Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: mbed-TFT-example-NCS36510 mbed-Accelerometer-example-NCS36510 mbed-Accelerometer-example-NCS36510
lwip_init.c
00001 /** 00002 * @file 00003 * Modules initialization 00004 * 00005 */ 00006 00007 /* 00008 * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 00009 * All rights reserved. 00010 * 00011 * Redistribution and use in source and binary forms, with or without modification, 00012 * are permitted provided that the following conditions are met: 00013 * 00014 * 1. Redistributions of source code must retain the above copyright notice, 00015 * this list of conditions and the following disclaimer. 00016 * 2. Redistributions in binary form must reproduce the above copyright notice, 00017 * this list of conditions and the following disclaimer in the documentation 00018 * and/or other materials provided with the distribution. 00019 * 3. The name of the author may not be used to endorse or promote products 00020 * derived from this software without specific prior written permission. 00021 * 00022 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 00023 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00024 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 00025 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00026 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 00027 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00028 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00029 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 00030 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 00031 * OF SUCH DAMAGE. 00032 * 00033 * This file is part of the lwIP TCP/IP stack. 00034 * 00035 * Author: Adam Dunkels <adam@sics.se> 00036 */ 00037 00038 /** 00039 * @defgroup lwip_nosys Mainloop mode ("NO_SYS") 00040 * @ingroup lwip 00041 * Use this mode if you do not run an OS on your system. \#define NO_SYS to 1. 00042 * Feed incoming packets to netif->input(pbuf, netif) function from mainloop, 00043 * *not* *from* *interrupt* *context*. You can allocate a @ref pbuf in interrupt 00044 * context and put them into a queue which is processed from mainloop.\n 00045 * Call sys_check_timeouts() periodically in the mainloop.\n 00046 * Porting: implement all functions in @ref sys_time and @ref sys_prot.\n 00047 * You can only use @ref callbackstyle_api in this mode. 00048 * 00049 * @defgroup lwip_os OS mode (TCPIP thread) 00050 * @ingroup lwip 00051 * Use this mode if you run an OS on your system. It is recommended to 00052 * use an RTOS that correctly handles priority inversion and 00053 * to use LWIP_TCPIP_CORE_LOCKING.\n 00054 * Porting: implement all functions in @ref sys_layer.\n 00055 * You can use @ref callbackstyle_api together with \#define tcpip_callback, 00056 * and all @ref threadsafe_api. 00057 */ 00058 00059 #include "lwip/opt.h" 00060 00061 #include "lwip/init.h" 00062 #include "lwip/stats.h" 00063 #include "lwip/sys.h" 00064 #include "lwip/mem.h" 00065 #include "lwip/memp.h" 00066 #include "lwip/pbuf.h" 00067 #include "lwip/netif.h" 00068 #include "lwip/sockets.h" 00069 #include "lwip/ip.h" 00070 #include "lwip/raw.h" 00071 #include "lwip/udp.h" 00072 #include "lwip/priv/tcp_priv.h" 00073 #include "lwip/autoip.h" 00074 #include "lwip/igmp.h" 00075 #include "lwip/dns.h" 00076 #include "lwip/timeouts.h" 00077 #include "lwip/etharp.h" 00078 #include "lwip/ip6.h" 00079 #include "lwip/nd6.h" 00080 #include "lwip/mld6.h" 00081 #include "lwip/api.h" 00082 00083 #include "netif/ppp/ppp_opts.h" 00084 #include "netif/ppp/ppp_impl.h" 00085 00086 /* Compile-time sanity checks for configuration errors. 00087 * These can be done independently of LWIP_DEBUG, without penalty. 00088 */ 00089 #ifndef BYTE_ORDER 00090 #error "BYTE_ORDER is not defined, you have to define it in your cc.h" 00091 #endif 00092 #if (!IP_SOF_BROADCAST && IP_SOF_BROADCAST_RECV) 00093 #error "If you want to use broadcast filter per pcb on recv operations, you have to define IP_SOF_BROADCAST=1 in your lwipopts.h" 00094 #endif 00095 #if (!LWIP_UDP && LWIP_UDPLITE) 00096 #error "If you want to use UDP Lite, you have to define LWIP_UDP=1 in your lwipopts.h" 00097 #endif 00098 #if (!LWIP_UDP && LWIP_DHCP) 00099 #error "If you want to use DHCP, you have to define LWIP_UDP=1 in your lwipopts.h" 00100 #endif 00101 #if (!LWIP_UDP && LWIP_MULTICAST_TX_OPTIONS) 00102 #error "If you want to use IGMP/LWIP_MULTICAST_TX_OPTIONS, you have to define LWIP_UDP=1 in your lwipopts.h" 00103 #endif 00104 #if (!LWIP_UDP && LWIP_DNS) 00105 #error "If you want to use DNS, you have to define LWIP_UDP=1 in your lwipopts.h" 00106 #endif 00107 #if !MEMP_MEM_MALLOC /* MEMP_NUM_* checks are disabled when not using the pool allocator */ 00108 #if (LWIP_ARP && ARP_QUEUEING && (MEMP_NUM_ARP_QUEUE<=0)) 00109 #error "If you want to use ARP Queueing, you have to define MEMP_NUM_ARP_QUEUE>=1 in your lwipopts.h" 00110 #endif 00111 #if (LWIP_RAW && (MEMP_NUM_RAW_PCB<=0)) 00112 #error "If you want to use RAW, you have to define MEMP_NUM_RAW_PCB>=1 in your lwipopts.h" 00113 #endif 00114 #if (LWIP_UDP && (MEMP_NUM_UDP_PCB<=0)) 00115 #error "If you want to use UDP, you have to define MEMP_NUM_UDP_PCB>=1 in your lwipopts.h" 00116 #endif 00117 #if (LWIP_TCP && (MEMP_NUM_TCP_PCB<=0)) 00118 #error "If you want to use TCP, you have to define MEMP_NUM_TCP_PCB>=1 in your lwipopts.h" 00119 #endif 00120 #if (LWIP_IGMP && (MEMP_NUM_IGMP_GROUP<=1)) 00121 #error "If you want to use IGMP, you have to define MEMP_NUM_IGMP_GROUP>1 in your lwipopts.h" 00122 #endif 00123 #if (LWIP_IGMP && !LWIP_MULTICAST_TX_OPTIONS) 00124 #error "If you want to use IGMP, you have to define LWIP_MULTICAST_TX_OPTIONS==1 in your lwipopts.h" 00125 #endif 00126 #if (LWIP_IGMP && !LWIP_IPV4) 00127 #error "IGMP needs LWIP_IPV4 enabled in your lwipopts.h" 00128 #endif 00129 #if (LWIP_MULTICAST_TX_OPTIONS && !LWIP_IPV4) 00130 #error "LWIP_MULTICAST_TX_OPTIONS needs LWIP_IPV4 enabled in your lwipopts.h" 00131 #endif 00132 #if ((LWIP_NETCONN || LWIP_SOCKET) && (MEMP_NUM_TCPIP_MSG_API<=0)) 00133 #error "If you want to use Sequential API, you have to define MEMP_NUM_TCPIP_MSG_API>=1 in your lwipopts.h" 00134 #endif 00135 /* There must be sufficient timeouts, taking into account requirements of the subsystems. */ 00136 #if LWIP_TIMERS && (MEMP_NUM_SYS_TIMEOUT < (LWIP_TCP + IP_REASSEMBLY + LWIP_ARP + (2*LWIP_DHCP) + LWIP_AUTOIP + LWIP_IGMP + LWIP_DNS + PPP_SUPPORT + (LWIP_IPV6 ? (1 + LWIP_IPV6_REASS + LWIP_IPV6_MLD) : 0))) 00137 #error "MEMP_NUM_SYS_TIMEOUT is too low to accomodate all required timeouts" 00138 #endif 00139 #if (IP_REASSEMBLY && (MEMP_NUM_REASSDATA > IP_REASS_MAX_PBUFS)) 00140 #error "MEMP_NUM_REASSDATA > IP_REASS_MAX_PBUFS doesn't make sense since each struct ip_reassdata must hold 2 pbufs at least!" 00141 #endif 00142 #endif /* !MEMP_MEM_MALLOC */ 00143 #if LWIP_WND_SCALE 00144 #if (LWIP_TCP && (TCP_WND > 0xffffffff)) 00145 #error "If you want to use TCP, TCP_WND must fit in an u32_t, so, you have to reduce it in your lwipopts.h" 00146 #endif 00147 #if (LWIP_TCP && LWIP_WND_SCALE && (TCP_RCV_SCALE > 14)) 00148 #error "The maximum valid window scale value is 14!" 00149 #endif 00150 #if (LWIP_TCP && (TCP_WND > (0xFFFFU << TCP_RCV_SCALE))) 00151 #error "TCP_WND is bigger than the configured LWIP_WND_SCALE allows!" 00152 #endif 00153 #if (LWIP_TCP && ((TCP_WND >> TCP_RCV_SCALE) == 0)) 00154 #error "TCP_WND is too small for the configured LWIP_WND_SCALE (results in zero window)!" 00155 #endif 00156 #else /* LWIP_WND_SCALE */ 00157 #if (LWIP_TCP && (TCP_WND > 0xffff)) 00158 #error "If you want to use TCP, TCP_WND must fit in an u16_t, so, you have to reduce it in your lwipopts.h (or enable window scaling)" 00159 #endif 00160 #endif /* LWIP_WND_SCALE */ 00161 #if (LWIP_TCP && (TCP_SND_QUEUELEN > 0xffff)) 00162 #error "If you want to use TCP, TCP_SND_QUEUELEN must fit in an u16_t, so, you have to reduce it in your lwipopts.h" 00163 #endif 00164 #if (LWIP_TCP && (TCP_SND_QUEUELEN < 2)) 00165 #error "TCP_SND_QUEUELEN must be at least 2 for no-copy TCP writes to work" 00166 #endif 00167 #if (LWIP_TCP && ((TCP_MAXRTX > 12) || (TCP_SYNMAXRTX > 12))) 00168 #error "If you want to use TCP, TCP_MAXRTX and TCP_SYNMAXRTX must less or equal to 12 (due to tcp_backoff table), so, you have to reduce them in your lwipopts.h" 00169 #endif 00170 #if (LWIP_TCP && TCP_LISTEN_BACKLOG && ((TCP_DEFAULT_LISTEN_BACKLOG < 0) || (TCP_DEFAULT_LISTEN_BACKLOG > 0xff))) 00171 #error "If you want to use TCP backlog, TCP_DEFAULT_LISTEN_BACKLOG must fit into an u8_t" 00172 #endif 00173 #if (LWIP_NETIF_API && (NO_SYS==1)) 00174 #error "If you want to use NETIF API, you have to define NO_SYS=0 in your lwipopts.h" 00175 #endif 00176 #if ((LWIP_SOCKET || LWIP_NETCONN) && (NO_SYS==1)) 00177 #error "If you want to use Sequential API, you have to define NO_SYS=0 in your lwipopts.h" 00178 #endif 00179 #if (LWIP_PPP_API && (NO_SYS==1)) 00180 #error "If you want to use PPP API, you have to define NO_SYS=0 in your lwipopts.h" 00181 #endif 00182 #if (LWIP_PPP_API && (PPP_SUPPORT==0)) 00183 #error "If you want to use PPP API, you have to enable PPP_SUPPORT in your lwipopts.h" 00184 #endif 00185 #if (((!LWIP_DHCP) || (!LWIP_AUTOIP)) && LWIP_DHCP_AUTOIP_COOP) 00186 #error "If you want to use DHCP/AUTOIP cooperation mode, you have to define LWIP_DHCP=1 and LWIP_AUTOIP=1 in your lwipopts.h" 00187 #endif 00188 #if (((!LWIP_DHCP) || (!LWIP_ARP)) && DHCP_DOES_ARP_CHECK) 00189 #error "If you want to use DHCP ARP checking, you have to define LWIP_DHCP=1 and LWIP_ARP=1 in your lwipopts.h" 00190 #endif 00191 #if (!LWIP_ARP && LWIP_AUTOIP) 00192 #error "If you want to use AUTOIP, you have to define LWIP_ARP=1 in your lwipopts.h" 00193 #endif 00194 #if (LWIP_TCP && ((LWIP_EVENT_API && LWIP_CALLBACK_API) || (!LWIP_EVENT_API && !LWIP_CALLBACK_API))) 00195 #error "One and exactly one of LWIP_EVENT_API and LWIP_CALLBACK_API has to be enabled in your lwipopts.h" 00196 #endif 00197 #if (MEM_LIBC_MALLOC && MEM_USE_POOLS) 00198 #error "MEM_LIBC_MALLOC and MEM_USE_POOLS may not both be simultaneously enabled in your lwipopts.h" 00199 #endif 00200 #if (MEM_USE_POOLS && !MEMP_USE_CUSTOM_POOLS) 00201 #error "MEM_USE_POOLS requires custom pools (MEMP_USE_CUSTOM_POOLS) to be enabled in your lwipopts.h" 00202 #endif 00203 #if (PBUF_POOL_BUFSIZE <= MEM_ALIGNMENT) 00204 #error "PBUF_POOL_BUFSIZE must be greater than MEM_ALIGNMENT or the offset may take the full first pbuf" 00205 #endif 00206 #if (DNS_LOCAL_HOSTLIST && !DNS_LOCAL_HOSTLIST_IS_DYNAMIC && !(defined(DNS_LOCAL_HOSTLIST_INIT))) 00207 #error "you have to define define DNS_LOCAL_HOSTLIST_INIT {{'host1', 0x123}, {'host2', 0x234}} to initialize DNS_LOCAL_HOSTLIST" 00208 #endif 00209 #if PPP_SUPPORT && !PPPOS_SUPPORT && !PPPOE_SUPPORT && !PPPOL2TP_SUPPORT 00210 #error "PPP_SUPPORT needs at least one of PPPOS_SUPPORT, PPPOE_SUPPORT or PPPOL2TP_SUPPORT turned on" 00211 #endif 00212 #if PPP_SUPPORT && !PPP_IPV4_SUPPORT && !PPP_IPV6_SUPPORT 00213 #error "PPP_SUPPORT needs PPP_IPV4_SUPPORT and/or PPP_IPV6_SUPPORT turned on" 00214 #endif 00215 #if PPP_SUPPORT && PPP_IPV4_SUPPORT && !LWIP_IPV4 00216 #error "PPP_IPV4_SUPPORT needs LWIP_IPV4 turned on" 00217 #endif 00218 #if PPP_SUPPORT && PPP_IPV6_SUPPORT && !LWIP_IPV6 00219 #error "PPP_IPV6_SUPPORT needs LWIP_IPV6 turned on" 00220 #endif 00221 #if !LWIP_ETHERNET && (LWIP_ARP || PPPOE_SUPPORT) 00222 #error "LWIP_ETHERNET needs to be turned on for LWIP_ARP or PPPOE_SUPPORT" 00223 #endif 00224 #if (LWIP_IGMP || LWIP_IPV6) && !defined(LWIP_RAND) 00225 #error "When using IGMP or IPv6, LWIP_RAND() needs to be defined to a random-function returning an u32_t random value" 00226 #endif 00227 #if LWIP_TCPIP_CORE_LOCKING_INPUT && !LWIP_TCPIP_CORE_LOCKING 00228 #error "When using LWIP_TCPIP_CORE_LOCKING_INPUT, LWIP_TCPIP_CORE_LOCKING must be enabled, too" 00229 #endif 00230 #if LWIP_TCP && LWIP_NETIF_TX_SINGLE_PBUF && !TCP_OVERSIZE 00231 #error "LWIP_NETIF_TX_SINGLE_PBUF needs TCP_OVERSIZE enabled to create single-pbuf TCP packets" 00232 #endif 00233 #if IP_FRAG && IP_FRAG_USES_STATIC_BUF && LWIP_NETIF_TX_SINGLE_PBUF 00234 #error "LWIP_NETIF_TX_SINGLE_PBUF does not work with IP_FRAG_USES_STATIC_BUF==1 as that creates pbuf queues" 00235 #endif 00236 #if LWIP_NETCONN && LWIP_TCP 00237 #if NETCONN_COPY != TCP_WRITE_FLAG_COPY 00238 #error "NETCONN_COPY != TCP_WRITE_FLAG_COPY" 00239 #endif 00240 #if NETCONN_MORE != TCP_WRITE_FLAG_MORE 00241 #error "NETCONN_MORE != TCP_WRITE_FLAG_MORE" 00242 #endif 00243 #endif /* LWIP_NETCONN && LWIP_TCP */ 00244 #if LWIP_SOCKET 00245 /* Check that the SO_* socket options and SOF_* lwIP-internal flags match */ 00246 #if SO_REUSEADDR != SOF_REUSEADDR 00247 #error "WARNING: SO_REUSEADDR != SOF_REUSEADDR" 00248 #endif 00249 #if SO_KEEPALIVE != SOF_KEEPALIVE 00250 #error "WARNING: SO_KEEPALIVE != SOF_KEEPALIVE" 00251 #endif 00252 #if SO_BROADCAST != SOF_BROADCAST 00253 #error "WARNING: SO_BROADCAST != SOF_BROADCAST" 00254 #endif 00255 #endif /* LWIP_SOCKET */ 00256 00257 00258 /* Compile-time checks for deprecated options. 00259 */ 00260 #ifdef MEMP_NUM_TCPIP_MSG 00261 #error "MEMP_NUM_TCPIP_MSG option is deprecated. Remove it from your lwipopts.h." 00262 #endif 00263 #ifdef TCP_REXMIT_DEBUG 00264 #error "TCP_REXMIT_DEBUG option is deprecated. Remove it from your lwipopts.h." 00265 #endif 00266 #ifdef RAW_STATS 00267 #error "RAW_STATS option is deprecated. Remove it from your lwipopts.h." 00268 #endif 00269 #ifdef ETHARP_QUEUE_FIRST 00270 #error "ETHARP_QUEUE_FIRST option is deprecated. Remove it from your lwipopts.h." 00271 #endif 00272 #ifdef ETHARP_ALWAYS_INSERT 00273 #error "ETHARP_ALWAYS_INSERT option is deprecated. Remove it from your lwipopts.h." 00274 #endif 00275 #if !NO_SYS && LWIP_TCPIP_CORE_LOCKING && LWIP_COMPAT_MUTEX && !defined(LWIP_COMPAT_MUTEX_ALLOWED) 00276 #error "LWIP_COMPAT_MUTEX cannot prevent priority inversion. It is recommended to implement priority-aware mutexes. (Define LWIP_COMPAT_MUTEX_ALLOWED to disable this error.)" 00277 #endif 00278 00279 #ifndef LWIP_DISABLE_TCP_SANITY_CHECKS 00280 #define LWIP_DISABLE_TCP_SANITY_CHECKS 0 00281 #endif 00282 #ifndef LWIP_DISABLE_MEMP_SANITY_CHECKS 00283 #define LWIP_DISABLE_MEMP_SANITY_CHECKS 0 00284 #endif 00285 00286 /* MEMP sanity checks */ 00287 #if MEMP_MEM_MALLOC 00288 #if !LWIP_DISABLE_MEMP_SANITY_CHECKS 00289 #if LWIP_NETCONN || LWIP_SOCKET 00290 #if !MEMP_NUM_NETCONN && LWIP_SOCKET 00291 #error "lwip_sanity_check: WARNING: MEMP_NUM_NETCONN cannot be 0 when using sockets!" 00292 #endif 00293 #else /* MEMP_MEM_MALLOC */ 00294 #if MEMP_NUM_NETCONN > (MEMP_NUM_TCP_PCB+MEMP_NUM_TCP_PCB_LISTEN+MEMP_NUM_UDP_PCB+MEMP_NUM_RAW_PCB) 00295 #error "lwip_sanity_check: WARNING: MEMP_NUM_NETCONN should be less than the sum of MEMP_NUM_{TCP,RAW,UDP}_PCB+MEMP_NUM_TCP_PCB_LISTEN. If you know what you are doing, define LWIP_DISABLE_MEMP_SANITY_CHECKS to 1 to disable this error." 00296 #endif 00297 #endif /* LWIP_NETCONN || LWIP_SOCKET */ 00298 #endif /* !LWIP_DISABLE_MEMP_SANITY_CHECKS */ 00299 #if MEM_USE_POOLS 00300 #error "MEMP_MEM_MALLOC and MEM_USE_POOLS cannot be enabled at the same time" 00301 #endif 00302 #ifdef LWIP_HOOK_MEMP_AVAILABLE 00303 #error "LWIP_HOOK_MEMP_AVAILABLE doesn't make sense with MEMP_MEM_MALLOC" 00304 #endif 00305 #endif /* MEMP_MEM_MALLOC */ 00306 00307 /* TCP sanity checks */ 00308 #if !LWIP_DISABLE_TCP_SANITY_CHECKS 00309 #if LWIP_TCP 00310 #if !MEMP_MEM_MALLOC && (MEMP_NUM_TCP_SEG < TCP_SND_QUEUELEN) 00311 #error "lwip_sanity_check: WARNING: MEMP_NUM_TCP_SEG should be at least as big as TCP_SND_QUEUELEN. If you know what you are doing, define LWIP_DISABLE_TCP_SANITY_CHECKS to 1 to disable this error." 00312 #endif 00313 #if TCP_SND_BUF < (2 * TCP_MSS) 00314 #error "lwip_sanity_check: WARNING: TCP_SND_BUF must be at least as much as (2 * TCP_MSS) for things to work smoothly. If you know what you are doing, define LWIP_DISABLE_TCP_SANITY_CHECKS to 1 to disable this error." 00315 #endif 00316 #if TCP_SND_QUEUELEN < (2 * (TCP_SND_BUF / TCP_MSS)) 00317 #error "lwip_sanity_check: WARNING: TCP_SND_QUEUELEN must be at least as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work. If you know what you are doing, define LWIP_DISABLE_TCP_SANITY_CHECKS to 1 to disable this error." 00318 #endif 00319 #if TCP_SNDLOWAT >= TCP_SND_BUF 00320 #error "lwip_sanity_check: WARNING: TCP_SNDLOWAT must be less than TCP_SND_BUF. If you know what you are doing, define LWIP_DISABLE_TCP_SANITY_CHECKS to 1 to disable this error." 00321 #endif 00322 #if TCP_SNDLOWAT >= (0xFFFF - (4 * TCP_MSS)) 00323 #error "lwip_sanity_check: WARNING: TCP_SNDLOWAT must at least be 4*MSS below u16_t overflow!" 00324 #endif 00325 #if TCP_SNDQUEUELOWAT >= TCP_SND_QUEUELEN 00326 #error "lwip_sanity_check: WARNING: TCP_SNDQUEUELOWAT must be less than TCP_SND_QUEUELEN. If you know what you are doing, define LWIP_DISABLE_TCP_SANITY_CHECKS to 1 to disable this error." 00327 #endif 00328 #if !MEMP_MEM_MALLOC && (PBUF_POOL_BUFSIZE <= (PBUF_LINK_ENCAPSULATION_HLEN + PBUF_LINK_HLEN + PBUF_IP_HLEN + PBUF_TRANSPORT_HLEN)) 00329 #error "lwip_sanity_check: WARNING: PBUF_POOL_BUFSIZE does not provide enough space for protocol headers. If you know what you are doing, define LWIP_DISABLE_TCP_SANITY_CHECKS to 1 to disable this error." 00330 #endif 00331 #if !MEMP_MEM_MALLOC && (TCP_WND > (PBUF_POOL_SIZE * (PBUF_POOL_BUFSIZE - (PBUF_LINK_ENCAPSULATION_HLEN + PBUF_LINK_HLEN + PBUF_IP_HLEN + PBUF_TRANSPORT_HLEN)))) 00332 #error "lwip_sanity_check: WARNING: TCP_WND is larger than space provided by PBUF_POOL_SIZE * (PBUF_POOL_BUFSIZE - protocol headers). If you know what you are doing, define LWIP_DISABLE_TCP_SANITY_CHECKS to 1 to disable this error." 00333 #endif 00334 #if TCP_WND < TCP_MSS 00335 #error "lwip_sanity_check: WARNING: TCP_WND is smaller than MSS. If you know what you are doing, define LWIP_DISABLE_TCP_SANITY_CHECKS to 1 to disable this error." 00336 #endif 00337 #endif /* LWIP_TCP */ 00338 #endif /* !LWIP_DISABLE_TCP_SANITY_CHECKS */ 00339 00340 /** 00341 * @ingroup lwip_nosys 00342 * Initialize all modules. 00343 * Use this in NO_SYS mode. Use tcpip_init() otherwise. 00344 */ 00345 void 00346 lwip_init(void) 00347 { 00348 /* Modules initialization */ 00349 stats_init(); 00350 #if !NO_SYS 00351 sys_init(); 00352 #endif /* !NO_SYS */ 00353 mem_init(); 00354 memp_init(); 00355 pbuf_init(); 00356 netif_init(); 00357 #if LWIP_IPV4 00358 ip_init(); 00359 #if LWIP_ARP 00360 etharp_init(); 00361 #endif /* LWIP_ARP */ 00362 #endif /* LWIP_IPV4 */ 00363 #if LWIP_RAW 00364 raw_init(); 00365 #endif /* LWIP_RAW */ 00366 #if LWIP_UDP 00367 udp_init(); 00368 #endif /* LWIP_UDP */ 00369 #if LWIP_TCP 00370 tcp_init(); 00371 #endif /* LWIP_TCP */ 00372 #if LWIP_AUTOIP 00373 autoip_init(); 00374 #endif /* LWIP_AUTOIP */ 00375 #if LWIP_IGMP 00376 igmp_init(); 00377 #endif /* LWIP_IGMP */ 00378 #if LWIP_DNS 00379 dns_init(); 00380 #endif /* LWIP_DNS */ 00381 #if PPP_SUPPORT 00382 ppp_init(); 00383 #endif 00384 00385 #if LWIP_TIMERS 00386 sys_timeouts_init(); 00387 #endif /* LWIP_TIMERS */ 00388 }
Generated on Tue Jul 12 2022 11:02:41 by
