Versions Compared

Key

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

...

Anchor11115651111565 NetDev_IO_Ctrl() Anchor11115501111550A 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

...

11065081106508Every device driver’s net_dev.c Anchor10962471096247

Prototype

...


...

static void CPU_INT08U opt, void *p_data, NET_ERR *perr);
HTML Table
summary
classCode_Listing
Table Row (tr)
Table Cell (td)
rowspan2
Anchor
10963091096309
Code Block


          static void NetDev_IO_Ctrl (NET_IF
*pif,
Anchor
11359651135965
Anchor
11359661135966
Anchor
11359671135967
Table Row (tr)

...

     *pif,
                                      CPU_INT08U  opt,
                                      void       *p_data,
                                      NET_ERR    *perr);

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’. Anchor11106191110619static’.

Arguments

...

11106241110624pif Anchor11320201132020

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

...

1132021opt Anchor11320261132026

I/O operation to perform.

...

1132022p_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.

...

perr Anchor11320301132030

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

...

Returned Value

Anchor11106791110679None. Anchor11106801110680

Required Configuration

...

11106811110681None. Anchor11106821110682

Notes / Warnings

...

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

NET_DEV_LINK_STATE_GET_INFO Anchor1090622
1090622NET_DEV_LINK_STATE_UPDATE Anchor11359681135968  anchor
10913451091345

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.