Ethernet Module

The Ethernet API provides a set of functions for configuring and using the Ethernet MAC module. Functions are provided to setup and configure the module to transmit and receive Ethernet frames. It also provides API to configure the Management Data Input Output (MDIO) module of the Ethernet.APIs are provided for reading from and writing to the External PHY registers.

Sample callback functions for Packet Transmit completion, Packet Receive completion and a simple Packet buffer handling mechanism has been provided.The default implementations for the callback functions can be modified as per application needs. The file also provides sample Ethernet Interrupt handler routines which can be modified as per application needs.

group ethernet_api

Defines

ETHERNET_MTL_TXQ0_OPERATION_MODE_TSF_S 1U
ETHERNET_MAC_CONFIGURATION_DM_S 13U
ETHERNET_MAC_CONFIGURATION_LM_S 12U
ETHERNET_MAC_PACKET_FILTER_PCF_FILTER_ALL_CTRL 0U
ETHERNET_MAC_PACKET_FILTER_PCF_FWD_ALL_EXCEPTPASS 1U
ETHERNET_MAC_PACKET_FILTER_PCF_FWD_ALL_WITHOUT_ADDRESS_FILTER 2U
ETHERNET_MAC_PACKET_FILTER_PCF_FWD_ALL_WITH_ADDRESS_FILTER 3U
ETHERNET_MAC_CONFIGURATION_DM_FULL_DUPLEX 1U
ETHERNET_MAC_CONFIGURATION_DM_HALF_DUPLEX 0U
ETHERNET_MAC_CONFIGURATION_LM_LOOPBACK_ENABLED 1U
ETHERNET_MAC_CONFIGURATION_LM_LOOPBACK_DISABLED 0U
ETHERNET_MAC_RXQ_CONTROL_RXQEN_ENABLED_GENERIC 2U
ETHERNET_MAC_WATCHDOG_TIMEOUT_WTO_2KB 0U
ETHERNET_MAC_WATCHDOG_TIMEOUT_WTO_3KB 1U
ETHERNET_MAC_WATCHDOG_TIMEOUT_WTO_4KB 2U
ETHERNET_MAC_WATCHDOG_TIMEOUT_WTO_5KB 3U
ETHERNET_MAC_WATCHDOG_TIMEOUT_WTO_6KB 4U
ETHERNET_MAC_WATCHDOG_TIMEOUT_WTO_7KB 5U
ETHERNET_MAC_WATCHDOG_TIMEOUT_WTO_8KB 6U
ETHERNET_MAC_WATCHDOG_TIMEOUT_WTO_9KB 7U
ETHERNET_MAC_WATCHDOG_TIMEOUT_WTO_10KB 8U
ETHERNET_MAC_WATCHDOG_TIMEOUT_WTO_11KB 9U
ETHERNET_MAC_WATCHDOG_TIMEOUT_WTO_12KB 10U
ETHERNET_MAC_WATCHDOG_TIMEOUT_WTO_13KB 11U
ETHERNET_MAC_WATCHDOG_TIMEOUT_WTO_14KB 12U
ETHERNET_MAC_WATCHDOG_TIMEOUT_WTO_15KB 13U
ETHERNET_MAC_WATCHDOG_TIMEOUT_WTO_15383 14U
ETHERNET_MTL_TXQ0_OPERATION_MODE_TTC_32 0U
ETHERNET_MTL_TXQ0_OPERATION_MODE_TTC_64 1U
ETHERNET_MTL_TXQ0_OPERATION_MODE_TTC_96 2U
ETHERNET_MTL_TXQ0_OPERATION_MODE_TTC_128 3U
ETHERNET_MTL_TXQ0_OPERATION_MODE_TTC_192 4U
ETHERNET_MTL_TXQ0_OPERATION_MODE_TTC_256 5U
ETHERNET_MTL_TXQ0_OPERATION_MODE_TTC_384 6U
ETHERNET_MTL_TXQ0_OPERATION_MODE_TTC_512 7U
ETHERNET_MTL_TXQ0_OPERATION_MODE_TXQ_DISABLED 0U
ETHERNET_MTL_TXQ0_OPERATION_MODE_TXQ_ENABLED 2U
ETHERNET_DMA_OPERATION_MODE_PR_TX1_RX1 0U
ETHERNET_DMA_OPERATION_MODE_PR_TX2_RX1 1U
ETHERNET_DMA_OPERATION_MODE_PR_TX3_RX1 2U
ETHERNET_DMA_OPERATION_MODE_PR_TX4_RX1 3U
ETHERNET_DMA_OPERATION_MODE_PR_TX5_RX1 4U
ETHERNET_DMA_OPERATION_MODE_PR_TX6_RX1 5U
ETHERNET_DMA_OPERATION_MODE_PR_TX7_RX1 6U
ETHERNET_DMA_OPERATION_MODE_PR_TX8_RX1 7U
ETHERNET_MTL_RXQ0_OPERATION_MODE_TXQ_DISABLED 0U
ETHERNET_MTL_RXQ0_OPERATION_MODE_TXQ_ENABLED 2U
ETHERNET_DMA_OPERATION_MODE_DA_ROUND_ROBIN 0U
ETHERNET_DMA_OPERATION_MODE_DA_FIXED_PRIORITY 1U
ETHERNET_MTL_OPERATON_MODE_SCHALG_WRR 0U
ETHERNET_MTL_OPERATON_MODE_SCHALG_WFQ 1U
ETHERNET_MTL_OPERATON_MODE_SCHALG_DWRR 2U
ETHERNET_MTL_OPERATON_MODE_SCHALG_STRICT_PRIORITY 3U
ETHERNET_MTL_OPERATION_MODE_RAA_SP 0U
ETHERNET_MTL_OPERATION_MODE_RAA_WSP 1U
ETHERNET_MTL_OPERATION_MODE_RAA_S 2U
ETHERNET_MTL_Q_OP_MODE_QSIZE_256 0U
ETHERNET_MTL_Q_OP_MODE_QSIZE_512 1U
ETHERNET_MTL_Q_OP_MODE_QSIZE_768 2U
ETHERNET_MTL_Q_OP_MODE_QSIZE_1024 3U
ETHERNET_MTL_Q_OP_MODE_QSIZE_1280 4U
ETHERNET_MTL_Q_OP_MODE_QSIZE_1536 5U
ETHERNET_MTL_Q_OP_MODE_QSIZE_1792 6U
ETHERNET_MTL_Q_OP_MODE_QSIZE_2048 7U
ETHERNET_MTL_Q_OP_MODE_QSIZE_4096 15U
ETHERNET_MTL_TXQ_OPMODE_TSF_ENABLE 1U
ETHERNET_MTL_TXQ_OPMODE_TSF_DISABLE 0U
ETHERNET_MTL_RX_Q_OP_MODE_RSF_ENABLE 1U
ETHERNET_MTL_RX_Q_OP_MODE_RSF_DISABLE 0U
ETHERNET_MTL_RXQ0_OPERATION_MODE_RTC_64 0U
ETHERNET_MTL_RXQ0_OPERATION_MODE_RTC_32 1U
ETHERNET_MTL_RXQ0_OPERATION_MODE_RTC_96 2U
ETHERNET_MTL_RXQ0_OPERATION_MODE_RTC_128 3U
ETHERNET_MTL_RXQ0_OPERATION_MODE_RSF_S 5U
ETHERNET_DMA_CHX_RX_CONTROL_RBSZ_16 4U
ETHERNET_DMA_CHX_RX_CONTROL_RBSZ_32 8U
ETHERNET_DMA_CHX_RX_CONTROL_RBSZ_64 16U
ETHERNET_DMA_CHX_RX_CONTROL_RBSZ_128 32U
ETHERNET_DMA_CHX_RX_CONTROL_RBSZ_256 64U
ETHERNET_DMA_CHX_RX_CONTROL_RBSZ_512 128U
ETHERNET_DMA_CHX_RX_CONTROL_RBSZ_1K 256U
ETHERNET_DMA_CHX_RX_CONTROL_RBSZ_2K 512U
ETHERNET_MAC_SUBNANOSECONDS_INC_MULTIPLIER 0x100U
ETHERNET_MAC_DIGITAL_ROLLOVER_ACCURACY 1U
ETHERNET_MAC_BINARY_ROLLOVER_ACCURACY 0.465F
ETHERNET_MAC_PPS_TARGET_TIME_SECONDS 0x0B80U
ETHERNET_MAC_PPS_TARGET_TIME_NANOSECONDS 0x0B84U
ETHERNET_MAC_PPS_WIDTH 0x0B8CU
ETHERNET_MAC_PPS_INTERVAL 0x0B88U
ETHERNET_MAC_PPS_TARGET_TIME_NANOSECONDS_TRGTBUSY 0x80000000U
ETHERNET_MAC_PPS_OUT_INSTANCE_0 0x0U
ETHERNET_MAC_PPS_OUT_INSTANCE_1 0x1U
ETHERNET_MAC_AUX_TIMESTAMP_FIFO_DEPTH 0x4U
ETHERNET_SS_PTPTSTRIGSEL_AUX_TRIG_SEL0 0x1U
ETHERNET_SS_PTPTSTRIGSEL_AUX_TRIG_SEL1 0x2U
ETHERNET_SS_PTPTSSWTRIG_PTP_AUX_TS_SW_TRIG0 0x1U
ETHERNET_SS_PTPTSSWTRIG_PTP_AUX_TS_SW_TRIG1 0x2U
ETHERNET_SS_PTPTSTRIGSEL_AUX_TRIG_SEL_MAX_VALUE 0x1FU
ETHERNET_MAC_PPS_CONTROL_PPSEN0 4U
ETHERNET_MAC_PPS_CONTROL_TRGTMODSEL0_S 5U
ETHERNET_MAC_PPS_CONTROL_TRGTMODSEL0_M 3U
ETHERNET_MAC_PPS_CONTROL_TRGTMODSEL1_S 13U
ETHERNET_MAC_PPS_CONTROL_TRGTMODSEL1_M 3U
ETHERNET_MAC_PPS_CONTROL_TRGTMODSEL_INTERRUPT 0x0U
ETHERNET_MAC_PPS_CONTROL_TRGTMODSEL_RESERVED 0x1U
ETHERNET_MAC_PPS_CONTROL_TRGTMODSEL_INTERRUPT_PULSE 0x2U
ETHERNET_MAC_PPS_CONTROL_TRGTMODSEL_PULSE 0x3U
ETHERNET_MAC_PPS_CONTROL_PPSEN0_PPS_FIXED_MODE 0x0U
ETHERNET_MAC_PPS_CONTROL_PPSEN0_PPS_FLEXIBLE_MODE 0x1U
ETHERNET_MAC_PPS_CONTROL_PPSCTRL_PPS_OUTPUT_SINGLE_PULSE 0x0U
ETHERNET_MAC_PPS_CONTROL_PPSCTRL_PPS_OUTPUT_1HZ 0x1U
ETHERNET_MAC_PPS_CONTROL_PPSCTRL_PPS_OUTPUT_2HZ 0x2U
ETHERNET_MAC_PPS_CONTROL_PPSCTRL_PPS_OUTPUT_4HZ 0x3U
ETHERNET_MAC_PPS_CONTROL_PPSCTRL_PPS_OUTPUT_8HZ 0x4U
ETHERNET_MAC_PPS_CONTROL_PPSCTRL_PPS_OUTPUT_16HZ 0x5U
ETHERNET_MAC_PPS_CONTROL_PPSCTRL_PPS_OUTPUT_32HZ 0x6U
ETHERNET_MAC_PPS_CONTROL_PPSCTRL_PPS_OUTPUT_64HZ 0x7U
ETHERNET_MAC_PPS_CONTROL_PPSCTRL_PPS_OUTPUT_128HZ 0x8U
ETHERNET_MAC_PPS_CONTROL_PPSCTRL_PPS_OUTPUT_256HZ 0x9U
ETHERNET_MAC_PPS_CONTROL_PPSCTRL_PPS_OUTPUT_512HZ 0xAU
ETHERNET_MAC_PPS_CONTROL_PPSCTRL_PPS_OUTPUT_1024HZ 0xBU
ETHERNET_MAC_PPS_CONTROL_PPSCTRL_PPS_OUTPUT_2048HZ 0xCU
ETHERNET_MAC_PPS_CONTROL_PPSCTRL_PPS_OUTPUT_4096HZ 0xDU
ETHERNET_MAC_PPS_CONTROL_PPSCTRL_PPS_OUTPUT_8192HZ 0xEU
ETHERNET_MAC_PPS_CONTROL_PPSCTRL_PPS_OUTPUT_16384HZ 0xFU
ETHERNET_MAC_PPS_CONTROL_PPSCTRL_PPS_OUTPUT_32768HZ 0x10U
ETHERNET_MAC_PPS_CONTROL_PPSCMD_COMMAND_NONE 0x0U
ETHERNET_MAC_PPS_CONTROL_PPSCMD_COMMAND_START_SINGLE 0x1U
ETHERNET_MAC_PPS_CONTROL_PPSCMD_COMMAND_START_TRAIN 0x2U
ETHERNET_MAC_PPS_CONTROL_PPSCMD_COMMAND_CANCEL_START 0x3U
ETHERNET_MAC_PPS_CONTROL_PPSCMD_COMMAND_STOP_AT_TIME 0x4U
ETHERNET_MAC_PPS_CONTROL_PPSCMD_COMMAND_STOP_NOW 0x5U
ETHERNET_MAC_PPS_CONTROL_PPSCMD_COMMAND_CANCEL_STOP 0x6U
ETHERNET_MAC_VLAN_INCL_VLP_S 18U
ETHERNET_MAC_VLAN_INCL_VLP_STATIC 1U
ETHERNET_MAC_VLAN_INCL_VLP_DYNAMIC 0U
ETHERNET_MAC_VLAN_INCL_CSVL_S 19U
ETHERNET_MAC_VLAN_INCL_VLTI_S 20U
ETHERNET_MAC_VLAN_INCL_CBTI_S 21U
ETHERNET_MAC_VLAN_INCL_ADDR_S 24U
ETHERNET_MAC_VLAN_INCL_ADDR_M 0x1000000U
ETHERNET_MAC_VLAN_INCL_RDWR_S 30U
ETHERNET_MAC_VLAN_INCL_BUSY_S 31U
ETHERNET_MAC_INNER_VLAN_INCL_VLP_S 18U
ETHERNET_MAC_INNER_VLAN_INCL_CSVL_S 19U
ETHERNET_MAC_INNER_VLAN_INCL_VLTI_S 20U
ETHERNET_MAC_VLAN_TAG_DATA_DATA_16_S 16U
ETHERNET_MAC_VLAN_TAG_DATA_DATA_17_S 17U
ETHERNET_MAC_VLAN_TAG_DATA_DATA_18_S 18U
ETHERNET_MAC_VLAN_TAG_DATA_DATA_19_S 19U
ETHERNET_MAC_VLAN_TAG_DATA_DATA_20_S 20U
ETHERNET_MAC_VLAN_TAG_DATA_DATA_24_S 24U
ETHERNET_MAC_VLAN_TAG_DATA_DATA_25_S 25U
ETHERNET_MAC_VLAN_TAG_CTRL_CT_READ 1U
ETHERNET_MAC_VLAN_TAG_CTRL_CT_WRITE 0U
ETHERNET_MAC_VLAN_TAG_CTRL_ERIVLT_S 27U
ETHERNET_MAC_VLAN_TAG_CTRL_ERIVLT_M 0x8000000U
ETHERNET_MAC_VLAN_TAG_CTRL_VTHM_M 0x2000000U
ETHERNET_DMA_MODE_INTM_MODE0 0U
ETHERNET_DMA_MODE_INTM_MODE1 1U
ETHERNET_DMA_MODE_INTM_MODE2 2U
ETHERNET_MDIO_ADDRESS_C45E_S 1U
ETHERNET_MDIO_ADDRESS_HIGHCLK_ENABLE_S 11U
ETHERNET_MAC_MDIO_ADDRESS_GOC_0_S 2U
ETHERNET_MAC_MDIO_ADDRESS_GOC_WRITE 1U
ETHERNET_MAC_MDIO_ADDRESS_GOC_READ 3U
ETHERNET_MAC_MDIO_ADDRESS_GOC_POSTREAD_INC 2U
ETHERNET_MAC_ADDRESS0_HIGH_DCS_S 16U
ETHERNET_MTL_RXQ_DMA_MAP0_DDMACH_S 4U
ETHERNET_MTL_RXQ_DMA_MAP0_QDMACH_S 8U
ETHERNET_REVMII_PHY_CONTROL 0x0U
ETHERNET_REVMII_COMMON_STATUS 0x1U
ETHERNET_REVMII_COMMON_EXT_STATUS 0xFU
ETHERNET_REVMII_INTERRUPT_STATUS_MASK 0x10U
ETHERNET_REVMII_REMOTE_PHY_STATUS 0x11U
ETHERNET_REVMII_INTERRUPT_STATUS_MASK_LSI_M 0x100U
ETHERNET_ENABLE 1U
ETHERNET_DISABLE 0U
ETHERNET_SS_CTRLSTS_CLK_LM_S 4U
ETHERNET_SS_CTRLSTS_CLK_SRC_SEL_S 7U
ETHERNET_SS_CTRLSTS_PHY_INTF_SEL_GMII 0U
ETHERNET_SS_CTRLSTS_PHY_INTF_SEL_RMII 4U
ETHERNET_SS_CTRLSTS_PHY_INTF_SEL_REVMII 7U
ETHERNET_SS_CTRLSTS_LMCLKSEL_NORMAL 0U
ETHERNET_SS_CTRLSTS_LMCLKSEL_INTERNAL 1U
ETHERNET_SS_CTRLSTS_CLK_SRC_SEL_EXTERNAL 0U
ETHERNET_SS_CTRLSTS_CLK_SRC_SEL_INTERNAL 1U
ETHERNET_SS_CTRLSTS_FLOW_CTRL_EN_ENABLED 3U
ETHERNET_SS_CTRLSTS_FLOW_CTRL_EN_DISABLED 0U
ETHERNET_SS_CTRLSTS_WRITE_KEY_VALUE 0xA5U
ETHERNET_NUMSTATS 56U
ETHERNET_MAX_NUM_DMA_CHANNELS 2U
ETHERNET_MAX_DMA_DIR 2U
ETHERNET_CH_DIR_TX 0U
ETHERNET_CH_DIR_RX 1U
ETHERNET_TX_DESC_IOC 0x80000000U
ETHERNET_DESC_OWNER 0x80000000U
ETHERNET_TX_DESC_FIRST_DESC 0x20000000U
ETHERNET_TX_DESC_LAST_DESC 0x10000000U
ETHERNET_TX_DESC_TTSE 0x40000000U
ETHERNET_RX_DESC_IOC 0x40000000U
ETHERNET_RX_DESC_BUF1_VALID 0x01000000U
ETHERNET_RX_DESC_BUF2_VALID 0x02000000U
ETHERNET_TX_DESC_TSE_ENABLE 0x00040000U
ETHERNET_TX_DESC_BUF2LENGTH_S 16U
ETHERNET_TX_DESC_SAIC_NO_SA_INC 0U
ETHERNET_TX_DESC_SAIC_INS_SA 1U
ETHERNET_TX_DESC_SAIC_REPL_SA 2U
ETHERNET_TX_DESC_SAIC_S 23U
ETHERNET_TX_DESC_CPC_S 26U
ETHERNET_TX_DESC_CIC_S 16U
ETHERNET_TX_CTXT_DESC_IVLAN_TAG_S 16U
ETHERNET_TX_DESC_VTIR_S 14U
ETHERNET_TX_DESC_TTSS 0x00020000U
ETHERNET_TX_CTXT_DESC_IVTIR_TAG_S 18U
ETHERNET_DESCRIPTORS_NUM_TX 16U
ETHERNET_DESCRIPTORS_NUM_TX_PER_CHANNEL 8U
ETHERNET_DESCRIPTORS_NUM_RX 16U
ETHERNET_DESCRIPTORS_NUM_RX_PER_CHANNEL 8U
ETHERNET_DESCRIPTORS_NUM (ETHERNET_DESCRIPTORS_NUM_TX

+ \

ETHERNET_DESCRIPTORS_NUM_RX )
ETHERNET_PKT_EXTENDED_FLAG_IVT_S 16U
ETHERNET_PKT_EXTENDED_FLAG_MSS_S 0U
ETHERNET_PKT_EXTENDED_FLAG_IVT_M 0xFFFF0000U
ETHERNET_PKT_EXTENDED_FLAG_MSS_M 0x00003FFFU
ETHERNET_PKT_EXTENDED_FLAG_IVTIR_S 18U
ETHERNET_PKT_EXTENDED_FLAG_VT_S 0U
ETHERNET_PKT_EXTENDED_FLAG_CTXT 0x40000000U
ETHERNET_PKT_EXTENDED_FLAG_OSTC 0x08000000U
ETHERNET_PKT_EXTENDED_FLAG_TCMSSV 0x04000000U
ETHERNET_PKT_EXTENDED_FLAG_CDE 0x00800000U
ETHERNET_PKT_EXTENDED_FLAG_VTIR_M 0x000C0000U
ETHERNET_PKT_EXTENDED_FLAG_VTIR_S 18U
ETHERNET_PKT_EXTENDED_FLAG_VTIR_NOTAG 0U
ETHERNET_PKT_EXTENDED_FLAG_VTIR_REMOVE 1U
ETHERNET_PKT_EXTENDED_FLAG_VTIR_INSERT 2U
ETHERNET_PKT_EXTENDED_FLAG_VTIR_REPLACE 3U
ETHERNET_PKT_EXTENDED_FLAG_IVLTV 0x00020000U
ETHERNET_PKT_EXTENDED_FLAG_VLTV 0x00010000U
ETHERNET_PKT_EXTENDED_FLAG_VT_M 0x0000FFFFU
ETHERNET_PKT_EXTENDED_FLAG_VLAN 0x5U
ETHERNET_PKT_EXTENDED_FLAG_TSO 0x6U
ETHERNET_PKT_EXTENDED_FLAG_OST 0x7U
ETHERNET_PKT_FLAG_SOP_S 29U
ETHERNET_PKT_FLAG_EOP_S 28U
ETHERNET_PKT_FLAG_CPC_S 26U
ETHERNET_PKT_FLAG_SAIC_S 24U
ETHERNET_PKT_FLAG_VLIC_S 22U
ETHERNET_PKT_FLAG_TSE_S 18U
ETHERNET_PKT_FLAG_CIC_S 16U
ETHERNET_PKT_FLAG_TTSE 0x40000000U
ETHERNET_PKT_FLAG_SOP 0x20000000U
ETHERNET_PKT_FLAG_EOP 0x10000000U
ETHERNET_PKT_FLAG_CPC 0x0c000000U
ETHERNET_PKT_FLAG_SAIC 0x03000000U
ETHERNET_PKT_FLAG_VLIC 0x00C00000U
ETHERNET_PKT_FLAG_TSE 0x00040000U
ETHERNET_PKT_FLAG_CIC 0x00030000U
ETHERNET_PKT_FLAG_NO_VLAN 0x00000000U
ETHERNET_PKT_FLAG_VLAN_REMOVAL 0x00400000U
ETHERNET_PKT_FLAG_VLAN_INSERTION 0x00800000U
ETHERNET_PKT_FLAG_VLAN_REPLACE 0x00C00000U
ETHERNET_PKT_FLAG_CRC_PAD_INS 0x00000000U
ETHERNET_PKT_FLAG_CRC_INS_NO_PAD 0x04000000U
ETHERNET_PKT_FLAG_CRC_PAD_DIS 0x08000000U
ETHERNET_PKT_FLAG_CRC_REPL_NO_PAD 0x0C000000U
ETHERNET_PKT_FLAG_SA_NO_INS 0x00000000U
ETHERNET_PKT_FLAG_SA_INS 0x01000000U
ETHERNET_PKT_FLAG_SA_REPLACE 0x02000000U
ETHERNET_PKT_FLAG_CS_NO_INS 0x00000000U
ETHERNET_PKT_FLAG_CS_IP_INS 0x00010000U
ETHERNET_PKT_FLAG_CS_IP_PAYLOAD_INS_NO_PSEUDO 0x00020000U
ETHERNET_PKT_FLAG_CS_IP_PAYLOAD_PSEUDO_INS 0x00030000U
ETHERNET_NUM_PORTS 1U
ETHERNET_DMA_CHANNEL_NUM_0 0U
ETHERNET_DMA_CHANNEL_NUM_1 1U
ETHERNET_RX_NORMAL_DESC_RDES1_TSA_LBIT_POS 0xeU
ETHERNET_RX_CONTEXT_DESC_RDES3_CTXT_HBIT_POS 0x1eU
ETHERNET_DRV_DEVMAGIC 0x0acefaceU
ETHERNET_ERROR_CODE (0x2000000U)
ETHERNET_ERROR_INFO (ETHERNET_ERROR_CODE)
ETHERNET_ERROR_WARNING (ETHERNET_ERROR_CODE | 0x10000000U)
ETHERNET_ERROR_MINOR (ETHERNET_ERROR_CODE | 0x20000000U)
ETHERNET_ERROR_MAJOR (ETHERNET_ERROR_CODE | 0x30000000U)
ETHERNET_ERROR_CRITICAL (ETHERNET_ERROR_CODE | 0x40000000U)
ETHERNET_ERR_INVALID_HANDLE (ETHERNET_ERROR_MAJOR + 1U)
ETHERNET_ERR_INVALID_PARAM (ETHERNET_ERROR_MAJOR + 2U)
ETHERNET_ERR_BAD_PACKET (ETHERNET_ERROR_MAJOR + 3U)
ETHERNET_RET_SUCCESS 0U
ETHERNET_GENERIC_INTERRUPT 0U
ETHERNET_TX_INTR_CH0 1U
ETHERNET_TX_INTR_CH1 2U
ETHERNET_RX_INTR_CH0 3U
ETHERNET_RX_INTR_CH1 4U
ETHERNET_NUM_INTERRUPTS 5U
ETHERNET_CHANNEL_OFFSET (0x80U)
ETHERNET_QUEUE_OFFSET (0x40U)
ETHERNET_INTERRUPT_FLAG_TRANSMIT 0x80000000U
ETHERNET_INTERRUPT_FLAG_RECEIVE 0x40000000U
ETHERNET_INTERRUPT_FLAG_EARLY 0x20000000U
ETHERNET_MAC_TIMESTAMP_CONTROL_DIGITAL_ROLLOVER ETHERNET_MAC_TIMESTAMP_CONTROL_TSCTRLSSR

PTP Ingress/Egress Correction related defines follow.

ETHERNET_MAC_TIMESTAMP_CONTROL_BINARY_ROLLOVER 0x0U
ETHERNET_MAC_TIMESTAMP_CONTROL_DIGITAL_ROLLOVER_MAX 0x3B9AC9FFU
ETHERNET_MAC_TIMESTAMP_CONTROL_BINARY_ROLLOVER_MAX 0x7FFFFFFFU
ETHERNET_MAC_TIMESTAMP_INGRESS_CORR_SUBNANOSEC_SCALAR 0x00000100U
ETHERNET_MAC_TIMESTAMP_ASYM_CORR_SCALAR 0x10000U
ETHERNET_MAC_TIMESTAMP_SYSTEM_TIME_SOURCE_INTERNAL 0x0U

PTP Higher Word related defines follow.

ETHERNET_MAC_TIMESTAMP_SYSTEM_TIME_SOURCE_EXTERNAL ETHERNET_MAC_TIMESTAMP_CONTROL_ESTI
ETHERNET_MAC_SYSTEM_TIME_HIGHER_WORD_NOT_VALID 0xFFFFFFFFU
ETHERNET_EEE_TX_CONTROL_LST_VALID 0x80000000U
ETHERNET_EEE_TX_CONTROL_TWT_VALID 0x40000000U
ETHERNET_EEE_TX_CONTROL_LET_VALID 0x20000000U
ETHERNET_EEE_TX_CONTROL_TMICRO_VALID 0x10000000U
ETHERNET_EEE_TX_CONTROL_PLS_VALID 0x80000000U
ETHERNET_EEE_TX_CONTROL_PLS_UP 0x00000002U
ETHERNET_EEE_TX_CONTROL_AUTOEEE_ENABLED 0x00000004U
ETHERNET_EEE_TX_CONTROL_EEE_ENABLED 0x00000001U
ETHERNET_EEE_TX_CONTROL_TXCLKGATE_ENABLED 0x00000008U
ETHERNET_RWKUP_FILTER_CONFIG0_ENABLED 0x1U
ETHERNET_RWKUP_FILTER_CONFIG1_ENABLED 0x2U
ETHERNET_RWKUP_FILTER_CONFIG2_ENABLED 0x4U
ETHERNET_RWKUP_FILTER_CONFIG3_ENABLED 0x8U
ETHERNET_RWKUP_FILTER_COMMAND_ENABLE 0x1U
ETHERNET_RWKUP_FILTER_COMMAND_AND_PREVIOUS 0x2U
ETHERNET_RWKUP_FILTER_COMMAND_INVERSE 0x4U
ETHERNET_RWKUP_FILTER_COMMAND_MULTICAST 0x8U
ETHERNET_RWKUP_FILTER_NUM 0x4U
ETHERNET_RWKUP_FILTER_NUM_WORDS 0x8U

Typedefs

typedef uint32_t Ethernet_Pkt_Flag_T
typedef uint32_t Ethernet_Pkt_Extended_Flag_T
typedef struct Ethernet_Pkt_Desc_T Ethernet_Pkt_Desc

EMAC Packet Structure, that the application/higher layer uses to Send a packet and Driver notifies to the higher layer using this structure For Multiple Packets/Buffers this structure is chained

typedef void *Ethernet_Handle

Generic Handle structure Not used now but for NDK Layer

typedef struct Ethernet_Devicest Ethernet_Device

Forward Declaration of Device Structure see structure Definition below

typedef Ethernet_DescCh Ethernet_TxChDesc
typedef Ethernet_DescCh Ethernet_RxChDesc

Enums

enum Ethernet_CompletionMode

Values:

enumerator ETHERNET_COMPLETION_NORMAL = 0x00U
enumerator ETHERNET_COMPLETION_EARLY = 0x01U

Normal Packet Completion.

Master write to slave

enum Ethernet_PTPOffloadMsgTrigger

PTP Offload related Enums and Structures follow.

Values:

enumerator ETHERNET_PTO_P_DELAY_REQ_MESSAGE_TRIGGER
enumerator ETHERNET_PTO_SYNC_MESSAGE_TRIGGER
enum Ethernet_PTPOffloadDelayReqRespMode

Values:

enumerator ETHERNET_PTO_DELAY_REQ_DELAY_RESP_DISABLE = 0x40U
enumerator ETHERNET_PTO_DELAY_REQ_DELAY_RESP_ENABLE = !0x40U
enum Ethernet_PTPOffloadAutoSyncMode

Values:

enumerator ETHERNET_PTO_AUTO_SYNC_MESSAGE_ENABLE = 0x2U
enumerator ETHERNET_PTO_AUTO_SYNC_MESSAGE_DISABLE = !0x2U
enum Ethernet_PTPOffloadAutoPDelayReqMode

Values:

enumerator ETHERNET_PTO_AUTO_P_DELAY_REQ_MESSAGE_ENABLE = 0x4U
enumerator ETHERNET_PTO_AUTO_P_DELAY_REQ_MESSAGE_DISABLE = !0x4U
enum Ethernet_PTPOffloadPDelayRespMode

Values:

enumerator ETHERNET_PTO_P_DELAY_RESP_MESSAGE_DISABLE = 0x80U
enumerator ETHERNET_PTO_P_DELAY_RESP_MESSAGE_ENABLE = !0x80U
enum Ethernet_PTPOffloadEnableMode

Values:

enumerator ETHERNET_PTP_OFFLOAD_ENABLE = 0x1U
enumerator ETHERNET_PTP_OFFLOAD_DISABLE = !0x1U
enum Ethernet_PTPOffloadModeType

Values:

enumerator ETHERNET_PTO_DELAY_REQ_DELAY_RESP_GENERATION
enumerator ETHERNET_PTO_AUTO_SYNC_MESSAGE
enumerator ETHERNET_PTO_AUTO_P_DELAY_REQ_MESSAGE
enumerator ETHERNET_PTO_P_DELAY_RESP_GENERATION
enum Ethernet_EnableTSO

Values:

enumerator ETHERNET_TX_CHANNEL_TSE_DISABLE
enumerator ETHERNET_TX_CHANNEL_TSE_ENABLE
enum Ethernet_EEE_eventType

Values:

enumerator ETHERNET_EEE_RX_LPI_MAGICPKT_RECEIVED = 0U
enumerator ETHERNET_EEE_RX_LPI_RMTWKUP_PKT_RECEIVED = 1U
enum Ethernet_SS_phyInterfaceMode

Values:

enumerator ETHERNET_SS_PHY_INTF_SEL_MII = 0U
enumerator ETHERNET_SS_PHY_INTF_SEL_RMII = 4U
enumerator ETHERNET_SS_PHY_INTF_SEL_REVMII = 7U
enum Ethernet_SS_clockSelection

Values:

enumerator ETHERNET_SS_CLK_SRC_EXTERNAL = 0U
enumerator ETHERNET_SS_CLK_SRC_INTERNAL = 1U
enum Ethernet_RxDMAQueueMode

Values:

enumerator ETHERNET_RX_DMA_QUEUE_STATIC = 0x00U
enumerator ETHERNET_RX_DMA_QUEUE_DYNAMIC = 0x01U
enum Ethernet_ChannelNum

Values:

enumerator ETHERNET_CHANNEL_0
enumerator ETHERNET_CHANNEL_1
enum Ethernet_QueueNum

Values:

enumerator ETHERNET_QUEUE_0
enumerator ETHERNET_QUEUE_1
enum Ethernet_SetConfigParam

Values:

enumerator ETHERNET_SET_CONFIG_VLAN_TX_OUTER
enumerator ETHERNET_SET_CONFIG_VLAN_TX_INNER
enumerator ETHERNET_SET_CONFIG_VLAN_TX_CHANNEL_BASED
enumerator ETHERNET_SET_CONFIG_VLAN_TX_DOUBLE_VLAN
enumerator ETHERNET_SET_CONFIG_VLAN_TX_PACKET_BASED
enumerator ETHERNET_SET_CONFIG_VLAN_INNER_TX_PACKET_BASED
enumerator ETHERNET_SET_CONFIG_DOUBLE_VLAN
enumerator ETHERNET_SET_CONFIG_FILTER_VLAN_PERFECT
enumerator ETHERNET_SET_CONFIG_FILTER_VLAN_HASH
enumerator ETHERNET_SET_CONFIG_FILTER_L3_L4
enumerator ETHERNET_SET_CONFIG_EEE_TX
enumerator ETHERNET_SET_CONFIG_EEE_TX_ENABLE
enumerator ETHERNET_SET_CONFIG_EEE_TX_DISABLE
enumerator ETHERNET_SET_CONFIG_RX_MAGIC_DETECT_ENABLE
enumerator ETHERNET_SET_CONFIG_RX_REMOTE_WAKEUP_FILTER
enumerator ETHERNET_SET_CONFIG_RX_REMOTE_WAKEUP_ENABLE
enumerator ETHERNET_SET_CONFIG_MAX
enum Ethernet_VlanTxTagControl

Values:

enumerator ETHERNET_VLAN_TX_NONE
enumerator ETHERNET_VLAN_TX_DELETE
enumerator ETHERNET_VLAN_TX_INSERT
enumerator ETHERNET_VLAN_TX_REPLACE
enum Ethernet_VlanType

Values:

enumerator ETHERNET_VLAN_TYPE_C
enumerator ETHERNET_VLAN_TYPE_S
enum Ethernet_VlanTagSource

Values:

enumerator ETHERNET_VLAN_TAG_SOURCE_REG
enumerator ETHERNET_VLAN_TAG_SOURCE_DESC
enum Ethernet_VlanRxPerfectFilterEnable

Values:

enumerator ETHERNET_VLAN_PERFECT_FILTER_DISABLED
enumerator ETHERNET_VLAN_PERFECT_FILTER_ENABLED
enum Ethernet_VlanRxPerfectFilterCompareMode

Values:

enumerator ETHERNET_VLAN_PERFECT_FILTER_COMPARE_16BITS
enumerator ETHERNET_VLAN_PERFECT_FILTER_COMPARE_12BITS
enum Ethernet_VlanRxPerfectFilterTypeComparison

Values:

enumerator ETHERNET_VLAN_PERFECT_FILTER_TYPE_COMPARISON_ENABLED
enumerator ETHERNET_VLAN_PERFECT_FILTER_TYPE_COMPARISON_DISABLED
enum Ethernet_VlanRxFilter_InnerVLANEnable

Values:

enumerator ETHERNET_VLAN_RX_FILTER_INNER_VLAN_DISABLED
enumerator ETHERNET_VLAN_RX_FILTER_INNER_VLAN_ENABLED
enum Ethernet_DMA_channelEnableDisable

Values:

enumerator ETHERNET_DMA_CHANNELNUM_DISABLED
enumerator ETHERNET_DMA_CHANNELNUM_ENABLED
enum Ethernet_ReceiveFlowControlLevel

Values:

enumerator ETHERNET_RX_FLOW_CONTROL_1KB
enumerator ETHERNET_RX_FLOW_CONTROL_1_5_KB
enumerator ETHERNET_RX_FLOW_CONTROL_2KB
enumerator ETHERNET_RX_FLOW_CONTROL_2_5KB
enumerator ETHERNET_RX_FLOW_CONTROL_3KB
enumerator ETHERNET_RX_FLOW_CONTROL_3_5KB
enumerator ETHERNET_RX_FLOW_CONTROL_4KB

Functions

Ethernet_InitConfig *Ethernet_initInterface(Ethernet_InitInterfaceConfig interfaceConfig)

Ethernet_initInterface Initialise the Ethernet Interface with this API. This is the First API of the Low Level Driver that should be called by application/Higher layer stack. Turns on the Clocks to Ethernet interface. The Module Initialization is done in Ethernet_getHandle API the user must fill the Parameters for Init in the Struture returned by the API

Return

Pointer to Init Config Structure to be used in Ethernet_getHandle() API

Parameters
  • interfaceConfig: Configuration Structure to be used for initializing interface

uint32_t Ethernet_initRxChannel(Ethernet_ChInfo *chInfo)

Initializes the Rx DMA Channel and makes it ready for receive

Return

none

Parameters
  • chInfo: : Pointer to the Channel info Structure for the channel to be init

void Ethernet_setMACConfiguration(uint32_t base, uint32_t flags)

Enables MAC for transmission and reception

Return

None

Parameters
  • base: Base Address of the Ethernet Module

  • flags: ORed value of flags to be set (ETHERNET_MAC_CONFIGURATION_RE, ETHERNET_MAC_CONFIGURATION_TE)

void Ethernet_clearMACConfiguration(uint32_t base, uint32_t flags)

Disables MAC for transmission and reception

Return

None

Parameters
  • base: Base Address of the Ethernet Module

  • flags: ORed value of flags to be set (ETHERNET_MAC_CONFIGURATION_RE, ETHERNET_MAC_CONFIGURATION_TE)

void Ethernet_shutdownInterface(void)

Ethernet_shutdownInterface This API can be used for dynamically shutting down the Ethernet interface. This shutsdown the DMA Receiver, Transmit Engines and disables the MAC Reception and transmission. For getting the interface to work the application should use Ethernet_initInterface() and Ethernet_getHandle() APIs to get the interface back to Normal operation.

Ethernet_shutdownInterface() Used to Shutdown the interface - To be implemented No Arguments and Does not Return anything

Return

None

Parameters
  • None:

void Ethernet_getInitConfig(Ethernet_InitConfig *pConfig)

Ethernet_getInitConfig() Builds a default Configuration of the Module The Module Initialization is done in Ethernet_getHandle API the user must fill the Parameters for Init using the Ethernet_InitConfig Struture. This API helps to fill the contents of the Init Config Structure The Ethernet_InitConfig structure variables are populated to a known good values Higher Layer/User can refer to this implementation for creating a different Configuration

Return

Nothing

Parameters
  • pConfig: Ethernet_InitConfig structure pointer could be returned Ethernet_InitInterface() API

uint32_t Ethernet_getHandle(Ethernet_Handle handleApplication, Ethernet_InitConfig *ethernetInitConfigPtr, Ethernet_Handle *ethernetHandlePtr)

Ethernet_getHandle must be called before using the interface For Sending and Receiving the Packets over Ethernet Must pass the filled Init Configuration Structure(that is returned by _initInterface call This initializes the Ethernet module as per the configuration structure provided. The Driver moves to initialized state ready for Sending/Receiving the packets

Return

ETHERNET_RET_SUCCESS on Success

Parameters
  • handleApplication: - can be any application specific passed back during callbacks

  • ethernetInitConfigPtr: - Pointer to the Filled up InitConfig Structure that is provided in _initInterface call

  • ethernetHandlePtr: - returns a handle (Pointer to Book Keeping Structure). This must be provided in subsequent calls to SendPacket or other APIs

uint32_t Ethernet_setConfig(Ethernet_Handle hEMAC, Ethernet_SetConfigParam setParam, void *buffPtr, uint32_t size)

Configure the Specified aspect of the Ethernet driver

Return

ETHERNET_RET_SUCCESS in case of Success and other Error code in case of failure

Parameters
  • hEMAC: handle returned by Ethernet_getHandle API

  • setParam: the parameter to be set can be any of the following values:

    • ETHERNET_SET_CONFIG_VLAN_TX_OUTER - for setting outer VLAN TX Parameters in case of dual VLAN or single VLAN

    • ETHERNET_SET_CONFIG_VLAN_TX_INNER - for setting inner VLAN TX Parameters . in case of inner VLAN

    • ETHERNET_SET_CONFIG_VLAN_TX_DOUBLE_VLAN - configures both Inner and Outer VLAN TX parameters

    • ETHERNET_SET_CONFIG_FILTER_VLAN_PERFECT - for configuring the VLAN Tag Perfect Filtering

    • ETHERNET_SET_CONFIG_FILTER_L3_L4 - for configuring L3,L4 Filters

  • buffPtr: the pointer to the Parameter structure being set

  • size: size of the buffer being passed in buffPtr

uint32_t Ethernet_configurePTP(Ethernet_Handle hEMAC)

Configure PTP Currently not implemented

uint32_t Ethernet_sendPacket(Ethernet_Handle hEMAC, Ethernet_Pkt_Desc *pktPtr)

Ethernet_sendPacket This API is to be used to Send Packet(s) over Ethernet This does a non Blocking Send over the Ethernet Interface The Master DMA inbuilt with the module is Programmed to pick up the Provided buffers and transfer to the Ethernet module TX FIFO. The Completion of DMA results in a Per channel DMA completion interrupt, for which there is a completion ISR The ISR is used to signal the end of packet transmission. The Buffers provided to the LLD over this API can be reclaimed as part of the TX. The Higher layer has to prepare Packet Descriptors for each Buffer and chain them if needed The Packet Boundaries can be specified in the flags using the ETHERNET_PKT_FLAG_SOP and ETHERNET_PKT_FLAG_SOP flags. If there is a single packet it must use both the flags ORred in the packet flags. On completion of Transmit of a Paket, the Driver picks up the Submitted Packet from Queue and returns the Packet Structure as an argument to the Callback function. Interrupt callback handling

Return

ETHERNET_RET_SUCCESS on Success or Error Codes on Failture

Parameters
  • hEMAC-: Handle to the EMAC returned in _Open call

  • pktPtr: - Pointer to the Packet Descriptor structure. If Multiple packets are to be transmitted multiple Descriptors can be chained and single call to _SendPacket can be done Even if a single packet is split into multiple buffers, multiple Descriptors to be chained The First Descriptor should have SOP set and EOP should be set in the last The number of fragments must be specified

uint32_t Ethernet_getStatistics(Ethernet_Handle hEMAC, Ethernet_Statistics *statisticsPtr)

Ethernet_getStatistics() API To get the RMON Statistics Combines all the RMON Statistics in a single call

Return

ETHERNET_RET_SUCCESS on success

Parameters
  • hEMAC: - Handle Provided by _Open call

  • statisticsPtr-: the Pointer to Statistics structure to be filled

void Ethernet_clearHandle(Ethernet_Handle *phEMAC)

Ethernet_clearHandle Not implemented Currently

void Ethernet_clearStatistics(Ethernet_Handle *ethernetHandlePtr)

Ethernet_clearStatistics() Used to Clear the RMON Statistics - To be implemeted

Return

none

Parameters
  • ethernetHandlePtr: - Handle provided in Ethernet_getHandle API call

void Ethernet_setDMARxQueueMode(uint32_t base, Ethernet_RxDMAQueueMode mode, Ethernet_QueueNum queueNum, Ethernet_ChannelNum mappedChannel)

Configures the Queueing model for a given DMA Queue and assigns static channel number for Static mapping of Queue to Channel number

Return

None.

Parameters
  • base: is the base address of the controller.

  • Ethernet_RxDMAQueueMode: configures whether it is Static or Dynamic mapping of the Channels ETHERNET_RX_DMA_QUEUE_STATIC - provides a static mapping of given queue to channel specified in mappedChannel for the queue queueNum ETHERNET_RX_DMA_QUEUE_DYNAMIC - provides a dynamic mapping based on the filters like MAC/L3/L4/VLAN

  • queueNum: specifies the queue number for which the parameter is getting configured

  • mappedChannel: is the channel number which is assigned in case of static mapping in case of Dynamic mapping this parameter is ignored

interrupt void Ethernet_transmitISR (void)

Ethernet_transmitISR() Transmit Packet Completion Interrupt Service Routine This low level driver currently uses the design where every transmit packet will have the Interrupt on Completion Set For each packet provided by the application for Transmit the driver forms a Transmit Descriptor which is submitted into the Transmit Ring of the Ethernet module Each packet’s Interrupt on Completion flag is Set in the Tx Descriptor For each packet Completion interrupt the ISR sees which channel has completion interrupt and handles the corresponding Tx Desc Queue The Packet completion is signalled to the application by calling the Callback function provided by the application

Return

None

interrupt void Ethernet_receiveISR (void)

Ethernet_receiveISR() Receive Packet Completion Interrupt Service Routine for each buffer which is submitted to the Ethernet channel Rx Ring the IOC flag in the Received descriptor is set which results in an interrupt for each packet The ISR pops the packet from Descriptor Queue DescQueue and calls the Rx Callback function registered by the Hiher layer calls Ethernet_removePacketsFromRxQueue to implement the same

Return

None

interrupt void Ethernet_genericISR (void)

Ethernet_genericISR() Generic Interrupt Service Routine

Return

None

Ethernet_Pkt_Desc *Ethernet_getPacketBuffer(void)

This function is a callback function called by the Driver when it needs a Packet for Receive Operation. This can be replaced by the Higher layer stack application while integrating this layer of driver

void Ethernet_releaseTxPacketBuffer(Ethernet_Handle handleApplication, Ethernet_Pkt_Desc *pPacket)

This function is a callback function called by the Driver to handle the Transmit Complete Callback that can be used to reclaim the buffer Placeholder function that can be changed while initializing the Init Structure

Ethernet_Pkt_Desc *Ethernet_receivePacketCallback(Ethernet_Handle handleApplication, Ethernet_Pkt_Desc *pPacket)

This callback function is called by the application when a Rx packet is available Can be changed by the higher layer stack

void Ethernet_setConfigTimestampPTP(uint32_t base, uint32_t config, float subSecondInc)

Configures the Ethernet MAC’s IEEE 1588 timestamping options.

This function is used to configure the operation of the Ethernet MAC’s internal timestamping clock. This clock is used to timestamp incoming and outgoing packets and as an accurate system time reference when IEEE 1588 Precision Time Protocol is in use.

Parameters
  • base: is the base address of the controller.

  • config: contains flags selecting particular configuration options.

  • subSecondInc: is the number that the IEEE 1588 subsecond clock should increment on each tick.

Return

None.

uint32_t Ethernet_getConfigTimestampPTP(uint32_t base, float *subSecondInc)

Returns the current IEEE 1588 timestamping configuration.

This function may be used to retrieve the current MAC timestamping configuration.

Parameters
  • base: is the base address of the controller.

  • subSecondInc: points to storage that is written with the current subsecond increment value for the IEEE 1588 clock.

Return

current state of the ETHERNET_O_MAC_TIMESTAMP_CONTROL register.

void Ethernet_enableSysTimePTP(uint32_t base)

Enables packet timestamping and starts the system clock running.

This function is used to enable the system clock used to timestamp Ethernet frames and to enable that timestamping.

Parameters
  • base: is the base address of the controller.

Return

None.

void Ethernet_disableSysTimePTP(uint32_t base)

Disables packet timestamping and stops the system clock.

This function is used to stop the system clock used to timestamp Ethernet frames and to disable timestamping.

Parameters
  • base: is the base address of the controller.

Return

None.

void Ethernet_setSysTimePTP(uint32_t base, uint32_t seconds, uint32_t subSeconds)

Sets the current system time.

This function may be used to set the current system time. The system clock is set to the value passed in the

seconds and subSeconds parameters.
Parameters
  • base: is the base address of the controller.

  • seconds: is the seconds value of the new system clock setting.

  • subSeconds: is the subseconds value of the new system clock setting.

The meaning of subseconds depends on the current system time configuration. If Ethernet_setConfigTimestampPTP() was previously called with the “DIGITAL ROLLOVER” configuration option, each bit in the subSeconds value represents 1 ns. If “BINARY ROLLOVER” was specified instead, a subSeconds bit represents 0.46 ns.

Return

None.

void Ethernet_getSysTimePTP(uint32_t base, uint32_t *seconds, uint32_t *subSeconds)

Gets the current system time.

This function may be used to get the current system time.

Parameters
  • base: is the base address of the controller.

  • seconds: points to storage for the current seconds value.

  • subSeconds: points to storage for the current subseconds value.

The meaning of subseconds depends on the current system time configuration. If Ethernet_setConfigTimestampPTP() was previously called with the “DIGITAL ROLLOVER” configuration option, each bit in the subSeconds value represents 1 ns. If “BINARY ROLLOVER” was specified instead, a subSeconds bit represents 0.46 ns.

Return

None.

void Ethernet_updateSysTimePTP(uint32_t base, uint32_t seconds, uint32_t subSeconds, bool addSub)

Adjusts the current system time upwards or downwards by a given amount.

This function may be used to adjust the current system time either upwards or downwards by a given amount. The size of the adjustment is given by the

seconds and subSeconds parameter and the direction by the addSub parameter. When addSub is true, the system time is advanced by the interval given. When it is false, the time is retarded by the interval.
Parameters
  • base: is the base address of the controller.

  • seconds: is the seconds value of the time update to apply.

  • subSeconds: is the subseconds value of the time update to apply.

  • addSub: defines the direction of the update, whether to add or.

The meaning of subseconds depends on the current system time configuration. If Ethernet_setConfigTimestampPTP() was previously called with the “DIGITAL ROLLOVER” configuration option, each bit in the subSeconds value represents 1 ns. If “BINARY ROLLOVER” was specified instead, a subSeconds bit represents 0.46 ns.

Return

None.

uint32_t Ethernet_getOneStepTransmitTimestampPTP(uint32_t base, uint32_t *seconds, uint32_t *nanoSeconds)

This API fetches the transmit timestamp of the PTP packet sent out on the line which is captured when PTP Offload is enabled.

When PTP Offload is enabled, the transmit timestamp of the packet is captured and corresponding interrupt status bit is set. For example, if the device is configured as slave, then transmit timestamp for outgoing ‘Delay Request’ packet is captured.

Parameters
  • base: is the base address of the controller.

  • seconds: is the seconds field of the captured transmit timestamp.

  • nanoSeconds: is the nano-seconds field of the captured transmit timestamp.

Return

Transmit Timestamp Status Missed indicator.

void Ethernet_setAddend(uint32_t base, uint32_t addend)

Adjusts the system time update rate when using the fine correction method.

This function is used to control the rate of update of the system time when in fine update mode. Fine correction mode is selected if

ETHERNET_MAC_TIMESTAMP_CONTROL_TSCFUPDT is supplied in the config parameter passed to a previous call to Ethernet_setConfigTimestampPTP(). Fine update mode is typically used when synchronizing the local clock to the IEEE 1588 master clock. The subsecond counter is incremented by the number passed to Ethernet_setConfigTimestampPTP() in the subSecondInc parameter each time a 32-bit accumulator register generates a carry. The accumulator register is incremented by the “addend” value on each main oscillator tick, and this addend value is modified to allow fine control over the rate of change of the timestamp counter. The addend value is calculated using the ratio of the main oscillator clock rate and the desired IEEE 1588 clock rate and the subSecondInc value is set to correspond to the desired IEEE 1588 clock rate.
Parameters
  • base: is the base address of the controller.

  • addend: is the number to add to the accumulator register on each tick of the Reference PTP Clock.

As an example, using digital rollover mode and a 100 MHz Reference PTP clock with a desired IEEE 1588 clock accuracy of 50 MHz, and having made a previous call to Ethernet_setConfigTimestampPTP() with subSecondInc set to the 50 MHz clock period of 20 ns, the initial addend value would be set to 0x80000000 to generate a carry on every second Reference PTP clock tick. Because the system time updates each time the accumulator overflows, small changes in the addend value can be used to very finely control the system time rate.

Return

None.

uint32_t Ethernet_getDepthAuxSnapshotFIFO(uint32_t base)

Returns the number of Auxiliary Timestamp Snapshots available in the Auxiliary Snapshot FIFO.

A value equal to

ETHERNET_MAC_AUX_TIMESTAMP_FIFO_DEPTH indicates that the Auxiliary Snapshot FIFO is full.
Parameters
  • base: is the base address of the controller.

Return

None.

void Ethernet_setTimestampSWTrigger(uint32_t base, uint32_t trigSelect)

Sets the software trigger for Auxiliary Timestamp.

This function can be used to trigger an auxiliary timestamp event initiated by the software.

Parameters
  • base: is the base address of the controller.

  • trigSelect: is the trigger input for which software trigger is intended.

Return

None.

void Ethernet_configAuxTimestampTrigger(uint32_t base, uint32_t trigSelect, uint32_t trigValue)

Configures the Auxiliary Timestamp Unit with intended Triggers.

Return

None.

Parameters
  • base: is the base address of the controller.

  • trigSelect: is the auxiliary snapshot input to be programmed.

  • trigValue: This function configures the Auxiliary Timestamp unit to store a snapshot of the system time based on an external event. The snapshots taken for any input are stored in a common FIFO. Ethernet_getAuxSnapshotTrigId() can be used to know the Input/Trigger Id is for which Timestamp is available for reading at the top of this FIFO. Ethernet_dequeueAuxSnapshotFIFO() can then be used to get the 64-bit timestamp. FIFO is cleared by calling Ethernet_clearAuxSnapshotFIFO(). Auxiliary timestamp snapshots can be recorded based on triggers of system events to track the sequence of events as well as measure latency/delay between two events and so on. The feature can then be used effectively to feed further control signaling choices, trace the sequence of events for debug or analysis purposes. CPU subsystem & device level exceptions like NMI, causes of NMI, Error pin status can be explicitly tracked with timestamp to aid debug or to report any systemic errors.

void Ethernet_clearAuxSnapshotFIFO(uint32_t base)

Clears/Resets the Auxiliary Timestamp Snapshot FIFO.

Return

None.

Parameters
  • base: is the base address of the controller.

void Ethernet_disableAuxSnapshot(uint32_t base, uint32_t trigInstance)

Disable the Auxiliary Timestamping for events.

This function can be used to disable the trigger instance for which Auxiliary Timestamp Snapshots need not be captured.

Parameters
  • base: is the base address of the controller.

  • trigInstance: denotes the Auxiliary Snapshot Trigger Instance.

Return

None.

void Ethernet_enableAuxSnapshot(uint32_t base, uint32_t trigInstance)

Enables the Auxiliary Timestamping for events.

This function can be used to enable the trigger instance for which Auxiliary Timestamp Snapshots needs to be captured.

Parameters
  • base: is the base address of the controller.

  • trigInstance: denotes the Auxiliary Snapshot Trigger Instance.

Return

None.

void Ethernet_dequeueAuxSnapshotFIFO(uint32_t base, uint32_t *seconds, uint32_t *nanoSeconds)

Read the top of Auxiliary Timestamp Snapshot FIFO.

This function can be used to read the content of a 64-bit wide Auxiliary Timestamp Snapshot FIFO with a depth configured as

ETHERNET_MAC_AUX_TIMESTAMP_FIFO_DEPTH. The top of the FIFO is removed only when the last byte of ETHERNET_O_MAC_AUXILIARY_TIMESTAMP_SECONDS is read.
Parameters
  • base: is the base address of the controller.

  • seconds: denotes the Higher 32 bits of the 64-bit Auxiliary Timestamp stored in the Auxiliary Timestamp Snapshot FIFO.

  • nanoSeconds: denotes the Lower 32 bits of the 64-bit Auxiliary Timestamp stored in the Auxiliary Timestamp Snapshot FIFO.

Return

None.

void Ethernet_getAuxSnapshotTrigId(uint32_t base, uint32_t *id)

Get the Id of trigger instance for the top item of Auxiliary Snapshot FIFO.

This function can be used to identify the Auxiliary trigger inputs for which the timestamp is available in the Auxiliary Snapshot FIFO.

Parameters
  • base: is the base address of the controller.

  • id: is pointer to the value of trigger instance identifier.

Return

None.

void Ethernet_selectTargetInterruptOrPulsePPS(uint32_t base, uint32_t ppsNum, uint32_t target)

Sets the action to be triggered when the target system time is reached.

Return

None.

Parameters
  • base: is the base address of the controller.

  • target: is the intended action upon reaching target time.

void Ethernet_setFixedModePPS(uint32_t base, uint32_t freq)

Sets the PPS output in fixed pulse mode.

Return

None.

Parameters
  • base: is the base address of the controller.

  • freq: is the frequency of the output generated on the PPS pin.

void Ethernet_setFlexibleModePPS(uint32_t base)

Sets the PPS output in flexible/command mode.

Return

None.

Parameters
  • base: is the base address of the controller.

void Ethernet_configurePPS(uint32_t base, uint32_t target, uint32_t mode, uint32_t fixedFreq)

Sets the target and mode of PPS in one API. Internally calls Ethernet_setTargetPPS(), Ethernet_setFixedModePPS() and Ethernet_setFlexibleModePPS() to configure the PPS in one shot.

Return

None.

Parameters
  • base: is the base address of the controller.

  • target: is the intended action upon reaching target time.

  • mode: is the PPS output mode.

  • fixedFreq: is the frequency of the output generated on the PPS pin.

void Ethernet_setTargetTimePPS(uint32_t base, uint32_t ppsNum, uint32_t seconds, uint32_t subSeconds)

Sets the target system time at which the next PPS interrupt/pulse is generated.

This function may be used to schedule an interrupt/PPS at some future time. The time reference for the function is the IEEE 1588 time as returned by

Ethernet_getSysTimePTP(). To generate an interrupt when the system time exceeds a given value, call this function to set the desired time, then Ethernet_selectTargetInterruptOrPulsePPS() to enable the interrupt. When the system time increments past the target time, an Ethernet interrupt is generated.
Parameters
  • base: is the base address of the controller.

  • ppsNum: is the instance of the PPS.

  • seconds: is the second value of the desired target time.

  • subSeconds: is the subseconds value of the desired target time.

The accuracy of the interrupt timing depends on the Ethernet timer update frequency and the subsecond increment value currently in use. The interrupt is generated on the first timer increment that causes the system time to be greater than or equal to the target time set.

Return

None.

void Ethernet_setPeriodPPS(uint32_t base, uint32_t ppsNum, uint32_t width, uint32_t interval)

Sets the interval and width of the pulse that is to be generated in flexible/command PPS mode.

Return

None.

Parameters
  • base: is the base address of the controller.

  • ppsNum: is the instance of the PPS.

  • width: is the pulse width.

  • interval: is the pulse interval.

void Ethernet_setCmdPPS(uint32_t base, uint32_t ppsNum, uint32_t ppsCmd)

Programs the command to control the pulse/train start/stop behaviour when PPS flexible/command mode is set.

Return

None.

Parameters
  • base: is the base address of the controller.

  • ppsNum: is the instance of the PPS.

  • ppsCmd: is the command to be programmed.

void Ethernet_writeConfigPTPOffload(uint32_t base, uint32_t config)

Programs the PTP Offload Configuration into the PTO_Control Register.

Return

None.

Parameters
  • base: is the base address of the controller.

  • config: is the 32 bit register value to be programmed.

uint32_t Ethernet_readConfigPTPOffload(uint32_t base)

Returns the raw PTP Offload Configuration from the PTO_Control Register.

Return

32 bit PTO_Control Register dump.

Parameters
  • base: is the base address of the controller.

void Ethernet_writeLogMsgIntervalPTPOffload(uint32_t base, uint32_t config)

Programs the Log Message Interval register with the configuration needed for sending automatic messages when PTP Offloading is enabled.

Return

None.

Parameters
  • base: is the base address of the controller.

  • config: is the 32 bit register value to be programmed.

uint32_t Ethernet_readLogMsgIntervalPTPOffload(uint32_t base)

Returns the raw Log Message Interval register value.

Return

32 bit Log Message Interval Register dump.

Parameters
  • base: is the base address of the controller.

void Ethernet_setPDelayReqMsgTriggerPTPOffload(uint32_t base)

Sets the bit that will trigger one-time sending of PTP Peer Delay Request message by the hardware when PTP Offloading is enabled. Before PTP Offload engine can send this message, it expects that the PTP header related information should have been already programmed by the application.

Return

None.

Parameters
  • base: is the base address of the controller.

void Ethernet_setSyncMsgTriggerPTPOffload(uint32_t base)

Sets the bit that will trigger one-time sending of PTP SYNC message by the hardware when PTP Offloading is enabled. Before PTP Offload engine can send this message, it expects that the PTP header related information to be already programmed by the application.

Return

None.

Parameters
  • base: is the base address of the controller.

void Ethernet_enableDisablePTPOffload(uint32_t base, Ethernet_PTPOffloadEnableMode enableDisable)

To enable or disable the PTP Offload engine. Once enabled, it arms the hardware to automatically send or respond to PTP messages on the line. Before this feature can be used, the engine expects that the PTP header related information to be already programmed by the application.

Return

None.

Parameters
  • base: is the base address of the controller.

  • enableDisable: is the on/off switch value that is to be programmed.

void Ethernet_setMsgSwitchesPTPOffload(uint32_t base, Ethernet_PTPOffloadModeType ptoModeType, void *ptoModeConf)

To switch on/off multiple automatic PTP send/response messages for master or slave mode. Ordinary/Boundary clock: In Master mode, hardware can generate Sync or Delay Response messages. Similarly, when configured in slave mode, the hardware can generate automatic responses to Delay Request messages. Transparent clock: Whether the hardware is configured in master or slave mode, it can generate the Peer Delay Request messages or respond with Peer Delay Response messages.

Return

None.

Parameters
  • base: is the base address of the controller.

  • ptoModeType: type of the message for which the switch setting needs to be programmed. This can be any of the following automatic types:

    1. Delay Request/ Delay Response message generation.

    2. Sync message generation.

    3. Peer Delay Request message generation.

    4. Peer Delay Response message generation.

  • ptoModeConf: is the on/off switch value corresponding to ptoModeType.

void Ethernet_setDomainNumberPTPOffload(uint32_t base, uint8_t domainNumber)

This API configures the Domain Number in the hardware. This is a part of standard PTP Header and the hardware uses this pre-configured value while sending automatic PTP messages.

Return

None.

Parameters
  • base: is the base address of the controller.

  • domainNumber: is the 8-bit value to be programmed in the controller.

void Ethernet_setSourcePortIdPTPOffload(uint32_t base, uint32_t spi0, uint32_t spi1, uint32_t spi2)

This API configures the Source Port Id in the hardware. This is a part of standard PTP Header and the hardware uses this pre-configured value while sending automatic PTP messages. This is a 10-octet value.

Return

None.

Parameters
  • base: is the base address of the controller.

  • spi0: is octet 1 to octet 4 of the Source Port Id.

  • spi1: is octet 5 to octet 8 of the Source Port Id.

  • spi2: is octet 9 and octet 10 of the Source Port Id.

void Ethernet_setLogSyncIntervalPTPOffload(uint32_t base, uint8_t value)

This API configures the periodicity of the automatically generated SYNC message when the PTP node is Master. Allowed values are -15 to 15. For a given value of the log sync interval (n), the time interval between consective Sync packets is given by: 2^(30+n) nanoSec, when -15 <= n <= -1 2^n sec, when 0 <= n <= 15

Return

None.

Parameters
  • base: is the base address of the controller.

  • value: is actual value of periodicity to be configured. Allowed values are -15 to 15. Negative value must be represented in 2’s-complement form. For example, if the required value is -1, the value programmed must be 0xFF.

void Ethernet_setDelaySyncRatioPTPOffload(uint32_t base, uint8_t value)

This API configures the frequency of the automatically generated Delay Request messages. Delay Request messages are generated by the slave node. The master sends this information (logMinDelayReqInterval) in the DelayResp PTP messages to the slave. The Receiver(slave) processes this value from the received DelayResp messages and updates this field accordingly. In the Slave mode, the host must not write/update this register unless it has to override the received value.

Return

None.

Parameters
  • base: is the base address of the controller.

  • value: is the 8-bit frequency value of DelayReq messages to be configured. It can be one of the following: 0: DelayReq generated for every received SYNC 1: DelayReq generated every alternate reception of SYNC 2: for every 4 SYNC messages 3: for every 8 SYNC messages 4: for every 16 SYNC messages 5: for every 32 SYNC messages 6-7: Reserved

void Ethernet_setLogMinPDelayReqIntervalPTPOffload(uint32_t base, uint8_t value)

This API configures the periodicity of the automatically generated Peer Delay Request message when the node is configured as transparent clock. Allowed values are -15 to 15.

Return

None.

Parameters
  • base: is the base address of the controller.

  • value: is actual value of periodicity to be configured. Allowed values are -15 to 15. Negative value must be represented in 2’s-complement form. For example, if the required value is -1, the value programmed must be 0xFF.

void Ethernet_setConfigPTPOffload(uint32_t base, Ethernet_PTPOffloadConfigParams ptoConfigParams)

This is a wrapper API that allows configuring the PTP Offload engine in the hardware. This includes the PTP header related information such as Domain Number, Source Port Id, LogSyncInterval, Delay Sync Ratio, LogMinPDelayInterval. It also configures various automatic PTP message switches such as Sync, Delay Request, Delay Response, Peer Delay Request.

Return

None.

Parameters
  • base: is the base address of the controller.

  • ptoConfigParams: is the structure that holds PTP Offload related settings like source port id, domain number, log message interval, automatic PTP message switches.

void Ethernet_enableUDPChecksumUpdatePTP(uint32_t base)

This API enables One-step timestamping feature for PTP packets over UDP. PTP requires the timestamp to be captured while the packet (SFD of the packet) is on the line and one step timestamp requires the origin timestamp and/or correction field to be updated in the PTP header while the packet is being transmitted on the line. Because the PTP message is present in the UDP payload, it is not possible to update the checksum field in the UDP header for modifications made to the PTP message, because it is already transmitted by then. Hence the hardware appends two bytes to the UDP payload and modifies those two bytes in order to keep the already transmitted UDP checksum same.

Return

None.

Parameters
  • base: is the base address of the controller.

void Ethernet_setIngressCorrectionPTP(uint32_t base, int32_t nanoSeconds)

This API enables the correction for latency and synchronization in the timestamp captured in the Receive side at the internal snapshot point. It is achieved by configuring the correction value (Ingress Correction Value) in the hardware. This value is always negative. According to the IEEE 1588 specification, a timestamp must be captured when the message timestamp point (leading edge of the first bit of the octet immediately following the Start Frame Delimiter octet) crosses the boundary between the node and the network.Because the reference timing source (the PTP clock clk_ptp_ref_i) is different from the MAC Tx or Rx clock, the captured timestamp must be corrected for latency issues because of synchronization. In addition, latency issues between the internal snapshot point and the recommended capture point (the boundary between the node and the network), must also be corrected.

Return

None.

Parameters
  • base: is the base address of the controller.

  • nanoSeconds: is the Ingress Correction value to be programmed. For Binary Rollover, accuracy is 1 ns. For Digital Rollover, accuracy is ~0.466ns.

void Ethernet_setEgressCorrectionPTP(uint32_t base, int32_t nanoSeconds)

This API enables the correction for latency and synchronization in the timestamp captured in the Transmit side at the internal snapshot point. It is achieved by configuring the correction value (Egress Correction Value) in the hardware. According to the IEEE 1588 specification, a timestamp must be captured when the message timestamp point (leading edge of the first bit of the octet immediately following the Start Frame Delimiter octet) crosses the boundary between the node and the network. Because the reference timing source (the PTP clock clk_ptp_ref_i) is different from the MAC Tx or Rx clock, the captured timestamp must be corrected for latency issues because of synchronization. In addition, latency issues between the internal snapshot point and the recommended capture point (the boundary between the node and the network), must also be corrected.

Return

None.

Parameters
  • base: is the base address of the controller.

  • nanoSeconds: is the Egress Correction value to be programmed. For Binary Rollover, accuracy is 1 ns. For Digital Rollover, accuracy is ~0.466ns.

void Ethernet_getSysTimeWithHigherWordPTP(uint32_t base, uint32_t *higherWord, uint32_t *seconds, uint32_t *subSeconds)

This API fetches the 80-bit timestamp from the hardware. IEEE 1588-2008 defines a reference time in 64-bit format whereas IEEE 1588-2002 defines an 80-bit format. Further the PTP subsystem provides two input sources:

  1. External Timestamp Input (Only 64 bit)

  2. Internal Timestamp Input (80 bit) The timestamp maintained in the hardware is 64-bit wide. The overflow to upper 16-bits of seconds register happens once in 130 years. The values of the upper 16-bits of the seconds field are exposed through this API.

Return

None.

Parameters
  • base: is the base address of the controller.

  • higherWord: is the upper 16-bits of seconds value.

  • seconds: is the lower 32-bits of seconds value.

  • subSeconds: is the 32-bit subSecond(nanoseconds) value.

void Ethernet_setSubNanosecEgressCorrectionPTP(uint32_t base, float nanoSeconds)

This API programs the Egress correction with sub-nanoseconds accuracy. The fractional part of the egress correction value represents the sub-nanoseconds value that needs to be programmed. The integer part represents the nanoseconds value.

Return

None.

Parameters
  • base: is the base address of the controller.

  • nanoSeconds: is the floating point nanosecond value from which the fractional part is extrapolated by multiplying with 2^8 and programmed in the hardware.

void Ethernet_setSubNanosecIngressCorrectionPTP(uint32_t base, float nanoSeconds)

This API programs the Ingress correction with sub-nanoseconds accuracy. The fractional part of the Ingress correction value represents the sub-nanoseconds value that needs to be programmed. The integer part represents the nanoseconds value.

Return

None.

Parameters
  • base: is the base address of the controller.

  • nanoSeconds: is the floating point nanosecond value from which the fractional part is extrapolated by multiplying with 2^8 and programmed in the hardware.

void Ethernet_setAsymEgressCorrectionPTP(uint32_t base, float nanoSeconds)

This API programs the Asymmetric Egress correction value in nanosecs which is subtracted from the correction field of the PTP packet being transmitted on the line.

Return

None.

Parameters
  • base: is the base address of the controller.

  • nanoSeconds: is the floating point nanosecond value which is to be subtracted from the correction field of the outgoing PTP packet.

void Ethernet_setAsymIngressCorrectionPTP(uint32_t base, float nanoSeconds)

This API programs the Asymmetric Ingress correction value in nanosecs which is added to the correction field of the PTP packet being received on the line.

Return

None.

Parameters
  • base: is the base address of the controller.

  • nanoSeconds: is the floating point nanosecond value which is to be added to the correction field of the incoming PTP packet.

bool Ethernet_isTimestampIntActive(void)

Ethernet_isTimestampIntActive()

This API checks whether the source of an interrupt (generic) is timestamp based. A Timestamp interrupt may arise due to following reasons:

  1. Transmit timestamp is captured for a packet when PTP Offload mode is enabled.

  2. The system time value is equal to or exceeds the value specified in the Target Time High and Low registers.

  3. There is an overflow in the Seconds register.

  4. Target Time Error occurred, that is, programmed target time already elapsed.

  5. Auxiliary snapshot trigger is asserted when Auxiliary Snapshot feature is enabled.

Return

true if the Timestamp Interrupt Status bit is set. false if the Timestamp Interrupt Status bit is reset.

Parameters
  • none:

bool Ethernet_isTransmitTimestampStatusSet(void)

Ethernet_isTransmitTimestampStatusSet()

This API checks whether the source of the timestamp interrupt is “Transmit timestamp is captured for a packet when PTP Offload mode is

enabled.” If it is set, the application shall use the

Ethernet_getOneStepTransmitTimestampPTP() API to read the captured timestamp for the transmitted packet. Note that this Transmit Timestamp Status will be reset only if the captured timestamp is read by calling above API.

Return

true if the Transmit Timestamp Status bit is set. false if the Transmit Timestamp Status bit is reset.

Parameters
  • none:

void Ethernet_configureMDIO(uint32_t base, uint32_t clockHigh, uint32_t clockRange, uint32_t clause45Enable)

Configures the Parameters of MDIO/Station Management Interface

The MDIO interface is used to access the external PHY

Return

None

Parameters
  • base: - Base Address of the Ethernet Module

  • clockHigh:

    • 0 - for Lower frequency ranges between 1Mhz to 2.5 Mhz range

    • 1- for higher frequency ranges as programmed in clockRange parameter

  • clockRange-: following are the allowed values

    • 0-5 with clockHigh 0 configures between 1 Mhz to 2.5 Mhz Range

    • 0-7 with clockHigh 1 For higher Frequency ranges, refer TRM other values are reserved

  • clause45Enable:

    • 0 -Operates Clause22 Mode

    • 1 - Operates in Clause45 Mode

void Ethernet_configurePHYAddress(uint32_t base, uint8_t phyAddr)

Configures the Address of PHY which is addressed by this MAC For RevMII Interface mode, this API configures the address of RevMII module as to be programmed from the other MAC

Return

None

Parameters
  • base: Base Address of the Ethernet Module

  • phyAddr: Address of the PHY 0-31 are valid addresses. Other values are reserved

uint8_t Ethernet_getPHYMode(uint32_t base)
uint16_t Ethernet_readPHYRegister(uint32_t base, uint16_t regAddress)
void Ethernet_writePHYRegister(uint32_t base, uint8_t regAddress, uint16_t writeData)
void Ethernet_setMACAddr(uint32_t base, uint8_t instanceNum, uint32_t MACAddrHigh, uint32_t MACAddrLow, Ethernet_ChannelNum channelNum)

Return

none

Parameters
  • base: Base Address of Ethernet module instanceNum : 0-3 , the instance of MAC address register to be programmed MacAddr High : Higher two bytes of MAC address in the lower two bytes Higher 16 bits are ignored MacAddrLow : Lower 4 bytes of the MAC address channelNum DMA Channel number to which this is mapped Function to program the MAC Address

void Ethernet_getMACAddr(uint32_t base, uint8_t instanceNum, uint32_t *macAddrHigh, uint32_t *macAddrLow)

Gives the MAC address of the instance passed

Return

None

Parameters
  • base: Base Address of the Ethernet Module

  • instanceNum: instance number of MAC address 0-3 are valid instance numbers

  • MACAddrHigh: Higher two bytes of MAC address in the lower nibble

  • MACAddrLow: Lower word of MAC address bytes

void Ethernet_clearDMAChannelInterrupt(uint32_t base, uint32_t channelNum, uint32_t flags)

Clears the Interrupt flags of the specific DMA Channel number

Return

None

Parameters
  • base: Base Address of the Ethernet Module

  • ChannelNum: Channel number of DMA 0,1 are valid Channel Numbers

  • flags: ORed value of flags to be cleared the set flags will be cleared in the DMA Channel

void Ethernet_enableDmaInterrupt(uint32_t baseAddress, uint32_t channelNum, uint32_t flags)

This function helps to enable specified flags in DMA_CH0_INTERRUPT_ENABLE register of the Ethernet Module

Return

none

Parameters
  • baseAddress: Base Address of the Ethernet modules

  • channelNum: Channel number which has to be programmed 0 or 1

  • flags: ORed Flags of the Register to be enabled

void Ethernet_disableDmaInterrupt(uint32_t baseAddress, uint32_t channelNum, uint32_t flags)

This function helps to disable specified flags in DMA_CHn_INTERRUPT_ENABLE register of the Ethernet Module

Return

none

Parameters
  • baseAddress: Base Address of the Ethernet modules

  • channelNum: Channel number which has to be programmed 0 or 1

  • flags: ORed Flags of the Register to be enabled. Example: ETHERNET_DMA_CH0_INTERRUPT_ENABLE_TBUE, ETHERNET_DMA_CH0_INTERRUPT_ENABLE_NIE, ETHERNET_DMA_CH0_INTERRUPT_ENABLE_RBUE.

void Ethernet_enableMTLInterrupt(uint32_t baseAddress, uint32_t queueNum, uint32_t flags)

This function helps to enable specified flags in MTL_Qn_INTERRUPT_CONTROL_STATUS register of the Ethernet Module

Return

none

Parameters
  • baseAddress: Base Address of the Ethernet modules

  • queueNum: Queue number which has to be programmed 0 or 1

  • flags: ORed Flags of the Register to be enabled. Example: ETHERNET_MTL_Q0_INTERRUPT_CONTROL_STATUS_RXOIE, ETHERNET_MTL_Q0_INTERRUPT_CONTROL_STATUS_TXUIE, ETHERNET_MTL_Q0_INTERRUPT_CONTROL_STATUS_RXOVFIS.

void Ethernet_disableRxDMAReception(uint32_t base, uint8_t channelNum)

This function disables the DMA from receiving anymore packets from fifo

Return

none

Parameters
  • baseAddress: Base Address of the Ethernet modules

  • channelNum: Channel number which has to be programmed 0 or 1

void Ethernet_enableRxDMAReception(uint32_t base, uint8_t channelNum)

This function enables the DMA for receiving packets from fifo

Return

none

Parameters
  • baseAddress: Base Address of the Ethernet modules

  • channelNum: Channel number which has to be programmed 0 or 1

void Ethernet_writeTxDescTailPointer(uint32_t baseAddress, uint32_t channelNum, Ethernet_HW_descriptor *write_data)

This function sets the Transmit Descriptor Tail Pointer of the Transmit DMA Ring. Configures the End of Tx Descriptor Ring

Return

none

Parameters
  • baseAddress: Base Address of Ethernet module

  • channelNum: the channel number of the register to be configured 0,1 are valid Channel numbers

  • write_data: pointer to the Descriptor 32 bit pointer to the hardware descriptor structure

void Ethernet_setDMAChannelTransmitStart(uint32_t base, uint32_t channelNum)

This sets the Transmit Start Bit in DMA Channel Tx Control Register

Return

None

Parameters
  • base: Base Address of the Ethernet Module

  • channelNum: instance number of DMA channel 0,1 are valid Channel Numbers

uint16_t Ethernet_getRxERICount(uint32_t base, uint32_t channelNum)

This returns the Count of the Fragments which have been DMAed in the packet which is currently being written by DMA from line This is typically used in Early Receive Interrupt (Generic Interrupt) handling to identify how many chunks(programmed Buffer size) has been received during Threshold mode/Early Receive interrupt handling. This shall be reset if the Receive Completion interrupt has been asserted for the current packet

Return

16 bit value of number of chunks received in current packet

Parameters
  • base: Base Address of the Ethernet Module

  • channelNum: instance number of DMA channel 0,1 are valid Channel Numbers

void Ethernet_addPacketsIntoRxQueue(Ethernet_DescCh *channelDescPtr)

Ethernet_addPacketsIntoRxQueue

Return

none

Parameters
  • : channelDescPtr - Pointer to Channel Descriptor Structure to which the Receive buffer has to be enqueued This function calls the higher layer callback function to get the buffers for receive from application and queues them up in Desc Queue For the Receive channels the Wait queue is not used only the Desc Queue is used by the driver

void Ethernet_removePacketsFromRxQueue(Ethernet_DescCh *channelDescPtr, Ethernet_CompletionMode completionMode)

Ethernet_removePacketsFromRxQueue()

This function is called from the Receive Completion Interrupt Handler This fills the PacketDescriptor Structure for handing over the packet And fills with the received packet details Calls the Receive Packet Callback function provided by higher layer

Return

None

Parameters
  • channelDescPtr: - Receive channel Desctiptor Pointer from which the Packet has to be Defines completionMode

void Ethernet_writeRxDescTailPointer(uint32_t baseAddress, uint32_t channelNum, Ethernet_HW_descriptor *write_data)

Return

none

Parameters
  • baseAddress: Base Address of Ethernet module channelNum : 0 or 1, the channel number of the register to be configured write_data : pointer to the Descriptor Function to write to DMA_CHx_RXDESC_TAIL_POINTER register This configures the beginning of Rx Descriptor Ring

void Ethernet_enableTransmitFlowControl(uint32_t base, uint8_t queueNum)

Enables the Flow Control in the Transmit Path for the given queue number

Return

None

Parameters
  • base: Base Address of the Ethernet Module

  • queueNum: instance number of MAC address 0,1 are valid queue Numbers

void Ethernet_disableTransmitFlowControl(uint32_t base, uint8_t queueNum)

Disables the Flow Control in the Transmit Path for the given queue number

Return

None

Parameters
  • base: Base Address of the Ethernet Module

  • queueNum: instance number of MAC address 0,1 are valid queue Numbers

void Ethernet_setTransmitPauseTime(uint32_t base, uint8_t queueNum, uint16_t pauseTime)

Programs the Pause Time in the Transmit Path for the given queue number. This shall be used when sending Pause Packets in full duplex mode for Flow control. The MAC Address 0 shall be used as the source address

Return

None

Parameters
  • base: Base Address of the Ethernet Module

  • queueNum: instance number of MAC address 0,1 are valid queue Numbers

  • pauseTime: 16 bit Pause Time to be used in the Pause packets

void Ethernet_triggerTransmitFlowControl(uint32_t base, uint8_t queueNum)

Triggers the Flow Control in the Transmit Path for the given queue number. In full duplex mode this results in Pause Frame sent on the line and in half duplex mode the Back pressure is activated. This API should not be called when the Flow control is already in progress. Use Ethernet_getTransmitFlowControlStatus() to get the status and call this if Flow control is not active

Return

None

Parameters
  • base: Base Address of the Ethernet Module

  • queueNum: instance number of MAC address 0,1 are valid queue Numbers

uint8_t Ethernet_getTransmitFlowControlStatus(uint32_t base, uint8_t queueNum)

Gives the Transmit Flow control Status of the given Queue This API can be used before calling Ethernet_triggerTransmitFlowControl()

Return

0 if Flow Control is not active 1 if Flow Control is active

Parameters
  • base: Base Address of the Ethernet Module

  • queueNum: instance number of MAC address 0,1 are valid queue Numbers

void Ethernet_enableReceiveFlowControl(uint32_t base, uint8_t queueNum)

This API enables the Hardware Flow Control Mechanism in the receive Path When a Pause Packet is received in Full duplex mode,the flow control mechanism is triggered in Transmit path. For Half Duplex mode the pause packets are only detected as control Packets. It may be practically efficient to use this feature if the Receive Queue size is 4K bytes. By default only Pause Packets with special MAC address 0180C2000001 If unicast Pause Packets are to be handled then use Ethernet_enableUnicastPauseFrameDetect() API to enable Unicast Pause. Suggested use after calling Ethernet_enableMACReceiveFlowControl() after enabling Receive Flow Control at MAC level.and configuring the thresholds using Ethernet_configureReceiveFlowcontrol() API. To disable the same use Ethernet_disableReceiveFlowControl() API

Return

None

Parameters
  • base: Base Address of the Ethernet Module

  • queueNum: instance number of MAC address 0,1 are valid queue Numbers

void Ethernet_disableReceiveFlowControl(uint32_t base, uint8_t queueNum)

This API disables the Hardware Flow Control Mechanism in the receive Path To Enable use Ethernet_disableReceiveFlowControl()

Return

None

Parameters
  • base: Base Address of the Ethernet Module

  • queueNum: instance number of MAC address 0,1 are valid queue Numbers

void Ethernet_configureReceiveFlowcontrol(uint32_t base, uint8_t queueNum, Ethernet_ReceiveFlowControlLevel activationLevel, Ethernet_ReceiveFlowControlLevel deActivationLevel)

This API configures the parameters for the Hardware Flow Control Mechanism in the receive Path of the Receive Queue When a Pause Packet is received in Full duplex mode,the flow control mechanism is triggered in Transmit path. For Half Duplex mode the pause packets are only detected as control Packets The Activation level controls when it is triggered and Deactivation level controls when it is deactivated.

Return

None

Parameters
  • base: Base Address of the Ethernet Module

  • queueNum: instance number of MAC address 0,1 are valid queue Numbers

void Ethernet_enableMACReceiveFlowControl(uint32_t base)

This API enables the Receive Flow control at MAC Level

Return

None

Parameters
  • base: Base Address of the Ethernet Module

void Ethernet_disableMACReceiveFlowControl(uint32_t base)

This API disables the Receive Flow control at MAC Level

Return

None

Parameters
  • base: Base Address of the Ethernet Module

void Ethernet_enableUnicastPauseFrameDetect(uint32_t base)

This API enables the Received unicast Pause Packets to be treated as Flow control packets. By default only the Multicast address pause packets are treated as Flow Control Packets This API enables MAC Address 0 also to be considered as a unicast

Return

None

Parameters
  • base: Base Address of the Ethernet Module

void Ethernet_disableUnicastPauseFrameDetect(uint32_t base)

This API disables the Received unicast Pause Packets to be treated as Flow control packets. Only the special Multicast address pause packets are treated as Flow Control Packets This API enables MAC Address 0 also to be considered as a unicast

Return

None

Parameters
  • base: Base Address of the Ethernet Module

struct Ethernet_LogMsgIntervalConfig
#include <ethernet.h>

Log Message Interval structure that is needed to notify the driver of the three values -

  1. Minimum Interval between successive Peer Delay Request messages

  2. Delay Request messages to Sync message ratio, that is for how many Sync messages that a slave receives, it should send a Delay Request message.

  3. Minimum Interval between successive Sync messages in the master.

The driver programs these value in the corresponding register which is then used to send automated PTP messages by the hardware when PTP Offloading is enabled.

struct Ethernet_SourcePortIdentity
#include <ethernet.h>

Source Port Identity structure that is needed to notify the driver of the source_port_id value as needed by the PTP Offload Engine to frame the PTP header in the hardware when PTP Offloading is enabled. This is a 10 Byte long field as specified in the IEEE 1588 Protocol.

struct Ethernet_PTPOffloadConfigParams
#include <ethernet.h>

PTP Offload Configuration Parameters structure, that the application/higher layer may use to set configuration and send this structure to the driver to enable corresponding PTP Offload features.

struct Ethernet_Statistics
#include <ethernet.h>

Statistics Software defines Structure that groups the different RMON Statistics in the Peripheral. Refer to TRM for further details of each of the elements

struct Ethernet_HW_descriptor
#include <ethernet.h>

Generic Hardware Descriptor Structure definition that can be used for Transmit,Receive and Context Descriptors

struct Ethernet_Pkt_Desc_T
#include <ethernet.h>

EMAC Packet Structure, that the application/higher layer uses to Send a packet and Driver notifies to the higher layer using this structure For Multiple Packets/Buffers this structure is chained

struct Ethernet_MACAddrConfig
#include <ethernet.h>

MAC Address Structure to by used by Higher layer to pass MAC address to the Driver

struct Ethernet_SubSystemConfig
#include <ethernet.h>

EMAC Wrapper Subsystem Configuration used in Initializing the Configuration during Ethernet_Init

struct Ethernet_MACFilterConfig
#include <ethernet.h>

Filter Coniguration Structure That maps to MAC Filter Configuration Register of the MAC

struct Ethernet_ChInfo
#include <ethernet.h>

Per Channel Information Structure Stores the individual channel Parameters

struct Ethernet_DmaMode
#include <ethernet.h>

This structure maps to the bit fields of DMA Mode of Ethernet module. Used to fill DMA Mode register. Default values are configured in Ethernet_getInitConfig() and can be overwritten before calling Ethernet_getHandle() API

struct Ethernet_InitConfig
#include <ethernet.h>

Init Configuration Structure used in Ethernet_getHandle The Ethernet_getInitConfig() API fills a known good value of this structure can be modified to change the default settings. An instance of this is stored fully in the Global Book Keeping structure for Maintaining the Configuration Specified by the Higher Layer/User

struct Ethernet_InitInterfaceConfig
#include <ethernet.h>

This Structure should be passed to Ethernet_InitInterface() API.

struct Ethernet_PKT_Queue_T
#include <ethernet.h>

Generic Packet Queue Structure - Contains a head and Tail pointer Two instances of such Structure is used in each channel

struct Ethernet_DescCh
#include <ethernet.h>

Per Channel Channel Descriptor Structure Maintains two queues one for Wait Queue that is submitted by the User Desc Queue that is Queued to the Hardware It also maintains the Descriptor pointers

struct Ethernet_DmaObj
#include <ethernet.h>

DMA Object that combines the Tx and Rx Channel Descritor Structures

struct Ethernet_BaseConfig
#include <ethernet.h>

Base Address Definition Structure Stores the Base Address of the Subsystem and the Ethernet module

struct Ethernet_Devicest
#include <ethernet.h>

Global Book keeping Structure maintained throughout

struct Ethernet_RxQControl
#include <ethernet.h>

The structure for Rx Queue Configuration Used by the driver in Rx Queue Configuration

struct Ethernet_VlanConfig
#include <ethernet.h>

The structure for VLAN Tag Configuration Used in Transmit VLAN Tagging

struct Ethernet_DoubleVLANConfig
#include <ethernet.h>

The structure for Dual VLAN Tag Configuration Used in Transmit Dual VLAN Tagging

struct Ethernet_VLANCBTIConfig
#include <ethernet.h>

The structure for Channel based VLAN Tag Insertion Configuration Used in Transmit VLAN Tagging

struct Ethernet_VLAN_Perfect_FilterParams
#include <ethernet.h>

The structure for VLAN Perfect Filter Configuration Used in Receive VLAN Filter

struct Ethernet_Vlan_Hash_FilterParams
#include <ethernet.h>

The structure for VLAN Hash Filter Used in Receive VLAN Filtering

struct Ethernet_L3_L4_FilterParams
#include <ethernet.h>

Value that can be passed to Ethernet_setConfig() as the buffPtr parameter. If layer3ProtocolSel is 1(for IPv6) make sure only either of layer3IPDestAddressMatchEnable or layer3IPSrcAddressMatchEnable is set

struct Ethernet_L3_L4_Control
#include <ethernet.h>

The structure for L3/L4 Filter configuration Used by the driver in L3/L4 Filter Configuration programming

struct Ethernet_EEE_Tx_Params
#include <ethernet.h>

The structure for Energy Efficient Ethernet Configuration(EEE) Used in Transmit EEE configuration

struct Ethernet_RemoteWakeUp_Filter_Config
#include <ethernet.h>

The structure for Remote Wake up Filter Configuration. Used in Receive EEE Path The device supports 1 to ETHERNET_RWKUP_FILTER_NUM number of filters This structure configures the filters for the same.

The following describes important details and recommendations when using the ethernet API.

Ethernet_initInterface() API has to be called first and then the Ethernet_getInitConfig to get known good set of parameters for the Ethernet MAC. Ethernet_getHandle() API initializes the module with the parameters configured. It also configures a default MAC address to the interface, which can be changed using Ethernet_setMACAddr() API.

Ethernet_sendPacket() API can be used to send packet(s) from the module. When a packet is received the Receive Interrupt handler will be called. This driver also implements a simple buffer handling mechanism using the Packet Descriptor structure. The application submits a packet descriptor structure during the _sendPacket() which is returned with the Transmit completion callback for relinquishing the buffers.

During the initialization ( Ethernet_getHandle()) the Driver calls the callback function for getting the Receive buffers.

The default callback functions invoked by the Interrupt handlers are also assigned by the Ethernet_getInitConfig() Those callbacks can be modified as needed by the application. Ethernet_getHandle API also programs the default Ethernet interrupt handlers. Please use Interrupt driver library APIs to change the default interrupt handlers.

The default Receive interrupt completion handler will call the callback function to refill the receive buffers consumed. The application should provide the buffer to replenish the receive buffer pool.

Ethernet_configureMDIO(), Ethernet_readPHYRegister(), Ethernet_writePHY Register APIs can be used to configure the MDIO module and access the external PHY registers.

The code for this module is contained in driverlib_cm/ethernet.c, with driverlib_cm/ethernet.h containing the API declarations for use by applications.