diff options
author | David Crocker <dcrocker@eschertech.com> | 2019-12-09 22:47:33 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2019-12-09 22:47:33 +0300 |
commit | 14db90f06f74494ee811cf1ae4f12190756ed2ca (patch) | |
tree | c5c8332e39db09a5df8c4475cfc03e184ed46016 /src/Networking/LwipEthernet | |
parent | bf7be88b40ee5b48aacd4d78917cfaa94f7aa3d2 (diff) |
Support loading IAP in RAM
Support loading IAP in RAM instead of flash, to make more flash memory available for the main firmware
Diffstat (limited to 'src/Networking/LwipEthernet')
-rw-r--r-- | src/Networking/LwipEthernet/GMAC/ethernet_sam.h | 3 | ||||
-rw-r--r-- | src/Networking/LwipEthernet/GMAC/same70_gmac.cpp | 13 | ||||
-rw-r--r-- | src/Networking/LwipEthernet/GMAC/same70_gmac.h | 12 | ||||
-rw-r--r-- | src/Networking/LwipEthernet/LwipEthernetInterface.cpp | 1 |
4 files changed, 19 insertions, 10 deletions
diff --git a/src/Networking/LwipEthernet/GMAC/ethernet_sam.h b/src/Networking/LwipEthernet/GMAC/ethernet_sam.h index 23266cf3..06516e19 100644 --- a/src/Networking/LwipEthernet/GMAC/ethernet_sam.h +++ b/src/Networking/LwipEthernet/GMAC/ethernet_sam.h @@ -54,6 +54,9 @@ // Perform low-level initialisation of the network interface void init_ethernet(IPAddress ipAddress, IPAddress netMask, IPAddress gateWay); +// Terminate Ethernet and stop any interrupts, tasks etc. Used when shutting down the whole system. +inline void ethernet_terminate() { ethernetif_terminate(); } + // Configure the ethernet interface void ethernet_configure_interface(const uint8_t macAddress[], const char *hostname); diff --git a/src/Networking/LwipEthernet/GMAC/same70_gmac.cpp b/src/Networking/LwipEthernet/GMAC/same70_gmac.cpp index 895f7d22..863f4018 100644 --- a/src/Networking/LwipEthernet/GMAC/same70_gmac.cpp +++ b/src/Networking/LwipEthernet/GMAC/same70_gmac.cpp @@ -683,8 +683,6 @@ err_t ethernetif_init(struct netif *netif) return ERR_OK; } -#if 1 // chrishamm - void ethernetif_hardware_init(void) { /* Enable GMAC clock. */ @@ -828,6 +826,15 @@ void ethernetif_set_mac_address(const uint8_t macAddress[]) } } +// This is called when we shut down +void ethernetif_terminate() +{ + NVIC_DisableIRQ(GMAC_IRQn); +#if LWIP_GMAC_TASK + ethernetTask.TerminateAndUnlink(); +#endif +} + extern "C" u32_t millis(); extern "C" u32_t sys_now(void) @@ -835,4 +842,4 @@ extern "C" u32_t sys_now(void) return millis(); } -#endif +// End diff --git a/src/Networking/LwipEthernet/GMAC/same70_gmac.h b/src/Networking/LwipEthernet/GMAC/same70_gmac.h index 7c676ff7..6d494faf 100644 --- a/src/Networking/LwipEthernet/GMAC/same70_gmac.h +++ b/src/Networking/LwipEthernet/GMAC/same70_gmac.h @@ -54,12 +54,14 @@ extern "C" { #include "lwip/netif.h" #include "netif/etharp.h" -err_t ethernetif_init(struct netif *netif); // called by LwIP to initialise the interface +#ifdef __cplusplus +} -bool ethernetif_input(struct netif *netif); // checks for a new packet and returns true if one was processed +err_t ethernetif_init(struct netif *netif); // called by LwIP to initialise the interface +void ethernetif_terminate(); // called when we shut down -#if 1 // chrishamm +bool ethernetif_input(struct netif *netif); // checks for a new packet and returns true if one was processed void ethernetif_hardware_init(void); // initialises the low-level hardware interface @@ -76,10 +78,6 @@ void ethernetif_set_mac_address(const uint8_t macAddress[]); #endif -#ifdef __cplusplus -} -#endif - // Error counters extern unsigned int rxErrorCount; extern unsigned int rxBuffersNotFullyPopulatedCount; diff --git a/src/Networking/LwipEthernet/LwipEthernetInterface.cpp b/src/Networking/LwipEthernet/LwipEthernetInterface.cpp index f32bf251..79378030 100644 --- a/src/Networking/LwipEthernet/LwipEthernetInterface.cpp +++ b/src/Networking/LwipEthernet/LwipEthernetInterface.cpp @@ -360,6 +360,7 @@ void LwipEthernetInterface::Activate() void LwipEthernetInterface::Exit() { Stop(); + ethernet_terminate(); } // Get the network state into the reply buffer, returning true if there is some sort of error |