Skip to content

Commit

Permalink
Fix compilation warnings by using the Chrono based time argument in E…
Browse files Browse the repository at this point in the history
…ventQueue call_every() API call.
  • Loading branch information
rajkan01 committed Jun 18, 2020
1 parent b1629b7 commit 28e44ac
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "netsocket/nsapi_types.h"
#include "mbed_shared_queues.h"

using namespace std::chrono;

/********************************************************************************
* Internal data
Expand All @@ -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")
Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()
{
Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,16 @@

#include "gd32xx_emac.h"

using namespace std::chrono;

/* \brief Flags for worker thread */
#define _ENET_FLAG_RX (1)

/** \brief Driver thread priority */
#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)
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
#include "numaker_emac.h"
#include "numaker_eth_hal.h"

using namespace std::chrono;

/********************************************************************************
*
********************************************************************************/
Expand All @@ -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()
{
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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()
{
Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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()
{
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 4 additions & 2 deletions features/netsocket/emac-drivers/TARGET_STM/stm32xx_emac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 28e44ac

Please sign in to comment.