Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Ethernet PHY Media Access Controller

See gmac_quickstart.

Driver for the GMAC PHY (Ethernet Media Access Controller). This file contains basic functions for the GMAC PHY.

Dependencies

This driver does not depend on other modules.

Functions

uint8_t gmac_phy_read (Gmac *p_gmac, uint8_t uc_phy_address, uint8_t uc_address, uint32_t *p_value)
 Read the PHY register. More...
 
static uint8_t gmac_phy_wait (Gmac *p_gmac, const uint32_t ul_retry)
 Wait PHY operation to be completed. More...
 
uint8_t gmac_phy_write (Gmac *p_gmac, uint8_t uc_phy_address, uint8_t uc_address, uint32_t ul_value)
 Write the PHY register. More...
 

uint8_t gmac_phy_read ( Gmac *  p_gmac,
uint8_t  uc_phy_address,
uint8_t  uc_address,
uint32_t *  p_value 
)

Read the PHY register.

Parameters
p_gmacPointer to the GMAC instance.
uc_phy_addressPHY address.
uc_addressRegister address.
p_valuePointer to a 32-bit location to store read data.

GMAC_OK if successfully, GMAC_TIMEOUT if timeout.

References gmac_get_phy_data(), gmac_maintain_phy(), GMAC_OK, gmac_phy_wait(), GMAC_TIMEOUT, and MAC_PHY_RETRY_MAX.

Referenced by ethernet_phy_auto_negotiate(), ethernet_phy_find_valid(), ethernet_phy_reset(), and ethernet_phy_set_link().

static uint8_t gmac_phy_wait ( Gmac *  p_gmac,
const uint32_t  ul_retry 
)
static

Wait PHY operation to be completed.

Parameters
p_gmacHW controller address.
ul_retryThe retry times.

Return GMAC_OK if the operation is completed successfully.

References gmac_is_phy_idle(), GMAC_OK, and GMAC_TIMEOUT.

Referenced by gmac_phy_read(), and gmac_phy_write().

uint8_t gmac_phy_write ( Gmac *  p_gmac,
uint8_t  uc_phy_address,
uint8_t  uc_address,
uint32_t  ul_value 
)

Write the PHY register.

Parameters
p_gmacPointer to the GMAC instance.
uc_phy_addressPHY Address.
uc_addressRegister Address.
ul_valueData to write, actually 16-bit data.

GMAC_OK if successfully, GMAC_TIMEOUT if timeout.

References gmac_maintain_phy(), GMAC_OK, gmac_phy_wait(), GMAC_TIMEOUT, and MAC_PHY_RETRY_MAX.

Referenced by ethernet_phy_auto_negotiate(), and ethernet_phy_reset().