2016-09-29 10:51:45 +00:00
|
|
|
|
/**
|
2016-07-27 17:09:52 +00:00
|
|
|
|
* @defgroup lwip lwIP
|
2016-07-27 18:49:19 +00:00
|
|
|
|
*
|
2016-07-27 17:09:52 +00:00
|
|
|
|
* @defgroup infrastructure Infrastructure
|
|
|
|
|
*
|
2016-07-26 16:39:53 +00:00
|
|
|
|
* @defgroup callbackstyle_api Callback-style APIs
|
|
|
|
|
* Non thread-safe APIs, callback style for maximum performance and minimum
|
|
|
|
|
* memory footprint.
|
|
|
|
|
*
|
2016-09-29 10:51:45 +00:00
|
|
|
|
* @defgroup sequential_api Sequential-style APIs
|
2016-09-30 07:05:33 +00:00
|
|
|
|
* Sequential-style APIs, blocking functions. More overhead, but can be called
|
2016-07-26 16:39:53 +00:00
|
|
|
|
* from any thread except TCPIP thread.
|
2016-07-26 17:30:05 +00:00
|
|
|
|
*
|
|
|
|
|
* @defgroup addons Addons
|
|
|
|
|
*
|
|
|
|
|
* @defgroup apps Applications
|
2016-07-26 16:39:53 +00:00
|
|
|
|
*/
|
|
|
|
|
|
2016-07-27 18:30:57 +00:00
|
|
|
|
/**
|
|
|
|
|
* @mainpage Overview
|
2016-07-27 17:09:52 +00:00
|
|
|
|
* @verbinclude "README"
|
2016-07-27 11:07:29 +00:00
|
|
|
|
*/
|
|
|
|
|
|
2016-07-27 18:30:57 +00:00
|
|
|
|
/**
|
2016-07-27 11:07:29 +00:00
|
|
|
|
* @page upgrading Upgrading
|
|
|
|
|
* @verbinclude "UPGRADING"
|
|
|
|
|
*/
|
2016-07-27 17:09:52 +00:00
|
|
|
|
|
2017-01-24 10:45:51 +00:00
|
|
|
|
/**
|
|
|
|
|
* @page changelog Changelog
|
|
|
|
|
* @verbinclude "CHANGELOG"
|
|
|
|
|
*/
|
|
|
|
|
|
2016-07-27 17:09:52 +00:00
|
|
|
|
/**
|
|
|
|
|
* @page contrib How to contribute to lwIP
|
|
|
|
|
* @verbinclude "contrib.txt"
|
2015-08-19 13:43:46 +00:00
|
|
|
|
*/
|
2016-08-07 08:05:34 +00:00
|
|
|
|
|
2016-09-29 10:51:45 +00:00
|
|
|
|
/**
|
|
|
|
|
* @page pitfalls Common pitfalls
|
|
|
|
|
*
|
|
|
|
|
* Multiple Execution Contexts in lwIP code
|
|
|
|
|
* ========================================
|
|
|
|
|
*
|
|
|
|
|
* The most common source of lwIP problems is to have multiple execution contexts
|
|
|
|
|
* inside the lwIP code.
|
|
|
|
|
*
|
|
|
|
|
* lwIP can be used in two basic modes: @ref lwip_nosys (no OS/RTOS
|
|
|
|
|
* running on target system) or @ref lwip_os (there is an OS running
|
|
|
|
|
* on the target system).
|
|
|
|
|
*
|
|
|
|
|
* Mainloop Mode
|
|
|
|
|
* -------------
|
|
|
|
|
* In mainloop mode, only @ref callbackstyle_api can be used.
|
|
|
|
|
* The user has two possibilities to ensure there is only one
|
|
|
|
|
* exection context at a time in lwIP:
|
|
|
|
|
*
|
|
|
|
|
* 1) Deliver RX ethernet packets directly in interrupt context to lwIP
|
|
|
|
|
* by calling netif->input directly in interrupt. This implies all lwIP
|
|
|
|
|
* callback functions are called in IRQ context, which may cause further
|
|
|
|
|
* problems in application code: IRQ is blocked for a long time, multiple
|
|
|
|
|
* execution contexts in application code etc. When the application wants
|
|
|
|
|
* to call lwIP, it only needs to disable interrupts during the call.
|
|
|
|
|
* If timers are involved, even more locking code is needed to lock out
|
|
|
|
|
* timer IRQ and ethernet IRQ from each other, assuming these may be nested.
|
|
|
|
|
*
|
|
|
|
|
* 2) Run lwIP in a mainloop. There is example code here: @ref lwip_nosys.
|
|
|
|
|
* lwIP is _ONLY_ called from mainloop callstacks here. The ethernet IRQ
|
|
|
|
|
* has to put received telegrams into a queue which is polled in the
|
|
|
|
|
* mainloop. Ensure lwIP is _NEVER_ called from an interrupt, e.g.
|
|
|
|
|
* some SPI IRQ wants to forward data to udp_send() or tcp_write()!
|
|
|
|
|
*
|
|
|
|
|
* OS Mode
|
|
|
|
|
* -------
|
|
|
|
|
* In OS mode, @ref callbackstyle_api AND @ref sequential_api can be used.
|
|
|
|
|
* @ref sequential_api are designed to be called from threads other than
|
|
|
|
|
* the TCPIP thread, so there is nothing to consider here.
|
|
|
|
|
* But @ref callbackstyle_api functions must _ONLY_ be called from
|
|
|
|
|
* TCPIP thread. It is a common error to call these from other threads
|
|
|
|
|
* or from IRQ contexts. Ethernet RX needs to deliver incoming packets
|
|
|
|
|
* in the correct way by sending a message to TCPIP thread, this is
|
|
|
|
|
* implemented in tcpip_input().
|
|
|
|
|
* Again, ensure lwIP is _NEVER_ called from an interrupt, e.g.
|
|
|
|
|
* some SPI IRQ wants to forward data to udp_send() or tcp_write()!
|
|
|
|
|
*
|
|
|
|
|
* 1) tcpip_callback() can be used get called back from TCPIP thread,
|
|
|
|
|
* it is safe to call any @ref callbackstyle_api from there.
|
|
|
|
|
*
|
|
|
|
|
* 2) Use @ref LWIP_TCPIP_CORE_LOCKING. All @ref callbackstyle_api
|
|
|
|
|
* functions can be called when lwIP core lock is aquired, see
|
|
|
|
|
* @ref LOCK_TCPIP_CORE() and @ref UNLOCK_TCPIP_CORE().
|
|
|
|
|
* These macros cannot be used in an interrupt context!
|
|
|
|
|
* Note the OS must correctly handle priority inversion for this.
|
|
|
|
|
*/
|
|
|
|
|
|
2016-08-18 19:09:34 +00:00
|
|
|
|
/**
|
|
|
|
|
* @page bugs Reporting bugs
|
|
|
|
|
* Please report bugs in the lwIP bug tracker at savannah.\n
|
|
|
|
|
* BEFORE submitting, please check if the bug has already been reported!\n
|
|
|
|
|
* https://savannah.nongnu.org/bugs/?group=lwip
|
|
|
|
|
*/
|
|
|
|
|
|
2016-08-07 08:05:34 +00:00
|
|
|
|
/**
|
|
|
|
|
* @defgroup lwip_nosys Mainloop mode ("NO_SYS")
|
|
|
|
|
* @ingroup lwip
|
|
|
|
|
* Use this mode if you do not run an OS on your system. \#define NO_SYS to 1.
|
|
|
|
|
* Feed incoming packets to netif->input(pbuf, netif) function from mainloop,
|
|
|
|
|
* *not* *from* *interrupt* *context*. You can allocate a @ref pbuf in interrupt
|
|
|
|
|
* context and put them into a queue which is processed from mainloop.\n
|
|
|
|
|
* Call sys_check_timeouts() periodically in the mainloop.\n
|
2016-12-08 14:25:38 +00:00
|
|
|
|
* Porting: implement all functions in @ref sys_time, @ref sys_prot and
|
|
|
|
|
* @ref compiler_abstraction.\n
|
2016-08-07 08:05:34 +00:00
|
|
|
|
* You can only use @ref callbackstyle_api in this mode.\n
|
|
|
|
|
* Sample code:\n
|
2016-09-27 19:18:03 +00:00
|
|
|
|
* @include NO_SYS_SampleCode.c
|
2016-08-07 08:05:34 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @defgroup lwip_os OS mode (TCPIP thread)
|
|
|
|
|
* @ingroup lwip
|
|
|
|
|
* Use this mode if you run an OS on your system. It is recommended to
|
|
|
|
|
* use an RTOS that correctly handles priority inversion and
|
|
|
|
|
* to use @ref LWIP_TCPIP_CORE_LOCKING.\n
|
|
|
|
|
* Porting: implement all functions in @ref sys_layer.\n
|
2016-08-07 18:20:38 +00:00
|
|
|
|
* You can use @ref callbackstyle_api together with @ref tcpip_callback,
|
2016-09-29 10:51:45 +00:00
|
|
|
|
* and all @ref sequential_api.
|
2016-08-07 08:05:34 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
2016-08-07 18:13:27 +00:00
|
|
|
|
* @page raw_api lwIP API
|
2016-08-07 08:05:34 +00:00
|
|
|
|
* @verbinclude "rawapi.txt"
|
|
|
|
|
*/
|