Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManuel Coenen <manuel@duet3d.com>2021-01-19 18:09:51 +0300
committerManuel Coenen <manuel@duet3d.com>2021-01-19 18:09:51 +0300
commitb52fe6b5480ec8fdef388ca2273b038e3d2b334c (patch)
tree66ffdd242641f62c04eda234390bb7c171c9ddec /src
parent13f2a61c28178b8457361f05650c19b5c09e3c37 (diff)
Restore compilability for SAM4E/4S builds
Diffstat (limited to 'src')
-rw-r--r--src/Hardware/ExceptionHandlers.cpp6
-rw-r--r--src/Hardware/NonVolatileMemory.cpp12
-rw-r--r--src/Hardware/SharedSpi/SharedSpiDevice.cpp10
-rw-r--r--src/Platform.cpp4
-rw-r--r--src/RepRap.cpp6
5 files changed, 33 insertions, 5 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]);
diff --git a/src/Platform.cpp b/src/Platform.cpp
index b82d029c..4ba4ee43 100644
--- a/src/Platform.cpp
+++ b/src/Platform.cpp
@@ -876,7 +876,11 @@ void Platform::ReadUniqueId()
memset(uniqueId, 0, sizeof(uniqueId));
const bool cacheWasEnabled = Cache::Disable();
+#if SAME70
const bool success = Flash::ReadUniqueId(uniqueId);
+#else
+ const bool success = flash_read_unique_id(uniqueId) == 0;
+#endif
if (cacheWasEnabled)
{
Cache::Enable();
diff --git a/src/RepRap.cpp b/src/RepRap.cpp
index b93018d5..cfc787a6 100644
--- a/src/RepRap.cpp
+++ b/src/RepRap.cpp
@@ -2834,8 +2834,10 @@ void RepRap::StartIap() noexcept
WatchdogReset(); // kick the watchdog one last time
-#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
// Modify vector table location