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
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2019-10-26 11:46:31 +0300
committerDavid Crocker <dcrocker@eschertech.com>2019-10-26 11:46:31 +0300
commit587f49d5699a6a0fc3cb8307e17dd5c2fa43f73b (patch)
tree311cc1342502b74cad2808ee6bf4e9cb66a7ac4c /src/Networking/LwipEthernet/LwipEthernetInterface.cpp
parentc25d73194252791ceb479ced79ffc77b31c810fe (diff)
Cached memory and Lwip networking changes
Put CAN, GMAC and some DMA buffers in new .ram_nocache memory section (needs new linker script in CoreNG) Added option to use separate Ethernet GMAC task (not working yet, so disabled - see LWIP_GMAC_TASK in compiler settings) Added code to set up non-cached memory usnig MPU (not working yet, so disabled)
Diffstat (limited to 'src/Networking/LwipEthernet/LwipEthernetInterface.cpp')
-rw-r--r--src/Networking/LwipEthernet/LwipEthernetInterface.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/Networking/LwipEthernet/LwipEthernetInterface.cpp b/src/Networking/LwipEthernet/LwipEthernetInterface.cpp
index f0f00961..c9e14533 100644
--- a/src/Networking/LwipEthernet/LwipEthernetInterface.cpp
+++ b/src/Networking/LwipEthernet/LwipEthernetInterface.cpp
@@ -49,7 +49,10 @@ static LwipEthernetInterface *ethernetInterface;
extern "C"
{
static volatile bool lwipLocked = false;
+
+#if !LWIP_GMAC_TASK
static volatile bool resetCallback = false;
+#endif
// Lock functions for LwIP (LwIP isn't thread-safe when working with the raw API)
bool LockLWIP()
@@ -70,6 +73,8 @@ void UnlockLWIP()
// Callback functions for the GMAC driver and for LwIP
+#if !LWIP_GMAC_TASK
+
// Called from ISR
static void ethernet_rx_callback(uint32_t ul_status)
{
@@ -87,15 +92,20 @@ static void ethernet_rx_callback(uint32_t ul_status)
}
}
+#endif
+
// Task function to keep the GMAC and LwIP running
void DoEthernetTask()
{
ethernet_task();
+
+#if !LWIP_GMAC_TASK
if (resetCallback)
{
resetCallback = false;
ethernet_set_rx_callback(&ethernet_rx_callback);
}
+#endif
}
// Callback functions for LWIP (may be called from ISR)
@@ -385,7 +395,9 @@ void LwipEthernetInterface::Start()
initialised = true;
}
+#if !LWIP_GMAC_TASK
resetCallback = true; // reset EMAC RX callback on next Spin call
+#endif
state = NetworkState::establishingLink;
}
@@ -395,7 +407,9 @@ void LwipEthernetInterface::Stop()
if (state != NetworkState::disabled)
{
netif_set_down(&gs_net_if);
+#if !LWIP_GMAC_TASK
resetCallback = false;
+#endif
ethernet_set_rx_callback(nullptr);
#if defined(DUET3)
@@ -520,11 +534,13 @@ void LwipEthernetInterface::Spin(bool full)
void LwipEthernetInterface::Interrupt()
{
+#if !LWIP_GMAC_TASK
if (initialised && LockLWIP())
{
ethernet_timers_update();
UnlockLWIP();
}
+#endif
}
void LwipEthernetInterface::Diagnostics(MessageType mtype)