The simple PHY function API provides simple non-blocking PHY status monitoring and initialization support for various Ethernet PHYs. To initialize the PHY, call lpc_phy_init() once. lpc_phy_init() requires several standard functions from the MAC driver for interfacing to the PHY via a MII link (Chip_ENET_Start_MII_Write(), Chip_ENET_Is_MII_Busy(), Chip_ENET_Start_MII_Read(), and Chip_ENET_Read_MII_Data()).
Once initialized, just preiodically call the lpcPHYStsPoll() function from the background loop or a thread and monitor the returned status to determine if the PHY state has changed and the current PHY state.
#define PHY_LINK_BUSY (1 << 1) |
PHY status bit for MII link busy
Definition at line 57 of file lpc_phy.h.
#define PHY_LINK_CHANGED (1 << 2) |
PHY status bit for changed state (not persistent)
Definition at line 58 of file lpc_phy.h.
#define PHY_LINK_CONNECTED (1 << 3) |
PHY status bit for connected state
Definition at line 59 of file lpc_phy.h.
#define PHY_LINK_ERROR (1 << 0) |
PHY status bit for link error
Definition at line 56 of file lpc_phy.h.
#define PHY_LINK_FULLDUPLX (1 << 5) |
PHY status bit for full duplex mode
Definition at line 61 of file lpc_phy.h.
#define PHY_LINK_SPEED100 (1 << 4) |
PHY status bit for 100Mbps mode
Definition at line 60 of file lpc_phy.h.
Initialize the PHY.
- Parameters
-
rmii | : Initializes PHY for RMII mode if true, MII if false |
pDelayMsFunc | : Delay function (in mS) used for this driver |
- Returns
- PHY_LINK_ERROR or 0 on success This function initializes the PHY. It will block until complete. It will not wait for the PHY to detect a connected cable and remain busy. Use lpcPHYStsPoll to detect cable insertion.
Definition at line 187 of file lpc_phy_dp83848.c.
Phy status update state machine.
- Returns
- An Or'ed value of PHY_LINK_* statuses This function can be called at any rate and will poll the the PHY status. Multiple calls may be needed to determine PHY status.
Definition at line 253 of file lpc_phy_dp83848.c.