PDK API Guide for J721E
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
 Input args for ENET_IOCTL_REGISTER_DSTMAC_RX_FLOW and ENET_IOCTL_UNREGISTER_DSTMAC_RX_FLOW commands. 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  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(* EnetPer_InitCfg) (EnetPer_Handle hPer, Enet_Type enetType, void *cfg, uint32_t cfgSize)
 Initialize peripheral's configuration parameters. More...
 
typedef int32_t(* 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(* EnetPer_Rejoin) (EnetPer_Handle hPer, Enet_Type enetType, uint32_t instId)
 Rejoin a running Enet Peripheral. More...
 
typedef int32_t(* EnetPer_Ioctl) (EnetPer_Handle hPer, uint32_t cmd, Enet_IoctlPrms *prms)
 Issue an operation on the Enet Peripheral. More...
 
typedef void(* EnetPer_Poll) (EnetPer_Handle hPer, Enet_Event evt, const void *arg, uint32_t argSize)
 Poll for Ethernet events. More...
 
typedef uint64_t(* EnetPer_ConvertTs) (EnetPer_Handle hPer, uint64_t ts)
 Convert a timestamp to nanoseconds. More...
 
typedef void(* EnetPer_PeriodicTick) (EnetPer_Handle hPer)
 Run periodic tick on the Ethernet peripheral. More...
 
typedef void(* 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(* EnetPer_UnregisterEventCb) (EnetPer_Handle hPer, Enet_Event evt, uint32_t evtNum)
 Unregister callback for an event. More...
 
typedef void(* EnetPer_Close) (EnetPer_Handle hPer)
 Close 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)
}
 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_PER_BASE | \
ENET_IOCTL_MIN(x))
Definition: enet_ioctl.h:167

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(* 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
hPerEnet Peripheral handle
enetTypeEnet Peripheral type
cfgConfiguration parameters to be initialized
cfgSizeSize of the configuration parameters

◆ EnetPer_Open

typedef int32_t(* 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
hPerEnet Peripheral handle
enetTypeEnet Peripheral type
instIdEnet Peripheral instance id
cfgConfiguration parameters
cfgSizeSize of the configuration parameters
Returns
Enet_ErrorCodes

◆ EnetPer_Rejoin

typedef int32_t(* 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
hPerEnet Peripheral handle
enetTypeEnet Peripheral type
instIdEnet Peripheral instance id
Returns
Enet_ErrorCodes

◆ EnetPer_Ioctl

typedef int32_t(* 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
hPerEnet Peripheral handle
cmdIOCTL command Id
prmsIOCTL parameters
Returns
Enet_ErrorCodes

◆ EnetPer_Poll

typedef void(* 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
hPerEnet Peripheral handle
evtEvent type
argPointer to the poll argument. This is specific to the poll event type
argSizeSize of arg

◆ EnetPer_ConvertTs

typedef uint64_t(* 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
hPerEnet Peripheral handle
tsTimestamp value, definition is peripheral specific
Returns
Nanoseconds value.

◆ EnetPer_PeriodicTick

typedef void(* EnetPer_PeriodicTick) (EnetPer_Handle hPer)

Run periodic tick on the Ethernet peripheral.

Run PHY periodic tick on the Ethernet peripheral.

Parameters
hPerEnet Peripheral handle

◆ EnetPer_RegisterEventCb

typedef void(* 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
hPerEnet Peripheral handle
evtEvent being registered for
evtNumEvent number. Use 0 for single event.
evtCbCallback function
evtCbArgsCallback function arguments

◆ EnetPer_UnregisterEventCb

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

Unregister callback for an event.

Unregisters a callback for an event.

Parameters
hPerEnet Peripheral handle
evtEvent being registered for
evtNumEvent number. Use 0 for single event.

◆ EnetPer_Close

typedef void(* EnetPer_Close) (EnetPer_Handle hPer)

Close the Enet Peripheral.

Closes the Enet Peripheral.

Parameters
hPerEnet Peripheral handle

Enumeration Type Documentation

◆ EnetPer_Ioctl_e

Ethernet peripheral IOCTL commands.

Enumerator
ENET_PER_IOCTL_GET_VERSION 

Get the hardware version of the peripheral.

IOCTL parameters:

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:

ENET_PER_IOCTL_CLOSE_PORT_LINK 

Close port link (MAC port and PHY).

IOCTL parameters:

ENET_PER_IOCTL_IS_PORT_LINK_UP 

Check if port link is up.

IOCTL parameters:

ENET_PER_IOCTL_GET_PORT_LINK_CFG 

Get port link configuration (speed and duplexity).

IOCTL parameters:

ENET_PER_IOCTL_ATTACH_CORE 

Attach core to Ethernet peripheral.

IOCTL parameters:

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:

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:

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:

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:

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