From ede07217df34a33e6f249cd337dd616f1762e9ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=20Lepp=C3=A4nen?= Date: Wed, 16 May 2018 11:59:50 +0300 Subject: [PATCH] Corrected lwip netif flags to be set before power up This enables that link up status callback can be called inside power up function. --- features/FEATURE_LWIP/lwip-interface/LWIPInterfaceEMAC.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/features/FEATURE_LWIP/lwip-interface/LWIPInterfaceEMAC.cpp b/features/FEATURE_LWIP/lwip-interface/LWIPInterfaceEMAC.cpp index fde9a1b389..36d8f90f55 100644 --- a/features/FEATURE_LWIP/lwip-interface/LWIPInterfaceEMAC.cpp +++ b/features/FEATURE_LWIP/lwip-interface/LWIPInterfaceEMAC.cpp @@ -143,6 +143,9 @@ err_t LWIP::Interface::emac_if_init(struct netif *netif) mbed_if->emac->set_link_input_cb(mbed::callback(mbed_if, &LWIP::Interface::emac_input)); mbed_if->emac->set_link_state_cb(mbed::callback(mbed_if, &LWIP::Interface::emac_state_change)); + /* Interface capabilities */ + netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_ETHERNET; + if (!mbed_if->emac->power_up()) { err = ERR_IF; } @@ -154,8 +157,6 @@ err_t LWIP::Interface::emac_if_init(struct netif *netif) mbed_if->emac->get_hwaddr(netif->hwaddr); /* Then we write back either what they gave us, or our default */ mbed_if->emac->set_hwaddr(netif->hwaddr); - /* Interface capabilities */ - netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_ETHERNET; mbed_if->emac->get_ifname(netif->name, 2);