From 3af1e6597b85a3a472c5df4b12cf2dbed2344add Mon Sep 17 00:00:00 2001 From: sg- Date: Fri, 10 Oct 2014 14:29:43 -0500 Subject: [PATCH] [net][k64f] Add access to link status in emac driver --- .../net/eth/lwip-eth/arch/TARGET_Freescale/k64f_emac.c | 7 +++++++ .../lwip-eth/arch/TARGET_Freescale/k64f_emac_config.h | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/libraries/net/eth/lwip-eth/arch/TARGET_Freescale/k64f_emac.c b/libraries/net/eth/lwip-eth/arch/TARGET_Freescale/k64f_emac.c index 2fbad3f054..482cd79595 100644 --- a/libraries/net/eth/lwip-eth/arch/TARGET_Freescale/k64f_emac.c +++ b/libraries/net/eth/lwip-eth/arch/TARGET_Freescale/k64f_emac.c @@ -723,6 +723,13 @@ typedef struct { enet_phy_duplex_t duplex; } PHY_STATE; +int phy_link_status() { + bool connection_status; + enet_dev_if_t * enetIfPtr = (enet_dev_if_t*)&enetDevIf[BOARD_DEBUG_ENET_INSTANCE]; + phy_get_link_status(enetIfPtr, &connection_status); + return (int)connection_status; +} + static void k64f_phy_task(void *data) { struct netif *netif = (struct netif*)data; bool connection_status; diff --git a/libraries/net/eth/lwip-eth/arch/TARGET_Freescale/k64f_emac_config.h b/libraries/net/eth/lwip-eth/arch/TARGET_Freescale/k64f_emac_config.h index 985fd45487..fda77aaebc 100644 --- a/libraries/net/eth/lwip-eth/arch/TARGET_Freescale/k64f_emac_config.h +++ b/libraries/net/eth/lwip-eth/arch/TARGET_Freescale/k64f_emac_config.h @@ -44,5 +44,15 @@ #define ENET_ETH_MAX_FLEN (1522) // recommended size for a VLAN frame +#if defined(__cplusplus) +extern "C" { +#endif + +int phy_link_status(void); + +#if defined(__cplusplus) +} +#endif + #endif // #define K64F_EMAC_CONFIG_H__