Versions Compared

Key

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

...

Anchor11111281111128 NetDev_MII_Rd() Anchor11111291111129The next function to implement is the (R)MII read/Phy_RegRd() function. This function is generally implemented within the Ethernet device driver file, since (R)MII bus reads are generally associated with the MAC device. In the case that the PHY communication mechanism is separate from the MAC, then a handler function may be provided within the net_bsp.c file and called from the device driver file instead. Anchor11108061110806

Note: This function must be implemented with a timeout and should not block indefinitely should the PHY fail to respond. Anchor11108071110807

Files

...

Every device driver’s net_dev.c Anchor10973701097370

Prototype

...


...

static void CPU_INT08U phy_addr, CPU_INT08U reg_addr, CPU_INT16U *p_data, NET_ERR *perr);
HTML Table
summary
classCode_Listing
Table Row (tr)
Table Cell (td)
rowspan2
Anchor
10973631097363
Code Block
          static void NetDev_MII_Rd (NET_IF
*pif,
Anchor
11359691135969
Anchor
11359701135970
Anchor
11359711135971
Anchor
11359721135972
Table Row (tr)

...

     *pif,
                                     CPU_INT08U  phy_addr,
                                     CPU_INT08U  reg_addr,
                                     CPU_INT16U *p_data,
                                     NET_ERR    *perr);

Note that since every device driver’s Phy_RegRd()/MII_Rd() 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’. Anchor11107041110704 Arguments Anchor11107881110788 pif Anchor11320631132063static’.

Arguments

pif

Pointer to the interface to read a (R)MII PHY register.

Anchor11108281110828phy_addr Anchor11320651132065

The bus address of the PHY.

...

11108291110829reg_addranchor11320671132067

The MII register number to read.

Anchor11108301110830p_data Anchor11320691132069

Pointer to a address to store the content of the PHY register being read.

...

1110843perr Anchor11320711132071

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

...

Returned Value

...

None. Anchor11108461110846

Required Configuration

...

11108471110847None.anchor10968001096800

Notes/Warnings

...

None.