Marco Zecchini
/
Example_RTOS
Rtos API example
Embed:
(wiki syntax)
Show/hide line numbers
main_page.h
00001 /** 00002 * @defgroup lwip lwIP 00003 * 00004 * @defgroup infrastructure Infrastructure 00005 * 00006 * @defgroup callbackstyle_api Callback-style APIs 00007 * Non thread-safe APIs, callback style for maximum performance and minimum 00008 * memory footprint. 00009 * 00010 * @defgroup sequential_api Sequential-style APIs 00011 * Sequential-style APIs, blocking functions. More overhead, but can be called 00012 * from any thread except TCPIP thread. 00013 * 00014 * @defgroup addons Addons 00015 * 00016 * @defgroup apps Applications 00017 */ 00018 00019 /** 00020 * @mainpage Overview 00021 * @verbinclude "README" 00022 */ 00023 00024 /** 00025 * @page upgrading Upgrading 00026 * @verbinclude "UPGRADING" 00027 */ 00028 00029 /** 00030 * @page changelog Changelog 00031 * @verbinclude "CHANGELOG" 00032 */ 00033 00034 /** 00035 * @page contrib How to contribute to lwIP 00036 * @verbinclude "contrib.txt" 00037 */ 00038 00039 /** 00040 * @page pitfalls Common pitfalls 00041 * 00042 * Multiple Execution Contexts in lwIP code 00043 * ======================================== 00044 * 00045 * The most common source of lwIP problems is to have multiple execution contexts 00046 * inside the lwIP code. 00047 * 00048 * lwIP can be used in two basic modes: @ref lwip_nosys (no OS/RTOS 00049 * running on target system) or @ref lwip_os (there is an OS running 00050 * on the target system). 00051 * 00052 * Mainloop Mode 00053 * ------------- 00054 * In mainloop mode, only @ref callbackstyle_api can be used. 00055 * The user has two possibilities to ensure there is only one 00056 * exection context at a time in lwIP: 00057 * 00058 * 1) Deliver RX ethernet packets directly in interrupt context to lwIP 00059 * by calling netif->input directly in interrupt. This implies all lwIP 00060 * callback functions are called in IRQ context, which may cause further 00061 * problems in application code: IRQ is blocked for a long time, multiple 00062 * execution contexts in application code etc. When the application wants 00063 * to call lwIP, it only needs to disable interrupts during the call. 00064 * If timers are involved, even more locking code is needed to lock out 00065 * timer IRQ and ethernet IRQ from each other, assuming these may be nested. 00066 * 00067 * 2) Run lwIP in a mainloop. There is example code here: @ref lwip_nosys. 00068 * lwIP is _ONLY_ called from mainloop callstacks here. The ethernet IRQ 00069 * has to put received telegrams into a queue which is polled in the 00070 * mainloop. Ensure lwIP is _NEVER_ called from an interrupt, e.g. 00071 * some SPI IRQ wants to forward data to udp_send() or tcp_write()! 00072 * 00073 * OS Mode 00074 * ------- 00075 * In OS mode, @ref callbackstyle_api AND @ref sequential_api can be used. 00076 * @ref sequential_api are designed to be called from threads other than 00077 * the TCPIP thread, so there is nothing to consider here. 00078 * But @ref callbackstyle_api functions must _ONLY_ be called from 00079 * TCPIP thread. It is a common error to call these from other threads 00080 * or from IRQ contexts. Ethernet RX needs to deliver incoming packets 00081 * in the correct way by sending a message to TCPIP thread, this is 00082 * implemented in tcpip_input(). 00083 * Again, ensure lwIP is _NEVER_ called from an interrupt, e.g. 00084 * some SPI IRQ wants to forward data to udp_send() or tcp_write()! 00085 * 00086 * 1) tcpip_callback() can be used get called back from TCPIP thread, 00087 * it is safe to call any @ref callbackstyle_api from there. 00088 * 00089 * 2) Use @ref LWIP_TCPIP_CORE_LOCKING. All @ref callbackstyle_api 00090 * functions can be called when lwIP core lock is aquired, see 00091 * @ref LOCK_TCPIP_CORE() and @ref UNLOCK_TCPIP_CORE(). 00092 * These macros cannot be used in an interrupt context! 00093 * Note the OS must correctly handle priority inversion for this. 00094 */ 00095 00096 /** 00097 * @page bugs Reporting bugs 00098 * Please report bugs in the lwIP bug tracker at savannah.\n 00099 * BEFORE submitting, please check if the bug has already been reported!\n 00100 * https://savannah.nongnu.org/bugs/?group=lwip 00101 */ 00102 00103 /** 00104 * @defgroup lwip_nosys Mainloop mode ("NO_SYS") 00105 * @ingroup lwip 00106 * Use this mode if you do not run an OS on your system. \#define NO_SYS to 1. 00107 * Feed incoming packets to netif->input(pbuf, netif) function from mainloop, 00108 * *not* *from* *interrupt* *context*. You can allocate a @ref pbuf in interrupt 00109 * context and put them into a queue which is processed from mainloop.\n 00110 * Call sys_check_timeouts() periodically in the mainloop.\n 00111 * Porting: implement all functions in @ref sys_time, @ref sys_prot and 00112 * @ref compiler_abstraction.\n 00113 * You can only use @ref callbackstyle_api in this mode.\n 00114 * Sample code:\n 00115 * @include NO_SYS_SampleCode.c 00116 */ 00117 00118 /** 00119 * @defgroup lwip_os OS mode (TCPIP thread) 00120 * @ingroup lwip 00121 * Use this mode if you run an OS on your system. It is recommended to 00122 * use an RTOS that correctly handles priority inversion and 00123 * to use @ref LWIP_TCPIP_CORE_LOCKING.\n 00124 * Porting: implement all functions in @ref sys_layer.\n 00125 * You can use @ref callbackstyle_api together with @ref tcpip_callback, 00126 * and all @ref sequential_api. 00127 */ 00128 00129 /** 00130 * @page raw_api lwIP API 00131 * @verbinclude "rawapi.txt" 00132 */
Generated on Sun Jul 17 2022 08:25:27 by 1.7.2