Versions Compared

Key

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

Suscribe / Unsuscribe to link state changes

TODO

Getting the Current Link State for an Interface

Some applications may wish to get the physical link state for a specific interface. Link state information may be obtained by calling NetIF_IO_Ctrl() or NetIF_LinkStateGet() with the appropriate arguments.

Calling NetIF_IO_Ctrl() will poll the hardware for the current link state. Alternatively, NetIF_LinkStateGet() gets the approximate link state by reading the interface link state flag. Polling the Ethernet hardware for link state takes significantly longer due to the speed and latency of the MII bus. Consequently, it may not be desirable to poll the hardware in a tight loop. Reading the interface flag is fast, but the flag is only periodically updated by the Net IF every 250mS (default) when using the generic Ethernet PHY driver. PHY drivers that implement link state change interrupts may change the value of the interface flag immediately upon link state change detection. In this scenario, calling NetIF_LinkStateGet() is ideal for these interfaces.

Increasing the Rate of Link State Polling

The application may increase the µC/TCP-IP link state polling rate by calling NetIF_CfgPhyLinkPeriod(). The default value is 250ms.

Getting the Current Link State for an Interface

µC/TCP-IP provides two mechanisms for obtaining interface link state.

...

The advantage to Method 2 is that the link state returned is the actual link state as reported by the hardware at the time of the function call. However, the overhead of communicating with the physical layer device may be high and therefore some cycles may be wasted waiting for the result since the connection bus between the CPU and the physical layer device is often only a couple of MHz.

Forcing an Ethernet PHY to a Specific Link State

The generic PHY driver that comes with µC/TCP-IP does not provide a mechanism for disabling auto-negotiation and specifying a desired link state. This restriction is required in order to remain MII register block compliant with all (R)MII compliant physical layer devices.

...