Versions Compared

Key

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

...

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.

Code Block
languagecpp
firstline1
titleListing - Calling NetIF_IO_Ctrl()
linenumberstrue
NetIF_IO_Ctrl((NET_IF_NBR) if_nbr,                                  (1)
              (CPU_INT08U) NET_IF_IO_CTRL_LINK_STATE_GET_INFO,      (2)
              (void     *)&link_state,                              (3)
              (NET_ERR  *)&err);                                    (4)


Panel
bgColor#f0f0f0
  1. The first argument specifies the interface number from which to get the physical link state.
  2. The second argument specifies the desired function that NetIF_IO_Ctrl() will perform. In order to get the current interfaces’ link state, the application should specify this argument as either:

    NET_IF_IO_CTRL_LINK_STATE_GET
    NET_IF_IO_CTRL_LINK_STATE_GET_INFO
  3. The third argument is a pointer to a link state variable that must be declared by the application and passed to NetIF_IO_Ctrl().


Wait Until the Cable is Connected (Link

...

Up)

Sometime the application might want to wait until the link is up before starting doing things on the network. The function NetIF_LinkStateWaitUntilUp can be use to do such functionality.

...

The following is an example physical layer device configuration structure.

Code Block
languagecpp
themeConfluence
NET_PHY_CFG_ETHER NetPhy_Cfg_Generic_0 = {
   0,
   NET_PHY_BUS_MODE_MII,
   NET_PHY_TYPE_EXT,
   NET_PHY_SPD_AUTO,
   NET_PHY_DUPLEX_AUTO
};


The parameters NET_PHY_SPD_AUTO and NET_PHY_DUPLEX_AUTO may be changed to match any of the following settings:

...