The ETHPHY driver provides APIs to control the Ethernet PHY devices present on the board. It accesses the PHY registers using the MDIO module.
Features Supported
- Note
- Only the commands needed for Industial Protocol examples are supported
- Commands for following things:
- Get the PHY link status
- Configure speed and half-duplex/full-duplex
- Configure PHY LEDs
- Select MII mode
- Soft-restart PHY
- Enable Auto MDI-X
- Disable 1G Advertisement
- Configure features like fast link down detection, extended full duplex ability, odd nibble detection and enhanced IPG detection
SysConfig Features
- Note
- It is strongly recommend to use SysConfig where it is available instead of using direct SW API calls. This will help simplify the SW application and also catch common mistakes early in the development cycle.
- Option to select the type of Ethernet PHY
- Option to select the MDIO instance to which PHY is connected
- Option to set the PHY address
- Based on above parameters, the SysConfig generated code does following:
- Open the ETHPHY instance using ETHPHY_open API as a part of Board_driversOpen. Handle can used by including
"ti_board_open_close.h"
file.
- Close the ETHPHY instance as a part of Board_driversClose
- Create macros like
CONFIG_ETHPHY0
using the name passed in SysConfig. This is used as an index to the array of handles.
Example Usage
Include the below file to access the APIs
Selecting MII mode and soft-resetting the PHY
Configuring PHY LED sources
ETHPHY_DP83869_LedSourceConfig ledConfig;
ledConfig.ledNum = ETHPHY_DP83869_LED0;
ledConfig.mode = ETHPHY_DP83869_LED_MODE_LINK_OK;
ledConfig.ledNum = ETHPHY_DP83869_LED1;
ledConfig.mode = ETHPHY_DP83869_LED_MODE_1000BT_LINK_UP;
ledConfig.ledNum = ETHPHY_DP83869_LED2;
ledConfig.mode = ETHPHY_DP83869_LED_MODE_LINK_OK_AND_BLINK_ON_RX_TX;
ledConfig.ledNum = ETHPHY_DP83869_LED_GPIO;
ledConfig.mode = ETHPHY_DP83869_LED_MODE_10_OR_100BT_LINK_UP;
API
APIs for Ethernet PHY