Ethernet link status for the K64F
Dependents: JRO_CR2 K64F_EthLink_HelloWorld frdm_test JRO_DDSv2
Simple K64F technique to determine if the Ethernet PHY link is up or down. The routine utilizes the Ethernet MII interface to gain access to the Ethernet PHY which contains the actual link status.
I wrote this because the mbed Ethernet function does not recognize its own "int link();" function with the K64F.
Revision 2:59166b94dfd0, committed 2014-11-07
- Comitter:
- loopsva
- Date:
- Fri Nov 07 21:41:13 2014 +0000
- Parent:
- 1:cbd7e77b6e38
- Child:
- 3:fbd2336e1193
- Commit message:
- Added compiler test for K46F and RTOS
Changed in this revision
k64f_EthLink.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/k64f_EthLink.cpp Wed Oct 01 00:23:48 2014 +0000 +++ b/k64f_EthLink.cpp Fri Nov 07 21:41:13 2014 +0000 @@ -1,5 +1,5 @@ +#ifdef defined(TARGET_K64F) #include "k64f_EthLink.h" -#include "rtos.h" //--------------------------------------------------------------------------------------------------------------------------------------// // Constructor @@ -17,7 +17,11 @@ //wait for MDIO interface to be ready do { k64f_mdio_reg = ENET_EIR; - Thread::wait(1); //release RTOS to do other functions +#ifdef RTOS_H + Thread::wait(1); +#else + wait_ms(1); +#endif mdio_timer++; } while(((k64f_mdio_reg & MDIO_MII_READY_BIT) == 0) && (mdio_timer < 300)); if(mdio_timer > 298) { //average is about 122mS @@ -31,4 +35,6 @@ if(k64f_mdio_reg & MDIO_MII_LINK_BITS) return(PHY_UP); return(PHY_DOWN); } +#endif +