Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

A device’s input/output control/IO_Ctrl() function 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.

Files

Every device driver’s net_dev.c

Prototype

Note that since every device driver’s IO_Ctrl() function is accessed only by function pointer via the device driver’s API structure, it doesn’t need to be globally available and should therefore be declared as ‘static’.

Arguments

pif

Pointer to the interface to handle network device I/O operations.

opt

I/O operation to perform.

p_data

A pointer to a variable containing the data necessary to perform the operation or a pointer to a variable to store data associated with the result of the operation.

perr

Pointer to variable that will receive the return error code from this function.

Returned Value

None.

Required Configuration

None.

Notes / Warnings

µC/TCP-IP defines the following default options:

NET_DEV_LINK_STATE_GET_INFO
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, Spd 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.

  • No labels