NetPhy_Init()

The first function within the Ethernet PHY API is the PHY driver initialization/Init() function which is called by the Ethernet network interface layer after the MAC device driver is initialized without error.

Files

Every physical layer driver’s net_phy.c

Prototype

          static void NetPhy_Init (NET_IF  *pif,
                                   NET_ERR *perr)

Note that since every PHY driver’s Init() function is accessed only by function pointer via the PHY 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 initialize a PHY.

perr

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

Returned Value

None.

Required Configuration

None.

Notes/Warnings

The PHY initialization function is responsible for the following actions:

  1. Reset the PHY and wait with timeout for reset to complete. If a timeout occurs, return perr set to NET_PHY_ERR_RESET_TIMEOUT.
  2. Start the auto-negotiation process. This should configure the PHY registers such that the desired link speed and duplex specified within the PHY configuration are respected. It is not necessary to wait until the auto-negotiation process has completed, as this can take upwards of many seconds. Generally, this action is performed by calling the PHY’s NetPhy_AutoNegStart() function.
  3. If no errors occur, return perr set to NET_PHY_ERR_NONE.