PDK API Guide for J721E
enet_soc.h File Reference

Introduction

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

Go to the source code of this file.

Macros

#define EnetSoc_assert(cond, ...)   (void)(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. More...
 

Functions

int32_t EnetSoc_init (void)
 Initialize SoC layer. More...
 
void EnetSoc_deinit (void)
 Deinitialize SoC layer. More...
 
EnetDma_Handle EnetSoc_getDmaHandle (Enet_Type enetType, uint32_t instId)
 Get handle of the DMA driver for a given Ethernet peripheral. More...
 
Enet_Handle EnetSoc_getEnetHandleByIdx (uint32_t idx)
 Get handle of the Enet driver by its index. More...
 
Enet_Handle EnetSoc_getEnetHandle (Enet_Type enetType, uint32_t instId)
 Get handle of the Enet driver for a given Ethernet peripheral. More...
 
uint32_t EnetSoc_getCoreId (void)
 Get core id of caller. More...
 
uint32_t EnetSoc_getCoreKey (uint32_t coreId)
 Get core key for the given core id. More...
 
bool EnetSoc_isCoreAllowed (Enet_Type enetType, uint32_t instId, uint32_t coreId)
 Check if core is enable to use an Ethernet peripheral. More...
 
uint32_t EnetSoc_getEnetNum (void)
 Get number of present Ethernet peripherals. More...
 
uint32_t EnetSoc_getMacPortMax (Enet_Type enetType, uint32_t instId)
 Get number of MAC ports in a peripheral. More...
 
uint32_t EnetSoc_getClkFreq (Enet_Type enetType, uint32_t instId, uint32_t clkId)
 Get SoC clock frequency. More...
 
int32_t EnetSoc_setupIntrCfg (Enet_Type enetType, uint32_t instId, uint32_t intrId)
 Configure SoC connection of an interrupt. More...
 
int32_t EnetSoc_releaseIntrCfg (Enet_Type enetType, uint32_t instId, uint32_t intrId)
 Release SoC connection of an interrupt. More...
 
uint32_t EnetSoc_getIntrNum (Enet_Type enetType, uint32_t instId, uint32_t intrId)
 Get the interrupt number of a peripheral interrupt signal. More...
 
uint32_t EnetSoc_getIntrTriggerType (Enet_Type enetType, uint32_t instId, uint32_t intrId)
 Get the interrupt trigger type of a peripheral interrupt signal. More...
 
int32_t EnetSoc_getEFusedMacAddrs (uint8_t macAddr[][ENET_MAC_ADDR_LEN], uint32_t *num)
 Get EFused MAC addresses. More...
 
uint32_t EnetSoc_getMacPortCaps (Enet_Type enetType, uint32_t instId, Enet_MacPort macPort)
 Get MAC port capability mask. More...
 
int32_t EnetSoc_getMacPortMii (Enet_Type enetType, uint32_t instId, Enet_MacPort macPort, EnetMacPort_Interface *mii)
 Get MAC port MII mode. More...
 
uint32_t EnetSoc_isIpSupported (Enet_Type enetType, uint32_t instId)
 Validate IP support in SOC. More...
 

Macro Definition Documentation

◆ EnetSoc_assert

#define EnetSoc_assert (   cond,
  ... 
)    (void)(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.

Function Documentation

◆ EnetSoc_init()

int32_t EnetSoc_init ( void  )

Initialize SoC layer.

Initializes the Enet SoC layer.

Returns
Enet_ErrorCodes

◆ EnetSoc_deinit()

void EnetSoc_deinit ( void  )

Deinitialize SoC layer.

Deinitializes the Enet SoC layer.

◆ EnetSoc_getDmaHandle()

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
enetTypeEnet Peripheral type
instIdInstance Id
Returns
DMA driver handle. NULL if no driver was found.

◆ EnetSoc_getEnetHandleByIdx()

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
idxEthernet peripheral index
Returns
Eth driver handle. NULL if index is greater than the number of peripherals present in the SoC.

◆ EnetSoc_getEnetHandle()

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
enetTypeEnet Peripheral type
instIdInstance Id
Returns
Eth driver handle. NULL if no driver was found.

◆ EnetSoc_getCoreId()

uint32_t EnetSoc_getCoreId ( void  )

Get core id of caller.

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

Returns
Core Id

◆ EnetSoc_getCoreKey()

uint32_t EnetSoc_getCoreKey ( uint32_t  coreId)

Get core key for the given core id.

Gets the core key corresponding to the passed core id.

Parameters
coreIdCore id
Returns
Core key

◆ EnetSoc_isCoreAllowed()

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
enetTypeEnet Peripheral type
instIdEnet Peripheral instance id
coreIdCore id
Returns
Wheter core is allowed to use the peripheral or not

◆ EnetSoc_getEnetNum()

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

◆ EnetSoc_getMacPortMax()

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
enetTypeEnet Peripheral type
instIdEnet Peripheral instance id
Returns
Number of MAC ports

◆ EnetSoc_getClkFreq()

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
enetTypeEnet Peripheral type
instIdEnet Peripheral instance id
clkIdClock id
Returns
Clock frequency in Hz

◆ EnetSoc_setupIntrCfg()

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
enetTypeEnet Peripheral type
instIdEnet Peripheral instance id
intrIdInterrupt id
Returns
Enet_ErrorCodes

◆ EnetSoc_releaseIntrCfg()

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
enetTypeEnet Peripheral type
instIdEnet Peripheral instance id
intrIdInterrupt id
Returns
Enet_ErrorCodes

◆ EnetSoc_getIntrNum()

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
enetTypeEnet Peripheral type
instIdEnet Peripheral instance id
intrIdInterrupt id
Returns
Interrupt number

◆ EnetSoc_getIntrTriggerType()

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
enetTypeEnet Peripheral type
instIdEnet Peripheral instance id
intrIdInterrupt id
Returns
Interrupt trigger type

◆ EnetSoc_getEFusedMacAddrs()

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
macAddrMAC address array
numMax number of addresses to populate in macAddr array. It's updated with actual number of addresses filled.
Returns
Enet_ErrorCodes

◆ EnetSoc_getMacPortCaps()

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
enetTypeEnet Peripheral type
instIdEnet Peripheral instance id
macPortMAC port number
Returns
MAC port capability mask

◆ EnetSoc_getMacPortMii()

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
enetTypeEnet Peripheral type
instIdEnet Peripheral instance id
macPortMAC port number
miiMII 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.

◆ EnetSoc_isIpSupported()

uint32_t EnetSoc_isIpSupported ( Enet_Type  enetType,
uint32_t  instId 
)

Validate IP support in SOC.

Validates IP support in given SOC.

Parameters
enetTypeEnet Peripheral type
instIdEnet Peripheral instance id
Returns
True if enetType is supported otherwise false.