NXP LPC LWIP port documentation  v1.10
LWIP port for LPC devices
lpc18xx/43xx EMAC driver for LWIP

Modules

 lpc18xx/43xx EMAC registers

Defines

#define tskTXCLEAN_PRIORITY   (TCPIP_THREAD_PRIO - 1)
 Driver transmit and receive thread priorities.
#define tskRECPKT_PRIORITY   (TCPIP_THREAD_PRIO - 1)

Functions

void lpc_mii_write_noblock (u32_t PhyReg, u32_t Value)
 Write a value via the MII link (non-blocking)
err_t lpc_mii_write (u32_t PhyReg, u32_t Value)
 Write a value via the MII link (blocking)
u32_t lpc_mii_is_busy (void)
 Reads current MII link busy status.
u32_t lpc_mii_read_data (void)
 Starts a read operation via the MII link (non-blocking)
void lpc_mii_read_noblock (u32_t PhyReg)
 Read a value via the MII link (blocking)
err_t lpc_mii_read (u32_t PhyReg, u32_t *data)
 Starts a read operation via the MII link (non-blocking)
s32_t lpc_rx_queue (struct netif *netif)
 Attempt to allocate and requeue a new pbuf for RX.
void lpc_enetif_input (struct netif *netif)
 Attempt to read a packet from the EMAC interface.
void lpc_tx_reclaim (struct netif *netif)
 Call for freeing TX buffers that are complete.
s32_t lpc_tx_ready (struct netif *netif)
 Polls if an available TX descriptor is ready. Can be used to determine if the low level transmit function will block.
void ETH_IRQHandler (void)
 LPC EMAC interrupt handler.
void lpc_emac_set_duplex (int full_duplex)
void lpc_emac_set_speed (int mbs_100)
err_t lpc_etharp_output (struct netif *netif, struct pbuf *q, ip_addr_t *ipaddr)
err_t lpc_enetif_init (struct netif *netif)

Define Documentation

#define tskTXCLEAN_PRIORITY   (TCPIP_THREAD_PRIO - 1)

Driver transmit and receive thread priorities.

Thread priorities for receive thread and TX cleanup thread. Alter to prioritize receive or transmit bandwidth. In a heavily loaded system or with LEIP_DEBUG enabled, the priorities might be better the same.


Function Documentation

void ETH_IRQHandler ( void  )

LPC EMAC interrupt handler.

This function handles the transmit, receive, and error interrupt of the LPC118xx/43xx. This is meant to be used when NO_SYS=0.

void lpc_emac_set_duplex ( int  full_duplex)

This function provides a method for the PHY to setup the EMAC for the PHY negotiated duplex mode.

Parameters:
[in]full_duplex0 = half duplex, 1 = full duplex
void lpc_emac_set_speed ( int  mbs_100)

This function provides a method for the PHY to setup the EMAC for the PHY negotiated bit rate.

Parameters:
[in]mbs_1000 = 10mbs mode, 1 = 100mbs mode
err_t lpc_enetif_init ( struct netif *  netif)

Should be called at the beginning of the program to set up the network interface.

This function should be passed as a parameter to netif_add().

Parameters:
[in]netifthe lwip network interface structure for this lpc_enetif
Returns:
ERR_OK if the loopif is initialized ERR_MEM if private data couldn't be allocated any other err_t on error
void lpc_enetif_input ( struct netif *  netif)

Attempt to read a packet from the EMAC interface.

Parameters:
[in]netifthe lwip network interface structure for this lpc_enetif
err_t lpc_etharp_output ( struct netif *  netif,
struct pbuf *  q,
ip_addr_t *  ipaddr 
)

This function is the ethernet packet send function. It calls etharp_output after checking link status.

Parameters:
[in]netifthe lwip network interface structure for this lpc_enetif
[in]qPointer to pbug to send
[in]ipaddrIP address
Returns:
ERR_OK or error code
u32_t lpc_mii_is_busy ( void  )

Reads current MII link busy status.

This function will return the current MII link busy status and is meant to be used with non-blocking functions for monitor PHY status such as connection state.

Returns:
!0 if the MII link is busy, otherwise 0
err_t lpc_mii_read ( u32_t  PhyReg,
u32_t *  data 
)

Starts a read operation via the MII link (non-blocking)

This function will start a read operation on the MII link interface from a PHY or a connected device. The function will not block and the status mist be polled until complete. Once complete, the data can be read.

Parameters:
[in]PhyRegPHY register to read from
u32_t lpc_mii_read_data ( void  )

Starts a read operation via the MII link (non-blocking)

This function returns the current value in the MII data register. It is meant to be used with the non-blocking oeprations. This value should only be read after a non-block read command has been issued and the MII status has been determined to be good.

Returns:
The current value in the MII value register
void lpc_mii_read_noblock ( u32_t  PhyReg)

Read a value via the MII link (blocking)

This function will read a value on the MII link interface from a PHY or a connected device. The function will block until complete.

Parameters:
[in]PhyRegPHY register to read from
[in]dataPointer to where to save data read via MII
Returns:
0 if the read was successful, otherwise !0
err_t lpc_mii_write ( u32_t  PhyReg,
u32_t  Value 
)

Write a value via the MII link (blocking)

This function will write a value on the MII link interface to a PHY or a connected device. The function will block until complete.

Parameters:
[in]PhyRegPHY register to write to
[in]ValueValue to write
Returns:
0 if the write was successful, otherwise !0
void lpc_mii_write_noblock ( u32_t  PhyReg,
u32_t  Value 
)

Write a value via the MII link (non-blocking)

This function will write a value on the MII link interface to a PHY or a connected device. The function will return immediately without a status. Status needs to be polled later to determine if the write was successful.

Parameters:
[in]PhyRegPHY register to write to
[in]ValueValue to write
s32_t lpc_rx_queue ( struct netif *  netif)

Attempt to allocate and requeue a new pbuf for RX.

Parameters:
[in]netifPointer to the netif structure
Returns:
The number of new descriptors queued
s32_t lpc_tx_ready ( struct netif *  netif)

Polls if an available TX descriptor is ready. Can be used to determine if the low level transmit function will block.

Parameters:
[in]netifthe lwip network interface structure for this lpc_enetif
Returns:
0 if no descriptors are read, or >0
void lpc_tx_reclaim ( struct netif *  netif)

Call for freeing TX buffers that are complete.

Parameters:
[in]netifthe lwip network interface structure for this lpc_enetif