Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

NetDev_IO_Ctrl()

...

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.anchor11065071106507

Files

...

1106508Every device driver’s net_dev.c Anchor10962471096247

Prototype

anchor 11233681123368

 

...

rowspan2

...

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’. Anchor11106191110619 Arguments Anchor11106241110624 pif Anchor11320201132020static’.

Arguments

pif

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

...

1132021opt Anchor11320261132026

I/O operation to perform.

...

11320221132022p_data Anchor11320281132028

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.

...

perranchor11320301132030

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

...

...

Returned Value

...

None.anchor11106801110680

Required Configuration

...

1110681None. Anchor11106821110682

Notes / Warnings

...

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

NET_DEV_LINK_STATE_GET_INFO Anchor10906221090622

NET_DEV_LINK_STATE_UPDATEanchor

11359681135968  Anchor10913451091345

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. Anchor11111261111126

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.