AM64x MCU+ SDK  08.02.00

Introduction

Data Structures

struct  Enet_IoctlPrms
 Enet IOCTL param. More...
 
struct  Enet_IoctlValidate
 Enet IOCTL expected param sizes. More...
 
struct  Enet_Version
 Version of a peripheral or module. More...
 
struct  Enet_VlanTag
 VLAN tag. More...
 

Functions

static uint32_t Enet_checkInArgs (const Enet_IoctlPrms *prms, uint32_t inArgsSize)
 Check IOCTL input args for commands that expect an input. More...
 
static uint32_t Enet_checkNoInArgs (const Enet_IoctlPrms *prms)
 Check IOCTL input args for commands that don't expect an input. More...
 
static uint32_t Enet_checkOutArgs (const Enet_IoctlPrms *prms, uint32_t outArgsSize)
 Check IOCTL output args for commands that expect an output. More...
 
static uint32_t Enet_checkNoOutArgs (const Enet_IoctlPrms *prms)
 Check IOCTL output args for commands that don't have output. More...
 
static uint32_t Enet_checkInOutArgs (const Enet_IoctlPrms *prms, uint32_t inArgsSize, uint32_t outArgsSize)
 Check IOCTL input and output args. More...
 
static bool Enet_isCpswFamily (Enet_Type enetType)
 Check if Ethernet peripheral type is part of CPSW family. More...
 
static bool Enet_isIcssFamily (Enet_Type enetType)
 Check if Ethernet peripheral type is part of ICSS family. More...
 
uint32_t Enet_getCoreId (void)
 
EnetTrace_TraceLevel Enet_setTraceLevel (EnetTrace_TraceLevel level)
 Set global trace level. More...
 
EnetTrace_TraceLevel Enet_getTraceLevel (void)
 Get current trace level. More...
 
void Enet_initOsalCfg (EnetOsal_Cfg *osalCfg)
 Initialize OSAL configuration. More...
 
void Enet_initUtilsCfg (EnetUtils_Cfg *utilsCfg)
 Initialize utils configuration. More...
 
void Enet_init (const EnetOsal_Cfg *osalCfg, const EnetUtils_Cfg *utilsCfg)
 Initialize Enet LLD. More...
 
void Enet_deinit (void)
 De-initialize Enet LLD. More...
 
Enet_Handle Enet_getHandle (Enet_Type enetType, uint32_t instId)
 Get the Enet handle of a peripheral. More...
 
uint32_t Enet_getMacPortMax (Enet_Type enetType, uint32_t instId)
 Get number of MAC ports available in the Ethernet peripheral. More...
 
void Enet_initCfg (Enet_Type enetType, uint32_t instId, void *cfg, uint32_t cfgSize)
 Initialize the peripheral configuration parameters. More...
 
Enet_Handle Enet_open (Enet_Type enetType, uint32_t instId, const void *cfg, uint32_t cfgSize)
 Open and initializes the Enet driver for a peripheral. More...
 
Enet_Handle Enet_rejoin (Enet_Type enetType, uint32_t instId)
 Rejoin a running Ethernet peripheral. More...
 
EnetDma_Handle Enet_getDmaHandle (Enet_Handle hEnet)
 Get the handle to the DMA used for packet transmit/receive. More...
 
int32_t Enet_ioctl (Enet_Handle hEnet, uint32_t coreId, uint32_t cmd, Enet_IoctlPrms *prms)
 Issue an operation on the Enet Peripheral. More...
 
void Enet_registerEventCb (Enet_Handle hEnet, Enet_Event evt, uint32_t evtNum, Enet_EventCallback evtCb, void *evtCbArgs)
 Register a callback for an event. More...
 
void Enet_unregisterEventCb (Enet_Handle hEnet, Enet_Event evt, uint32_t evtNum)
 Unregister callback for an event. More...
 
void Enet_poll (Enet_Handle hEnet, Enet_Event evt, const void *arg, uint32_t argSize)
 Poll for Ethernet events. More...
 
void Enet_periodicTick (Enet_Handle hEnet)
 Run periodic tick on the Ethernet peripheral. More...
 
uint32_t Enet_getMacPortCnt (Enet_Handle hEnet)
 Get number of MAC ports available in the Ethernet peripheral. More...
 
void Enet_close (Enet_Handle hEnet)
 Close the Enet peripheral. More...
 

Typedefs

typedef void(* Enet_EventCallback) (Enet_Event evt, uint32_t evtNum, void *evtCbArgs, void *arg1, void *arg2)
 Event callback. More...
 

Enumerations

enum  Enet_IoctlType_e { ENET_IOCTL_TYPE_PUBLIC = ENET_IOCTL_TYPE(1U), ENET_IOCTL_TYPE_PRIVATE = ENET_IOCTL_TYPE(2U) }
 IOCTL types. More...
 
enum  Enet_IoctlPer_e { ENET_IOCTL_PER_GENERIC = ENET_IOCTL_PER(0U), ENET_IOCTL_PER_CPSW = ENET_IOCTL_PER(1U), ENET_IOCTL_PER_ICSSG = ENET_IOCTL_PER(2U), ENET_IOCTL_PER_GMAC = ENET_IOCTL_PER(3U) }
 IOCTL peripheral types. More...
 
enum  Enet_IoctlMajor_e {
  ENET_IOCTL_PER_BASE = ENET_IOCTL_MAJ(1U), ENET_IOCTL_FDB_BASE = ENET_IOCTL_MAJ(2U), ENET_IOCTL_TIMESYNC_BASE = ENET_IOCTL_MAJ(3U), ENET_IOCTL_HOSTPORT_BASE = ENET_IOCTL_MAJ(4U),
  ENET_IOCTL_MACPORT_BASE = ENET_IOCTL_MAJ(5U), ENET_IOCTL_MDIO_BASE = ENET_IOCTL_MAJ(6U), ENET_IOCTL_STATS_BASE = ENET_IOCTL_MAJ(7U), ENET_IOCTL_PHY_BASE = ENET_IOCTL_MAJ(9U),
  ENET_IOCTL_RM_BASE = ENET_IOCTL_MAJ(10U), ENET_IOCTL_TAS_BASE = ENET_IOCTL_MAJ(11U)
}
 IOCTL base number. More...
 
enum  Enet_Type {
  ENET_NULL, ENET_ICSSG_DUALMAC, ENET_ICSSG_SWITCH, ENET_GMAC_3G,
  ENET_CPSW_2G, ENET_CPSW_3G, ENET_CPSW_5G, ENET_CPSW_9G,
  ENET_TYPE_COUNT
}
 Ethernet peripheral type. More...
 
enum  Enet_Magic { ENET_MAGIC = 0xABABABABU, ENET_NO_MAGIC = 0x0U }
 Enet driver magic value, used to indicate if driver is open or not. More...
 
enum  Enet_CrcType { ENET_CRC_ETHERNET = 0U, ENET_CRC_CASTAGNOLI }
 CRC type. More...
 
enum  Enet_Event {
  ENET_EVT_NONE = 0U, ENET_EVT_ASYNC_CMD_RESP = ENET_BIT(0U), ENET_EVT_TIMESTAMP_SWPUSH = ENET_BIT(1U), ENET_EVT_TIMESTAMP_HWPUSH = ENET_BIT(2U),
  ENET_EVT_TIMESTAMP_ROLLOVER = ENET_BIT(3U), ENET_EVT_TIMESTAMP_HALFROLLOVER = ENET_BIT(4U), ENET_EVT_TIMESTAMP_RX = ENET_BIT(5U), ENET_EVT_TIMESTAMP_TX = ENET_BIT(6U),
  ENET_EVT_TIMESTAMP_COMP = ENET_BIT(7U), ENET_EVT_TIMESTAMP_HOSTTX = ENET_BIT(8U), ENET_EVT_ANY = 0xFFFFFFFFU
}
 Ethernet events. More...
 
enum  Enet_Speed { ENET_SPEED_10MBIT = 0U, ENET_SPEED_100MBIT, ENET_SPEED_1GBIT, ENET_SPEED_AUTO }
 MAC interface speed. More...
 
enum  Enet_Duplexity { ENET_DUPLEX_HALF = 0U, ENET_DUPLEX_FULL, ENET_DUPLEX_AUTO }
 MAC interface duplexity. More...
 
enum  Enet_VlanTagType { ENET_VLAN_TAG_TYPE_INNER = 0U, ENET_VLAN_TAG_TYPE_OUTER }
 Double tagging VLAN type. More...
 
enum  Enet_MacPort {
  ENET_MAC_PORT_FIRST = 0U, ENET_MAC_PORT_1 = ENET_MAC_PORT_FIRST, ENET_MAC_PORT_2 = 1U, ENET_MAC_PORT_3 = 2U,
  ENET_MAC_PORT_4 = 3U, ENET_MAC_PORT_5 = 4U, ENET_MAC_PORT_6 = 5U, ENET_MAC_PORT_7 = 6U,
  ENET_MAC_PORT_8 = 7U, ENET_MAC_PORT_LAST = ENET_MAC_PORT_8
}
 MAC port. More...
 

Macros

#define ENET_IOCTL_TYPE_OFFSET   (24U)
 IOCTL type bit offset. More...
 
#define ENET_IOCTL_PER_OFFSET   (16U)
 IOCTL hardware peripheral bit offset. More...
 
#define ENET_IOCTL_MAJOR_OFFSET   (8U)
 IOCTL major number bit offset. More...
 
#define ENET_IOCTL_MINOR_OFFSET   (0U)
 IOCTL minor number bit offset. More...
 
#define ENET_IOCTL_GET_TYPE(x)   ((x) & 0xFF000000U)
 Helper macro to get the IOCTL type (public/private). More...
 
#define ENET_IOCTL_GET_PER(x)   ((x) & 0x00FF0000U)
 Helper macro to get the peripheral type. More...
 
#define ENET_IOCTL_GET_MAJ(x)   ((x) & 0x0000FF00U)
 Helper macro to get the IOCTL major number. More...
 
#define ENET_IOCTL_GET_MIN(x)   ((x) & 0x000000FFU)
 Helper macro to get the IOCTL major number. More...
 
#define ENET_IOCTL_TYPE(x)   ((x) << ENET_IOCTL_TYPE_OFFSET)
 Helper macro to set the IOCTL type. More...
 
#define ENET_IOCTL_PER(x)   ((x) << ENET_IOCTL_PER_OFFSET)
 Helper macro to set the IOCTL type. More...
 
#define ENET_IOCTL_MAJ(x)   ((x) << ENET_IOCTL_MAJOR_OFFSET)
 Helper macro to set the IOCTL major number. More...
 
#define ENET_IOCTL_MIN(x)   ((x) << ENET_IOCTL_MINOR_OFFSET)
 Helper macro to set the IOCTL minor number. More...
 
#define ENET_IOCTL_SET_NO_ARGS(prms)
 Set null args for an IOCTL command that takes no arguments. More...
 
#define ENET_IOCTL_SET_IN_ARGS(prms, in)
 Set the input args for an IOCTL command. More...
 
#define ENET_IOCTL_SET_OUT_ARGS(prms, out)
 Set the output args for an IOCTL command. More...
 
#define ENET_IOCTL_SET_INOUT_ARGS(prms, in, out)
 Set the input and output args for an IOCTL command. More...
 
#define ENET_IOCTL_VALID_PRMS(cmdId, inSize, outSize)
 Helper macro used to add an entry in a IOCTL valid information of type Enet_IoctlValidate. More...
 
#define ENET_ARRAYSIZE(x)   (sizeof(x) / sizeof(x[0]))
 Macro to get the size of an array. More...
 
#define ENET_BIT(n)   (1U << (n))
 Macro to set bit at given bit position. More...
 
#define ENET_GET_BIT(val, n)   (((val) & ENET_BIT(n)) >> (n))
 Macro to get bit at given bit position. More...
 
#define ENET_IS_BIT_SET(val, n)   (((val) & ENET_BIT(n)) != 0U)
 Macro to check if bit at given bit position is set. More...
 
#define ENET_NOT_ZERO(val)   ((uint32_t)0U != (uint32_t)(val))
 Macro to check if value is not zero. More...
 
#define ENET_FEXT(reg, PER_REG_FIELD)    (((reg) & PER_REG_FIELD##_MASK) >> PER_REG_FIELD##_SHIFT)
 Field EXTract macro. We can't use CSL macro as it appends shift/mask with CSL_. More...
 
#define ENET_FINS(reg, PER_REG_FIELD, val)
 Field INSert macro. We can't use CSL macro as it appends shift/mask with CSL_. More...
 
#define ENET_DIV_ROUNDUP(val, div)   (((val) + (div) - 1) / (div))
 Macro to perform round-up division. More...
 
#define ENET_VERSION_NONE   (0xFFFFFFFFU)
 Version field is not supported. More...
 
#define ENET_MAC_ADDR_LEN   (6U)
 MAC address length in bytes/octets. More...
 
#define ENET_OUI_ADDR_LEN   (3U)
 Organization Unique Id (OUI) address length in bytes/octets. More...
 
#define ENET_IPv4_ADDR_LEN   (4U)
 IPv4 address length in bytes/octets. More...
 
#define ENET_IPv6_ADDR_LEN   (16U)
 IPv6 address length in bytes/octets. More...
 
#define ENET_PRI_NUM   (8U)
 Packet priority. More...
 
#define ENET_PRI_MIN   (0U)
 Lowest packet priority. More...
 
#define ENET_PRI_MAX   (ENET_PRI_NUM - 1U)
 Lowest packet priority. More...
 
#define ENET_TOS_PRI_NUM   (64U)
 Type of Service (ToS) priority. More...
 
#define ENET_TOS_PRI_MIN   (0U)
 Lowest ToS priority. More...
 
#define ENET_TOS_PRI_MAX   (ENET_TOS_PRI_NUM - 1U)
 Highest ToS priority. More...
 
#define ENET_VLAN_ID_MAX   (4095U)
 Maximum value for VLAN ID. More...
 
#define ENET_ETHERTYPE_PTP   (0x88F7U)
 EtherType value for PTP over Ethernet Annex F (IEEE 802.3). More...
 
#define ENET_TYPE_NUM   (ENET_TYPE_COUNT + 1U)
 Number of supported Ethernet peripheral types. More...
 
#define ENET_MAC_PORT_NUM   ((uint32_t)ENET_MAC_PORT_LAST + 1U)
 Number of MAC ports - For internal use only. More...
 
#define ENET_MACPORT_NORM(n)   ((n) - ENET_MAC_PORT_FIRST)
 Normalize Enet_MacPort. More...
 
#define ENET_MACPORT_DENORM(n)   ((Enet_MacPort)((n) + ENET_MAC_PORT_FIRST))
 De-normalize Enet_MacPort. More...
 
#define ENET_MACPORT_ID(n)   ((n) - ENET_MAC_PORT_FIRST + 1U)
 Convert Enet_MacPort to an integer id. More...
 
#define ENET_MAC_PORT_INV   ((Enet_MacPort)0xFFFFU)
 MAC invalid port number. Used for error checks only. More...
 
#define ENET_TRAFFIC_CLASS_INV   ((uint32_t)0xFFFFU)
 TX traffic class invalid value. Used for error checks only. More...
 
#define ENET_MACPORT_MASK(n)   (ENET_BIT(ENET_MACPORT_NORM(n)))
 Convert Enet_MacPort to a bit mask. More...
 

Enet Error Codes

Error codes returned by the Enet driver APIs.

#define ENET_SOK   (CSL_PASS)
 Success. More...
 
#define ENET_SINPROGRESS   (1)
 Operation in progress. More...
 
#define ENET_EFAIL   (CSL_EFAIL)
 Generic failure error condition (typically caused by hardware). More...
 
#define ENET_EBADARGS   (CSL_EBADARGS)
 Bad arguments (i.e. NULL pointer). More...
 
#define ENET_EINVALIDPARAMS   (CSL_EINVALID_PARAMS)
 Invalid parameters (i.e. value out-of-range). More...
 
#define ENET_ETIMEOUT   (CSL_ETIMEOUT)
 Time out while waiting for a given condition to happen. More...
 
#define ENET_EALLOC   (CSL_EALLOC)
 Allocation failure. More...
 
#define ENET_EUNEXPECTED   (CSL_EALLOC - 1)
 Unexpected condition occurred (sometimes unrecoverable). More...
 
#define ENET_EBUSY   (CSL_EALLOC - 2)
 The resource is currently busy performing an operation. More...
 
#define ENET_EALREADYOPEN   (CSL_EALLOC - 3)
 Already open error. More...
 
#define ENET_EPERM   (CSL_EALLOC - 4)
 Operation not permitted. More...
 
#define ENET_ENOTSUPPORTED   (CSL_EALLOC - 5)
 Operation not supported. More...
 
#define ENET_ENOTFOUND   (CSL_EALLOC - 6)
 Resource not found. More...
 
#define ENET_EUNKNOWNIOCTL   (CSL_EALLOC - 7)
 Unknown IOCTL. More...
 
#define ENET_EMALFORMEDIOCTL   (CSL_EALLOC - 8)
 Malformed IOCTL (args pointer or size not as expected). More...
 

Macro Definition Documentation

◆ ENET_IOCTL_TYPE_OFFSET

#define ENET_IOCTL_TYPE_OFFSET   (24U)

IOCTL type bit offset.

◆ ENET_IOCTL_PER_OFFSET

#define ENET_IOCTL_PER_OFFSET   (16U)

IOCTL hardware peripheral bit offset.

◆ ENET_IOCTL_MAJOR_OFFSET

#define ENET_IOCTL_MAJOR_OFFSET   (8U)

IOCTL major number bit offset.

◆ ENET_IOCTL_MINOR_OFFSET

#define ENET_IOCTL_MINOR_OFFSET   (0U)

IOCTL minor number bit offset.

◆ ENET_IOCTL_GET_TYPE

#define ENET_IOCTL_GET_TYPE (   x)    ((x) & 0xFF000000U)

Helper macro to get the IOCTL type (public/private).

◆ ENET_IOCTL_GET_PER

#define ENET_IOCTL_GET_PER (   x)    ((x) & 0x00FF0000U)

Helper macro to get the peripheral type.

◆ ENET_IOCTL_GET_MAJ

#define ENET_IOCTL_GET_MAJ (   x)    ((x) & 0x0000FF00U)

Helper macro to get the IOCTL major number.

◆ ENET_IOCTL_GET_MIN

#define ENET_IOCTL_GET_MIN (   x)    ((x) & 0x000000FFU)

Helper macro to get the IOCTL major number.

◆ ENET_IOCTL_TYPE

#define ENET_IOCTL_TYPE (   x)    ((x) << ENET_IOCTL_TYPE_OFFSET)

Helper macro to set the IOCTL type.

◆ ENET_IOCTL_PER

#define ENET_IOCTL_PER (   x)    ((x) << ENET_IOCTL_PER_OFFSET)

Helper macro to set the IOCTL type.

◆ ENET_IOCTL_MAJ

#define ENET_IOCTL_MAJ (   x)    ((x) << ENET_IOCTL_MAJOR_OFFSET)

Helper macro to set the IOCTL major number.

◆ ENET_IOCTL_MIN

#define ENET_IOCTL_MIN (   x)    ((x) << ENET_IOCTL_MINOR_OFFSET)

Helper macro to set the IOCTL minor number.

◆ ENET_IOCTL_SET_NO_ARGS

#define ENET_IOCTL_SET_NO_ARGS (   prms)
Value:
{ \
(prms)->inArgs = NULL; \
(prms)->inArgsSize = 0U; \
(prms)->outArgs = NULL; \
(prms)->outArgsSize = 0U; \
}

Set null args for an IOCTL command that takes no arguments.

◆ ENET_IOCTL_SET_IN_ARGS

#define ENET_IOCTL_SET_IN_ARGS (   prms,
  in 
)
Value:
{ \
(prms)->inArgs = (in); \
(prms)->inArgsSize = sizeof(*(in)); \
(prms)->outArgs = NULL; \
(prms)->outArgsSize = 0U; \
}

Set the input args for an IOCTL command.

◆ ENET_IOCTL_SET_OUT_ARGS

#define ENET_IOCTL_SET_OUT_ARGS (   prms,
  out 
)
Value:
{ \
(prms)->inArgs = NULL; \
(prms)->inArgsSize = 0U; \
(prms)->outArgs = (out); \
(prms)->outArgsSize = sizeof(*(out)); \
}

Set the output args for an IOCTL command.

◆ ENET_IOCTL_SET_INOUT_ARGS

#define ENET_IOCTL_SET_INOUT_ARGS (   prms,
  in,
  out 
)
Value:
{ \
(prms)->inArgs = (in); \
(prms)->inArgsSize = sizeof(*(in)); \
(prms)->outArgs = (out); \
(prms)->outArgsSize = sizeof(*(out)); \
}

Set the input and output args for an IOCTL command.

◆ ENET_IOCTL_VALID_PRMS

#define ENET_IOCTL_VALID_PRMS (   cmdId,
  inSize,
  outSize 
)
Value:
[ENET_IOCTL_GET_MIN(cmdId)] = \
{ \
.cmd = (cmdId), \
.inArgsSize = (inSize), \
.outArgsSize = (outSize), \
}

Helper macro used to add an entry in a IOCTL valid information of type Enet_IoctlValidate.

◆ ENET_SOK

#define ENET_SOK   (CSL_PASS)

Success.

◆ ENET_SINPROGRESS

#define ENET_SINPROGRESS   (1)

Operation in progress.

◆ ENET_EFAIL

#define ENET_EFAIL   (CSL_EFAIL)

Generic failure error condition (typically caused by hardware).

◆ ENET_EBADARGS

#define ENET_EBADARGS   (CSL_EBADARGS)

Bad arguments (i.e. NULL pointer).

◆ ENET_EINVALIDPARAMS

#define ENET_EINVALIDPARAMS   (CSL_EINVALID_PARAMS)

Invalid parameters (i.e. value out-of-range).

◆ ENET_ETIMEOUT

#define ENET_ETIMEOUT   (CSL_ETIMEOUT)

Time out while waiting for a given condition to happen.

◆ ENET_EALLOC

#define ENET_EALLOC   (CSL_EALLOC)

Allocation failure.

◆ ENET_EUNEXPECTED

#define ENET_EUNEXPECTED   (CSL_EALLOC - 1)

Unexpected condition occurred (sometimes unrecoverable).

◆ ENET_EBUSY

#define ENET_EBUSY   (CSL_EALLOC - 2)

The resource is currently busy performing an operation.

◆ ENET_EALREADYOPEN

#define ENET_EALREADYOPEN   (CSL_EALLOC - 3)

Already open error.

◆ ENET_EPERM

#define ENET_EPERM   (CSL_EALLOC - 4)

Operation not permitted.

◆ ENET_ENOTSUPPORTED

#define ENET_ENOTSUPPORTED   (CSL_EALLOC - 5)

Operation not supported.

◆ ENET_ENOTFOUND

#define ENET_ENOTFOUND   (CSL_EALLOC - 6)

Resource not found.

◆ ENET_EUNKNOWNIOCTL

#define ENET_EUNKNOWNIOCTL   (CSL_EALLOC - 7)

Unknown IOCTL.

◆ ENET_EMALFORMEDIOCTL

#define ENET_EMALFORMEDIOCTL   (CSL_EALLOC - 8)

Malformed IOCTL (args pointer or size not as expected).

◆ ENET_ARRAYSIZE

#define ENET_ARRAYSIZE (   x)    (sizeof(x) / sizeof(x[0]))

Macro to get the size of an array.

◆ ENET_BIT

#define ENET_BIT (   n)    (1U << (n))

Macro to set bit at given bit position.

◆ ENET_GET_BIT

#define ENET_GET_BIT (   val,
 
)    (((val) & ENET_BIT(n)) >> (n))

Macro to get bit at given bit position.

◆ ENET_IS_BIT_SET

#define ENET_IS_BIT_SET (   val,
 
)    (((val) & ENET_BIT(n)) != 0U)

Macro to check if bit at given bit position is set.

◆ ENET_NOT_ZERO

#define ENET_NOT_ZERO (   val)    ((uint32_t)0U != (uint32_t)(val))

Macro to check if value is not zero.

◆ ENET_FEXT

#define ENET_FEXT (   reg,
  PER_REG_FIELD 
)     (((reg) & PER_REG_FIELD##_MASK) >> PER_REG_FIELD##_SHIFT)

Field EXTract macro. We can't use CSL macro as it appends shift/mask with CSL_.

◆ ENET_FINS

#define ENET_FINS (   reg,
  PER_REG_FIELD,
  val 
)
Value:
((reg) = ((reg) & ~PER_REG_FIELD##_MASK) \
| (((val) << PER_REG_FIELD##_SHIFT) & PER_REG_FIELD##_MASK))

Field INSert macro. We can't use CSL macro as it appends shift/mask with CSL_.

◆ ENET_DIV_ROUNDUP

#define ENET_DIV_ROUNDUP (   val,
  div 
)    (((val) + (div) - 1) / (div))

Macro to perform round-up division.

◆ ENET_VERSION_NONE

#define ENET_VERSION_NONE   (0xFFFFFFFFU)

Version field is not supported.

◆ ENET_MAC_ADDR_LEN

#define ENET_MAC_ADDR_LEN   (6U)

MAC address length in bytes/octets.

◆ ENET_OUI_ADDR_LEN

#define ENET_OUI_ADDR_LEN   (3U)

Organization Unique Id (OUI) address length in bytes/octets.

◆ ENET_IPv4_ADDR_LEN

#define ENET_IPv4_ADDR_LEN   (4U)

IPv4 address length in bytes/octets.

◆ ENET_IPv6_ADDR_LEN

#define ENET_IPv6_ADDR_LEN   (16U)

IPv6 address length in bytes/octets.

◆ ENET_PRI_NUM

#define ENET_PRI_NUM   (8U)

Packet priority.

◆ ENET_PRI_MIN

#define ENET_PRI_MIN   (0U)

Lowest packet priority.

◆ ENET_PRI_MAX

#define ENET_PRI_MAX   (ENET_PRI_NUM - 1U)

Lowest packet priority.

◆ ENET_TOS_PRI_NUM

#define ENET_TOS_PRI_NUM   (64U)

Type of Service (ToS) priority.

◆ ENET_TOS_PRI_MIN

#define ENET_TOS_PRI_MIN   (0U)

Lowest ToS priority.

◆ ENET_TOS_PRI_MAX

#define ENET_TOS_PRI_MAX   (ENET_TOS_PRI_NUM - 1U)

Highest ToS priority.

◆ ENET_VLAN_ID_MAX

#define ENET_VLAN_ID_MAX   (4095U)

Maximum value for VLAN ID.

◆ ENET_ETHERTYPE_PTP

#define ENET_ETHERTYPE_PTP   (0x88F7U)

EtherType value for PTP over Ethernet Annex F (IEEE 802.3).

◆ ENET_TYPE_NUM

#define ENET_TYPE_NUM   (ENET_TYPE_COUNT + 1U)

Number of supported Ethernet peripheral types.

◆ ENET_MAC_PORT_NUM

#define ENET_MAC_PORT_NUM   ((uint32_t)ENET_MAC_PORT_LAST + 1U)

Number of MAC ports - For internal use only.

◆ ENET_MACPORT_NORM

#define ENET_MACPORT_NORM (   n)    ((n) - ENET_MAC_PORT_FIRST)

Normalize Enet_MacPort.

Macro to normalize Enet_MacPort. It takes an Enet_MacPort enum and converts it to a zero-based index.

◆ ENET_MACPORT_DENORM

#define ENET_MACPORT_DENORM (   n)    ((Enet_MacPort)((n) + ENET_MAC_PORT_FIRST))

De-normalize Enet_MacPort.

Macro to denormalize MAC port number. It takes a zero-based port number and converts it to a Enet_MacPort enum.

◆ ENET_MACPORT_ID

#define ENET_MACPORT_ID (   n)    ((n) - ENET_MAC_PORT_FIRST + 1U)

Convert Enet_MacPort to an integer id.

Converts Enet_MacPort to an integer id that corresponds to the port number. This macro is expected to be used in prints/traces to let the user know the port number in a way that is consistent with the Enet_MacPort names.

◆ ENET_MAC_PORT_INV

#define ENET_MAC_PORT_INV   ((Enet_MacPort)0xFFFFU)

MAC invalid port number. Used for error checks only.

◆ ENET_TRAFFIC_CLASS_INV

#define ENET_TRAFFIC_CLASS_INV   ((uint32_t)0xFFFFU)

TX traffic class invalid value. Used for error checks only.

◆ ENET_MACPORT_MASK

#define ENET_MACPORT_MASK (   n)    (ENET_BIT(ENET_MACPORT_NORM(n)))

Convert Enet_MacPort to a bit mask.

Converts a Enet_MacPort to a bit mask to be used in APIs that take a port mask.

Typedef Documentation

◆ Enet_EventCallback

typedef void(* Enet_EventCallback) (Enet_Event evt, uint32_t evtNum, void *evtCbArgs, void *arg1, void *arg2)

Event callback.

Parameters
evtEvent being registered for
evtNumEvent number (0 if single event)
evtCbArgsCallback argument given during registration in Enet_registerEventCb()
arg1Event specific argument
arg2Event specific argument

Enumeration Type Documentation

◆ Enet_IoctlType_e

IOCTL types.

Enumerator
ENET_IOCTL_TYPE_PUBLIC 

Public IOCTL type (default type if omitted)

ENET_IOCTL_TYPE_PRIVATE 

Private IOCTL type

◆ Enet_IoctlPer_e

IOCTL peripheral types.

Enumerator
ENET_IOCTL_PER_GENERIC 

Generic IOCTLs

ENET_IOCTL_PER_CPSW 

CPSW specific IOCTL (agnostic of number of CPSW ports)

ENET_IOCTL_PER_ICSSG 

ICSSG specific IOCTL

ENET_IOCTL_PER_GMAC 

GMAC specific IOCTL

◆ Enet_IoctlMajor_e

IOCTL base number.

Enumerator
ENET_IOCTL_PER_BASE 

Enet peripheral IOCTL base

ENET_IOCTL_FDB_BASE 

FDB module IOCTL base

ENET_IOCTL_TIMESYNC_BASE 

TimeSync module IOCTL base

ENET_IOCTL_HOSTPORT_BASE 

Host port module IOCTL base

ENET_IOCTL_MACPORT_BASE 

MAC port module IOCTL base

ENET_IOCTL_MDIO_BASE 

MDIO module IOCTL base

ENET_IOCTL_STATS_BASE 

Statistics module IOCTL base

ENET_IOCTL_PHY_BASE 

PHY module IOCTL base

ENET_IOCTL_RM_BASE 

Resource Manager module IOCTL base

ENET_IOCTL_TAS_BASE 

TAS module IOCTL base

◆ Enet_Type

enum Enet_Type

Ethernet peripheral type.

Enumerator
ENET_NULL 

"Null" peripheral - for testing only

ENET_ICSSG_DUALMAC 

ICSSG_MAC: 1 MAC port

ENET_ICSSG_SWITCH 

ICSSG: 1 host port + 2 MAC ports

ENET_GMAC_3G 

GMAC_3G: 1 host port + 2 MAC ports

ENET_CPSW_2G 

CPSW_2G: 1 host port + 1 MAC port

ENET_CPSW_3G 

CPSW_3G: 1 host port + 2 MAC port

ENET_CPSW_5G 

CPSW_5G: 1 host port + 4 MAC ports

ENET_CPSW_9G 

CPSW_9G: 1 host port + 8 MAC ports

ENET_TYPE_COUNT 

Number of Ethernet Peripheral types - For internal use only

◆ Enet_Magic

enum Enet_Magic

Enet driver magic value, used to indicate if driver is open or not.

Enumerator
ENET_MAGIC 

Magic number used to identify when driver has been opened.

ENET_NO_MAGIC 

Magic number used to identify when driver is closed.

◆ Enet_CrcType

CRC type.

Enumerator
ENET_CRC_ETHERNET 

Ethernet CRC type

ENET_CRC_CASTAGNOLI 

Castagnoli CRC type

◆ Enet_Event

enum Enet_Event

Ethernet events.

Used for any Enet APIs that are event related such as:

  • Ethernet event types to poll for in Enet_poll() function. A poll bit mask can be constructed with any of these poll events.
  • Event callback registration, i.e. link up, link down, timestamp push events, etc.
Enumerator
ENET_EVT_NONE 

No event

ENET_EVT_ASYNC_CMD_RESP 

Response to an asynchronous command.

This event type doesn't require any additional argument in Enet_poll(), caller should pass arg = NULL and argSize = 0.

ENET_EVT_TIMESTAMP_SWPUSH 

Software timestamp push event. Currently not used.

ENET_EVT_TIMESTAMP_HWPUSH 

Hardware timestamp push event. Currently not used.

ENET_EVT_TIMESTAMP_ROLLOVER 

Timestamp half rollover event. Currently not used.

ENET_EVT_TIMESTAMP_HALFROLLOVER 

Timestamp rollover event. Currently not used.

ENET_EVT_TIMESTAMP_RX 

Timestamp receive event. Currently not used.

ENET_EVT_TIMESTAMP_TX 

Timestamp transmit event. For CPSW, the timestamp is returned in clock cycles. For ICSSG, the timestamp is returned in nanoseconds.

This event requires the port number be passed to Enet_poll(), caller should pass the port number as arg and argSize = sizeof(Enet_MacPort).

ENET_EVT_TIMESTAMP_COMP 

Timestamp compare event. Currently not used.

ENET_EVT_TIMESTAMP_HOSTTX 

Timestamp host transmit event. Currently not used.

ENET_EVT_ANY 

Any event. It could be used to flush all events when no callback is passed

◆ Enet_Speed

enum Enet_Speed

MAC interface speed.

Enumerator
ENET_SPEED_10MBIT 

10 Mbps

ENET_SPEED_100MBIT 

100 Mbps

ENET_SPEED_1GBIT 

1 Gbps

ENET_SPEED_AUTO 

Speed determined automatically

◆ Enet_Duplexity

MAC interface duplexity.

Enumerator
ENET_DUPLEX_HALF 

Half duplex

ENET_DUPLEX_FULL 

Full duplex

ENET_DUPLEX_AUTO 

Duplexity determined automatically

◆ Enet_VlanTagType

Double tagging VLAN type.

Enumerator
ENET_VLAN_TAG_TYPE_INNER 

Inner or customer tag

ENET_VLAN_TAG_TYPE_OUTER 

Outer or service tag

◆ Enet_MacPort

MAC port.

Enumerator
ENET_MAC_PORT_FIRST 

First MAC port

ENET_MAC_PORT_1 

MAC port 1

ENET_MAC_PORT_2 

MAC port 2

ENET_MAC_PORT_3 

MAC port 3

ENET_MAC_PORT_4 

MAC port 4

ENET_MAC_PORT_5 

MAC port 5

ENET_MAC_PORT_6 

MAC port 6

ENET_MAC_PORT_7 

MAC port 7

ENET_MAC_PORT_8 

MAC port 8

ENET_MAC_PORT_LAST 

Last MAC port - Used to count the number of ports

Function Documentation

◆ Enet_checkInArgs()

static uint32_t Enet_checkInArgs ( const Enet_IoctlPrms prms,
uint32_t  inArgsSize 
)
inlinestatic

Check IOCTL input args for commands that expect an input.

Helper function to check the input arguments passed to an IOCTL for commands that expect an input argument.

Parameters
prmsIOCTL parameters pointer
inArgsSizeExpected size of the input argument
Returns
ENET_SOK if inArgs pointer is not NULL and inArgsSize matches the expected size. Otherwise, ENET_EMALFORMEDIOCTL.

◆ Enet_checkNoInArgs()

static uint32_t Enet_checkNoInArgs ( const Enet_IoctlPrms prms)
inlinestatic

Check IOCTL input args for commands that don't expect an input.

Helper function to check the input arguments passed to an IOCTL for commands that don't expect an input.

Parameters
prmsIOCTL parameters pointer
Returns
ENET_SOK if inArgs pointer is NULL and inArgsSize is 0. Otherwise, ENET_EMALFORMEDIOCTL.

◆ Enet_checkOutArgs()

static uint32_t Enet_checkOutArgs ( const Enet_IoctlPrms prms,
uint32_t  outArgsSize 
)
inlinestatic

Check IOCTL output args for commands that expect an output.

Helper function to check the output arguments passed to an IOCTL for commands that expect an output argument.

Parameters
prmsIOCTL parameters pointer
outArgsSizeExpected size of the output argument
Returns
ENET_SOK if outArgs pointer is not NULL and outArgsSize matches the expected size. Otherwise, ENET_EMALFORMEDIOCTL.

◆ Enet_checkNoOutArgs()

static uint32_t Enet_checkNoOutArgs ( const Enet_IoctlPrms prms)
inlinestatic

Check IOCTL output args for commands that don't have output.

Helper function to check the output arguments passed to an IOCTL for commands that don't have an output argument.

Parameters
prmsIOCTL parameters pointer
Returns
ENET_SOK if outArgs pointer is NULL and outArgsSize is 0. Otherwise, ENET_EMAILFORMEDIOCTL.

◆ Enet_checkInOutArgs()

static uint32_t Enet_checkInOutArgs ( const Enet_IoctlPrms prms,
uint32_t  inArgsSize,
uint32_t  outArgsSize 
)
inlinestatic

Check IOCTL input and output args.

Helper function to check the input and output arguments passed to an IOCTL for commands that expect input and output arguments.

Parameters
prmsIOCTL parameters pointer
inArgsSizeExpected size of the input argument
outArgsSizeExpected size of the output argument
Returns
ENET_SOK if outArgs pointer is NULL and outArgsSize is 0. Otherwise, ENET_EMAILFORMEDIOCTL.

◆ Enet_isCpswFamily()

static bool Enet_isCpswFamily ( Enet_Type  enetType)
inlinestatic

Check if Ethernet peripheral type is part of CPSW family.

Parameters
enetTypeEthernet peripheral type
Returns
true if CPSW family, false otherwise.

◆ Enet_isIcssFamily()

static bool Enet_isIcssFamily ( Enet_Type  enetType)
inlinestatic

Check if Ethernet peripheral type is part of ICSS family.

Parameters
enetTypeEthernet peripheral type
Returns
true if ICSS family, false otherwise.

◆ Enet_getCoreId()

uint32_t Enet_getCoreId ( void  )

Get self core id.

Gets the core id of the calling core. The driver doesn't enforce any specific core id definitions, it's up to the Enet SoC layer to define it.

Returns
Core id

◆ Enet_setTraceLevel()

EnetTrace_TraceLevel Enet_setTraceLevel ( EnetTrace_TraceLevel  level)

Set global trace level.

Sets the trace level of the Enet LLD. The driver provides the following trace levels: ERROR, WARN, INFO, DEBUG and VERBOSE.

This function returns the previous trace level, which comes in handy when restoring trace level, if needed.

Parameters
levelTrace level
Returns
Previuos trace level

◆ Enet_getTraceLevel()

EnetTrace_TraceLevel Enet_getTraceLevel ( void  )

Get current trace level.

Get the current global trace level of the Enet LLD.

Returns
Current trace level

◆ Enet_initOsalCfg()

void Enet_initOsalCfg ( EnetOsal_Cfg osalCfg)

Initialize OSAL configuration.

Initializes the passed OSAL configuration structure with a default implementation which is based on the PDK OSAL library if ENET_CFG_HAS_DEFAULT_OSAL config flag is enabled. Otherwise, the configuration structure will be cleared.

The caller can overwrite any OSAL functions after calling this API.

Parameters
osalCfgOSAL configuration parameters

◆ Enet_initUtilsCfg()

void Enet_initUtilsCfg ( EnetUtils_Cfg utilsCfg)

Initialize utils configuration.

Initializes the passed utils configuration structure with a default implementation if ENET_CFG_HAS_DEFAULT_OSAL config flag is enabled. Otherwise, the configuration structure will be cleared. The default utils implementation provides UART-based logging and one-to-one address translation.

The caller can overwrite any utils functions after calling this API.

Parameters
utilsCfgUtils configuration parameters

◆ Enet_init()

void Enet_init ( const EnetOsal_Cfg osalCfg,
const EnetUtils_Cfg utilsCfg 
)

Initialize Enet LLD.

One-time initialization of the Enet LLD driver. This function initializes the OSAL and utils infrastructure that the driver requires for handling multiple peripherals as well as logging and tracing.

The Enet LLD provides a default OSAL implementation which is based on PDK OSAL library if ENET_CFG_HAS_DEFAULT_OSAL config flag is enabled. The default OSAL implementation can be used if the caller passes a NULL osalCfg.

Similarly, the Enet LLD provides a default utils implementation if ENET_CFG_HAS_DEFAULT_UTILS config flag is set. The default utils implementation can be used if the caller passes a NULL utilsCfg.

Parameters
osalCfgOSAL configuration parameters
utilsCfgUtils configuration parameters

◆ Enet_deinit()

void Enet_deinit ( void  )

De-initialize Enet LLD.

One-time de-initialization of the Enet LLD driver. This function clears the OSAL and utils config parameters passed during Enet_init().

It's expected to be called once all Ethernet peripherals have been closed via Enet_close().

◆ Enet_getHandle()

Enet_Handle Enet_getHandle ( Enet_Type  enetType,
uint32_t  instId 
)

Get the Enet handle of a peripheral.

Gets the driver handle of a peripheral identified by its type and instance id. If the driver hasn't been opened via Enet_open(), this function returns NULL.

Parameters
enetTypeEnet Peripheral type
instIdEnet Peripheral instance id
Returns
Driver handle if opened. Otherwise, NULL.

◆ Enet_getMacPortMax()

uint32_t Enet_getMacPortMax ( Enet_Type  enetType,
uint32_t  instId 
)

Get number of MAC ports available in the Ethernet peripheral.

Gets the number of MAC ports available in the Ethernet peripheral identified by its type and instance id.

Parameters
enetTypeEnet Peripheral type
instIdEnet Peripheral instance id
Returns
Number of MAC ports

◆ Enet_initCfg()

void Enet_initCfg ( Enet_Type  enetType,
uint32_t  instId,
void *  cfg,
uint32_t  cfgSize 
)

Initialize the peripheral configuration parameters.

Initializes the peripheral configuration parameters with default values.

Configuration parameters are peripheral specific, so the Enet LLD doesn't enforce any definition. Instead, the application should use the configuration structure corresponding to the peripheral(s) available in the platform.

Parameters
enetTypeEnet Peripheral type
instIdEnet Peripheral instance id
cfgConfiguration parameters to be initialized
cfgSizeSize of the configuration parameters

◆ Enet_open()

Enet_Handle Enet_open ( Enet_Type  enetType,
uint32_t  instId,
const void *  cfg,
uint32_t  cfgSize 
)

Open and initializes the Enet driver for a peripheral.

Opens and initializes the Ethernet peripheral with the configuration parameters provided by the caller. The peripheral is identified by its type and instance id.

Configuration parameters are peripheral specific, so the Enet LLD doesn't enforce any definition. Instead, the application should use the configuration structure corresponding to the peripheral(s) available in the platform.

Parameters
enetTypeEnet Peripheral type
instIdEnet Peripheral instance id
cfgConfiguration parameters
cfgSizeSize of the configuration parameters
Returns
Enet handle if successfully open, NULL otherwise.

◆ Enet_rejoin()

Enet_Handle Enet_rejoin ( Enet_Type  enetType,
uint32_t  instId 
)

Rejoin a running Ethernet peripheral.

Reopens the Enet Peripheral, but doesn't perform any hardware initialization. This function is expected to be called to rejoin to a running peripheral. The peripheral is identified by its type and instance id.

Parameters
enetTypeEnet Peripheral type
instIdEnet Peripheral instance id
Returns
Enet handle if successfully open, NULL otherwise.

◆ Enet_getDmaHandle()

EnetDma_Handle Enet_getDmaHandle ( Enet_Handle  hEnet)

Get the handle to the DMA used for packet transmit/receive.

Gets the handle to the DMA which will later be used as arguments to other DMA related APIs, such as EnetDma_openRxCh() or EnetDma_openTxCh(). Enet_getDmaHandle() is required for peripherals where DMA is opened internally, such as J721E. Enet_getDmaHandle() is not required in peripherals where DMA is opened separately, such as AM273X.

Parameters
hEnetEnet driver handle
Returns
Enet DMA handle if Enet peripherals owns the handle, NULL otherwise.

◆ Enet_ioctl()

int32_t Enet_ioctl ( Enet_Handle  hEnet,
uint32_t  coreId,
uint32_t  cmd,
Enet_IoctlPrms prms 
)

Issue an operation on the Enet Peripheral.

Issues a control operation on the Enet Peripheral. The IOCTL parameters should be built using the helper macros provided by the driver:

Parameters
hEnetEnet driver handle
coreIdCaller's core id
cmdIOCTL command Id
prmsIOCTL parameters
Returns
ENET_SOK if operation is synchronous and it was successful. ENET_SINPROGRESS if operation is asynchronous and was initiated sucessfully. Enet_ErrorCodes in case of any failure.

◆ Enet_registerEventCb()

void Enet_registerEventCb ( Enet_Handle  hEnet,
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 with be called either via Enet_poll() when interrupts are disabled or internally by the driver when servicing an interrupt in ISR context.

Parameters
hEnetEnet driver handle
evtEvent being registered for
evtNumEvent number. Use 0 for single event.
evtCbCallback function
evtCbArgsCallback function arguments

◆ Enet_unregisterEventCb()

void Enet_unregisterEventCb ( Enet_Handle  hEnet,
Enet_Event  evt,
uint32_t  evtNum 
)

Unregister callback for an event.

Unregisters a callback for an event.

Parameters
hEnetEnet driver handle
evtEvent being registered for
evtNumEvent number. Use 0 for single event.

◆ Enet_poll()

void Enet_poll ( Enet_Handle  hEnet,
Enet_Event  evt,
const void *  arg,
uint32_t  argSize 
)

Poll for Ethernet events.

Unblocking poll for the events specified in evtMask. The event mask can be constructed using the types defined in Enet_Event. The callback function must be registered via Enet_registerEventCb() prior to calling Enet_poll().

Note that not all peripherals support poll mechanism.

Parameters
hEnetEnet driver handle
evtEvent type
argPointer to the poll argument. This is specific to the poll event type. Refer to Enet_Event for required argument types
argSizeSize of arg. This is used to validate the argument type

◆ Enet_periodicTick()

void Enet_periodicTick ( Enet_Handle  hEnet)

Run periodic tick on the Ethernet peripheral.

Run PHY periodic tick on the Ethernet peripheral.

Parameters
hEnetEnet driver handle

◆ Enet_getMacPortCnt()

uint32_t Enet_getMacPortCnt ( Enet_Handle  hEnet)

Get number of MAC ports available in the Ethernet peripheral.

Gets the number of MAC ports available in the Ethernet peripheral. This function is similar to Enet_getMacPortMax() except that it takes an Enet handle.

Parameters
hEnetEnet driver handle
Returns
Number of MAC ports

◆ Enet_close()

void Enet_close ( Enet_Handle  hEnet)

Close the Enet peripheral.

Closes the Ethernet Peripheral.

Parameters
hEnetEnet driver handle
ENET_IOCTL_GET_MIN
#define ENET_IOCTL_GET_MIN(x)
Helper macro to get the IOCTL major number.
Definition: enet_ioctl.h:87