[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [lwip-users] Porting lwIP
From: |
Goldschmidt Simon |
Subject: |
RE: [lwip-users] Porting lwIP |
Date: |
Tue, 15 May 2007 12:32:46 +0200 |
Hi,
> I am currently able to send and receive ethernet packages
> without problems. Is it possible to run ethernetif_output()
> and ethernetif_input() in different threads (besides hardware issues)?
For that you have to set SYS_LIGHTWEIGHT_PROT to 1 so that the MEMP
pools are protected from concurrent access.
And beware that you don't call core functions (everything not in
src/api, except inet.c pbuf.c, sys.c and stats.c)
from multiple threads at a time.
I'm guessing you want to have the sockets API. In that case, start the
core processing thread by calling
tcpip_init() (that thread will call netif->output() later) and start a
rx-thread which pulls packets off
the MAC into pbufs calling netif->input() (which must be tcpip_input()
or tcpip_ethinput()).
Then you create application threads wich can call the functions in
api.h/socket.h/netifapi.h
Doing that you should be thread-safe :-)
(I'm writing this in detail since I don't think we have enough
documentation about this, yet.)
>
> Anything else I have overseen? Is there a preferred way to
> integrate the new files into the directory structure of lwIP?
You'd normally have a directory outside of the main lwip directory.
Other than that, it's up to you.
You only have to provide a directory (which you must include in your
compiler's search path) that provides
the 'arch' directory where cc.h/perf.h/sys_arch.h reside.
Hope that helps,
Simon.