diff options
author | David Crocker <dcrocker@eschertech.com> | 2019-12-10 18:03:11 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2019-12-10 18:03:11 +0300 |
commit | b7daa1866c654eefe9d1427fd5d2c68b476d7cd7 (patch) | |
tree | c9ca30e6f07acd55061236c820469e794111fb14 /src/Networking/LwipEthernet/GMAC | |
parent | d4342a41d2972c20892c793f2ce015e6eafc70ed (diff) |
Added more noexcept specifiers
Diffstat (limited to 'src/Networking/LwipEthernet/GMAC')
-rw-r--r-- | src/Networking/LwipEthernet/GMAC/ethernet_sam.cpp | 20 | ||||
-rw-r--r-- | src/Networking/LwipEthernet/GMAC/ethernet_sam.h | 20 | ||||
-rw-r--r-- | src/Networking/LwipEthernet/GMAC/same70_gmac.cpp | 36 | ||||
-rw-r--r-- | src/Networking/LwipEthernet/GMAC/same70_gmac.h | 18 |
4 files changed, 47 insertions, 47 deletions
diff --git a/src/Networking/LwipEthernet/GMAC/ethernet_sam.cpp b/src/Networking/LwipEthernet/GMAC/ethernet_sam.cpp index e706a153..d4301e93 100644 --- a/src/Networking/LwipEthernet/GMAC/ethernet_sam.cpp +++ b/src/Networking/LwipEthernet/GMAC/ethernet_sam.cpp @@ -89,14 +89,14 @@ static timers_info_t gs_timers_table[] = { #endif }; -extern uint32_t millis(); +extern uint32_t millis() noexcept; } // end extern "C" /** * \brief Process timing functions. */ -void ethernet_timers_update(void) +void ethernet_timers_update(void) noexcept { static uint32_t ul_last_time; uint32_t ul_cur_time, ul_time_diff, ul_idx_timer; @@ -127,7 +127,7 @@ void ethernet_timers_update(void) //************************************************************************************************************ // This sets the static IP configuration on-the-fly -void ethernet_set_configuration(IPAddress ipAddress, IPAddress netMask, IPAddress gateWay) +void ethernet_set_configuration(IPAddress ipAddress, IPAddress netMask, IPAddress gateWay) noexcept { ip4_addr_t x_ip_addr, x_net_mask, x_gateway; x_ip_addr.addr = ipAddress.GetV4LittleEndian(); @@ -143,7 +143,7 @@ void ethernet_set_configuration(IPAddress ipAddress, IPAddress netMask, IPAddres /** \brief Initialize the Ethernet subsystem. * */ -void init_ethernet(IPAddress ipAddress, IPAddress netMask, IPAddress gateWay) +void init_ethernet(IPAddress ipAddress, IPAddress netMask, IPAddress gateWay) noexcept { ip4_addr_t x_ip_addr, x_net_mask, x_gateway; x_ip_addr.addr = ipAddress.GetV4LittleEndian(); @@ -169,7 +169,7 @@ void init_ethernet(IPAddress ipAddress, IPAddress netMask, IPAddress gateWay) /** \brief Configure the Ethernet subsystem. Should be called after init_ethernet() * */ -void ethernet_configure_interface(const uint8_t macAddress[], const char *hostname) +void ethernet_configure_interface(const uint8_t macAddress[], const char *hostname) noexcept { ethernetif_set_mac_address(macAddress); @@ -181,7 +181,7 @@ void ethernet_configure_interface(const uint8_t macAddress[], const char *hostna /* \brief Perform ethernet auto-negotiation and establish link. Returns true when ready * */ -bool ethernet_establish_link(void) +bool ethernet_establish_link() noexcept { if (ethernetif_establish_link()) { @@ -194,7 +194,7 @@ bool ethernet_establish_link(void) /* \brief Is the link still up? Also updates the interface status if the link has gone down * */ -bool ethernet_link_established(void) +bool ethernet_link_established() noexcept { if (!ethernetif_link_established()) { @@ -210,7 +210,7 @@ bool ethernet_link_established(void) * * \return Returns true if data has been processed. */ -void ethernet_task(void) +void ethernet_task() noexcept { #if !LWIP_GMAC_TASK /* Run polling tasks */ @@ -229,7 +229,7 @@ void ethernet_task(void) * * \param callback The callback to be called when a new packet is ready */ -void ethernet_set_rx_callback(gmac_dev_tx_cb_t callback) +void ethernet_set_rx_callback(gmac_dev_tx_cb_t callback) noexcept { ethernetif_set_rx_callback(callback); } @@ -238,7 +238,7 @@ void ethernet_set_rx_callback(gmac_dev_tx_cb_t callback) /* * \brief Returns the current IP address */ -void ethernet_get_ipaddress(IPAddress& ipAddress, IPAddress& netMask, IPAddress& gateWay) +void ethernet_get_ipaddress(IPAddress& ipAddress, IPAddress& netMask, IPAddress& gateWay) noexcept { ipAddress.SetV4LittleEndian(gs_net_if.ip_addr.addr); netMask.SetV4LittleEndian(gs_net_if.netmask.addr); diff --git a/src/Networking/LwipEthernet/GMAC/ethernet_sam.h b/src/Networking/LwipEthernet/GMAC/ethernet_sam.h index 06516e19..c1948803 100644 --- a/src/Networking/LwipEthernet/GMAC/ethernet_sam.h +++ b/src/Networking/LwipEthernet/GMAC/ethernet_sam.h @@ -52,35 +52,35 @@ #include "lwip/netif.h" // Perform low-level initialisation of the network interface -void init_ethernet(IPAddress ipAddress, IPAddress netMask, IPAddress gateWay); +void init_ethernet(IPAddress ipAddress, IPAddress netMask, IPAddress gateWay) noexcept; // Terminate Ethernet and stop any interrupts, tasks etc. Used when shutting down the whole system. -inline void ethernet_terminate() { ethernetif_terminate(); } +inline void ethernet_terminate() noexcept { ethernetif_terminate(); } // Configure the ethernet interface -void ethernet_configure_interface(const uint8_t macAddress[], const char *hostname); +void ethernet_configure_interface(const uint8_t macAddress[], const char *hostname) noexcept; // Perform ethernet auto-negotiation and establish link. Returns true when ready -bool ethernet_establish_link(void); +bool ethernet_establish_link() noexcept; // Is the link still up? Also updates the interface status if the link has gone down -bool ethernet_link_established(void); +bool ethernet_link_established() noexcept; // Update IPv4 configuration on demand -void ethernet_set_configuration(IPAddress ipAddress, IPAddress netMask, IPAddress gateWay); +void ethernet_set_configuration(IPAddress ipAddress, IPAddress netMask, IPAddress gateWay) noexcept; // Must be called periodically to keep the LwIP timers running -void ethernet_timers_update(void); +void ethernet_timers_update() noexcept; // Reads all stored network packets and processes them -void ethernet_task(void); +void ethernet_task() noexcept; #if !LWIP_GMAC_TASK // Set the RX callback for incoming network packets -void ethernet_set_rx_callback(gmac_dev_tx_cb_t callback); +void ethernet_set_rx_callback(gmac_dev_tx_cb_t callback) noexcept; #endif // Returns the network interface's current IPv4 address -void ethernet_get_ipaddress(IPAddress& ipAddress, IPAddress& netMask, IPAddress& gateWay); +void ethernet_get_ipaddress(IPAddress& ipAddress, IPAddress& netMask, IPAddress& gateWay) noexcept; #endif /* ETHERNET_SAM_H_INCLUDED */ diff --git a/src/Networking/LwipEthernet/GMAC/same70_gmac.cpp b/src/Networking/LwipEthernet/GMAC/same70_gmac.cpp index 863f4018..2565fe79 100644 --- a/src/Networking/LwipEthernet/GMAC/same70_gmac.cpp +++ b/src/Networking/LwipEthernet/GMAC/same70_gmac.cpp @@ -176,7 +176,7 @@ static gmac_dev_tx_cb_t gmac_rx_cb = nullptr; /** * \brief GMAC interrupt handler. */ -void GMAC_Handler(void) +extern "C" void GMAC_Handler() noexcept { #if LWIP_GMAC_TASK /* Get interrupt status. */ @@ -214,7 +214,7 @@ void GMAC_Handler(void) * \param p_gmac_dev Pointer to driver data structure. * \param startAt The index to start populating from */ -static void gmac_rx_populate_queue(struct gmac_device *p_gmac_dev, uint32_t startAt) +static void gmac_rx_populate_queue(struct gmac_device *p_gmac_dev, uint32_t startAt) noexcept { uint32_t ul_index = startAt; @@ -278,7 +278,7 @@ static void gmac_rx_populate_queue(struct gmac_device *p_gmac_dev, uint32_t star * * \param ps_gmac_dev Pointer to driver data structure. */ -static void gmac_rx_init(struct gmac_device *ps_gmac_dev) +static void gmac_rx_init(struct gmac_device *ps_gmac_dev) noexcept { uint32_t ul_index = 0; @@ -308,7 +308,7 @@ static void gmac_rx_init(struct gmac_device *ps_gmac_dev) * * \param ps_gmac_dev Pointer to driver data structure. */ -static void gmac_tx_init(struct gmac_device *ps_gmac_dev) +static void gmac_tx_init(struct gmac_device *ps_gmac_dev) noexcept { uint32_t ul_index; @@ -334,7 +334,7 @@ static void gmac_tx_init(struct gmac_device *ps_gmac_dev) * * \param netif the lwIP network interface structure for this ethernetif. */ -static void gmac_low_level_init(struct netif *netif) +static void gmac_low_level_init(struct netif *netif) noexcept { #if 0 // chrishamm volatile uint32_t ul_delay; @@ -402,7 +402,7 @@ static void gmac_low_level_init(struct netif *netif) * \return ERR_OK if the packet could be sent. * an err_t value if the packet couldn't be sent. */ -static err_t gmac_low_level_output(netif *p_netif, struct pbuf *p) +static err_t gmac_low_level_output(netif *p_netif, struct pbuf *p) noexcept { gmac_device *const ps_gmac_dev = static_cast<gmac_device *>(p_netif->state); @@ -482,7 +482,7 @@ static err_t gmac_low_level_output(netif *p_netif, struct pbuf *p) * \return a pbuf filled with the received packet (including MAC header). * 0 on memory error. */ -static pbuf *gmac_low_level_input(struct netif *netif) +static pbuf *gmac_low_level_input(struct netif *netif) noexcept { gmac_device *ps_gmac_dev = static_cast<gmac_device *>(netif->state); @@ -565,7 +565,7 @@ static pbuf *gmac_low_level_input(struct netif *netif) * * \param pvParameters A pointer to the gmac_device instance. */ -extern "C" [[noreturn]] void gmac_task(void *pvParameters) +extern "C" [[noreturn]] void gmac_task(void *pvParameters) noexcept { gmac_device * const ps_gmac_dev = static_cast<gmac_device*>(pvParameters); netif * const p_netif = ps_gmac_dev->netif; @@ -593,7 +593,7 @@ extern "C" [[noreturn]] void gmac_task(void *pvParameters) * * \param netif the lwIP network interface structure for this ethernetif. */ -bool ethernetif_input(struct netif *netif) +bool ethernetif_input(struct netif *netif) noexcept { struct eth_hdr *ethhdr; struct pbuf *p; @@ -642,7 +642,7 @@ bool ethernetif_input(struct netif *netif) * ERR_MEM if private data couldn't be allocated. * any other err_t on error. */ -err_t ethernetif_init(struct netif *netif) +err_t ethernetif_init(struct netif *netif) noexcept { LWIP_ASSERT("netif != NULL", (netif != NULL)); @@ -683,7 +683,7 @@ err_t ethernetif_init(struct netif *netif) return ERR_OK; } -void ethernetif_hardware_init(void) +void ethernetif_hardware_init() noexcept { /* Enable GMAC clock. */ pmc_enable_periph_clk(ID_GMAC); @@ -767,7 +767,7 @@ void ethernetif_hardware_init(void) NVIC_EnableIRQ(GMAC_IRQn); } -bool ethernetif_establish_link(void) +bool ethernetif_establish_link() noexcept { /* Auto Negotiate, work in RMII mode. */ uint8_t result = ethernet_phy_auto_negotiate(GMAC, BOARD_GMAC_PHY_ADDR); @@ -790,7 +790,7 @@ bool ethernetif_establish_link(void) } // Ask the PHY if the link is still up -bool ethernetif_link_established(void) +bool ethernetif_link_established() noexcept { gmac_enable_management(GMAC, true); @@ -810,13 +810,13 @@ bool ethernetif_link_established(void) } #if !LWIP_GMAC_TASK -void ethernetif_set_rx_callback(gmac_dev_tx_cb_t callback) +void ethernetif_set_rx_callback(gmac_dev_tx_cb_t callback) noexcept { gmac_rx_cb = callback; } #endif -void ethernetif_set_mac_address(const uint8_t macAddress[]) +void ethernetif_set_mac_address(const uint8_t macAddress[]) noexcept { // This function must be called once before low_level_init(), because that is where the // MAC address of the netif is assigned @@ -827,7 +827,7 @@ void ethernetif_set_mac_address(const uint8_t macAddress[]) } // This is called when we shut down -void ethernetif_terminate() +void ethernetif_terminate() noexcept { NVIC_DisableIRQ(GMAC_IRQn); #if LWIP_GMAC_TASK @@ -835,9 +835,9 @@ void ethernetif_terminate() #endif } -extern "C" u32_t millis(); +extern "C" u32_t millis() noexcept; -extern "C" u32_t sys_now(void) +extern "C" u32_t sys_now() noexcept { return millis(); } diff --git a/src/Networking/LwipEthernet/GMAC/same70_gmac.h b/src/Networking/LwipEthernet/GMAC/same70_gmac.h index 6d494faf..8d6bd595 100644 --- a/src/Networking/LwipEthernet/GMAC/same70_gmac.h +++ b/src/Networking/LwipEthernet/GMAC/same70_gmac.h @@ -57,24 +57,24 @@ extern "C" { #ifdef __cplusplus } -err_t ethernetif_init(struct netif *netif); // called by LwIP to initialise the interface +err_t ethernetif_init(struct netif *netif) noexcept; // called by LwIP to initialise the interface -void ethernetif_terminate(); // called when we shut down +void ethernetif_terminate() noexcept; // called when we shut down -bool ethernetif_input(struct netif *netif); // checks for a new packet and returns true if one was processed +bool ethernetif_input(struct netif *netif) noexcept; // checks for a new packet and returns true if one was processed -void ethernetif_hardware_init(void); // initialises the low-level hardware interface +void ethernetif_hardware_init() noexcept; // initialises the low-level hardware interface -bool ethernetif_establish_link(void); // attempts to establish link and returns true on success +bool ethernetif_establish_link() noexcept; // attempts to establish link and returns true on success -bool ethernetif_link_established(void); // asks the PHY if the link is still up +bool ethernetif_link_established() noexcept; // asks the PHY if the link is still up #if !LWIP_GMAC_TASK -typedef void (*gmac_dev_tx_cb_t) (uint32_t ul_status); // copied from gmac_raw.h -void ethernetif_set_rx_callback(gmac_dev_tx_cb_t callback); +typedef void (*gmac_dev_tx_cb_t) (uint32_t ul_status) noexcept; // copied from gmac_raw.h +void ethernetif_set_rx_callback(gmac_dev_tx_cb_t callback) noexcept; #endif -void ethernetif_set_mac_address(const uint8_t macAddress[]); +void ethernetif_set_mac_address(const uint8_t macAddress[]) noexcept; #endif |