LPCOpen Platform
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Ethernet example

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_Type *pTXDescs, int32_t numTXDescs, IP_ENET_001_ENHRXDESC_Type *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_Type TXDescs [ENET_NUM_TX_DESC]
 
static IP_ENET_001_ENHRXDESC_Type 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
 

Detailed 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 115K8N1. 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.

No special setup is required for the demo. Just build and run.

Build procedure: LPCOpen 18xx/43xx build instructions

Supported boards and board setup:

Submit bug reports for LPCOpen code here.

Macro Definition Documentation

#define ENET_NUM_RX_DESC   4

Definition at line 70 of file enet.c.

#define ENET_NUM_TX_DESC   4

Definition at line 69 of file enet.c.

Function Documentation

static void* ENET_RXGet ( int32_t *  bytes)
static

Definition at line 163 of file enet.c.

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

Definition at line 144 of file enet.c.

static void* ENET_TXBuffClaim ( void  )
static

Definition at line 205 of file enet.c.

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

Definition at line 185 of file enet.c.

void ETH_IRQHandler ( void  )

Handle interrupt from ethernet.

Returns
Nothing

Definition at line 232 of file enet.c.

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

Definition at line 100 of file enet.c.

static void InitDescriptors ( IP_ENET_001_ENHTXDESC_Type pTXDescs,
int32_t  numTXDescs,
IP_ENET_001_ENHRXDESC_Type pRXDescs,
int32_t  numRXDescs 
)
static

Definition at line 111 of file enet.c.

static void localMsDelay ( uint32_t  ms)
static

Definition at line 91 of file enet.c.

int main ( void  )

main routine for ENET example

Returns
Nothing (function should not exit)

Definition at line 241 of file enet.c.

Variable Documentation

int32_t rxAvail
static

Definition at line 78 of file enet.c.

uint8_t RXBuffer[ENET_NUM_RX_DESC][EMAC_ETH_MAX_FLEN]
static

Definition at line 77 of file enet.c.

Definition at line 73 of file enet.c.

int32_t rxFill
static

Definition at line 78 of file enet.c.

int32_t rxGet
static

Definition at line 78 of file enet.c.

int32_t rxNumDescs
static

Definition at line 78 of file enet.c.

uint8_t TXBuffer[ENET_NUM_TX_DESC][EMAC_ETH_MAX_FLEN]
static

Definition at line 76 of file enet.c.

Definition at line 72 of file enet.c.

int32_t txFill
static

Definition at line 79 of file enet.c.

int32_t txGet
static

Definition at line 79 of file enet.c.

int32_t txNumDescs
static

Definition at line 79 of file enet.c.

int32_t txUsed
static

Definition at line 79 of file enet.c.