|
1 | 1 | /* Copyright (C) 2012 mbed.org, MIT License
|
2 |
| - * |
3 |
| - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
4 |
| - * and associated documentation files (the "Software"), to deal in the Software without restriction, |
5 |
| - * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
6 |
| - * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
7 |
| - * furnished to do so, subject to the following conditions: |
8 |
| - * |
9 |
| - * The above copyright notice and this permission notice shall be included in all copies or |
10 |
| - * substantial portions of the Software. |
11 |
| - * |
12 |
| - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
13 |
| - * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
14 |
| - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
15 |
| - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
16 |
| - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
17 |
| - */ |
| 2 | +
|
| 3 | + Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
| 4 | + and associated documentation files (the "Software"), to deal in the Software without restriction, |
| 5 | + including without limitation the rights to use, copy, modify, merge, publish, distribute, |
| 6 | + sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
| 7 | + furnished to do so, subject to the following conditions: |
| 8 | +
|
| 9 | + The above copyright notice and this permission notice shall be included in all copies or |
| 10 | + substantial portions of the Software. |
| 11 | +
|
| 12 | + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
| 13 | + BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 14 | + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
| 15 | + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 16 | + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 17 | +*/ |
18 | 18 |
|
19 | 19 | #ifndef LWIPOPTS_H
|
20 | 20 | #define LWIPOPTS_H
|
21 | 21 |
|
22 | 22 | // Workaround for Linux timeval
|
23 | 23 | #if defined (TOOLCHAIN_GCC)
|
24 |
| -#define LWIP_TIMEVAL_PRIVATE 0 |
25 |
| -#include <sys/time.h> |
| 24 | + #define LWIP_TIMEVAL_PRIVATE 0 |
| 25 | + #include <sys/time.h> |
26 | 26 | #endif
|
27 | 27 | #include "nsapi_types.h"
|
28 | 28 | #include "mbed_retarget.h"
|
|
35 | 35 | #define NO_SYS 0
|
36 | 36 |
|
37 | 37 | #if !MBED_CONF_LWIP_IPV4_ENABLED && !MBED_CONF_LWIP_IPV6_ENABLED
|
38 |
| -#error "Either IPv4 or IPv6 must be enabled." |
| 38 | + #error "Either IPv4 or IPv6 must be enabled." |
39 | 39 | #endif
|
40 | 40 |
|
41 | 41 | #define LWIP_IPV4 MBED_CONF_LWIP_IPV4_ENABLED
|
|
47 | 47 | // On dual stack configuration how long to wait for both or preferred stack
|
48 | 48 | // addresses before completing bring up.
|
49 | 49 | #if LWIP_IPV4 && LWIP_IPV6
|
50 |
| -#if MBED_CONF_LWIP_ADDR_TIMEOUT_MODE |
51 |
| -#define BOTH_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT |
52 |
| -#define PREF_ADDR_TIMEOUT 0 |
53 |
| -#else |
54 |
| -#define PREF_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT |
55 |
| -#define BOTH_ADDR_TIMEOUT 0 |
56 |
| -#endif |
| 50 | + #if MBED_CONF_LWIP_ADDR_TIMEOUT_MODE |
| 51 | + #define BOTH_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT |
| 52 | + #define PREF_ADDR_TIMEOUT 0 |
| 53 | + #else |
| 54 | + #define PREF_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT |
| 55 | + #define BOTH_ADDR_TIMEOUT 0 |
| 56 | + #endif |
57 | 57 | #else
|
58 |
| -#define PREF_ADDR_TIMEOUT 0 |
59 |
| -#define BOTH_ADDR_TIMEOUT 0 |
| 58 | + #define PREF_ADDR_TIMEOUT 0 |
| 59 | + #define BOTH_ADDR_TIMEOUT 0 |
60 | 60 | #endif
|
61 | 61 |
|
62 | 62 |
|
|
68 | 68 | #define PREF_IPV6 2
|
69 | 69 |
|
70 | 70 | #if MBED_CONF_LWIP_IP_VER_PREF == 6
|
71 |
| -#define IP_VERSION_PREF PREF_IPV6 |
| 71 | + #define IP_VERSION_PREF PREF_IPV6 |
72 | 72 | #elif MBED_CONF_LWIP_IP_VER_PREF == 4
|
73 |
| -#define IP_VERSION_PREF PREF_IPV4 |
| 73 | + #define IP_VERSION_PREF PREF_IPV4 |
74 | 74 | #else
|
75 |
| -#error "Either IPv4 or IPv6 must be preferred." |
| 75 | + #error "Either IPv4 or IPv6 must be preferred." |
76 | 76 | #endif
|
77 | 77 |
|
78 | 78 | #undef LWIP_DEBUG
|
79 | 79 | #if MBED_CONF_LWIP_DEBUG_ENABLED
|
80 |
| -#define LWIP_DEBUG 1 |
| 80 | + #define LWIP_DEBUG 1 |
81 | 81 | #endif
|
82 | 82 |
|
83 | 83 | #if NO_SYS == 0
|
84 |
| -#include "cmsis_os2.h" |
| 84 | + #include "cmsis_os2.h" |
85 | 85 |
|
86 |
| -#define SYS_LIGHTWEIGHT_PROT 1 |
| 86 | + #define SYS_LIGHTWEIGHT_PROT 1 |
87 | 87 |
|
88 |
| -#define LWIP_RAW MBED_CONF_LWIP_RAW_SOCKET_ENABLED |
| 88 | + #define LWIP_RAW MBED_CONF_LWIP_RAW_SOCKET_ENABLED |
89 | 89 |
|
90 |
| -#define MEMP_NUM_TCPIP_MSG_INPKT MBED_CONF_LWIP_MEMP_NUM_TCPIP_MSG_INPKT |
| 90 | + #define MEMP_NUM_TCPIP_MSG_INPKT MBED_CONF_LWIP_MEMP_NUM_TCPIP_MSG_INPKT |
91 | 91 |
|
92 |
| -// Thread stacks use 8-byte alignment |
93 |
| -#define LWIP_ALIGN_UP(pos, align) ((pos) % (align) ? (pos) + ((align) - (pos) % (align)) : (pos)) |
| 92 | + // Thread stacks use 8-byte alignment |
| 93 | + #define LWIP_ALIGN_UP(pos, align) ((pos) % (align) ? (pos) + ((align) - (pos) % (align)) : (pos)) |
94 | 94 |
|
95 |
| -#ifdef LWIP_DEBUG |
96 |
| -// For LWIP debug, double the stack |
97 |
| -#define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE*2, 8) |
98 |
| -#elif MBED_DEBUG |
99 |
| -// When debug is enabled on the build increase stack 25 percent |
100 |
| -#define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE + MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE / 4, 8) |
101 |
| -#else |
102 |
| -#define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE, 8) |
103 |
| -#endif |
| 95 | + #ifdef LWIP_DEBUG |
| 96 | + // For LWIP debug, double the stack |
| 97 | + #define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE*2, 8) |
| 98 | + #elif MBED_DEBUG |
| 99 | + // When debug is enabled on the build increase stack 25 percent |
| 100 | + #define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE + MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE / 4, 8) |
| 101 | + #else |
| 102 | + #define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE, 8) |
| 103 | + #endif |
104 | 104 |
|
105 |
| -// Thread priority (osPriorityNormal by default) |
106 |
| -#define TCPIP_THREAD_PRIO (MBED_CONF_LWIP_TCPIP_THREAD_PRIORITY) |
| 105 | + // Thread priority (osPriorityNormal by default) |
| 106 | + #define TCPIP_THREAD_PRIO (MBED_CONF_LWIP_TCPIP_THREAD_PRIORITY) |
107 | 107 |
|
108 |
| -#ifdef LWIP_DEBUG |
109 |
| -#define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE*2, 8) |
110 |
| -#else |
111 |
| -#define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE, 8) |
112 |
| -#endif |
| 108 | + #ifdef LWIP_DEBUG |
| 109 | + #define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE*2, 8) |
| 110 | + #else |
| 111 | + #define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE, 8) |
| 112 | + #endif |
113 | 113 |
|
114 |
| -#define MEMP_NUM_SYS_TIMEOUT 16 |
| 114 | + #define MEMP_NUM_SYS_TIMEOUT 16 |
115 | 115 |
|
116 |
| -#define sys_msleep(ms) sys_msleep(ms) |
| 116 | + #define sys_msleep(ms) sys_msleep(ms) |
117 | 117 |
|
118 | 118 | #endif
|
119 | 119 |
|
|
143 | 143 | #define PBUF_POOL_SIZE MBED_CONF_LWIP_PBUF_POOL_SIZE
|
144 | 144 |
|
145 | 145 | #ifdef MBED_CONF_LWIP_PBUF_POOL_BUFSIZE
|
146 |
| -#undef PBUF_POOL_BUFSIZE |
147 |
| -#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(MBED_CONF_LWIP_PBUF_POOL_BUFSIZE) |
| 146 | + #undef PBUF_POOL_BUFSIZE |
| 147 | + #define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(MBED_CONF_LWIP_PBUF_POOL_BUFSIZE) |
148 | 148 | #else
|
149 |
| -#ifndef PBUF_POOL_BUFSIZE |
150 |
| -#if LWIP_IPV6 |
151 |
| -#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) |
152 |
| -#elif LWIP_IPV4 |
153 |
| -#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+20+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) |
154 |
| -#endif |
155 |
| -#endif |
| 149 | + #ifndef PBUF_POOL_BUFSIZE |
| 150 | + #if LWIP_IPV6 |
| 151 | + #define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) |
| 152 | + #elif LWIP_IPV4 |
| 153 | + #define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+20+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) |
| 154 | + #endif |
| 155 | + #endif |
156 | 156 | #endif
|
157 | 157 |
|
158 | 158 | #define MEM_SIZE MBED_CONF_LWIP_MEM_SIZE
|
|
181 | 181 | #define MEMP_NUM_NETCONN MBED_CONF_LWIP_SOCKET_MAX
|
182 | 182 |
|
183 | 183 | #if MBED_CONF_LWIP_TCP_ENABLED
|
184 |
| -#define LWIP_TCP 1 |
185 |
| -#define TCP_OVERSIZE 0 |
186 |
| -#define LWIP_TCP_KEEPALIVE 1 |
| 184 | + #define LWIP_TCP 1 |
| 185 | + #define TCP_OVERSIZE 0 |
| 186 | + #define LWIP_TCP_KEEPALIVE 1 |
187 | 187 |
|
188 |
| -#define TCP_CLOSE_TIMEOUT MBED_CONF_LWIP_TCP_CLOSE_TIMEOUT |
| 188 | + #define TCP_CLOSE_TIMEOUT MBED_CONF_LWIP_TCP_CLOSE_TIMEOUT |
189 | 189 |
|
190 | 190 | #else
|
191 |
| -#define LWIP_TCP 0 |
| 191 | + #define LWIP_TCP 0 |
192 | 192 | #endif
|
193 | 193 |
|
194 | 194 | #define LWIP_DNS 1
|
|
251 | 251 | #define UDP_LPC_EMAC LWIP_DBG_OFF
|
252 | 252 |
|
253 | 253 | #ifdef LWIP_DEBUG
|
254 |
| -#define MEMP_OVERFLOW_CHECK 1 |
255 |
| -#define MEMP_SANITY_CHECK 1 |
256 |
| -#define LWIP_DBG_TYPES_ON LWIP_DBG_ON |
257 |
| -#define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL |
| 254 | + #define MEMP_OVERFLOW_CHECK 1 |
| 255 | + #define MEMP_SANITY_CHECK 1 |
| 256 | + #define LWIP_DBG_TYPES_ON LWIP_DBG_ON |
| 257 | + #define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL |
258 | 258 | #else
|
259 |
| -#define LWIP_NOASSERT 1 |
260 |
| -#define LWIP_STATS 0 |
| 259 | + #define LWIP_NOASSERT 1 |
| 260 | + #define LWIP_STATS 0 |
261 | 261 | #endif
|
262 | 262 |
|
263 | 263 | #define TRACE_TO_ASCII_HEX_DUMP 0
|
|
269 | 269 | // Interface type configuration
|
270 | 270 |
|
271 | 271 | #if MBED_CONF_LWIP_ETHERNET_ENABLED
|
272 |
| -#define LWIP_ARP 1 |
273 |
| -#define LWIP_ETHERNET 1 |
274 |
| -#define LWIP_DHCP LWIP_IPV4 |
| 272 | + #define LWIP_ARP 1 |
| 273 | + #define LWIP_ETHERNET 1 |
| 274 | + #define LWIP_DHCP LWIP_IPV4 |
275 | 275 | #else
|
276 |
| -#define LWIP_ARP 0 |
277 |
| -#define LWIP_ETHERNET 0 |
| 276 | + #define LWIP_ARP 0 |
| 277 | + #define LWIP_ETHERNET 0 |
278 | 278 | #endif // MBED_CONF_LWIP_ETHERNET_ENABLED
|
279 | 279 |
|
280 | 280 | #if MBED_CONF_LWIP_L3IP_ENABLED
|
281 |
| -#define LWIP_L3IP 1 |
| 281 | + #define LWIP_L3IP 1 |
282 | 282 | #else
|
283 |
| -#define LWIP_L3IP 0 |
| 283 | + #define LWIP_L3IP 0 |
284 | 284 | #endif
|
285 | 285 |
|
286 | 286 | //Maximum size of network interface name
|
|
291 | 291 | // Enable PPP for now either from lwIP PPP configuration (obsolete) or from PPP service configuration
|
292 | 292 | #if MBED_CONF_PPP_ENABLED || MBED_CONF_LWIP_PPP_ENABLED
|
293 | 293 |
|
294 |
| -#define PPP_SUPPORT 1 |
295 |
| - |
296 |
| -#if MBED_CONF_PPP_IPV4_ENABLED || MBED_CONF_LWIP_IPV4_ENABLED |
297 |
| -#define LWIP 0x11991199 |
298 |
| -#if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV4_ENABLED |
299 |
| -#error LWIP: IPv4 PPP enabled but not IPv4 |
300 |
| -#endif |
301 |
| -#undef LWIP |
302 |
| -#define PPP_IPV4_SUPPORT 1 |
303 |
| -#endif |
304 |
| - |
305 |
| -#if MBED_CONF_PPP_IPV6_ENABLED || MBED_CONF_LWIP_IPV6_ENABLED |
306 |
| -#define LWIP 0x11991199 |
307 |
| -#if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV6_ENABLED |
308 |
| -#error LWIP: IPv6 PPP enabled but not IPv6 |
309 |
| -#endif |
310 |
| -#undef LWIP |
311 |
| -#define PPP_IPV6_SUPPORT 1 |
312 |
| -// Later to be dynamic for use for multiple interfaces |
313 |
| -#define LWIP_IPV6_DUP_DETECT_ATTEMPTS 0 |
314 |
| -#endif |
| 294 | + #define PPP_SUPPORT 1 |
| 295 | + |
| 296 | + #if MBED_CONF_PPP_IPV4_ENABLED || MBED_CONF_LWIP_IPV4_ENABLED |
| 297 | + #define LWIP 0x11991199 |
| 298 | + #if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV4_ENABLED |
| 299 | + #error LWIP: IPv4 PPP enabled but not IPv4 |
| 300 | + #endif |
| 301 | + #undef LWIP |
| 302 | + #define PPP_IPV4_SUPPORT 1 |
| 303 | + #endif |
| 304 | + |
| 305 | + #if MBED_CONF_PPP_IPV6_ENABLED || MBED_CONF_LWIP_IPV6_ENABLED |
| 306 | + #define LWIP 0x11991199 |
| 307 | + #if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV6_ENABLED |
| 308 | + #error LWIP: IPv6 PPP enabled but not IPv6 |
| 309 | + #endif |
| 310 | + #undef LWIP |
| 311 | + #define PPP_IPV6_SUPPORT 1 |
| 312 | + // Later to be dynamic for use for multiple interfaces |
| 313 | + #define LWIP_IPV6_DUP_DETECT_ATTEMPTS 0 |
| 314 | + #endif |
315 | 315 |
|
316 | 316 | #endif
|
317 | 317 |
|
|
320 | 320 | // Make sure we default these to off, so
|
321 | 321 | // LWIP doesn't default to on
|
322 | 322 | #ifndef LWIP_ARP
|
323 |
| -#define LWIP_ARP 0 |
| 323 | + #define LWIP_ARP 0 |
324 | 324 | #endif
|
325 | 325 |
|
326 | 326 | // Checksum-on-copy disabled due to https://savannah.nongnu.org/bugs/?50914
|
|
337 | 337 | #include "lwip_tcp_isn.h"
|
338 | 338 | #define LWIP_HOOK_TCP_ISN lwip_hook_tcp_isn
|
339 | 339 | #ifdef MBEDTLS_MD5_C
|
340 |
| -#define LWIP_USE_EXTERNAL_MBEDTLS 1 |
| 340 | + #define LWIP_USE_EXTERNAL_MBEDTLS 1 |
341 | 341 | #else
|
342 |
| -#define LWIP_USE_EXTERNAL_MBEDTLS 0 |
| 342 | + #define LWIP_USE_EXTERNAL_MBEDTLS 0 |
343 | 343 | #endif
|
344 | 344 |
|
345 | 345 | #define LWIP_ND6_RDNSS_MAX_DNS_SERVERS MBED_CONF_LWIP_ND6_RDNSS_MAX_DNS_SERVERS
|
|
0 commit comments