Setting the MAC Link, Duplex and Speed Settings
NetDev_IO_Ctrl()
is used to implement miscellaneous functionality such as setting and getting the PHY link state, as well as updating the MAC link state registers when the PHY link state has changed. An optional void pointer to a data variable is passed into the function and may be used to get device parameters from the caller, or to return device parameters to the caller. μC/TCP-IP defines the following default options: NET_DEV_LINK_STATE_GET_INFO
and NET_DEV_LINK_STATE_UPDATE
.
The NET_DEV_LINK_STATE_GET_INFO
option expects p_data
to point to a variable of type NET_DEV_LINK_ETHER
for the case of an Ethernet driver. This variable has two fields, Speed and Duplex, which are filled in by the PHY device driver via a call through the PHY API. μC/TCP-IP internally uses this option code in order to periodically poll the PHYs for link state. The NET_DEV_LINK_STATE_UPDATE
option is used by the PHY driver to communicate with the MAC when either μC/TCP-IP polls the PHY for link status, or when a PHY interrupt occurs. Not all MAC’s require PHY link state synchronization. Should this be the case, then the device driver may not need to implement this option.