#include "eth_link.h" #include "lwip/netif.h" #include "app_init/app_init.h" #include "wdt_task/wdt_task.h" #include "net_lwip/netconf.h" /** * @brief Ethernet link state monitor thread. * * @details * - Aligns task architecture with reference project's ethernet_link_thread. * - Polls link state of the given netif. * - Feeds watchdog flag for EthLink task. * * @param argument Must be a pointer to struct netif. */ void ethernet_link_thread(void *argument) { struct netif *netif = (struct netif *)argument; if (netif == NULL) { for (;;) { v_wdt_setFlag(TASK_ID_EthLink); mSleep(MY_GET_SLEEP_TIME(TASK_ID_EthLink)); } } for (;;) { (void)netif_is_link_up(netif); v_wdt_setFlag(TASK_ID_EthLink); mSleep(MY_GET_SLEEP_TIME(TASK_ID_EthLink)); } } int is_eth_link_up(void) { return (int)netif_is_link_up(NETCONF_ETH_NETIF); }