The raw API is a very direct interface, and is “close to the metal”. If the CYGFUN_LWIP_NO_SYS option is enabled then there still needs to be a single “lwIP” owner thread but an application can be constructed where the main processing loop of that thread performs lwIP support as well as other application event processing as required so that only a single stack footprint is required. The trueraw application is built when CYGFUN_LWIP_NO_SYS is configured, and the CYGBLD_NET_LWIP_BUILD_MANUAL_TESTS option is enabled. This provides a simple example of an application using the raw API without the overhead of the TCP/IP helper thread.

For “true” raw API applications the cyg_lwip_init() function can be used to initialise the lwIP stack (as for sequential or BSD API applications), but there is no support for “waiting” for the network to be brought up within that function call, since when using a “true” raw world the caller of the cyg_lwip_init() is also responsible for processing network packets that may be needed to bring up the network interface up. If required an application can perform its own lwIP stack initialization, and does not need to use the eCos default support.

Note that if you do decide to use cyg_lwip_init() with the configuration option CYGFUN_LWIP_SEQUENTIAL_API disabled, so that solely the raw API is available, bbut with the configuration option CYGFUN_LWIP_NO_SYS also disabled, then the application will need to provide its own alternative to the tcpip_input() function which had previously been used to inject received packets into the stack. This function must be declared as follows:

err_t tcpip_input(struct pbuf *, struct netif *);

See the Section called System initialization for further details on initialization.

Declarations for the API functions are found in header files within the lwIP include tree. The TCP functions are found in <lwip/tcp.h>, and UDP in <lwip/udp.h>.

The raw API uses many of the same types and definitions used in the sequential API. In particular the raw API functions use struct ip_addr and err_t error codes.

Documentation license for this page: eCosPro License