AM261x MCU+ SDK: enet_per.h File Reference

| AM261x MCU+ SDK 26.00.00 |

Data Structures | Macros | Typedefs | Enumerations
enet_per.h File Reference

## Introduction

This file contains the type definitions and helper macros for the Enet Peripheral interface.

Go to the source code of this file.

## Data Structures
struct | Enet_DfltFlowInfo
| Rx Default Flow Info used for default flow registration/unregistration. More...
struct | Enet_MacDstFlowInfo
| Output args for ENET_PER_IOCTL_ATTACH_CORE command. More...
struct | EnetPer_PortLinkCfg
| Input args for ENET_PER_IOCTL_OPEN_PORT_LINK command. More...
struct | EnetPer_AttachCoreOutArgs
| Output args for ENET_PER_IOCTL_ATTACH_CORE command. More...
struct | Enet_ExtPhyLinkUpEventInfo
| Input args for ENET_PER_IOCTL_HANDLE_EXTPHY_LINKUP_EVENT command. More...
struct | Enet_IoctlRegisterHandlerInArgs
| ENET_PER_IOCTL_REGISTER_IOCTL_HANDLER inArgs More...
struct | EnetPer_Obj
| Ethernet Peripheral object. More...

## Macros
#define | ENET_TO_PER(per) ((EnetPer_Handle)(per))
| Convert peripheral specific handle to EnetMod generic handle. More...
#define | ENET_PER_NAME(per) (ENET_TO_PER(per)->name)
| Get peripheral name. More...
#define | ENET_PER_PUBLIC_IOCTL(x)
| Helper macro to create IOCTL commands for peripherals. More...

## Typedefs
typedef struct EnetPer_Obj_s * | EnetPer_Handle
| Ethernet Peripheral handle. More...
typedef void(*const | EnetPer_InitCfg) (EnetPer_Handle hPer, Enet_Type enetType, void *cfg, uint32_t cfgSize)
| Initialize peripheral's configuration parameters. More...
typedef int32_t(*const | EnetPer_Open) (EnetPer_Handle hPer, Enet_Type enetType, uint32_t instId, const void *cfg, uint32_t cfgSize)
| Open and initialize the Enet Peripheral. More...
typedef int32_t(*const | EnetPer_Rejoin) (EnetPer_Handle hPer, Enet_Type enetType, uint32_t instId)
| Rejoin a running Enet Peripheral. More...
typedef int32_t(*const | EnetPer_Ioctl) (EnetPer_Handle hPer, uint32_t cmd, Enet_IoctlPrms *prms)
| Issue an operation on the Enet Peripheral. More...
typedef void(*const | EnetPer_Poll) (EnetPer_Handle hPer, Enet_Event evt, const void *arg, uint32_t argSize)
| Poll for Ethernet events. More...
typedef uint64_t(*const | EnetPer_ConvertTs) (EnetPer_Handle hPer, uint64_t ts)
| Convert a timestamp to nanoseconds. More...
typedef void(*const | EnetPer_PeriodicTick) (EnetPer_Handle hPer)
| Run periodic tick on the Ethernet peripheral. More...
typedef void(*const | EnetPer_RegisterEventCb) (EnetPer_Handle hPer, Enet_Event evt, uint32_t evtNum, Enet_EventCallback evtCb, void *evtCbArgs)
| Register a callback for an event. More...
typedef void(*const | EnetPer_UnregisterEventCb) (EnetPer_Handle hPer, Enet_Event evt, uint32_t evtNum)
| Unregister callback for an event. More...
typedef void(*const | EnetPer_Close) (EnetPer_Handle hPer)
| Close the Enet Peripheral. More...
typedef void(*const | EnetPer_SaveCtxt) (EnetPer_Handle hPer)
| Save and close the Enet Peripheral. More...
typedef int32_t(*const | EnetPer_RestoreCtxt) (EnetPer_Handle hPer, Enet_Type enetType, uint32_t instId)
| Restores and Opens the Enet Peripheral. More...

## Enumerations
enum | EnetPer_Ioctl_e { ENET_PER_IOCTL_GET_VERSION = ENET_PER_PUBLIC_IOCTL(0U), ENET_PER_IOCTL_PRINT_REGS = ENET_PER_PUBLIC_IOCTL(1U), ENET_PER_IOCTL_OPEN_PORT_LINK = ENET_PER_PUBLIC_IOCTL(2U), ENET_PER_IOCTL_CLOSE_PORT_LINK = ENET_PER_PUBLIC_IOCTL(3U), ENET_PER_IOCTL_IS_PORT_LINK_UP = ENET_PER_PUBLIC_IOCTL(4U), ENET_PER_IOCTL_GET_PORT_LINK_CFG = ENET_PER_PUBLIC_IOCTL(5U), ENET_PER_IOCTL_ATTACH_CORE = ENET_PER_PUBLIC_IOCTL(6U), ENET_PER_IOCTL_DETACH_CORE = ENET_PER_PUBLIC_IOCTL(7U), ENET_IOCTL_REGISTER_RX_DEFAULT_FLOW = ENET_PER_PUBLIC_IOCTL(8U), ENET_IOCTL_UNREGISTER_RX_DEFAULT_FLOW = ENET_PER_PUBLIC_IOCTL(9U), ENET_IOCTL_REGISTER_DSTMAC_RX_FLOW = ENET_PER_PUBLIC_IOCTL(10U), ENET_IOCTL_UNREGISTER_DSTMAC_RX_FLOW = ENET_PER_PUBLIC_IOCTL(11U), ENET_PER_IOCTL_SET_VLAN_AWARE = ENET_PER_PUBLIC_IOCTL(12U), ENET_PER_IOCTL_SET_VLAN_UNAWARE = ENET_PER_PUBLIC_IOCTL(13U), ENET_PER_IOCTL_HANDLE_EXTPHY_LINKUP_EVENT = ENET_PER_PUBLIC_IOCTL(14U), ENET_PER_IOCTL_HANDLE_EXTPHY_LINKDOWN_EVENT = ENET_PER_PUBLIC_IOCTL(15U), ENET_PER_IOCTL_REGISTER_IOCTL_HANDLER = ENET_PER_PUBLIC_IOCTL(16U), ENET_PER_IOCTL_SET_ISOLATE_STATE = ENET_PER_PUBLIC_IOCTL(17U), ENET_PER_IOCTL_CLEAR_ISOLATE_STATE = ENET_PER_PUBLIC_IOCTL(17U) }
| Ethernet peripheral IOCTL commands. More...

## Macro Definition Documentation

## ◆ ENET_TO_PER

#define ENET_TO_PER | ( |  | per | ) | ((EnetPer_Handle)(per))

Convert peripheral specific handle to EnetMod generic handle.

## ◆ ENET_PER_NAME

#define ENET_PER_NAME | ( |  | per | ) | (ENET_TO_PER(per)->name)

Get peripheral name.

## ◆ ENET_PER_PUBLIC_IOCTL

#define ENET_PER_PUBLIC_IOCTL | ( |  | x | ) |

Value:
(ENET_IOCTL_TYPE_PUBLIC | \
ENET_IOCTL_PER_BASE | \
ENET_IOCTL_MIN(x))

Helper macro to create IOCTL commands for peripherals.

## Typedef Documentation

## ◆ EnetPer_Handle

typedef struct EnetPer_Obj_s* EnetPer_Handle

Ethernet Peripheral handle.

Ethernet Peripheral handle used to call any EnetPer related APIs.

## ◆ EnetPer_InitCfg

typedef void(* const EnetPer_InitCfg) (EnetPer_Handle hPer, Enet_Type enetType, void *cfg, uint32_t cfgSize)

Initialize peripheral's configuration parameters.

Initializes the configuration parameter of the Enet Peripheral.

Parameters

  hPer | Enet Peripheral handle
  enetType | Enet Peripheral type
  cfg | Configuration parameters to be initialized
  cfgSize | Size of the configuration parameters

## ◆ EnetPer_Open

typedef int32_t(* const EnetPer_Open) (EnetPer_Handle hPer, Enet_Type enetType, uint32_t instId, const void *cfg, uint32_t cfgSize)

Open and initialize the Enet Peripheral.

Opens and initializes the Enet Peripheral with the configuration parameters provided by the caller.

Parameters

  hPer | Enet Peripheral handle
  enetType | Enet Peripheral type
  instId | Enet Peripheral instance id
  cfg | Configuration parameters
  cfgSize | Size of the configuration parameters

Returns
  Enet_ErrorCodes

## ◆ EnetPer_Rejoin

typedef int32_t(* const EnetPer_Rejoin) (EnetPer_Handle hPer, Enet_Type enetType, uint32_t instId)

Rejoin a running Enet Peripheral.

Reopens the Enet Peripheral, but doesn't perform any hardware initialization. This function is expected to be called to attach to a running peripheral.

This is an optional function and could be set to NULL if the peripheral doesn't implement it.

Parameters

  hPer | Enet Peripheral handle
  enetType | Enet Peripheral type
  instId | Enet Peripheral instance id

Returns
  Enet_ErrorCodes

## ◆ EnetPer_Ioctl

typedef int32_t(* const EnetPer_Ioctl) (EnetPer_Handle hPer, uint32_t cmd, Enet_IoctlPrms *prms)

Issue an operation on the Enet Peripheral.

Issues a control operation on the Enet Peripheral.

Parameters

  hPer | Enet Peripheral handle
  cmd | IOCTL command Id
  prms | IOCTL parameters

Returns
  Enet_ErrorCodes

## ◆ EnetPer_Poll

typedef void(* const EnetPer_Poll) (EnetPer_Handle hPer, Enet_Event evt, const void *arg, uint32_t argSize)

Poll for Ethernet events.

Unblocking poll for the events specified in `evt`.

This is an optional function and could be set to NULL if the peripheral doesn't implement it.

Parameters

  hPer | Enet Peripheral handle
  evt | Event type
  arg | Pointer to the poll argument. This is specific to the poll event type
  argSize | Size of `arg`

## ◆ EnetPer_ConvertTs

typedef uint64_t(* const EnetPer_ConvertTs) (EnetPer_Handle hPer, uint64_t ts)

Convert a timestamp to nanoseconds.

Converts a peripheral-specific timestamp value to nanoseconds value. Timestamp values could be defined as bitfields or absolute values, so the peripheral has to perform the conversion to a nanosecond value, so it's presented in an uniform unit to the application.

This is an optional function and could be set to NULL if the peripheral doesn't implement it.

Parameters

  hPer | Enet Peripheral handle
  ts | Timestamp value, definition is peripheral specific

Returns
  Nanoseconds value.

## ◆ EnetPer_PeriodicTick

typedef void(* const EnetPer_PeriodicTick) (EnetPer_Handle hPer)

Run periodic tick on the Ethernet peripheral.

Run PHY periodic tick on the Ethernet peripheral.

Parameters

  hPer | Enet Peripheral handle

## ◆ EnetPer_RegisterEventCb

typedef void(* const EnetPer_RegisterEventCb) (EnetPer_Handle hPer, Enet_Event evt, uint32_t evtNum, Enet_EventCallback evtCb, void *evtCbArgs)

Register a callback for an event.

Registers a callback for an event. The callback will be called either via Enet_poll() when interrupts are disabled or internally by the driver when servicing an interrupt in ISR context.

Parameters

  hPer | Enet Peripheral handle
  evt | Event being registered for
  evtNum | Event number. Use 0 for single event.
  evtCb | Callback function
  evtCbArgs | Callback function arguments

## ◆ EnetPer_UnregisterEventCb

typedef void(* const EnetPer_UnregisterEventCb) (EnetPer_Handle hPer, Enet_Event evt, uint32_t evtNum)

Unregister callback for an event.

Unregisters a callback for an event.

Parameters

  hPer | Enet Peripheral handle
  evt | Event being registered for
  evtNum | Event number. Use 0 for single event.

## ◆ EnetPer_Close

typedef void(* const EnetPer_Close) (EnetPer_Handle hPer)

Close the Enet Peripheral.

Closes the Enet Peripheral.

Parameters

  hPer | Enet Peripheral handle

## ◆ EnetPer_SaveCtxt

typedef void(* const EnetPer_SaveCtxt) (EnetPer_Handle hPer)

Save and close the Enet Peripheral.

Saves and Closes the Enet Peripheral.

Parameters

  hPer | Enet Peripheral handle

## ◆ EnetPer_RestoreCtxt

typedef int32_t(* const EnetPer_RestoreCtxt) (EnetPer_Handle hPer, Enet_Type enetType, uint32_t instId)

Restores and Opens the Enet Peripheral.

Restores and opens the Enet Peripheral with the configuration parameters provided by the caller.

Parameters

  hPer | Enet Peripheral handle
  enetType | Enet Peripheral type
  instId | Enet Peripheral instance id

Returns
  Enet_ErrorCodes

## Enumeration Type Documentation

## ◆ EnetPer_Ioctl_e

enum EnetPer_Ioctl_e

Ethernet peripheral IOCTL commands.

Enumerator
ENET_PER_IOCTL_GET_VERSION | Get the hardware version of the peripheral. IOCTL parameters: inArgs: None outArgs: Enet_Version
ENET_PER_IOCTL_PRINT_REGS | Print registers of the peripheral and all its modules. IOCTL parameters: inArgs: None outArgs: None
ENET_PER_IOCTL_OPEN_PORT_LINK | Open port link (MAC port and PHY). IOCTL parameters: inArgs: EnetPer_PortLinkCfg outArgs: None
ENET_PER_IOCTL_CLOSE_PORT_LINK | Close port link (MAC port and PHY). IOCTL parameters: inArgs: Enet_MacPort outArgs: None
ENET_PER_IOCTL_IS_PORT_LINK_UP | Check if port link is up. IOCTL parameters: inArgs: Enet_MacPort outArgs: bool
ENET_PER_IOCTL_GET_PORT_LINK_CFG | Get port link configuration (speed and duplexity). IOCTL parameters: inArgs: Enet_MacPort outArgs: EnetMacPort_LinkCfg
ENET_PER_IOCTL_ATTACH_CORE | Attach core to Ethernet peripheral. IOCTL parameters: inArgs: uint32_t outArgs: EnetPer_AttachCoreOutArgs
ENET_PER_IOCTL_DETACH_CORE | Detach core from Ethernet peripheral using its core key. IOCTL parameters: inArgs: uint32_t outArgs: None
ENET_IOCTL_REGISTER_RX_DEFAULT_FLOW | Register default flow to a specific rx flow. IOCTL parameters: inArgs: Enet_DfltFlowInfo outArgs: None
ENET_IOCTL_UNREGISTER_RX_DEFAULT_FLOW | Unregister default flow. After unregistering default flow, default flow traffic will be directed to CPSW internal reserved flow where they will be dropped. IOCTL parameters: inArgs: Enet_DfltFlowInfo outArgs: None
ENET_IOCTL_REGISTER_DSTMAC_RX_FLOW | Register destination MAC address to a specific rx flow. Note that CPSW supports associating multiple L2/L3 header fields to a specific rx flow. Refer ALE API CPSW_ALE_IOCTL_SET_POLICER for details on how to associate fields other than DST MAC to a specific flow. IOCTL parameters: inArgs: Enet_MacDstFlowInfo outArgs: None
ENET_IOCTL_UNREGISTER_DSTMAC_RX_FLOW | Unregister destination MAC address to a specific flow. After unregistering dstmac, traffic with associated MAC address will be directed to default flow. IOCTL parameters: inArgs: Enet_MacDstFlowInfo outArgs: None
ENET_PER_IOCTL_SET_VLAN_AWARE | Enable VLAN aware mode. Enables VLAN aware mode at peripheral level. IOCTL parameters: inArgs: None outArgs: None
ENET_PER_IOCTL_SET_VLAN_UNAWARE | Disable VLAN aware mode. Disables VLAN aware mode at peripheral level. IOCTL parameters: inArgs: None outArgs: None
ENET_PER_IOCTL_HANDLE_EXTPHY_LINKUP_EVENT | Handle link up event for an externally managed PHY. IOCTL params: inArgs: Enet_ExtPhyLinkUpEventInfo outArgs: None Type: Synchronous.
ENET_PER_IOCTL_HANDLE_EXTPHY_LINKDOWN_EVENT | Handle link down event for an externally managed PHY. IOCTL params: inArgs: # outArgs: None Type: Synchronous.
ENET_PER_IOCTL_REGISTER_IOCTL_HANDLER | Register IOCTL handler. IOCTL params: inArgs: Enet_IoctlRegisterHandlerInArgs outArgs: None Type: Synchronous.
ENET_PER_IOCTL_SET_ISOLATE_STATE | Setting PHY ISOLATE mode. Settting the PHY to ISOLATE mode IOCTL parameters: inArgs: None outArgs: None
ENET_PER_IOCTL_CLEAR_ISOLATE_STATE | Clear PHY ISOLATE mode. Clear the PHY ISOLATE mode IOCTL parameters: inArgs: None outArgs: None

ENET_IOCTL_TYPE_PUBLIC
@ ENET_IOCTL_TYPE_PUBLIC
Definition: enet_ioctl.h:216