AM64x MCU+ SDK  08.02.00
enet_types.h File Reference

Introduction

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

Go to the source code of this file.

Data Structures

struct  Enet_Version
 Version of a peripheral or module. More...
 
struct  Enet_VlanTag
 VLAN tag. More...
 

Macros

#define ENET_ARRAYSIZE(x)   (sizeof(x) / sizeof(x[0]))
 Macro to get the size of an array. More...
 
#define ENET_BIT(n)   (1U << (n))
 Macro to set bit at given bit position. More...
 
#define ENET_GET_BIT(val, n)   (((val) & ENET_BIT(n)) >> (n))
 Macro to get bit at given bit position. More...
 
#define ENET_IS_BIT_SET(val, n)   (((val) & ENET_BIT(n)) != 0U)
 Macro to check if bit at given bit position is set. More...
 
#define ENET_NOT_ZERO(val)   ((uint32_t)0U != (uint32_t)(val))
 Macro to check if value is not zero. More...
 
#define ENET_FEXT(reg, PER_REG_FIELD)    (((reg) & PER_REG_FIELD##_MASK) >> PER_REG_FIELD##_SHIFT)
 Field EXTract macro. We can't use CSL macro as it appends shift/mask with CSL_. More...
 
#define ENET_FINS(reg, PER_REG_FIELD, val)
 Field INSert macro. We can't use CSL macro as it appends shift/mask with CSL_. More...
 
#define ENET_DIV_ROUNDUP(val, div)   (((val) + (div) - 1) / (div))
 Macro to perform round-up division. More...
 
#define ENET_VERSION_NONE   (0xFFFFFFFFU)
 Version field is not supported. More...
 
#define ENET_MAC_ADDR_LEN   (6U)
 MAC address length in bytes/octets. More...
 
#define ENET_OUI_ADDR_LEN   (3U)
 Organization Unique Id (OUI) address length in bytes/octets. More...
 
#define ENET_IPv4_ADDR_LEN   (4U)
 IPv4 address length in bytes/octets. More...
 
#define ENET_IPv6_ADDR_LEN   (16U)
 IPv6 address length in bytes/octets. More...
 
#define ENET_PRI_NUM   (8U)
 Packet priority. More...
 
#define ENET_PRI_MIN   (0U)
 Lowest packet priority. More...
 
#define ENET_PRI_MAX   (ENET_PRI_NUM - 1U)
 Lowest packet priority. More...
 
#define ENET_TOS_PRI_NUM   (64U)
 Type of Service (ToS) priority. More...
 
#define ENET_TOS_PRI_MIN   (0U)
 Lowest ToS priority. More...
 
#define ENET_TOS_PRI_MAX   (ENET_TOS_PRI_NUM - 1U)
 Highest ToS priority. More...
 
#define ENET_VLAN_ID_MAX   (4095U)
 Maximum value for VLAN ID. More...
 
#define ENET_ETHERTYPE_PTP   (0x88F7U)
 EtherType value for PTP over Ethernet Annex F (IEEE 802.3). More...
 
#define ENET_TYPE_NUM   (ENET_TYPE_COUNT + 1U)
 Number of supported Ethernet peripheral types. More...
 
#define ENET_MAC_PORT_NUM   ((uint32_t)ENET_MAC_PORT_LAST + 1U)
 Number of MAC ports - For internal use only. More...
 
#define ENET_MACPORT_NORM(n)   ((n) - ENET_MAC_PORT_FIRST)
 Normalize Enet_MacPort. More...
 
#define ENET_MACPORT_DENORM(n)   ((Enet_MacPort)((n) + ENET_MAC_PORT_FIRST))
 De-normalize Enet_MacPort. More...
 
#define ENET_MACPORT_ID(n)   ((n) - ENET_MAC_PORT_FIRST + 1U)
 Convert Enet_MacPort to an integer id. More...
 
#define ENET_MAC_PORT_INV   ((Enet_MacPort)0xFFFFU)
 MAC invalid port number. Used for error checks only. More...
 
#define ENET_TRAFFIC_CLASS_INV   ((uint32_t)0xFFFFU)
 TX traffic class invalid value. Used for error checks only. More...
 
#define ENET_MACPORT_MASK(n)   (ENET_BIT(ENET_MACPORT_NORM(n)))
 Convert Enet_MacPort to a bit mask. More...
 
Enet Error Codes

Error codes returned by the Enet driver APIs.

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

Typedefs

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

Enumerations

enum  Enet_Type {
  ENET_NULL, ENET_ICSSG_DUALMAC, ENET_ICSSG_SWITCH, ENET_GMAC_3G,
  ENET_CPSW_2G, ENET_CPSW_3G, ENET_CPSW_5G, ENET_CPSW_9G,
  ENET_TYPE_COUNT
}
 Ethernet peripheral type. More...
 
enum  Enet_Magic { ENET_MAGIC = 0xABABABABU, ENET_NO_MAGIC = 0x0U }
 Enet driver magic value, used to indicate if driver is open or not. More...
 
enum  Enet_CrcType { ENET_CRC_ETHERNET = 0U, ENET_CRC_CASTAGNOLI }
 CRC type. More...
 
enum  Enet_Event {
  ENET_EVT_NONE = 0U, ENET_EVT_ASYNC_CMD_RESP = ENET_BIT(0U), ENET_EVT_TIMESTAMP_SWPUSH = ENET_BIT(1U), ENET_EVT_TIMESTAMP_HWPUSH = ENET_BIT(2U),
  ENET_EVT_TIMESTAMP_ROLLOVER = ENET_BIT(3U), ENET_EVT_TIMESTAMP_HALFROLLOVER = ENET_BIT(4U), ENET_EVT_TIMESTAMP_RX = ENET_BIT(5U), ENET_EVT_TIMESTAMP_TX = ENET_BIT(6U),
  ENET_EVT_TIMESTAMP_COMP = ENET_BIT(7U), ENET_EVT_TIMESTAMP_HOSTTX = ENET_BIT(8U), ENET_EVT_ANY = 0xFFFFFFFFU
}
 Ethernet events. More...
 
enum  Enet_Speed { ENET_SPEED_10MBIT = 0U, ENET_SPEED_100MBIT, ENET_SPEED_1GBIT, ENET_SPEED_AUTO }
 MAC interface speed. More...
 
enum  Enet_Duplexity { ENET_DUPLEX_HALF = 0U, ENET_DUPLEX_FULL, ENET_DUPLEX_AUTO }
 MAC interface duplexity. More...
 
enum  Enet_VlanTagType { ENET_VLAN_TAG_TYPE_INNER = 0U, ENET_VLAN_TAG_TYPE_OUTER }
 Double tagging VLAN type. More...
 
enum  Enet_MacPort {
  ENET_MAC_PORT_FIRST = 0U, ENET_MAC_PORT_1 = ENET_MAC_PORT_FIRST, ENET_MAC_PORT_2 = 1U, ENET_MAC_PORT_3 = 2U,
  ENET_MAC_PORT_4 = 3U, ENET_MAC_PORT_5 = 4U, ENET_MAC_PORT_6 = 5U, ENET_MAC_PORT_7 = 6U,
  ENET_MAC_PORT_8 = 7U, ENET_MAC_PORT_LAST = ENET_MAC_PORT_8
}
 MAC port. More...
 

Functions

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