![]() |
M480 BSP V3.05.006
The Board Support Package for M480 Series
|
Macros | |
#define | EMAC_ENABLE_TX() |
Enable EMAC Tx function. More... | |
#define | EMAC_ENABLE_RX() |
Enable EMAC Rx function. More... | |
#define | EMAC_DISABLE_TX() |
Disable EMAC Tx function. More... | |
#define | EMAC_DISABLE_RX() |
Disable EMAC Rx function. More... | |
#define | EMAC_ENABLE_MAGIC_PKT_WAKEUP() |
Enable EMAC Magic Packet Wakeup function. More... | |
#define | EMAC_DISABLE_MAGIC_PKT_WAKEUP() |
Disable EMAC Magic Packet Wakeup function. More... | |
#define | EMAC_ENABLE_RECV_BCASTPKT() |
Enable EMAC to receive broadcast packets. More... | |
#define | EMAC_DISABLE_RECV_BCASTPKT() |
Disable EMAC to receive broadcast packets. More... | |
#define | EMAC_ENABLE_RECV_MCASTPKT() |
Enable EMAC to receive multicast packets. More... | |
#define | EMAC_DISABLE_RECV_MCASTPKT() |
Disable EMAC Magic Packet Wakeup function. More... | |
#define | EMAC_GET_ALARM_FLAG() |
Check if EMAC time stamp alarm interrupt occurred or not. More... | |
#define | EMAC_CLR_ALARM_FLAG() |
Clear EMAC time stamp alarm interrupt flag. More... | |
#define | EMAC_TRIGGER_RX() do{EMAC->RXST = 0UL;}while(0) |
Trigger EMAC Rx function. More... | |
#define | EMAC_TRIGGER_TX() do{EMAC->TXST = 0UL;}while(0) |
Trigger EMAC Tx function. More... | |
#define | EMAC_ENABLE_INT(emac, u32eIntSel) |
Enable specified EMAC interrupt. More... | |
#define | EMAC_DISABLE_INT(emac, u32eIntSel) |
Disable specified EMAC interrupt. More... | |
#define | EMAC_GET_INT_FLAG(emac, u32eIntTypeFlag) |
Get specified interrupt flag/status. More... | |
#define | EMAC_CLEAR_INT_FLAG(emac, u32eIntTypeFlag) |
Clear specified interrupt flag/status. More... | |
Functions | |
void | EMAC_Open (uint8_t *pu8MacAddr) |
Initialize EMAC interface, including descriptors, MAC address, and PHY. More... | |
int32_t | EMAC_Close (void) |
This function stop all receive and transmit activity and disable MAC interface. More... | |
void | EMAC_SetMacAddr (uint8_t *pu8MacAddr) |
Set the device MAC address. More... | |
void | EMAC_EnableCamEntry (uint32_t u32Entry, uint8_t pu8MacAddr[]) |
Fill a CAM entry for MAC address comparison. More... | |
void | EMAC_DisableCamEntry (uint32_t u32Entry) |
Disable a specified CAM entry. More... | |
uint32_t | EMAC_RecvPkt (uint8_t *pu8Data, uint32_t *pu32Size) |
Receive an Ethernet packet. More... | |
uint32_t | EMAC_RecvPktTS (uint8_t *pu8Data, uint32_t *pu32Size, uint32_t *pu32Sec, uint32_t *pu32Nsec) |
Receive an Ethernet packet and the time stamp while it's received. More... | |
void | EMAC_RecvPktDone (void) |
Clean up process after a packet is received. More... | |
uint32_t | EMAC_SendPkt (uint8_t *pu8Data, uint32_t u32Size) |
Send an Ethernet packet. More... | |
uint32_t | EMAC_SendPktDone (void) |
Clean up process after packet(s) are sent. More... | |
uint32_t | EMAC_SendPktDoneTS (uint32_t *pu32Sec, uint32_t *pu32Nsec) |
Clean up process after a packet is sent, and get the time stamp while packet is sent. More... | |
void | EMAC_EnableTS (uint32_t u32Sec, uint32_t u32Nsec) |
Enable IEEE1588 time stamp function and set current time. More... | |
void | EMAC_DisableTS (void) |
Disable IEEE1588 time stamp function. More... | |
void | EMAC_GetTime (uint32_t *pu32Sec, uint32_t *pu32Nsec) |
Get current time stamp. More... | |
void | EMAC_SetTime (uint32_t u32Sec, uint32_t u32Nsec) |
Set current time stamp. More... | |
void | EMAC_UpdateTime (uint32_t u32Neg, uint32_t u32Sec, uint32_t u32Nsec) |
Add a offset to current time. More... | |
void | EMAC_EnableAlarm (uint32_t u32Sec, uint32_t u32Nsec) |
Enable alarm function and set alarm time. More... | |
void | EMAC_DisableAlarm (void) |
Disable alarm function. More... | |
uint32_t | EMAC_CheckLinkStatus (void) |
Check Ethernet link status. More... | |
int32_t | EMAC_PhyInit (void) |
int32_t | EMAC_FillCamEntry (uint8_t pu8MacAddr[]) |
Fill a MAC address to list and enable. More... | |
uint8_t * | EMAC_ClaimFreeTXBuf (void) |
Get avaiable TX buffer address. More... | |
uint32_t | EMAC_GetAvailRXBufSize (void) |
Get data length of avaiable RX buffer. More... | |
uint32_t | EMAC_SendPktWoCopy (uint32_t u32Size) |
Send an Ethernet packet. More... | |
void | EMAC_RecvPktDoneWoRxTrigger (void) |
Clean up process after a packet is received. More... | |
HIDDEN_SYMBOLS
#define EMAC_CLEAR_INT_FLAG | ( | emac, | |
u32eIntTypeFlag | |||
) |
Clear specified interrupt flag/status.
[in] | emac | The pointer of the specified EMAC module |
[in] | u32eIntTypeFlag | Interrupt Type Flag, should be
|
0 | The specified interrupt is not happened. 1 The specified interrupt is happened. |
This macro clear specified interrupt flag or interrupt indicator status.
#define EMAC_CLR_ALARM_FLAG | ( | ) |
#define EMAC_DISABLE_INT | ( | emac, | |
u32eIntSel | |||
) |
Disable specified EMAC interrupt.
[in] | emac | The pointer of the specified EMAC module |
[in] | u32eIntSel | Interrupt type select
|
This macro disable specified EMAC interrupt.
#define EMAC_DISABLE_MAGIC_PKT_WAKEUP | ( | ) |
#define EMAC_DISABLE_RECV_BCASTPKT | ( | ) |
#define EMAC_DISABLE_RECV_MCASTPKT | ( | ) |
#define EMAC_DISABLE_RX | ( | ) |
#define EMAC_DISABLE_TX | ( | ) |
#define EMAC_ENABLE_INT | ( | emac, | |
u32eIntSel | |||
) |
Enable specified EMAC interrupt.
[in] | emac | The pointer of the specified EMAC module |
[in] | u32eIntSel | Interrupt type select
|
This macro enable specified EMAC interrupt.
#define EMAC_ENABLE_MAGIC_PKT_WAKEUP | ( | ) |
#define EMAC_ENABLE_RECV_BCASTPKT | ( | ) |
#define EMAC_ENABLE_RECV_MCASTPKT | ( | ) |
#define EMAC_ENABLE_RX | ( | ) |
#define EMAC_ENABLE_TX | ( | ) |
#define EMAC_GET_ALARM_FLAG | ( | ) |
#define EMAC_GET_INT_FLAG | ( | emac, | |
u32eIntTypeFlag | |||
) |
Get specified interrupt flag/status.
[in] | emac | The pointer of the specified EMAC module |
[in] | u32eIntTypeFlag | Interrupt Type Flag, should be
|
This macro get specified interrupt flag or interrupt indicator status.
#define EMAC_TRIGGER_RX | ( | ) | do{EMAC->RXST = 0UL;}while(0) |
#define EMAC_TRIGGER_TX | ( | ) | do{EMAC->TXST = 0UL;}while(0) |
uint32_t EMAC_CheckLinkStatus | ( | void | ) |
Check Ethernet link status.
None |
uint8_t * EMAC_ClaimFreeTXBuf | ( | void | ) |
int32_t EMAC_Close | ( | void | ) |
This function stop all receive and transmit activity and disable MAC interface.
None |
0 | Disable EMAC success |
EMAC_TIMEOUT_ERR | Disable EMAC failed because reset EMAC state machine takes longer than expected |
void EMAC_DisableAlarm | ( | void | ) |
void EMAC_DisableCamEntry | ( | uint32_t | u32Entry | ) |
void EMAC_DisableTS | ( | void | ) |
void EMAC_EnableAlarm | ( | uint32_t | u32Sec, |
uint32_t | u32Nsec | ||
) |
void EMAC_EnableCamEntry | ( | uint32_t | u32Entry, |
uint8_t | pu8MacAddr[] | ||
) |
void EMAC_EnableTS | ( | uint32_t | u32Sec, |
uint32_t | u32Nsec | ||
) |
int32_t EMAC_FillCamEntry | ( | uint8_t | pu8MacAddr[] | ) |
uint32_t EMAC_GetAvailRXBufSize | ( | void | ) |
void EMAC_GetTime | ( | uint32_t * | pu32Sec, |
uint32_t * | pu32Nsec | ||
) |
void EMAC_Open | ( | uint8_t * | pu8MacAddr | ) |
Initialize EMAC interface, including descriptors, MAC address, and PHY.
[in] | pu8MacAddr | Pointer to uint8_t array holds MAC address |
int32_t EMAC_PhyInit | ( | void | ) |
uint32_t EMAC_RecvPkt | ( | uint8_t * | pu8Data, |
uint32_t * | pu32Size | ||
) |
Receive an Ethernet packet.
[in] | pu8Data | Pointer to a buffer to store received packet (4 byte CRC removed) |
[in] | pu32Size | Received packet size (without 4 byte CRC). |
0 | No packet available for receive |
1 | A packet is received |
EMAC_BUS_ERR | Bus error |
void EMAC_RecvPktDone | ( | void | ) |
Clean up process after a packet is received.
None |
EMAC Rx interrupt service routine must call this API to release the resource use by receive process
void EMAC_RecvPktDoneWoRxTrigger | ( | void | ) |
Clean up process after a packet is received.
None |
Caller must call the function to release the resource.
uint32_t EMAC_RecvPktTS | ( | uint8_t * | pu8Data, |
uint32_t * | pu32Size, | ||
uint32_t * | pu32Sec, | ||
uint32_t * | pu32Nsec | ||
) |
Receive an Ethernet packet and the time stamp while it's received.
[out] | pu8Data | Pointer to a buffer to store received packet (4 byte CRC removed) |
[out] | pu32Size | Received packet size (without 4 byte CRC). |
[out] | pu32Sec | Second value while packet received |
[out] | pu32Nsec | Nano second value while packet received |
0 | No packet available for receive |
1 | A packet is received |
EMAC_BUS_ERR | Bus error |
uint32_t EMAC_SendPkt | ( | uint8_t * | pu8Data, |
uint32_t | u32Size | ||
) |
Send an Ethernet packet.
[in] | pu8Data | Pointer to a buffer holds the packet to transmit |
[in] | u32Size | Packet size (without 4 byte CRC). |
0 | Transmit failed due to descriptor unavailable. |
1 | Packet is copied to descriptor and triggered to transmit. |
uint32_t EMAC_SendPktDone | ( | void | ) |
Clean up process after packet(s) are sent.
None |
EMAC_BUS_ERR | Bus error |
Otherwise | Number of packet sent between two function calls |
EMAC Tx interrupt service routine must call this API or EMAC_SendPktDoneTS to release the resource use by transmit process
uint32_t EMAC_SendPktDoneTS | ( | uint32_t * | pu32Sec, |
uint32_t * | pu32Nsec | ||
) |
Clean up process after a packet is sent, and get the time stamp while packet is sent.
[in] | pu32Sec | Second value while packet sent |
[in] | pu32Nsec | Nano second value while packet sent |
0 | No packet sent successfully, and the value in *pu32Sec and *pu32Nsec are meaningless |
1 | A packet sent successfully, and the value in *pu32Sec and *pu32Nsec is the time stamp while packet sent |
EMAC_BUS_ERR | Bus error |
EMAC Tx interrupt service routine must call this API or EMAC_SendPktDone to release the resource use by transmit process
uint32_t EMAC_SendPktWoCopy | ( | uint32_t | u32Size | ) |
Send an Ethernet packet.
[in] | u32Size | Packet size (without 4 byte CRC). |
0 | Transmit failed due to descriptor unavailable. |
1 | Triggered to transmit. |
void EMAC_SetMacAddr | ( | uint8_t * | pu8MacAddr | ) |
void EMAC_SetTime | ( | uint32_t | u32Sec, |
uint32_t | u32Nsec | ||
) |
void EMAC_UpdateTime | ( | uint32_t | u32Neg, |
uint32_t | u32Sec, | ||
uint32_t | u32Nsec | ||
) |