RTEMS 6.1-rc2
|
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 |
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. | |
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. | |
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. | |
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. | |
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. | |
#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. | |
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. | |
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. | |
void | ENET_Down (ENET_Type *base) |
Stops the ENET module. | |
void | ENET_Deinit (ENET_Type *base) |
Deinitializes the ENET module. | |
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. | |
void | ENET_SetSMI (ENET_Type *base, uint32_t srcClock_Hz, bool isPreambleDisabled) |
Sets the ENET SMI(serial management interface)- MII management interface. | |
status_t | ENET_MDIOWrite (ENET_Type *base, uint8_t phyAddr, uint8_t regAddr, uint16_t data) |
MDIO write with IEEE802.3 Clause 22 format. | |
status_t | ENET_MDIORead (ENET_Type *base, uint8_t phyAddr, uint8_t regAddr, uint16_t *pData) |
MDIO read with IEEE802.3 Clause 22 format. | |
MAC Address Filter | |
void | ENET_SetMacAddr (ENET_Type *base, uint8_t *macAddr) |
Sets the ENET module Mac address. | |
void | ENET_GetMacAddr (ENET_Type *base, uint8_t *macAddr) |
Gets the ENET module Mac address. | |
void | ENET_AddMulticastGroup (ENET_Type *base, uint8_t *address) |
Adds the ENET device to a multicast group. | |
void | ENET_LeaveMulticastGroup (ENET_Type *base, uint8_t *address) |
Moves the ENET device from a multicast group. | |
Interrupts. | |
void | ENET_SetRxISRHandler (ENET_Type *base, enet_isr_t ISRHandler) |
Set the second level Rx IRQ handler. | |
void | ENET_SetTxISRHandler (ENET_Type *base, enet_isr_t ISRHandler) |
Set the second level Tx IRQ handler. | |
void | ENET_SetErrISRHandler (ENET_Type *base, enet_isr_t ISRHandler) |
Set the second level Err IRQ handler. | |
Transactional operation | |
void | ENET_SetCallback (enet_handle_t *handle, enet_callback_t callback, void *userData) |
Sets the callback function. | |
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. | |
void | ENET_GetStatistics (ENET_Type *base, enet_transfer_stats_t *statistics) |
Gets statistical data in transfer. | |
status_t | ENET_GetRxFrameSize (enet_handle_t *handle, uint32_t *length, uint8_t ringId) |
Gets the size of the read frame for specified ring. | |
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. | |
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. | |
status_t | ENET_SetTxReclaim (enet_handle_t *handle, bool isEnable, uint8_t ringId) |
Enable or disable tx descriptors reclaim mechanism. | |
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. | |
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. | |
void | ENET_ReleaseRxBuffer (ENET_Type *base, enet_handle_t *handle, void *buffer, uint8_t ringId) |
Release receive buffer descriptor to DMA. | |
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. | |
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. | |
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. | |
void | ENET_TransmitIRQHandler (ENET_Type *base, enet_handle_t *handle) |
The transmit IRQ handler. | |
void | ENET_ReceiveIRQHandler (ENET_Type *base, enet_handle_t *handle) |
The receive IRQ handler. | |
void | ENET_ErrorIRQHandler (ENET_Type *base, enet_handle_t *handle) |
Some special IRQ handler including the error, mii, wakeup irq handler. | |
void | ENET_Ptp1588IRQHandler (ENET_Type *base) |
the common IRQ handler for the 1588 irq handler. | |
void | ENET_CommonFrame0IRQHandler (ENET_Type *base) |
the common IRQ handler for the tx/rx/error etc irq handler. | |
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. | |
#define ENET_BUFFDESCRIPTOR_RX_BROADCAST_MASK 0x0080U |
Broadcast packet mask.
#define ENET_BUFFDESCRIPTOR_RX_CRC_MASK 0x0004U |
CRC error mask.
#define ENET_BUFFDESCRIPTOR_RX_EMPTY_MASK 0x8000U |
Empty bit mask.
#define ENET_BUFFDESCRIPTOR_RX_ERR_MASK |
Defines the receive error status flag mask.
#define ENET_BUFFDESCRIPTOR_RX_LAST_MASK 0x0800U |
Last BD of the frame mask.
#define ENET_BUFFDESCRIPTOR_RX_LENVLIOLATE_MASK 0x0020U |
Length violation mask.
#define ENET_BUFFDESCRIPTOR_RX_MISS_MASK 0x0100U |
Received because of the promiscuous mode.
#define ENET_BUFFDESCRIPTOR_RX_MULTICAST_MASK 0x0040U |
Multicast packet mask.
#define ENET_BUFFDESCRIPTOR_RX_NOOCTET_MASK 0x0010U |
Non-octet aligned frame mask.
#define ENET_BUFFDESCRIPTOR_RX_OVERRUN_MASK 0x0002U |
FIFO overrun mask.
#define ENET_BUFFDESCRIPTOR_RX_SOFTOWNER1_MASK 0x4000U |
Software owner one mask.
#define ENET_BUFFDESCRIPTOR_RX_SOFTOWNER2_Mask 0x1000U |
Software owner two mask.
#define ENET_BUFFDESCRIPTOR_RX_TRUNC_MASK 0x0001U |
Frame is truncated mask.
#define ENET_BUFFDESCRIPTOR_RX_WRAP_MASK 0x2000U |
Next buffer descriptor is the start address.
#define ENET_BUFFDESCRIPTOR_TX_LAST_MASK 0x0800U |
Last BD of the frame mask.
#define ENET_BUFFDESCRIPTOR_TX_READY_MASK 0x8000U |
Ready bit mask.
#define ENET_BUFFDESCRIPTOR_TX_SOFTOWENER1_MASK 0x4000U |
Software owner one mask.
#define ENET_BUFFDESCRIPTOR_TX_SOFTOWENER2_MASK 0x1000U |
Software owner two mask.
#define ENET_BUFFDESCRIPTOR_TX_TRANMITCRC_MASK 0x0400U |
Transmit CRC mask.
#define ENET_BUFFDESCRIPTOR_TX_WRAP_MASK 0x2000U |
Wrap buffer descriptor mask.
#define ENET_ERR_INTERRUPT |
Enet error interrupt flag.
#define ENET_FIFO_MIN_RX_FULL 5U |
ENET minimum receive FIFO full.
#define ENET_FRAME_CRC_LEN 4U |
CRC size in a frame.
#define ENET_FRAME_MAX_FRAMELEN 1518U |
Default maximum Ethernet frame size without VLAN tag.
#define ENET_FRAME_VLAN_TAGLEN 4U |
Ethernet single VLAN tag size.
#define ENET_PHY_MAXADDRESS (ENET_MMFR_PA_MASK >> ENET_MMFR_PA_SHIFT) |
Maximum PHY address.
#define ENET_RX_INTERRUPT ((uint32_t)kENET_RxFrameInterrupt | (uint32_t)kENET_RxBufferInterrupt) |
Enet Rx interrupt flag.
#define ENET_RX_MIN_BUFFERSIZE 256U |
ENET minimum buffer size.
#define ENET_TS_INTERRUPT ((uint32_t)kENET_TsTimerInterrupt | (uint32_t)kENET_TsAvailInterrupt) |
Enet timestamp interrupt flag.
#define ENET_TX_INTERRUPT ((uint32_t)kENET_TxFrameInterrupt | (uint32_t)kENET_TxBufferInterrupt) |
Enet Tx interrupt flag.
typedef struct _enet_buffer_config 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.
typedef struct _enet_config enet_config_t |
Defines the basic configuration structure for the ENET device.
Note:
typedef enum _enet_mii_speed 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".
typedef enum _enet_special_control_flag 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.
anonymous enum |
Defines the status return codes for transaction.
enum _enet_event |
Defines the common interrupt event for callback use.
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.
enum _enet_mii_duplex |
enum _enet_mii_mode |
enum _enet_mii_read |
enum _enet_mii_speed |
enum _enet_mii_write |
enum _enet_rx_accelerator |
Defines the receive accelerator configuration.
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.
enum _enet_tx_accelerator |
void ENET_AddMulticastGroup | ( | ENET_Type * | base, |
uint8_t * | address | ||
) |
Adds the ENET device to a multicast group.
base | ENET peripheral base address. |
address | The 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.
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).
base | ENET 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.
void ENET_Deinit | ( | ENET_Type * | base | ) |
Deinitializes the ENET module.
This function gates the module clock, clears ENET interrupts, and disables the ENET module.
base | ENET 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.
void ENET_Down | ( | ENET_Type * | base | ) |
Stops the ENET module.
This function disables the ENET module.
base | ENET peripheral base address. |
brief Stops the ENET module.
This function disables the ENET module.
param base ENET peripheral base address.
void ENET_ErrorIRQHandler | ( | ENET_Type * | base, |
enet_handle_t * | handle | ||
) |
Some special IRQ handler including the error, mii, wakeup irq handler.
base | ENET peripheral base address. |
handle | The 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.
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:
config | The 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.
uint32_t ENET_GetInstance | ( | ENET_Type * | base | ) |
Get the ENET instance from peripheral base address.
base | ENET peripheral base address. |
base | ENET peripheral base address. |
void ENET_GetMacAddr | ( | ENET_Type * | base, |
uint8_t * | macAddr | ||
) |
Gets the ENET module Mac address.
base | ENET peripheral base address. |
macAddr | The 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.
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.
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:
base | ENET peripheral base address. |
handle | The ENET handler structure. This is the same handler pointer used in the ENET_Init. |
buffer | The data buffer pointer to store the frame. |
length | The 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. |
ringId | The ring index, range from 0 ~ (FSL_FEATURE_ENET_INSTANCE_QUEUEn(x) - 1). |
isLastBuff | The flag represents whether this buffer is the last buffer to store frame. |
ts | The 1588 timestamp value, vaild in last buffer. |
kStatus_Success | Get receive buffer succeed. |
kStatus_ENET_RxFrameFail | Get 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.
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.
handle | The ENET handler structure pointer. This is the same handler pointer used in the ENET_Init. |
eErrorStatic | The error statistics structure pointer. |
ringId | The 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).
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.
base | ENET peripheral base address. |
handle | The ENET handler pointer. This is the same handler pointer used in the ENET_Init. |
rxFrame | The received frame information structure provided by user. |
ringId | The ring index or ring number. |
kStatus_Success | Succeed to get one frame and allocate new memory for Rx buffer. |
kStatus_ENET_RxFrameEmpty | There's no Rx frame in the BD. |
kStatus_ENET_RxFrameError | There's issue in this receiving. |
kStatus_ENET_RxFrameDrop | There'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.
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.
handle | The ENET handler structure. This is the same handler pointer used in the ENET_Init. |
length | The length of the valid frame received. |
ringId | The ring index or ring number. |
kStatus_ENET_RxFrameEmpty | No frame received. Should not call ENET_ReadFrame to read frame. |
kStatus_ENET_RxFrameError | Data error happens. ENET_ReadFrame should be called with NULL data and NULL length to update the receive buffers. |
kStatus_Success | Receive 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.
void ENET_GetStatistics | ( | ENET_Type * | base, |
enet_transfer_stats_t * | statistics | ||
) |
Gets statistical data in transfer.
base | ENET peripheral base address. |
statistics | The statistics structure pointer. |
brief Gets statistical data in transfer.
param base ENET peripheral base address. param statistics The statistics structure pointer.
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.
base | ENET peripheral base address. |
handle | ENET handler pointer. |
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. |
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. |
macAddr | ENET mac address of Ethernet device. This MAC address should be provided. |
srcClock_Hz | The internal module clock source for MII clock. |
kStatus_Success | Succeed to initialize the ethernet driver. |
kStatus_ENET_InitMemoryFail | Init 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.
void ENET_LeaveMulticastGroup | ( | ENET_Type * | base, |
uint8_t * | address | ||
) |
Moves the ENET device from a multicast group.
base | ENET peripheral base address. |
address | The 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.
MDIO read with IEEE802.3 Clause 22 format.
base | ENET peripheral base address. |
phyAddr | The PHY address. Range from 0 ~ 31. |
regAddr | The PHY register. Range from 0 ~ 31. |
pData | The data read from PHY. |
base | ENET peripheral base address. |
phyAddr | The PHY address. |
regAddr | The PHY register. Range from 0 ~ 31. |
pData | The data read from PHY. |
MDIO write with IEEE802.3 Clause 22 format.
base | ENET peripheral base address. |
phyAddr | The PHY address. Range from 0 ~ 31. |
regAddr | The PHY register. Range from 0 ~ 31. |
data | The data written to PHY. |
base | ENET peripheral base address. |
phyAddr | The PHY address. |
regAddr | The PHY register. Range from 0 ~ 31. |
data | The data written to PHY. |
void ENET_Ptp1588IRQHandler | ( | ENET_Type * | base | ) |
the common IRQ handler for the 1588 irq handler.
This is used for the 1588 timer interrupt.
base | ENET peripheral base address. |
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.
base | ENET peripheral base address. |
handle | The ENET handler structure. This is the same handler pointer used in the ENET_Init. |
data | The data buffer provided by user to store the frame which memory size should be at least "length". |
length | The size of the data buffer which is still the length of the received frame. |
ringId | The ring index or ring number. |
ts | The timestamp address to store received timestamp. |
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.
void ENET_ReceiveIRQHandler | ( | ENET_Type * | base, |
enet_handle_t * | handle | ||
) |
The receive IRQ handler.
base | ENET peripheral base address. |
handle | The ENET handler pointer. |
brief The receive IRQ handler.
param base ENET peripheral base address. param handle The ENET handler pointer.
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.
base | ENET peripheral base address. |
handle | The ENET handler pointer. This is the same handler pointer used in the ENET_Init. |
ringId | The 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.
void ENET_ReleaseRxBuffer | ( | ENET_Type * | base, |
enet_handle_t * | handle, | ||
void * | buffer, | ||
uint8_t | ringId | ||
) |
Release receive buffer descriptor to DMA.
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.
base | ENET peripheral base address. |
handle | The ENET handler structure. This is the same handler pointer used in the ENET_Init. |
buffer | The buffer address to store frame, using it to find the correspond BD and release it. |
ringId | The 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.
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.
base | ENET peripheral base address. |
handle | The ENET handler pointer. This is the same handler pointer used in the ENET_Init. |
data | The data buffer provided by user to send. |
length | The length of the data to send. |
ringId | The ring index or ring number. |
tsFlag | Timestamp enable flag. |
context | Used by user to handle some events after transmit over. |
kStatus_Success | Send frame succeed. |
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. |
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.
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.
base | ENET peripheral base address. |
handle | The ENET handler pointer. This is the same handler pointer used in the ENET_Init. |
data | The data buffer provided by user to send. |
length | The length of the data to send. |
ringId | The ring index or ring number. |
tsFlag | Timestamp enable flag. |
context | Used by user to handle some events after transmit over. |
kStatus_Success | Send frame succeed. |
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. |
deprecated Do not use this function. It has been superseded by ENET_StartTxFrame.
void ENET_SetCallback | ( | enet_handle_t * | handle, |
enet_callback_t | callback, | ||
void * | userData | ||
) |
Sets the callback function.
handle | ENET handler pointer. Should be provided by application. |
callback | The ENET callback function. |
userData | The callback function parameter. |
deprecated Do not use this function. It has been superceded by the config param in ENET_Init.
void ENET_SetErrISRHandler | ( | ENET_Type * | base, |
enet_isr_t | ISRHandler | ||
) |
Set the second level Err IRQ handler.
base | ENET peripheral base address. |
ISRHandler | The handler to install. |
void ENET_SetMacAddr | ( | ENET_Type * | base, |
uint8_t * | macAddr | ||
) |
Sets the ENET module Mac address.
base | ENET peripheral base address. |
macAddr | The 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.
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.
base | ENET peripheral base address. |
speed | The speed of the RMII mode. |
duplex | The 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.
void ENET_SetRxISRHandler | ( | ENET_Type * | base, |
enet_isr_t | ISRHandler | ||
) |
Set the second level Rx IRQ handler.
base | ENET peripheral base address. |
ISRHandler | The handler to install. |
void ENET_SetSMI | ( | ENET_Type * | base, |
uint32_t | srcClock_Hz, | ||
bool | isPreambleDisabled | ||
) |
Sets the ENET SMI(serial management interface)- MII management interface.
base | ENET peripheral base address. |
srcClock_Hz | This is the ENET module clock frequency. See clock distribution. |
isPreambleDisabled | The preamble disable flag.
|
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.
void ENET_SetTxISRHandler | ( | ENET_Type * | base, |
enet_isr_t | ISRHandler | ||
) |
Set the second level Tx IRQ handler.
base | ENET peripheral base address. |
ISRHandler | The handler to install. |
status_t ENET_SetTxReclaim | ( | enet_handle_t * | handle, |
bool | isEnable, | ||
uint8_t | ringId | ||
) |
Enable or disable tx descriptors reclaim mechanism.
handle | The ENET handler pointer. This is the same handler pointer used in the ENET_Init. |
isEnable | Enable or disable flag. |
ringId | The ring index or ring number. |
kStatus_Success | Succeed to enable/disable Tx reclaim. |
kStatus_Fail | Fail 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.
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.
base | ENET peripheral base address. |
handle | The ENET handler pointer. This is the same handler pointer used in the ENET_Init. |
txFrame | The Tx frame structure. |
ringId | The ring index or ring number. |
kStatus_Success | Succeed to send one frame. |
kStatus_ENET_TxFrameBusy | The BD is not ready for Tx or the reclaim operation still not finishs. |
kStatus_ENET_TxFrameOverLen | The 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.
void ENET_TransmitIRQHandler | ( | ENET_Type * | base, |
enet_handle_t * | handle | ||
) |
The transmit IRQ handler.
base | ENET peripheral base address. |
handle | The ENET handler pointer. |
brief The transmit IRQ handler.
param base ENET peripheral base address. param handle The ENET handler pointer.
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.
base | ENET peripheral base address. |
handle | ENET handler pointer. |
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. |
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. |
macAddr | ENET mac address of Ethernet device. This MAC address should be provided. |
srcClock_Hz | The internal module clock source for MII clock. |
kStatus_Success | Succeed to initialize the ethernet driver. |
kStatus_ENET_InitMemoryFail | Init 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.
uint32_t _enet_rx_bd_struct::buffer |
Data buffer pointer.
uint32_t _enet_tx_bd_struct::buffer |
Data buffer pointer.
void* _enet_buffer_struct::buffer |
The buffer store the whole or partial frame.
enet_callback_t _enet_config::callback |
General callback function.
enet_callback_t _enet_handle::callback |
Callback function.
void* enet_frame_info::context |
User specified data
void* _enet_tx_frame_struct::context |
Driver reclaims and gives it in Tx over callback, usually store network packet header.
uint16_t _enet_rx_bd_struct::control |
Buffer descriptor control and status.
uint16_t _enet_tx_bd_struct::control |
Buffer descriptor control and status.
uint32_t _enet_config::interrupt |
Mac interrupt source. A logical OR of "enet_interrupt_enable_t".
bool _enet_tx_dirty_ring::isFull |
tx ring is full flag.
uint16_t _enet_rx_bd_struct::length |
Buffer descriptor data length.
uint16_t _enet_tx_bd_struct::length |
Buffer descriptor data length.
uint16_t _enet_buffer_struct::length |
The byte length of this buffer.
uint32_t _enet_config::macSpecialConfig |
Mac special configuration. A logical OR of "enet_special_control_flag_t".
enet_mii_duplex_t _enet_config::miiDuplex |
MII duplex.
enet_mii_mode_t _enet_config::miiMode |
MII mode.
enet_mii_speed_t _enet_config::miiSpeed |
MII Speed.
uint8_t _enet_handle::multicastCount[64] |
Multicast collisions counter
uint16_t _enet_config::pauseDuration |
For flow control enabled case: Pause duration.
bool _enet_rx_frame_attribute_struct::promiscuous |
This frame is received because of promiscuous mode.
uint8_t _enet_config::ringNum |
Number of used rings. default with 1 – single ring.
uint8_t _enet_handle::ringNum |
Number of used rings.
uint8_t _enet_config::rxAccelerConfig |
Receive accelerator, A logical OR of "enet_rx_accelerator_t".
enet_rx_frame_attribute_t _enet_rx_frame_struct::rxAttribute |
Rx frame attribute structure.
volatile enet_rx_bd_struct_t* _enet_rx_bd_ring::rxBdBase |
Buffer descriptor base address pointer.
uint16_t _enet_buffer_config::rxBdNumber |
Receive buffer descriptor number.
enet_rx_bd_ring_t _enet_handle::rxBdRing[FSL_FEATURE_ENET_QUEUE] |
Receive buffer descriptor.
volatile enet_rx_bd_struct_t* _enet_buffer_config::rxBdStartAddrAlign |
Aligned receive buffer descriptor start address: should be non-cacheable.
enet_rx_alloc_callback_t _enet_config::rxBuffAlloc |
Callback function to alloc memory, must be provided for zero-copy Rx.
enet_rx_alloc_callback_t _enet_handle::rxBuffAlloc |
Callback function to alloc memory for zero copy Rx.
enet_buffer_struct_t* _enet_rx_frame_struct::rxBuffArray |
Rx frame buffer structure.
uint8_t* _enet_buffer_config::rxBufferAlign |
Receive data buffer start address.
enet_rx_free_callback_t _enet_config::rxBuffFree |
Callback function to free memory, must be provided for zero-copy Rx.
enet_rx_free_callback_t _enet_handle::rxBuffFree |
Callback function to free memory for zero copy Rx.
uint16_t _enet_buffer_config::rxBuffSizeAlign |
Aligned receive data buffer size.
uint16_t _enet_handle::rxBuffSizeAlign[FSL_FEATURE_ENET_QUEUE] |
Receive buffer size alignment.
uint8_t _enet_config::rxFifoEmptyThreshold |
For flow control enabled case: when RX FIFO level reaches this value, it makes MAC generate XOFF pause frame.
uint8_t _enet_config::rxFifoFullThreshold |
For store and forward disable case, the data required in RX FIFO to notify the MAC receive ready status.
enet_rx_frame_error_t _enet_rx_frame_struct::rxFrameError |
Rx frame error.
uint16_t _enet_rx_bd_ring::rxGenIdx |
The current available receive buffer descriptor pointer.
bool _enet_buffer_config::rxMaintainEnable |
Receive buffer cache maintain.
bool _enet_handle::rxMaintainEnable[FSL_FEATURE_ENET_QUEUE] |
Receive buffer cache maintain.
uint16_t _enet_config::rxMaxFrameLen |
Receive maximum frame length.
uint16_t _enet_rx_bd_ring::rxRingLen |
Receive ring length.
uint32_t _enet_data_error_stats::statsRxAlignErr |
Receive non-octet alignment/
bool _enet_rx_frame_error::statsRxAlignErr |
Receive non-octet alignment.
uint32_t _enet_transfer_stats::statsRxAlignErr |
Rx frame number with alignment error.
uint32_t _enet_transfer_stats::statsRxCrcErr |
Rx frame number with CRC error.
uint32_t _enet_transfer_stats::statsRxDropInvalidSFD |
Dropped frame number due to invalid SFD.
uint32_t _enet_data_error_stats::statsRxFcsErr |
Receive CRC error.
bool _enet_rx_frame_error::statsRxFcsErr |
Receive CRC error.
uint32_t _enet_transfer_stats::statsRxFifoOverflowErr |
Rx FIFO overflow count.
uint32_t _enet_transfer_stats::statsRxFrameCount |
Rx frame number.
uint32_t _enet_transfer_stats::statsRxFrameOk |
Good Rx frame number.
uint32_t _enet_data_error_stats::statsRxLenGreaterErr |
Receive length greater than RCR[MAX_FL].
bool _enet_rx_frame_error::statsRxLenGreaterErr |
Receive length greater than RCR[MAX_FL].
uint32_t _enet_data_error_stats::statsRxOverRunErr |
Receive over run.
bool _enet_rx_frame_error::statsRxOverRunErr |
Receive over run.
uint32_t _enet_data_error_stats::statsRxTruncateErr |
Receive truncate.
bool _enet_rx_frame_error::statsRxTruncateErr |
Receive truncate.
uint32_t _enet_transfer_stats::statsTxCrcAlignErr |
The transmit frame is error.
uint32_t _enet_transfer_stats::statsTxFifoUnderRunErr |
Tx FIFO underrun count.
uint32_t _enet_transfer_stats::statsTxFrameCount |
Tx frame number.
uint32_t _enet_transfer_stats::statsTxFrameOk |
Good Tx frame number.
uint16_t _enet_rx_frame_struct::totLen |
Rx frame total length.
uint8_t _enet_config::txAccelerConfig |
Transmit accelerator, A logical OR of "enet_rx_accelerator_t".
volatile enet_tx_bd_struct_t* _enet_tx_bd_ring::txBdBase |
Buffer descriptor base address pointer.
uint16_t _enet_buffer_config::txBdNumber |
Transmit buffer descriptor number.
enet_tx_bd_ring_t _enet_handle::txBdRing[FSL_FEATURE_ENET_QUEUE] |
Transmit buffer descriptor.
volatile enet_tx_bd_struct_t* _enet_buffer_config::txBdStartAddrAlign |
Aligned transmit buffer descriptor start address: should be non-cacheable.
enet_buffer_struct_t* _enet_tx_frame_struct::txBuffArray |
Tx frame buffer structure.
uint8_t* _enet_buffer_config::txBufferAlign |
Transmit data buffer start address.
uint32_t _enet_tx_frame_struct::txBuffNum |
Buffer number of this Tx frame.
uint16_t _enet_buffer_config::txBuffSizeAlign |
Aligned transmit data buffer size.
uint16_t _enet_handle::txBuffSizeAlign[FSL_FEATURE_ENET_QUEUE] |
Transmit buffer size alignment.
uint16_t _enet_tx_dirty_ring::txConsumIdx |
tx consume index.
uint16_t _enet_tx_bd_ring::txConsumIdx |
Transmit consume index.
volatile uint16_t _enet_tx_bd_ring::txDescUsed |
Transmit descriptor used number.
enet_frame_info_t* _enet_tx_dirty_ring::txDirtyBase |
Dirty buffer descriptor base address pointer.
enet_tx_dirty_ring_t _enet_handle::txDirtyRing[FSL_FEATURE_ENET_QUEUE] |
Ring to store tx frame information.
uint8_t _enet_config::txFifoWatermark |
For store and forward disable case, the data required in TX FIFO before a frame transmit start.
enet_frame_info_t* _enet_buffer_config::txFrameInfo |
Transmit frame information start address.
uint16_t _enet_tx_dirty_ring::txGenIdx |
tx generate index.
uint16_t _enet_tx_bd_ring::txGenIdx |
The current available transmit buffer descriptor pointer.
bool _enet_buffer_config::txMaintainEnable |
Transmit buffer cache maintain.
bool _enet_handle::txMaintainEnable[FSL_FEATURE_ENET_QUEUE] |
Transmit buffer cache maintain.
bool _enet_handle::txReclaimEnable[FSL_FEATURE_ENET_QUEUE] |
Tx reclaim enable flag.
uint16_t _enet_tx_dirty_ring::txRingLen |
tx ring length.
uint16_t _enet_tx_bd_ring::txRingLen |
Transmit ring length.
void* _enet_config::userData |
Callback function parameter.
void* _enet_handle::userData |
Callback function parameter.