We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

AR# 30155

10.1 EDK - How do I initialize the network interface for lwIP 3.00.a?


Keywords: lwIP, 3.00.a, lwip_v3_00_a, 1.2, netif, TEMAC, TCP, UDP, IP, stack, init

How do I initialize the network interface for lwIP 3.00.a?


In raw mode, the application has to manually call xemacif_input function to receive packets. In socket mode, the application has to launch a thread, xemacif_input_thread. The documentation for each of these two functions follows:

Raw Mode Only

void xemacif_input(struct netif *netif)

The Xilinx lwIP adapters work in interrupt mode. The receive interrupt handlers move the packet data from the MAC and store them in a queue. The xemacif_input function takes those received packets from the queue, and passes them to lwIP; consequently, this function is required for lwIP operation in raw mode. An lwIP application in raw mode should have a structure like the following:

while (1) {
/* receive packets */
/* do application specific processing */

The program is notified of the received data through callbacks.

Socket Mode Only

void xemacif_input_thread(struct netif *netif)

In the socket mode, the application thread must launch a separate thread to receive the input packets. This performs the same work as the raw mode function, xemacif_input, except that it resides in its own separate thread; consequently, any lwIP socket mode application is required to have code similar to the following in its main thread:

sys_thread_new(xemacif_input_thread, netif, DEFAULT_THREAD_PRIO);

The application can then continue launching separate threads for performing application-specific tasks. The xemacif_input_thread receives data processed by the interrupt handlers, and passes them to the lwIP tcpip_thread.

For other lwIP issues, please refer to (Xilinx Answer 29757), (Xilinx Answer 29791), and (Xilinx Answer 30195).

The above information is now included in the OS and Libraries Guide in 10.1 Service Pack 2 available at:
The first service pack containing the fix is 10.1 Service Pack 2.
AR# 30155
Date 06/26/2008
Status Active
Type General Article