This section describes the programming interface of the ENET HAL driver.
|
enum | enet_status_t { ,
kStatus_ENET_InvalidInput,
kStatus_ENET_InvalidDevice,
kStatus_ENET_InitTimeout,
kStatus_ENET_MemoryAllocateFail,
kStatus_ENET_GetClockFreqFail,
kStatus_ENET_Initialized,
kStatus_ENET_Open,
kStatus_ENET_Close,
kStatus_ENET_Layer2UnInitialized,
kStatus_ENET_Layer2OverLarge,
kStatus_ENET_Layer2BufferFull,
kStatus_ENET_Layer2TypeError,
kStatus_ENET_PtpringBufferFull,
kStatus_ENET_PtpringBufferEmpty,
kStatus_ENET_SMIUninitialized,
kStatus_ENET_SMIVisitTimeout,
kStatus_ENET_RxbdInvalid,
kStatus_ENET_RxbdEmpty,
kStatus_ENET_RxbdTrunc,
kStatus_ENET_RxbdError,
kStatus_ENET_RxBdFull,
kStatus_ENET_SmallRxBuffSize,
kStatus_ENET_NoEnoughRxBuffers,
kStatus_ENET_LargeBufferFull,
kStatus_ENET_TxLarge,
kStatus_ENET_TxbdFull,
kStatus_ENET_TxbdNull,
kStatus_ENET_TxBufferNull,
kStatus_ENET_NoRxBufferLeft,
kStatus_ENET_UnknownCommand,
kStatus_ENET_TimeOut,
kStatus_ENET_MulticastPointerNull,
kStatus_ENET_NoMulticastAddr,
kStatus_ENET_AlreadyAddedMulticast,
kStatus_ENET_PHYAutoDiscoverFail
} |
| Defines the Status return codes. More...
|
|
enum | enet_rx_bd_control_status_t {
kEnetRxBdEmpty = 0x8000U,
kEnetRxBdRxSoftOwner1 = 0x4000U,
kEnetRxBdWrap = 0x2000U,
kEnetRxBdRxSoftOwner2 = 0x1000U,
kEnetRxBdLast = 0x0800U,
kEnetRxBdMiss = 0x0100U,
kEnetRxBdBroadCast = 0x0080U,
kEnetRxBdMultiCast = 0x0040U,
kEnetRxBdLengthViolation = 0x0020U,
kEnetRxBdNoOctet = 0x0010U,
kEnetRxBdCrc = 0x0004U,
kEnetRxBdOverRun = 0x0002U,
kEnetRxBdTrunc = 0x0001U
} |
| Defines the control and status region of the receive buffer descriptor. More...
|
|
enum | enet_rx_bd_control_extend0_t {
kEnetRxBdIpv4 = 0x0001U,
kEnetRxBdIpv6 = 0x0002U,
kEnetRxBdVlan = 0x0004U,
kEnetRxBdProtocolChecksumErr = 0x0010U,
kEnetRxBdIpHeaderChecksumErr = 0x0020U
} |
| Defines the control extended region1 of the receive buffer descriptor. More...
|
|
enum | enet_rx_bd_control_extend1_t {
kEnetRxBdIntrrupt = 0x0080U,
kEnetRxBdUnicast = 0x0100U,
kEnetRxBdCollision = 0x0200U,
kEnetRxBdPhyErr = 0x0400U,
kEnetRxBdMacErr = 0x8000U
} |
| Defines the control extended region2 of the receive buffer descriptor. More...
|
|
enum | enet_tx_bd_control_status_t {
kEnetTxBdReady = 0x8000U,
kEnetTxBdTxSoftOwner1 = 0x4000U,
kEnetTxBdWrap = 0x2000U,
kEnetTxBdTxSoftOwner2 = 0x1000U,
kEnetTxBdLast = 0x0800U,
kEnetTxBdTransmitCrc = 0x0400U
} |
| Defines the control status of the transmit buffer descriptor. More...
|
|
enum | enet_tx_bd_control_extend0_t {
kEnetTxBdTxErr = 0x8000U,
kEnetTxBdTxUnderFlowErr = 0x2000U,
kEnetTxBdExcessCollisionErr = 0x1000U,
kEnetTxBdTxFrameErr = 0x0800U,
kEnetTxBdLatecollisionErr = 0x0400U,
kEnetTxBdOverFlowErr = 0x0200U,
kEnetTxTimestampErr = 0x0100U
} |
| Defines the control extended region1 of the transmit buffer descriptor. More...
|
|
enum | enet_tx_bd_control_extend1_t {
kEnetTxBdTxInterrupt = 0x4000U,
kEnetTxBdTimeStamp = 0x2000U
} |
| Defines the control extended region2 of the transmit buffer descriptor. More...
|
|
enum | enet_constant_parameter_t {
kEnetMacAddrLen = 6U,
kEnetHashValMask = 0x1FU,
kEnetMinBuffSize = 256U,
kEnetMaxTimeout = 0xFFFFU,
kEnetMdcFreq = 2500000U
} |
| Defines the macro to the different ENET constant value. More...
|
|
enum | enet_fifo_configure_t {
kEnetMinTxFifoAlmostFull = 6U,
kEnetMinFifoAlmostEmpty = 4U,
kEnetDefaultTxFifoAlmostFull = 8U
} |
| Defines the normal FIFO configuration for ENET MAC. More...
|
|
enum | enet_mac_operate_mode_t {
kEnetMacNormalMode = 0U,
kEnetMacSleepMode = 1U
} |
| Defines the normal operating mode and sleep mode for ENET MAC. More...
|
|
enum | enet_config_rmii_mode_t {
kEnetCfgMii = 0U,
kEnetCfgRmii = 1U
} |
| Defines the RMII or MII mode for data interface between the MAC and the PHY. More...
|
|
enum | enet_config_speed_t {
kEnetCfgSpeed100M = 0U,
kEnetCfgSpeed10M = 1U
} |
| Defines the 10 Mbps or 100 Mbps speed mode for the data transfer. More...
|
|
enum | enet_config_duplex_t {
kEnetCfgHalfDuplex = 0U,
kEnetCfgFullDuplex = 1U
} |
| Defines the half or full duplex mode for the data transfer. More...
|
|
enum | enet_mii_write_t {
kEnetWriteNoCompliant = 0U,
kEnetWriteValidFrame = 1U
} |
| Defines the write operation for the MII. More...
|
|
enum | enet_mii_read_t {
kEnetReadValidFrame = 2U,
kEnetReadNoCompliant = 3U
} |
| Defines the read operation for the MII. More...
|
|
enum | enet_special_address_filter_t {
kEnetSpecialAddressInit = 0U,
kEnetSpecialAddressEnable = 1U,
kEnetSpecialAddressDisable = 2U
} |
| Defines the initialization, enables or disables the operation for a special address filter. More...
|
|
enum | enet_timer_channel_t {
kEnetTimerChannel1 = 0U,
kEnetTimerChannel2 = 1U,
kEnetTimerChannel3 = 2U,
kEnetTimerChannel4 = 3U
} |
| Defines the IEEE 1588 timer channel numbers. More...
|
|
enum | enet_timer_channel_mode_t {
kEnetChannelDisable = 0U,
kEnetChannelRisingCapture = 1U,
kEnetChannelFallingCapture = 2U,
kEnetChannelBothCapture = 3U,
kEnetChannelSoftCompare = 4U,
kEnetChannelToggleCompare = 5U,
kEnetChannelClearCompare = 6U,
kEnetChannelSetCompare = 7U,
kEnetChannelClearCompareSetOverflow = 10U,
kEnetChannelSetCompareClearOverflow = 11U,
kEnetChannelPulseLowonCompare = 14U,
kEnetChannelPulseHighonCompare = 15U
} |
| Defines the capture or compare mode for IEEE 1588 timer channels. More...
|
|
enum | enet_interrupt_request_t {
kEnetBabrInterrupt = 0x40000000U,
kEnetBabtInterrupt = 0x20000000U,
kEnetGraceStopInterrupt = 0x10000000U,
kEnetTxFrameInterrupt = 0x08000000U,
kEnetTxByteInterrupt = 0x04000000U,
kEnetRxFrameInterrupt = 0x02000000U,
kEnetRxByteInterrupt = 0x01000000U,
kEnetMiiInterrupt = 0x00800000U,
kEnetEBusERInterrupt = 0x00400000U,
kEnetLateCollisionInterrupt = 0x00200000U,
kEnetRetryLimitInterrupt = 0x00100000U,
kEnetUnderrunInterrupt = 0x00080000U,
kEnetPayloadRxInterrupt = 0x00040000U,
kEnetWakeupInterrupt = 0x00020000U,
kEnetTsAvailInterrupt = 0x00010000U,
kEnetTsTimerInterrupt = 0x00008000U,
kEnetAllInterrupt = 0x7FFFFFFFU
} |
| Defines the RXFRAME/RXBYTE/TXFRAME/TXBYTE/MII/TSTIMER/TSAVAIL interrupt source for ENET. More...
|
|
enum | enet_irq_number_t {
kEnetTsTimerNumber = 0,
kEnetReceiveNumber = 1,
kEnetTransmitNumber = 2,
kEnetMiiErrorNumber = 3
} |
|
enum | enet_frame_max_t {
kEnetNsecOneSec = 1000000000,
kEnetMaxFrameSize = 1518,
kEnetMaxFrameVlanSize = 1522,
kEnetMaxFrameDateSize = 1500,
kEnetDefaultTruncLen = 2047,
kEnetDefaultIpg = 12,
kEnetMaxValidTxIpg = 27,
kEnetMinValidTxIpg = 8,
kEnetMaxMdioHoldCycle = 7,
kEnetMaxFrameBdNumbers = 6,
kEnetFrameFcsLen = 4,
kEnetEthernetHeadLen = 14,
kEnetEthernetVlanHeadLen = 18
} |
| Defines the ENET main constant. More...
|
|
enum | enet_txaccelerator_config_t {
kEnetTxAccelisShift16Enabled = 0x01U,
kEnetTxAccelIpCheckEnabled = 0x08U,
kEnetTxAccelProtoCheckEnabled = 0x10U
} |
| Defines the transmit accelerator configuration. More...
|
|
enum | enet_rxaccelerator_config_t {
kEnetRxAccelPadRemoveEnabled = 0x01U,
kEnetRxAccelIpCheckEnabled = 0x02U,
kEnetRxAccelProtoCheckEnabled = 0x04U,
kEnetRxAccelMacCheckEnabled = 0x40U,
kEnetRxAccelisShift16Enabled = 0x80U
} |
| Defines the receive accelerator configuration. More...
|
|
enum | enet_mac_control_flag_t {
kEnetStopModeEnable = 0x1U
,
kEnetPayloadlenCheckEnable = 0x4U,
kEnetRxFlowControlEnable = 0x8U,
kEnetRxCrcFwdEnable = 0x10U,
kEnetRxPauseFwdEnable = 0x20U,
kEnetRxPadRemoveEnable = 0x40U,
kEnetRxBcRejectEnable = 0x80U,
kEnetRxPromiscuousEnable = 0x100U,
kEnetTxCrcFwdEnable = 0x200U,
kEnetTxCrcBdEnable = 0x400U,
kEnetMacAddrInsert = 0x800U,
kEnetTxAccelEnable = 0x1000U,
kEnetRxAccelEnable = 0x2000U,
kEnetStoreAndFwdEnable = 0x4000U,
kEnetMacMibEnable = 0x8000U,
kEnetSMIPreambleDisable = 0x10000U,
kEnetVlanTagEnabled = 0x20000U,
kEnetMacEnhancedEnable = 0x40000U
} |
| Defines the ENET MAC control Configure. More...
|
|
enum | enet_en_dynamical_act_t {
kEnGraceSendStop,
kEnSendPauseFrame,
kEnClearMibCounter
} |
| The action of mac which should be enabled dynamically. More...
|
|
|
enet_status_t | ENET_HAL_Init (ENET_Type *base) |
| Initializes the ENET module to reset status. More...
|
|
void | ENET_HAL_Config (ENET_Type *base, const enet_mac_config_t *macCfgPtr, const uint32_t sysClk, const enet_bd_config *bdConfig) |
| Configures the ENET. More...
|
|
void | ENET_HAL_GetStatus (ENET_Type *base, const uint32_t mask, enet_cur_status_t *curStatus) |
| Gets the ENET status. More...
|
|
void | ENET_HAL_SetMulticastAddrHash (ENET_Type *base, uint32_t crcValue, enet_special_address_filter_t mode) |
| Sets the hardware addressing filtering to a multicast group address. More...
|
|
void | ENET_HAL_GetBufDescripAttr (volatile enet_bd_struct_t *curBd, const uint64_t mask, enet_bd_attr_t *resultAttr) |
| Gets the attribute field value of buffer descriptor structure and flag status in the control field. More...
|
|
uint8_t * | ENET_HAL_GetBuffDescripData (volatile enet_bd_struct_t *curBd) |
| Gets the buffer address of the buffer descriptors. More...
|
|
void | ENET_HAL_ClrRxBdAfterHandled (volatile enet_bd_struct_t *rxBds, uint8_t *data, bool isbufferUpdate) |
| Clears the receive buffer descriptor flag after it has been received or encountered some error in the receiving process. More...
|
|
void | ENET_HAL_SetTxBdBeforeSend (volatile enet_bd_struct_t *txBds, uint16_t length, bool isTxtsCfged, bool isTxCrcEnable, bool isLastOne) |
| Sets the transmit buffer descriptor flag before sending a frame. More...
|
|
static void | ENET_HAL_ClrTxBdAfterSend (volatile enet_bd_struct_t *curBd) |
| Clears the context in the transmit buffer descriptors. More...
|
|
static void | ENET_HAL_SetRxBdActive (ENET_Type *base) |
| Activates the receive buffer descriptor. More...
|
|
static void | ENET_HAL_SetTxBdActive (ENET_Type *base) |
| Activates the transmit buffer descriptor. More...
|
|
void | ENET_HAL_SetRMIIMode (ENET_Type *base, enet_config_rmii_t *rmiiCfgPtr) |
| Configures the (R)MII data interface of ENET. More...
|
|
static uint32_t | ENET_HAL_GetSMIData (ENET_Type *base) |
| Reads data from PHY. More...
|
|
void | ENET_HAL_SetSMIRead (ENET_Type *base, uint32_t phyAddr, uint32_t phyReg, enet_mii_read_t operation) |
| Sets the Serial Management interface (SMI) read command. More...
|
|
void | ENET_HAL_SetSMIWrite (ENET_Type *base, uint32_t phyAddr, uint32_t phyReg, enet_mii_write_t operation, uint32_t data) |
| Sets the SMI write command. More...
|
|
void | ENET_HAL_EnDynamicalAct (ENET_Type *base, enet_en_dynamical_act_t action, bool enable) |
| Enables/disables the Mac dynamical action. More...
|
|
static void | ENET_HAL_Enable (ENET_Type *base) |
| Enables the ENET module. More...
|
|
static void | ENET_HAL_Disable (ENET_Type *base) |
| Disables the ENET module. More...
|
|
void | ENET_HAL_SetIntMode (ENET_Type *base, enet_interrupt_request_t source, bool enable) |
| Enables/disables the ENET interrupt. More...
|
|
static void | ENET_HAL_ClearIntStatusFlag (ENET_Type *base, enet_interrupt_request_t source) |
| Clears ENET interrupt events. More...
|
|
static bool | ENET_HAL_GetIntStatusFlag (ENET_Type *base, enet_interrupt_request_t source) |
| Gets the ENET interrupt status. More...
|
|
void | ENET_HAL_Start1588Timer (ENET_Type *base, enet_config_ptp_timer_t *ptpCfgPtr) |
| Configures the IEEE 1588 timer and runs the IEEE 1588 timer. More...
|
|
void | ENET_HAL_Stop1588Timer (ENET_Type *base) |
| Stops the IEEE 1588 timer. More...
|
|
static void | ENET_HAL_Adjust1588Timer (ENET_Type *base, uint32_t increaseCorrection, uint32_t periodCorrection) |
| Adjusts the IEEE 1588 timer. More...
|
|
static void | ENET_HAL_Set1588TimerNewTime (ENET_Type *base, uint32_t nanSecond) |
| Sets the IEEE 1588 timer. More...
|
|
static uint32_t | ENET_HAL_Get1588TimerCurrentTime (ENET_Type *base) |
| Gets the time from the IEEE 1588 timer. More...
|
|
static bool | ENET_HAL_Get1588TimerChnStatus (ENET_Type *base, enet_timer_channel_t channel) |
| Gets the IEEE 1588 timer channel status. More...
|
|
static void | ENET_HAL_Rst1588TimerCmpValAndClrFlag (ENET_Type *base, enet_timer_channel_t channel, uint32_t compareValue) |
| Resets the IEEE 1588 timer compare value and clears the IEEE 1588 timer channel interrupt flag. More...
|
|