MTB CAT1 Peripheral driver library

General Description

Functions

cy_en_ephy_status_t Cy_EPHY_Init (cy_stc_ephy_t *phy, cy_ephy_read_handle fnRead, cy_ephy_write_handle fnWrite)
 This function initializes the private structure and assign a PHY-read, PHY-write function handle to its private data structure. More...
 
cy_en_ephy_status_t Cy_EPHY_Discover (cy_stc_ephy_t *phy)
 Discovers connected PHY at address zero. More...
 
cy_en_ephy_status_t Cy_EPHY_Configure (cy_stc_ephy_t *phy, cy_stc_ephy_config_t *config)
 Configures PHY with user provided speed and duplex mode. More...
 
uint32_t Cy_EPHY_GetLinkStatus (cy_stc_ephy_t *phy)
 Get current link status of PHY. More...
 
cy_en_ephy_status_t Cy_EPHY_Reset (cy_stc_ephy_t *phy)
 Soft reset PHY by enabling 15th bit of BMCR register. More...
 
uint32_t Cy_EPHY_GetAutoNegotiationStatus (cy_stc_ephy_t *phy)
 Get current Auto-Negotiation status (completed or In-progress). More...
 
cy_en_ephy_status_t Cy_EPHY_getLinkPartnerCapabilities (cy_stc_ephy_t *phy, cy_stc_ephy_config_t *lpConfig)
 Gets Link partner capabilities (speed and duplex) More...
 

Function Documentation

◆ Cy_EPHY_Init()

cy_en_ephy_status_t Cy_EPHY_Init ( cy_stc_ephy_t phy,
cy_ephy_read_handle  fnRead,
cy_ephy_write_handle  fnWrite 
)

This function initializes the private structure and assign a PHY-read, PHY-write function handle to its private data structure.

Parameters
phypointer to PHY private data structure.
fnReadpointer to read function implemented in application
fnWritepointer to write function implemented in application
Returns
Initialization status
CY_EPHY_SUCCESS for successfully initializes the internal data structures.

◆ Cy_EPHY_Discover()

cy_en_ephy_status_t Cy_EPHY_Discover ( cy_stc_ephy_t phy)

Discovers connected PHY at address zero.

Reads ID1 and ID2 register to form PHY ID.

Parameters
phypointer to PHY private data structure
Returns
CY_EPHY_ERROR PHY chip contains invalid PHY ID
CY_EPHY_SUCCESS PHY chip contains a valid PHY ID

◆ Cy_EPHY_Configure()

cy_en_ephy_status_t Cy_EPHY_Configure ( cy_stc_ephy_t phy,
cy_stc_ephy_config_t config 
)

Configures PHY with user provided speed and duplex mode.

Parameters
phypointer to PHY private data structure
configpointer to PHY configuration structure
Returns
CY_EPHY_SUCCESS Successfully configure PHY registers
CY_EPHY_AN_NOT_SUPPORTED PHY does not support Auto-Negotiation.
Note
For Auto-Negotiation configure the speed and duplex mode to CY_EPHY_SPEED_AUTO and CY_EPHY_DUPLEX_AUTO respectively. In this configuration PHY will advertise with highest capabilities. Also if vendor specific registers are supported then user may needs to configure the vendor specific registers to highest capabilities. For more details please refer to the PHY datasheet.

◆ Cy_EPHY_GetLinkStatus()

uint32_t Cy_EPHY_GetLinkStatus ( cy_stc_ephy_t phy)

Get current link status of PHY.

Parameters
phypointer to PHY private data structure
Returns
link status of PHY (0=down, 1=up)

◆ Cy_EPHY_Reset()

cy_en_ephy_status_t Cy_EPHY_Reset ( cy_stc_ephy_t phy)

Soft reset PHY by enabling 15th bit of BMCR register.

Parameters
phypointer to PHY private data structure
Returns
CY_EPHY_SUCCESS for successful soft reset

◆ Cy_EPHY_GetAutoNegotiationStatus()

uint32_t Cy_EPHY_GetAutoNegotiationStatus ( cy_stc_ephy_t phy)

Get current Auto-Negotiation status (completed or In-progress).

Parameters
phypointer to PHY private data structure
Returns
Auto-Negotiation status of PHY. 0 = Auto-Negotiation process is not completed. 1 = Auto-Negotiation process is completed.

◆ Cy_EPHY_getLinkPartnerCapabilities()

cy_en_ephy_status_t Cy_EPHY_getLinkPartnerCapabilities ( cy_stc_ephy_t phy,
cy_stc_ephy_config_t lpConfig 
)

Gets Link partner capabilities (speed and duplex)

Parameters
phyPointer to PHY private data structure
lpConfig[Output] Speed and duplex information
Returns
CY_EPHY_SUCCESS : Success in processing the link capability.
CY_EPHY_ERROR : Error in processing the link capability. Ignore the lpConfig output parameter.
Note
This function should be called after Auto-Negotiation is completed ( Cy_EPHY_GetAutoNegotiationStatus )