NetPhy_LinkStateSet()
The Ethernet PHY’s LinkStateSet()
function determines the current Ethernet link state. Results are passed back to the caller within a NET_DEV_LINK_ETHER
structure which contains fields for link speed and duplex. This function is called periodically by µC/TCP-IP.
...
Every physical layer driver’s net_phy.c
Prototype
...
Code Block |
---|
static void NetPhy_LinkStateSet (NET_IF *pif,
NET_DEV_LINK_ETHER *plink_state,
NET_ERR *perr); |
Note that since every PHY driver’s LinkStateSet()
function is accessed only by function pointer via the PHY driver’s API structure, it doesn’t need to be globally available and should therefore be declared as ‘static
’.
...
Pointer to a link state structure with link state information to configure. The NET_DEV_LINK_ETHER
structure contains two fields for link speed and duplex. Link speed is set via plink_state->Spd
:
NET_PHY_SPD_10
NET_PHY_SPD_100
And link duplex is set via plink_state->Duplex
:
NET_PHY_DUPLEX_HALF
NET_PHY_DUPLEX_FULL
...
perr
Pointer to variable that will receive the return error code from this function.
...