diff options
author | Manuel Coenen <manuel@duet3d.com> | 2021-01-19 18:09:51 +0300 |
---|---|---|
committer | Manuel Coenen <manuel@duet3d.com> | 2021-01-19 18:09:51 +0300 |
commit | b52fe6b5480ec8fdef388ca2273b038e3d2b334c (patch) | |
tree | 66ffdd242641f62c04eda234390bb7c171c9ddec /src/Hardware | |
parent | 13f2a61c28178b8457361f05650c19b5c09e3c37 (diff) |
Restore compilability for SAM4E/4S builds
Diffstat (limited to 'src/Hardware')
-rw-r--r-- | src/Hardware/ExceptionHandlers.cpp | 6 | ||||
-rw-r--r-- | src/Hardware/NonVolatileMemory.cpp | 12 | ||||
-rw-r--r-- | src/Hardware/SharedSpi/SharedSpiDevice.cpp | 10 |
3 files changed, 25 insertions, 3 deletions
diff --git a/src/Hardware/ExceptionHandlers.cpp b/src/Hardware/ExceptionHandlers.cpp index c1fa5186..17c5c4b5 100644 --- a/src/Hardware/ExceptionHandlers.cpp +++ b/src/Hardware/ExceptionHandlers.cpp @@ -20,8 +20,10 @@ cpu_irq_disable(); // disable interrupts before we call any flash functions. We don't enable them again. WatchdogReset(); // kick the watchdog -#if SAM4E || SAME70 - WatchdogResetSecondary(); // kick the secondary watchdog +#if SAM4E + rswdt_restart(RSWDT); // kick the secondary watchdog +#elif SAME70 + WatchdogResetSecondary(); // kick the secondary watchdog #endif Cache::Disable(); diff --git a/src/Hardware/NonVolatileMemory.cpp b/src/Hardware/NonVolatileMemory.cpp index 45aee49e..e0ef6d85 100644 --- a/src/Hardware/NonVolatileMemory.cpp +++ b/src/Hardware/NonVolatileMemory.cpp @@ -27,7 +27,11 @@ void NonVolatileMemory::EnsureRead() noexcept # error //TODO #elif SAM4E || SAM4S || SAME70 const bool cacheEnabled = Cache::Disable(); +# if SAME70 Flash::ReadUserSignature(reinterpret_cast<uint32_t*>(&buffer), sizeof(buffer)/sizeof(uint32_t)); +# else + flash_read_user_signature(reinterpret_cast<uint32_t*>(&buffer), sizeof(buffer)/sizeof(uint32_t)); +# endif if (cacheEnabled) { Cache::Enable(); @@ -66,7 +70,11 @@ void NonVolatileMemory::EnsureWritten() noexcept { // Erase the page # if SAM4E || SAM4S || SAME70 +# if SAME70 Flash::EraseUserSignature(); +# else + flash_erase_user_signature(); +# endif # elif defined(__LPC17xx__) LPC_EraseSoftwareResetDataSlots(); // erase the last flash sector # endif @@ -77,7 +85,11 @@ void NonVolatileMemory::EnsureWritten() noexcept { # if SAM4E || SAM4S || SAME70 const bool cacheEnabled = Cache::Disable(); +# if SAME70 Flash::WriteUserSignature(reinterpret_cast<const uint32_t*>(&buffer)); +# else + flash_write_user_signature(reinterpret_cast<const uint32_t*>(&buffer)); +# endif if (cacheEnabled) { Cache::Enable(); diff --git a/src/Hardware/SharedSpi/SharedSpiDevice.cpp b/src/Hardware/SharedSpi/SharedSpiDevice.cpp index c7c9c4d2..cc6a6783 100644 --- a/src/Hardware/SharedSpi/SharedSpiDevice.cpp +++ b/src/Hardware/SharedSpi/SharedSpiDevice.cpp @@ -15,7 +15,9 @@ # include <peripheral_clk_config.h> # include <hri_sercom_e54.h> #elif USART_SPI -# include <pmc/pmc.h> +# if SAME70 +# include <pmc/pmc.h> +# endif # include <usart/usart.h> #else # include <spi/spi.h> @@ -345,9 +347,15 @@ void SharedSpiDevice::Init() noexcept SetPinFunction(SharedSpiSclkPin, SharedSpiPinFunction); mainSharedSpiDevice = new SharedSpiDevice(SharedSpiSercomNumber); #elif USART_SPI +# if SAME70 SetPinFunction(APIN_USART_SSPI_SCK, USARTSSPIPeriphMode); SetPinFunction(APIN_USART_SSPI_MOSI, USARTSSPIPeriphMode); SetPinFunction(APIN_USART_SSPI_MISO, USARTSSPIPeriphMode); +# else + ConfigurePin(APIN_USART_SSPI_SCK); + ConfigurePin(APIN_USART_SSPI_MOSI); + ConfigurePin(APIN_USART_SSPI_MISO); +#endif mainSharedSpiDevice = new SharedSpiDevice(0); #else ConfigurePin(g_APinDescription[APIN_SHARED_SPI_SCK]); |