LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
18xx/43xx EMAC driver for LWIP

Detailed Description

This is the LPC18xx/43xx EMAC driver for LWIP. This driver supports both RTOS-based and no-RTOS operation with LWIP. WHen using an RTOS, several threads will be created for handling RX and TX packet fucntions.

Note that some LWIP examples may not necessarily use all the provided LWIP driver functions or may contain overriden versions of the functions. (For example, PHY drives may have their own implementation of the MII read/write functions).

Functions

void lpc_enetif_input (struct netif *netif)
 Attempt to read a packet from the EMAC interface.
 
s32_t lpc_rx_queue (struct netif *netif)
 Attempt to allocate and requeue a new pbuf for RX.
 
s32_t lpc_tx_ready (struct netif *netif)
 Polls if an available TX descriptor is ready.
 
void lpc_tx_reclaim (struct netif *netif)
 Call for freeing TX buffers that are complete.
 
err_t lpc_enetif_init (struct netif *netif)
 LWIP 18xx/43xx EMAC initialization function.
 
void lpc_emac_set_duplex (int full_duplex)
 Set up the MAC interface duplex.
 
void lpc_emac_set_speed (int mbs_100)
 Set up the MAC interface speed.
 
void msDelay (uint32_t ms)
 Millisecond Delay function.
 

Macro Definition Documentation

#define tskRECPKT_PRIORITY   (TCPIP_THREAD_PRIO - 1)

Definition at line 81 of file lpc18xx_43xx_emac.c.

#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 LWIP_DEBUG enabled, the priorities might be better the same.

Definition at line 80 of file lpc18xx_43xx_emac.c.

Function Documentation

void ETH_IRQHandler ( void  )

EMAC interrupt handler.

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

Definition at line 813 of file lpc18xx_43xx_emac.c.

static err_t low_level_init ( struct netif *  netif)
static

Definition at line 571 of file lpc18xx_43xx_emac.c.

void lpc_emac_set_duplex ( int  full_duplex)

Set up the MAC interface duplex.

Parameters
full_duplex: 0 = half duplex, 1 = full duplex
Returns
Nothing
Note
This function provides a method for the PHY to setup the EMAC for the PHY negotiated duplex mode.

Definition at line 792 of file lpc17xx_40xx_emac.c.

void lpc_emac_set_speed ( int  mbs_100)

Set up the MAC interface speed.

Parameters
mbs_100: 0 = 10mbs mode, 1 = 100mbs mode
Returns
Nothing
Note
This function provides a method for the PHY to setup the EMAC for the PHY negotiated bit rate.

Definition at line 803 of file lpc17xx_40xx_emac.c.

err_t lpc_enetif_init ( struct netif *  netif)

LWIP 18xx/43xx EMAC initialization function.

Parameters
netif: lwip network interface structure pointer
Returns
ERR_OK if the loopif is initialized, or ERR_* on other errors
Note
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().

LWIP 18xx/43xx EMAC initialization function.

Parameters
netif: lwip network interface structure pointer
Returns
ERR_OK if the loopif is initialized, or ERR_* on other errors
Note
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().

Definition at line 814 of file lpc17xx_40xx_emac.c.

void lpc_enetif_input ( struct netif *  netif)

Attempt to read a packet from the EMAC interface.

Parameters
netif: lwip network interface structure pointer
Returns
Nothing

Definition at line 693 of file lpc17xx_40xx_emac.c.

static err_t lpc_etharp_output ( struct netif *  netif,
struct pbuf *  q,
ip_addr_t *  ipaddr 
)
static

Definition at line 523 of file lpc18xx_43xx_emac.c.

static struct pbuf* lpc_low_level_input ( struct netif *  netif)
staticread

Definition at line 211 of file lpc18xx_43xx_emac.c.

static err_t lpc_low_level_output ( struct netif *  netif,
struct pbuf *  sendp 
)
static

Definition at line 365 of file lpc18xx_43xx_emac.c.

s32_t lpc_rx_queue ( struct netif *  netif)

Attempt to allocate and requeue a new pbuf for RX.

Parameters
netif: lwip network interface structure pointer
Returns
The number of new descriptors queued

Definition at line 658 of file lpc17xx_40xx_emac.c.

static err_t lpc_rx_setup ( struct lpc_enetdata lpc_netifdata)
static

Definition at line 175 of file lpc18xx_43xx_emac.c.

static void lpc_rxqueue_pbuf ( struct lpc_enetdata lpc_netifdata,
struct pbuf *  p 
)
static

Definition at line 140 of file lpc18xx_43xx_emac.c.

s32_t lpc_tx_ready ( struct netif *  netif)

Polls if an available TX descriptor is ready.

Parameters
netif: lwip network interface structure pointer
Returns
0 if no descriptors are read, or >0
Note
Can be used to determine if the low level transmit function will block

Definition at line 738 of file lpc17xx_40xx_emac.c.

void lpc_tx_reclaim ( struct netif *  netif)

Call for freeing TX buffers that are complete.

Parameters
netif: lwip network interface structure pointer
Returns
Nothing

Definition at line 731 of file lpc17xx_40xx_emac.c.

static err_t lpc_tx_setup ( struct lpc_enetdata lpc_netifdata)
static

Definition at line 336 of file lpc18xx_43xx_emac.c.

void msDelay ( uint32_t  ms)

Millisecond Delay function.

Parameters
ms: Milliseconds to wait
Returns
None

Millisecond Delay function.

Parameters
ms: Delay period in milliseconds
Returns
None Delay for the specified number of milliSeconds. This function is used by LWIP stack in stand-alone configuration

Millisecond Delay function.

Delay function.

Parameters
ms: Number of milliSeconds to delay
Returns
Nothing Needed for some functions, do not use prior to FreeRTOS running

Definition at line 300 of file lpc43xx_systick.c.

static portTASK_FUNCTION ( vPacketReceiveTask  ,
pvParameters   
)
static

Definition at line 538 of file lpc18xx_43xx_emac.c.

static portTASK_FUNCTION ( vTransmitCleanupTask  ,
pvParameters   
)
static

Definition at line 557 of file lpc18xx_43xx_emac.c.

Variable Documentation

uint32_t intMask
static

Definition at line 120 of file lpc18xx_43xx_emac.c.

struct lpc_enetdata lpc_enetdata
static

Definition at line 118 of file lpc18xx_43xx_emac.c.