diff --git a/features/netsocket/emac-drivers/TARGET_ARM_FM/COMPONENT_LAN91C111/fvp_emac.cpp b/features/netsocket/emac-drivers/TARGET_ARM_FM/COMPONENT_LAN91C111/fvp_emac.cpp index d5e51f453fa..95ec2bf34f0 100644 --- a/features/netsocket/emac-drivers/TARGET_ARM_FM/COMPONENT_LAN91C111/fvp_emac.cpp +++ b/features/netsocket/emac-drivers/TARGET_ARM_FM/COMPONENT_LAN91C111/fvp_emac.cpp @@ -26,6 +26,7 @@ #include "netsocket/nsapi_types.h" #include "mbed_shared_queues.h" +using namespace std::chrono; /******************************************************************************** * Internal data @@ -40,7 +41,7 @@ /** \brief Driver thread priority */ #define THREAD_PRIORITY (osPriorityNormal) -#define PHY_TASK_PERIOD_MS 200 +#define PHY_TASK_PERIOD 200ms fvp_EMAC::fvp_EMAC() : _thread(THREAD_PRIORITY, THREAD_STACKSIZE, NULL, "fvp_emac_thread") @@ -229,7 +230,7 @@ bool fvp_EMAC::power_up() /* Allow the PHY task to detect the initial link state and set up the proper flags */ ThisThread::sleep_for(10); - _phy_task_handle = mbed::mbed_event_queue()->call_every(PHY_TASK_PERIOD_MS, mbed::callback(this, &fvp_EMAC::phy_task)); + _phy_task_handle = mbed::mbed_event_queue()->call_every(PHY_TASK_PERIOD, mbed::callback(this, &fvp_EMAC::phy_task)); return true; } diff --git a/features/netsocket/emac-drivers/TARGET_Freescale_EMAC/kinetis_emac.cpp b/features/netsocket/emac-drivers/TARGET_Freescale_EMAC/kinetis_emac.cpp index 43bf2b45619..ae9f6afb906 100644 --- a/features/netsocket/emac-drivers/TARGET_Freescale_EMAC/kinetis_emac.cpp +++ b/features/netsocket/emac-drivers/TARGET_Freescale_EMAC/kinetis_emac.cpp @@ -48,6 +48,8 @@ #include "kinetis_emac.h" #include "mbed_power_mgmt.h" +using namespace std::chrono; + enet_handle_t g_handle; // TX Buffer descriptors uint8_t *tx_desc_start_addr; @@ -75,7 +77,7 @@ extern "C" void kinetis_init_eth_hardware(void); /** \brief Driver thread priority */ #define THREAD_PRIORITY (osPriorityNormal) -#define PHY_TASK_PERIOD_MS 200 +#define PHY_TASK_PERIOD 200ms Kinetis_EMAC::Kinetis_EMAC() : xTXDCountSem(ENET_TX_RING_LEN, ENET_TX_RING_LEN), hwaddr() { @@ -507,7 +509,7 @@ bool Kinetis_EMAC::power_up() /* Allow the PHY task to detect the initial link state and set up the proper flags */ osDelay(10); - phy_task_handle = mbed::mbed_event_queue()->call_every(PHY_TASK_PERIOD_MS, mbed::callback(this, &Kinetis_EMAC::phy_task)); + phy_task_handle = mbed::mbed_event_queue()->call_every(PHY_TASK_PERIOD, mbed::callback(this, &Kinetis_EMAC::phy_task)); return true; } diff --git a/features/netsocket/emac-drivers/TARGET_GD_EMAC/gd32xx_emac.cpp b/features/netsocket/emac-drivers/TARGET_GD_EMAC/gd32xx_emac.cpp index 5ab4a9c4ff9..f08c0410052 100644 --- a/features/netsocket/emac-drivers/TARGET_GD_EMAC/gd32xx_emac.cpp +++ b/features/netsocket/emac-drivers/TARGET_GD_EMAC/gd32xx_emac.cpp @@ -27,6 +27,8 @@ #include "gd32xx_emac.h" +using namespace std::chrono; + /* \brief Flags for worker thread */ #define _ENET_FLAG_RX (1) @@ -34,7 +36,7 @@ #define _THREAD_STACKSIZE (512) #define _THREAD_PRIORITY (osPriorityHigh) -#define _PHY_TASK_PERIOD_MS (200) +#define _PHY_TASK_PERIOD (200ms) #define _ENET_HW_ADDR_SIZE (6) #define _ENET_MTU_SIZE (1500) @@ -345,7 +347,7 @@ bool GD32_EMAC::power_up() /* Worker thread */ rx_thread = create_new_thread("gd32_emac_thread", &GD32_EMAC::thread_function, this, _THREAD_STACKSIZE, _THREAD_PRIORITY, &rx_thread_cb); - phy_task_handle = mbed::mbed_event_queue()->call_every(_PHY_TASK_PERIOD_MS, mbed::callback(this, &GD32_EMAC::phy_task)); + phy_task_handle = mbed::mbed_event_queue()->call_every(_PHY_TASK_PERIOD, mbed::callback(this, &GD32_EMAC::phy_task)); /* Allow the PHY task to detect the initial link state and set up the proper flags */ osDelay(10); diff --git a/features/netsocket/emac-drivers/TARGET_NUVOTON_EMAC/numaker_emac.cpp b/features/netsocket/emac-drivers/TARGET_NUVOTON_EMAC/numaker_emac.cpp index 32a886af2ee..945583e65b4 100644 --- a/features/netsocket/emac-drivers/TARGET_NUVOTON_EMAC/numaker_emac.cpp +++ b/features/netsocket/emac-drivers/TARGET_NUVOTON_EMAC/numaker_emac.cpp @@ -36,6 +36,8 @@ #include "numaker_emac.h" #include "numaker_eth_hal.h" +using namespace std::chrono; + /******************************************************************************** * ********************************************************************************/ @@ -53,7 +55,7 @@ extern "C" void numaker_eth_rx_next(void); /** \brief Driver thread priority */ #define THREAD_PRIORITY (osPriorityNormal) -#define PHY_TASK_PERIOD_MS 200 +#define PHY_TASK_PERIOD 200ms NUMAKER_EMAC::NUMAKER_EMAC() : thread(0), hwaddr() { @@ -331,7 +333,7 @@ bool NUMAKER_EMAC::power_up() /* PHY monitoring task */ phy_state = PHY_UNLINKED_STATE; - phy_task_handle = mbed::mbed_event_queue()->call_every(PHY_TASK_PERIOD_MS, mbed::callback(this, &NUMAKER_EMAC::phy_task)); + phy_task_handle = mbed::mbed_event_queue()->call_every(PHY_TASK_PERIOD, mbed::callback(this, &NUMAKER_EMAC::phy_task)); /* Allow the PHY task to detect the initial link state and set up the proper flags */ osDelay(10); diff --git a/features/netsocket/emac-drivers/TARGET_NXP_EMAC/TARGET_IMX/imx_emac.cpp b/features/netsocket/emac-drivers/TARGET_NXP_EMAC/TARGET_IMX/imx_emac.cpp index 0db56cb44cf..0077299f835 100644 --- a/features/netsocket/emac-drivers/TARGET_NXP_EMAC/TARGET_IMX/imx_emac.cpp +++ b/features/netsocket/emac-drivers/TARGET_NXP_EMAC/TARGET_IMX/imx_emac.cpp @@ -48,6 +48,8 @@ #include "imx_emac.h" #include "mbed_power_mgmt.h" +using namespace std::chrono; + enet_handle_t g_handle; // RX packet buffer pointers emac_mem_buf_t *rx_buff[ENET_RX_RING_LEN]; @@ -71,7 +73,7 @@ extern "C" void kinetis_init_eth_hardware(void); /** \brief Driver thread priority */ #define THREAD_PRIORITY (osPriorityNormal) -#define PHY_TASK_PERIOD_MS 200 +#define PHY_TASK_PERIOD 200ms Kinetis_EMAC::Kinetis_EMAC() : xTXDCountSem(ENET_TX_RING_LEN, ENET_TX_RING_LEN), hwaddr() { @@ -511,7 +513,7 @@ bool Kinetis_EMAC::power_up() /* Allow the PHY task to detect the initial link state and set up the proper flags */ osDelay(10); - phy_task_handle = mbed::mbed_event_queue()->call_every(PHY_TASK_PERIOD_MS, mbed::callback(this, &Kinetis_EMAC::phy_task)); + phy_task_handle = mbed::mbed_event_queue()->call_every(PHY_TASK_PERIOD, mbed::callback(this, &Kinetis_EMAC::phy_task)); return true; } diff --git a/features/netsocket/emac-drivers/TARGET_NXP_EMAC/TARGET_MCU_LPC546XX/lpc546xx_emac.cpp b/features/netsocket/emac-drivers/TARGET_NXP_EMAC/TARGET_MCU_LPC546XX/lpc546xx_emac.cpp index 937e2016a53..4fcffea7d87 100644 --- a/features/netsocket/emac-drivers/TARGET_NXP_EMAC/TARGET_MCU_LPC546XX/lpc546xx_emac.cpp +++ b/features/netsocket/emac-drivers/TARGET_NXP_EMAC/TARGET_MCU_LPC546XX/lpc546xx_emac.cpp @@ -31,6 +31,8 @@ #include "lpc546xx_emac_config.h" #include "lpc546xx_emac.h" +using namespace std::chrono; + enet_handle_t g_handle; // RX packet buffer pointers emac_mem_buf_t *rx_buff[ENET_RX_RING_LEN]; @@ -54,7 +56,7 @@ extern "C" void lpc546xx_init_eth_hardware(void); /** \brief Driver thread priority */ #define THREAD_PRIORITY (osPriorityNormal) -#define PHY_TASK_PERIOD_MS 200 +#define PHY_TASK_PERIOD 200ms LPC546XX_EMAC::LPC546XX_EMAC() : xTXDCountSem(ENET_TX_RING_LEN, ENET_TX_RING_LEN), hwaddr() { @@ -497,7 +499,7 @@ bool LPC546XX_EMAC::power_up() prev_state.speed = (phy_speed_t)STATE_UNKNOWN; prev_state.duplex = (phy_duplex_t)STATE_UNKNOWN; - phy_task_handle = mbed::mbed_event_queue()->call_every(PHY_TASK_PERIOD_MS, mbed::callback(this, &LPC546XX_EMAC::phy_task)); + phy_task_handle = mbed::mbed_event_queue()->call_every(PHY_TASK_PERIOD, mbed::callback(this, &LPC546XX_EMAC::phy_task)); /* Allow the PHY task to detect the initial link state and set up the proper flags */ osDelay(10); diff --git a/features/netsocket/emac-drivers/TARGET_STM/stm32xx_emac.cpp b/features/netsocket/emac-drivers/TARGET_STM/stm32xx_emac.cpp index c3294bd9d4c..98e2eca9945 100644 --- a/features/netsocket/emac-drivers/TARGET_STM/stm32xx_emac.cpp +++ b/features/netsocket/emac-drivers/TARGET_STM/stm32xx_emac.cpp @@ -52,13 +52,15 @@ #include "lwip/api.h" #endif +using namespace std::chrono; + /* \brief Flags for worker thread */ #define FLAG_RX 1 /** \brief Driver thread priority */ #define THREAD_PRIORITY (osPriorityHigh) -#define PHY_TASK_PERIOD_MS 200 +#define PHY_TASK_PERIOD 200ms #define STM_HWADDR_SIZE (6) #define STM_ETH_MTU_SIZE 1500 @@ -890,7 +892,7 @@ bool STM32_EMAC::power_up() #endif - phy_task_handle = mbed::mbed_event_queue()->call_every(PHY_TASK_PERIOD_MS, mbed::callback(this, &STM32_EMAC::phy_task)); + phy_task_handle = mbed::mbed_event_queue()->call_every(PHY_TASK_PERIOD, mbed::callback(this, &STM32_EMAC::phy_task)); #if defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx)\ || defined (STM32F779xx)