LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
LPC18xx/43xx Ethernet example

Detailed Description

Example description
The ENET example is a simple Ethernet application for sending an Ethernet packet via the MAC and displaying received broadcast packets.

To use the example, connect a serial cable to the board's RS232/UART port and start a terminal program to monitor the port. The terminal program on the host PC should be setup for 115.2K 8N1. For each packet received, the LED will toggle and the packets source and destination MAC addresses will be displayed with the packet type. Pressing any key will send a dummy packet.

Special connection requirements
There are no special connection requirements for this example.

Build procedures:
LPC18xx/43xx example quickstart for Keil uVision4
LPC18xx/43xx example quickstart for IAR EWARM
LPC18xx/43xx example quickstart for Code Red Xpresso

Supported boards and board setup:
Hitex 1850 evaluation boards
Hitex 4350 evaluation boards
Keil 1857 evaluation boards
Keil 4357 evaluation boards
NGX 1830 Xplorer boards
NGX 4330 Xplorer boards

Submitting LPCOpen issues:
Community support for LPCOpen

Macros

#define ENET_NUM_TX_DESC   4
 
#define ENET_NUM_RX_DESC   4
 

Functions

static void localMsDelay (uint32_t ms)
 
static __INLINE int32_t incIndex (int32_t index, int32_t max)
 
static void InitDescriptors (IP_ENET_001_ENHTXDESC_T *pTXDescs, int32_t numTXDescs, IP_ENET_001_ENHRXDESC_T *pRXDescs, int32_t numRXDescs)
 
static void ENET_RXQueue (void *buffer, int32_t bytes)
 
static void * ENET_RXGet (int32_t *bytes)
 
static void ENET_TXQueue (void *buffer, int32_t bytes)
 
static void * ENET_TXBuffClaim (void)
 
void ETH_IRQHandler (void)
 Handle interrupt from ethernet.
 
int main (void)
 main routine for ENET example
 

Variables

static IP_ENET_001_ENHTXDESC_T TXDescs [ENET_NUM_TX_DESC]
 
static IP_ENET_001_ENHRXDESC_T RXDescs [ENET_NUM_RX_DESC]
 
static uint8_t TXBuffer [ENET_NUM_TX_DESC][EMAC_ETH_MAX_FLEN]
 
static uint8_t RXBuffer [ENET_NUM_RX_DESC][EMAC_ETH_MAX_FLEN]
 
static int32_t rxFill
 
static int32_t rxGet
 
static int32_t rxAvail
 
static int32_t rxNumDescs
 
static int32_t txFill
 
static int32_t txGet
 
static int32_t txUsed
 
static int32_t txNumDescs
 

Macro Definition Documentation

#define ENET_NUM_RX_DESC   4

Definition at line 78 of file enet.c.

#define ENET_NUM_TX_DESC   4

Definition at line 77 of file enet.c.

Function Documentation

static void* ENET_RXGet ( int32_t *  bytes)
static

Definition at line 171 of file enet.c.

static void ENET_RXQueue ( void *  buffer,
int32_t  bytes 
)
static

Definition at line 152 of file enet.c.

static void* ENET_TXBuffClaim ( void  )
static

Definition at line 213 of file enet.c.

static void ENET_TXQueue ( void *  buffer,
int32_t  bytes 
)
static

Definition at line 193 of file enet.c.

void ETH_IRQHandler ( void  )

Handle interrupt from ethernet.

Returns
Nothing

Definition at line 240 of file enet.c.

static __INLINE int32_t incIndex ( int32_t  index,
int32_t  max 
)
static

Definition at line 108 of file enet.c.

static void InitDescriptors ( IP_ENET_001_ENHTXDESC_T pTXDescs,
int32_t  numTXDescs,
IP_ENET_001_ENHRXDESC_T pRXDescs,
int32_t  numRXDescs 
)
static

Definition at line 119 of file enet.c.

static void localMsDelay ( uint32_t  ms)
static

Definition at line 99 of file enet.c.

int main ( void  )

main routine for ENET example

Main program body.

Returns
Nothing (function should not exit)

Definition at line 249 of file enet.c.

Variable Documentation

int32_t rxAvail
static

Definition at line 86 of file enet.c.

uint8_t RXBuffer[ENET_NUM_RX_DESC][EMAC_ETH_MAX_FLEN]
static

Definition at line 85 of file enet.c.

Definition at line 81 of file enet.c.

int32_t rxFill
static

Definition at line 86 of file enet.c.

int32_t rxGet
static

Definition at line 86 of file enet.c.

int32_t rxNumDescs
static

Definition at line 86 of file enet.c.

uint8_t TXBuffer[ENET_NUM_TX_DESC][EMAC_ETH_MAX_FLEN]
static

Definition at line 84 of file enet.c.

Definition at line 80 of file enet.c.

int32_t txFill
static

Definition at line 87 of file enet.c.

int32_t txGet
static

Definition at line 87 of file enet.c.

int32_t txNumDescs
static

Definition at line 87 of file enet.c.

int32_t txUsed
static

Definition at line 87 of file enet.c.