AM263Px MCU+ SDK: APIs for Ethernet PHY

| AM263Px MCU+ SDK 26.00.00 |

Data Structures | Functions | Typedefs
APIs for Ethernet PHY
APIs for Board Specific Device Drivers

## Introduction

This module contains APIs to program and use the Ethernet PHY present on the board. See ETHPHY for more details.

## Data Structures
struct | ETHPHY_Params
| Parameters passed during ETHPHY_open() More...
struct | ETHPHY_Fxns
| ETHPHY Driver implementation callbacks. More...
struct | ETHPHY_Attrs
| ETHPHY device attributes. These are filled by SysCfg based on the PHY device that is selected. More...
struct | ETHPHY_Config
| ETHPHY driver configuration. These are filled by SysCfg based on the PHY device that is selected. More...
struct | ETHPHY_SpeedDuplexConfig
| Data structure to be passed/returned when calling ETHPHY_command with ETHPHY_CMD_GET_SPEED_AND_DUPLEX_CONFIG or ETHPHY_CMD_SET_SPEED_AND_DUPLEX_CONFIG. More...

## Functions
void | ETHPHY_Params_init (ETHPHY_Params *params)
| Set default parameters in the ETHPHY_Params structure. More...
ETHPHY_Handle | ETHPHY_open (uint32_t instanceId, const ETHPHY_Params *params)
| Open ETHPHY driver. More...
void | ETHPHY_close (ETHPHY_Handle handle)
| Close ETHPHY driver. More...
int32_t | ETHPHY_command (ETHPHY_Handle handle, uint32_t command, void *data, uint32_t dataSize)
| Send a command to the ETHPHY. More...
const ETHPHY_Attrs * | ETHPHY_getAttrs (uint32_t instanceId)
| Return ETHPHY attributes. More...

## Typedefs
typedef void * | ETHPHY_Handle
| Handle to the ETHPHY driver returned by ETHPHY_open() More...
typedef struct ETHPHY_Config_s | ETHPHY_Config
| Forward declaration of ETHPHY_Config. More...
typedef struct ETHPHY_Params_s | ETHPHY_Params
| Forward declaration of ETHPHY_Params. More...

## ETHPHY Commands
Various commands for the Eternet PHY
#define | ETHPHY_CMD_ENABLE_MII (0U)
| Command to configure the PHY in MII mode. More...
#define | ETHPHY_CMD_SOFT_RESTART (1U)
| Command for Soft Restart. It restarts the PHY without affecting registers. More...
#define | ETHPHY_CMD_ENABLE_AUTO_MDIX (2U)
| Command to enable Auto MDI-X (Automatic Crossover) More...
#define | ETHPHY_CMD_VERIFY_IDENTIFIER_REGISTER (3U)
| Command to verify the PHY Identifier Register. It checks if the PHYIDR1 register has the expected value. More...
#define | ETHPHY_CMD_DISABLE_1000M_ADVERTISEMENT (4U)
| Command to disable 1000M ability advertisement More...
#define | ETHPHY_CMD_ENABLE_FAST_LINK_DOWN_DETECTION (5U)
| Command to enable Fast Link Down Detection. "data" argument should be passed while making ETHPHY_command API call with this command. Refer to the PHY-specific .h file in "source/board/ethphy" for the data structure needed to be passed. More...
#define | ETHPHY_CMD_CONFIGURE_LED_SOURCE (6U)
| Command to configure the source of PHY LEDs. "data" argument should be passed while making ETHPHY_command API call with this command. Refer to the PHY-specific .h file in "source/board/ethphy" for the data structure needed to be passed. More...
#define | ETHPHY_CMD_CONFIGURE_LED_BLINK_RATE (7U)
| Command to configure the blink rate of PHY LEDs. "data" argument should be passed while making ETHPHY_command API call with this command. Refer to the PHY-specific .h file in "source/board/ethphy" for the data structure needed to be passed. More...
#define | ETHPHY_CMD_ENABLE_EXTENDED_FD_ABILITY (8U)
| Command to enable the extended full duplex ability. More...
#define | ETHPHY_CMD_ENABLE_ODD_NIBBLE_DETECTION (9U)
| Command to enable odd nibble detection. More...
#define | ETHPHY_CMD_ENABLE_ENHANCED_IPG_DETECTION (10U)
| Command to enable enhanced IPG detection. More...
#define | ETHPHY_CMD_GET_LINK_STATUS (11U)
| Command to get Link Status for the PHY. More...
#define | ETHPHY_CMD_GET_SPEED_AND_DUPLEX_CONFIG (12U)
| Command to get Speed and Duplex configuration for the PHY. "data" argument should be passed while making ETHPHY_command API call with this command. "data" should be of type ETHPHY_SpeedDuplexConfig. More...
#define | ETHPHY_CMD_SET_SPEED_AND_DUPLEX_CONFIG (13U)
| Command to set Speed and Duplex configuration for the PHY. "data" argument should be passed while making ETHPHY_command API call with this command. "data" should be of type ETHPHY_SpeedDuplexConfig. More...
#define | ETHPHY_CMD_ENABLE_LOW_LATENCY_10M_100M_RGMII (14U)
| Command to enable low latency for 10M/100M operation in RGMII mode. More...
#define | ETHPHY_CMD_SET_RX_HALF_FULL_THRESHOLD_RGMII (15U)
| Command to set RX half full threshold in RGMII mode. "data" argument should be passed while making ETHPHY_command API call with this command. "data" should be a pointer to "uint8_t" and value should be present in the lowest 3 bits. More...
#define | ETHPHY_CMD_SET_TX_HALF_FULL_THRESHOLD_RGMII (16U)
| Command to set TX half full threshold in RGMII mode. "data" argument should be passed while making ETHPHY_command API call with this command. "data" should be a pointer to "uint8_t" and value should be present in the lowest 3 bits. More...
#define | ETHPHY_CMD_GET_AUTONEG_COMPLETE_STATUS (17U)
| Command to get auto-negotiation completion status. "data" argument should be passed while making ETHPHY_command API call with this command. "data" should be a pointer to "uint8_t" and value returned will be 0 if auto-negotiation is not complete, and 1 if it is complete. More...
#define | ETHPHY_CMD_GET_LINK_PARTNER_AUTONEG_ABILITY (18U)
| Command to get link partner's auto-negotiation ability. "data" argument should be passed while making ETHPHY_command API call with this command. "data" should be a pointer to "uint8_t" and value returned will be 0 if partner is not auto-negotiation able, and 1 if it is in auto-neogtiation able. More...
#define | ETHPHY_CMD_ENABLE_IEEE_POWER_DOWN (19U)
| Command to enable the IEEE Power Down mode. More...
#define | ETHPHY_CMD_DISABLE_IEEE_POWER_DOWN (20U)
| Command to disable the IEEE Power Down mode. More...

## ETHPHY SPEED AND DUPLEX CONFIGURATIONS
Different modes for speed and duplex configuration in ETHPHY
#define | ETHPHY_SPEED_DUPLEX_CONFIG_AUTONEG (0U)
#define | ETHPHY_SPEED_DUPLEX_CONFIG_10FD (1U)
#define | ETHPHY_SPEED_DUPLEX_CONFIG_100FD (2U)
#define | ETHPHY_SPEED_DUPLEX_CONFIG_1000FD (3U)
#define | ETHPHY_SPEED_DUPLEX_CONFIG_10HD (4U)
#define | ETHPHY_SPEED_DUPLEX_CONFIG_100HD (5U)
#define | ETHPHY_SPEED_DUPLEX_CONFIG_1000HD (6U)
#define | ETHPHY_SPEED_DUPLEX_CONFIG_INVALID (7U)

## ETHPHY driver implementation callbacks
typedef int32_t(* | ETHPHY_OpenFxn) (ETHPHY_Config *config, const ETHPHY_Params *params)
| Driver implementation to open a specific ETHPHY driver. More...
typedef void(* | ETHPHY_CloseFxn) (ETHPHY_Config *config)
| Driver implementation to close a specific ETHPHY driver. More...
typedef int32_t(* | ETHPHY_CommandFxn) (ETHPHY_Config *config, uint32_t command, void *data, uint32_t dataSize)
| Driver implementation to send command to the ETHPHY using specific ETHPHY driver. More...

## Macro Definition Documentation

## ◆ ETHPHY_CMD_ENABLE_MII

#define ETHPHY_CMD_ENABLE_MII (0U)

Command to configure the PHY in MII mode.

## ◆ ETHPHY_CMD_SOFT_RESTART

#define ETHPHY_CMD_SOFT_RESTART (1U)

Command for Soft Restart. It restarts the PHY without affecting registers.

## ◆ ETHPHY_CMD_ENABLE_AUTO_MDIX

#define ETHPHY_CMD_ENABLE_AUTO_MDIX (2U)

Command to enable Auto MDI-X (Automatic Crossover)

## ◆ ETHPHY_CMD_VERIFY_IDENTIFIER_REGISTER

#define ETHPHY_CMD_VERIFY_IDENTIFIER_REGISTER (3U)

Command to verify the PHY Identifier Register. It checks if the PHYIDR1 register has the expected value.

## ◆ ETHPHY_CMD_DISABLE_1000M_ADVERTISEMENT

#define ETHPHY_CMD_DISABLE_1000M_ADVERTISEMENT (4U)

Command to disable 1000M ability advertisement

## ◆ ETHPHY_CMD_ENABLE_FAST_LINK_DOWN_DETECTION

#define ETHPHY_CMD_ENABLE_FAST_LINK_DOWN_DETECTION (5U)

Command to enable Fast Link Down Detection. "data" argument should be passed while making ETHPHY_command API call with this command. Refer to the PHY-specific .h file in "source/board/ethphy" for the data structure needed to be passed.

## ◆ ETHPHY_CMD_CONFIGURE_LED_SOURCE

#define ETHPHY_CMD_CONFIGURE_LED_SOURCE (6U)

Command to configure the source of PHY LEDs. "data" argument should be passed while making ETHPHY_command API call with this command. Refer to the PHY-specific .h file in "source/board/ethphy" for the data structure needed to be passed.

## ◆ ETHPHY_CMD_CONFIGURE_LED_BLINK_RATE

#define ETHPHY_CMD_CONFIGURE_LED_BLINK_RATE (7U)

Command to configure the blink rate of PHY LEDs. "data" argument should be passed while making ETHPHY_command API call with this command. Refer to the PHY-specific .h file in "source/board/ethphy" for the data structure needed to be passed.

## ◆ ETHPHY_CMD_ENABLE_EXTENDED_FD_ABILITY

#define ETHPHY_CMD_ENABLE_EXTENDED_FD_ABILITY (8U)

Command to enable the extended full duplex ability.

## ◆ ETHPHY_CMD_ENABLE_ODD_NIBBLE_DETECTION

#define ETHPHY_CMD_ENABLE_ODD_NIBBLE_DETECTION (9U)

Command to enable odd nibble detection.

## ◆ ETHPHY_CMD_ENABLE_ENHANCED_IPG_DETECTION

#define ETHPHY_CMD_ENABLE_ENHANCED_IPG_DETECTION (10U)

Command to enable enhanced IPG detection.

## ◆ ETHPHY_CMD_GET_LINK_STATUS

#define ETHPHY_CMD_GET_LINK_STATUS (11U)

Command to get Link Status for the PHY.

## ◆ ETHPHY_CMD_GET_SPEED_AND_DUPLEX_CONFIG

#define ETHPHY_CMD_GET_SPEED_AND_DUPLEX_CONFIG (12U)

Command to get Speed and Duplex configuration for the PHY. "data" argument should be passed while making ETHPHY_command API call with this command. "data" should be of type ETHPHY_SpeedDuplexConfig.

## ◆ ETHPHY_CMD_SET_SPEED_AND_DUPLEX_CONFIG

#define ETHPHY_CMD_SET_SPEED_AND_DUPLEX_CONFIG (13U)

Command to set Speed and Duplex configuration for the PHY. "data" argument should be passed while making ETHPHY_command API call with this command. "data" should be of type ETHPHY_SpeedDuplexConfig.

## ◆ ETHPHY_CMD_ENABLE_LOW_LATENCY_10M_100M_RGMII

#define ETHPHY_CMD_ENABLE_LOW_LATENCY_10M_100M_RGMII (14U)

Command to enable low latency for 10M/100M operation in RGMII mode.

## ◆ ETHPHY_CMD_SET_RX_HALF_FULL_THRESHOLD_RGMII

#define ETHPHY_CMD_SET_RX_HALF_FULL_THRESHOLD_RGMII (15U)

Command to set RX half full threshold in RGMII mode. "data" argument should be passed while making ETHPHY_command API call with this command. "data" should be a pointer to "uint8_t" and value should be present in the lowest 3 bits.

## ◆ ETHPHY_CMD_SET_TX_HALF_FULL_THRESHOLD_RGMII

#define ETHPHY_CMD_SET_TX_HALF_FULL_THRESHOLD_RGMII (16U)

Command to set TX half full threshold in RGMII mode. "data" argument should be passed while making ETHPHY_command API call with this command. "data" should be a pointer to "uint8_t" and value should be present in the lowest 3 bits.

## ◆ ETHPHY_CMD_GET_AUTONEG_COMPLETE_STATUS

#define ETHPHY_CMD_GET_AUTONEG_COMPLETE_STATUS (17U)

Command to get auto-negotiation completion status. "data" argument should be passed while making ETHPHY_command API call with this command. "data" should be a pointer to "uint8_t" and value returned will be 0 if auto-negotiation is not complete, and 1 if it is complete.

## ◆ ETHPHY_CMD_GET_LINK_PARTNER_AUTONEG_ABILITY

#define ETHPHY_CMD_GET_LINK_PARTNER_AUTONEG_ABILITY (18U)

Command to get link partner's auto-negotiation ability. "data" argument should be passed while making ETHPHY_command API call with this command. "data" should be a pointer to "uint8_t" and value returned will be 0 if partner is not auto-negotiation able, and 1 if it is in auto-neogtiation able.

## ◆ ETHPHY_CMD_ENABLE_IEEE_POWER_DOWN

#define ETHPHY_CMD_ENABLE_IEEE_POWER_DOWN (19U)

Command to enable the IEEE Power Down mode.

## ◆ ETHPHY_CMD_DISABLE_IEEE_POWER_DOWN

#define ETHPHY_CMD_DISABLE_IEEE_POWER_DOWN (20U)

Command to disable the IEEE Power Down mode.

## ◆ ETHPHY_SPEED_DUPLEX_CONFIG_AUTONEG

#define ETHPHY_SPEED_DUPLEX_CONFIG_AUTONEG (0U)

## ◆ ETHPHY_SPEED_DUPLEX_CONFIG_10FD

#define ETHPHY_SPEED_DUPLEX_CONFIG_10FD (1U)

## ◆ ETHPHY_SPEED_DUPLEX_CONFIG_100FD

#define ETHPHY_SPEED_DUPLEX_CONFIG_100FD (2U)

## ◆ ETHPHY_SPEED_DUPLEX_CONFIG_1000FD

#define ETHPHY_SPEED_DUPLEX_CONFIG_1000FD (3U)

## ◆ ETHPHY_SPEED_DUPLEX_CONFIG_10HD

#define ETHPHY_SPEED_DUPLEX_CONFIG_10HD (4U)

## ◆ ETHPHY_SPEED_DUPLEX_CONFIG_100HD

#define ETHPHY_SPEED_DUPLEX_CONFIG_100HD (5U)

## ◆ ETHPHY_SPEED_DUPLEX_CONFIG_1000HD

#define ETHPHY_SPEED_DUPLEX_CONFIG_1000HD (6U)

## ◆ ETHPHY_SPEED_DUPLEX_CONFIG_INVALID

#define ETHPHY_SPEED_DUPLEX_CONFIG_INVALID (7U)

## Typedef Documentation

## ◆ ETHPHY_Handle

typedef void* ETHPHY_Handle

Handle to the ETHPHY driver returned by ETHPHY_open()

## ◆ ETHPHY_Config

typedef struct ETHPHY_Config_s ETHPHY_Config

Forward declaration of ETHPHY_Config.

## ◆ ETHPHY_Params

typedef struct ETHPHY_Params_s ETHPHY_Params

Forward declaration of ETHPHY_Params.

## ◆ ETHPHY_OpenFxn

typedef int32_t(* ETHPHY_OpenFxn) (ETHPHY_Config *config, const ETHPHY_Params *params)

Driver implementation to open a specific ETHPHY driver.

Typically this callback is hidden from the end application and is implemented when a new type of ETHPHY device needs to be implemented.

Parameters

  config | [IN] ETHPHY configuration for the specific ETHPHY device
  params | [IN] User controllable parameters when opening the ETHPHY device

Returns
  SystemP_SUCCESS on success, else failure

## ◆ ETHPHY_CloseFxn

typedef void(* ETHPHY_CloseFxn) (ETHPHY_Config *config)

Driver implementation to close a specific ETHPHY driver.

Typically this callback is hidden from the end application and is implemented when a new type of ETHPHY device needs to be implemented.

Parameters

  config | [IN] ETHPHY configuration for the specific ETHPHY device

Returns
  SystemP_SUCCESS on success, else failure

## ◆ ETHPHY_CommandFxn

typedef int32_t(* ETHPHY_CommandFxn) (ETHPHY_Config *config, uint32_t command, void *data, uint32_t dataSize)

Driver implementation to send command to the ETHPHY using specific ETHPHY driver.

Typically this callback is hidden from the end application and is implemented when a new type of ETHPHY device needs to be implemented.

Parameters

  config | [IN] ETHPHY configuration for the specific ETHPHY device
  command | [IN] Command from ETHPHY_Commands
  data | [IN] Pointer to structure which has the data to write/read
  dataSize | [IN] Size of the structure pointed by data

Returns
  SystemP_SUCCESS on success, else failure

## Function Documentation

## ◆ ETHPHY_Params_init()

void ETHPHY_Params_init | ( | ETHPHY_Params * | params | ) |

Set default parameters in the ETHPHY_Params structure.

Call this API to set defaults and then override the fields as needed before calling ETHPHY_open.

Parameters

  params | [OUT] Initialized parameters

## ◆ ETHPHY_open()

ETHPHY_Handle ETHPHY_open | ( | uint32_t | instanceId,
|  | const ETHPHY_Params * | params
| ) |  |

Open ETHPHY driver.

Global variables `ETHPHY_Config gETHPHY_Config[]` and `uint32_t gETHPHY_ConfigNum` is instantiated by SysCfg to describe the ETHPHY configuration based on user selection in SysCfg.

Parameters

  instanceId | [IN] Index within `ETHPHY_Config gETHPHY_Config[]` denoting the ETHPHY driver to open
  params | [IN] Open parameters

Returns
  Handle to ETHPHY driver which should be used in subsequent API call Else returns NULL in case of failure

## ◆ ETHPHY_close()

void ETHPHY_close | ( | ETHPHY_Handle | handle | ) |

Close ETHPHY driver.

Parameters

  handle | [in] ETHPHY driver handle from ETHPHY_open

## ◆ ETHPHY_command()

int32_t ETHPHY_command | ( | ETHPHY_Handle | handle,
|  | uint32_t | command,
|  | void * | data,
|  | uint32_t | dataSize
| ) |  |

Send a command to the ETHPHY.

Parameters

  handle | [in] ETHPHY driver handle from ETHPHY_open
  command | [in] Command from ETHPHY_Commands
  data | [IN] Pointer to structure which has the data to write/read
  dataSize | [IN] Size of the structure pointed by data

Returns
  SystemP_SUCCESS on success, else failure

## ◆ ETHPHY_getAttrs()

const ETHPHY_Attrs* ETHPHY_getAttrs | ( | uint32_t | instanceId | ) |

Return ETHPHY attributes.

Parameters

  instanceId | [IN] ETHPHY instance ID

Returns
  ETHPHY_Attrs, else NULL if instanceId is invalid