EMAC_Public_Functions
[EMAC]
Functions | |
Status | EMAC_Init (EMAC_CFG_Type *EMAC_ConfigStruct) |
Initializes the EMAC peripheral according to the specified parameters in the EMAC_ConfigStruct. | |
void | EMAC_DeInit (void) |
De-initializes the EMAC peripheral registers to their default reset values. | |
int32_t | EMAC_CheckPHYStatus (uint32_t ulPHYState) |
Check specified PHY status in EMAC peripheral. | |
int32_t | EMAC_SetPHYMode (uint32_t ulPHYMode) |
Set specified PHY mode in EMAC peripheral. | |
int32_t | EMAC_UpdatePHYStatus (void) |
Auto-Configures value for the EMAC configuration register to match with current PHY mode. | |
void | EMAC_SetHashFilter (uint8_t dstMAC_addr[], FunctionalState NewState) |
Enable/Disable hash filter functionality for specified destination MAC address in EMAC module. | |
int32_t | EMAC_CRCCalc (uint8_t frame_no_fcs[], int32_t frame_len) |
Calculates CRC code for number of bytes in the frame. | |
void | EMAC_SetFilterMode (uint32_t ulFilterMode, FunctionalState NewState) |
Enable/Disable Filter mode for each specified type EMAC peripheral. | |
FlagStatus | EMAC_GetWoLStatus (uint32_t ulWoLMode) |
Get status of Wake On LAN Filter for each specified type in EMAC peripheral, clear this status if it is set. | |
void | EMAC_WritePacketBuffer (EMAC_PACKETBUF_Type *pDataStruct) |
Write data to Tx packet data buffer at current index due to TxProduceIndex. | |
void | EMAC_ReadPacketBuffer (EMAC_PACKETBUF_Type *pDataStruct) |
Read data from Rx packet data buffer at current index due to RxConsumeIndex. | |
void | EMAC_StandardIRQHandler (void) |
Standard EMAC IRQ Handler. This sub-routine will check these following interrupt and call the call-back function if they're already installed:
| |
void | EMAC_SetupIntCBS (uint32_t ulIntType, EMAC_IntCBSType *pfnIntCb) |
Setup/register Call-back function for each interrupt type in EMAC module. | |
void | EMAC_IntCmd (uint32_t ulIntType, FunctionalState NewState) |
Enable/Disable interrupt for each type in EMAC. | |
IntStatus | EMAC_IntGetStatus (uint32_t ulIntType) |
Check whether if specified interrupt flag is set or not for each interrupt type in EMAC and clear interrupt pending if it is set. | |
Bool | EMAC_CheckReceiveIndex (void) |
Check whether if the current RxConsumeIndex is not equal to the current RxProduceIndex. | |
Bool | EMAC_CheckTransmitIndex (void) |
Check whether if the current TxProduceIndex is not equal to the current RxProduceIndex - 1. | |
FlagStatus | EMAC_CheckReceiveDataStatus (uint32_t ulRxStatType) |
Get current status value of receive data (due to RxConsumeIndex). | |
uint32_t | EMAC_GetReceiveDataSize (void) |
Get size of current Received data in received buffer (due to RxConsumeIndex). | |
void | EMAC_UpdateRxConsumeIndex (void) |
Increase the RxConsumeIndex (after reading the Receive buffer to release the Receive buffer) and wrap-around the index if it reaches the maximum Receive Number. | |
void | EMAC_UpdateTxProduceIndex (void) |
Increase the TxProduceIndex (after writting to the Transmit buffer to enable the Transmit buffer) and wrap-around the index if it reaches the maximum Transmit Number. |
Function Documentation
int32_t EMAC_CheckPHYStatus | ( | uint32_t | ulPHYState | ) |
Check specified PHY status in EMAC peripheral.
- Parameters:
-
[in] ulPHYState Specified PHY Status Type, should be: - EMAC_PHY_STAT_LINK: Link Status
- EMAC_PHY_STAT_SPEED: Speed Status
- EMAC_PHY_STAT_DUP: Duplex Status
- Returns:
- Status of specified PHY status (0 or 1). (-1) if error.
- 0: Link Down
- 1: Link Up For EMAC_PHY_STAT_SPEED, return value:
- 0: 10Mbps
- 1: 100Mbps For EMAC_PHY_STAT_DUP, return value:
- 0: Half-Duplex
- 1: Full-Duplex
Definition at line 375 of file lpc17xx_emac.c.
FlagStatus EMAC_CheckReceiveDataStatus | ( | uint32_t | ulRxStatType | ) |
Get current status value of receive data (due to RxConsumeIndex).
- Parameters:
-
[in] ulRxStatType Received Status type, should be one of following: - EMAC_RINFO_CTRL_FRAME: Control Frame
- EMAC_RINFO_VLAN: VLAN Frame
- EMAC_RINFO_FAIL_FILT: RX Filter Failed
- EMAC_RINFO_MCAST: Multicast Frame
- EMAC_RINFO_BCAST: Broadcast Frame
- EMAC_RINFO_CRC_ERR: CRC Error in Frame
- EMAC_RINFO_SYM_ERR: Symbol Error from PHY
- EMAC_RINFO_LEN_ERR: Length Error
- EMAC_RINFO_RANGE_ERR: Range error(exceeded max size)
- EMAC_RINFO_ALIGN_ERR: Alignment error
- EMAC_RINFO_OVERRUN: Receive overrun
- EMAC_RINFO_NO_DESCR: No new Descriptor available
- EMAC_RINFO_LAST_FLAG: last Fragment in Frame
- EMAC_RINFO_ERR: Error Occurred (OR of all error)
- Returns:
- Current value of receive data (due to RxConsumeIndex)
Definition at line 923 of file lpc17xx_emac.c.
Bool EMAC_CheckReceiveIndex | ( | void | ) |
Check whether if the current RxConsumeIndex is not equal to the current RxProduceIndex.
- Parameters:
-
[in] None
- Returns:
- TRUE if they're not equal, otherwise return FALSE
Definition at line 873 of file lpc17xx_emac.c.
Bool EMAC_CheckTransmitIndex | ( | void | ) |
Check whether if the current TxProduceIndex is not equal to the current RxProduceIndex - 1.
- Parameters:
-
[in] None
- Returns:
- TRUE if they're not equal, otherwise return FALSE
Definition at line 893 of file lpc17xx_emac.c.
int32_t EMAC_CRCCalc | ( | uint8_t | frame_no_fcs[], | |
int32_t | frame_len | |||
) |
Calculates CRC code for number of bytes in the frame.
- Parameters:
-
[in] frame_no_fcs Pointer to the first byte of the frame [in] frame_len length of the frame without the FCS
- Returns:
- the CRC as a 32 bit integer
Definition at line 572 of file lpc17xx_emac.c.
void EMAC_DeInit | ( | void | ) |
De-initializes the EMAC peripheral registers to their default reset values.
- Parameters:
-
[in] None
- Returns:
- None
Definition at line 343 of file lpc17xx_emac.c.
uint32_t EMAC_GetReceiveDataSize | ( | void | ) |
Get size of current Received data in received buffer (due to RxConsumeIndex).
- Parameters:
-
[in] None
- Returns:
- Size of received data
Definition at line 937 of file lpc17xx_emac.c.
FlagStatus EMAC_GetWoLStatus | ( | uint32_t | ulWoLMode | ) |
Get status of Wake On LAN Filter for each specified type in EMAC peripheral, clear this status if it is set.
- Parameters:
-
[in] ulWoLMode WoL Filter mode, should be: - EMAC_WOL_UCAST: unicast frames caused WoL
- EMAC_WOL_UCAST: broadcast frame caused WoL
- EMAC_WOL_MCAST: multicast frame caused WoL
- EMAC_WOL_UCAST_HASH: unicast frame that passes the imperfect hash filter caused WoL
- EMAC_WOL_MCAST_HASH: multicast frame that passes the imperfect hash filter caused WoL
- EMAC_WOL_PERFECT:perfect address matching filter caused WoL
- EMAC_WOL_RX_FILTER: the receive filter caused WoL
- EMAC_WOL_MAG_PACKET: the magic packet filter caused WoL
- Returns:
- SET/RESET
Definition at line 663 of file lpc17xx_emac.c.
Status EMAC_Init | ( | EMAC_CFG_Type * | EMAC_ConfigStruct | ) |
Initializes the EMAC peripheral according to the specified parameters in the EMAC_ConfigStruct.
- Parameters:
-
[in] EMAC_ConfigStruct Pointer to a EMAC_CFG_Type structure that contains the configuration information for the specified EMAC peripheral.
- Returns:
- None
- Remove the soft reset condition from the MAC
- Configure the PHY via the MIIM interface of the MAC
- Select RMII mode
- Configure the transmit and receive DMA engines, including the descriptor arrays
- Configure the host registers (MAC1,MAC2 etc.) in the MAC
- Enable the receive and transmit data paths In default state after initializing, only Rx Done and Tx Done interrupt are enabled, all remain interrupts are disabled (Ref. from LPC17xx UM)
Definition at line 247 of file lpc17xx_emac.c.
void EMAC_IntCmd | ( | uint32_t | ulIntType, | |
FunctionalState | NewState | |||
) |
Enable/Disable interrupt for each type in EMAC.
- Parameters:
-
[in] ulIntType Interrupt Type, should be: - EMAC_INT_RX_OVERRUN: Receive Overrun
- EMAC_INT_RX_ERR: Receive Error
- EMAC_INT_RX_FIN: Receive Descriptor Finish
- EMAC_INT_RX_DONE: Receive Done
- EMAC_INT_TX_UNDERRUN: Transmit Under-run
- EMAC_INT_TX_ERR: Transmit Error
- EMAC_INT_TX_FIN: Transmit descriptor finish
- EMAC_INT_TX_DONE: Transmit Done
- EMAC_INT_SOFT_INT: Software interrupt
- EMAC_INT_WAKEUP: Wakeup interrupt
[in] NewState New State of this function, should be: - ENABLE.
- DISABLE.
- Returns:
- None
Definition at line 826 of file lpc17xx_emac.c.
IntStatus EMAC_IntGetStatus | ( | uint32_t | ulIntType | ) |
Check whether if specified interrupt flag is set or not for each interrupt type in EMAC and clear interrupt pending if it is set.
- Parameters:
-
[in] ulIntType Interrupt Type, should be: - EMAC_INT_RX_OVERRUN: Receive Overrun
- EMAC_INT_RX_ERR: Receive Error
- EMAC_INT_RX_FIN: Receive Descriptor Finish
- EMAC_INT_RX_DONE: Receive Done
- EMAC_INT_TX_UNDERRUN: Transmit Under-run
- EMAC_INT_TX_ERR: Transmit Error
- EMAC_INT_TX_FIN: Transmit descriptor finish
- EMAC_INT_TX_DONE: Transmit Done
- EMAC_INT_SOFT_INT: Software interrupt
- EMAC_INT_WAKEUP: Wakeup interrupt
- Returns:
- New state of specified interrupt (SET or RESET)
Definition at line 852 of file lpc17xx_emac.c.
void EMAC_ReadPacketBuffer | ( | EMAC_PACKETBUF_Type * | pDataStruct | ) |
Read data from Rx packet data buffer at current index due to RxConsumeIndex.
- Parameters:
-
[in] pDataStruct Pointer to a EMAC_PACKETBUF_Type structure data that contain specified information about Packet data buffer.
- Returns:
- None
Definition at line 705 of file lpc17xx_emac.c.
void EMAC_SetFilterMode | ( | uint32_t | ulFilterMode, | |
FunctionalState | NewState | |||
) |
Enable/Disable Filter mode for each specified type EMAC peripheral.
- Parameters:
-
[in] ulFilterMode Filter mode, should be: - EMAC_RFC_UCAST_EN: all frames of unicast types will be accepted
- EMAC_RFC_BCAST_EN: broadcast frame will be accepted
- EMAC_RFC_MCAST_EN: all frames of multicast types will be accepted
- EMAC_RFC_UCAST_HASH_EN: The imperfect hash filter will be applied to unicast addresses
- EMAC_RFC_MCAST_HASH_EN: The imperfect hash filter will be applied to multicast addresses
- EMAC_RFC_PERFECT_EN: the destination address will be compared with the 6 byte station address programmed in the station address by the filter
- EMAC_RFC_MAGP_WOL_EN: the result of the magic packet filter will generate a WoL interrupt when there is a match
- EMAC_RFC_PFILT_WOL_EN: the result of the perfect address matching filter and the imperfect hash filter will generate a WoL interrupt when there is a match
[in] NewState New State of this command, should be: - ENABLE
- DISABLE
- Returns:
- None
Definition at line 637 of file lpc17xx_emac.c.
void EMAC_SetHashFilter | ( | uint8_t | dstMAC_addr[], | |
FunctionalState | NewState | |||
) |
Enable/Disable hash filter functionality for specified destination MAC address in EMAC module.
- Parameters:
-
[in] dstMAC_addr Pointer to the first MAC destination address, should be 6-bytes length, in order LSB to the MSB [in] NewState New State of this command, should be: - ENABLE.
- DISABLE.
- Returns:
- None
Definition at line 542 of file lpc17xx_emac.c.
int32_t EMAC_SetPHYMode | ( | uint32_t | ulPHYMode | ) |
Set specified PHY mode in EMAC peripheral.
- Parameters:
-
[in] ulPHYMode Specified PHY mode, should be: - EMAC_MODE_AUTO
- EMAC_MODE_10M_FULL
- EMAC_MODE_10M_HALF
- EMAC_MODE_100M_FULL
- EMAC_MODE_100M_HALF
- Returns:
- Return (0) if no error, otherwise return (-1)
Definition at line 408 of file lpc17xx_emac.c.
void EMAC_SetupIntCBS | ( | uint32_t | ulIntType, | |
EMAC_IntCBSType * | pfnIntCb | |||
) |
Setup/register Call-back function for each interrupt type in EMAC module.
- Parameters:
-
[in] ulIntType Interrupt type, should be one of the following: - EMAC_INT_RX_OVERRUN: Receive Overrun
- EMAC_INT_RX_ERR: Receive Error
- EMAC_INT_RX_FIN: Receive Descriptor Finish
- EMAC_INT_RX_DONE: Receive Done
- EMAC_INT_TX_UNDERRUN: Transmit Under-run
- EMAC_INT_TX_ERR: Transmit Error
- EMAC_INT_TX_FIN: Transmit descriptor finish
- EMAC_INT_TX_DONE: Transmit Done
- EMAC_INT_SOFT_INT: Software interrupt
- EMAC_INT_WAKEUP: Wakeup interrupt
[in] pfnIntCb Pointer to Call-back function used for this interrupt type
- Returns:
- None
Definition at line 787 of file lpc17xx_emac.c.
void EMAC_StandardIRQHandler | ( | void | ) |
Standard EMAC IRQ Handler. This sub-routine will check these following interrupt and call the call-back function if they're already installed:
- Overrun Error interrupt in RX Queue
- Receive Error interrupt: AlignmentError, RangeError, LengthError, SymbolError, CRCError or NoDescriptor or Overrun
- RX Finished Process Descriptors interrupt (ProduceIndex == ConsumeIndex)
- Receive Done interrupt
- Transmit Under-run interrupt
- Transmit errors interrupt : LateCollision, ExcessiveCollision and ExcessiveDefer, NoDescriptor or Under-run
- TX Finished Process Descriptors interrupt (ProduceIndex == ConsumeIndex)
- Transmit Done interrupt
- Interrupt triggered by software
- Interrupt triggered by a Wakeup event detected by the receive filter.
- Parameters:
-
[in] None
- Returns:
- None
Definition at line 740 of file lpc17xx_emac.c.
int32_t EMAC_UpdatePHYStatus | ( | void | ) |
Auto-Configures value for the EMAC configuration register to match with current PHY mode.
- Parameters:
-
[in] None
- Returns:
- Return (0) if no error, otherwise return (-1)
- Speed mode.
- Half/Full duplex mode
Definition at line 481 of file lpc17xx_emac.c.
void EMAC_UpdateRxConsumeIndex | ( | void | ) |
Increase the RxConsumeIndex (after reading the Receive buffer to release the Receive buffer) and wrap-around the index if it reaches the maximum Receive Number.
- Parameters:
-
[in] None
- Returns:
- None
Definition at line 951 of file lpc17xx_emac.c.
void EMAC_UpdateTxProduceIndex | ( | void | ) |
Increase the TxProduceIndex (after writting to the Transmit buffer to enable the Transmit buffer) and wrap-around the index if it reaches the maximum Transmit Number.
- Parameters:
-
[in] None
- Returns:
- None
Definition at line 968 of file lpc17xx_emac.c.
void EMAC_WritePacketBuffer | ( | EMAC_PACKETBUF_Type * | pDataStruct | ) |
Write data to Tx packet data buffer at current index due to TxProduceIndex.
- Parameters:
-
[in] pDataStruct Pointer to a EMAC_PACKETBUF_Type structure data that contain specified information about Packet data buffer.
- Returns:
- None
Definition at line 682 of file lpc17xx_emac.c.
Generated on Mon Feb 8 10:01:44 2010 for LPC1700CMSIS Standard Peripheral Firmware Library by
