diff options
author | David Crocker <dcrocker@eschertech.com> | 2022-09-20 22:47:13 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2022-09-23 15:47:03 +0300 |
commit | de9eede5f17bc6adf8c058e7ab227ed2161c94bc (patch) | |
tree | 4a4066e9431077fb196ea9718fccf659a958d818 | |
parent | b30426ffd005721ba226d5e67a40a4883f24dd36 (diff) |
Moved wifi transfer buffers into non-cached RAM on SAME70
-rw-r--r-- | src/Networking/ESP8266WiFi/WiFiInterface.cpp | 13 | ||||
-rw-r--r-- | src/Networking/ESP8266WiFi/WiFiInterface.h | 24 |
2 files changed, 23 insertions, 14 deletions
diff --git a/src/Networking/ESP8266WiFi/WiFiInterface.cpp b/src/Networking/ESP8266WiFi/WiFiInterface.cpp index ba4aec9a..a0ca3dbe 100644 --- a/src/Networking/ESP8266WiFi/WiFiInterface.cpp +++ b/src/Networking/ESP8266WiFi/WiFiInterface.cpp @@ -25,7 +25,7 @@ static_assert(SsidLength == SsidBufferLength, "SSID lengths in NetworkDefs.h and // Define exactly one of the following as 1, the other as zero -#if defined(DUET_NG) +#if SAM4E # include <pmc/pmc.h> # include <spi/spi.h> @@ -36,7 +36,7 @@ static_assert(SsidLength == SsidBufferLength, "SSID lengths in NetworkDefs.h and # define USE_DMAC_MANAGER 0 // use SAMD/SAME DMA controller via DmacManager module # define USE_XDMAC 0 // use SAME7 XDMA controller -#elif defined(DUET3_MB6HC) +#elif SAME70 # include <pmc/pmc.h> # include <spi/spi.h> @@ -47,6 +47,9 @@ static_assert(SsidLength == SsidBufferLength, "SSID lengths in NetworkDefs.h and # define USE_DMAC_MANAGER 0 // use SAMD/SAME DMA controller via DmacManager module # define USE_XDMAC 1 // use SAME7 XDMA controller +static __nocache MessageBufferOut messageBufferOut; +static __nocache MessageBufferIn messageBufferIn; + #elif SAME5x # include <DmacManager.h> @@ -467,8 +470,14 @@ void WiFiInterface::Activate() noexcept { activated = true; +#if SAME70 + bufferOut = &messageBufferOut; + bufferIn = &messageBufferIn; +#else bufferOut = new MessageBufferOut; bufferIn = new MessageBufferIn; +#endif + #if HAS_MASS_STORAGE || HAS_EMBEDDED_FILES uploader = new WifiFirmwareUploader(SERIAL_WIFI_DEVICE, *this); #endif diff --git a/src/Networking/ESP8266WiFi/WiFiInterface.h b/src/Networking/ESP8266WiFi/WiFiInterface.h index 5776f1e6..42a41f9b 100644 --- a/src/Networking/ESP8266WiFi/WiFiInterface.h +++ b/src/Networking/ESP8266WiFi/WiFiInterface.h @@ -32,6 +32,18 @@ private: uint32_t padding; }; +struct MessageBufferOut +{ + MessageHeaderSamToEsp hdr; + uint8_t data[MaxDataLength]; // data to send +}; + +struct alignas(16) MessageBufferIn +{ + MessageHeaderEspToSam hdr; + uint8_t data[MaxDataLength]; // data to send +}; + // The main network class that drives the network. class WiFiInterface : public NetworkInterface { @@ -123,18 +135,6 @@ private: bool lastDataReadyPinState; uint8_t risingEdges; - struct MessageBufferOut - { - MessageHeaderSamToEsp hdr; - uint8_t data[MaxDataLength]; // data to send - }; - - struct alignas(16) MessageBufferIn - { - MessageHeaderEspToSam hdr; - uint8_t data[MaxDataLength]; // data to send - }; - MessageBufferOut *bufferOut; MessageBufferIn *bufferIn; |