LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
CHIP: LPC17xx/40xx Ethernet driver

Detailed Description

Modules

 CHIP: LPC17xx/40xx Ethernet driver build options
 

Typedefs

typedef IP_ENET_002_TXDESC_T ENET_TXDESC_T
 
typedef IP_ENET_002_TXSTAT_T ENET_TXSTAT_T
 
typedef IP_ENET_002_RXDESC_T ENET_RXDESC_T
 
typedef IP_ENET_002_RXSTAT_T ENET_RXSTAT_T
 
typedef IP_ENET_002_BUFF_STATUS_T ENET_BUFF_STATUS
 

Functions

STATIC INLINE void Chip_ENET_Reset (LPC_ENET_T *pENET)
 Resets the ethernet interface.
 
STATIC INLINE void Chip_ENET_SetADDR (LPC_ENET_T *pENET, const uint8_t *macAddr)
 Sets the address of the interface.
 
STATIC INLINE void Chip_ENET_SetupMII (LPC_ENET_T *pENET, uint32_t div, uint8_t addr)
 Sets up the PHY link clock divider and PHY address.
 
STATIC INLINE void Chip_ENET_StartMIIWrite (LPC_ENET_T *pENET, uint8_t reg, uint16_t data)
 Starts a PHY write via the MII.
 
STATIC INLINE void Chip_ENET_StartMIIRead (LPC_ENET_T *pENET, uint8_t reg)
 Starts a PHY read via the MII.
 
STATIC INLINE bool Chip_ENET_IsMIIBusy (LPC_ENET_T *pENET)
 Returns MII link (PHY) busy status.
 
STATIC INLINE uint16_t Chip_ENET_ReadMIIData (LPC_ENET_T *pENET)
 Returns the value read from the PHY.
 
STATIC INLINE void Chip_ENET_TXEnable (LPC_ENET_T *pENET)
 Enables ethernet transmit.
 
STATIC INLINE void Chip_ENET_TXDisable (LPC_ENET_T *pENET)
 Disables ethernet transmit.
 
STATIC INLINE void Chip_ENET_RXEnable (LPC_ENET_T *pENET)
 Enables ethernet packet reception.
 
STATIC INLINE void Chip_ENET_RXDisable (LPC_ENET_T *pENET)
 Disables ethernet packet reception.
 
STATIC INLINE void Chip_ENET_ResetTXLogic (LPC_ENET_T *pENET)
 Reset Tx Logic.
 
STATIC INLINE void Chip_ENET_ResetRXLogic (LPC_ENET_T *pENET)
 Reset Rx Logic.
 
STATIC INLINE void Chip_ENET_EnableRXFilter (LPC_ENET_T *pENET, uint32_t mask)
 Enable Rx Filter.
 
STATIC INLINE void Chip_ENET_DisableRXFilter (LPC_ENET_T *pENET, uint32_t mask)
 Disable Rx Filter.
 
STATIC INLINE void Chip_ENET_SetFullDuplex (LPC_ENET_T *pENET)
 Sets full duplex operation for the interface.
 
STATIC INLINE void Chip_ENET_SetHalfDuplex (LPC_ENET_T *pENET)
 Sets half duplex operation for the interface.
 
STATIC INLINE void Chip_ENET_Set100Mbps (LPC_ENET_T *pENET)
 Selects 100Mbps for the current speed.
 
STATIC INLINE void Chip_ENET_Set10Mbps (LPC_ENET_T *pENET)
 Selects 10Mbps for the current speed.
 
STATIC INLINE void Chip_ENET_InitTxDescriptors (LPC_ENET_T *pENET, ENET_TXDESC_T *pDescs, ENET_TXSTAT_T *pStatus, uint32_t descNum)
 Configures the initial ethernet transmit descriptors.
 
STATIC INLINE void Chip_ENET_InitRxDescriptors (LPC_ENET_T *pENET, ENET_RXDESC_T *pDescs, ENET_RXSTAT_T *pStatus, uint32_t descNum)
 Configures the initial ethernet receive descriptors.
 
STATIC INLINE uint16_t Chip_ENET_GetTXProduceIndex (LPC_ENET_T *pENET)
 Get the current Tx Produce Descriptor Index.
 
STATIC INLINE uint16_t Chip_ENET_GetTXConsumeIndex (LPC_ENET_T *pENET)
 Get the current Tx Consume Descriptor Index.
 
STATIC INLINE uint16_t Chip_ENET_GetRXProduceIndex (LPC_ENET_T *pENET)
 Get the current Rx Produce Descriptor Index.
 
STATIC INLINE uint16_t Chip_ENET_GetRXConsumeIndex (LPC_ENET_T *pENET)
 Get the current Rx Consume Descriptor Index.
 
STATIC INLINE ENET_BUFF_STATUS Chip_ENET_GetBufferStatus (LPC_ENET_T *pENET, uint16_t produceIndex, uint16_t consumeIndex, uint16_t buffSize)
 Get the buffer status with the current Produce Index and Consume Index.
 
STATIC INLINE uint32_t Chip_ENET_GetFillDescNum (LPC_ENET_T *pENET, uint16_t produceIndex, uint16_t consumeIndex, uint16_t buffSize)
 Get the number of descriptors filled.
 
STATIC INLINE uint32_t Chip_ENET_GetFreeDescNum (LPC_ENET_T *pENET, uint16_t produceIndex, uint16_t consumeIndex, uint16_t buffSize)
 Get the number of free descriptors.
 
STATIC INLINE bool Chip_ENET_IsTxFull (LPC_ENET_T *pENET)
 Check if Tx buffer is full.
 
STATIC INLINE bool Chip_ENET_IsRxEmpty (LPC_ENET_T *pENET)
 Check if Rx buffer is empty.
 
STATIC INLINE uint16_t Chip_ENET_IncTXProduceIndex (LPC_ENET_T *pENET)
 Increase the current Tx Produce Descriptor Index.
 
STATIC INLINE uint16_t Chip_ENET_IncRXConsumeIndex (LPC_ENET_T *pENET)
 Increase the current Rx Consume Descriptor Index.
 
STATIC INLINE void Chip_ENET_EnableInt (LPC_ENET_T *pENET, uint32_t mask)
 Enable ENET interrupts.
 
STATIC INLINE void Chip_ENET_DisableInt (LPC_ENET_T *pENET, uint32_t mask)
 Disable ENET interrupts.
 
STATIC INLINE uint32_t Chip_ENET_GetIntStatus (LPC_ENET_T *pENET)
 Get the interrupt status.
 
STATIC INLINE void Chip_ENET_ClearIntStatus (LPC_ENET_T *pENET, uint32_t mask)
 Clear the interrupt status.
 
void Chip_ENET_Init (LPC_ENET_T *pENET)
 Initialize ethernet interface.
 
void Chip_ENET_DeInit (LPC_ENET_T *pENET)
 De-initialize the ethernet interface.
 
uint32_t Chip_ENET_FindMIIDiv (LPC_ENET_T *pENET, uint32_t clockRate)
 Find the divider index for a desired MII clock rate.
 

Typedef Documentation

Definition at line 64 of file enet_17xx_40xx.h.

Definition at line 62 of file enet_17xx_40xx.h.

Definition at line 63 of file enet_17xx_40xx.h.

Definition at line 60 of file enet_17xx_40xx.h.

Definition at line 61 of file enet_17xx_40xx.h.

Function Documentation

STATIC INLINE void Chip_ENET_ClearIntStatus ( LPC_ENET_T pENET,
uint32_t  mask 
)

Clear the interrupt status.

Parameters
pENET: The base of ENET peripheral on the chip
mask: Interrupt mask (Or-ed bit values of ENET_INT_*)
Returns
Nothing

Definition at line 463 of file enet_17xx_40xx.h.

void Chip_ENET_DeInit ( LPC_ENET_T pENET)

De-initialize the ethernet interface.

Parameters
pENET: The base of ENET peripheral on the chip
Returns
Nothing

Definition at line 93 of file enet_17xx_40xx.c.

STATIC INLINE void Chip_ENET_DisableInt ( LPC_ENET_T pENET,
uint32_t  mask 
)

Disable ENET interrupts.

Parameters
pENET: The base of ENET peripheral on the chip
mask: Interrupt mask (Or-ed bit values of ENET_INT_*)
Returns
Nothing

Definition at line 442 of file enet_17xx_40xx.h.

STATIC INLINE void Chip_ENET_DisableRXFilter ( LPC_ENET_T pENET,
uint32_t  mask 
)

Disable Rx Filter.

Parameters
pENET: The base of ENET peripheral on the chip
mask: Filter mask (Or-ed bit values of ENET_RXFILTERCTRL_*)
Returns
Nothing

Definition at line 229 of file enet_17xx_40xx.h.

STATIC INLINE void Chip_ENET_EnableInt ( LPC_ENET_T pENET,
uint32_t  mask 
)

Enable ENET interrupts.

Parameters
pENET: The base of ENET peripheral on the chip
mask: Interrupt mask (Or-ed bit values of ENET_INT_*)
Returns
Nothing

Definition at line 431 of file enet_17xx_40xx.h.

STATIC INLINE void Chip_ENET_EnableRXFilter ( LPC_ENET_T pENET,
uint32_t  mask 
)

Enable Rx Filter.

Parameters
pENET: The base of ENET peripheral on the chip
mask: Filter mask (Or-ed bit values of ENET_RXFILTERCTRL_*)
Returns
Nothing

Definition at line 218 of file enet_17xx_40xx.h.

uint32_t Chip_ENET_FindMIIDiv ( LPC_ENET_T pENET,
uint32_t  clockRate 
)

Find the divider index for a desired MII clock rate.

Parameters
pENET: The base of ENET peripheral on the chip
clockRate: Clock rate to get divider index for
Returns
MII divider index to get the closest clock rate for clockRate
Note
Use this function to get a divider index for the Chip_ENET_SetupMII() function determined from the desired MII clock rate.

Definition at line 73 of file enet_17xx_40xx.c.

STATIC INLINE ENET_BUFF_STATUS Chip_ENET_GetBufferStatus ( LPC_ENET_T pENET,
uint16_t  produceIndex,
uint16_t  consumeIndex,
uint16_t  buffSize 
)

Get the buffer status with the current Produce Index and Consume Index.

Parameters
pENET: The base of ENET peripheral on the chip
produceIndex: Produce Index
consumeIndex: Consume Index
buffSize: Buffer size
Returns
Status (One of status value: ENET_BUFF_EMPTY/ENET_BUFF_FULL/ENET_BUFF_PARTIAL_FULL)

Definition at line 352 of file enet_17xx_40xx.h.

STATIC INLINE uint32_t Chip_ENET_GetFillDescNum ( LPC_ENET_T pENET,
uint16_t  produceIndex,
uint16_t  consumeIndex,
uint16_t  buffSize 
)

Get the number of descriptors filled.

Parameters
pENET: The base of ENET peripheral on the chip
produceIndex: Produce Index
consumeIndex: Consume Index
buffSize: Buffer size
Returns
the number of descriptors

Definition at line 367 of file enet_17xx_40xx.h.

STATIC INLINE uint32_t Chip_ENET_GetFreeDescNum ( LPC_ENET_T pENET,
uint16_t  produceIndex,
uint16_t  consumeIndex,
uint16_t  buffSize 
)

Get the number of free descriptors.

Parameters
pENET: The base of ENET peripheral on the chip
produceIndex: Produce Index
consumeIndex: Consume Index
buffSize: Buffer size
Returns
the number of descriptors

Definition at line 380 of file enet_17xx_40xx.h.

STATIC INLINE uint32_t Chip_ENET_GetIntStatus ( LPC_ENET_T pENET)

Get the interrupt status.

Parameters
pENET: The base of ENET peripheral on the chip
Returns
interrupt status (Or-ed bit values of ENET_INT_*)

Definition at line 452 of file enet_17xx_40xx.h.

STATIC INLINE uint16_t Chip_ENET_GetRXConsumeIndex ( LPC_ENET_T pENET)

Get the current Rx Consume Descriptor Index.

Parameters
pENET: The base of ENET peripheral on the chip
Returns
Rx Consume Index

Definition at line 339 of file enet_17xx_40xx.h.

STATIC INLINE uint16_t Chip_ENET_GetRXProduceIndex ( LPC_ENET_T pENET)

Get the current Rx Produce Descriptor Index.

Parameters
pENET: The base of ENET peripheral on the chip
Returns
Rx Produce Index

Definition at line 329 of file enet_17xx_40xx.h.

STATIC INLINE uint16_t Chip_ENET_GetTXConsumeIndex ( LPC_ENET_T pENET)

Get the current Tx Consume Descriptor Index.

Parameters
pENET: The base of ENET peripheral on the chip
Returns
Tx Consume Index

Definition at line 319 of file enet_17xx_40xx.h.

STATIC INLINE uint16_t Chip_ENET_GetTXProduceIndex ( LPC_ENET_T pENET)

Get the current Tx Produce Descriptor Index.

Parameters
pENET: The base of ENET peripheral on the chip
Returns
Tx Produce Index

Definition at line 309 of file enet_17xx_40xx.h.

STATIC INLINE uint16_t Chip_ENET_IncRXConsumeIndex ( LPC_ENET_T pENET)

Increase the current Rx Consume Descriptor Index.

Parameters
pENET: The base of ENET peripheral on the chip
Returns
The new index value

Definition at line 420 of file enet_17xx_40xx.h.

STATIC INLINE uint16_t Chip_ENET_IncTXProduceIndex ( LPC_ENET_T pENET)

Increase the current Tx Produce Descriptor Index.

Parameters
pENET: The base of ENET peripheral on the chip
Returns
The new index value

Definition at line 410 of file enet_17xx_40xx.h.

void Chip_ENET_Init ( LPC_ENET_T pENET)

Initialize ethernet interface.

Parameters
pENET: The base of ENET peripheral on the chip
Returns
Nothing
Note
Performs basic initialization of the ethernet interface in a default state. This is enough to place the interface in a usable state, but may require more setup outside this function.

Definition at line 55 of file enet_17xx_40xx.c.

STATIC INLINE void Chip_ENET_InitRxDescriptors ( LPC_ENET_T pENET,
ENET_RXDESC_T pDescs,
ENET_RXSTAT_T pStatus,
uint32_t  descNum 
)

Configures the initial ethernet receive descriptors.

Parameters
pENET: The base of ENET peripheral on the chip
pDescs: Pointer to TX descriptor list
pStatus: Pointer to TX status list
descNum: the number of desciptors
Returns
Nothing

Definition at line 297 of file enet_17xx_40xx.h.

STATIC INLINE void Chip_ENET_InitTxDescriptors ( LPC_ENET_T pENET,
ENET_TXDESC_T pDescs,
ENET_TXSTAT_T pStatus,
uint32_t  descNum 
)

Configures the initial ethernet transmit descriptors.

Parameters
pENET: The base of ENET peripheral on the chip
pDescs: Pointer to TX descriptor list
pStatus: Pointer to TX status list
descNum: the number of desciptors
Returns
Nothing

Definition at line 282 of file enet_17xx_40xx.h.

STATIC INLINE bool Chip_ENET_IsMIIBusy ( LPC_ENET_T pENET)

Returns MII link (PHY) busy status.

Parameters
pENET: The base of ENET peripheral on the chip
Returns
Returns true if busy, otherwise false

Definition at line 137 of file enet_17xx_40xx.h.

STATIC INLINE bool Chip_ENET_IsRxEmpty ( LPC_ENET_T pENET)

Check if Rx buffer is empty.

Parameters
pENET: The base of ENET peripheral on the chip
Returns
true/false

Definition at line 400 of file enet_17xx_40xx.h.

STATIC INLINE bool Chip_ENET_IsTxFull ( LPC_ENET_T pENET)

Check if Tx buffer is full.

Parameters
pENET: The base of ENET peripheral on the chip
Returns
true/false

Definition at line 390 of file enet_17xx_40xx.h.

STATIC INLINE uint16_t Chip_ENET_ReadMIIData ( LPC_ENET_T pENET)

Returns the value read from the PHY.

Parameters
pENET: The base of ENET peripheral on the chip
Returns
Read value from PHY

Definition at line 147 of file enet_17xx_40xx.h.

STATIC INLINE void Chip_ENET_Reset ( LPC_ENET_T pENET)

Resets the ethernet interface.

Parameters
pENET: The base of ENET peripheral on the chip
Returns
Nothing
Note
Resets the ethernet interface. This should be called prior to Chip_ENET_Init with a small delay after this call.

Definition at line 73 of file enet_17xx_40xx.h.

STATIC INLINE void Chip_ENET_ResetRXLogic ( LPC_ENET_T pENET)

Reset Rx Logic.

Parameters
pENET: The base of ENET peripheral on the chip
Returns
Nothing

Definition at line 207 of file enet_17xx_40xx.h.

STATIC INLINE void Chip_ENET_ResetTXLogic ( LPC_ENET_T pENET)

Reset Tx Logic.

Parameters
pENET: The base of ENET peripheral on the chip
Returns
Nothing

Definition at line 197 of file enet_17xx_40xx.h.

STATIC INLINE void Chip_ENET_RXDisable ( LPC_ENET_T pENET)

Disables ethernet packet reception.

Parameters
pENET: The base of ENET peripheral on the chip
Returns
Nothing

Definition at line 187 of file enet_17xx_40xx.h.

STATIC INLINE void Chip_ENET_RXEnable ( LPC_ENET_T pENET)

Enables ethernet packet reception.

Parameters
pENET: The base of ENET peripheral on the chip
Returns
Nothing

Definition at line 177 of file enet_17xx_40xx.h.

STATIC INLINE void Chip_ENET_Set100Mbps ( LPC_ENET_T pENET)

Selects 100Mbps for the current speed.

Parameters
pENET: The base of ENET peripheral on the chip
Returns
Nothing

Definition at line 259 of file enet_17xx_40xx.h.

STATIC INLINE void Chip_ENET_Set10Mbps ( LPC_ENET_T pENET)

Selects 10Mbps for the current speed.

Parameters
pENET: The base of ENET peripheral on the chip
Returns
Nothing

Definition at line 269 of file enet_17xx_40xx.h.

STATIC INLINE void Chip_ENET_SetADDR ( LPC_ENET_T pENET,
const uint8_t *  macAddr 
)

Sets the address of the interface.

Parameters
pENET: The base of ENET peripheral on the chip
macAddr: Pointer to the 6 bytes used for the MAC address
Returns
Nothing

Definition at line 84 of file enet_17xx_40xx.h.

STATIC INLINE void Chip_ENET_SetFullDuplex ( LPC_ENET_T pENET)

Sets full duplex operation for the interface.

Parameters
pENET: The base of ENET peripheral on the chip
Returns
Nothing

Definition at line 239 of file enet_17xx_40xx.h.

STATIC INLINE void Chip_ENET_SetHalfDuplex ( LPC_ENET_T pENET)

Sets half duplex operation for the interface.

Parameters
pENET: The base of ENET peripheral on the chip
Returns
Nothing

Definition at line 249 of file enet_17xx_40xx.h.

STATIC INLINE void Chip_ENET_SetupMII ( LPC_ENET_T pENET,
uint32_t  div,
uint8_t  addr 
)

Sets up the PHY link clock divider and PHY address.

Parameters
pENET: The base of ENET peripheral on the chip
div: Divider index, not a divider value, see user manual
addr: PHY address, used with MII read and write
Returns
Nothing
Note
The MII clock divider rate is divided from the peripheral clock returned from the Chip_Clock_GetSystemClockRate() function. Use Chip_ENET_FindMIIDiv() with a desired clock rate to find the correct divider index value.

Definition at line 99 of file enet_17xx_40xx.h.

STATIC INLINE void Chip_ENET_StartMIIRead ( LPC_ENET_T pENET,
uint8_t  reg 
)

Starts a PHY read via the MII.

Parameters
pENET: The base of ENET peripheral on the chip
reg: PHY register to read
Returns
Nothing
Note
Start a PHY read operation. Does not block, requires calling IP_ENET_IsMIIBusy to determine when read is complete and calling IP_ENET_ReadMIIData to get the data.

Definition at line 127 of file enet_17xx_40xx.h.

STATIC INLINE void Chip_ENET_StartMIIWrite ( LPC_ENET_T pENET,
uint8_t  reg,
uint16_t  data 
)

Starts a PHY write via the MII.

Parameters
pENET: The base of ENET peripheral on the chip
reg: PHY register to write
data: Data to write to PHY register
Returns
Nothing
Note
Start a PHY write operation. Does not block, requires calling IP_ENET_IsMIIBusy to determine when write is complete.

Definition at line 113 of file enet_17xx_40xx.h.

STATIC INLINE void Chip_ENET_TXDisable ( LPC_ENET_T pENET)

Disables ethernet transmit.

Parameters
pENET: The base of ENET peripheral on the chip
Returns
Nothing

Definition at line 167 of file enet_17xx_40xx.h.

STATIC INLINE void Chip_ENET_TXEnable ( LPC_ENET_T pENET)

Enables ethernet transmit.

Parameters
pENET: The base of ENET peripheral on the chip
Returns
Nothing

Definition at line 157 of file enet_17xx_40xx.h.