RTEMS 6.1-rc1
Data Structures | Enumerator | Variables
Enet

Data Structures

struct  _enet_rx_bd_struct
 Defines the receive buffer descriptor structure for the little endian system. More...
 
struct  _enet_tx_bd_struct
 Defines the enhanced transmit buffer descriptor structure for the little endian system. More...
 
struct  _enet_data_error_stats
 Defines the ENET data error statistics structure. More...
 
struct  _enet_rx_frame_error
 Defines the Rx frame error structure. More...
 
struct  _enet_transfer_stats
 Defines the ENET transfer statistics structure. More...
 
struct  enet_frame_info
 Defines the frame info structure. More...
 
struct  _enet_tx_dirty_ring
 Defines the ENET transmit dirty addresses ring/queue structure. More...
 
struct  _enet_buffer_config
 Defines the receive buffer descriptor configuration structure. More...
 
struct  _enet_config
 Defines the basic configuration structure for the ENET device. More...
 
struct  _enet_tx_bd_ring
 Defines the ENET transmit buffer descriptor ring/queue structure. More...
 
struct  _enet_rx_bd_ring
 Defines the ENET receive buffer descriptor ring/queue structure. More...
 
struct  _enet_handle
 Defines the ENET handler structure. More...
 
struct  _enet_buffer_struct
 
struct  _enet_rx_frame_attribute_struct
 
struct  _enet_rx_frame_struct
 
struct  _enet_tx_frame_struct
 

Variables

uint16_t _enet_rx_bd_struct::length
 
uint16_t _enet_rx_bd_struct::control
 
uint32_t _enet_rx_bd_struct::buffer
 
uint16_t _enet_tx_bd_struct::length
 
uint16_t _enet_tx_bd_struct::control
 
uint32_t _enet_tx_bd_struct::buffer
 
uint32_t _enet_data_error_stats::statsRxLenGreaterErr
 
uint32_t _enet_data_error_stats::statsRxAlignErr
 
uint32_t _enet_data_error_stats::statsRxFcsErr
 
uint32_t _enet_data_error_stats::statsRxOverRunErr
 
uint32_t _enet_data_error_stats::statsRxTruncateErr
 
bool _enet_rx_frame_error::statsRxTruncateErr: 1
 
bool _enet_rx_frame_error::statsRxOverRunErr: 1
 
bool _enet_rx_frame_error::statsRxFcsErr: 1
 
bool _enet_rx_frame_error::__pad0__: 1
 
bool _enet_rx_frame_error::statsRxAlignErr: 1
 
bool _enet_rx_frame_error::statsRxLenGreaterErr: 1
 
uint32_t _enet_rx_frame_error::__pad1__: 19
 
uint32_t _enet_transfer_stats::statsRxFrameCount
 
uint32_t _enet_transfer_stats::statsRxFrameOk
 
uint32_t _enet_transfer_stats::statsRxCrcErr
 
uint32_t _enet_transfer_stats::statsRxAlignErr
 
uint32_t _enet_transfer_stats::statsRxDropInvalidSFD
 
uint32_t _enet_transfer_stats::statsRxFifoOverflowErr
 
uint32_t _enet_transfer_stats::statsTxFrameCount
 
uint32_t _enet_transfer_stats::statsTxFrameOk
 
uint32_t _enet_transfer_stats::statsTxCrcAlignErr
 
uint32_t _enet_transfer_stats::statsTxFifoUnderRunErr
 
void * enet_frame_info::context
 
enet_frame_info_t_enet_tx_dirty_ring::txDirtyBase
 
uint16_t _enet_tx_dirty_ring::txGenIdx
 
uint16_t _enet_tx_dirty_ring::txConsumIdx
 
uint16_t _enet_tx_dirty_ring::txRingLen
 
bool _enet_tx_dirty_ring::isFull
 
uint16_t _enet_buffer_config::rxBdNumber
 
uint16_t _enet_buffer_config::txBdNumber
 
uint16_t _enet_buffer_config::rxBuffSizeAlign
 
uint16_t _enet_buffer_config::txBuffSizeAlign
 
volatile enet_rx_bd_struct_t_enet_buffer_config::rxBdStartAddrAlign
 
volatile enet_tx_bd_struct_t_enet_buffer_config::txBdStartAddrAlign
 
uint8_t * _enet_buffer_config::rxBufferAlign
 
uint8_t * _enet_buffer_config::txBufferAlign
 
bool _enet_buffer_config::rxMaintainEnable
 
bool _enet_buffer_config::txMaintainEnable
 
enet_frame_info_t_enet_buffer_config::txFrameInfo
 
uint32_t _enet_config::macSpecialConfig
 
uint32_t _enet_config::interrupt
 
uint16_t _enet_config::rxMaxFrameLen
 
enet_mii_mode_t _enet_config::miiMode
 
enet_mii_speed_t _enet_config::miiSpeed
 
enet_mii_duplex_t _enet_config::miiDuplex
 
uint8_t _enet_config::rxAccelerConfig
 
uint8_t _enet_config::txAccelerConfig
 
uint16_t _enet_config::pauseDuration
 
uint8_t _enet_config::rxFifoEmptyThreshold
 
uint8_t _enet_config::rxFifoFullThreshold
 
uint8_t _enet_config::txFifoWatermark
 
uint8_t _enet_config::ringNum
 
enet_rx_alloc_callback_t _enet_config::rxBuffAlloc
 
enet_rx_free_callback_t _enet_config::rxBuffFree
 
enet_callback_t _enet_config::callback
 
void * _enet_config::userData
 
volatile enet_tx_bd_struct_t_enet_tx_bd_ring::txBdBase
 
uint16_t _enet_tx_bd_ring::txGenIdx
 
uint16_t _enet_tx_bd_ring::txConsumIdx
 
volatile uint16_t _enet_tx_bd_ring::txDescUsed
 
uint16_t _enet_tx_bd_ring::txRingLen
 
volatile enet_rx_bd_struct_t_enet_rx_bd_ring::rxBdBase
 
uint16_t _enet_rx_bd_ring::rxGenIdx
 
uint16_t _enet_rx_bd_ring::rxRingLen
 
enet_rx_bd_ring_t _enet_handle::rxBdRing [FSL_FEATURE_ENET_QUEUE]
 
enet_tx_bd_ring_t _enet_handle::txBdRing [FSL_FEATURE_ENET_QUEUE]
 
uint16_t _enet_handle::rxBuffSizeAlign [FSL_FEATURE_ENET_QUEUE]
 
uint16_t _enet_handle::txBuffSizeAlign [FSL_FEATURE_ENET_QUEUE]
 
bool _enet_handle::rxMaintainEnable [FSL_FEATURE_ENET_QUEUE]
 
bool _enet_handle::txMaintainEnable [FSL_FEATURE_ENET_QUEUE]
 
uint8_t _enet_handle::ringNum
 
enet_callback_t _enet_handle::callback
 
void * _enet_handle::userData
 
enet_tx_dirty_ring_t _enet_handle::txDirtyRing [FSL_FEATURE_ENET_QUEUE]
 
bool _enet_handle::txReclaimEnable [FSL_FEATURE_ENET_QUEUE]
 
enet_rx_alloc_callback_t _enet_handle::rxBuffAlloc
 
enet_rx_free_callback_t _enet_handle::rxBuffFree
 
uint8_t _enet_handle::multicastCount [64]
 
void * _enet_buffer_struct::buffer
 
uint16_t _enet_buffer_struct::length
 
bool _enet_rx_frame_attribute_struct::promiscuous
 
enet_buffer_struct_t_enet_rx_frame_struct::rxBuffArray
 
uint16_t _enet_rx_frame_struct::totLen
 
enet_rx_frame_attribute_t _enet_rx_frame_struct::rxAttribute
 
enet_rx_frame_error_t _enet_rx_frame_struct::rxFrameError
 
enet_buffer_struct_t_enet_tx_frame_struct::txBuffArray
 
uint32_t _enet_tx_frame_struct::txBuffNum
 
void * _enet_tx_frame_struct::context
 

Defines some Ethernet parameters.

enum  {
  kStatus_ENET_InitMemoryFail , kStatus_ENET_RxFrameError = MAKE_STATUS(kStatusGroup_ENET, 1U) , kStatus_ENET_RxFrameFail = MAKE_STATUS(kStatusGroup_ENET, 2U) , kStatus_ENET_RxFrameEmpty = MAKE_STATUS(kStatusGroup_ENET, 3U) ,
  kStatus_ENET_RxFrameDrop = MAKE_STATUS(kStatusGroup_ENET, 4U) , kStatus_ENET_TxFrameOverLen = MAKE_STATUS(kStatusGroup_ENET, 5U) , kStatus_ENET_TxFrameBusy = MAKE_STATUS(kStatusGroup_ENET, 6U) , kStatus_ENET_TxFrameFail = MAKE_STATUS(kStatusGroup_ENET, 7U)
}
 Defines the status return codes for transaction. More...
 
enum  _enet_mii_mode { kENET_MiiMode = 0U , kENET_RmiiMode = 1U }
 Defines the MII/RMII/RGMII mode for data interface between the MAC and the PHY. More...
 
enum  _enet_mii_speed { kENET_MiiSpeed10M = 0U , kENET_MiiSpeed100M = 1U }
 Defines the 10/100/1000 Mbps speed for the MII data interface. More...
 
enum  _enet_mii_duplex { kENET_MiiHalfDuplex = 0U , kENET_MiiFullDuplex }
 Defines the half or full duplex for the MII data interface. More...
 
enum  _enet_mii_write { kENET_MiiWriteNoCompliant = 0U , kENET_MiiWriteValidFrame }
 Define the MII opcode for normal MDIO_CLAUSES_22 Frame. More...
 
enum  _enet_mii_read { kENET_MiiReadValidFrame = 2U , kENET_MiiReadNoCompliant = 3U }
 Defines the read operation for the MII management frame. More...
 
enum  _enet_special_control_flag {
  kENET_ControlFlowControlEnable = 0x0001U , kENET_ControlRxPayloadCheckEnable = 0x0002U , kENET_ControlRxPadRemoveEnable = 0x0004U , kENET_ControlRxBroadCastRejectEnable = 0x0008U ,
  kENET_ControlMacAddrInsert = 0x0010U , kENET_ControlStoreAndFwdDisable = 0x0020U , kENET_ControlSMIPreambleDisable = 0x0040U , kENET_ControlPromiscuousEnable = 0x0080U ,
  kENET_ControlMIILoopEnable = 0x0100U , kENET_ControlVLANTagEnable = 0x0200U
}
 Defines a special configuration for ENET MAC controller. More...
 
enum  _enet_interrupt_enable {
  kENET_BabrInterrupt = ENET_EIR_BABR_MASK , kENET_BabtInterrupt = ENET_EIR_BABT_MASK , kENET_GraceStopInterrupt = ENET_EIR_GRA_MASK , kENET_TxFrameInterrupt = ENET_EIR_TXF_MASK ,
  kENET_TxBufferInterrupt = ENET_EIR_TXB_MASK , kENET_RxFrameInterrupt = ENET_EIR_RXF_MASK , kENET_RxBufferInterrupt = ENET_EIR_RXB_MASK , kENET_MiiInterrupt = ENET_EIR_MII_MASK ,
  kENET_EBusERInterrupt = ENET_EIR_EBERR_MASK , kENET_LateCollisionInterrupt = ENET_EIR_LC_MASK , kENET_RetryLimitInterrupt = ENET_EIR_RL_MASK , kENET_UnderrunInterrupt = ENET_EIR_UN_MASK ,
  kENET_PayloadRxInterrupt = ENET_EIR_PLR_MASK , kENET_WakeupInterrupt = ENET_EIR_WAKEUP_MASK , kENET_TsAvailInterrupt = ENET_EIR_TS_AVAIL_MASK , kENET_TsTimerInterrupt = ENET_EIR_TS_TIMER_MASK
}
 List of interrupts supported by the peripheral. This enumeration uses one-bit encoding to allow a logical OR of multiple members. Members usually map to interrupt enable bits in one or more peripheral registers. More...
 
enum  _enet_event {
  kENET_RxEvent , kENET_TxEvent , kENET_ErrEvent , kENET_WakeUpEvent ,
  kENET_TimeStampEvent , kENET_TimeStampAvailEvent
}
 Defines the common interrupt event for callback use. More...
 
enum  _enet_tx_accelerator { kENET_TxAccelIsShift16Enabled = ENET_TACC_SHIFT16_MASK , kENET_TxAccelIpCheckEnabled = ENET_TACC_IPCHK_MASK , kENET_TxAccelProtoCheckEnabled = ENET_TACC_PROCHK_MASK }
 Defines the transmit accelerator configuration. More...
 
enum  _enet_rx_accelerator {
  kENET_RxAccelPadRemoveEnabled = ENET_RACC_PADREM_MASK , kENET_RxAccelIpCheckEnabled = ENET_RACC_IPDIS_MASK , kENET_RxAccelProtoCheckEnabled = ENET_RACC_PRODIS_MASK , kENET_RxAccelMacCheckEnabled = ENET_RACC_LINEDIS_MASK ,
  kENET_RxAccelisShift16Enabled = ENET_RACC_SHIFT16_MASK
}
 Defines the receive accelerator configuration. More...
 
typedef enum _enet_mii_mode enet_mii_mode_t
 Defines the MII/RMII/RGMII mode for data interface between the MAC and the PHY.
 
typedef enum _enet_mii_speed enet_mii_speed_t
 Defines the 10/100/1000 Mbps speed for the MII data interface. More...
 
typedef enum _enet_mii_duplex enet_mii_duplex_t
 Defines the half or full duplex for the MII data interface.
 
typedef enum _enet_mii_write enet_mii_write_t
 Define the MII opcode for normal MDIO_CLAUSES_22 Frame.
 
typedef enum _enet_mii_read enet_mii_read_t
 Defines the read operation for the MII management frame.
 
typedef enum _enet_special_control_flag enet_special_control_flag_t
 Defines a special configuration for ENET MAC controller. More...
 
typedef enum _enet_interrupt_enable enet_interrupt_enable_t
 List of interrupts supported by the peripheral. This enumeration uses one-bit encoding to allow a logical OR of multiple members. Members usually map to interrupt enable bits in one or more peripheral registers.
 
typedef enum _enet_event enet_event_t
 Defines the common interrupt event for callback use.
 
typedef enum _enet_tx_accelerator enet_tx_accelerator_t
 Defines the transmit accelerator configuration.
 
typedef enum _enet_rx_accelerator enet_rx_accelerator_t
 Defines the receive accelerator configuration.
 
typedef struct _enet_rx_bd_struct enet_rx_bd_struct_t
 Defines the receive buffer descriptor structure for the little endian system.
 
typedef struct _enet_tx_bd_struct enet_tx_bd_struct_t
 Defines the enhanced transmit buffer descriptor structure for the little endian system.
 
typedef struct _enet_data_error_stats enet_data_error_stats_t
 Defines the ENET data error statistics structure.
 
typedef struct _enet_rx_frame_error enet_rx_frame_error_t
 Defines the Rx frame error structure.
 
typedef struct _enet_transfer_stats enet_transfer_stats_t
 Defines the ENET transfer statistics structure.
 
typedef struct enet_frame_info enet_frame_info_t
 Defines the frame info structure.
 
typedef struct _enet_tx_dirty_ring enet_tx_dirty_ring_t
 Defines the ENET transmit dirty addresses ring/queue structure.
 
typedef void *(* enet_rx_alloc_callback_t) (ENET_Type *base, void *userData, uint8_t ringId)
 Defines the ENET Rx memory buffer alloc function pointer.
 
typedef void(* enet_rx_free_callback_t) (ENET_Type *base, void *buffer, void *userData, uint8_t ringId)
 Defines the ENET Rx memory buffer free function pointer.
 
typedef struct _enet_buffer_config enet_buffer_config_t
 Defines the receive buffer descriptor configuration structure. More...
 
typedef struct _enet_handle enet_handle_t
 
typedef void(* enet_callback_t) (ENET_Type *base, enet_handle_t *handle, enet_event_t event, enet_frame_info_t *frameInfo, void *userData)
 ENET callback function.
 
typedef struct _enet_config enet_config_t
 Defines the basic configuration structure for the ENET device. More...
 
typedef struct _enet_tx_bd_ring enet_tx_bd_ring_t
 Defines the ENET transmit buffer descriptor ring/queue structure.
 
typedef struct _enet_rx_bd_ring enet_rx_bd_ring_t
 Defines the ENET receive buffer descriptor ring/queue structure.
 
typedef struct _enet_buffer_struct enet_buffer_struct_t
 
typedef struct _enet_rx_frame_attribute_struct enet_rx_frame_attribute_t
 
typedef struct _enet_rx_frame_struct enet_rx_frame_struct_t
 
typedef struct _enet_tx_frame_struct enet_tx_frame_struct_t
 
typedef void(* enet_isr_t) (ENET_Type *base, enet_handle_t *handle)
 Define interrupt IRQ handler.
 
const clock_ip_name_t s_enetClock []
 Pointers to enet clocks for each instance.
 
uint32_t ENET_GetInstance (ENET_Type *base)
 Get the ENET instance from peripheral base address. More...
 
#define ENET_FRAME_MAX_FRAMELEN   1518U
 
#define ENET_FRAME_VLAN_TAGLEN   4U
 
#define ENET_FRAME_CRC_LEN   4U
 
#define ENET_FRAME_TX_LEN_LIMITATION(x)    ((((x)->RCR & ENET_RCR_MAX_FL_MASK) >> ENET_RCR_MAX_FL_SHIFT) - ENET_FRAME_CRC_LEN)
 
#define ENET_FIFO_MIN_RX_FULL   5U
 
#define ENET_RX_MIN_BUFFERSIZE   256U
 
#define ENET_PHY_MAXADDRESS   (ENET_MMFR_PA_MASK >> ENET_MMFR_PA_SHIFT)
 
#define ENET_TX_INTERRUPT    ((uint32_t)kENET_TxFrameInterrupt | (uint32_t)kENET_TxBufferInterrupt)
 
#define ENET_RX_INTERRUPT    ((uint32_t)kENET_RxFrameInterrupt | (uint32_t)kENET_RxBufferInterrupt)
 
#define ENET_TS_INTERRUPT    ((uint32_t)kENET_TsTimerInterrupt | (uint32_t)kENET_TsAvailInterrupt)
 
#define ENET_ERR_INTERRUPT
 

Initialization and De-initialization

void ENET_GetDefaultConfig (enet_config_t *config)
 Gets the ENET default configuration structure. More...
 
status_t ENET_Up (ENET_Type *base, enet_handle_t *handle, const enet_config_t *config, const enet_buffer_config_t *bufferConfig, uint8_t *macAddr, uint32_t srcClock_Hz)
 Initializes the ENET module. More...
 
status_t ENET_Init (ENET_Type *base, enet_handle_t *handle, const enet_config_t *config, const enet_buffer_config_t *bufferConfig, uint8_t *macAddr, uint32_t srcClock_Hz)
 Initializes the ENET module. More...
 
void ENET_Down (ENET_Type *base)
 Stops the ENET module. More...
 
void ENET_Deinit (ENET_Type *base)
 Deinitializes the ENET module. More...
 

MII interface operation

void ENET_SetMII (ENET_Type *base, enet_mii_speed_t speed, enet_mii_duplex_t duplex)
 Sets the ENET MII speed and duplex. More...
 
void ENET_SetSMI (ENET_Type *base, uint32_t srcClock_Hz, bool isPreambleDisabled)
 Sets the ENET SMI(serial management interface)- MII management interface. More...
 
status_t ENET_MDIOWrite (ENET_Type *base, uint8_t phyAddr, uint8_t regAddr, uint16_t data)
 MDIO write with IEEE802.3 Clause 22 format. More...
 
status_t ENET_MDIORead (ENET_Type *base, uint8_t phyAddr, uint8_t regAddr, uint16_t *pData)
 MDIO read with IEEE802.3 Clause 22 format. More...
 

MAC Address Filter

void ENET_SetMacAddr (ENET_Type *base, uint8_t *macAddr)
 Sets the ENET module Mac address. More...
 
void ENET_GetMacAddr (ENET_Type *base, uint8_t *macAddr)
 Gets the ENET module Mac address. More...
 
void ENET_AddMulticastGroup (ENET_Type *base, uint8_t *address)
 Adds the ENET device to a multicast group. More...
 
void ENET_LeaveMulticastGroup (ENET_Type *base, uint8_t *address)
 Moves the ENET device from a multicast group. More...
 

Interrupts.

void ENET_SetRxISRHandler (ENET_Type *base, enet_isr_t ISRHandler)
 Set the second level Rx IRQ handler. More...
 
void ENET_SetTxISRHandler (ENET_Type *base, enet_isr_t ISRHandler)
 Set the second level Tx IRQ handler. More...
 
void ENET_SetErrISRHandler (ENET_Type *base, enet_isr_t ISRHandler)
 Set the second level Err IRQ handler. More...
 

Transactional operation

void ENET_SetCallback (enet_handle_t *handle, enet_callback_t callback, void *userData)
 Sets the callback function. More...
 
void ENET_GetRxErrBeforeReadFrame (enet_handle_t *handle, enet_data_error_stats_t *eErrorStatic, uint8_t ringId)
 Gets the error statistics of a received frame for ENET specified ring. More...
 
void ENET_GetStatistics (ENET_Type *base, enet_transfer_stats_t *statistics)
 Gets statistical data in transfer. More...
 
status_t ENET_GetRxFrameSize (enet_handle_t *handle, uint32_t *length, uint8_t ringId)
 Gets the size of the read frame for specified ring. More...
 
status_t ENET_ReadFrame (ENET_Type *base, enet_handle_t *handle, uint8_t *data, uint32_t length, uint8_t ringId, uint32_t *ts)
 Reads a frame from the ENET device. This function reads a frame (both the data and the length) from the ENET buffer descriptors. User can get timestamp through ts pointer if the ts is not NULL. More...
 
status_t ENET_SendFrame (ENET_Type *base, enet_handle_t *handle, const uint8_t *data, uint32_t length, uint8_t ringId, bool tsFlag, void *context)
 Transmits an ENET frame for specified ring. More...
 
status_t ENET_SetTxReclaim (enet_handle_t *handle, bool isEnable, uint8_t ringId)
 Enable or disable tx descriptors reclaim mechanism. More...
 
void ENET_ReclaimTxDescriptor (ENET_Type *base, enet_handle_t *handle, uint8_t ringId)
 Reclaim tx descriptors. This function is used to update the tx descriptor status and store the tx timestamp when the 1588 feature is enabled. This is called by the transmit interupt IRQ handler after the complete of a frame transmission. More...
 
status_t ENET_GetRxBuffer (ENET_Type *base, enet_handle_t *handle, void **buffer, uint32_t *length, uint8_t ringId, bool *isLastBuff, uint32_t *ts)
 Get a receive buffer pointer of the ENET device for specified ring. More...
 
void ENET_ReleaseRxBuffer (ENET_Type *base, enet_handle_t *handle, void *buffer, uint8_t ringId)
 Release receive buffer descriptor to DMA. More...
 
status_t ENET_GetRxFrame (ENET_Type *base, enet_handle_t *handle, enet_rx_frame_struct_t *rxFrame, uint8_t ringId)
 Receives one frame in specified BD ring with zero copy. More...
 
status_t ENET_StartTxFrame (ENET_Type *base, enet_handle_t *handle, enet_tx_frame_struct_t *txFrame, uint8_t ringId)
 Sends one frame in specified BD ring with zero copy. More...
 
status_t ENET_SendFrameZeroCopy (ENET_Type *base, enet_handle_t *handle, const uint8_t *data, uint32_t length, uint8_t ringId, bool tsFlag, void *context)
 Transmits an ENET frame for specified ring with zero-copy. More...
 
void ENET_TransmitIRQHandler (ENET_Type *base, enet_handle_t *handle)
 The transmit IRQ handler. More...
 
void ENET_ReceiveIRQHandler (ENET_Type *base, enet_handle_t *handle)
 The receive IRQ handler. More...
 
void ENET_ErrorIRQHandler (ENET_Type *base, enet_handle_t *handle)
 Some special IRQ handler including the error, mii, wakeup irq handler. More...
 
void ENET_Ptp1588IRQHandler (ENET_Type *base)
 the common IRQ handler for the 1588 irq handler. More...
 
void ENET_CommonFrame0IRQHandler (ENET_Type *base)
 the common IRQ handler for the tx/rx/error etc irq handler. More...
 

Driver version

#define FSL_ENET_DRIVER_VERSION   (MAKE_VERSION(2, 6, 3))
 Defines the driver version.
 

ENET DESCRIPTOR QUEUE

#define FSL_FEATURE_ENET_QUEUE   1 /* Singal queue for previous IP. */
 Defines the queue number.
 

Control and status region bit masks of the receive buffer descriptor.

#define ENET_BUFFDESCRIPTOR_RX_EMPTY_MASK   0x8000U
 
#define ENET_BUFFDESCRIPTOR_RX_SOFTOWNER1_MASK   0x4000U
 
#define ENET_BUFFDESCRIPTOR_RX_WRAP_MASK   0x2000U
 
#define ENET_BUFFDESCRIPTOR_RX_SOFTOWNER2_Mask   0x1000U
 
#define ENET_BUFFDESCRIPTOR_RX_LAST_MASK   0x0800U
 
#define ENET_BUFFDESCRIPTOR_RX_MISS_MASK   0x0100U
 
#define ENET_BUFFDESCRIPTOR_RX_BROADCAST_MASK   0x0080U
 
#define ENET_BUFFDESCRIPTOR_RX_MULTICAST_MASK   0x0040U
 
#define ENET_BUFFDESCRIPTOR_RX_LENVLIOLATE_MASK   0x0020U
 
#define ENET_BUFFDESCRIPTOR_RX_NOOCTET_MASK   0x0010U
 
#define ENET_BUFFDESCRIPTOR_RX_CRC_MASK   0x0004U
 
#define ENET_BUFFDESCRIPTOR_RX_OVERRUN_MASK   0x0002U
 
#define ENET_BUFFDESCRIPTOR_RX_TRUNC_MASK   0x0001U
 

Control and status bit masks of the transmit buffer descriptor.

#define ENET_BUFFDESCRIPTOR_TX_READY_MASK   0x8000U
 
#define ENET_BUFFDESCRIPTOR_TX_SOFTOWENER1_MASK   0x4000U
 
#define ENET_BUFFDESCRIPTOR_TX_WRAP_MASK   0x2000U
 
#define ENET_BUFFDESCRIPTOR_TX_SOFTOWENER2_MASK   0x1000U
 
#define ENET_BUFFDESCRIPTOR_TX_LAST_MASK   0x0800U
 
#define ENET_BUFFDESCRIPTOR_TX_TRANMITCRC_MASK   0x0400U
 
#define ENET_BUFFDESCRIPTOR_RX_ERR_MASK
 Defines the receive error status flag mask. More...
 

Detailed Description

Macro Definition Documentation

◆ ENET_BUFFDESCRIPTOR_RX_BROADCAST_MASK

#define ENET_BUFFDESCRIPTOR_RX_BROADCAST_MASK   0x0080U

Broadcast packet mask.

◆ ENET_BUFFDESCRIPTOR_RX_CRC_MASK

#define ENET_BUFFDESCRIPTOR_RX_CRC_MASK   0x0004U

CRC error mask.

◆ ENET_BUFFDESCRIPTOR_RX_EMPTY_MASK

#define ENET_BUFFDESCRIPTOR_RX_EMPTY_MASK   0x8000U

Empty bit mask.

◆ ENET_BUFFDESCRIPTOR_RX_ERR_MASK

#define ENET_BUFFDESCRIPTOR_RX_ERR_MASK
Value:
ENET_BUFFDESCRIPTOR_RX_LENVLIOLATE_MASK | ENET_BUFFDESCRIPTOR_RX_NOOCTET_MASK | ENET_BUFFDESCRIPTOR_RX_CRC_MASK)
#define ENET_BUFFDESCRIPTOR_RX_OVERRUN_MASK
Definition: fsl_enet.h:51
#define ENET_BUFFDESCRIPTOR_RX_CRC_MASK
Definition: fsl_enet.h:50
#define ENET_BUFFDESCRIPTOR_RX_NOOCTET_MASK
Definition: fsl_enet.h:49
#define ENET_BUFFDESCRIPTOR_RX_TRUNC_MASK
Definition: fsl_enet.h:52

Defines the receive error status flag mask.

◆ ENET_BUFFDESCRIPTOR_RX_LAST_MASK

#define ENET_BUFFDESCRIPTOR_RX_LAST_MASK   0x0800U

Last BD of the frame mask.

◆ ENET_BUFFDESCRIPTOR_RX_LENVLIOLATE_MASK

#define ENET_BUFFDESCRIPTOR_RX_LENVLIOLATE_MASK   0x0020U

Length violation mask.

◆ ENET_BUFFDESCRIPTOR_RX_MISS_MASK

#define ENET_BUFFDESCRIPTOR_RX_MISS_MASK   0x0100U

Received because of the promiscuous mode.

◆ ENET_BUFFDESCRIPTOR_RX_MULTICAST_MASK

#define ENET_BUFFDESCRIPTOR_RX_MULTICAST_MASK   0x0040U

Multicast packet mask.

◆ ENET_BUFFDESCRIPTOR_RX_NOOCTET_MASK

#define ENET_BUFFDESCRIPTOR_RX_NOOCTET_MASK   0x0010U

Non-octet aligned frame mask.

◆ ENET_BUFFDESCRIPTOR_RX_OVERRUN_MASK

#define ENET_BUFFDESCRIPTOR_RX_OVERRUN_MASK   0x0002U

FIFO overrun mask.

◆ ENET_BUFFDESCRIPTOR_RX_SOFTOWNER1_MASK

#define ENET_BUFFDESCRIPTOR_RX_SOFTOWNER1_MASK   0x4000U

Software owner one mask.

◆ ENET_BUFFDESCRIPTOR_RX_SOFTOWNER2_Mask

#define ENET_BUFFDESCRIPTOR_RX_SOFTOWNER2_Mask   0x1000U

Software owner two mask.

◆ ENET_BUFFDESCRIPTOR_RX_TRUNC_MASK

#define ENET_BUFFDESCRIPTOR_RX_TRUNC_MASK   0x0001U

Frame is truncated mask.

◆ ENET_BUFFDESCRIPTOR_RX_WRAP_MASK

#define ENET_BUFFDESCRIPTOR_RX_WRAP_MASK   0x2000U

Next buffer descriptor is the start address.

◆ ENET_BUFFDESCRIPTOR_TX_LAST_MASK

#define ENET_BUFFDESCRIPTOR_TX_LAST_MASK   0x0800U

Last BD of the frame mask.

◆ ENET_BUFFDESCRIPTOR_TX_READY_MASK

#define ENET_BUFFDESCRIPTOR_TX_READY_MASK   0x8000U

Ready bit mask.

◆ ENET_BUFFDESCRIPTOR_TX_SOFTOWENER1_MASK

#define ENET_BUFFDESCRIPTOR_TX_SOFTOWENER1_MASK   0x4000U

Software owner one mask.

◆ ENET_BUFFDESCRIPTOR_TX_SOFTOWENER2_MASK

#define ENET_BUFFDESCRIPTOR_TX_SOFTOWENER2_MASK   0x1000U

Software owner two mask.

◆ ENET_BUFFDESCRIPTOR_TX_TRANMITCRC_MASK

#define ENET_BUFFDESCRIPTOR_TX_TRANMITCRC_MASK   0x0400U

Transmit CRC mask.

◆ ENET_BUFFDESCRIPTOR_TX_WRAP_MASK

#define ENET_BUFFDESCRIPTOR_TX_WRAP_MASK   0x2000U

Wrap buffer descriptor mask.

◆ ENET_ERR_INTERRUPT

#define ENET_ERR_INTERRUPT
Value:
((uint32_t)kENET_BabrInterrupt | (uint32_t)kENET_BabtInterrupt | (uint32_t)kENET_EBusERInterrupt | \
@ kENET_BabtInterrupt
Definition: fsl_enet.h:262
@ kENET_LateCollisionInterrupt
Definition: fsl_enet.h:270
@ kENET_UnderrunInterrupt
Definition: fsl_enet.h:272
@ kENET_BabrInterrupt
Definition: fsl_enet.h:261
@ kENET_RetryLimitInterrupt
Definition: fsl_enet.h:271
@ kENET_EBusERInterrupt
Definition: fsl_enet.h:269
@ kENET_PayloadRxInterrupt
Definition: fsl_enet.h:273

Enet error interrupt flag.

◆ ENET_FIFO_MIN_RX_FULL

#define ENET_FIFO_MIN_RX_FULL   5U

ENET minimum receive FIFO full.

◆ ENET_FRAME_CRC_LEN

#define ENET_FRAME_CRC_LEN   4U

CRC size in a frame.

◆ ENET_FRAME_MAX_FRAMELEN

#define ENET_FRAME_MAX_FRAMELEN   1518U

Default maximum Ethernet frame size without VLAN tag.

◆ ENET_FRAME_VLAN_TAGLEN

#define ENET_FRAME_VLAN_TAGLEN   4U

Ethernet single VLAN tag size.

◆ ENET_PHY_MAXADDRESS

#define ENET_PHY_MAXADDRESS   (ENET_MMFR_PA_MASK >> ENET_MMFR_PA_SHIFT)

Maximum PHY address.

◆ ENET_RX_INTERRUPT

#define ENET_RX_INTERRUPT    ((uint32_t)kENET_RxFrameInterrupt | (uint32_t)kENET_RxBufferInterrupt)

Enet Rx interrupt flag.

◆ ENET_RX_MIN_BUFFERSIZE

#define ENET_RX_MIN_BUFFERSIZE   256U

ENET minimum buffer size.

◆ ENET_TS_INTERRUPT

#define ENET_TS_INTERRUPT    ((uint32_t)kENET_TsTimerInterrupt | (uint32_t)kENET_TsAvailInterrupt)

Enet timestamp interrupt flag.

◆ ENET_TX_INTERRUPT

#define ENET_TX_INTERRUPT    ((uint32_t)kENET_TxFrameInterrupt | (uint32_t)kENET_TxBufferInterrupt)

Enet Tx interrupt flag.

Typedef Documentation

◆ enet_buffer_config_t

Defines the receive buffer descriptor configuration structure.

Note that for the internal DMA requirements, the buffers have a corresponding alignment requirements.

  1. The aligned receive and transmit buffer size must be evenly divisible by ENET_BUFF_ALIGNMENT. when the data buffers are in cacheable region when cache is enabled, all those size should be aligned to the maximum value of "ENET_BUFF_ALIGNMENT" and the cache line size.
  2. The aligned transmit and receive buffer descriptor start address must be at least 64 bit aligned. However, it's recommended to be evenly divisible by ENET_BUFF_ALIGNMENT. buffer descriptors should be put in non-cacheable region when cache is enabled.
  3. The aligned transmit and receive data buffer start address must be evenly divisible by ENET_BUFF_ALIGNMENT. Receive buffers should be continuous with the total size equal to "rxBdNumber * rxBuffSizeAlign". Transmit buffers should be continuous with the total size equal to "txBdNumber * txBuffSizeAlign". when the data buffers are in cacheable region when cache is enabled, all those size should be aligned to the maximum value of "ENET_BUFF_ALIGNMENT" and the cache line size.

◆ enet_config_t

typedef struct _enet_config enet_config_t

Defines the basic configuration structure for the ENET device.

Note:

  1. macSpecialConfig is used for a special control configuration, A logical OR of "enet_special_control_flag_t". For a special configuration for MAC, set this parameter to 0.
  2. txWatermark is used for a cut-through operation. It is in steps of 64 bytes: 0/1 - 64 bytes written to TX FIFO before transmission of a frame begins. 2 - 128 bytes written to TX FIFO .... 3 - 192 bytes written to TX FIFO .... The maximum of txWatermark is 0x2F - 4032 bytes written to TX FIFO .... txWatermark allows minimizing the transmit latency to set the txWatermark to 0 or 1 or for larger bus access latency 3 or larger due to contention for the system bus.
  3. rxFifoFullThreshold is similar to the txWatermark for cut-through operation in RX. It is in 64-bit words. The minimum is ENET_FIFO_MIN_RX_FULL and the maximum is 0xFF. If the end of the frame is stored in FIFO and the frame size if smaller than the txWatermark, the frame is still transmitted. The rule is the same for rxFifoFullThreshold in the receive direction.
  4. When "kENET_ControlFlowControlEnable" is set in the macSpecialConfig, ensure that the pauseDuration, rxFifoEmptyThreshold, and rxFifoStatEmptyThreshold are set for flow control enabled case.
  5. When "kENET_ControlStoreAndFwdDisabled" is set in the macSpecialConfig, ensure that the rxFifoFullThreshold and txFifoWatermark are set for store and forward disable.
  6. The rxAccelerConfig and txAccelerConfig default setting with 0 - accelerator are disabled. The "enet_tx_accelerator_t" and "enet_rx_accelerator_t" are recommended to be used to enable the transmit and receive accelerator. After the accelerators are enabled, the store and forward feature should be enabled. As a result, kENET_ControlStoreAndFwdDisabled should not be set.
  7. The intCoalesceCfg can be used in the rx or tx enabled cases to decrese the CPU loading.

◆ enet_mii_speed_t

Defines the 10/100/1000 Mbps speed for the MII data interface.

Notice: "kENET_MiiSpeed1000M" only supported when mii mode is "kENET_RgmiiMode".

◆ enet_special_control_flag_t

Defines a special configuration for ENET MAC controller.

These control flags are provided for special user requirements. Normally, these control flags are unused for ENET initialization. For special requirements, set the flags to macSpecialConfig in the enet_config_t. The kENET_ControlStoreAndFwdDisable is used to disable the FIFO store and forward. FIFO store and forward means that the FIFO read/send is started when a complete frame is stored in TX/RX FIFO. If this flag is set, configure rxFifoFullThreshold and txFifoWatermark in the enet_config_t.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Defines the status return codes for transaction.

Enumerator
kStatus_ENET_InitMemoryFail 

Init fails since buffer memory is not enough.

kStatus_ENET_RxFrameError 

A frame received but data error happen.

kStatus_ENET_RxFrameFail 

Failed to receive a frame.

kStatus_ENET_RxFrameEmpty 

No frame arrive.

kStatus_ENET_RxFrameDrop 

Rx frame is dropped since no buffer memory.

kStatus_ENET_TxFrameOverLen 

Tx frame over length.

kStatus_ENET_TxFrameBusy 

Tx buffer descriptors are under process.

kStatus_ENET_TxFrameFail 

Transmit frame fail.

◆ _enet_event

Defines the common interrupt event for callback use.

Enumerator
kENET_RxEvent 

Receive event.

kENET_TxEvent 

Transmit event.

kENET_ErrEvent 

Error event: BABR/BABT/EBERR/LC/RL/UN/PLR .

kENET_WakeUpEvent 

Wake up from sleep mode event.

kENET_TimeStampEvent 

Time stamp event.

kENET_TimeStampAvailEvent 

Time stamp available event.

◆ _enet_interrupt_enable

List of interrupts supported by the peripheral. This enumeration uses one-bit encoding to allow a logical OR of multiple members. Members usually map to interrupt enable bits in one or more peripheral registers.

Enumerator
kENET_BabrInterrupt 

Babbling receive error interrupt source

kENET_BabtInterrupt 

Babbling transmit error interrupt source

kENET_GraceStopInterrupt 

Graceful stop complete interrupt source

kENET_TxFrameInterrupt 

TX FRAME interrupt source

kENET_TxBufferInterrupt 

TX BUFFER interrupt source

kENET_RxFrameInterrupt 

RX FRAME interrupt source

kENET_RxBufferInterrupt 

RX BUFFER interrupt source

kENET_MiiInterrupt 

MII interrupt source

kENET_EBusERInterrupt 

Ethernet bus error interrupt source

kENET_LateCollisionInterrupt 

Late collision interrupt source

kENET_RetryLimitInterrupt 

Collision Retry Limit interrupt source

kENET_UnderrunInterrupt 

Transmit FIFO underrun interrupt source

kENET_PayloadRxInterrupt 

Payload Receive error interrupt source

kENET_WakeupInterrupt 

WAKEUP interrupt source

kENET_TsAvailInterrupt 

TS AVAIL interrupt source for PTP

kENET_TsTimerInterrupt 

TS WRAP interrupt source for PTP

◆ _enet_mii_duplex

Defines the half or full duplex for the MII data interface.

Enumerator
kENET_MiiHalfDuplex 

Half duplex mode.

kENET_MiiFullDuplex 

Full duplex mode.

◆ _enet_mii_mode

Defines the MII/RMII/RGMII mode for data interface between the MAC and the PHY.

Enumerator
kENET_MiiMode 

MII mode for data interface.

kENET_RmiiMode 

RMII mode for data interface.

◆ _enet_mii_read

Defines the read operation for the MII management frame.

Enumerator
kENET_MiiReadValidFrame 

Read frame operation for a valid MII management frame.

kENET_MiiReadNoCompliant 

Read frame operation, but not MII-compliant.

◆ _enet_mii_speed

Defines the 10/100/1000 Mbps speed for the MII data interface.

Notice: "kENET_MiiSpeed1000M" only supported when mii mode is "kENET_RgmiiMode".

Enumerator
kENET_MiiSpeed10M 

Speed 10 Mbps.

kENET_MiiSpeed100M 

Speed 100 Mbps.

◆ _enet_mii_write

Define the MII opcode for normal MDIO_CLAUSES_22 Frame.

Enumerator
kENET_MiiWriteNoCompliant 

Write frame operation, but not MII-compliant.

kENET_MiiWriteValidFrame 

Write frame operation for a valid MII management frame.

◆ _enet_rx_accelerator

Defines the receive accelerator configuration.

Enumerator
kENET_RxAccelPadRemoveEnabled 

Padding removal for short IP frames.

kENET_RxAccelIpCheckEnabled 

Discard with wrong IP header checksum.

kENET_RxAccelProtoCheckEnabled 

Discard with wrong protocol checksum.

kENET_RxAccelMacCheckEnabled 

Discard with Mac layer errors.

kENET_RxAccelisShift16Enabled 

Receive FIFO shift-16.

◆ _enet_special_control_flag

Defines a special configuration for ENET MAC controller.

These control flags are provided for special user requirements. Normally, these control flags are unused for ENET initialization. For special requirements, set the flags to macSpecialConfig in the enet_config_t. The kENET_ControlStoreAndFwdDisable is used to disable the FIFO store and forward. FIFO store and forward means that the FIFO read/send is started when a complete frame is stored in TX/RX FIFO. If this flag is set, configure rxFifoFullThreshold and txFifoWatermark in the enet_config_t.

Enumerator
kENET_ControlFlowControlEnable 

Enable ENET flow control: pause frame.

kENET_ControlRxPayloadCheckEnable 

Enable ENET receive payload length check.

kENET_ControlRxPadRemoveEnable 

Padding is removed from received frames.

kENET_ControlRxBroadCastRejectEnable 

Enable broadcast frame reject.

kENET_ControlMacAddrInsert 

Enable MAC address insert.

kENET_ControlStoreAndFwdDisable 

Enable FIFO store and forward.

kENET_ControlSMIPreambleDisable 

Enable SMI preamble.

kENET_ControlPromiscuousEnable 

Enable promiscuous mode.

kENET_ControlMIILoopEnable 

Enable ENET MII loop back.

kENET_ControlVLANTagEnable 

Enable normal VLAN (single vlan tag).

◆ _enet_tx_accelerator

Defines the transmit accelerator configuration.

Enumerator
kENET_TxAccelIsShift16Enabled 

Transmit FIFO shift-16.

kENET_TxAccelIpCheckEnabled 

Insert IP header checksum.

kENET_TxAccelProtoCheckEnabled 

Insert protocol checksum.

Function Documentation

◆ ENET_AddMulticastGroup()

void ENET_AddMulticastGroup ( ENET_Type base,
uint8_t *  address 
)

Adds the ENET device to a multicast group.

Parameters
baseENET peripheral base address.
addressThe six-byte multicast group address which is provided by application.

brief Adds the ENET device to a multicast group.

param base ENET peripheral base address. param address The six-byte multicast group address which is provided by application.

◆ ENET_CommonFrame0IRQHandler()

void ENET_CommonFrame0IRQHandler ( ENET_Type base)

the common IRQ handler for the tx/rx/error etc irq handler.

This is used for the combined tx/rx/error interrupt for single/mutli-ring (frame 0).

Parameters
baseENET peripheral base address.

brief the common IRQ handler for the tx/rx/error etc irq handler.

This is used for the combined tx/rx/error interrupt for single/mutli-ring (frame 0).

param base ENET peripheral base address.

◆ ENET_Deinit()

void ENET_Deinit ( ENET_Type base)

Deinitializes the ENET module.

This function gates the module clock, clears ENET interrupts, and disables the ENET module.

Parameters
baseENET peripheral base address.

brief Deinitializes the ENET module.

This function gates the module clock, clears ENET interrupts, and disables the ENET module.

param base ENET peripheral base address.

◆ ENET_Down()

void ENET_Down ( ENET_Type base)

Stops the ENET module.

This function disables the ENET module.

Parameters
baseENET peripheral base address.

brief Stops the ENET module.

This function disables the ENET module.

param base ENET peripheral base address.

◆ ENET_ErrorIRQHandler()

void ENET_ErrorIRQHandler ( ENET_Type base,
enet_handle_t handle 
)

Some special IRQ handler including the error, mii, wakeup irq handler.

Parameters
baseENET peripheral base address.
handleThe ENET handler pointer.

brief Some special IRQ handler including the error, mii, wakeup irq handler.

param base ENET peripheral base address. param handle The ENET handler pointer.

◆ ENET_GetDefaultConfig()

void ENET_GetDefaultConfig ( enet_config_t config)

Gets the ENET default configuration structure.

The purpose of this API is to get the default ENET MAC controller configure structure for ENET_Init(). User may use the initialized structure unchanged in ENET_Init(), or modify some fields of the structure before calling ENET_Init(). Example:

void ENET_GetDefaultConfig(enet_config_t *config)
Gets the ENET default configuration structure.
Definition: fsl_enet.c:206
Defines the basic configuration structure for the ENET device.
Definition: fsl_enet.h:646
Definition: deflate.c:114
Parameters
configThe ENET mac controller configuration structure pointer.

brief Gets the ENET default configuration structure.

The purpose of this API is to get the default ENET MAC controller configure structure for ENET_Init(). User may use the initialized structure unchanged in ENET_Init(), or modify some fields of the structure before calling ENET_Init(). Example: code enet_config_t config; ENET_GetDefaultConfig(&config); endcode param config The ENET mac controller configuration structure pointer.

◆ ENET_GetInstance()

uint32_t ENET_GetInstance ( ENET_Type base)

Get the ENET instance from peripheral base address.

Parameters
baseENET peripheral base address.
Returns
ENET instance.

◆ ENET_GetMacAddr()

void ENET_GetMacAddr ( ENET_Type base,
uint8_t *  macAddr 
)

Gets the ENET module Mac address.

Parameters
baseENET peripheral base address.
macAddrThe six-byte Mac address pointer. The pointer is allocated by application and input into the API.

brief Gets the ENET module Mac address.

param base ENET peripheral base address. param macAddr The six-byte Mac address pointer. The pointer is allocated by application and input into the API.

◆ ENET_GetRxBuffer()

status_t ENET_GetRxBuffer ( ENET_Type base,
enet_handle_t handle,
void **  buffer,
uint32_t *  length,
uint8_t  ringId,
bool *  isLastBuff,
uint32_t *  ts 
)

Get a receive buffer pointer of the ENET device for specified ring.

Deprecated:
Do not use this function. It has been superseded by ENET_GetRxFrame.

This function can get the data address which stores frame. Then can analyze these data directly without doing any memory copy. When the frame locates in multiple BD buffer, need to repeat calling this function until isLastBuff=true (need to store the temp buf pointer everytime call this function). After finishing the analysis of this frame, call ENET_ReleaseRxBuffer to release rxbuff memory to DMA. This is an example:

uint32_t length;
uint8_t *buf = NULL;
uint32_t data_len = 0;
bool isLastBuff = false;
enet_handle_t g_handle;
status_t status;
status = ENET_GetRxFrameSize(&g_handle, &length, 0);
if (length != 0)
{
ENET_GetRxBuffer(EXAMPLE_ENET, &g_handle, &buf, &data_len, 0, &isLastBuff, NULL);
ENET_ReleaseRxBuffer(EXAMPLE_ENET, &g_handle, buf, 0);
}
#define NULL
Requests a GPIO pin group configuration.
Definition: xil_types.h:54
void ENET_ReleaseRxBuffer(ENET_Type *base, enet_handle_t *handle, void *buffer, uint8_t ringId)
Release receive buffer descriptor to DMA.
Definition: fsl_enet.c:2252
status_t ENET_GetRxBuffer(ENET_Type *base, enet_handle_t *handle, void **buffer, uint32_t *length, uint8_t ringId, bool *isLastBuff, uint32_t *ts)
Get a receive buffer pointer of the ENET device for specified ring.
Definition: fsl_enet.c:2181
status_t ENET_GetRxFrameSize(enet_handle_t *handle, uint32_t *length, uint8_t ringId)
Gets the size of the read frame for specified ring.
Definition: fsl_enet.c:1599
int32_t status_t
Type used for all status and error return values.
Definition: fsl_common.h:225
Defines the ENET handler structure.
Definition: fsl_enet.h:698
Parameters
baseENET peripheral base address.
handleThe ENET handler structure. This is the same handler pointer used in the ENET_Init.
bufferThe data buffer pointer to store the frame.
lengthThe size of the data buffer. If isLastBuff=false, it represents data length of this buffer. If isLastBuff=true, it represents data length of total frame.
ringIdThe ring index, range from 0 ~ (FSL_FEATURE_ENET_INSTANCE_QUEUEn(x) - 1).
isLastBuffThe flag represents whether this buffer is the last buffer to store frame.
tsThe 1588 timestamp value, vaild in last buffer.
Return values
kStatus_SuccessGet receive buffer succeed.
kStatus_ENET_RxFrameFailGet receive buffer fails, it's owned by application, should wait app to release this buffer.

deprecated Do not use this function. It has been superseded by ENET_GetRxFrame.

◆ ENET_GetRxErrBeforeReadFrame()

void ENET_GetRxErrBeforeReadFrame ( enet_handle_t handle,
enet_data_error_stats_t eErrorStatic,
uint8_t  ringId 
)

Gets the error statistics of a received frame for ENET specified ring.

This API must be called after the ENET_GetRxFrameSize and before the ENET_ReadFrame(). If the ENET_GetRxFrameSize returns kStatus_ENET_RxFrameError, the ENET_GetRxErrBeforeReadFrame can be used to get the exact error statistics. This is an example.

status = ENET_GetRxFrameSize(&g_handle, &length, 0);
{
Comments: Get the error information of the received frame.
ENET_GetRxErrBeforeReadFrame(&g_handle, &eErrStatic, 0);
Comments: update the receive buffer.
ENET_ReadFrame(EXAMPLE_ENET, &g_handle, NULL, 0);
}
status_t ENET_ReadFrame(ENET_Type *base, enet_handle_t *handle, uint8_t *data, uint32_t length, uint8_t ringId, uint32_t *ts)
Reads a frame from the ENET device. This function reads a frame (both the data and the length) from t...
Definition: fsl_enet.c:1716
void ENET_GetRxErrBeforeReadFrame(enet_handle_t *handle, enet_data_error_stats_t *eErrorStatic, uint8_t ringId)
Gets the error statistics of a received frame for ENET specified ring.
Definition: fsl_enet.c:1482
@ kStatus_ENET_RxFrameError
Definition: fsl_enet.h:161
Parameters
handleThe ENET handler structure pointer. This is the same handler pointer used in the ENET_Init.
eErrorStaticThe error statistics structure pointer.
ringIdThe ring index, range from 0 ~ (FSL_FEATURE_ENET_INSTANCE_QUEUEn(x) - 1).

brief Gets the error statistics of a received frame for ENET specified ring.

This API must be called after the ENET_GetRxFrameSize and before the ENET_ReadFrame(). If the ENET_GetRxFrameSize returns kStatus_ENET_RxFrameError, the ENET_GetRxErrBeforeReadFrame can be used to get the exact error statistics. This is an example. code status = ENET_GetRxFrameSize(&g_handle, &length, 0); if (status == kStatus_ENET_RxFrameError) { ENET_GetRxErrBeforeReadFrame(&g_handle, &eErrStatic, 0); ENET_ReadFrame(EXAMPLE_ENET, &g_handle, NULL, 0); } endcode param handle The ENET handler structure pointer. This is the same handler pointer used in the ENET_Init. param eErrorStatic The error statistics structure pointer. param ringId The ring index, range from 0 ~ (FSL_FEATURE_ENET_INSTANCE_QUEUEn(x) - 1).

◆ ENET_GetRxFrame()

status_t ENET_GetRxFrame ( ENET_Type base,
enet_handle_t handle,
enet_rx_frame_struct_t rxFrame,
uint8_t  ringId 
)

Receives one frame in specified BD ring with zero copy.

This function will use the user-defined allocate and free callback. Every time application gets one frame through this function, driver will allocate new buffers for the BDs whose buffers have been taken by application.

Note
This function will drop current frame and update related BDs as available for DMA if new buffers allocating fails. Application must provide a memory pool including at least BD number + 1 buffers to make this function work normally. If user calls this function in Rx interrupt handler, be careful that this function makes Rx BD ready with allocating new buffer(normal) or updating current BD(out of memory). If there's always new Rx frame input, Rx interrupt will be triggered forever. Application need to disable Rx interrupt according to specific design in this case.
Parameters
baseENET peripheral base address.
handleThe ENET handler pointer. This is the same handler pointer used in the ENET_Init.
rxFrameThe received frame information structure provided by user.
ringIdThe ring index or ring number.
Return values
kStatus_SuccessSucceed to get one frame and allocate new memory for Rx buffer.
kStatus_ENET_RxFrameEmptyThere's no Rx frame in the BD.
kStatus_ENET_RxFrameErrorThere's issue in this receiving.
kStatus_ENET_RxFrameDropThere's no new buffer memory for BD, drop this frame.

brief Receives one frame in specified BD ring with zero copy.

This function will use the user-defined allocate and free callback. Every time application gets one frame through this function, driver will allocate new buffers for the BDs whose buffers have been taken by application. note This function will drop current frame and update related BDs as available for DMA if new buffers allocating fails. Application must provide a memory pool including at least BD number + 1 buffers to make this function work normally. If user calls this function in Rx interrupt handler, be careful that this function makes Rx BD ready with allocating new buffer(normal) or updating current BD(out of memory). If there's always new Rx frame input, Rx interrupt will be triggered forever. Application need to disable Rx interrupt according to specific design in this case.

param base ENET peripheral base address. param handle The ENET handler pointer. This is the same handler pointer used in the ENET_Init. param rxFrame The received frame information structure provided by user. param ringId The ring index or ring number. retval kStatus_Success Succeed to get one frame and allocate new memory for Rx buffer. retval kStatus_ENET_RxFrameEmpty There's no Rx frame in the BD. retval kStatus_ENET_RxFrameError There's issue in this receiving. retval kStatus_ENET_RxFrameDrop There's no new buffer memory for BD, drop this frame.

◆ ENET_GetRxFrameSize()

status_t ENET_GetRxFrameSize ( enet_handle_t handle,
uint32_t *  length,
uint8_t  ringId 
)

Gets the size of the read frame for specified ring.

This function gets a received frame size from the ENET buffer descriptors.

Note
The FCS of the frame is automatically removed by MAC and the size is the length without the FCS. After calling ENET_GetRxFrameSize, ENET_ReadFrame() should be called to receive frame and update the BD if the result is not "kStatus_ENET_RxFrameEmpty".
Parameters
handleThe ENET handler structure. This is the same handler pointer used in the ENET_Init.
lengthThe length of the valid frame received.
ringIdThe ring index or ring number.
Return values
kStatus_ENET_RxFrameEmptyNo frame received. Should not call ENET_ReadFrame to read frame.
kStatus_ENET_RxFrameErrorData error happens. ENET_ReadFrame should be called with NULL data and NULL length to update the receive buffers.
kStatus_SuccessReceive a frame Successfully then the ENET_ReadFrame should be called with the right data buffer and the captured data length input.

brief Gets the size of the read frame for specified ring.

This function gets a received frame size from the ENET buffer descriptors. note The FCS of the frame is automatically removed by MAC and the size is the length without the FCS. After calling ENET_GetRxFrameSize, ENET_ReadFrame() should be called to receive frame and update the BD if the result is not "kStatus_ENET_RxFrameEmpty".

param handle The ENET handler structure. This is the same handler pointer used in the ENET_Init. param length The length of the valid frame received. param ringId The ring index or ring number. retval kStatus_ENET_RxFrameEmpty No frame received. Should not call ENET_ReadFrame to read frame. retval kStatus_ENET_RxFrameError Data error happens. ENET_ReadFrame should be called with NULL data and NULL length to update the receive buffers. retval kStatus_Success Receive a frame Successfully then the ENET_ReadFrame should be called with the right data buffer and the captured data length input.

◆ ENET_GetStatistics()

void ENET_GetStatistics ( ENET_Type base,
enet_transfer_stats_t statistics 
)

Gets statistical data in transfer.

Parameters
baseENET peripheral base address.
statisticsThe statistics structure pointer.

brief Gets statistical data in transfer.

param base ENET peripheral base address. param statistics The statistics structure pointer.

◆ ENET_Init()

status_t ENET_Init ( ENET_Type base,
enet_handle_t handle,
const enet_config_t config,
const enet_buffer_config_t bufferConfig,
uint8_t *  macAddr,
uint32_t  srcClock_Hz 
)

Initializes the ENET module.

This function ungates the module clock and initializes it with the ENET configuration.

Note
ENET has two buffer descriptors legacy buffer descriptors and enhanced IEEE 1588 buffer descriptors. The legacy descriptor is used by default. To use the IEEE 1588 feature, use the enhanced IEEE 1588 buffer descriptor by defining "ENET_ENHANCEDBUFFERDESCRIPTOR_MODE" and calling ENET_Ptp1588Configure() to configure the 1588 feature and related buffers after calling ENET_Init().
Parameters
baseENET peripheral base address.
handleENET handler pointer.
configENET mac configuration structure pointer. The "enet_config_t" type mac configuration return from ENET_GetDefaultConfig can be used directly. It is also possible to verify the Mac configuration using other methods.
bufferConfigENET buffer configuration structure pointer. The buffer configuration should be prepared for ENET Initialization. It is the start address of "ringNum" enet_buffer_config structures. To support added multi-ring features in some soc and compatible with the previous enet driver version. For single ring supported, this bufferConfig is a buffer configure structure pointer, for multi-ring supported and used case, this bufferConfig pointer should be a buffer configure structure array pointer.
macAddrENET mac address of Ethernet device. This MAC address should be provided.
srcClock_HzThe internal module clock source for MII clock.
Return values
kStatus_SuccessSucceed to initialize the ethernet driver.
kStatus_ENET_InitMemoryFailInit fails since buffer memory is not enough.

brief Initializes the ENET module.

This function ungates the module clock and initializes it with the ENET configuration. note ENET has two buffer descriptors legacy buffer descriptors and enhanced IEEE 1588 buffer descriptors. The legacy descriptor is used by default. To use the IEEE 1588 feature, use the enhanced IEEE 1588 buffer descriptor by defining "ENET_ENHANCEDBUFFERDESCRIPTOR_MODE" and calling ENET_Ptp1588Configure() to configure the 1588 feature and related buffers after calling ENET_Init().

param base ENET peripheral base address. param handle ENET handler pointer. param config ENET mac configuration structure pointer. The "enet_config_t" type mac configuration return from ENET_GetDefaultConfig can be used directly. It is also possible to verify the Mac configuration using other methods. param bufferConfig ENET buffer configuration structure pointer. The buffer configuration should be prepared for ENET Initialization. It is the start address of "ringNum" enet_buffer_config structures. To support added multi-ring features in some soc and compatible with the previous enet driver version. For single ring supported, this bufferConfig is a buffer configure structure pointer, for multi-ring supported and used case, this bufferConfig pointer should be a buffer configure structure array pointer. param macAddr ENET mac address of Ethernet device. This MAC address should be provided. param srcClock_Hz The internal module clock source for MII clock. retval kStatus_Success Succeed to initialize the ethernet driver. retval kStatus_ENET_InitMemoryFail Init fails since buffer memory is not enough.

◆ ENET_LeaveMulticastGroup()

void ENET_LeaveMulticastGroup ( ENET_Type base,
uint8_t *  address 
)

Moves the ENET device from a multicast group.

Parameters
baseENET peripheral base address.
addressThe six-byte multicast group address which is provided by application.

brief Moves the ENET device from a multicast group.

param base ENET peripheral base address. param address The six-byte multicast group address which is provided by application.

◆ ENET_MDIORead()

status_t ENET_MDIORead ( ENET_Type base,
uint8_t  phyAddr,
uint8_t  regAddr,
uint16_t *  pData 
)

MDIO read with IEEE802.3 Clause 22 format.

Parameters
baseENET peripheral base address.
phyAddrThe PHY address. Range from 0 ~ 31.
regAddrThe PHY register. Range from 0 ~ 31.
pDataThe data read from PHY.
Returns
kStatus_Success MDIO access succeeds.
kStatus_Timeout MDIO access timeout.
Parameters
baseENET peripheral base address.
phyAddrThe PHY address.
regAddrThe PHY register. Range from 0 ~ 31.
pDataThe data read from PHY.
Returns
kStatus_Success MDIO access succeeds.
kStatus_Timeout MDIO access timeout.

◆ ENET_MDIOWrite()

status_t ENET_MDIOWrite ( ENET_Type base,
uint8_t  phyAddr,
uint8_t  regAddr,
uint16_t  data 
)

MDIO write with IEEE802.3 Clause 22 format.

Parameters
baseENET peripheral base address.
phyAddrThe PHY address. Range from 0 ~ 31.
regAddrThe PHY register. Range from 0 ~ 31.
dataThe data written to PHY.
Returns
kStatus_Success MDIO access succeeds.
kStatus_Timeout MDIO access timeout.
Parameters
baseENET peripheral base address.
phyAddrThe PHY address.
regAddrThe PHY register. Range from 0 ~ 31.
dataThe data written to PHY.
Returns
kStatus_Success MDIO access succeeds.
kStatus_Timeout MDIO access timeout.

◆ ENET_Ptp1588IRQHandler()

void ENET_Ptp1588IRQHandler ( ENET_Type base)

the common IRQ handler for the 1588 irq handler.

This is used for the 1588 timer interrupt.

Parameters
baseENET peripheral base address.

◆ ENET_ReadFrame()

status_t ENET_ReadFrame ( ENET_Type base,
enet_handle_t handle,
uint8_t *  data,
uint32_t  length,
uint8_t  ringId,
uint32_t *  ts 
)

Reads a frame from the ENET device. This function reads a frame (both the data and the length) from the ENET buffer descriptors. User can get timestamp through ts pointer if the ts is not NULL.

Note
It doesn't store the timestamp in the receive timestamp queue. The ENET_GetRxFrameSize should be used to get the size of the prepared data buffer. This API uses memcpy to copy data from DMA buffer to application buffer, 4 bytes aligned data buffer in 32 bits platforms provided by user may let compiler use optimization instruction to reduce time consumption. This is an example:
uint32_t length;
enet_handle_t g_handle;
Comments: Get the received frame size firstly.
status = ENET_GetRxFrameSize(&g_handle, &length, 0);
if (length != 0)
{
Comments: Allocate memory here with the size of "length"
uint8_t *data = memory allocate interface;
if (!data)
{
ENET_ReadFrame(ENET, &g_handle, NULL, 0, 0, NULL);
Comments: Add the console warning log.
}
else
{
status = ENET_ReadFrame(ENET, &g_handle, data, length, 0, NULL);
Comments: Call stack input API to deliver the data to stack
}
}
else if (status == kStatus_ENET_RxFrameError)
{
Comments: Update the received buffer when a error frame is received.
ENET_ReadFrame(ENET, &g_handle, NULL, 0, 0, NULL);
}
#define ENET
Definition: MIMXRT1052.h:20352
unsigned size
Definition: tte.h:1
Parameters
baseENET peripheral base address.
handleThe ENET handler structure. This is the same handler pointer used in the ENET_Init.
dataThe data buffer provided by user to store the frame which memory size should be at least "length".
lengthThe size of the data buffer which is still the length of the received frame.
ringIdThe ring index or ring number.
tsThe timestamp address to store received timestamp.
Returns
The execute status, successful or failure.

brief Reads a frame from the ENET device. This function reads a frame (both the data and the length) from the ENET buffer descriptors. User can get timestamp through ts pointer if the ts is not NULL. note It doesn't store the timestamp in the receive timestamp queue. The ENET_GetRxFrameSize should be used to get the size of the prepared data buffer. This API uses memcpy to copy data from DMA buffer to application buffer, 4 bytes aligned data buffer in 32 bits platforms provided by user may let compiler use optimization instruction to reduce time consumption. This is an example: code uint32_t length; enet_handle_t g_handle; Comments: Get the received frame size firstly. status = ENET_GetRxFrameSize(&g_handle, &length, 0); if (length != 0) { Comments: Allocate memory here with the size of "length" uint8_t *data = memory allocate interface; if (!data) { ENET_ReadFrame(ENET, &g_handle, NULL, 0, 0, NULL); Comments: Add the console warning log. } else { status = ENET_ReadFrame(ENET, &g_handle, data, length, 0, NULL); Comments: Call stack input API to deliver the data to stack } } else if (status == kStatus_ENET_RxFrameError) { Comments: Update the received buffer when a error frame is received. ENET_ReadFrame(ENET, &g_handle, NULL, 0, 0, NULL); } endcode param base ENET peripheral base address. param handle The ENET handler structure. This is the same handler pointer used in the ENET_Init. param data The data buffer provided by user to store the frame which memory size should be at least "length". param length The size of the data buffer which is still the length of the received frame. param ringId The ring index or ring number. param ts The timestamp address to store received timestamp. return The execute status, successful or failure.

◆ ENET_ReceiveIRQHandler()

void ENET_ReceiveIRQHandler ( ENET_Type base,
enet_handle_t handle 
)

The receive IRQ handler.

Parameters
baseENET peripheral base address.
handleThe ENET handler pointer.

brief The receive IRQ handler.

param base ENET peripheral base address. param handle The ENET handler pointer.

◆ ENET_ReclaimTxDescriptor()

void ENET_ReclaimTxDescriptor ( ENET_Type base,
enet_handle_t handle,
uint8_t  ringId 
)

Reclaim tx descriptors. This function is used to update the tx descriptor status and store the tx timestamp when the 1588 feature is enabled. This is called by the transmit interupt IRQ handler after the complete of a frame transmission.

Parameters
baseENET peripheral base address.
handleThe ENET handler pointer. This is the same handler pointer used in the ENET_Init.
ringIdThe ring index or ring number.

brief Reclaim tx descriptors. This function is used to update the tx descriptor status and store the tx timestamp when the 1588 feature is enabled. This is called by the transmit interupt IRQ handler after the complete of a frame transmission.

param base ENET peripheral base address. param handle The ENET handler pointer. This is the same handler pointer used in the ENET_Init. param ringId The ring index or ring number.

◆ ENET_ReleaseRxBuffer()

void ENET_ReleaseRxBuffer ( ENET_Type base,
enet_handle_t handle,
void *  buffer,
uint8_t  ringId 
)

Release receive buffer descriptor to DMA.

Deprecated:
Do not use this function. It has been superseded by ENET_GetRxFrame.

This function can release specified BD owned by application, meanwhile it may rearrange the BD to let the no-owned BDs always in back of the index of DMA transfer. So for the situation that releasing order is not same as the getting order, the rearrangement makes all ready BDs can be used by DMA.

Note
This function can't be interrupted by ENET_GetRxBuffer, so in application must make sure ENET_GetRxBuffer is called before or after this function. And this function itself isn't thread safe due to BD content exchanging.
Parameters
baseENET peripheral base address.
handleThe ENET handler structure. This is the same handler pointer used in the ENET_Init.
bufferThe buffer address to store frame, using it to find the correspond BD and release it.
ringIdThe ring index, range from 0 ~ (FSL_FEATURE_ENET_INSTANCE_QUEUEn(x) - 1).

deprecated Do not use this function. It has been superseded by ENET_GetRxFrame.

◆ ENET_SendFrame()

status_t ENET_SendFrame ( ENET_Type base,
enet_handle_t handle,
const uint8_t *  data,
uint32_t  length,
uint8_t  ringId,
bool  tsFlag,
void *  context 
)

Transmits an ENET frame for specified ring.

Note
The CRC is automatically appended to the data. Input the data to send without the CRC. This API uses memcpy to copy data from DMA buffer to application buffer, 4 bytes aligned data buffer in 32 bits platforms provided by user may let compiler use optimization instruction to reduce time consumption.
Parameters
baseENET peripheral base address.
handleThe ENET handler pointer. This is the same handler pointer used in the ENET_Init.
dataThe data buffer provided by user to send.
lengthThe length of the data to send.
ringIdThe ring index or ring number.
tsFlagTimestamp enable flag.
contextUsed by user to handle some events after transmit over.
Return values
kStatus_SuccessSend frame succeed.
kStatus_ENET_TxFrameBusyTransmit buffer descriptor is busy under transmission. The transmit busy happens when the data send rate is over the MAC capacity. The waiting mechanism is recommended to be added after each call return with kStatus_ENET_TxFrameBusy.

brief Transmits an ENET frame for specified ring. note The CRC is automatically appended to the data. Input the data to send without the CRC. This API uses memcpy to copy data from DMA buffer to application buffer, 4 bytes aligned data buffer in 32 bits platforms provided by user may let compiler use optimization instruction to reduce time consumption.

param base ENET peripheral base address. param handle The ENET handler pointer. This is the same handler pointer used in the ENET_Init. param data The data buffer provided by user to send. param length The length of the data to send. param ringId The ring index or ring number. param tsFlag Timestamp enable flag. param context Used by user to handle some events after transmit over. retval kStatus_Success Send frame succeed. retval kStatus_ENET_TxFrameBusy Transmit buffer descriptor is busy under transmission. The transmit busy happens when the data send rate is over the MAC capacity. The waiting mechanism is recommended to be added after each call return with kStatus_ENET_TxFrameBusy.

◆ ENET_SendFrameZeroCopy()

status_t ENET_SendFrameZeroCopy ( ENET_Type base,
enet_handle_t handle,
const uint8_t *  data,
uint32_t  length,
uint8_t  ringId,
bool  tsFlag,
void *  context 
)

Transmits an ENET frame for specified ring with zero-copy.

Deprecated:
Do not use this function. It has been superseded by ENET_StartTxFrame.
Note
The CRC is automatically appended to the data. Input the data to send without the CRC. The frame must store in continuous memory and need to check the buffer start address alignment based on your device, otherwise it has issue or can't get highest DMA transmit speed.
Parameters
baseENET peripheral base address.
handleThe ENET handler pointer. This is the same handler pointer used in the ENET_Init.
dataThe data buffer provided by user to send.
lengthThe length of the data to send.
ringIdThe ring index or ring number.
tsFlagTimestamp enable flag.
contextUsed by user to handle some events after transmit over.
Return values
kStatus_SuccessSend frame succeed.
kStatus_ENET_TxFrameBusyTransmit buffer descriptor is busy under transmission. The transmit busy happens when the data send rate is over the MAC capacity. The waiting mechanism is recommended to be added after each call return with kStatus_ENET_TxFrameBusy.

deprecated Do not use this function. It has been superseded by ENET_StartTxFrame.

◆ ENET_SetCallback()

void ENET_SetCallback ( enet_handle_t handle,
enet_callback_t  callback,
void *  userData 
)

Sets the callback function.

Deprecated:
Do not use this function. It has been superceded by the config param in ENET_Init. This API is provided for the application callback required case when ENET interrupt is enabled. This API should be called after calling ENET_Init.
Parameters
handleENET handler pointer. Should be provided by application.
callbackThe ENET callback function.
userDataThe callback function parameter.

deprecated Do not use this function. It has been superceded by the config param in ENET_Init.

◆ ENET_SetErrISRHandler()

void ENET_SetErrISRHandler ( ENET_Type base,
enet_isr_t  ISRHandler 
)

Set the second level Err IRQ handler.

Parameters
baseENET peripheral base address.
ISRHandlerThe handler to install.

◆ ENET_SetMacAddr()

void ENET_SetMacAddr ( ENET_Type base,
uint8_t *  macAddr 
)

Sets the ENET module Mac address.

Parameters
baseENET peripheral base address.
macAddrThe six-byte Mac address pointer. The pointer is allocated by application and input into the API.

brief Sets the ENET module Mac address.

param base ENET peripheral base address. param macAddr The six-byte Mac address pointer. The pointer is allocated by application and input into the API.

◆ ENET_SetMII()

void ENET_SetMII ( ENET_Type base,
enet_mii_speed_t  speed,
enet_mii_duplex_t  duplex 
)

Sets the ENET MII speed and duplex.

This API is provided to dynamically change the speed and dulpex for MAC.

Parameters
baseENET peripheral base address.
speedThe speed of the RMII mode.
duplexThe duplex of the RMII mode.

brief Sets the ENET MII speed and duplex.

This API is provided to dynamically change the speed and dulpex for MAC.

param base ENET peripheral base address. param speed The speed of the RMII mode. param duplex The duplex of the RMII mode.

◆ ENET_SetRxISRHandler()

void ENET_SetRxISRHandler ( ENET_Type base,
enet_isr_t  ISRHandler 
)

Set the second level Rx IRQ handler.

Parameters
baseENET peripheral base address.
ISRHandlerThe handler to install.

◆ ENET_SetSMI()

void ENET_SetSMI ( ENET_Type base,
uint32_t  srcClock_Hz,
bool  isPreambleDisabled 
)

Sets the ENET SMI(serial management interface)- MII management interface.

Parameters
baseENET peripheral base address.
srcClock_HzThis is the ENET module clock frequency. See clock distribution.
isPreambleDisabledThe preamble disable flag.
  • true Enables the preamble.
  • false Disables the preamble.

brief Sets the ENET SMI(serial management interface)- MII management interface.

param base ENET peripheral base address. param srcClock_Hz This is the ENET module clock frequency. See clock distribution. param isPreambleDisabled The preamble disable flag.

  • true Enables the preamble.
  • false Disables the preamble.

◆ ENET_SetTxISRHandler()

void ENET_SetTxISRHandler ( ENET_Type base,
enet_isr_t  ISRHandler 
)

Set the second level Tx IRQ handler.

Parameters
baseENET peripheral base address.
ISRHandlerThe handler to install.

◆ ENET_SetTxReclaim()

status_t ENET_SetTxReclaim ( enet_handle_t handle,
bool  isEnable,
uint8_t  ringId 
)

Enable or disable tx descriptors reclaim mechanism.

Note
This function must be called when no pending send frame action. Set enable if you want to reclaim context or timestamp in interrupt.
Parameters
handleThe ENET handler pointer. This is the same handler pointer used in the ENET_Init.
isEnableEnable or disable flag.
ringIdThe ring index or ring number.
Return values
kStatus_SuccessSucceed to enable/disable Tx reclaim.
kStatus_FailFail to enable/disable Tx reclaim.

brief Enable or disable tx descriptors reclaim mechanism. note This function must be called when no pending send frame action. Set enable if you want to reclaim context or timestamp in interrupt.

param handle The ENET handler pointer. This is the same handler pointer used in the ENET_Init. param isEnable Enable or disable flag. param ringId The ring index or ring number. retval kStatus_Success Succeed to enable/disable Tx reclaim. retval kStatus_Fail Fail to enable/disable Tx reclaim.

◆ ENET_StartTxFrame()

status_t ENET_StartTxFrame ( ENET_Type base,
enet_handle_t handle,
enet_tx_frame_struct_t txFrame,
uint8_t  ringId 
)

Sends one frame in specified BD ring with zero copy.

This function supports scattered buffer transmit, user needs to provide the buffer array.

Note
Tx reclaim should be enabled to ensure the Tx buffer ownership can be given back to application after Tx is over.
Parameters
baseENET peripheral base address.
handleThe ENET handler pointer. This is the same handler pointer used in the ENET_Init.
txFrameThe Tx frame structure.
ringIdThe ring index or ring number.
Return values
kStatus_SuccessSucceed to send one frame.
kStatus_ENET_TxFrameBusyThe BD is not ready for Tx or the reclaim operation still not finishs.
kStatus_ENET_TxFrameOverLenThe Tx frame length is over max ethernet frame length.

brief Sends one frame in specified BD ring with zero copy.

This function supports scattered buffer transmit, user needs to provide the buffer array. note Tx reclaim should be enabled to ensure the Tx buffer ownership can be given back to application after Tx is over.

param base ENET peripheral base address. param handle The ENET handler pointer. This is the same handler pointer used in the ENET_Init. param txFrame The Tx frame structure. param ringId The ring index or ring number. retval kStatus_Success Succeed to send one frame. retval kStatus_ENET_TxFrameBusy The BD is not ready for Tx or the reclaim operation still not finishs. retval kStatus_ENET_TxFrameOverLen The Tx frame length is over max ethernet frame length.

◆ ENET_TransmitIRQHandler()

void ENET_TransmitIRQHandler ( ENET_Type base,
enet_handle_t handle 
)

The transmit IRQ handler.

Parameters
baseENET peripheral base address.
handleThe ENET handler pointer.

brief The transmit IRQ handler.

param base ENET peripheral base address. param handle The ENET handler pointer.

◆ ENET_Up()

status_t ENET_Up ( ENET_Type base,
enet_handle_t handle,
const enet_config_t config,
const enet_buffer_config_t bufferConfig,
uint8_t *  macAddr,
uint32_t  srcClock_Hz 
)

Initializes the ENET module.

This function initializes the module with the ENET configuration.

Note
ENET has two buffer descriptors legacy buffer descriptors and enhanced IEEE 1588 buffer descriptors. The legacy descriptor is used by default. To use the IEEE 1588 feature, use the enhanced IEEE 1588 buffer descriptor by defining "ENET_ENHANCEDBUFFERDESCRIPTOR_MODE" and calling ENET_Ptp1588Configure() to configure the 1588 feature and related buffers after calling ENET_Up().
Parameters
baseENET peripheral base address.
handleENET handler pointer.
configENET mac configuration structure pointer. The "enet_config_t" type mac configuration return from ENET_GetDefaultConfig can be used directly. It is also possible to verify the Mac configuration using other methods.
bufferConfigENET buffer configuration structure pointer. The buffer configuration should be prepared for ENET Initialization. It is the start address of "ringNum" enet_buffer_config structures. To support added multi-ring features in some soc and compatible with the previous enet driver version. For single ring supported, this bufferConfig is a buffer configure structure pointer, for multi-ring supported and used case, this bufferConfig pointer should be a buffer configure structure array pointer.
macAddrENET mac address of Ethernet device. This MAC address should be provided.
srcClock_HzThe internal module clock source for MII clock.
Return values
kStatus_SuccessSucceed to initialize the ethernet driver.
kStatus_ENET_InitMemoryFailInit fails since buffer memory is not enough.

brief Initializes the ENET module.

This function initializes the module with the ENET configuration. note ENET has two buffer descriptors legacy buffer descriptors and enhanced IEEE 1588 buffer descriptors. The legacy descriptor is used by default. To use the IEEE 1588 feature, use the enhanced IEEE 1588 buffer descriptor by defining "ENET_ENHANCEDBUFFERDESCRIPTOR_MODE" and calling ENET_Ptp1588Configure() to configure the 1588 feature and related buffers after calling ENET_Up().

param base ENET peripheral base address. param handle ENET handler pointer. param config ENET mac configuration structure pointer. The "enet_config_t" type mac configuration return from ENET_GetDefaultConfig can be used directly. It is also possible to verify the Mac configuration using other methods. param bufferConfig ENET buffer configuration structure pointer. The buffer configuration should be prepared for ENET Initialization. It is the start address of "ringNum" enet_buffer_config structures. To support added multi-ring features in some soc and compatible with the previous enet driver version. For single ring supported, this bufferConfig is a buffer configure structure pointer, for multi-ring supported and used case, this bufferConfig pointer should be a buffer configure structure array pointer. param macAddr ENET mac address of Ethernet device. This MAC address should be provided. param srcClock_Hz The internal module clock source for MII clock. retval kStatus_Success Succeed to initialize the ethernet driver. retval kStatus_ENET_InitMemoryFail Init fails since buffer memory is not enough.

Variable Documentation

◆ buffer [1/3]

uint32_t _enet_rx_bd_struct::buffer

Data buffer pointer.

◆ buffer [2/3]

uint32_t _enet_tx_bd_struct::buffer

Data buffer pointer.

◆ buffer [3/3]

void* _enet_buffer_struct::buffer

The buffer store the whole or partial frame.

◆ callback [1/2]

enet_callback_t _enet_config::callback

General callback function.

◆ callback [2/2]

enet_callback_t _enet_handle::callback

Callback function.

◆ context [1/2]

void* enet_frame_info::context

User specified data

◆ context [2/2]

void* _enet_tx_frame_struct::context

Driver reclaims and gives it in Tx over callback, usually store network packet header.

◆ control [1/2]

uint16_t _enet_rx_bd_struct::control

Buffer descriptor control and status.

◆ control [2/2]

uint16_t _enet_tx_bd_struct::control

Buffer descriptor control and status.

◆ interrupt

uint32_t _enet_config::interrupt

Mac interrupt source. A logical OR of "enet_interrupt_enable_t".

◆ isFull

bool _enet_tx_dirty_ring::isFull

tx ring is full flag.

◆ length [1/3]

uint16_t _enet_rx_bd_struct::length

Buffer descriptor data length.

◆ length [2/3]

uint16_t _enet_tx_bd_struct::length

Buffer descriptor data length.

◆ length [3/3]

uint16_t _enet_buffer_struct::length

The byte length of this buffer.

◆ macSpecialConfig

uint32_t _enet_config::macSpecialConfig

Mac special configuration. A logical OR of "enet_special_control_flag_t".

◆ miiDuplex

enet_mii_duplex_t _enet_config::miiDuplex

MII duplex.

◆ miiMode

enet_mii_mode_t _enet_config::miiMode

MII mode.

◆ miiSpeed

enet_mii_speed_t _enet_config::miiSpeed

MII Speed.

◆ multicastCount

uint8_t _enet_handle::multicastCount[64]

Multicast collisions counter

◆ pauseDuration

uint16_t _enet_config::pauseDuration

For flow control enabled case: Pause duration.

◆ promiscuous

bool _enet_rx_frame_attribute_struct::promiscuous

This frame is received because of promiscuous mode.

◆ ringNum [1/2]

uint8_t _enet_config::ringNum

Number of used rings. default with 1 – single ring.

◆ ringNum [2/2]

uint8_t _enet_handle::ringNum

Number of used rings.

◆ rxAccelerConfig

uint8_t _enet_config::rxAccelerConfig

Receive accelerator, A logical OR of "enet_rx_accelerator_t".

◆ rxAttribute

enet_rx_frame_attribute_t _enet_rx_frame_struct::rxAttribute

Rx frame attribute structure.

◆ rxBdBase

volatile enet_rx_bd_struct_t* _enet_rx_bd_ring::rxBdBase

Buffer descriptor base address pointer.

◆ rxBdNumber

uint16_t _enet_buffer_config::rxBdNumber

Receive buffer descriptor number.

◆ rxBdRing

enet_rx_bd_ring_t _enet_handle::rxBdRing[FSL_FEATURE_ENET_QUEUE]

Receive buffer descriptor.

◆ rxBdStartAddrAlign

volatile enet_rx_bd_struct_t* _enet_buffer_config::rxBdStartAddrAlign

Aligned receive buffer descriptor start address: should be non-cacheable.

◆ rxBuffAlloc [1/2]

enet_rx_alloc_callback_t _enet_config::rxBuffAlloc

Callback function to alloc memory, must be provided for zero-copy Rx.

◆ rxBuffAlloc [2/2]

enet_rx_alloc_callback_t _enet_handle::rxBuffAlloc

Callback function to alloc memory for zero copy Rx.

◆ rxBuffArray

enet_buffer_struct_t* _enet_rx_frame_struct::rxBuffArray

Rx frame buffer structure.

◆ rxBufferAlign

uint8_t* _enet_buffer_config::rxBufferAlign

Receive data buffer start address.

◆ rxBuffFree [1/2]

enet_rx_free_callback_t _enet_config::rxBuffFree

Callback function to free memory, must be provided for zero-copy Rx.

◆ rxBuffFree [2/2]

enet_rx_free_callback_t _enet_handle::rxBuffFree

Callback function to free memory for zero copy Rx.

◆ rxBuffSizeAlign [1/2]

uint16_t _enet_buffer_config::rxBuffSizeAlign

Aligned receive data buffer size.

◆ rxBuffSizeAlign [2/2]

uint16_t _enet_handle::rxBuffSizeAlign[FSL_FEATURE_ENET_QUEUE]

Receive buffer size alignment.

◆ rxFifoEmptyThreshold

uint8_t _enet_config::rxFifoEmptyThreshold

For flow control enabled case: when RX FIFO level reaches this value, it makes MAC generate XOFF pause frame.

◆ rxFifoFullThreshold

uint8_t _enet_config::rxFifoFullThreshold

For store and forward disable case, the data required in RX FIFO to notify the MAC receive ready status.

◆ rxFrameError

enet_rx_frame_error_t _enet_rx_frame_struct::rxFrameError

Rx frame error.

◆ rxGenIdx

uint16_t _enet_rx_bd_ring::rxGenIdx

The current available receive buffer descriptor pointer.

◆ rxMaintainEnable [1/2]

bool _enet_buffer_config::rxMaintainEnable

Receive buffer cache maintain.

◆ rxMaintainEnable [2/2]

bool _enet_handle::rxMaintainEnable[FSL_FEATURE_ENET_QUEUE]

Receive buffer cache maintain.

◆ rxMaxFrameLen

uint16_t _enet_config::rxMaxFrameLen

Receive maximum frame length.

◆ rxRingLen

uint16_t _enet_rx_bd_ring::rxRingLen

Receive ring length.

◆ statsRxAlignErr [1/3]

uint32_t _enet_data_error_stats::statsRxAlignErr

Receive non-octet alignment/

◆ statsRxAlignErr [2/3]

bool _enet_rx_frame_error::statsRxAlignErr

Receive non-octet alignment.

◆ statsRxAlignErr [3/3]

uint32_t _enet_transfer_stats::statsRxAlignErr

Rx frame number with alignment error.

◆ statsRxCrcErr

uint32_t _enet_transfer_stats::statsRxCrcErr

Rx frame number with CRC error.

◆ statsRxDropInvalidSFD

uint32_t _enet_transfer_stats::statsRxDropInvalidSFD

Dropped frame number due to invalid SFD.

◆ statsRxFcsErr [1/2]

uint32_t _enet_data_error_stats::statsRxFcsErr

Receive CRC error.

◆ statsRxFcsErr [2/2]

bool _enet_rx_frame_error::statsRxFcsErr

Receive CRC error.

◆ statsRxFifoOverflowErr

uint32_t _enet_transfer_stats::statsRxFifoOverflowErr

Rx FIFO overflow count.

◆ statsRxFrameCount

uint32_t _enet_transfer_stats::statsRxFrameCount

Rx frame number.

◆ statsRxFrameOk

uint32_t _enet_transfer_stats::statsRxFrameOk

Good Rx frame number.

◆ statsRxLenGreaterErr [1/2]

uint32_t _enet_data_error_stats::statsRxLenGreaterErr

Receive length greater than RCR[MAX_FL].

◆ statsRxLenGreaterErr [2/2]

bool _enet_rx_frame_error::statsRxLenGreaterErr

Receive length greater than RCR[MAX_FL].

◆ statsRxOverRunErr [1/2]

uint32_t _enet_data_error_stats::statsRxOverRunErr

Receive over run.

◆ statsRxOverRunErr [2/2]

bool _enet_rx_frame_error::statsRxOverRunErr

Receive over run.

◆ statsRxTruncateErr [1/2]

uint32_t _enet_data_error_stats::statsRxTruncateErr

Receive truncate.

◆ statsRxTruncateErr [2/2]

bool _enet_rx_frame_error::statsRxTruncateErr

Receive truncate.

◆ statsTxCrcAlignErr

uint32_t _enet_transfer_stats::statsTxCrcAlignErr

The transmit frame is error.

◆ statsTxFifoUnderRunErr

uint32_t _enet_transfer_stats::statsTxFifoUnderRunErr

Tx FIFO underrun count.

◆ statsTxFrameCount

uint32_t _enet_transfer_stats::statsTxFrameCount

Tx frame number.

◆ statsTxFrameOk

uint32_t _enet_transfer_stats::statsTxFrameOk

Good Tx frame number.

◆ totLen

uint16_t _enet_rx_frame_struct::totLen

Rx frame total length.

◆ txAccelerConfig

uint8_t _enet_config::txAccelerConfig

Transmit accelerator, A logical OR of "enet_rx_accelerator_t".

◆ txBdBase

volatile enet_tx_bd_struct_t* _enet_tx_bd_ring::txBdBase

Buffer descriptor base address pointer.

◆ txBdNumber

uint16_t _enet_buffer_config::txBdNumber

Transmit buffer descriptor number.

◆ txBdRing

enet_tx_bd_ring_t _enet_handle::txBdRing[FSL_FEATURE_ENET_QUEUE]

Transmit buffer descriptor.

◆ txBdStartAddrAlign

volatile enet_tx_bd_struct_t* _enet_buffer_config::txBdStartAddrAlign

Aligned transmit buffer descriptor start address: should be non-cacheable.

◆ txBuffArray

enet_buffer_struct_t* _enet_tx_frame_struct::txBuffArray

Tx frame buffer structure.

◆ txBufferAlign

uint8_t* _enet_buffer_config::txBufferAlign

Transmit data buffer start address.

◆ txBuffNum

uint32_t _enet_tx_frame_struct::txBuffNum

Buffer number of this Tx frame.

◆ txBuffSizeAlign [1/2]

uint16_t _enet_buffer_config::txBuffSizeAlign

Aligned transmit data buffer size.

◆ txBuffSizeAlign [2/2]

uint16_t _enet_handle::txBuffSizeAlign[FSL_FEATURE_ENET_QUEUE]

Transmit buffer size alignment.

◆ txConsumIdx [1/2]

uint16_t _enet_tx_dirty_ring::txConsumIdx

tx consume index.

◆ txConsumIdx [2/2]

uint16_t _enet_tx_bd_ring::txConsumIdx

Transmit consume index.

◆ txDescUsed

volatile uint16_t _enet_tx_bd_ring::txDescUsed

Transmit descriptor used number.

◆ txDirtyBase

enet_frame_info_t* _enet_tx_dirty_ring::txDirtyBase

Dirty buffer descriptor base address pointer.

◆ txDirtyRing

enet_tx_dirty_ring_t _enet_handle::txDirtyRing[FSL_FEATURE_ENET_QUEUE]

Ring to store tx frame information.

◆ txFifoWatermark

uint8_t _enet_config::txFifoWatermark

For store and forward disable case, the data required in TX FIFO before a frame transmit start.

◆ txFrameInfo

enet_frame_info_t* _enet_buffer_config::txFrameInfo

Transmit frame information start address.

◆ txGenIdx [1/2]

uint16_t _enet_tx_dirty_ring::txGenIdx

tx generate index.

◆ txGenIdx [2/2]

uint16_t _enet_tx_bd_ring::txGenIdx

The current available transmit buffer descriptor pointer.

◆ txMaintainEnable [1/2]

bool _enet_buffer_config::txMaintainEnable

Transmit buffer cache maintain.

◆ txMaintainEnable [2/2]

bool _enet_handle::txMaintainEnable[FSL_FEATURE_ENET_QUEUE]

Transmit buffer cache maintain.

◆ txReclaimEnable

bool _enet_handle::txReclaimEnable[FSL_FEATURE_ENET_QUEUE]

Tx reclaim enable flag.

◆ txRingLen [1/2]

uint16_t _enet_tx_dirty_ring::txRingLen

tx ring length.

◆ txRingLen [2/2]

uint16_t _enet_tx_bd_ring::txRingLen

Transmit ring length.

◆ userData [1/2]

void* _enet_config::userData

Callback function parameter.

◆ userData [2/2]

void* _enet_handle::userData

Callback function parameter.