Enet Integration Guide

Introduction

Enet LLD is an unified Ethernet driver that supports Ethernet peripherals found in TI SoCs, such as CPSW and ICSSG. Please refer to the SDK release notes to find out what peripherals are currently supported.

The diagram below shows the overall software architecture of the Enet low-level driver. A top-level driver layer provides the interface that the applications can use to configure the switch and to send/receive Ethernet frames.

For instance, the CPSW support in the Enet driver consists of several software submodules that mirror those of the CPSW hardware, like DMA, ALE, MAC port, host port, MDIO, etc. Additionally, the Enet driver also includes PHY driver support as well as a resource manager to administrate the CPSW resources.

Enet LLD relies on other drivers like UDMA for data transfer to/from the Ethernet peripheral’s host port to the other processing cores inside the TI SoC devices. For the lower level access to the hardware registers, Enet LLD relies on the Chip Support Library (CSL).

Enet LLD Software Architecture Block Diagram

Getting Familiar with Enet LLD APIs

The Enet LLD APIs can be broadly divided into two categories: control and data path. The control APIs can be used to configure all Ethernet hardware submodules like FDB, MAC port, host port, MDIO, statistics, as well as PHY drivers and resource management. The data path APIs are exclusive for the DMA-based data transfers between the TI SoC processing cores and the Ethernet peripheral.

The main APIs of the Enet LLD are the following:

  • Enet_open()

  • Enet_close()

  • Enet_ioctl()

  • Enet_poll()

  • Enet_periodicTick()

  • EnetDma_openRxCh()

  • EnetDma_closeRxCh()

  • EnetDma_openTxCh()

  • EnetDma_closeTxCh()

  • EnetDma_retrieveRxPktQ()

  • EnetDma_submitRxPktQ()

  • EnetDma_retrieveTxPktQ()

  • EnetDma_submitTxPktQ()

It’s worth noting that the control path APIs are mainly IOCTL-based, and the data path APIs are direct functions in order to avoid any additional overhead associated with IOCTL calls as DMA data operations occur highly frequently.

IOCTL Interface

IOCTLs are system calls that take an argument specifying the command code and can take none or additional parameters via Enet_IoctlPrms argument. IOCTL are used by all Enet submodules except for DMA.

The Enet_IoctlPrms parameter structure consists of input and output argument pointers and their corresponding size. The following helper macros are provided to help construct the IOCTL params:

  • ENET_IOCTL_SET_NO_ARGS(prms) - Used for IOCTL commands that take no parameters.

  • ENET_IOCTL_SET_IN_ARGS(prms, in) - Used for IOCTL commands that take input parameters but don’t output any parameter.

  • ENET_IOCTL_SET_OUT_ARGS(prms, out) - Used for IOCTL commands that don’t take input parameters but return output parameters.

  • ENET_IOCTL_SET_INOUT_ARGS(prms, in, out) - Used for IOCTL commands that take input parameters and also return output parameters.

where prms is a pointer to Enet_IoctlPrms variable, in is the pointer to IOCTL input argument and out is the pointer to IOCTL output argument.

It’s recommended that the application doesn’t set the Enet_IoctlPrms members individually, but only through the helper macros listed above.

Integrating Enet LLD into User’s Application

Developers who wish to add network connectivity to the applications running on TI SoCs, will have to integrate Enet LLD by following the below sequence:

  1. Init Sequence - One-time initialization before using any Enet LLD APIs.

  2. Peripheral Open Sequence - Opens an Ethernet peripheral, called for each peripheral that the application intends to use.

  3. Port Open Sequence - Opens a MAC port.

  4. Packet Send/Receive Sequence - DMA TX and RX channel open sequences as well as functions to use to submit and retrieve queue of packets to/from the driver.

  5. Port Close Sequence - Closes a MAC port.

  6. Peripheral Close Sequence - Closes an Ethernet peripheral.

  7. Deinit Sequence - One-time deinitialization once application is done using Enet LLD.

Each of these sequences will be covered in detail in the following sections.

Init Sequence

This is a one-time initialization where the application sets the utils function that Enet LLD will use throughout its lifecycle.

At this stage Enet LLD also initializes its SoC layer which contains data about the Ethernet hardware available in the TI device.

The application should follow the next steps:

  1. (Optional) Enet_initUtilsCfg() to initialize utils configuration with a default implementation. The default implementation of Enet Utils interface is UART-based logging and one-to-one address translations. Applications may want to pass their own utils’ print function if UART is not available.

  2. Enet_init() to pass the utils configurations setup in the previous step. The application can pass NULL to utils config if it intends to use the driver’s default implementation.

Peripheral Open Sequence

This is an initialization that needs to be done for each peripheral in the system.

Application should follow the next steps:

  1. Initialize the peripheral configuration parameters with default values using Enet_initCfg(). Although the application can fill all parameters manually, it’s recommended to first get the driver’s default values for all parameters and only overwrite the parameters of interest.

    • CPSW peripheral configuration - Cpsw_Cfg structure has the configuration parameters for CPSW Enet Peripheral, such as:

      • Configuration of DMA: EnetDma_Cfg.

      • VLAN configuration (inner/outer VLAN, customer/service switch): Cpsw_VlanCfg.

      • Max packet length transmitted on egress: Cpsw_Cfg.txMtu.

      • Configuration of the host (CPPI) port: CpswHostPort_Cfg.

      • Configure of the ALE submodule: CpswAle_Cfg.

      • Configure of the CPTS submodule: CpswCpts_Cfg.

      • Configuration of the MDIO submodule: Mdio_Cfg.

      • Configuration of CPSW Resource Partition: EnetRm_ResCfg.

  2. Once done with the configuration of the parameters, the UDMA driver has to be opened. Enet utils library provides a helper function called EnetAppUtils_udmaOpen() to open the UDMA driver.

  3. Enet_open() to open a peripheral, passing the configuration parameters previously initialized. Enet_open() function takes the following arguments:

    • Peripheral type - specifies the type or class of the peripheral, i.e. CPSW, ICSSG or other.

    • Instance number - specifies the instance number of the peripheral.

    • Configuration structure - a pointer to the peripheral-specific configuration structure.

    • Size of the configuration structure.

  4. If the module is opened successfully, the API will return a valid handle pointer to the Enet driver.

  5. Attach the core with the Resource Manager (RM) using ENET_PER_IOCTL_ATTACH_CORE IOCTL.

  6. Once the application attaches the core with Resource Manager (RM), the IOCTL call will return a core key which has to be used in all further RM-related calls.

  7. A MAC address for the host port is to be obtained using EnetAppUtils_allocMac() and the corresponding entry in the ALE table can be added using EnetAppUtils_addHostPortEntry().

  8. Allocate memory for Ring Accelerators, Ethernet packets, etc.

Port Open Sequence

The MAC ports can be opened in MAC-to-PHY or MAC-to-MAC mode. In MAC-to-PHY mode, Enet LLD’s PHY driver state machine will be used to configure the Ethernet PHY. In MAC-to-MAC mode, the PHY driver will be bypassed entirely.

Packet Send/Receive Sequence

  1. Open the DMA channels:

    • Initialize the Tx Channel and Rx Flow parameters using EnetUdma_initTxChParams() and EnetUdma_initRxFlowParams(), respectively.

    • After setting the parameters, open the channel and flow using EnetAppUtils_openTxCh() and EnetAppUtils_openRxFlow(), respectively.

  2. To transmit data:

    • Call EnetDma_submitTxPktQ() to submit packets ready for transmission.

    • Call EnetDma_retrieveTxPktQ() to retrieve successfully transmitted packets.

  3. To receive packets:

    • Call EnetDma_retrieveRxPktQ() to retrieve received packets.

    • Call EnetDma_submitRxPktQ() to submit new packets to the Rx free queue.

Port Close Sequence

MAC ports can be closed using the ENET_PER_IOCTL_CLOSE_PORT_LINK IOCTL command. This will close the PHY state machine associated with this MAC port.

Peripheral Close Sequence

  1. Disable the host port using the ENET_HOSTPORT_IOCTL_DISABLE command.

  2. Close the opened Tx Channel and Rx flow using EnetAppUtils_closeRxFlow() and EnetAppUtils_closeTxCh().

  3. Detach the core from Resource Manager using the ENET_PER_IOCTL_DETACH_CORE command.

  4. Close and deinitialize Enet driver using Enet_close() and Enet_deinit().

Deinit Sequence

  1. Call Enet_deinit() to deinitialize the driver. No further Enet LLD APIs should be called from this point.

  2. Close the UDMA driver using EnetAppUtils_udmaclose().

API Reference

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

Defines

ENET_FEAT_ALL

Feature mask which indicates that all of the configurable features are enabled.

ENET_FEAT_BASE

Feature masks which indicates that none of the configurable features are enabled.

ENET_FEAT_IS_EN(feats, mask)

Check if a configurable feature is enabled or not.

ENET_ERRATA_NONE

Errata mask which indicates that none of the erratas is applicable.

ENET_ERRATA_IS_ANY(mask)

Check if any errata is applicable, from an errata mask.

ENET_ERRATA_IS_EN(erratas, mask)

Check if an errata is applicable.

Typedefs

typedef struct Enet_Obj_s *Enet_Handle

Ethernet driver handle.

Ethernet driver opaque handle used to call any Enet related APIs.

Functions

static inline EnetPer_Handle Enet_getPerHandle(Enet_Handle hEnet)

Get the Enet Peripheral handle associated with Enet driver.

Gets the underlying Enet Peripheral handle associated with the given Enet driver.

Parameters:

hEnet – Enet handle

Returns:

EthPer handle

struct Enet_Obj
#include <enet_base.h>

Enet object.

Public Members

EnetPer_Obj *enetPer

Underlying Ethernet Peripheral

Enet_Magic magic

Magic number used to indicate if driver has been opened

SemaphoreP_enetOsal *lock

Main, API-level Lock

This file contains the type definitions and helper macros for the Enet Data Path (DMA) interface.

Enet DMA driver callback function types.

Callback function typedefs so that the EnetDma layer can call into the app layer and let it translate between the DMA packet descriptors and packets and the stack/translation layer’s buffers and packets.

typedef EnetDma_Pkt *(*EnetDma_AllocEthPktFxn)(uint32_t pktSize, uint32_t alignSize, void *appPriv)

Function pointer type for Ethernet packet allocation function.

typedef void (*EnetDma_FreeEthPktFxn)(EnetDma_Pkt *pPktInfo)

Function pointer type for Ethernet packet free function.

Defines

ENETDMA_RXCSUMINFO_CHKSUM_ADD_SHIFT

THOST CSUM ENCAP Word- Checksum Add bit shift.

ENETDMA_RXCSUMINFO_CHKSUM_ADD_MASK

THOST CSUM ENCAP Word - Checksum Add bit mask.

ENETDMA_RXCSUMINFO_CHKSUM_ERR_SHIFT

THOST CSUM ENCAP Word - Checksum Error bit shift.

ENETDMA_RXCSUMINFO_CHKSUM_ERR_MASK

THOST CSUM ENCAP Word - Checksum Error bit mask.

ENETDMA_RXCSUMINFO_FRAGMENT_SHIFT

THOST CSUM ENCAP Word - IP Fragment bit shift.

ENETDMA_RXCSUMINFO_FRAGMENT_MASK

THOST CSUM ENCAP Word - IP Fragment bit mask.

ENETDMA_RXCSUMINFO_TCP_UDP_N_SHIFT

THOST CSUM ENCAP Word - TCP or UDP bit shift.

ENETDMA_RXCSUMINFO_TCP_UDP_N_MASK

THOST CSUM ENCAP Word - TCP or UDP bit mask.

ENETDMA_RXCSUMINFO_IPV6_VALID_SHIFT

THOST CSUM ENCAP Word - IPv6 Valid bit shift.

ENETDMA_RXCSUMINFO_IPV6_VALID_MASK

THOST CSUM ENCAP Word - IPv6 Valid bit mask.

ENETDMA_RXCSUMINFO_IPV4_VALID_SHIFT

THOST CSUM ENCAP Word - IPv4 Valid bit shift.

ENETDMA_RXCSUMINFO_IPV4_VALID_MASK

THOST CSUM ENCAP Word - IPv4 Valid bit mask.

ENETDMA_TXCSUMINFO_CHKSUM_BYTECNT_SHIFT

FHOST CSUM ENCAP Word - Checksum Byte Count bit shift.

ENETDMA_TXCSUMINFO_CHKSUM_BYTECNT_MASK

FHOST CSUM ENCAP Word - Checksum Byte Count bit mask.

ENETDMA_TXCSUMINFO_CHKSUM_INV_SHIFT

FHOST CSUM ENCAP Word - Inverted Checksum bit shift.

ENETDMA_TXCSUMINFO_CHKSUM_INV_MASK

FHOST CSUM ENCAP Word - Inverted Checksum bit mask.

ENETDMA_TXCSUMINFO_CHKSUM_STARTBYTE_SHIFT

FHOST CSUM ENCAP Word - Checksum Start Byte bit shift.

ENETDMA_TXCSUMINFO_CHKSUM_STARTBYTE_MASK

FHOST CSUM ENCAP Word - Checksum Start Byte bit mask.

ENETDMA_TXCSUMINFO_CHKSUM_RESULT_SHIFT

FHOST CSUM ENCAP Word - Checksum Result bit shift.

ENETDMA_TXCSUMINFO_CHKSUM_RESULT_MASK

FHOST CSUM ENCAP Word - Checksum Result bit mask.

ENETDMA_RXCSUMINFO_GET_IPV4_FLAG(chkSumInfo)

Get IPv4 flag from THOST Checksum Encapsulation word.

ENETDMA_RXCSUMINFO_GET_IPV6_FLAG(chkSumInfo)

Get IPv6 flag from THOST Checksum Encapsulation word.

ENETDMA_RXCSUMINFO_GET_TCPUDP_N_FLAG(chkSumInfo)

Get TCP or UDP flag from THOST Checksum Encapsulation word.

ENETDMA_RXCSUMINFO_GET_FRAGMENT_FLAG(chkSumInfo)

Get IP Fragment flag from THOST Checksum Encapsulation word.

ENETDMA_RXCSUMINFO_GET_CHKSUM_ERR_FLAG(chkSumInfo)

Get Checksum Error flag from THOST Checksum Encapsulation word.

ENETDMA_RXCSUMINFO_GET_CHKSUM_RESULT(chkSumInfo)

Get Checksum Result from THOST Checksum Encapsulation word.

ENETDMA_TXCSUMINFO_SET_CHKSUM_RESBYTE(chkSumInfo, val)

Set Checksum Result Byte into FHOST Checksum Encapsulation word.

ENETDMA_TXCSUMINFO_SET_CHKSUM_STARTBYTE(chkSumInfo, val)

Set Checksum Start Byte into FHOST Checksum Encapsulation word.

ENETDMA_TXCSUMINFO_SET_CHKSUM_INV_FLAG(chkSumInfo, val)

Set Invert Checksum flag into FHOST Checksum Encapsulation word.

ENETDMA_TXCSUMINFO_SET_CHKSUM_BYTECNT(chkSumInfo, val)

Set Checksum Byte Count into FHOST Checksum Encapsulation word.

ENET_DMA_STATS_HISTORY_CNT

Enet DMA statistics configuration.

Number of entries kept in the statistics for DMA module.

Typedefs

typedef EnetQ EnetDma_PktQ

Packet queue.

A queue of packets, which are used for managing the packets given to the DMA driver by an application. It can also be used by the translation or application layer to manage free packets pools.

Functions

EnetDma_Handle EnetDma_initDmaCfg(Enet_Type enetType, uint32_t instId, const EnetDma_initCfg *pDmaCfg)

Initialize data path.

Initialize DMA data path state on remote core.

Parameters:
  • enetType – [IN] Enet Peripheral type

  • instId – [IN] Enet Peripheral instance id

  • pDmaCfg – [OUT] Data Path Init params

Returns:

Enet DMA opaque handle

int32_t EnetDma_deinitDmaCfg(EnetDma_Handle hEnetUdma)

De-initialize data path.

De-initialize DMA data path state on remote core.

Parameters:

hEnetUdma – [IN] Cpsw DMA Handle

Returns:

Enet_ErrorCodes

int32_t EnetDma_enableRxEvent(EnetDma_RxChHandle hRxCh)

Enable RX channel packet reception event.

Enables the packet arrival event for RX channel. This allows application to control notify events runtime and retrieve packet only once to do burst packet processing.

Parameters:

hRxCh – [IN] Handle to Enet DMA RX channel

Returns:

Enet_ErrorCodes

int32_t EnetDma_registerRxEventCb(EnetDma_RxChHandle hRxCh, EnetDma_PktNotifyCb notifyCb, void *cbArg)

Register packet arrival event callback.

Enables the packet arrival event for RX channel. This allows application to control notify events runtime and retrieve packet only once to do burst packet processing.

Parameters:
  • hRxCh – [IN] Handle to Enet DMA RX channel

  • notifyCb – [IN] Packet rx event notify function callback

  • cbArg – [IN] Argument to be passed to notify function callback

Returns:

Enet_ErrorCodes

int32_t EnetDma_disableRxEvent(EnetDma_RxChHandle hRxCh)

Disable RX channel packet reception event.

Disable the packet arrival event for RX channel.

Parameters:

hRxCh – [IN] Handle to Enet DMA RX channel

Returns:

Enet_ErrorCodes

int32_t EnetDma_enableTxEvent(EnetDma_TxChHandle hTxCh)

Enable TX channel packet transmit completion event.

Enables the packet transmit event for TX channel. This allows application to control notify events runtime and retrieve empty packets only once to do burst packet processing.

Parameters:

hTxCh – [IN] Handle to Enet DMA TX channel

Returns:

Enet_ErrorCodes

int32_t EnetDma_registerTxEventCb(EnetDma_TxChHandle hTxCh, EnetDma_PktNotifyCb notifyCb, void *cbArg)

Register packet transmit completion event callback.

Parameters:
  • hTxCh – [IN] Handle to Enet DMA TX channel

  • notifyCb – [IN] Packet tx event notify function callback

  • cbArg – [IN] Argument to be passed to notify function callback

Returns:

Enet_ErrorCodes

int32_t EnetDma_disableTxEvent(EnetDma_TxChHandle hTxCh)

Disable TX channel packet transmit completion event.

Disable the packet transmit event for TX channel.

Parameters:

hTxCh – [IN] Handle to Enet DMA TX channel

Returns:

Enet_ErrorCodes

int32_t EnetDma_retrieveRxPktQ(EnetDma_RxChHandle hRxCh, EnetDma_PktQ *pRetrieveQ)

Retrieve queue of RX ready (full) packets from RX channel.

Parameters:
  • hRxCh – [IN] Enet DMA RX channel handle for the RX channel we wish to retrieve packets from

  • pRetrieveQ – [OUT] Pointer to EnetDma_PktQ structure where packets from hardware are retrieved and returned to application

Returns:

Enet_ErrorCodes

int32_t EnetDma_retrieveRxPkt(EnetDma_RxChHandle hRxCh, EnetDma_Pkt **pPkt)

Retrieve single RX ready (full) packet (single) from RX channel.

Parameters:
  • hRxCh – [IN] Enet DMA RX channel handle for the RX channel we wish to retrieve packet from

  • pPkt – [OUT] Pointer to EnetDma_Pkt structure where packet from hardware is retrieved and returned to application

Returns:

Enet_ErrorCodes

int32_t EnetDma_submitRxPktQ(EnetDma_RxChHandle hRxCh, EnetDma_PktQ *pSubmitQ)

Submit queue of RX free (empty) packets for reception to RX channel.

Parameters:
  • hRxCh – [IN] Enet DMA RX channel handle for the RX channel we wish to submit packets to

  • pSubmitQ – [IN] Pointer to EnetDma_PktQ structure containing packets to be submitted to channel [OUT] Returned packets for which driver couldn’t allocate the DMA descriptors.

Returns:

Enet_ErrorCodes

int32_t EnetDma_submitRxPkt(EnetDma_RxChHandle hRxCh, EnetDma_Pkt *pPkt)

Submit single RX free (empty) packet for reception to RX channel.

Parameters:
  • hRxCh – [IN] Enet DMA RX channel handle for the RX channel we wish to submit packet to

  • pPkt – [IN] Pointer to EnetDma_Pkt structure containing packet to be submitted to channel

Returns:

Enet_ErrorCodes

int32_t EnetDma_retrieveTxPktQ(EnetDma_TxChHandle hTxCh, EnetDma_PktQ *pRetrieveQ)

Retrieve queue of TX free (empty) packets from TX channel.

Parameters:
  • hTxCh – [IN] Enet DMA TX channel handle for the TX channel we wish to retrieve packet from

  • pRetrieveQ – [OUT] Pointer to EnetDma_PktQ structure where packets from hardware are retrieved and returned to application

Returns:

Enet_ErrorCodes

int32_t EnetDma_retrieveTxPkt(EnetDma_TxChHandle hTxCh, EnetDma_Pkt **pPkt)

Retrieve single TX free (empty) packet from TX channel.

Parameters:
  • hTxCh – [IN] Enet DMA TX channel handle for the TX channel we wish to retrieve packet from

  • pPkt – [OUT] Pointer to EnetDma_Pkt structure where packet from hardware is retrieved and returned to application

Returns:

Enet_ErrorCodes

int32_t EnetDma_submitTxPktQ(EnetDma_TxChHandle hTxCh, EnetDma_PktQ *pSubmitQ)

Submit a queue of ready (full) packets to TX channel.

Parameters:
  • hTxCh – [IN] TX Channel handle for the TX channel we wish to submit packets to

  • pSubmitQ – [IN] Pointer to EnetDma_Pkt structure containing packets to be submitted.

Returns:

Enet_ErrorCodes

int32_t EnetDma_submitTxPkt(EnetDma_TxChHandle hTxCh, EnetDma_Pkt *pPkt)

Submit a single ready (full) packet to TX channel.

Parameters:
  • hTxCh – [IN] TX Channel handle for the TX channel we wish to submit packets to

  • pPkt – [IN] Pointer to EnetDma_Pkt structure containing packet to be submitted.

Returns:

Enet_ErrorCodes

void EnetDma_initPktInfo(EnetDma_Pkt *pktInfo)

Initialize packet information structure.

Initialize packet information structure with null/zero values.

Parameters:

pktInfo – [IN] Pointer to EnetDma_Pkt structure

int32_t EnetDma_getRxChStats(EnetDma_RxChHandle hRxCh, EnetDma_RxChStats *pStats)

Get RX channel statistics.

Parameters:
  • hRxCh – [IN] RX channel handle

  • pStats – [INOUT] Pointer to RX channel stats object where stats would be returned

Return values:
  • ENET_SOK – Retrieved stats successfully

  • ENET_ENOTSUPPORTED – Stats is not supported (enabled) or error retrieving

int32_t EnetDma_getTxChStats(EnetDma_TxChHandle hTxCh, EnetDma_TxChStats *pStats)

Get TX channel statistics.

Parameters:
  • hTxCh – [IN] TX channel handle

  • pStats – [INOUT] Pointer to TX Channel stats object where stats would be returned

Return values:
  • ENET_SOK – Retrieved stats successfully

  • ENET_ENOTSUPPORTED – Stats is not supported (enabled) or error retrieving

int32_t EnetDma_resetRxChStats(EnetDma_RxChHandle hRxCh)

Reset RX channel statistics.

Parameters:

hRxCh – [IN] RX channel handle

Return values:
  • ENET_SOK – Reseted stats successfully

  • ENET_ENOTSUPPORTED – Stats is not supported (enabled) or error resetting

int32_t EnetDma_resetTxChStats(EnetDma_TxChHandle hTxCh)

Reset TX channel statistics.

Parameters:

hTxCh – [IN] TX Channel handle

Return values:
  • ENET_SOK – Reseted stats successfully

  • ENET_ENOTSUPPORTED – Stats is not supported (enabled) or error resetting

struct EnetDma_CbStats
#include <enet_dma.h>

Stats for packets submitted/retrieved in the DMA event callbacks functions.

Public Members

uint64_t dataNotifyCnt

Total number of times the packets were submitted or retrieved from DMA

uint64_t zeroNotifyCnt

Counts when DMA retrievePkts is called but no packets was retrieved. This count can help in determining optimal pacing interval

uint64_t totalPktCnt

Total number of packets submitted or retrieved from DMA

uint64_t totalCycleCnt

Total cycles consumed to submit or retrieve totalPktCnt packets from DMA

uint64_t pktsPerNotifyMax

Maximum packets retrieved in single submit or retrieve call. This count can help in determining optimal number of DMA descriptors and packet counts to be allocated

uint64_t pktsPerNotify[ENET_DMA_STATS_HISTORY_CNT]

Packets retrieved per call to single submit or retrieve call. Maintained for last ENET_DMA_STATS_HISTORY_CNT packets

uint64_t cycleCntPerNotifyMax

Maximum of cycles consumed of all submit or retrieve call.

uint64_t cycleCntPerNotify[ENET_DMA_STATS_HISTORY_CNT]

Cycles consumed per call to single submit or retrieve call. Maintained for last ENET_DMA_STATS_HISTORY_CNT packets

uint64_t cycleCntPerPktMax

Maximum cycles for single packet in submit or retrieve call

uint64_t cycleCntPerPkt[ENET_DMA_STATS_HISTORY_CNT]

Cycles per packet in submit or retrieve call. Maintained for last ENET_DMA_STATS_HISTORY_CNT packets

uint64_t readyDmaDescQCnt[ENET_DMA_STATS_HISTORY_CNT]

Number of free DMA descriptors in the RX channels or TX channels DMA descriptor queue. Maintained for last ENET_DMA_STATS_HISTORY_CNT packets. This can be useful to detect and handle drops in packet bursts

struct EnetDma_DmaDescStats
#include <enet_dma.h>

DMA descriptor stats for the RX & TX channels.

Public Members

uint64_t readyDmaDescEnq

Total number of empty desc enqueued for RX channel and ready desc enqueued for TX channel.

uint64_t freeDmaDescDeq

Total number of ready desc dequeued for RX channel and empty desc dequeued for TX channel.

uint64_t underFlowCnt

Total number of DMA desc queue underflows for RX channel or TX channel

struct EnetDma_RxChStats
#include <enet_dma.h>

RX channel statistics.

Public Members

EnetDma_CbStats submitPktStats

Stats for RX submit packet calls

EnetDma_CbStats retrievePktStats

Stats for RX retrieve packet calls

EnetDma_DmaDescStats dmaDescStats

RX channels DMD desc queue stats

uint64_t rxSubmitPktEnq

Total number of free packets enqueued for RX channel

uint64_t rxRetrievePktDeq

Total number of full packets deq for RX channel

uint64_t rxSubmitPktUnderFlowCnt

Total number of packets underflows for RX channel

struct EnetDma_TxChStats
#include <enet_dma.h>

TX channel statistics.

Public Members

EnetDma_CbStats submitPktStats

Stats for TX submit packet calls

EnetDma_CbStats retrievePktStats

Stats for TX retrieve packet calls

EnetDma_DmaDescStats dmaDescStats

TX Channels DMD desc queue stats

uint64_t txSubmitPktEnq

Total number of free packets enqueued for TX Channel

uint64_t txRetrievePktDeq

Total number of full packets deq for TX Channel

uint64_t txSubmitPktOverFlowCnt

Total number of packets underflows for TX Channel

Enet DMA utility API to check packet and descriptor ownership states during development and debug.

Defines

ENET_UTILS_GET_STATE(state, mask, bitshift)
ENET_UTILS_SET_STATE(state, mask, bitshift, value)
ENET_UTILS_DRIVER_STATE_MASK
ENET_UTILS_DRIVER_STATE_BIT_SHIFT
ENET_DMA_MEMMGR_STATE_MASK
ENET_DMA_MEMMGR_STATE_BIT_SHIFT
ENET_UTILS_APP_STATE_MASK
ENET_UTILS_APP_STATE_BIT_SHIFT
ENET_UTILS_GET_PKT_DRIVER_STATE(state)
ENET_UTILS_SET_PKT_DRIVER_STATE(state, value)
ENET_UTILS_GET_PKT_MEMMGR_STATE(state)
ENET_UTILS_SET_PKT_MEMMGR_STATE(state, value)
ENET_UTILS_GET_PKT_APP_STATE(state)
ENET_UTILS_SET_PKT_APP_STATE(state, value)
ENET_DMA_MEMMGR_DESCSTATE_MASK
ENET_DMA_MEMMGR_DESCSTATE_SHIFT
ENET_UTILS_GET_DESC_MEMMGR_STATE(state)
ENET_UTILS_SET_DESC_MEMMGR_STATE(state, value)

Enums

enum EnetDma_DescStateMemMgr

Enet DMA Descriptor state.

DMA descriptor state used by Enet DMA driver for sanity check.

Values:

enumerator ENET_DESCSTATE_MEMMGR_FREE

Desc free

enumerator ENET_DESCSTATE_MEMMGR_ALLOC

Desc Allocated

enum EnetDma_PktStateApp

App Pkt state.

Packet state for application

Values:

enumerator ENET_PKTSTATE_APP_WITH_FREEQ

Packet with APP Free queue

enumerator ENET_PKTSTATE_APP_WITH_READYQ

Packet with APP Ready queue

enumerator ENET_PKTSTATE_APP_WITH_DRIVER

Packet with Driver

enum EnetDma_PktStateDma

DMA Pkt state.

Packet state for DMA

Values:

enumerator ENET_PKTSTATE_DMA_WITH_HW

Packet with HW

enumerator ENET_PKTSTATE_DMA_NOT_WITH_HW

Packet not with HW

enum EnetDma_PktStateMemMgr

Enet DMA Pkt state.

Packet state for memory manager

Values:

enumerator ENET_PKTSTATE_MEMMGR_FREE

Packet free

enumerator ENET_PKTSTATE_MEMMGR_ALLOC

Packet Allocated

enum EnetDma_PktStateModuleType

Enet DMA Pkt state.

Type of Enet DMA Pkt state.

Values:

enumerator ENET_PKTSTATE_MODULE_APP

Module type is app

enumerator ENET_PKTSTATE_MODULE_DRIVER

Module type is DMA Driver

enumerator ENET_PKTSTATE_MODULE_MEMMGR

Module type is MEM Mgr

Functions

static inline void EnetDma_checkPktState(uint32_t *pStateVar, EnetDma_PktStateModuleType module, uint32_t expectedState, uint32_t newState)

Packet state check & set API for app, memory manager and dma driver.

This development time API checks expected state and sets new packet state. This is used by modules handling the packet to confirm the packet is returned and allocated in correct state. Memutils checks (free, allocated), dma driver checks (with Hw, with driver) and app checks which queue it belongs

Note

- Optional for MemMgr and app. DMA driver mandatory uses when ENET_CFG_DEV_ERROR is defined.

Parameters:
  • pStateVar – [IN/OUT] Pointer to packet state variable of packet structure EnetDma_Pkt

  • module – [IN] Module id. Refer to EnetDma_PktStateModuleType

  • expectedState – [IN] State packet is expected to be.

  • newState – [IN] New state packet is set to.

static inline void EnetDma_checkDescState(uint32_t *pStateVar, EnetDma_DescStateMemMgr expectedState, EnetDma_DescStateMemMgr newState)

Descriptor state check & set API for descriptor memory manager.

This development time API checks expected state and sets new descriptor state. This is used by modules handling the Desc to confirm the Desc is returned and allocated in correct state. Only memutils modules uses it now for checking if desc is free or allocated while allocating or freeing desc respectively.

Note

- memory manager may not allocate the descState as this is optional check for MemMgr.

Parameters:
  • pStateVar – [IN/OUT] Pointer to Desc state variable.

  • expectedState – [IN] State Desc is expected to be.

  • newState – [IN] New state Desc is set to.

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

Defines

ENET_IOCTL_TYPE_OFFSET

IOCTL type bit offset.

IOCTL Interface Description IOCTLs get resolved to command number after macro resolution which is then used to index into command array to find the function to execute Command Structure: |<TYPE - 8b>|<PERIPHERAL - 8b>|<MAJOR_NUMBER - 8b>|<MINOR_NUMBER - 8b>|

ENET_IOCTL_PER_OFFSET

IOCTL hardware peripheral bit offset.

ENET_IOCTL_MAJOR_OFFSET

IOCTL major number bit offset.

ENET_IOCTL_MINOR_OFFSET

IOCTL minor number bit offset.

ENET_IOCTL_GET_TYPE(x)

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

ENET_IOCTL_GET_PER(x)

Helper macro to get the peripheral type.

ENET_IOCTL_GET_MAJ(x)

Helper macro to get the IOCTL major number.

ENET_IOCTL_GET_MIN(x)

Helper macro to get the IOCTL minor number.

ENET_IOCTL_TYPE(x)

Helper macro to set the IOCTL type.

ENET_IOCTL_PER(x)

Helper macro to set the IOCTL hardware peripheral.

ENET_IOCTL_MAJ(x)

Helper macro to set the IOCTL major number.

ENET_IOCTL_MIN(x)

Helper macro to set the IOCTL minor number.

ENET_IOCTL_SET_NO_ARGS(prms)

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

ENET_IOCTL_SET_IN_ARGS(prms, in)

Set the input args for an IOCTL command.

ENET_IOCTL_SET_OUT_ARGS(prms, out)

Set the output args for an IOCTL command.

ENET_IOCTL_SET_INOUT_ARGS(prms, in, out)

Set the input and output args for an IOCTL command.

ENET_IOCTL_VALID_PRMS(cmdId, inSize, outSize)

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

ENET_IOCTL(hEnet, coreId, ioctlCmd, prms, status)

Helper macro used to first register IOCTL handler and then invoke the IOCTL.

This macro replaces the previous Enet_ioctl function which 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:
  • hEnet – Enet driver handle

  • coreId – Caller’s core id

  • ioctlCmd – IOCTL command Id

  • prms – IOCTL parameters

  • status – return status of the Enet_ioctl. ENET_SOK if operation is synchronous and it was successful. ENET_SINPROGRESS if operation is asynchronous and was initiated successfully. Enet_ErrorCodes in case of any failure.

Enums

enum Enet_IoctlType_e

IOCTL types.

Values:

enumerator ENET_IOCTL_TYPE_PUBLIC

Public IOCTL type (default type if omitted)

enumerator ENET_IOCTL_TYPE_PRIVATE

Private IOCTL type

enum Enet_IoctlPer_e

IOCTL peripheral types.

Values:

enumerator ENET_IOCTL_PER_GENERIC

Generic IOCTLs

enumerator ENET_IOCTL_PER_CPSW

CPSW specific IOCTL (agnostic of number of CPSW ports)

enumerator ENET_IOCTL_PER_ICSSG

ICSSG specific IOCTL

enumerator ENET_IOCTL_PER_GMAC

GMAC specific IOCTL

enum Enet_IoctlMajor_e

IOCTL base number.

Values:

enumerator ENET_IOCTL_PER_BASE

Enet peripheral IOCTL base

enumerator ENET_IOCTL_FDB_BASE

FDB module IOCTL base

enumerator ENET_IOCTL_TIMESYNC_BASE

TimeSync module IOCTL base

enumerator ENET_IOCTL_HOSTPORT_BASE

Host port module IOCTL base

enumerator ENET_IOCTL_MACPORT_BASE

MAC port module IOCTL base

enumerator ENET_IOCTL_MDIO_BASE

MDIO module IOCTL base

enumerator ENET_IOCTL_STATS_BASE

Statistics module IOCTL base

enumerator ENET_IOCTL_PHY_BASE

PHY module IOCTL base

enumerator ENET_IOCTL_RM_BASE

Resource Manager module IOCTL base

enumerator ENET_IOCTL_TAS_BASE

TAS module IOCTL base

Functions

static inline uint32_t Enet_checkInArgs(const Enet_IoctlPrms *prms, uint32_t inArgsSize)

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:
  • prms – IOCTL parameters pointer

  • inArgsSize – Expected size of the input argument

Returns:

ENET_SOK if inArgs pointer is not NULL and inArgsSize matches the expected size. Otherwise, ENET_EMALFORMEDIOCTL.

static inline uint32_t Enet_checkNoInArgs(const Enet_IoctlPrms *prms)

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:

prms – IOCTL parameters pointer

Returns:

ENET_SOK if inArgs pointer is NULL and inArgsSize is 0. Otherwise, ENET_EMALFORMEDIOCTL.

static inline uint32_t Enet_checkOutArgs(const Enet_IoctlPrms *prms, uint32_t outArgsSize)

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:
  • prms – IOCTL parameters pointer

  • outArgsSize – Expected size of the output argument

Returns:

ENET_SOK if outArgs pointer is not NULL and outArgsSize matches the expected size. Otherwise, ENET_EMALFORMEDIOCTL.

static inline uint32_t Enet_checkNoOutArgs(const Enet_IoctlPrms *prms)

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:

prms – IOCTL parameters pointer

Returns:

ENET_SOK if outArgs pointer is NULL and outArgsSize is 0. Otherwise, ENET_EMAILFORMEDIOCTL.

static inline uint32_t Enet_checkInOutArgs(const Enet_IoctlPrms *prms, uint32_t inArgsSize, uint32_t outArgsSize)

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:
  • prms – IOCTL parameters pointer

  • inArgsSize – Expected size of the input argument

  • outArgsSize – Expected size of the output argument

Returns:

ENET_SOK if outArgs pointer is NULL and outArgsSize is 0. Otherwise, ENET_EMAILFORMEDIOCTL.

struct Enet_IoctlPrms
#include <enet_ioctl.h>

Enet IOCTL param.

IOCTL params structure argument for all Enet IOCTL commands

Public Members

const void *inArgs

Pointer to an actual input args struct for the IOCTL cmd

uint32_t inArgsSize

Size of inArgs structure

void *outArgs

Pointer to an actual output args struct for the IOCTL cmd

uint32_t outArgsSize

Size of outArgs structure

struct Enet_IoctlValidate
#include <enet_ioctl.h>

Enet IOCTL expected param sizes.

Expected input and output argument sizes of an Enet IOCTL. This is useful for validation purposes only.

Public Members

uint32_t cmd

Command id

uint32_t inArgsSize

Expected size of IOCTL input argument (Enet_IoctlPrms.inArgsSize)

uint32_t outArgsSize

Expected size of IOCTL output argument (Enet_IoctlPrms.outArgsSize)

This file contains the type definitions and helper macros for the Enet Forwarding Database (FDB) module interface.

Defines

ENET_FDB_PUBLIC_IOCTL(x)

Helper macro to create IOCTL commands for FDB module.

Enums

enum EnetFdb_Ioctl

FDB IOCTL commands.

FDB IOCTLs is a reduced set of commands as forwarding database hardware modules are significantly different that it’s more feasible to expose dedicated, module-specific IOCTL commands in module-specific drivers.

Refer to CPSW ALE, ICSSG FDB or the FDB module documentation present in the Ethernet peripheral of interest.

Values:

enumerator ENET_FDB_IOCTL_GET_VERSION

Get the hardware version of the FDB module.

IOCTL parameters:

enumerator ENET_FDB_IOCTL_PRINT_REGS

Print FDB registers.

IOCTL parameters:

  • inArgs: None

  • outArgs: None

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

Defines

ENET_HOSTPORT_PUBLIC_IOCTL(x)

Helper macro to create IOCTL commands for host port module.

Enums

enum EnetHostPort_Ioctl

Host port IOCTL commands.

Values:

enumerator ENET_HOSTPORT_IOCTL_GET_VERSION

Get the hardware version of the host port module.

IOCTL parameters:

enumerator ENET_HOSTPORT_IOCTL_PRINT_REGS

Print host port registers.

IOCTL parameters:

  • inArgs: None

  • outArgs: None

enumerator ENET_HOSTPORT_IOCTL_ENABLE

Enable host port.

IOCTL parameters:

  • inArgs: None

  • outArgs: None

enumerator ENET_HOSTPORT_IOCTL_DISABLE

Disable host port.

IOCTL parameters:

  • inArgs: None

  • outArgs: None

enumerator ENET_HOSTPORT_IOCTL_SET_INGRESS_DSCP_PRI_MAP

Set ingress DSCP priority (TOS) map.

IOCTL parameters:

enumerator ENET_HOSTPORT_IOCTL_GET_INGRESS_DSCP_PRI_MAP

Get ingress DSCP priority (TOS) map.

IOCTL parameters:

enumerator ENET_HOSTPORT_IOCTL_SET_PRI_REGEN_MAP

Set VLAN priority regeneration map.

IOCTL parameters:

enumerator ENET_HOSTPORT_IOCTL_GET_PRI_REGEN_MAP

Get VLAN priority regeneration map.

IOCTL parameters:

enumerator ENET_HOSTPORT_IOCTL_SET_EGRESS_QOS_PRI_MAP

Set QoS egress priority map.

IOCTL parameters:

enumerator ENET_HOSTPORT_IOCTL_GET_EGRESS_QOS_PRI_MAP

Get QoS egress priority map.

IOCTL parameters:

enumerator ENET_HOSTPORT_IOCTL_ENABLE_INGRESS_TRAFFIC_SHAPING

Enable ingress traffic shaping configuration.

IOCTL parameters:

enumerator ENET_HOSTPORT_IOCTL_DISABLE_INGRESS_TRAFFIC_SHAPING

Disable ingress traffic shaping configuration.

IOCTL parameters:

  • inArgs: None

  • outArgs: None

enumerator ENET_HOSTPORT_IOCTL_GET_INGRESS_TRAFFIC_SHAPING

Get ingress traffic shaping configuration.

IOCTL parameters:

enumerator ENET_HOSTPORT_IOCTL_GET_MAXLEN

Get MRU and MTU.

IOCTL parameters:

enumerator ENET_HOSTPORT_IS_CSUM_OFFLOAD_ENABLED

Check if checksum offload is enabled.

IOCTL parameters:

  • inArgs: None

  • outArgs: bool

enumerator ENET_HOSTPORT_IOCTL_SET_CREDIT_BASED_SHAPING

Set Idleslope for Credit Based Shaper on Host Port.

IOCTL parameters:

enumerator ENET_HOSTPORT_IOCTL_GET_CREDIT_BASED_SHAPING

Get Idleslope of Credit Based Shaper on Host Port queue.

IOCTL parameters:

  • inArgs: uint32_t

  • outArgs: uint64_t

enum EnetHostPort_IngressPriorityType

Port priority type.

Values:

enumerator ENET_INGRESS_PRI_TYPE_FIXED

Fixed priority

enumerator ENET_INGRESS_PRI_TYPE_RR

Round-robin priority

This file contains the type definitions and helper macros for the Enet MAC port module interface.

Defines

ENET_MACPORT_PUBLIC_IOCTL(x)

Helper macro to create IOCTL commands for MAC port module.

ENET_MACPORT_PRIVATE_IOCTL(x)

Helper macro to create private IOCTL commands for MAC Port module.

Enums

enum EnetMacPort_Ioctl

MAC port IOCTL commands.

Values:

enumerator ENET_MACPORT_IOCTL_GET_VERSION

Get the hardware version of the MAC port module.

IOCTL parameters:

enumerator ENET_MACPORT_IOCTL_PRINT_REGS

Print MAC port registers.

IOCTL parameters:

enumerator ENET_MACPORT_IOCTL_SET_INGRESS_DSCP_PRI_MAP

Set ingress DSCP priority (TOS) map.

NOTE:

  • For ICSSG upto 7 DSCP values can have traffic class mapping, All others will be treated as best effort traffic.

  • For ICSSG only IPv4 based priority mapping is supported and Ipv6 based is not supported.

  • For ICSSG incase of local generated traffic for switch mode expecting both ports has same mapping and if it is undirected traffic priorities are taken from Port1 mapping

IOCTL parameters:

enumerator ENET_MACPORT_IOCTL_GET_INGRESS_DSCP_PRI_MAP

Get ingress DSCP priority (TOS) map.

IOCTL parameters:

enumerator ENET_MACPORT_IOCTL_SET_PRI_REGEN_MAP

Set VLAN priority regeneration map.

IOCTL parameters:

enumerator ENET_MACPORT_IOCTL_GET_PRI_REGEN_MAP

Get VLAN priority regeneration map.

IOCTL parameters:

enumerator ENET_MACPORT_IOCTL_SET_EGRESS_QOS_PRI_MAP

Set QoS egress priority map.

IOCTL parameters:

enumerator ENET_MACPORT_IOCTL_GET_EGRESS_QOS_PRI_MAP

Get QoS egress priority map.

IOCTL parameters:

enumerator ENET_MACPORT_IOCTL_ENABLE_EGRESS_TRAFFIC_SHAPING

Enable egress traffic shaping configuration.

IOCTL parameters:

enumerator ENET_MACPORT_IOCTL_DISABLE_EGRESS_TRAFFIC_SHAPING

Disable egress traffic shaping configuration.

IOCTL parameters:

enumerator ENET_MACPORT_IOCTL_GET_EGRESS_TRAFFIC_SHAPING

Get egress traffic shaping configuration.

IOCTL parameters:

enumerator ENET_MACPORT_IOCTL_GET_MAXLEN

Get MRU and MTU.

IOCTL parameters:

Get MAC port’s speed and duplexity.

IOCTL parameters:

enumerator ENET_MACPORT_IOCTL_SET_CREDIT_BASED_SHAPING

Set Idleslope for Credit Based Shaper on MAC Port.

IOCTL parameters:

enumerator ENET_MACPORT_IOCTL_GET_CREDIT_BASED_SHAPING

Get Idleslope of Credit Based Shaper on MAC Port queue.

IOCTL parameters:

enumerator ENET_MACPORT_IOCTL_IET_RELEASE_PREEMPT_TRAFFIC

IET release preemptible traffic.

IOCTL parameters:

enumerator ENET_MACPORT_IOCTL_IET_HOLD_PREEMPT_TRAFFIC

IET hold preemptible traffic.

IOCTL parameters:

enumerator ENET_MACPORT_IOCTL_GET_QUEUE_PREEMPT_STATUS

Get macport queue preemption status.

IOCTL parameters:

enumerator ENET_MACPORT_IOCTL_SET_PREEMPT_QUEUE

Set macport queue preemption mode.

IOCTL parameters:

enumerator ENET_MACPORT_IOCTL_GET_PREEMPT_MIN_FRAG_SIZE

Get minimum fragment size.

IOCTL parameters:

enumerator ENET_MACPORT_IOCTL_SET_PREEMPT_MIN_FRAG_SIZE

Set minimum fragment size.

IOCTL parameters:

enumerator ENET_MACPORT_IOCTL_GET_PREEMPT_VERIFY_STATUS

Get IET verification status.

IOCTL parameters:

enumerator ENET_MACPORT_IOCTL_DISABLE_PREEMPT_VERIFICATION

Disable IET verification.

IOCTL parameters:

enumerator ENET_MACPORT_IOCTL_ENABLE_PREEMPT_VERIFICATION

Enable IET verification.

IOCTL parameters:

enumerator ENET_MACPORT_IOCTL_GET_PREEMPTION_ACTIVE_STATUS

Get preemption active status.

IOCTL parameters:

enumerator ENET_MACPORT_IOCTL_GET_PREEMPTION_ENABLE_STATUS

Get preemption enable status.

IOCTL parameters:

enumerator ENET_MACPORT_IOCTL_DISABLE_PREEMPTION

Disable frame preemption.

IOCTL parameters:

enumerator ENET_MACPORT_IOCTL_ENABLE_PREEMPTION

Enable IET frame preemption.

IOCTL parameters:

enumerator ENET_MACPORT_IOCTL_SET_CUT_THRU_PARAMS

Set Cut thru Params on MAC Port.

IOCTL parameters:

enumerator ENET_MACPORT_IOCTL_GET_CUT_THRU_PARAMS

Get Cut thru Params on MAC Port.

IOCTL parameters:

enum EnetMac_LayerType

MAC interface layer type.

Values:

enumerator ENET_MAC_LAYER_MII

Media-Independent Interface (MII) layer

enumerator ENET_MAC_LAYER_GMII

Gigabit Media-Independent Interface (GMII) layer

enumerator ENET_MAC_LAYER_XGMII

10-Gigabit Media-Independent Interface (XGMII) layer

enum EnetMac_SublayerType

MAC interface sublayer type.

Values:

enumerator ENET_MAC_SUBLAYER_STANDARD

Standard interface sublayer

enumerator ENET_MAC_SUBLAYER_REDUCED

Reduced interface sublayer

enumerator ENET_MAC_SUBLAYER_SERIAL

Serial interface sublayer

enumerator ENET_MAC_SUBLAYER_QUAD_SERIAL_MAIN

Quad-serial interface sublayer (main port)

enumerator ENET_MAC_SUBLAYER_QUAD_SERIAL_SUB

Quad-serial interface sublayer (sub port)

enum EnetMac_VariantType

MAC interface variant (only for specific interface types).

Values:

enumerator ENET_MAC_VARIANT_NONE

No variant

enumerator ENET_MAC_VARIANT_FORCED

Forced mode (out of band)

enum EnetMac_SgmiiMode

SGMII mode.

Values:

enumerator ENET_MAC_SGMIIMODE_INVALID

Invalid mode. Set to when port is used in non Q/SGMII mode

enumerator ENET_MAC_SGMIIMODE_FIBER_WITH_PHY

SGMII in fiber mode with PHY connection

enumerator ENET_MAC_SGMIIMODE_SGMII_WITH_PHY

SGMII in SGMII mode with PHY connection

enumerator ENET_MAC_SGMIIMODE_SGMII_AUTONEG_MASTER

SGMII in MAC to MAC with auto-neg master mode

enumerator ENET_MAC_SGMIIMODE_SGMII_AUTONEG_SLAVE

SGMII in MAC to MAC with auto-neg slave mode

enumerator ENET_MAC_SGMIIMODE_SGMII_FORCEDLINK

SGMII in MAC to MAC with forced master mode

enum EnetMacPort_VlanType

VLAN usage type.

Values:

enumerator ENET_MACPORT_VLAN_TYPE_NONE

No VLAN tag

enumerator ENET_MACPORT_VLAN_TYPE_SINGLE_TAG

Single VLAN tag

enumerator ENET_MACPORT_VLAN_TYPE_STACKED_TAGS

Stacked VLAN tag

enum EnetMacPort_PreemptVerifyStatus

MacPort IET Verification status.

Values:

enumerator ENET_MAC_VERIFYSTATUS_UNKNOWN

Unknown status

enumerator ENET_MAC_VERIFYSTATE_INITIAL

Initial state

enumerator ENET_MAC_VERIFYSTATE_VERIFYING

Verifying state

enumerator ENET_MAC_VERIFYSTATUS_SUCCEEDED

Verify Success

enumerator ENET_MAC_VERIFYSTATUS_FAILED

Verify Failure

enumerator ENET_MAC_VERIFYSTATUS_DISABLED

Verification Disabled

enumerator ENET_MAC_VERIFYSTATUS_RXRESPOND_ERROR

Received Verify Packet with Errors

enumerator ENET_MAC_VERIFYSTATUS_RXVERIFY_ERROR

Received Verify Packet with Errors

enum EnetMacPort_QueuePreemptMode

Queue preemptive mode: express or preemptive.

Values:

enumerator ENET_MAC_QUEUE_PREEMPT_MODE_EXPRESS

Express queue

enumerator ENET_MAC_QUEUE_PREEMPT_MODE_PREEMPT

Preemptive queue

Functions

static inline bool EnetMacPort_isMii(const EnetMacPort_Interface *mii)

Check if interface is MII.

Parameters:

mii – MAC port interface

Returns:

true if MAC port interface is MII, otherwise false.

static inline bool EnetMacPort_isRmii(const EnetMacPort_Interface *mii)

Check if interface is RMII.

Parameters:

mii – MAC port interface

Returns:

true if MAC port interface is RMII, otherwise false.

static inline bool EnetMacPort_isGmii(const EnetMacPort_Interface *mii)

Check if interface is GMII.

Parameters:

mii – MAC port interface

Returns:

true if MAC port interface is GMII, otherwise false.

static inline bool EnetMacPort_isRgmii(const EnetMacPort_Interface *mii)

Check if interface is RGMII.

Parameters:

mii – MAC port interface

Returns:

true if MAC port interface is RGMII, otherwise false.

static inline bool EnetMacPort_isSgmii(const EnetMacPort_Interface *mii)

Check if interface is SGMII.

Parameters:

mii – MAC port interface

Returns:

true if MAC port interface is SGMII, otherwise false.

static inline bool EnetMacPort_isQsgmii(const EnetMacPort_Interface *mii)

Check if interface is QSGMII.

Parameters:

mii – MAC port interface

Returns:

true if MAC port interface is QSGMII, otherwise false.

static inline bool EnetMacPort_isXfi(const EnetMacPort_Interface *mii)

Check if interface is XFI.

Parameters:

mii – MAC port interface

Returns:

true if MAC port interface is XFI, otherwise false.

struct EnetMacPort_Interface
#include <enet_mod_macport.h>

MAC port interface.

Public Members

EnetMac_LayerType layerType

Interface layer type

EnetMac_SublayerType sublayerType

Interface sublayer type

EnetMac_VariantType variantType

Variant type

struct EnetMacPort_LinkCfg
#include <enet_mod_macport.h>

Link speed and duplexity configuration.

Public Members

Enet_Speed speed

Link speed

Enet_Duplexity duplexity

Duplexity

struct EnetMacPort_GenericInArgs
#include <enet_mod_macport.h>

Generic MAC port input args.

Public Members

Enet_MacPort macPort

Port number

struct EnetMacPort_SetIngressDscpPriorityMapInArgs
#include <enet_mod_macport.h>

Input args for ENET_MACPORT_IOCTL_SET_INGRESS_DSCP_PRI_MAP command.

Public Members

Enet_MacPort macPort

Port number

EnetPort_DscpPriorityMap dscpPriorityMap

Ingress DSCP priority (TOS) map

struct EnetMacPort_SetPriorityRegenMapInArgs
#include <enet_mod_macport.h>

Input args for ENET_MACPORT_IOCTL_SET_PRI_REGEN_MAP command.

Public Members

Enet_MacPort macPort

Port number

EnetPort_PriorityMap priorityRegenMap

Priority regeneration map

struct EnetMacPort_SetEgressPriorityMapInArgs
#include <enet_mod_macport.h>

Input args for ENET_MACPORT_IOCTL_SET_EGRESS_QOS_PRI_MAP command.

Public Members

Enet_MacPort macPort

Port number

EnetPort_PriorityMap priorityMap

Egress priority map

struct EnetMacPort_EnableEgressTrafficShapingInArgs
#include <enet_mod_macport.h>

Input args for ENET_MACPORT_IOCTL_ENABLE_EGRESS_TRAFFIC_SHAPING command.

Public Members

Enet_MacPort macPort

Port number

EnetPort_TrafficShapingCfg trafficShapingCfg

Traffic shaping configuration for all priorities

struct EnetMacPort_SetCreditBasedShaperInArgs
#include <enet_mod_macport.h>

Input args for ENET_MACPORT_IOCTL_SET_CREDIT_BASED_SHAPING command.

Public Members

Enet_MacPort macPort

Port number

EnetPort_CreditBasedShapingCfg cbsCfg

Credit based shaper configuration

struct EnetMacPort_GetCreditBasedShaperInArgs
#include <enet_mod_macport.h>

Input args for ENET_MACPORT_IOCTL_GET_CREDIT_BASED_SHAPING command.

Public Members

Enet_MacPort macPort

Port number

uint32_t trafficClass

Priority queue number

struct EnetMacPort_SetPreemptMinFragSizeInArgs
#include <enet_mod_macport.h>

Input args for ENET_MACPORT_IOCTL_SET_PREEMPT_MIN_FRAG_SIZE.

Public Members

Enet_MacPort macPort

Port number

uint8_t preemptMinFragSize

preemptMinFragSize is addFragSize as defined in IEEE 802.3br 64*(1 + addFragSize) becomes the minimum fragment size

struct EnetMacPort_QueuePreemptCfg
#include <enet_mod_macport.h>

MacPort Queue Preempt Config.

Public Members

EnetMacPort_QueuePreemptMode preemptMode[ENET_PRI_NUM]

Preemption mode for each queue

struct EnetMacPort_SetPreemptQueueInArgs
#include <enet_mod_macport.h>

Input args for ENET_MACPORT_IOCTL_SET_PREEMPT_QUEUE.

Public Members

Enet_MacPort macPort

Port number

EnetMacPort_QueuePreemptCfg queuePreemptCfg

Queue preemption mode

struct EnetMacPort_CutThruParams
#include <enet_mod_macport.h>

Input args for ENET_MACPORT_IOCTL_SET_CUT_THRU_PARAMS command.

Public Members

Enet_MacPort macPort

Port number

EnetPort_CutThruParams cutThruCfg

Cut Thru Switching configuration

This file contains the type definitions and helper macros for the Enet MDIO module.

Defines

ENET_MDIO_FEAT_CLAUSE45

MDIO feature mask for Clause-45 support.

ENET_MDIO_FEAT_PHY_MONITOR

MDIO feature mask for PHY state change monitoring.

ENET_MDIO_PUBLIC_IOCTL(x)

Helper macro to create IOCTL commands for MDIO module.

ENET_MDIO_PRIVATE_IOCTL(x)

Helper macro to create private IOCTL commands for MDIO module.

ENET_MDIO_PHY_ADDR_MASK(addr)

Create a MDIO PHY mask from a PHY address.

ENET_MDIO_IS_PHY_ADDR_SET(mask, addr)

Check if the corresponding PHY address mask is set.

ENET_MDIO_PHY_ADDR_MASK_NONE

MDIO PHY address mask for no PHYs present.

ENET_MDIO_PHY_ADDR_MASK_ALL

MDIO PHY address mask for all PHYs present.

ENET_MDIO_PHY_CNT_MAX

Maximum number of PHYs supported on the MDIO bus.

Enums

enum EnetMdio_Ioctl

MDIO IOCTL commands.

Values:

enumerator ENET_MDIO_IOCTL_GET_VERSION

Get the hardware version of the MDIO module.

IOCTL parameters:

enumerator ENET_MDIO_IOCTL_PRINT_REGS

Print MDIO registers.

IOCTL parameters:

  • inArgs: None

  • outArgs: None

enumerator ENET_MDIO_IOCTL_IS_ALIVE

Get PHY alive status.

IOCTL parameters:

  • inArgs: uint8_t

  • outArgs: bool

enumerator ENET_MDIO_IOCTL_IS_LINKED

Get PHY link status.

IOCTL parameters:

  • inArgs: uint8_t

  • outArgs: bool

enumerator ENET_MDIO_IOCTL_IS_POLL_ENABLED

Get link state change poll enable status.

Checks if PHY state change is being monitored for the given PHY address regardless of the underlying monitoring mechanism or mode.

IOCTL parameters:

  • inArgs: uint8_t

  • outArgs: bool

enumerator ENET_MDIO_IOCTL_C22_READ

Read a PHY register using clause-22 frame.

IOCTL parameters:

enumerator ENET_MDIO_IOCTL_C22_WRITE

Write a PHY register using clause-22 frame.

IOCTL parameters:

enumerator ENET_MDIO_IOCTL_C45_READ

Read a PHY register using clause-45 frame.

IOCTL parameters:

enumerator ENET_MDIO_IOCTL_C45_WRITE

Write a PHY register using clause-45 frame.

IOCTL parameters:

enumerator ENET_MDIO_IOCTL_C22_ASYNC_READ_TRIGGER

Trigger Asynchronous read to PHY register.

IOCTL parameters:

enumerator ENET_MDIO_IOCTL_C22_ASYNC_READ_COMPLETE

Checks for async read completion to PHY register.

IOCTL parameters:

enumerator ENET_MDIO_IOCTL_C22_ASYNC_WRITE_TRIGGER

Trigger Asynchronous Write to PHY register.

IOCTL parameters:

enumerator ENET_MDIO_IOCTL_C22_ASYNC_WRITE_COMPLETE

Checks for async Write completion to PHY register.

IOCTL parameters:

enumerator ENET_MDIO_IOCTL_C45_ASYNC_READ_TRIGGER

Trigger Asynchronous Read to PHY register using clause-45 frame.

IOCTL parameters:

enumerator ENET_MDIO_IOCTL_C45_ASYNC_READ_COMPLETE

Checks for async Read completion to PHY register using clause-45 frame.

IOCTL parameters:

enumerator ENET_MDIO_IOCTL_C45_ASYNC_WRITE_TRIGGER

Trigger Asynchronous Write to PHY register using clause-45 frame.

IOCTL parameters:

enumerator ENET_MDIO_IOCTL_C45_ASYNC_WRITE_COMPLETE

Checks for async Write completion to PHY register using clause-45 frame.

IOCTL parameters:

enumerator ENET_MDIO_IOCTL_ENABLE_STATE_MACHINE

Enable MDIO state machine. Use.

If Mdio_Cfg.disableStateMachineOnInit is set, this IOCTL allows enabling Mdio state machine via IOCTL. This is used for sequencing external PHY management operation with MDIO state machine so that any link interrupts are not missed and MDIO state machine is enabled only after PHY initialization is complete IOCTL parameters:

  • inArgs: None

  • outArgs: None

enum EnetMdio_Group

MDIO user group.

Values:

enumerator ENET_MDIO_GROUP_0

Group 0

enumerator ENET_MDIO_GROUP_1

Group 1

enumerator ENET_MDIO_GROUP_NUM

Number of groups

enum EnetMdio_FrameFmt

Frame format.

Values:

enumerator ENET_MDIO_FRAME_FMT_C22

Clause 22 frame format

enumerator ENET_MDIO_FRAME_FMT_C45

Clause 45 frame format

enum EnetMdio_C45Mmd

Clause-45 MDIO Manageable Device (MMD) addresses.

Values:

enumerator ENET_MDIO_MMD_PMA_PMD

PMA/PMD

enumerator ENET_MDIO_MMD_WIS

WIS

enumerator ENET_MDIO_MMD_PCS

PCS

enumerator ENET_MDIO_MMD_PHY_XS

PHY XS

enumerator ENET_MDIO_MMD_DTE_XS

DTE XS

enumerator ENET_MDIO_MMD_VENDOR_1

Vendor specific 1

enumerator ENET_MDIO_MMD_VENDOR_2

Vendor specific 2

struct EnetMdio_C22ReadInArgs
#include <enet_mod_mdio.h>

Input args for ENET_MDIO_IOCTL_C22_READ command.

Clause-22 register read arguments.

Public Members

EnetMdio_Group group

User channel to be used to perform the register access. Simultaneous access from same group is not allowed. Not applicable in manual mode.

uint32_t phyAddr

PHY address

uint16_t reg

Register address

struct EnetMdio_C45ReadInArgs
#include <enet_mod_mdio.h>

Input args for ENET_MDIO_IOCTL_C45_READ command.

Clause-45 register read arguments.

Public Members

EnetMdio_Group group

User channel to be used to perform the register access. Simultaneous access from same group is not allowed. Not applicable in manual mode.

uint32_t phyAddr

PHY address

EnetMdio_C45Mmd mmd

MMD

uint16_t reg

Register address

struct EnetMdio_C22WriteInArgs
#include <enet_mod_mdio.h>

Input args for ENET_MDIO_IOCTL_C22_WRITE command.

Clause-22 register write arguments.

Public Members

EnetMdio_Group group

User channel to be used to perform the register access. Simultaneous access from same group is not allowed. Not applicable in manual mode.

uint32_t phyAddr

PHY address

uint16_t reg

Register address

uint16_t val

Value to be written

struct EnetMdio_C45WriteInArgs
#include <enet_mod_mdio.h>

Input args for ENET_MDIO_IOCTL_C45_WRITE command.

Clause-45 register write arguments.

Public Members

EnetMdio_Group group

User channel to be used to perform the register access. Simultaneous access from same group is not allowed. Not applicable in manual mode.

uint32_t phyAddr

PHY address

EnetMdio_C45Mmd mmd

MMD

uint16_t reg

Register address

uint16_t val

Value to be written

This file contains the type definitions and helper macros for the Ethernet PHY interface.

Defines

ENET_PHY_PUBLIC_IOCTL(x)

Helper macro to create PHY IOCTL commands.

Enums

enum EnetPhy_Ioctl_e

PHY IOCTL commands.

Values:

enumerator ENET_PHY_IOCTL_GET_ID

Get PHY identification.

IOCTL parameters:

enumerator ENET_PHY_IOCTL_GET_SUPPORTED_MODES

Get PHY supported modes by local PHY device.

IOCTL parameters:

enumerator ENET_PHY_IOCTL_GET_LOOPBACK_STATE

Check if PHY is in loopback or not.

IOCTL parameters:

enumerator ENET_PHY_IOCTL_IS_ALIVE

Check PHY alive status.

IOCTL parameters:

enumerator ENET_PHY_IOCTL_IS_LINKED

Check state-machine link state, that is, whether the state machine has reached the LINKED state.

IOCTL parameters:

Get the link speed and duplexity state after the state machine has reached the LINKED state.

IOCTL parameters:

enumerator ENET_PHY_IOCTL_RESET

Reset PHY.

IOCTL parameters:

enumerator ENET_PHY_IOCTL_READ_REG

Read PHY register.

IOCTL parameters:

enumerator ENET_PHY_IOCTL_WRITE_REG

Write PHY register.

IOCTL parameters:

enumerator ENET_PHY_IOCTL_READ_EXT_REG

Read PHY extended register.

IOCTL parameters:

enumerator ENET_PHY_IOCTL_WRITE_EXT_REG

Write PHY extended register.

IOCTL parameters:

enumerator ENET_PHY_IOCTL_C45_READ_REG

Read PHY register using Clause-45 frame.

IOCTL parameters:

enumerator ENET_PHY_IOCTL_C45_WRITE_REG

Write PHY register using Clause-45 frame.

IOCTL parameters:

enumerator ENET_PHY_IOCTL_PRINT_REGS

Print PHY registers.

IOCTL parameters:

enumerator ENET_PHY_IOCTL_ADJ_PTP_FREQ

Adjust PHY PTP clock Frequency.

IOCTL parameters:

enumerator ENET_PHY_IOCTL_ADJ_PTP_PHASE

Adjust PHY PTP clock Phase.

IOCTL parameters:

enumerator ENET_PHY_IOCTL_GET_PTP_TIME

Get current PHY PTP clock time.

IOCTL parameters:

enumerator ENET_PHY_IOCTL_SET_PTP_TIME

Set PHY PTP clock time.

IOCTL parameters:

enumerator ENET_PHY_IOCTL_GET_PTP_TXTS

Get PHY PTP TX packet timestamp.

IOCTL parameters:

enumerator ENET_PHY_IOCTL_GET_PTP_RXTS

Get PHY PTP RX packet timestamp.

IOCTL parameters:

enumerator ENET_PHY_IOCTL_WAIT_PTP_TXTS

Add PHY PTP TX packet info to a waiting TX timestamp list.

IOCTL parameters:

enumerator ENET_PHY_IOCTL_PROC_STATUS_FRAME

Process PHY status frame.

IOCTL parameters:

enumerator ENET_PHY_IOCTL_GET_STATUS_FRAME_ETHDR

Get PHY status frame header.

IOCTL parameters:

enumerator ENET_PHY_IOCTL_ENABLE_PTP

Enable/Disable PHY PTP module.

IOCTL parameters:

enumerator ENET_PHY_IOCTL_ENABLE_EVENT_CAPTURE

Enable/Disable an event capture on a PHY GPIO pin.

IOCTL parameters:

enumerator ENET_PHY_IOCTL_ENABLE_TRIGGER_OUTPUT

Enable/Disable clock trigger on a GPIO pin.

IOCTL parameters:

enumerator ENET_PHY_IOCTL_GET_EVENT_TIMESTAMP

Get event timestamp.

IOCTL parameters:

Get Phy Link status. This IOTCL will not have longterm support and this functionality will eventually be merged to ENET_PHY_IOCTL_GET_LINK_MODE IOCTL in upcoming release. So ENET_PHY_IOCTL_GET_LINK_MODE IOCTL can be continued to use to get the phy link speed, duplexity.

IOCTL parameters:

enumerator ENET_PHY_IOCTL_CONFIG_MEDIA_CLOCK

Config Media Clock.

IOCTL parameters:

enumerator ENET_PHY_IOCTL_NUDGE_CODEC_CLOCK

Nudge Codec Clock.

IOCTL parameters:

struct EnetPhy_GenericInArgs
#include <enet_mod_phy.h>

Generic input args.

Public Members

Enet_MacPort macPort

Port number

struct EnetPhy_ReadRegInArgs
#include <enet_mod_phy.h>

Input args for ENET_PHY_IOCTL_READ_EXT_REG command.

Public Members

Enet_MacPort macPort

Port number

uint16_t reg

Register address

struct EnetPhy_WriteRegInArgs
#include <enet_mod_phy.h>

Input args for ENET_PHY_IOCTL_WRITE_EXT_REG command.

Public Members

Enet_MacPort macPort

Port number

uint16_t reg

Register address

uint16_t val

Value to be written

struct EnetPhy_C45ReadRegInArgs
#include <enet_mod_phy.h>

Input args for ENET_PHY_IOCTL_C45_READ_REG command.

Public Members

Enet_MacPort macPort

Port number

uint8_t mmd

MMD

uint16_t reg

Register address

struct EnetPhy_C45WriteRegInArgs
#include <enet_mod_phy.h>

Input args for ENET_PHY_IOCTL_C45_WRITE_REG command.

Public Members

Enet_MacPort macPort

Port number

uint8_t mmd

MMD

uint16_t reg

Register address

uint16_t val

Value to be written

struct EnetPhy_PtpPktTimestampInArgs
#include <enet_mod_phy.h>

Input args for ENET_PHY_IOCTL_GET_PTP_TXTS command.

Public Members

Enet_MacPort macPort
uint32_t domain
uint32_t msgType
uint32_t seqId
struct EnetPhy_AdjPtpFreqInArgs
#include <enet_mod_phy.h>

Input args for ENET_PHY_IOCTL_ADJ_PTP_FREQ command.

Public Members

Enet_MacPort macPort
int64_t ppb
struct EnetPhy_AdjPtpPhaseInArgs
#include <enet_mod_phy.h>

Input args for ENET_PHY_IOCTL_ADJ_PTP_PHASE command.

Public Members

Enet_MacPort macPort
int64_t offset
struct EnetPhy_SetPtpTimeInArgs
#include <enet_mod_phy.h>

Input args for ENET_PHY_IOCTL_SET_PTP_TIME command.

Public Members

Enet_MacPort macPort
uint64_t ts64
struct EnetPhy_ProcStatusFrameInArgs
#include <enet_mod_phy.h>

Input args for ENET_PHY_IOCTL_PROC_STATUS_FRAME command.

Public Members

Enet_MacPort macPort
uint8_t *frame
uint32_t size
struct EnetPhy_ProcStatusFrameOutArgs
#include <enet_mod_phy.h>

Output args for ENET_PHY_IOCTL_PROC_STATUS_FRAME command.

Public Members

uint32_t types
struct EnetPhy_GetStatusFrameEthdrOutArgs
#include <enet_mod_phy.h>

Input args for ENET_PHY_IOCTL_GET_STATUS_FRAME_ETHDR command.

Public Members

uint8_t *ethhdr
uint32_t size
struct EnetPhy_EnablePtpInArgs
#include <enet_mod_phy.h>

Input args for ENET_PHY_IOCTL_ENABLE_PTP command.

Public Members

Enet_MacPort macPort
bool on
uint32_t srcMacStatusFrameType
struct EnetPhy_EnableEventCaptureInArgs
#include <enet_mod_phy.h>

Input args for ENET_PHY_IOCTL_ENABLE_EVENT_CAPTURE command.

Public Members

Enet_MacPort macPort
uint32_t eventIdx
bool falling
bool on
struct EnetPhy_EnableTriggerOutputInArgs
#include <enet_mod_phy.h>

Input args for ENET_PHY_IOCTL_ENABLE_TRIGGER_OUTPUT command.

Public Members

Enet_MacPort macPort
uint32_t triggerIdx
uint64_t startNsec
uint64_t periodNsec
bool repeat
struct EnetPhy_GetEventTimestampOutArgs
#include <enet_mod_phy.h>

Output args for ENET_PHY_IOCTL_GET_EVENT_TIMESTAMP command.

Public Members

uint32_t eventIdx
uint32_t seqId
uint64_t ts64
struct EnetPhy_ConfigMediaClockInArgs
#include <enet_mod_phy.h>

Input args for ENET_PHY_IOCTL_CONFIG_MEDIA_CLOCK command.

Public Members

Enet_MacPort macPort
bool isMaster
uint8_t *streamIDMatchValue
bool enTrigOut
struct EnetPhy_NudgeCodecClockInArgs
#include <enet_mod_phy.h>

Input args for ENET_PHY_IOCTL_NUDGE_CODEC_CLOCK command.

Public Members

Enet_MacPort macPort
int8_t nudgeValue

This file contains the type definitions and helper macros that are common for host and MAC ports.

Enums

enum EnetPort_EgressPriorityType

Egress priority type.

Values:

enumerator ENET_EGRESS_PRI_TYPE_FIXED

Fixed priority

enumerator ENET_EGRESS_PRI_TYPE_ESCALATE

Escalate priority

struct EnetPort_VlanCfg
#include <enet_mod_port.h>

VLAN configuration parameters.

Public Members

uint32_t portPri

Port VLAN priority

uint32_t portCfi

Port CFI bit

uint32_t portVID

Port VLAN ID

struct EnetPort_TrafficShapingRates
#include <enet_mod_port.h>

Traffic shaping parameters (committed and excess rates).

Public Members

uint64_t committedRateBitsPerSec

Committed Information Rate (CIR) in bits-per-second

uint64_t excessRateBitsPerSec

Excess Information Rate (EIR) in bits-per-second

struct EnetPort_CreditBasedShapingCfg
#include <enet_mod_port.h>

Credit Based shaping parameters (idleSlope).

Public Members

uint32_t queueNum

Priority queue number

uint64_t idleSlope

idleSlope for CBS for the switch queue priority

struct EnetPort_TrafficShapingCfg
#include <enet_mod_port.h>

Traffic shaping configuration for all priorities.

Public Members

EnetPort_TrafficShapingRates rates[ENET_PRI_NUM]

Traffic shaping rates (committed and excess rates) for all priorities

struct EnetPort_PriorityMap
#include <enet_mod_port.h>

Priority map.

It can be used for priority regeneration as well as for QoS egress priority remapping.

Public Members

uint32_t priorityMap[ENET_PRI_NUM]

Packet priority map. Map index is the input priority, map value is the output priority.

struct EnetPort_DscpPriorityMap
#include <enet_mod_port.h>

DSCP priority map.

Public Members

uint32_t tosMap[ENET_TOS_PRI_NUM]

DSCP IPv4/IPv6 to priority map

bool dscpIPv4En

Enable IPv4 based DSCP

bool dscpIPv6En

Enable IPv6 based DSCP

struct EnetPort_MaxLen
#include <enet_mod_port.h>

Maximum packet lengths for TX and RX.

Public Members

uint32_t mtu[ENET_PRI_NUM]

Per-priority Maximum Transmit Unit (MTU)

uint32_t mru

Maximum Receive Unit (MRU)

struct EnetPort_CutThruParams
#include <enet_mod_port.h>

Public Members

bool portSpeedAutoEn

Port Speed

uint32_t rxPriCutThruEn

RX Priority for Cut-thru

uint32_t txPriCutThruEn

TX Priority for Cut-thru

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

Defines

ENET_STATS_PUBLIC_IOCTL(x)

Helper macro to create IOCTL commands for STATS module.

Enums

enum EnetStats_Ioctl

Statistics IOCTL commands.

Values:

enumerator ENET_STATS_IOCTL_GET_VERSION

Get the hardware version of the Stats module.

IOCTL parameters:

enumerator ENET_STATS_IOCTL_PRINT_REGS

Print Stats registers.

IOCTL parameters:

  • inArgs: None

  • outArgs: None

enumerator ENET_STATS_IOCTL_GET_HOSTPORT_STATS

Get host port statistics.

Gets the network statistics of the host port. It’s caller’s responsibility to typecast the returned statistics structure according to the underlying peripheral’s definition.

Use this IOCTL if the statistics module doesn’t support separate host port and MAC port statistics.

IOCTL parameters:

  • inArgs: None

  • outArgs: Peripheral/module specific definition.

enumerator ENET_STATS_IOCTL_GET_MACPORT_STATS

Get MAC port statistics.

Gets the network statistics of the given MAC port number. It’s caller’s responsibility to typecast the returned statistics structure according to the underlying peripheral’s definition. For ICSSG MAC mode usecase, port number can’t be other than ENET_MAC_PORT_1, as each ICSSG MAC supports only one MAC port.

IOCTL parameters:

  • inArgs: Enet_MacPort

  • outArgs: Peripheral/module specific definition.

enumerator ENET_STATS_IOCTL_RESET_HOSTPORT_STATS

Reset host port statistics.

Resets the network statistics counters of the host port.

Use this IOCTL if the statistics module doesn’t support separate host port and MAC port statistics.

IOCTL parameters:

  • inArgs: None

  • outArgs: None

enumerator ENET_STATS_IOCTL_RESET_MACPORT_STATS

Reset MAC port statistics.

Resets the network statistics counters of the given MAC port number. For ICSSG MAC mode usecase, port number can’t be other than ENET_MAC_PORT_1, as each ICSSG MAC supports only one MAC port.

IOCTL parameters:

This file contains the type definitions and helper macros for the Enet Time Aware Shaper (TAS) module interface.

Defines

ENET_TAS_PUBLIC_IOCTL(x)

Helper macro to create IOCTL commands for TAS module.

ENET_TAS_GATE_MASK(tc7, tc6, tc5, tc4, tc3, tc2, tc1, tc0)

Helper macro to create a gate mask.

ENET_TAS_MAX_CMD_LISTS

Maximum number of gate command entries in each list.

ENET_TAS_MAX_NUM_QUEUES

Maximum number of transmit queues supported by implementation.

Enums

enum EnetTas_Ioctl

TAS module IOCTL commands.

Values:

enumerator ENET_TAS_IOCTL_GET_VERSION

Get the hardware version of the TAS module.

IOCTL parameters:

Type: Synchronous.

enumerator ENET_TAS_IOCTL_SET_ADMIN_LIST

Set the admin list parameters of the TAS module.

IOCTL parameters:

Type: Asynchronous.

enumerator ENET_TAS_IOCTL_GET_OPER_LIST_STATUS

Get the status of the operational list update.

This IOCTL should be called after ENET_TAS_IOCTL_SET_ADMIN_LIST to verify admin list to operational list copy at specified time. This IOCTL should be called until ENET_TAS_OPER_LIST_UPDATED received as output.

IOCTL parameters:

Type: Synchronous.

enumerator ENET_TAS_IOCTL_SET_STATE

Set the state of the TAS module.

IOCTL parameters:

Type: Asynchronous.

enumerator ENET_TAS_IOCTL_GET_STATE

Get the state of the TAS module.

IOCTL parameters:

Type: Synchronous.

enumerator ENET_TAS_IOCTL_GET_ADMIN_LIST

Get the admin list parameters of the TAS module.

IOCTL parameters:

Type: Synchronous.

enumerator ENET_TAS_IOCTL_GET_OPER_LIST

Get the operational list parameters of the TAS module.

IOCTL parameters:

Type: Synchronous.

enumerator ENET_TAS_IOCTL_CONFIG_CHANGE_STATUS_PARAMS

Get the TAS config change status parameters.

IOCTL parameters:

Type: Synchronous.

enum EnetTas_OperStatus

TAS state types.

Values:

enumerator ENET_TAS_OPER_LIST_NOT_YET_UPDATED

Operational list is not yet updated.

enumerator ENET_TAS_OPER_LIST_UPDATED

Operational list is updated.

enum EnetTas_TasState

TAS state types.

Values:

enumerator ENET_TAS_DISABLE

Idle.

enumerator ENET_TAS_ENABLE

Enable TAS.

enumerator ENET_TAS_RESET

Reset the state machine.

struct EnetTas_GenericInArgs
#include <enet_mod_tas.h>

Generic input args.

Public Members

Enet_MacPort macPort

Port number.

struct EnetTas_GateCmdEntry
#include <enet_mod_tas.h>

Gate control list. See IEEE Std 802.1Q-2018 8.6.8.4.

Public Members

uint32_t timeInterval

32-bit time interval for the gate command.

uint8_t gateStateMask

8-bit mask to signify which gate will be open. One bit for each gate.

struct EnetTas_MaxSDUTable
#include <enet_mod_tas.h>

Max SDU table. See IEEE Std 802.1Q-2018 12.29.1.1.

Public Members

uint16_t maxSDU[ENET_TAS_MAX_NUM_QUEUES]

Maximum service data unit (SDU). One per queue.

struct EnetTas_ControlList
#include <enet_mod_tas.h>

Gate control list. See IEEE Std 802.1Q-2018 8.6.9.4 D3-1.

Public Members

uint64_t baseTime

Base time for the TAS gate operations. If a list is already active, then this time will be increased to align with the nearest start of cycle boundary. This is a 64-bit timestamp in nanoseconds.

EnetTas_GateCmdEntry gateCmdList[ENET_TAS_MAX_CMD_LISTS]

The actual gate list containing operations and delay associated.

uint64_t cycleTime

The list repeats after this time.

uint8_t listLength

Length of the list or number of entries.

EnetTas_MaxSDUTable sduTable

See EnetTas_MaxSDUTable.

struct EnetTas_ConfigStatus
#include <enet_mod_tas.h>

Config state machine variables. See IEEE Std 802.1Q-2018 8.6.8.4.

Public Members

uint64_t configChangeTime

New list is copied at this time.

uint32_t configChangeErrorCounter

Config change error counter, incremented if admin->baseTime < current time and TAS_enabled is true.

uint8_t configPending

True if list update is pending.

uint8_t configChange

Set to true when application trigger updating of admin list to active list, cleared when configChangeTime is updated.

struct EnetTas_SetAdminListInArgs
#include <enet_mod_tas.h>

Input args for ENET_TAS_IOCTL_SET_ADMIN_LIST commands.

Public Members

Enet_MacPort macPort

Port number.

EnetTas_ControlList adminList

Admin list.

struct EnetTas_SetStateInArgs
#include <enet_mod_tas.h>

Input args for ENET_TAS_IOCTL_SET_STATE commands.

Public Members

Enet_MacPort macPort

Port number.

EnetTas_TasState state

TAS state.

This file contains the type definitions and helper macros for the Enet Time Synchronization module interface.

Defines

ENET_TIMESYNC_PUBLIC_IOCTL(x)

Helper macro to create IOCTL commands for TIMESYNC module.

Enums

enum EnetTimeSync_Ioctl

TimeSync module IOCTL commands.

Values:

enumerator ENET_TIMESYNC_IOCTL_GET_VERSION

Get the hardware version of the TimeSync module.

IOCTL parameters:

enumerator ENET_TIMESYNC_IOCTL_PRINT_REGS

Print TimeSync registers.

IOCTL parameters:

  • inArgs: None

  • outArgs: None

enumerator ENET_TIMESYNC_IOCTL_PRINT_STATS

Print TimeSync event statistics. They could be either hardware or software based statistics.

IOCTL parameters:

  • inArgs: None

  • outArgs: None

enumerator ENET_TIMESYNC_IOCTL_GET_CURRENT_TIMESTAMP

Get current timestamp.

IOCTL parameters:

  • inArgs: None

  • outArgs: uint64_t

enumerator ENET_TIMESYNC_IOCTL_SET_TIMESTAMP

Set timestamp value.

IOCTL parameters:

enumerator ENET_TIMESYNC_IOCTL_ADJUST_TIMESTAMP

Adjust the timestamp value.

IOCTL parameters:

enumerator ENET_TIMESYNC_IOCTL_GET_ETH_RX_TIMESTAMP

Get Ethernet RX timestamp.

IOCTL parameters:

enumerator ENET_TIMESYNC_IOCTL_GET_ETH_TX_TIMESTAMP

Get Ethernet TX timestamp. For CPSW the driver maintains a pool of the timestamps that are captured by CPTS and gives back the matched entry. But, In case of ICSSG, Driver doesn’t maintain any software pool, it returns back the top entry in the queue if it matches the seq id passed.

IOCTL parameters:

enumerator ENET_TIMESYNC_IOCTL_RESET

Reset TimeSync module.

IOCTL parameters:

  • inArgs: None

  • outArgs: None

enumerator ENET_TIMESYNC_IOCTL_SET_TIMESTAMP_COMPLETE

ICSSG Set timestamp operation completed.

IOCTL parameters:

  • inArgs: None

  • outArgs: None

enum EnetTimeSync_MsgType

TimeSync Ethernet message type.

Values:

enumerator ENET_TIMESYNC_MESSAGE_SYNC

TimeSync sync message

enumerator ENET_TIMESYNC_MESSAGE_DELAY_REQ

TimeSync delay request message

enumerator ENET_TIMESYNC_MESSAGE_PDELAY_REQ

TimeSync Pdelay request message

enumerator ENET_TIMESYNC_MESSAGE_PDELAY_RESP

TimeSync Pdelay response message

enumerator ENET_TIMESYNC_MESSAGE_FOLLOW_UP

TimeSync follow up message

enumerator ENET_TIMESYNC_MESSAGE_DELAY_RESP

TimeSync delay response message

enumerator ENET_TIMESYNC_MESSAGE_PDELAY_RESP_FOLLOW_UP

TimeSync Pdelay response followup message

enumerator ENET_TIMESYNC_MESSAGE_ANNOUNCE

TimeSync announce message

enumerator ENET_TIMESYNC_MESSAGE_SIGNALING

TimeSync signaling message

enumerator ENET_TIMESYNC_MESSAGE_MANAGEMENT

TimeSync management message

enumerator ENET_TIMESYNC_MESSAGE_INVALID

TimeSync invalid message

enum EnetTimeSync_AdjMode

TimeSync adjustment mode.

Values:

enumerator ENET_TIMESYNC_ADJMODE_DISABLE

Adjustment value is set to zero

enumerator ENET_TIMESYNC_ADJMODE_PPM

Adjustment value is calculated for parts per million

enumerator ENET_TIMESYNC_ADJMODE_PPH

Adjustment value is calculated for parts per hour

enum EnetTimeSync_AdjDir

TimeSync adjustment direction.

Values:

enumerator ENET_TIMESYNC_ADJDIR_INCREASE

Increase timestamp with adjustment value

enumerator ENET_TIMESYNC_ADJDIR_DECREASE

Decrease timestamp with adjustment value

struct EnetTimeSync_setTimestamp
#include <enet_mod_timesync.h>

Timestamp set.

Public Members

uint64_t tsLoadVal

timestamp value in nano seconds unit to set

uint8_t clkMode

mode of the clock. Applicable only to ICSSG peripheral. Says whether given value tsLoadVal is absolute or related. 0: absolute, 1: relative

uint8_t clkSign
struct EnetTimeSync_TimestampAdj
#include <enet_mod_timesync.h>

Timestamp adjustment.

Public Members

int32_t adjValInNsecs

Adjustment value for timestamp

uint32_t intervalInNsecs

Interval to apply the adjustment

struct EnetTimeSync_GetEthTimestampInArgs
#include <enet_mod_timesync.h>

Input args for ENET_TIMESYNC_IOCTL_GET_ETH_RX_TIMESTAMP and ENET_TIMESYNC_IOCTL_GET_ETH_TX_TIMESTAMP commands.

Public Members

EnetTimeSync_MsgType msgType

TimeSync event message type

uint32_t seqId

Sequence id of the event

uint32_t portNum

MAC port number corresponding to the event

uint32_t domain

Domain number of the event

This file contains the OSAL API of the Enet driver.

Typedefs

typedef void (*EnetOsal_Isr)(uintptr_t arg)

Enet OSAL ISR callback function prototype.

Param arg:

App data

Enums

enum EnetOSAL_armGicTrigType_t

Enumerates the types different trigger types. Please refer to Section 4.3.13 Interrupt Configuration Registers, GICD_ICFGRn of ARM Generic Interrupt Controller Architecture version 2.0 Architecture Specification document for details.

Values:

enumerator ENETOSAL_ARM_GIC_TRIG_TYPE_LEVEL

Corresponding interrupt is level sensitive

enumerator ENETOSAL_ARM_GIC_TRIG_TYPE_EDGE

Corresponding interrupt is edge sensitive

enumerator ENETOSAL_ARM_GIC_TRIG_TYPE_HIGH_LEVEL

Coressponding interrupt is high level sensitive

enumerator ENETOSAL_ARM_GIC_TRIG_TYPE_LOW_LEVEL

Coressponding interrupt is low level sensitive

enumerator ENETOSAL_ARM_GIC_TRIG_TYPE_RISING_EDGE

Coressponding interrupt is rising edge sensitive

enumerator ENETOSAL_ARM_GIC_TRIG_TYPE_FALLING_EDGE

Coressponding interrupt is falling edge sensitive

Functions

uintptr_t EnetOsal_disableAllIntr(void)

Enet OSAL intr disable function prototype.

Returns:

Cookie to be passed back to enable interrupt function

void EnetOsal_restoreAllIntr(uintptr_t cookie)

Enet OSAL intr restore function prototype.

Parameters:

cookie – This is returned in disable interrupt function

HwiP_enetOsal *EnetOsal_registerIntr(EnetOsal_Isr isrFxn, uint32_t coreIntrNum, uint32_t intrPriority, uint32_t intrTrigType, void *arg)

Register an ISR for an interrupt.

Parameters:
  • isrFxn – Interrupt service routine

  • coreIntrNum – Interrupt number

  • intrPriority – Interrupt priority

  • intrTrigType – Interrupt trigger type

  • arg – Argument to ISR function

Returns:

Interrupt handle pointer

void EnetOsal_unregisterIntr(HwiP_enetOsal *hHwi)

Unregister an interrupt.

Parameters:

hHwi – Interrupt handle pointer

void EnetOsal_enableIntr(uint32_t coreIntrNum)

Enable interrupt.

Parameters:

coreIntrNum – Interrupt number

void EnetOsal_disableIntr(uint32_t coreIntrNum)

Disable interrupt.

Parameters:

coreIntrNum – Interrupt number

SemaphoreP_enetOsal *EnetOsal_createMutex(void)

Create a mutex.

Returns:

Mutex handle pointer

void EnetOsal_deleteMutex(SemaphoreP_enetOsal *hMutex)

Delete a mutex.

Parameters:

hMutex – Mutex handle pointer

void EnetOsal_lockMutex(SemaphoreP_enetOsal *hMutex)

Lock a mutex.

Parameters:

hMutex – Mutex handle pointer

void EnetOsal_unlockMutex(SemaphoreP_enetOsal *hMutex)

Unlock a mutex.

Parameters:

hMutex – Mutex handle pointer

void EnetOsal_cacheInv(void *addr, int32_t size)

Invalidate cache.

Invalidates cache in a range of memory.

Parameters:
  • addr – Start address of the cache line(s)

  • size – Size (in bytes) of the memory to invalidate

void EnetOsal_cacheWb(void *addr, int32_t size)

Write-back cache.

Writes back cache a range of memory from cache.

Parameters:
  • addr – Start address of the cache line(s)

  • size – Size (in bytes) of the memory to be written back

void EnetOsal_cacheWbInv(void *addr, int32_t size)

Write-back and invalidate cache.

Writes back and invalidates a range of memory.

Parameters:
  • addr – Start address of the cache line/s

  • size – Size (in bytes) of the memory to be written back

bool EnetOsal_isCacheCoherent(void)
uint32_t EnetOsal_timerGetDiff(uint32_t startTime)

Get the time difference with respect to timestamp.

Gets the difference between time value passed to this function and current time from timer.

Returns:

Time difference

uint32_t EnetOsal_timerRead(void)

Read current timer value.

Returns:

Timer’s read value

struct SemaphoreP_enetOsal
#include <enet_osal.h>

Semaphore structure.

Public Members

bool used
SemaphoreP_Object sem
struct HwiP_enetOsal
#include <enet_osal.h>

Hwi structure.

Public Members

bool used
HwiP_Object hwi

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

Defines

ENET_TO_PER(per)

Convert peripheral specific handle to EnetMod generic handle.

ENET_PER_NAME(per)

Get peripheral name.

ENET_PER_PUBLIC_IOCTL(x)

Helper macro to create IOCTL commands for peripherals.

Typedefs

typedef struct EnetPer_Obj_s *EnetPer_Handle

Ethernet Peripheral handle.

Ethernet Peripheral handle used to call any EnetPer related APIs.

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.

Param hPer:

Enet Peripheral handle

Param enetType:

Enet Peripheral type

Param cfg:

Configuration parameters to be initialized

Param cfgSize:

Size of the configuration parameters

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.

Param hPer:

Enet Peripheral handle

Param enetType:

Enet Peripheral type

Param instId:

Enet Peripheral instance id

Param cfg:

Configuration parameters

Param cfgSize:

Size of the configuration parameters

Return:

Enet_ErrorCodes

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.

Param hPer:

Enet Peripheral handle

Param enetType:

Enet Peripheral type

Param instId:

Enet Peripheral instance id

Return:

Enet_ErrorCodes

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.

Param hPer:

Enet Peripheral handle

Param cmd:

IOCTL command Id

Param prms:

IOCTL parameters

Return:

Enet_ErrorCodes

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.

Param hPer:

Enet Peripheral handle

Param evt:

Event type

Param arg:

Pointer to the poll argument. This is specific to the poll event type

Param argSize:

Size of arg

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.

Param hPer:

Enet Peripheral handle

Param ts:

Timestamp value, definition is peripheral specific

Return:

Nanoseconds value.

typedef void (*const EnetPer_PeriodicTick)(EnetPer_Handle hPer)

Run periodic tick on the Ethernet peripheral.

Run PHY periodic tick on the Ethernet peripheral.

Param hPer:

Enet Peripheral handle

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.

Param hPer:

Enet Peripheral handle

Param evt:

Event being registered for

Param evtNum:

Event number. Use 0 for single event.

Param evtCb:

Callback function

Param evtCbArgs:

Callback function arguments

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.

Param hPer:

Enet Peripheral handle

Param evt:

Event being registered for

Param evtNum:

Event number. Use 0 for single event.

typedef void (*const EnetPer_Close)(EnetPer_Handle hPer)

Close the Enet Peripheral.

Closes the Enet Peripheral.

Param hPer:

Enet Peripheral handle

typedef void (*const EnetPer_SaveCtxt)(EnetPer_Handle hPer)

Save and close the Enet Peripheral.

Saves and Closes the Enet Peripheral.

Param hPer:

Enet Peripheral handle

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.

Param hPer:

Enet Peripheral handle

Param enetType:

Enet Peripheral type

Param instId:

Enet Peripheral instance id

Return:

Enet_ErrorCodes

Enums

enum EnetPer_Ioctl_e

Ethernet peripheral IOCTL commands.

Values:

enumerator ENET_PER_IOCTL_GET_VERSION

Get the hardware version of the peripheral.

IOCTL parameters:

enumerator ENET_PER_IOCTL_PRINT_REGS

Print registers of the peripheral and all its modules.

IOCTL parameters:

  • inArgs: None

  • outArgs: None

enumerator ENET_PER_IOCTL_OPEN_PORT_LINK

Open port link (MAC port and PHY).

IOCTL parameters:

enumerator ENET_PER_IOCTL_CLOSE_PORT_LINK

Close port link (MAC port and PHY).

IOCTL parameters:

Check if port link is up.

IOCTL parameters:

Get port link configuration (speed and duplexity).

IOCTL parameters:

enumerator ENET_PER_IOCTL_ATTACH_CORE

Attach core to Ethernet peripheral.

IOCTL parameters:

enumerator ENET_PER_IOCTL_DETACH_CORE

Detach core from Ethernet peripheral using its core key.

IOCTL parameters:

  • inArgs: uint32_t

  • outArgs: None

enumerator ENET_IOCTL_REGISTER_RX_DEFAULT_FLOW

Register default flow to a specific rx flow.

IOCTL parameters:

enumerator 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:

enumerator 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:

enumerator 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:

enumerator ENET_PER_IOCTL_SET_VLAN_AWARE

Enable VLAN aware mode.

Enables VLAN aware mode at peripheral level.

IOCTL parameters:

  • inArgs: None

  • outArgs: None

enumerator ENET_PER_IOCTL_SET_VLAN_UNAWARE

Disable VLAN aware mode.

Disables VLAN aware mode at peripheral level.

IOCTL parameters:

  • inArgs: None

  • outArgs: None

enumerator ENET_PER_IOCTL_HANDLE_EXTPHY_LINKUP_EVENT

Handle link up event for an externally managed PHY.

IOCTL params:

Type: Synchronous.

enumerator ENET_PER_IOCTL_HANDLE_EXTPHY_LINKDOWN_EVENT

Handle link down event for an externally managed PHY.

IOCTL params:

  • inArgs: #

  • outArgs: None

Type: Synchronous.

enumerator ENET_PER_IOCTL_REGISTER_IOCTL_HANDLER

Register IOCTL handler.

IOCTL params:

Type: Synchronous.

enumerator ENET_PER_IOCTL_SET_ISOLATE_STATE

Setting PHY ISOLATE mode.

Settting the PHY to ISOLATE mode

IOCTL parameters:

  • inArgs: None

  • outArgs: None

enumerator ENET_PER_IOCTL_CLEAR_ISOLATE_STATE

Clear PHY ISOLATE mode.

Clear the PHY ISOLATE mode

IOCTL parameters:

  • inArgs: None

  • outArgs: None

struct Enet_DfltFlowInfo
#include <enet_per.h>

Rx Default Flow Info used for default flow registration/unregistration.

Public Members

uint32_t coreKey

Core key

uint32_t chIdx

0-relative channel index

uint32_t startIdx

RX flow base or start index

uint32_t flowIdx

Allocated flow’s index (offset from startIdx)

struct Enet_MacDstFlowInfo
#include <enet_per.h>

Output args for ENET_PER_IOCTL_ATTACH_CORE command.

Public Members

uint32_t coreKey

Core Key

uint32_t startIdx

Rx Flow Base or Start index

uint32_t flowIdx

Allocated flow’s index (offset from startIdx)

uint8_t macAddress[ENET_MAC_ADDR_LEN]

Destination mac address associated with the flow

struct EnetPer_PortLinkCfg
#include <enet_per.h>

Input args for ENET_PER_IOCTL_OPEN_PORT_LINK command.

Public Members

Enet_MacPort macPort

Port number

void *macCfg

MAC port configuration

EnetPhy_Cfg phyCfg

PHY configuration

EnetMacPort_Interface mii

MAC port MII interface

EnetMacPort_LinkCfg linkCfg

Link configuration (speed and duplexity)

struct EnetPer_AttachCoreOutArgs
#include <enet_per.h>

Output args for ENET_PER_IOCTL_ATTACH_CORE command.

Public Members

uint32_t coreKey

Core key

uint32_t rxMtu

Host Port RX MTU

uint32_t txMtu[ENET_PRI_NUM]

TX MTU per priority

struct Enet_ExtPhyLinkUpEventInfo
#include <enet_per.h>

Input args for ENET_PER_IOCTL_HANDLE_EXTPHY_LINKUP_EVENT command.

Public Members

Enet_MacPort macPort

Mac port for which link up event occured

EnetPhy_LinkCfg phyLinkCfg

PHY link info as determined by the externally managed PHY

struct Enet_IoctlRegisterHandlerInArgs
#include <enet_per.h>

ENET_PER_IOCTL_REGISTER_IOCTL_HANDLER inArgs

Public Members

uint32_t cmd

IOCTL cmd

uintptr_t fxn

Address of IOCTL handler function

struct EnetPer_Obj
#include <enet_per.h>

Ethernet Peripheral object.

Public Members

const char *name

Peripheral name

Enet_Type enetType

Peripheral type

uint32_t instId

Peripheral instance id

Enet_Magic magic

Peripheral initialization magic

uint64_t physAddr

Peripheral’s physical address. Used for peripherals that have registers that are not part of any module (i.e. peripherals that have a wrapper subsystem). It can be set to 0 for peripherals that don’t have have additional registers other than those of their modules.

void *virtAddr

Peripheral’s virtual address

uint64_t physAddr2

Peripheral’s second physical address, if needed

void *virtAddr2

Peripheral’s second virtual address, if needed

uint32_t features

Peripheral features

uint32_t errata

Peripheral applicable errata

EnetPer_InitCfg initCfg

Pointer to the EnetPer config initialization function

EnetPer_Open open

Pointer to the EnetPer open function

EnetPer_Rejoin rejoin

Pointer to the EnetPer rejoin function

EnetPer_Ioctl ioctl

Pointer to the EnetPer ioctl function

EnetPer_Poll poll

Pointer to the EnetPer poll function

EnetPer_ConvertTs convertTs

Pointer to the EnetPer timestamp conversion function

EnetPer_PeriodicTick periodicTick

Pointer to the EnetPer periodic tick function

EnetPer_RegisterEventCb registerEventCb

Pointer to the EnetPer register event callback function

EnetPer_UnregisterEventCb unregisterEventCb

Pointer to the EnetPer unregister event callback function

EnetPer_Close close

Pointer to the EnetPer close function

EnetPer_SaveCtxt saveCtxt

Pointer to the EnetPer saveCtxt function

EnetPer_RestoreCtxt restoreCtxt

Pointer to the EnetPer restoreCtxt function

This file contains the type definitions and helper macros for the Enet software queue.

Functions

void EnetQueue_initQ(EnetQ *queue)

Init queue.

Initializes a queue.

Parameters:

queue – Queue pointer

void EnetQueue_copyQ(EnetQ *dstQueue, const EnetQ *srcQueue)

Copy queues.

Copies queues. The copied queue will have the same head/tail pointers and count as the source queue.

Parameters:
  • dstQueue – Destination queue pointer

  • srcQueue – Source queue pointer

void EnetQueue_enq(EnetQ *queue, EnetQ_Node *node)

Enqueue a packet into the queue.

Enqueues a packet into the queue.

Parameters:
  • queue – Queue pointer

  • node – Queue node pointer

void EnetQueue_enqHead(EnetQ *queue, EnetQ_Node *node)

Enqueue a packet at head into the queue.

Enqueues a packet into head of queue.

Parameters:
  • queue – Queue pointer

  • node – Queue node pointer

EnetQ_Node *EnetQueue_deq(EnetQ *queue)

Dequeue a packet from the queue.

Dequeues a packet from the queue. A null pointer is returned if the queue was already empty.

Parameters:

queue – Queue pointer

Returns:

Queue node pointer or NULL if queue was empty

void EnetQueue_append(EnetQ *dstQueue, EnetQ *srcQueue)

Append queue.

Appends a packet queue into another queue. The packets in the source queue are queued to the tail of the destination queue.

Parameters:
  • dstQueue – Destination queue node pointer

  • srcQueue – Source queue pointer

uint32_t EnetQueue_getQCount(EnetQ *queue)

Get queue count.

Gets the number of packets in the queue.

Parameters:

queue – Queue pointer

Returns:

Number of packets in the queue

void EnetQueue_verifyQCount(EnetQ *queue)

Checks queue corruption.

Debug API which verifies the queue memory corruption by checking queue count to actual elements in queue. Asserts if queue count doesn’t match.

Parameters:

queue – Queue pointer

struct EnetQ_Node
#include <enet_queue.h>

A generic node structure for a single link list.

Public Members

struct EnetQ_Node_s *next

Pointer to the next element in the list

struct EnetQ
#include <enet_queue.h>

Generic queue.

Public Members

uint32_t count

The current number of entries in the queue

EnetQ_Node *head

The top of the queue

EnetQ_Node *tail

The end of the queue

uint32_t magic

Magic number used to check queue initialization

This file contains the type definitions and helper macros for the Enet Resource Manager module.

Resource Manager Error Codes

Error codes returned by RM functions.

ENET_RM_TXCHNUM_INVALID

Enet RM invalid TX channel number.

ENET_RM_RXFLOWIDX_INVALID

Enet RM invalid RX flow id.

ENET_RM_INVALIDCORE

Enet RM invalid core.

Defines

ENET_RM_PUBLIC_IOCTL(x)

Helper macro to create IOCTL commands for Enet RM module.

ENET_RM_NUM_IOCTL_PERM_ENTRY_MAX

Maximum number of entries for IOCTL permission.

ENET_RM_NUM_MACADDR_MAX

Maximum number of macaddress to be managed by RM.

ENET_RM_NUM_RXCHAN_MAX

Maximum number of RX channels (i.e. sets of flows).

This is needed only for ICSSG Switch where there are two RX channels (with 8 flows each) for the host port. For all other peripherals, there is a single RX channel and multiple flows.

Enums

enum EnetRm_Ioctls

Enet RM IOCTL commands.

Values:

enumerator ENET_RM_IOCTL_ALLOC_MAC_ADDR

Alloc MAC address.

IOCTL parameters:

enumerator ENET_RM_IOCTL_FREE_MAC_ADDR

Free MAC address.

IOCTL parameters:

enumerator ENET_RM_IOCTL_ALLOC_RX_FLOW

Alloc RX flow.

IOCTL parameters:

enumerator ENET_RM_IOCTL_FREE_RX_FLOW

Free RX flow.

IOCTL parameters:

enumerator ENET_RM_IOCTL_ALLOC_TX_CH_PEERID

Alloc TX channel peer id.

IOCTL parameters:

  • inArgs: uint32_t coreKey

  • outArgs: uint32_t txPSILThreadId

enumerator ENET_RM_IOCTL_FREE_TX_CH_PEERID

Free TX channel peer id.

IOCTL parameters:

enumerator ENET_RM_IOCTL_ALLOC_HW_PUSH_INST

Alloc HW Push instance.

IOCTL parameters:

enumerator ENET_RM_IOCTL_FREE_HW_PUSH_INST

Free HW Push instance.

IOCTL parameters:

enum EnetRm_TxCh

RM tx channel.

This enum holds the number of tx channel.

Values:

enumerator ENET_RM_TX_CH_0

Channel no 0

enumerator ENET_RM_TX_CH_1

Channel no 1

enumerator ENET_RM_TX_CH_2

Channel no 2

enumerator ENET_RM_TX_CH_3

Channel no 3

enumerator ENET_RM_TX_CH_4

Channel no 4

enumerator ENET_RM_TX_CH_5

Channel no 5

enumerator ENET_RM_TX_CH_6

Channel no 6

enumerator ENET_RM_TX_CH_7

Channel no 7

enumerator ENET_RM_TX_CH_LAST

Max number of tx channels available

enumerator ENET_RM_TX_CH_ANY

Default Channel

struct EnetRm_ResourceInfo
#include <enet_rm.h>

Enet RM resource information.

This structure holds the number of TX channels, RX flows and MAC addresses partitioned to the core.

Public Members

uint32_t coreId

Core Id for which resource info is applicable

uint32_t numTxCh

Number of TX channels

EnetRm_TxCh txCh[ENET_CFG_RM_TX_CH_MAX]

Array of TX channels allocated for a given core

uint32_t numRxCh

Number of RX channels

uint32_t numRxFlows

Number of RX Flows. The total number of Rx flows required for the RX channel is the sum of all RX flows alloted to different cores.

The total number of RX flows should be <= maximum number of RX flows supported by the SoC. Refer to the Enet SoC layer implementation to find out the maximum number of flows supported by SoC

uint32_t numMacAddress

Number of MAC addresses

uint32_t numHwPush

Number of Hw Push instances

struct EnetRm_ResPrms
#include <enet_rm.h>

Enet RM resource parameters.

This structure has the information about reserved flow, default flow and Enet RM DMA resource information of all cores.

Public Members

uint32_t numCores

Number of cores

EnetRm_ResourceInfo coreResInfo[ENET_CFG_REMOTE_CLIENT_CORES_MAX]

DMA Resource Information of all cores

bool isStaticTxChanAllocated

Application has allocated absolute tx channels

struct EnetRm_IoctlPermissionEntry
#include <enet_rm.h>

Enet RM IOCTL permission entry.

This structure has the information about IOCTL permissions for each IOCTL command.

Public Members

uint32_t cmd

IOCTL command

uint32_t permittedCoreMask

Cores from which this IOCTL call is allowed. This is a bitmask of allowed coreIds

struct EnetRm_IoctlPermissionTable
#include <enet_rm.h>

Enet RM IOCTL permission table.

This structure has the information about IOCTL permissions for all IOCTL commands.

Public Members

uint32_t defaultPermittedCoreMask

Permitted core mask if IOCTL command not found in explicit permission entry table

uint32_t numEntries

Number of explicit permission entry

EnetRm_IoctlPermissionEntry entry[ENET_RM_NUM_IOCTL_PERM_ENTRY_MAX]

Permission table entries. Must have numEntries valid entries

struct EnetRm_MacAddressPool
#include <enet_rm.h>

Enet RM MAC address pool.

This structure has the pool of MAC addresses that are being managed.

Public Members

uint32_t numMacAddress

Number of MAC addresses

uint8_t macAddress[ENET_RM_NUM_MACADDR_MAX][ENET_MAC_ADDR_LEN]

Array of MAC addresses, not to exceed ENET_RM_NUM_MACADDR_MAX

struct EnetRm_AllocRxFlowInArgs
#include <enet_rm.h>

Input args for ENET_RM_IOCTL_ALLOC_RX_FLOW command.

Public Members

uint32_t coreKey

Core key

uint32_t chIdx

0-relative RX channel index

struct EnetRm_AllocRxFlow
#include <enet_rm.h>

Output args for ENET_RM_IOCTL_ALLOC_RX_FLOW command.

Public Members

uint32_t startIdx

Rx flow base or start index

uint32_t flowIdx

Allocated flow’s index (offset from startIdx)

struct EnetRm_AllocMacAddrOutArgs
#include <enet_rm.h>

Input args for ENET_RM_IOCTL_ALLOC_MAC_ADDR command.

Public Members

uint8_t macAddr[ENET_MAC_ADDR_LEN]

MAC address

struct EnetRm_FreeTxChInArgs
#include <enet_rm.h>

Input args for ENET_RM_IOCTL_FREE_TX_CH_PEERID command.

Public Members

uint32_t coreKey

Core key

uint32_t txChNum

Tx channel PSIL Thread Id

struct EnetRm_FreeRxFlowInArgs
#include <enet_rm.h>

Input args for ENET_RM_IOCTL_FREE_RX_FLOW command.

Public Members

uint32_t coreKey

Core key

uint32_t chIdx

0-relative RX channel index

uint32_t flowIdx

Rx flow index

struct EnetRm_FreeMacAddrInArgs
#include <enet_rm.h>

Input args for ENET_RM_IOCTL_FREE_MAC_ADDR command.

Public Members

uint32_t coreKey

Core key

uint8_t macAddr[ENET_MAC_ADDR_LEN]

MAC address

struct EnetRm_ResCfg
#include <enet_rm.h>

Resource manager configuration parameters.

Resources that will be managed by Enet RM module for partitioning across cores.

Public Members

uint32_t selfCoreId

Self core Id

EnetRm_ResPrms resPartInfo

Resource Partition Information

EnetRm_IoctlPermissionTable ioctlPermissionInfo

IOCTL permission info

EnetRm_MacAddressPool macList

MAC address list to be managed by RM

struct EnetRm_AllocHwPushOutArgs
#include <enet_rm.h>

Output args for ENET_RM_IOCTL_ALLOC_HW_PUSH_INST command.

Public Members

uint32_t hwPushNum

Hardware push instance number

struct EnetRm_FreeHwPushInArgs
#include <enet_rm.h>

Input args for ENET_RM_IOCTL_FREE_HW_PUSH_INST command.

Public Members

uint32_t coreKey

Core key

uint32_t hwPushNum

Hardware push instance number

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

Defines

EnetSoc_assert(cond, ...)

Assertion. Note - We use ‘!(cond) before calling PDK OSAL as PDK OSAL_Assert is opposite of normal C assert. It asserts when condition is true.

Functions

int32_t EnetSoc_init(void)

Initialize SoC layer.

Initializes the Enet SoC layer.

Returns:

Enet_ErrorCodes

void EnetSoc_deinit(void)

Deinitialize SoC layer.

Deinitializes the Enet SoC layer.

EnetDma_Handle EnetSoc_getDmaHandle(Enet_Type enetType, uint32_t instId)

Get handle of the DMA driver for a given Ethernet peripheral.

Gets the handle to the DMA driver corresponding to the Ethernet peripheral identified by its type and instance id.

Parameters:
  • enetType – Enet Peripheral type

  • instId – Instance Id

Returns:

DMA driver handle. NULL if no driver was found.

Enet_Handle EnetSoc_getEnetHandleByIdx(uint32_t idx)

Get handle of the Enet driver by its index.

Gets the handle to the Enet driver by its index. The index definition itself it SoC specific and not meaningful outside SoC internal implementation.

This function is mainly used by the Enet top-layer to iterate over all peripherals supported by the SoC. It’s used along with EnetSoc_getEnetNum() to query the number of available peripherals.

Parameters:

idx – Ethernet peripheral index

Returns:

Eth driver handle. NULL if index is greater than the number of peripherals present in the SoC.

Enet_Handle EnetSoc_getEnetHandle(Enet_Type enetType, uint32_t instId)

Get handle of the Enet driver for a given Ethernet peripheral.

Gets the handle to the Enet driver corresponding to the Ethernet peripheral identified by its type and instance id.

Parameters:
  • enetType – Enet Peripheral type

  • instId – Instance Id

Returns:

Eth driver handle. NULL if no driver was found.

uint32_t EnetSoc_getCoreId(void)

Get core id of caller.

Gets id of the core where this function is called from.

Returns:

Core Id

bool EnetSoc_isCoreAllowed(Enet_Type enetType, uint32_t instId, uint32_t coreId)

Check if core is enable to use an Ethernet peripheral.

Checks if a given core is allowed to use the Ethernet peripheral identified by its type and instance id.

Parameters:
  • enetType – Enet Peripheral type

  • instId – Enet Peripheral instance id

  • coreId – Core id

Returns:

Wheter core is allowed to use the peripheral or not

uint32_t EnetSoc_getEnetNum(void)

Get number of present Ethernet peripherals.

Gets the number of Ethernet peripheral present in this SoC.

Returns:

Number of peripherals

uint32_t EnetSoc_getMacPortMax(Enet_Type enetType, uint32_t instId)

Get number of MAC ports in a peripheral.

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

Parameters:
  • enetType – Enet Peripheral type

  • instId – Enet Peripheral instance id

Returns:

Number of MAC ports

uint32_t EnetSoc_getClkFreq(Enet_Type enetType, uint32_t instId, uint32_t clkId)

Get SoC clock frequency.

Gets the frequency (in Hz) of an SoC clock identified by clkId.

Parameters:
  • enetType – Enet Peripheral type

  • instId – Enet Peripheral instance id

  • clkId – Clock id

Returns:

Clock frequency in Hz

int32_t EnetSoc_setupIntrCfg(Enet_Type enetType, uint32_t instId, uint32_t intrId)

Configure SoC connection of an interrupt.

Perform the “SoC connection” configuration of a peripheral interrupt identified by intrId.

Parameters:
  • enetType – Enet Peripheral type

  • instId – Enet Peripheral instance id

  • intrId – Interrupt id

Returns:

Enet_ErrorCodes

int32_t EnetSoc_releaseIntrCfg(Enet_Type enetType, uint32_t instId, uint32_t intrId)

Release SoC connection of an interrupt.

Releases the “SoC connection” configuration of a peripheral interrupt identified by intrId previuosly done via EnetSoc_setupIntrCfg().

Parameters:
  • enetType – Enet Peripheral type

  • instId – Enet Peripheral instance id

  • intrId – Interrupt id

Returns:

Enet_ErrorCodes

uint32_t EnetSoc_getIntrNum(Enet_Type enetType, uint32_t instId, uint32_t intrId)

Get the interrupt number of a peripheral interrupt signal.

Gets the interrupt number that can be used to register/unregister an ISR which corresponds to a peripheral interrupt signal. The interrupt number could be routed at runtime via configurable interrupt routes, which makes the interrupt number a dynamic parameter from the driver’s perspective.

Parameters:
  • enetType – Enet Peripheral type

  • instId – Enet Peripheral instance id

  • intrId – Interrupt id

Returns:

Interrupt number

uint32_t EnetSoc_getIntrTriggerType(Enet_Type enetType, uint32_t instId, uint32_t intrId)

Get the interrupt trigger type of a peripheral interrupt signal.

Gets the interrupt trigger type that can be used to register/unregister an ISR which corresponds to a peripheral interrupt signal. The interrupt trigger type could be routed at runtime via configurable interrupt routes, which makes the interrupt number a dynamic parameter from the driver’s perspective.

Parameters:
  • enetType – Enet Peripheral type

  • instId – Enet Peripheral instance id

  • intrId – Interrupt id

Returns:

Interrupt trigger type

int32_t EnetSoc_getEFusedMacAddrs(uint8_t macAddr[][ENET_MAC_ADDR_LEN], uint32_t *num)

Get EFused MAC addresses.

Get a list of EFused MAC addresses.

Parameters:
  • macAddr – MAC address array

  • num – Max number of addresses to populate in macAddr array. It’s updated with actual number of addresses filled.

Returns:

Enet_ErrorCodes

uint32_t EnetSoc_getMacPortCaps(Enet_Type enetType, uint32_t instId, Enet_MacPort macPort)

Get MAC port capability mask.

Gets the capability mask of a MAC port.

Parameters:
  • enetType – Enet Peripheral type

  • instId – Enet Peripheral instance id

  • macPort – MAC port number

Returns:

MAC port capability mask

int32_t EnetSoc_getMacPortMii(Enet_Type enetType, uint32_t instId, Enet_MacPort macPort, EnetMacPort_Interface *mii)

Get MAC port MII mode.

Gets the SoC-level MII mode of a given MAC port. The MII mode could be configurable or fixed. If there is no SoC-level MII mode configuration, then return ENET_ENOTSUPPORTED.

Parameters:
  • enetType – Enet Peripheral type

  • instId – Enet Peripheral instance id

  • macPort – MAC port number

  • mii – MII interface

Returns:

ENET_SOK if no errors. ENET_ENOTSUPPORTED if SoC doesn’t provide SoC-levle MII interface configuration. Enet_ErrorCodes in case of any other failure.

uint32_t EnetSoc_isIpSupported(Enet_Type enetType, uint32_t instId)

Validate IP support in SOC.

Validates IP support in given SOC.

Parameters:
  • enetType – Enet Peripheral type

  • instId – Enet Peripheral instance id

Returns:

True if enetType is supported otherwise false.

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

Defines

ENET_CFG_TRACE_LEVEL_NONE

All traces disabled at build-time.

ENET_CFG_TRACE_LEVEL_ERROR

Build-time error level.

ENET_CFG_TRACE_LEVEL_WARN

Build-time warning level.

ENET_CFG_TRACE_LEVEL_INFO

Build-time information level.

ENET_CFG_TRACE_LEVEL_DEBUG

Build-time debug level.

ENET_CFG_TRACE_LEVEL_VERBOSE

Build-time verbose level.

ENET_CFG_TRACE_LEVEL

Default trace level if none is set.

ENET_CFG_TRACE_FORMAT_FUNC

Trace prefix: “<func>: string”.

ENET_CFG_TRACE_FORMAT_FILE

Trace prefix: “<func>: <line>: string”.

ENET_CFG_TRACE_FORMAT_FULL

Trace prefix: “<file>: <line>: <func>: <line>: string”.

ENET_CFG_TRACE_TRACE_FORMAT

Default trace format if none is specified.

Enums

enum EnetTrace_TraceLevel

Enumerates the types of trace level.

Values:

enumerator ENET_TRACE_NONE

All traces are disabled at runtime

enumerator ENET_TRACE_ERROR

Error trace level

enumerator ENET_TRACE_WARN

Warning trace level

enumerator ENET_TRACE_INFO

Info trace level: enables only important informational messages for the user (i.e. PHY link is up or down, NIMU layer is ready, etc).

The amount of info logs is not invasive in nature so this trace level may be enabled by applications at init time.

enumerator ENET_TRACE_DEBUG

Debug trace level: enables further information messages about operations taking place in the driver (i.e. a module is being opened, PHY auto-negotiation is started, etc).

The debug level should be enabled by the user on a need basis (i.e. for debugging or tracing execution flow, etc) as the number of messages will increase considerably with respect to ENET_TRACE_INFO level.

This trace level can be enabled at runtime only in ‘debug’ builds.

enumerator ENET_TRACE_VERBOSE

Verbose trace level: enables even further messages about operations taking place in the driver (i.e. PHY state transitions, DMA transfer completion, etc) that are periodic in nature or simply happen very often during normal execution.

The amount of messages will increase drastically when the verbose level is enabled, so it’s recommended to set it only if really needed.

This trace level can be enabled at runtime only in ‘debug’ builds.

This file contains the basic types using across the Enet driver.

Enet Error Codes

Error codes returned by the Enet driver APIs.

ENET_SOK

Success.

ENET_SINPROGRESS

Operation in progress.

ENET_EFAIL

Generic failure error condition (typically caused by hardware).

ENET_EBADARGS

Bad arguments (i.e. NULL pointer).

ENET_EINVALIDPARAMS

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

ENET_ETIMEOUT

Time out while waiting for a given condition to happen.

ENET_EALLOC

Allocation failure.

ENET_EUNEXPECTED

Unexpected condition occurred (sometimes unrecoverable).

ENET_EBUSY

The resource is currently busy performing an operation.

ENET_EALREADYOPEN

Already open error.

ENET_EPERM

Operation not permitted.

ENET_ENOTSUPPORTED

Operation not supported.

ENET_ENOTFOUND

Resource not found.

ENET_EUNKNOWNIOCTL

Unknown IOCTL.

ENET_EMALFORMEDIOCTL

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

Defines

ENET_ARRAYSIZE(x)

Macro to get the size of an array.

ENET_BIT(n)

Macro to set bit at given bit position.

ENET_GET_BIT(val, n)

Macro to get bit at given bit position.

ENET_IS_BIT_SET(val, n)

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

ENET_NOT_ZERO(val)

Macro to check if value is not zero.

ENET_FEXT(reg, PER_REG_FIELD)

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

ENET_FINS(reg, PER_REG_FIELD, val)

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

ENET_DIV_ROUNDUP(val, div)

Macro to perform round-up division.

ENET_VERSION_NONE

Version field is not supported.

ENET_MAC_ADDR_LEN

MAC address length in bytes/octets.

ENET_OUI_ADDR_LEN

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

ENET_IPv4_ADDR_LEN

IPv4 address length in bytes/octets.

ENET_IPv6_ADDR_LEN

IPv6 address length in bytes/octets.

ENET_PRI_NUM

Packet priority.

ENET_PRI_MIN

Lowest packet priority.

ENET_PRI_MAX

Highest packet priority.

ENET_TOS_PRI_NUM

Type of Service (ToS) priority.

ENET_TOS_PRI_MIN

Lowest ToS priority.

ENET_TOS_PRI_MAX

Highest ToS priority.

ENET_VLAN_ID_MAX

Maximum value for VLAN ID.

ENET_ETHERTYPE_PTP

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

ENET_RX_MTU_MAX

RX MAX MTU.

ENET_ETHERTYPE_CUSTOMER_VLAN

EtherType value for Customer VLAN type (IEEE 802.1Q).

ENET_TYPE_NUM

Number of supported Ethernet peripheral types.

ENET_MAC_PORT_NUM

Number of MAC ports - For internal use only.

ENET_MACPORT_NORM(n)

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(n)

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(n)

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

MAC invalid port number. Used for error checks only.

ENET_TRAFFIC_CLASS_INV

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

ENET_MACPORT_MASK(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.

Typedefs

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

Event callback.

Param evt:

Event being registered for

Param evtNum:

Event number (0 if single event)

Param evtCbArgs:

Callback argument given during registration in Enet_registerEventCb()

Param arg1:

Event specific argument

Param arg2:

Event specific argument

typedef void (*Enet_notifyCallback)(void *pArg)

Enums

enum Enet_Type

Ethernet peripheral type.

Values:

enumerator ENET_NULL

“Null” peripheral - for testing only

enumerator ENET_ICSSG_DUALMAC

ICSSG_MAC: 1 MAC port

enumerator ENET_ICSSG_SWITCH

ICSSG: 1 host port + 2 MAC ports

enumerator ENET_GMAC_3G

GMAC_3G: 1 host port + 2 MAC ports

enumerator ENET_CPSW_2G

CPSW_2G: 1 host port + 1 MAC port

enumerator ENET_CPSW_3G

CPSW_3G: 1 host port + 2 MAC port

enumerator ENET_CPSW_5G

CPSW_5G: 1 host port + 4 MAC ports

enumerator ENET_CPSW_9G

CPSW_9G: 1 host port + 8 MAC ports

enumerator ENET_TYPE_COUNT

Number of Ethernet Peripheral types - For internal use only

enum Enet_Magic

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

Values:

enumerator ENET_MAGIC

Magic number used to identify when driver has been opened.

enumerator ENET_NO_MAGIC

Magic number used to identify when driver is closed.

enum Enet_CrcType

CRC type.

Values:

enumerator ENET_CRC_ETHERNET

Ethernet CRC type

enumerator ENET_CRC_CASTAGNOLI

Castagnoli CRC type

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.

Values:

enumerator ENET_EVT_NONE

No event

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

enumerator ENET_EVT_TIMESTAMP_SWPUSH

Software timestamp push event. Currently not used.

enumerator ENET_EVT_TIMESTAMP_HWPUSH

Hardware timestamp push event. Currently not used.

enumerator ENET_EVT_TIMESTAMP_ROLLOVER

Timestamp half rollover event. Currently not used.

enumerator ENET_EVT_TIMESTAMP_HALFROLLOVER

Timestamp rollover event. Currently not used.

enumerator ENET_EVT_TIMESTAMP_RX

Timestamp receive event. Currently not used.

enumerator 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).

enumerator ENET_EVT_TIMESTAMP_COMP

Timestamp compare event. Currently not used.

enumerator ENET_EVT_TIMESTAMP_HOSTTX

Timestamp host transmit event. Currently not used.

enumerator ENET_EVT_ANY

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

enum Enet_Speed

MAC interface speed.

Values:

enumerator ENET_SPEED_10MBIT

10 Mbps

enumerator ENET_SPEED_100MBIT

100 Mbps

enumerator ENET_SPEED_1GBIT

1 Gbps

enumerator ENET_SPEED_AUTO

Speed determined automatically

enum Enet_Duplexity

MAC interface duplexity.

Values:

enumerator ENET_DUPLEX_HALF

Half duplex

enumerator ENET_DUPLEX_FULL

Full duplex

enumerator ENET_DUPLEX_AUTO

Duplexity determined automatically

enum Enet_VlanTagType

Double tagging VLAN type.

Values:

enumerator ENET_VLAN_TAG_TYPE_INNER

Inner or customer tag

enumerator ENET_VLAN_TAG_TYPE_OUTER

Outer or service tag

enum Enet_MacPort

MAC port.

Values:

enumerator ENET_MAC_PORT_FIRST

First MAC port

enumerator ENET_MAC_PORT_1

MAC port 1

enumerator ENET_MAC_PORT_2

MAC port 2

enumerator ENET_MAC_PORT_3

MAC port 3

enumerator ENET_MAC_PORT_4

MAC port 4

enumerator ENET_MAC_PORT_5

MAC port 5

enumerator ENET_MAC_PORT_6

MAC port 6

enumerator ENET_MAC_PORT_7

MAC port 7

enumerator ENET_MAC_PORT_8

MAC port 8

enumerator ENET_MAC_PORT_LAST

Last MAC port - Used to count the number of ports

Functions

static inline bool Enet_isCpswFamily(Enet_Type enetType)

Check if Ethernet peripheral type is part of CPSW family.

Parameters:

enetType – Ethernet peripheral type

Returns:

true if CPSW family, false otherwise.

static inline bool Enet_isIcssFamily(Enet_Type enetType)

Check if Ethernet peripheral type is part of ICSS family.

Parameters:

enetType – Ethernet peripheral type

Returns:

true if ICSS family, false otherwise.

struct Enet_Version
#include <enet_types.h>

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.

Public Members

uint32_t maj

Major version

uint32_t min

Minor version

uint32_t rtl

RTL version

uint32_t id

Identification

uint32_t other1

Other version value. No specific definition enforced

uint32_t other2

Other version value. No specific definition enforced

struct Enet_VlanTag
#include <enet_types.h>

VLAN tag.

Public Members

uint16_t tpid

Tag protocol identifier (TPID)

uint8_t pcp

Priority code point (PCP)

uint8_t dei

Drop elegible indicator (DEI)

uint16_t vlanId

VLAN id (VID)

Enet_VlanTagType tagType

Whether is an inner or outer VLAN tag

struct Enet_notify_t
#include <enet_types.h>

Public Members

Enet_notifyCallback cbFxn
void *cbArg

This file contains the type definitions and function prototypes of the Enet Utils functionality.

Defines

container_of(ptr, type, member)

Macro to get container structure from one of its members’ addresses.

ENET_UNUSED(x)

Unused variable.

ENET_MK_ONES(c_ebit, c_sbit)

Macro to create a bit mask.

ENET_UTILS_ALIGN(x, y)

Align a value by performing a round-up operation.

ENET_UTILS_IS_ALIGNED(addr, alignSz)

Macro to determine if an address is aligned to a given size.

ENET_UTILS_ARRAY_COPY(dst, src)

Macro to copy arrays. They must be of the same size.

Enet_assert(cond, ...)

Assertion.

Enet_devAssert(cond, ...)

Development-time assertion.

ENET_UTILS_COMPILETIME_ASSERT(cond)

Compile-time assertion.

ENET_NUM_NANOSECS_PER_SEC

Typedefs

typedef void (*Enet_Print)(const char *fmt, ...)

Info/debug print function prototype.

This function is used by the driver to print info/debug messages.

Param fmt:

Formatted string followed by variable arguments

typedef uint64_t (*Enet_VirtToPhys)(const void *virtAddr, void *appData)

Virtual-to-physical address translation callback function.

This function is used by the driver to convert virtual address to physical address.

Param virtAddr:

Virtual address

Param appData:

Callback pointer passed during translation

Return:

Translated physical address

typedef void *(*Enet_PhysToVirt)(uint64_t phyAddr, void *appData)

Physical-to-virtual address translation callback function.

This function is used by the driver to convert physical address to virtual address.

Param phyAddr:

Physical address

Param appData:

Callback pointer passed during translation

Return:

Translated virtual address

Functions

void EnetUtils_init(const EnetUtils_Cfg *cfg)

Initialize utils module.

Utils module initialization function. Should be only called from the Enet top-level module.

Parameters:

cfg – Pointer to the initialization parameters

void EnetUtils_deinit(void)

De-initialize utils module.

void EnetUtils_printf(const char *fmt, ...)

Print function.

Prints the provided formatted string.

Parameters:

fmt – Formatted string followed by variable arguments

void EnetUtils_vprintf(const char *fmt, va_list args)

Print function for va_list.

Prints the provided formatted string.

Parameters:
  • fmt – Formatted string

  • args – Arg list pointing to the arguments in the format string

uint32_t EnetUtils_min(uint32_t num1, uint32_t num2)

Returns minimum of two numbers.

Parameters:
  • num1 – First number

  • num2 – Second number

Returns:

Minimum number

uint32_t EnetUtils_max(uint32_t num1, uint32_t num2)

Returns minimum of two numbers.

Parameters:
  • num1 – First number

  • num2 – Second number

Returns:

Maximum number

void EnetUtils_delayTicks(const uint32_t delayTicks)

Busy loop for a given amount of delay in CPU clock ticks.

Parameters:

delayTicks – Delay time in CPU clock ticks

void EnetUtils_delayNs(const uint32_t delayNs)

Busy loop for a given amount of delay in nano seconds.

Parameters:

delayNs – Delay time in nano seconds

uint64_t EnetUtils_virtToPhys(const void *virtAddr, void *appData)

Convert a virtual address to physical address.

Parameters:
  • virtAddr – Virtual address

  • appData – Auxiliary data

Returns:

Physical address

void *EnetUtils_physToVirt(uint64_t physAddr, void *appData)

Convert a physical address to virtual address.

Parameters:
  • physAddr – Physical address

  • appData – Auxiliary data

Returns:

Virtual address

EnetPhy_Mii EnetUtils_macToPhyMii(const EnetMacPort_Interface *macMii)

Convert MAC port MII to PHY MII types.

Converts MII type definition from EnetMacPort_Interface to EnetPhy_Mii.

Parameters:

macMii – MAC port MII interface type

Returns:

ENETPHY MII interface

static inline void EnetUtils_copyMacAddr(uint8_t *dst, const uint8_t *src)

Copy MAC address.

Copies 6-byte MAC address.

Parameters:
  • dst – Pointer to MAC address memory being copied into

  • src – Pointer to MAC address memory to be copied from

static inline bool EnetUtils_cmpMacAddr(const uint8_t *addr1, const uint8_t *addr2)

Compare two MAC address.

Compares two MAC address to determine if they are equal.

Parameters:
  • addr1 – MAC address being compared

  • addr2 – MAC address being compared

Returns:

true if MAC addresses are same, false otherwise.

static inline void EnetUtils_clearMacAddr(uint8_t *addr)

Clear MAC address.

Clear 6-byte MAC address memory.

Parameters:

addr – Pointer to MAC address memory to be cleared

static inline bool EnetUtils_isMcastAddr(const uint8_t *addr)

Check if address is multicast.

Checks if MAC address is multicast.

Parameters:

addr – MAC address

Returns:

Whether MAC address is multicast or not.

struct EnetUtils_Cfg
#include <enet_utils.h>

Enet utils parameters.

Public Members

Enet_Print print

If not NULL, this function will be called to print debug/info message with appropriate string

Enet_VirtToPhys virtToPhys

If not NULL, this function will be called to translate virtual address to physical address to be provided to the Enet driver. If NULL, the driver will assume a one-one mapping.

Enet_PhysToVirt physToVirt

If not NULL, this function will be called to translate physical address to virtual address to access the pointer returned by the Enet driver. If NULL, the driver will assume a one-one mapping.