Fix compilation warnings by using the Chrono based time argument in EventQueue call_every() API call.

pull/13142/head
Rajkumar Kanagaraj 2020-06-17 17:09:37 +01:00
parent b1629b7e59
commit 28e44ac6f8
7 changed files with 27 additions and 14 deletions

View File

@ -26,6 +26,7 @@
#include "netsocket/nsapi_types.h" #include "netsocket/nsapi_types.h"
#include "mbed_shared_queues.h" #include "mbed_shared_queues.h"
using namespace std::chrono;
/******************************************************************************** /********************************************************************************
* Internal data * Internal data
@ -40,7 +41,7 @@
/** \brief Driver thread priority */ /** \brief Driver thread priority */
#define THREAD_PRIORITY (osPriorityNormal) #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") 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 */ /* Allow the PHY task to detect the initial link state and set up the proper flags */
ThisThread::sleep_for(10); 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; return true;
} }

View File

@ -48,6 +48,8 @@
#include "kinetis_emac.h" #include "kinetis_emac.h"
#include "mbed_power_mgmt.h" #include "mbed_power_mgmt.h"
using namespace std::chrono;
enet_handle_t g_handle; enet_handle_t g_handle;
// TX Buffer descriptors // TX Buffer descriptors
uint8_t *tx_desc_start_addr; uint8_t *tx_desc_start_addr;
@ -75,7 +77,7 @@ extern "C" void kinetis_init_eth_hardware(void);
/** \brief Driver thread priority */ /** \brief Driver thread priority */
#define THREAD_PRIORITY (osPriorityNormal) #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() 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 */ /* Allow the PHY task to detect the initial link state and set up the proper flags */
osDelay(10); 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; return true;
} }

View File

@ -27,6 +27,8 @@
#include "gd32xx_emac.h" #include "gd32xx_emac.h"
using namespace std::chrono;
/* \brief Flags for worker thread */ /* \brief Flags for worker thread */
#define _ENET_FLAG_RX (1) #define _ENET_FLAG_RX (1)
@ -34,7 +36,7 @@
#define _THREAD_STACKSIZE (512) #define _THREAD_STACKSIZE (512)
#define _THREAD_PRIORITY (osPriorityHigh) #define _THREAD_PRIORITY (osPriorityHigh)
#define _PHY_TASK_PERIOD_MS (200) #define _PHY_TASK_PERIOD (200ms)
#define _ENET_HW_ADDR_SIZE (6) #define _ENET_HW_ADDR_SIZE (6)
#define _ENET_MTU_SIZE (1500) #define _ENET_MTU_SIZE (1500)
@ -345,7 +347,7 @@ bool GD32_EMAC::power_up()
/* Worker thread */ /* Worker thread */
rx_thread = create_new_thread("gd32_emac_thread", &GD32_EMAC::thread_function, this, _THREAD_STACKSIZE, _THREAD_PRIORITY, &rx_thread_cb); 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 */ /* Allow the PHY task to detect the initial link state and set up the proper flags */
osDelay(10); osDelay(10);

View File

@ -36,6 +36,8 @@
#include "numaker_emac.h" #include "numaker_emac.h"
#include "numaker_eth_hal.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 */ /** \brief Driver thread priority */
#define THREAD_PRIORITY (osPriorityNormal) #define THREAD_PRIORITY (osPriorityNormal)
#define PHY_TASK_PERIOD_MS 200 #define PHY_TASK_PERIOD 200ms
NUMAKER_EMAC::NUMAKER_EMAC() : thread(0), hwaddr() NUMAKER_EMAC::NUMAKER_EMAC() : thread(0), hwaddr()
{ {
@ -331,7 +333,7 @@ bool NUMAKER_EMAC::power_up()
/* PHY monitoring task */ /* PHY monitoring task */
phy_state = PHY_UNLINKED_STATE; 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 */ /* Allow the PHY task to detect the initial link state and set up the proper flags */
osDelay(10); osDelay(10);

View File

@ -48,6 +48,8 @@
#include "imx_emac.h" #include "imx_emac.h"
#include "mbed_power_mgmt.h" #include "mbed_power_mgmt.h"
using namespace std::chrono;
enet_handle_t g_handle; enet_handle_t g_handle;
// RX packet buffer pointers // RX packet buffer pointers
emac_mem_buf_t *rx_buff[ENET_RX_RING_LEN]; 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 */ /** \brief Driver thread priority */
#define THREAD_PRIORITY (osPriorityNormal) #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() 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 */ /* Allow the PHY task to detect the initial link state and set up the proper flags */
osDelay(10); 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; return true;
} }

View File

@ -31,6 +31,8 @@
#include "lpc546xx_emac_config.h" #include "lpc546xx_emac_config.h"
#include "lpc546xx_emac.h" #include "lpc546xx_emac.h"
using namespace std::chrono;
enet_handle_t g_handle; enet_handle_t g_handle;
// RX packet buffer pointers // RX packet buffer pointers
emac_mem_buf_t *rx_buff[ENET_RX_RING_LEN]; 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 */ /** \brief Driver thread priority */
#define THREAD_PRIORITY (osPriorityNormal) #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() 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.speed = (phy_speed_t)STATE_UNKNOWN;
prev_state.duplex = (phy_duplex_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 */ /* Allow the PHY task to detect the initial link state and set up the proper flags */
osDelay(10); osDelay(10);

View File

@ -52,13 +52,15 @@
#include "lwip/api.h" #include "lwip/api.h"
#endif #endif
using namespace std::chrono;
/* \brief Flags for worker thread */ /* \brief Flags for worker thread */
#define FLAG_RX 1 #define FLAG_RX 1
/** \brief Driver thread priority */ /** \brief Driver thread priority */
#define THREAD_PRIORITY (osPriorityHigh) #define THREAD_PRIORITY (osPriorityHigh)
#define PHY_TASK_PERIOD_MS 200 #define PHY_TASK_PERIOD 200ms
#define STM_HWADDR_SIZE (6) #define STM_HWADDR_SIZE (6)
#define STM_ETH_MTU_SIZE 1500 #define STM_ETH_MTU_SIZE 1500
@ -890,7 +892,7 @@ bool STM32_EMAC::power_up()
#endif #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)\ #if defined (STM32F767xx) || defined (STM32F769xx) || defined (STM32F777xx)\
|| defined (STM32F779xx) || defined (STM32F779xx)