Data Structures | Macros | Typedefs | Enumerations | Functions
Enet Main API

Data Structures

struct  Enet_IoctlPrms_s
 Enet IOCTL param. More...
 
struct  Enet_Version_s
 Version of a peripheral or module. More...
 
struct  Enet_VlanTag_s
 VLAN tag. More...
 

Macros

#define ENET_IOCTL_TYPE_OFFSET   (24U)
 IOCTL type bit offset.
 
#define ENET_IOCTL_PER_OFFSET   (16U)
 IOCTL hardware peripheral bit offset.
 
#define ENET_IOCTL_MAJOR_OFFSET   (8U)
 IOCTL major number bit offset.
 
#define ENET_IOCTL_MINOR_OFFSET   (0U)
 IOCTL minor number bit offset.
 
#define ENET_IOCTL_GET_TYPE(x)   ((x) & 0xFF000000U)
 Helper macro to get the IOCTL type (public/private).
 
#define ENET_IOCTL_GET_PER(x)   ((x) & 0x00FF0000U)
 Helper macro to get the peripheral type.
 
#define ENET_IOCTL_GET_MAJ(x)   ((x) & 0x0000FF00U)
 Helper macro to get the IOCTL major number.
 
#define ENET_IOCTL_GET_MIN(x)   ((x) & 0x000000FFU)
 Helper macro to get the IOCTL major number.
 
#define ENET_IOCTL_TYPE(x)   ((x) << ENET_IOCTL_TYPE_OFFSET)
 Helper macro to set the IOCTL type.
 
#define ENET_IOCTL_PER(x)   ((x) << ENET_IOCTL_PER_OFFSET)
 Helper macro to set the IOCTL type.
 
#define ENET_IOCTL_MAJ(x)   ((x) << ENET_IOCTL_MAJOR_OFFSET)
 Helper macro to set the IOCTL major number.
 
#define ENET_IOCTL_MIN(x)   ((x) << ENET_IOCTL_MINOR_OFFSET)
 Helper macro to set the IOCTL minor number.
 
#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_PUBLIC_IOCTL(x)   (ENET_IOCTL_ENET_BASE | ENET_IOCTL_MIN(x))
 Helper macro for Enet public IOCTL command ids.
 
#define ENET_ARRAYSIZE(x)   (sizeof(x) / sizeof(x[0]))
 Macro to get the size of an array.
 
#define ENET_BIT(n)   (1U << (n))
 Macro to set bit at given bit position.
 
#define ENET_GET_BIT(val, n)   (((val) & ENET_BIT(n)) >> (n))
 Macro to get bit at given bit position.
 
#define ENET_IS_BIT_SET(val, n)   (((val) & ENET_BIT(n)) != 0U)
 Macro to check if bit at given bit position is set.
 
#define ENET_VERSION_NONE   (0xFFFFFFFFU)
 Version field is not supported.
 
#define ENET_MAC_ADDR_LEN   (6U)
 MAC address length in bytes/octets.
 
#define ENET_OUI_ADDR_LEN   (3U)
 Organization Unique Id (OUI) address length in bytes/octets.
 
#define ENET_IPv4_ADDR_LEN   (4U)
 IPv4 address length in bytes/octets.
 
#define ENET_IPv6_ADDR_LEN   (16U)
 IPv6 address length in bytes/octets.
 
#define ENET_PRIORITY_NUM   (8U)
 Packet priority.
 
#define ENET_PRIORITY_MIN   (0U)
 Lowest packet priority.
 
#define ENET_PRIORITY_MAX   (ENET_PRIORITY_NUM - 1U)
 Lowest packet priority.
 
#define ENET_TOS_PRIORITY_NUM   (64U)
 Type of Service (ToS) priority.
 
#define ENET_TOS_PRIORITY_MIN   (0U)
 Lowest ToS priority.
 
#define ENET_TOS_PRIORITY_MAX   (ENET_TOS_PRIORITY_NUM - 1U)
 Highest ToS priority.
 
#define ENET_TYPE_NUM   (ENET_TYPE_COUNT + 1U)
 Number of supported Ethernet peripheral types.
 
#define ENET_MAC_PORT_NUM   (ENET_MAC_PORT_COUNT)
 Number of MAC ports.
 
#define ENET_NORM_MACPORT(n)   ((n) - ENET_MAC_PORT_FIRST)
 Normalize Enet_MacPort. More...
 
#define ENET_DENORM_MACPORT(n)   ((Enet_MacPort)((n) + ENET_MAC_PORT_FIRST)
 De-normalize Enet_MacPort. More...
 
#define ENET_MAC_PORT_INV   ((Enet_MacPort)0xFFFFU)
 MAC invalid port number. Used for error checks only.
 

Typedefs

typedef void(* Enet_EventCallback )(Enet_Event evt, uint32_t evtNum, void *evtCbArgs, void *arg1, void *arg2)
 Event callback. More...
 
typedef struct Enet_IoctlPrms_s Enet_IoctlPrms
 Enet IOCTL param. More...
 
typedef enum Enet_Type_e Enet_Type
 Ethernet peripheral type.
 
typedef enum Enet_Event_e Enet_Event
 Ethernet events. More...
 
typedef struct Enet_Version_s Enet_Version
 Version of a peripheral or module. More...
 
typedef enum Enet_Speed_e Enet_Speed
 MAC interface speed.
 
typedef enum Enet_Duplexity_e Enet_Duplexity
 MAC interface duplexity.
 
typedef enum Enet_VlanTagType_e Enet_VlanTagType
 Double tagging VLAN type.
 
typedef struct Enet_VlanTag_s Enet_VlanTag
 VLAN tag.
 
typedef enum Enet_MacPort_e Enet_MacPort
 MAC port.
 

Enumerations

enum  Enet_IoctlType_e { ENET_IOCTL_TYPE_PUBLIC = ENET_IOCTL_TYPE(0U), ENET_IOCTL_TYPE_PRIVATE = ENET_IOCTL_TYPE(1U) }
 IOCTL types. More...
 
enum  Enet_IoctlPer_e { ENET_IOCTL_PER_CPSW = ENET_IOCTL_PER(0U), ENET_IOCTL_PER_ICSSG = ENET_IOCTL_PER(1U), ENET_IOCTL_PER_GMAC = ENET_IOCTL_PER(2U) }
 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)
}
 IOCTL base number. More...
 
enum  Enet_Type_e {
  ENET_NULL, ENET_ICSSG, ENET_GMAC_3G, ENET_CPSW_2G,
  ENET_CPSW_5G, ENET_CPSW_9G, ENET_TYPE_COUNT
}
 Ethernet peripheral type. More...
 
enum  Enet_Event_e {
  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_e { ENET_SPEED_10MBIT = 0U, ENET_SPEED_100MBIT, ENET_SPEED_1GBIT, ENET_SPEED_AUTO }
 MAC interface speed. More...
 
enum  Enet_Duplexity_e { ENET_DUPLEX_HALF = 0U, ENET_DUPLEX_FULL, ENET_DUPLEX_AUTO }
 MAC interface duplexity. More...
 
enum  Enet_VlanTagType_e { ENET_VLAN_TAG_TYPE_INNER = 0U, ENET_VLAN_TAG_TYPE_OUTER }
 Double tagging VLAN type. More...
 
enum  Enet_MacPort_e {
  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_COUNT
}
 MAC port. More...
 

Functions

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)
 Initialize the peripheral configuration parameters. More...
 
Enet_Handle Enet_open (Enet_Type enetType, uint32_t instId, const void *cfg)
 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...
 
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, uint32_t evtMask)
 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...
 

Enet Error Codes

Error codes returned by the Enet driver APIs.

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

Detailed Description

Macro Definition Documentation

#define ENET_DENORM_MACPORT (   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.

#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.

#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.

#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.

#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.

#define ENET_NORM_MACPORT (   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.

Typedef Documentation

typedef enum Enet_Event_e 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.
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

Enet IOCTL param.

IOCTL params structure argument for all Enet IOCTL commands

typedef struct Enet_Version_s Enet_Version

Version of a peripheral or module.

Version of a peripheral or module. It's the type returned by any GET_VERSION IOCTL command.

Version fields that are not supported or applicable will be set to ENET_VERSION_NONE.

Enumeration Type Documentation

MAC interface duplexity.

Enumerator
ENET_DUPLEX_HALF 

Half duplex

ENET_DUPLEX_FULL 

Full duplex

ENET_DUPLEX_AUTO 

Duplexity determined automatically

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

ENET_EVT_TIMESTAMP_SWPUSH 

Software timestamp push event

ENET_EVT_TIMESTAMP_HWPUSH 

Hardware timestamp push event

ENET_EVT_TIMESTAMP_ROLLOVER 

Timestamp half rollover event

ENET_EVT_TIMESTAMP_HALFROLLOVER 

Timestamp rollover event

ENET_EVT_TIMESTAMP_RX 

Timestamp receive event

ENET_EVT_TIMESTAMP_TX 

Timestamp transmit event

ENET_EVT_TIMESTAMP_COMP 

Timestamp compare event

ENET_EVT_TIMESTAMP_HOSTTX 

Timestamp host transmit event

ENET_EVT_ANY 

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

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

IOCTL peripheral types.

Enumerator
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

IOCTL types.

Enumerator
ENET_IOCTL_TYPE_PUBLIC 

Public IOCTL type (default type if omitted)

ENET_IOCTL_TYPE_PRIVATE 

Private IOCTL type

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_COUNT 

Number of MAC ports - For internal use only

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

Ethernet peripheral type.

Enumerator
ENET_NULL 

"Null" peripheral - for testing only

ENET_ICSSG 

ICSSG

ENET_GMAC_3G 

GMAC_3G: 1 host port + 2 MAC ports

ENET_CPSW_2G 

CPSW_2G: 1 host port + 1 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

Double tagging VLAN type.

Enumerator
ENET_VLAN_TAG_TYPE_INNER 

Inner or customer tag

ENET_VLAN_TAG_TYPE_OUTER 

Outer or service tag

Function Documentation

void Enet_close ( Enet_Handle  hEnet)

Close the Enet peripheral.

Closes the Ethernet Peripheral.

Parameters
hEnetEnet driver handle
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().

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_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.
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
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
EnetTrace_TraceLevel Enet_getTraceLevel ( void  )

Get current trace level.

Get the current global trace level of the Enet LLD.

Returns
Current trace level
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 implemetnation can be used if the caller passes a NULL utilsCfg.

Parameters
osalCfgOSAL configuration parameters
utilsCfgUtils configuration parameters
void Enet_initCfg ( Enet_Type  enetType,
uint32_t  instId,
void *  cfg 
)

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
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
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
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_Handle Enet_open ( Enet_Type  enetType,
uint32_t  instId,
const void *  cfg 
)

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
Returns
Enet_ErrorCodes
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
void Enet_poll ( Enet_Handle  hEnet,
uint32_t  evtMask 
)

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
evtMaskEvent bit mask
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_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_ErrorCodes
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
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.

Copyright 2020, Texas Instruments Incorporated