Data Structures | |
struct | Enet_IoctlPrms |
Enet IOCTL param. More... | |
struct | Enet_IoctlValidate |
Enet IOCTL expected param sizes. More... | |
struct | Enet_Version |
Version of a peripheral or module. More... | |
struct | Enet_VlanTag |
VLAN tag. More... | |
struct | Enet_notify_t |
Functions | |
static uint32_t | Enet_checkInArgs (const Enet_IoctlPrms *prms, uint32_t inArgsSize) |
Check IOCTL input args for commands that expect an input. More... | |
static uint32_t | Enet_checkNoInArgs (const Enet_IoctlPrms *prms) |
Check IOCTL input args for commands that don't expect an input. More... | |
static uint32_t | Enet_checkOutArgs (const Enet_IoctlPrms *prms, uint32_t outArgsSize) |
Check IOCTL output args for commands that expect an output. More... | |
static uint32_t | Enet_checkNoOutArgs (const Enet_IoctlPrms *prms) |
Check IOCTL output args for commands that don't have output. More... | |
static uint32_t | Enet_checkInOutArgs (const Enet_IoctlPrms *prms, uint32_t inArgsSize, uint32_t outArgsSize) |
Check IOCTL input and output args. More... | |
static bool | Enet_isCpswFamily (Enet_Type enetType) |
Check if Ethernet peripheral type is part of CPSW family. More... | |
static bool | Enet_isIcssFamily (Enet_Type enetType) |
Check if Ethernet peripheral type is part of ICSS family. More... | |
uint32_t | Enet_getCoreId (void) |
EnetTrace_TraceLevel | Enet_setTraceLevel (EnetTrace_TraceLevel level) |
Set global trace level. More... | |
EnetTrace_TraceLevel | Enet_getTraceLevel (void) |
Get current trace level. More... | |
void | Enet_initOsalCfg (EnetOsal_Cfg *osalCfg) |
Initialize OSAL configuration. More... | |
void | Enet_initUtilsCfg (EnetUtils_Cfg *utilsCfg) |
Initialize utils configuration. More... | |
void | Enet_init (const EnetOsal_Cfg *osalCfg, const EnetUtils_Cfg *utilsCfg) |
Initialize Enet LLD. More... | |
void | Enet_deinit (void) |
De-initialize Enet LLD. More... | |
Enet_Handle | Enet_getHandle (Enet_Type enetType, uint32_t instId) |
Get the Enet handle of a peripheral. More... | |
uint32_t | Enet_getMacPortMax (Enet_Type enetType, uint32_t instId) |
Get number of MAC ports available in the Ethernet peripheral. More... | |
void | Enet_initCfg (Enet_Type enetType, uint32_t instId, void *cfg, uint32_t cfgSize) |
Initialize the peripheral configuration parameters. More... | |
Enet_Handle | Enet_open (Enet_Type enetType, uint32_t instId, const void *cfg, uint32_t cfgSize) |
Open and initializes the Enet driver for a peripheral. More... | |
Enet_Handle | Enet_rejoin (Enet_Type enetType, uint32_t instId) |
Rejoin a running Ethernet peripheral. More... | |
EnetDma_Handle | Enet_getDmaHandle (Enet_Handle hEnet) |
Get the handle to the DMA used for packet transmit/receive. More... | |
void | Enet_registerEventCb (Enet_Handle hEnet, Enet_Event evt, uint32_t evtNum, Enet_EventCallback evtCb, void *evtCbArgs) |
Register a callback for an event. More... | |
void | Enet_unregisterEventCb (Enet_Handle hEnet, Enet_Event evt, uint32_t evtNum) |
Unregister callback for an event. More... | |
void | Enet_poll (Enet_Handle hEnet, Enet_Event evt, const void *arg, uint32_t argSize) |
Poll for Ethernet events. More... | |
void | Enet_periodicTick (Enet_Handle hEnet) |
Run periodic tick on the Ethernet peripheral. More... | |
uint32_t | Enet_getMacPortCnt (Enet_Handle hEnet) |
Get number of MAC ports available in the Ethernet peripheral. More... | |
void | Enet_close (Enet_Handle hEnet) |
Close the Enet peripheral. More... | |
int32_t | Enet_saveCtxt (Enet_Handle hEnet) |
Save and closes the context of the Enet peripheral. More... | |
int32_t | Enet_restoreCtxt (Enet_Type enetType, uint32_t instId) |
Restore and open the context of the Enet peripheral. More... | |
int32_t | Enet_hardResetCpsw (Enet_Handle hEnet, Enet_Type enetType, uint32_t instId, Enet_notify_t *pCpswTriggerResetCb) |
Hard reset CPSW peripheral. More... | |
int32_t | Enet_getHandleInfo (Enet_Handle hEnet, Enet_Type *enetType, uint32_t *instId) |
Get enetType and instId info from the enet handle. More... | |
Typedefs | |
typedef void(* | Enet_EventCallback) (Enet_Event evt, uint32_t evtNum, void *evtCbArgs, void *arg1, void *arg2) |
Event callback. More... | |
typedef void(* | Enet_notifyCallback) (void *pArg) |
Macros | |
#define | ENET_IOCTL_TYPE_OFFSET (24U) |
IOCTL type bit offset. More... | |
#define | ENET_IOCTL_PER_OFFSET (16U) |
IOCTL hardware peripheral bit offset. More... | |
#define | ENET_IOCTL_MAJOR_OFFSET (8U) |
IOCTL major number bit offset. More... | |
#define | ENET_IOCTL_MINOR_OFFSET (0U) |
IOCTL minor number bit offset. More... | |
#define | ENET_IOCTL_GET_TYPE(x) ((x) & 0xFF000000U) |
Helper macro to get the IOCTL type (public/private). More... | |
#define | ENET_IOCTL_GET_PER(x) ((x) & 0x00FF0000U) |
Helper macro to get the peripheral type. More... | |
#define | ENET_IOCTL_GET_MAJ(x) ((x) & 0x0000FF00U) |
Helper macro to get the IOCTL major number. More... | |
#define | ENET_IOCTL_GET_MIN(x) ((x) & 0x000000FFU) |
Helper macro to get the IOCTL major number. More... | |
#define | ENET_IOCTL_TYPE(x) ((x) << ENET_IOCTL_TYPE_OFFSET) |
Helper macro to set the IOCTL type. More... | |
#define | ENET_IOCTL_PER(x) ((x) << ENET_IOCTL_PER_OFFSET) |
Helper macro to set the IOCTL type. More... | |
#define | ENET_IOCTL_MAJ(x) ((x) << ENET_IOCTL_MAJOR_OFFSET) |
Helper macro to set the IOCTL major number. More... | |
#define | ENET_IOCTL_MIN(x) ((x) << ENET_IOCTL_MINOR_OFFSET) |
Helper macro to set the IOCTL minor number. More... | |
#define | ENET_IOCTL_SET_NO_ARGS(prms) |
Set null args for an IOCTL command that takes no arguments. More... | |
#define | ENET_IOCTL_SET_IN_ARGS(prms, in) |
Set the input args for an IOCTL command. More... | |
#define | ENET_IOCTL_SET_OUT_ARGS(prms, out) |
Set the output args for an IOCTL command. More... | |
#define | ENET_IOCTL_SET_INOUT_ARGS(prms, in, out) |
Set the input and output args for an IOCTL command. More... | |
#define | ENET_IOCTL_VALID_PRMS(cmdId, inSize, outSize) |
Helper macro used to add an entry in a IOCTL valid information of type Enet_IoctlValidate. More... | |
#define | ENET_IOCTL(hEnet, coreId, ioctlCmd, prms, status) |
Helper macro used to first register IOCTL handler and then invoke the IOCTL. More... | |
#define | ENET_ARRAYSIZE(x) (sizeof(x) / sizeof(x[0])) |
Macro to get the size of an array. More... | |
#define | ENET_BIT(n) (1U << (n)) |
Macro to set bit at given bit position. More... | |
#define | ENET_GET_BIT(val, n) (((val) & ENET_BIT(n)) >> (n)) |
Macro to get bit at given bit position. More... | |
#define | ENET_IS_BIT_SET(val, n) (((val) & ENET_BIT(n)) != 0U) |
Macro to check if bit at given bit position is set. More... | |
#define | ENET_NOT_ZERO(val) ((uint32_t)0U != (uint32_t)(val)) |
Macro to check if value is not zero. More... | |
#define | ENET_FEXT(reg, PER_REG_FIELD) (((reg) & PER_REG_FIELD##_MASK) >> PER_REG_FIELD##_SHIFT) |
Field EXTract macro. We can't use CSL macro as it appends shift/mask with CSL_. More... | |
#define | ENET_FINS(reg, PER_REG_FIELD, val) |
Field INSert macro. We can't use CSL macro as it appends shift/mask with CSL_. More... | |
#define | ENET_DIV_ROUNDUP(val, div) (((val) + (div) - 1) / (div)) |
Macro to perform round-up division. More... | |
#define | ENET_VERSION_NONE (0xFFFFFFFFU) |
Version field is not supported. More... | |
#define | ENET_MAC_ADDR_LEN (6U) |
MAC address length in bytes/octets. More... | |
#define | ENET_OUI_ADDR_LEN (3U) |
Organization Unique Id (OUI) address length in bytes/octets. More... | |
#define | ENET_IPv4_ADDR_LEN (4U) |
IPv4 address length in bytes/octets. More... | |
#define | ENET_IPv6_ADDR_LEN (16U) |
IPv6 address length in bytes/octets. More... | |
#define | ENET_PRI_NUM (8U) |
Packet priority. More... | |
#define | ENET_PRI_MIN (0U) |
Lowest packet priority. More... | |
#define | ENET_PRI_MAX (ENET_PRI_NUM - 1U) |
Highest packet priority. More... | |
#define | ENET_TOS_PRI_NUM (64U) |
Type of Service (ToS) priority. More... | |
#define | ENET_TOS_PRI_MIN (0U) |
Lowest ToS priority. More... | |
#define | ENET_TOS_PRI_MAX (ENET_TOS_PRI_NUM - 1U) |
Highest ToS priority. More... | |
#define | ENET_VLAN_ID_MAX (4095U) |
Maximum value for VLAN ID. More... | |
#define | ENET_ETHERTYPE_PTP (0x88F7U) |
EtherType value for PTP over Ethernet Annex F (IEEE 802.3). More... | |
#define | ENET_RX_MTU_MAX (2016U) |
RX MAX MTU. More... | |
#define | ENET_TYPE_NUM (ENET_TYPE_COUNT + 1U) |
Number of supported Ethernet peripheral types. More... | |
#define | ENET_MAC_PORT_NUM ((uint32_t)ENET_MAC_PORT_LAST + 1U) |
Number of MAC ports - For internal use only. More... | |
#define | ENET_MACPORT_NORM(n) ((n) - ENET_MAC_PORT_FIRST) |
Normalize Enet_MacPort. More... | |
#define | ENET_MACPORT_DENORM(n) ((Enet_MacPort)((n) + ENET_MAC_PORT_FIRST)) |
De-normalize Enet_MacPort. More... | |
#define | ENET_MACPORT_ID(n) ((n) - ENET_MAC_PORT_FIRST + 1U) |
Convert Enet_MacPort to an integer id. More... | |
#define | ENET_MAC_PORT_INV ((Enet_MacPort)0xFFFFU) |
MAC invalid port number. Used for error checks only. More... | |
#define | ENET_TRAFFIC_CLASS_INV ((uint32_t)0xFFFFU) |
TX traffic class invalid value. Used for error checks only. More... | |
#define | ENET_MACPORT_MASK(n) (ENET_BIT(ENET_MACPORT_NORM(n))) |
Convert Enet_MacPort to a bit mask. More... | |
Enet Error Codes | |
Error codes returned by the Enet driver APIs. | |
#define | ENET_SOK (CSL_PASS) |
Success. More... | |
#define | ENET_SINPROGRESS (1) |
Operation in progress. More... | |
#define | ENET_EFAIL (CSL_EFAIL) |
Generic failure error condition (typically caused by hardware). More... | |
#define | ENET_EBADARGS (CSL_EBADARGS) |
Bad arguments (i.e. NULL pointer). More... | |
#define | ENET_EINVALIDPARAMS (CSL_EINVALID_PARAMS) |
Invalid parameters (i.e. value out-of-range). More... | |
#define | ENET_ETIMEOUT (CSL_ETIMEOUT) |
Time out while waiting for a given condition to happen. More... | |
#define | ENET_EALLOC (CSL_EALLOC) |
Allocation failure. More... | |
#define | ENET_EUNEXPECTED (CSL_EALLOC - 1) |
Unexpected condition occurred (sometimes unrecoverable). More... | |
#define | ENET_EBUSY (CSL_EALLOC - 2) |
The resource is currently busy performing an operation. More... | |
#define | ENET_EALREADYOPEN (CSL_EALLOC - 3) |
Already open error. More... | |
#define | ENET_EPERM (CSL_EALLOC - 4) |
Operation not permitted. More... | |
#define | ENET_ENOTSUPPORTED (CSL_EALLOC - 5) |
Operation not supported. More... | |
#define | ENET_ENOTFOUND (CSL_EALLOC - 6) |
Resource not found. More... | |
#define | ENET_EUNKNOWNIOCTL (CSL_EALLOC - 7) |
Unknown IOCTL. More... | |
#define | ENET_EMALFORMEDIOCTL (CSL_EALLOC - 8) |
Malformed IOCTL (args pointer or size not as expected). More... | |
#define ENET_IOCTL_TYPE_OFFSET (24U) |
IOCTL type bit offset.
#define ENET_IOCTL_PER_OFFSET (16U) |
IOCTL hardware peripheral bit offset.
#define ENET_IOCTL_MAJOR_OFFSET (8U) |
IOCTL major number bit offset.
#define ENET_IOCTL_MINOR_OFFSET (0U) |
IOCTL minor number bit offset.
#define ENET_IOCTL_GET_TYPE | ( | x | ) | ((x) & 0xFF000000U) |
Helper macro to get the IOCTL type (public/private).
#define ENET_IOCTL_GET_PER | ( | x | ) | ((x) & 0x00FF0000U) |
Helper macro to get the peripheral type.
#define ENET_IOCTL_GET_MAJ | ( | x | ) | ((x) & 0x0000FF00U) |
Helper macro to get the IOCTL major number.
#define ENET_IOCTL_GET_MIN | ( | x | ) | ((x) & 0x000000FFU) |
Helper macro to get the IOCTL major number.
#define ENET_IOCTL_TYPE | ( | x | ) | ((x) << ENET_IOCTL_TYPE_OFFSET) |
Helper macro to set the IOCTL type.
#define ENET_IOCTL_PER | ( | x | ) | ((x) << ENET_IOCTL_PER_OFFSET) |
Helper macro to set the IOCTL type.
#define ENET_IOCTL_MAJ | ( | x | ) | ((x) << ENET_IOCTL_MAJOR_OFFSET) |
Helper macro to set the IOCTL major number.
#define ENET_IOCTL_MIN | ( | x | ) | ((x) << ENET_IOCTL_MINOR_OFFSET) |
Helper macro to set the IOCTL minor number.
#define ENET_IOCTL_SET_NO_ARGS | ( | prms | ) |
Set null args for an IOCTL command that takes no arguments.
#define ENET_IOCTL_SET_IN_ARGS | ( | prms, | |
in | |||
) |
Set the input args for an IOCTL command.
#define ENET_IOCTL_SET_OUT_ARGS | ( | prms, | |
out | |||
) |
Set the output args for an IOCTL command.
#define ENET_IOCTL_SET_INOUT_ARGS | ( | prms, | |
in, | |||
out | |||
) |
Set the input and output args for an IOCTL command.
#define ENET_IOCTL_VALID_PRMS | ( | cmdId, | |
inSize, | |||
outSize | |||
) |
Helper macro used to add an entry in a IOCTL valid information of type Enet_IoctlValidate.
#define 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:
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 sucessfully. Enet_ErrorCodes in case of any failure. |
#define ENET_SOK (CSL_PASS) |
Success.
#define ENET_SINPROGRESS (1) |
Operation in progress.
#define ENET_EFAIL (CSL_EFAIL) |
Generic failure error condition (typically caused by hardware).
#define ENET_EBADARGS (CSL_EBADARGS) |
Bad arguments (i.e. NULL pointer).
#define ENET_EINVALIDPARAMS (CSL_EINVALID_PARAMS) |
Invalid parameters (i.e. value out-of-range).
#define ENET_ETIMEOUT (CSL_ETIMEOUT) |
Time out while waiting for a given condition to happen.
#define ENET_EALLOC (CSL_EALLOC) |
Allocation failure.
#define ENET_EUNEXPECTED (CSL_EALLOC - 1) |
Unexpected condition occurred (sometimes unrecoverable).
#define ENET_EBUSY (CSL_EALLOC - 2) |
The resource is currently busy performing an operation.
#define ENET_EALREADYOPEN (CSL_EALLOC - 3) |
Already open error.
#define ENET_EPERM (CSL_EALLOC - 4) |
Operation not permitted.
#define ENET_ENOTSUPPORTED (CSL_EALLOC - 5) |
Operation not supported.
#define ENET_ENOTFOUND (CSL_EALLOC - 6) |
Resource not found.
#define ENET_EUNKNOWNIOCTL (CSL_EALLOC - 7) |
Unknown IOCTL.
#define ENET_EMALFORMEDIOCTL (CSL_EALLOC - 8) |
Malformed IOCTL (args pointer or size not as expected).
#define ENET_ARRAYSIZE | ( | x | ) | (sizeof(x) / sizeof(x[0])) |
Macro to get the size of an array.
#define ENET_BIT | ( | n | ) | (1U << (n)) |
Macro to set bit at given bit position.
#define ENET_GET_BIT | ( | val, | |
n | |||
) | (((val) & ENET_BIT(n)) >> (n)) |
Macro to get bit at given bit position.
#define ENET_IS_BIT_SET | ( | val, | |
n | |||
) | (((val) & ENET_BIT(n)) != 0U) |
Macro to check if bit at given bit position is set.
#define ENET_NOT_ZERO | ( | val | ) | ((uint32_t)0U != (uint32_t)(val)) |
Macro to check if value is not zero.
#define ENET_FEXT | ( | reg, | |
PER_REG_FIELD | |||
) | (((reg) & PER_REG_FIELD##_MASK) >> PER_REG_FIELD##_SHIFT) |
Field EXTract macro. We can't use CSL macro as it appends shift/mask with CSL_.
#define ENET_FINS | ( | reg, | |
PER_REG_FIELD, | |||
val | |||
) |
Field INSert macro. We can't use CSL macro as it appends shift/mask with CSL_.
#define ENET_DIV_ROUNDUP | ( | val, | |
div | |||
) | (((val) + (div) - 1) / (div)) |
Macro to perform round-up division.
#define ENET_VERSION_NONE (0xFFFFFFFFU) |
Version field is not supported.
#define ENET_MAC_ADDR_LEN (6U) |
MAC address length in bytes/octets.
#define ENET_OUI_ADDR_LEN (3U) |
Organization Unique Id (OUI) address length in bytes/octets.
#define ENET_IPv4_ADDR_LEN (4U) |
IPv4 address length in bytes/octets.
#define ENET_IPv6_ADDR_LEN (16U) |
IPv6 address length in bytes/octets.
#define ENET_PRI_NUM (8U) |
Packet priority.
#define ENET_PRI_MIN (0U) |
Lowest packet priority.
#define ENET_PRI_MAX (ENET_PRI_NUM - 1U) |
Highest packet priority.
#define ENET_TOS_PRI_NUM (64U) |
Type of Service (ToS) priority.
#define ENET_TOS_PRI_MIN (0U) |
Lowest ToS priority.
#define ENET_TOS_PRI_MAX (ENET_TOS_PRI_NUM - 1U) |
Highest ToS priority.
#define ENET_VLAN_ID_MAX (4095U) |
Maximum value for VLAN ID.
#define ENET_ETHERTYPE_PTP (0x88F7U) |
EtherType value for PTP over Ethernet Annex F (IEEE 802.3).
#define ENET_RX_MTU_MAX (2016U) |
RX MAX MTU.
#define ENET_TYPE_NUM (ENET_TYPE_COUNT + 1U) |
Number of supported Ethernet peripheral types.
#define ENET_MAC_PORT_NUM ((uint32_t)ENET_MAC_PORT_LAST + 1U) |
Number of MAC ports - For internal use only.
#define ENET_MACPORT_NORM | ( | n | ) | ((n) - ENET_MAC_PORT_FIRST) |
Normalize Enet_MacPort.
Macro to normalize Enet_MacPort. It takes an Enet_MacPort enum and converts it to a zero-based index.
#define ENET_MACPORT_DENORM | ( | n | ) | ((Enet_MacPort)((n) + ENET_MAC_PORT_FIRST)) |
De-normalize Enet_MacPort.
Macro to denormalize MAC port number. It takes a zero-based port number and converts it to a Enet_MacPort enum.
#define ENET_MACPORT_ID | ( | n | ) | ((n) - ENET_MAC_PORT_FIRST + 1U) |
Convert Enet_MacPort to an integer id.
Converts Enet_MacPort to an integer id that corresponds to the port number. This macro is expected to be used in prints/traces to let the user know the port number in a way that is consistent with the Enet_MacPort names.
#define ENET_MAC_PORT_INV ((Enet_MacPort)0xFFFFU) |
MAC invalid port number. Used for error checks only.
#define ENET_TRAFFIC_CLASS_INV ((uint32_t)0xFFFFU) |
TX traffic class invalid value. Used for error checks only.
#define ENET_MACPORT_MASK | ( | n | ) | (ENET_BIT(ENET_MACPORT_NORM(n))) |
Convert Enet_MacPort to a bit mask.
Converts a Enet_MacPort to a bit mask to be used in APIs that take a port mask.
typedef void(* Enet_EventCallback) (Enet_Event evt, uint32_t evtNum, void *evtCbArgs, void *arg1, void *arg2) |
Event callback.
evt | Event being registered for |
evtNum | Event number (0 if single event) |
evtCbArgs | Callback argument given during registration in Enet_registerEventCb() |
arg1 | Event specific argument |
arg2 | Event specific argument |
typedef void(* Enet_notifyCallback) (void *pArg) |
enum Enet_IoctlType_e |
enum Enet_IoctlPer_e |
enum Enet_IoctlMajor_e |
IOCTL base number.
enum Enet_Type |
Ethernet peripheral type.
enum Enet_Magic |
enum Enet_CrcType |
enum Enet_Event |
Ethernet events.
Used for any Enet APIs that are event related such as:
Enumerator | |
---|---|
ENET_EVT_NONE | No event |
ENET_EVT_ASYNC_CMD_RESP | Response to an asynchronous command. This event type doesn't require any additional argument in Enet_poll(), caller should pass arg = NULL and argSize = 0. |
ENET_EVT_TIMESTAMP_SWPUSH | Software timestamp push event. Currently not used. |
ENET_EVT_TIMESTAMP_HWPUSH | Hardware timestamp push event. Currently not used. |
ENET_EVT_TIMESTAMP_ROLLOVER | Timestamp half rollover event. Currently not used. |
ENET_EVT_TIMESTAMP_HALFROLLOVER | Timestamp rollover event. Currently not used. |
ENET_EVT_TIMESTAMP_RX | Timestamp receive event. Currently not used. |
ENET_EVT_TIMESTAMP_TX | Timestamp transmit event. For CPSW, the timestamp is returned in clock cycles. For ICSSG, the timestamp is returned in nanoseconds. This event requires the port number be passed to Enet_poll(), caller should pass the port number as arg and argSize = sizeof(Enet_MacPort). |
ENET_EVT_TIMESTAMP_COMP | Timestamp compare event. Currently not used. |
ENET_EVT_TIMESTAMP_HOSTTX | Timestamp host transmit event. Currently not used. |
ENET_EVT_ANY | Any event. It could be used to flush all events when no callback is passed |
enum Enet_Speed |
enum Enet_Duplexity |
enum Enet_VlanTagType |
enum Enet_MacPort |
MAC port.
|
inlinestatic |
Check IOCTL input args for commands that expect an input.
Helper function to check the input arguments passed to an IOCTL for commands that expect an input argument.
prms | IOCTL parameters pointer |
inArgsSize | Expected size of the input argument |
|
inlinestatic |
Check IOCTL input args for commands that don't expect an input.
Helper function to check the input arguments passed to an IOCTL for commands that don't expect an input.
prms | IOCTL parameters pointer |
|
inlinestatic |
Check IOCTL output args for commands that expect an output.
Helper function to check the output arguments passed to an IOCTL for commands that expect an output argument.
prms | IOCTL parameters pointer |
outArgsSize | Expected size of the output argument |
|
inlinestatic |
Check IOCTL output args for commands that don't have output.
Helper function to check the output arguments passed to an IOCTL for commands that don't have an output argument.
prms | IOCTL parameters pointer |
|
inlinestatic |
Check IOCTL input and output args.
Helper function to check the input and output arguments passed to an IOCTL for commands that expect input and output arguments.
prms | IOCTL parameters pointer |
inArgsSize | Expected size of the input argument |
outArgsSize | Expected size of the output argument |
|
inlinestatic |
Check if Ethernet peripheral type is part of CPSW family.
enetType | Ethernet peripheral type |
|
inlinestatic |
Check if Ethernet peripheral type is part of ICSS family.
enetType | Ethernet peripheral type |
uint32_t Enet_getCoreId | ( | void | ) |
Get self core id.
Gets the core id of the calling core. The driver doesn't enforce any specific core id definitions, it's up to the Enet SoC layer to define it.
EnetTrace_TraceLevel Enet_setTraceLevel | ( | EnetTrace_TraceLevel | level | ) |
Set global trace level.
Sets the trace level of the Enet LLD. The driver provides the following trace levels: ERROR, WARN, INFO, DEBUG and VERBOSE.
This function returns the previous trace level, which comes in handy when restoring trace level, if needed.
level | Trace level |
EnetTrace_TraceLevel Enet_getTraceLevel | ( | void | ) |
Get current trace level.
Get the current global trace level of the Enet LLD.
void Enet_initOsalCfg | ( | EnetOsal_Cfg * | osalCfg | ) |
Initialize OSAL configuration.
Initializes the passed OSAL configuration structure with a default implementation which is based on the PDK OSAL library if ENET_CFG_HAS_DEFAULT_OSAL config flag is enabled. Otherwise, the configuration structure will be cleared.
The caller can overwrite any OSAL functions after calling this API.
osalCfg | OSAL configuration parameters |
void Enet_initUtilsCfg | ( | EnetUtils_Cfg * | utilsCfg | ) |
Initialize utils configuration.
Initializes the passed utils configuration structure with a default implementation if ENET_CFG_HAS_DEFAULT_OSAL config flag is enabled. Otherwise, the configuration structure will be cleared. The default utils implementation provides UART-based logging and one-to-one address translation.
The caller can overwrite any utils functions after calling this API.
utilsCfg | Utils configuration parameters |
void Enet_init | ( | const EnetOsal_Cfg * | osalCfg, |
const EnetUtils_Cfg * | utilsCfg | ||
) |
Initialize Enet LLD.
One-time initialization of the Enet LLD driver. This function initializes the OSAL and utils infrastructure that the driver requires for handling multiple peripherals as well as logging and tracing.
The Enet LLD provides a default OSAL implementation which is based on PDK OSAL library if ENET_CFG_HAS_DEFAULT_OSAL config flag is enabled. The default OSAL implementation can be used if the caller passes a NULL osalCfg
.
Similarly, the Enet LLD provides a default utils implementation if ENET_CFG_HAS_DEFAULT_UTILS config flag is set. The default utils implementation can be used if the caller passes a NULL utilsCfg
.
osalCfg | OSAL configuration parameters |
utilsCfg | Utils configuration parameters |
void Enet_deinit | ( | void | ) |
De-initialize Enet LLD.
One-time de-initialization of the Enet LLD driver. This function clears the OSAL and utils config parameters passed during Enet_init().
It's expected to be called once all Ethernet peripherals have been closed via Enet_close().
Enet_Handle Enet_getHandle | ( | Enet_Type | enetType, |
uint32_t | instId | ||
) |
Get the Enet handle of a peripheral.
Gets the driver handle of a peripheral identified by its type and instance id. If the driver hasn't been opened via Enet_open(), this function returns NULL.
enetType | Enet Peripheral type |
instId | Enet Peripheral instance id |
uint32_t Enet_getMacPortMax | ( | Enet_Type | enetType, |
uint32_t | instId | ||
) |
Get number of MAC ports available in the Ethernet peripheral.
Gets the number of MAC ports available in the Ethernet peripheral identified by its type and instance id.
enetType | Enet Peripheral type |
instId | Enet Peripheral instance id |
void Enet_initCfg | ( | Enet_Type | enetType, |
uint32_t | instId, | ||
void * | cfg, | ||
uint32_t | cfgSize | ||
) |
Initialize the peripheral configuration parameters.
Initializes the peripheral configuration parameters with default values.
Configuration parameters are peripheral specific, so the Enet LLD doesn't enforce any definition. Instead, the application should use the configuration structure corresponding to the peripheral(s) available in the platform.
enetType | Enet Peripheral type |
instId | Enet Peripheral instance id |
cfg | Configuration parameters to be initialized |
cfgSize | Size of the configuration parameters |
Enet_Handle Enet_open | ( | Enet_Type | enetType, |
uint32_t | instId, | ||
const void * | cfg, | ||
uint32_t | cfgSize | ||
) |
Open and initializes the Enet driver for a peripheral.
Opens and initializes the Ethernet peripheral with the configuration parameters provided by the caller. The peripheral is identified by its type and instance id.
Configuration parameters are peripheral specific, so the Enet LLD doesn't enforce any definition. Instead, the application should use the configuration structure corresponding to the peripheral(s) available in the platform.
enetType | Enet Peripheral type |
instId | Enet Peripheral instance id |
cfg | Configuration parameters |
cfgSize | Size of the configuration parameters |
Enet_Handle Enet_rejoin | ( | Enet_Type | enetType, |
uint32_t | instId | ||
) |
Rejoin a running Ethernet peripheral.
Reopens the Enet Peripheral, but doesn't perform any hardware initialization. This function is expected to be called to rejoin to a running peripheral. The peripheral is identified by its type and instance id.
enetType | Enet Peripheral type |
instId | Enet Peripheral instance id |
EnetDma_Handle Enet_getDmaHandle | ( | Enet_Handle | hEnet | ) |
Get the handle to the DMA used for packet transmit/receive.
Gets the handle to the DMA which will later be used as arguments to other DMA related APIs, such as EnetDma_openRxCh() or EnetDma_openTxCh(). Enet_getDmaHandle() is required for peripherals where DMA is opened internally, such as J721E. Enet_getDmaHandle() is not required in peripherals where DMA is opened separately, such as AM273X.
hEnet | Enet driver handle |
void Enet_registerEventCb | ( | Enet_Handle | hEnet, |
Enet_Event | evt, | ||
uint32_t | evtNum, | ||
Enet_EventCallback | evtCb, | ||
void * | evtCbArgs | ||
) |
Register a callback for an event.
Registers a callback for an event. The callback with be called either via Enet_poll() when interrupts are disabled or internally by the driver when servicing an interrupt in ISR context.
hEnet | Enet driver handle |
evt | Event being registered for |
evtNum | Event number. Use 0 for single event. |
evtCb | Callback function |
evtCbArgs | Callback function arguments |
void Enet_unregisterEventCb | ( | Enet_Handle | hEnet, |
Enet_Event | evt, | ||
uint32_t | evtNum | ||
) |
Unregister callback for an event.
Unregisters a callback for an event.
hEnet | Enet driver handle |
evt | Event being registered for |
evtNum | Event number. Use 0 for single event. |
void Enet_poll | ( | Enet_Handle | hEnet, |
Enet_Event | evt, | ||
const void * | arg, | ||
uint32_t | argSize | ||
) |
Poll for Ethernet events.
Unblocking poll for the events specified in evtMask
. The event mask can be constructed using the types defined in Enet_Event. The callback function must be registered via Enet_registerEventCb() prior to calling Enet_poll().
Note that not all peripherals support poll mechanism.
hEnet | Enet driver handle |
evt | Event type |
arg | Pointer to the poll argument. This is specific to the poll event type. Refer to Enet_Event for required argument types |
argSize | Size of arg . This is used to validate the argument type |
void Enet_periodicTick | ( | Enet_Handle | hEnet | ) |
Run periodic tick on the Ethernet peripheral.
Run PHY periodic tick on the Ethernet peripheral.
hEnet | Enet driver handle |
uint32_t Enet_getMacPortCnt | ( | Enet_Handle | hEnet | ) |
Get number of MAC ports available in the Ethernet peripheral.
Gets the number of MAC ports available in the Ethernet peripheral. This function is similar to Enet_getMacPortMax() except that it takes an Enet handle.
hEnet | Enet driver handle |
void Enet_close | ( | Enet_Handle | hEnet | ) |
Close the Enet peripheral.
Closes the Ethernet Peripheral.
hEnet | Enet driver handle |
int32_t Enet_saveCtxt | ( | Enet_Handle | hEnet | ) |
Save and closes the context of the Enet peripheral.
Save the Ethernet Peripheral.
hEnet | Enet driver handle |
int32_t Enet_restoreCtxt | ( | Enet_Type | enetType, |
uint32_t | instId | ||
) |
Restore and open the context of the Enet peripheral.
Restore the Ethernet Peripheral.
enetType | Enet Peripheral type |
instId | Enet Peripheral instance id |
int32_t Enet_hardResetCpsw | ( | Enet_Handle | hEnet, |
Enet_Type | enetType, | ||
uint32_t | instId, | ||
Enet_notify_t * | pCpswTriggerResetCb | ||
) |
Hard reset CPSW peripheral.
Restore the Ethernet Peripheral.
hEnet | Enet Handle |
enetType | Enet Peripheral type |
instId | Enet Peripheral instance id |
pCpswTriggerResetCb | CPSW Reset SOC specific callback function |
int32_t Enet_getHandleInfo | ( | Enet_Handle | hEnet, |
Enet_Type * | enetType, | ||
uint32_t * | instId | ||
) |
Get enetType and instId info from the enet handle.
Returns the enetType and instance id associated with Enet_Handle.
hEnet | Enet driver handle |
enetType | Pointer to enetType set by this function |
instId | Instance Id |