Skip to content
This repository was archived by the owner on Jan 29, 2023. It is now read-only.

Commit 3a6514c

Browse files
authored
Update Packages_Patches
1 parent e2ff52e commit 3a6514c

File tree

11 files changed

+2051
-0
lines changed

11 files changed

+2051
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,347 @@
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+
*/
18+
19+
#ifndef LWIPOPTS_H
20+
#define LWIPOPTS_H
21+
22+
// Workaround for Linux timeval
23+
#if defined (TOOLCHAIN_GCC)
24+
#define LWIP_TIMEVAL_PRIVATE 0
25+
#include <sys/time.h>
26+
#endif
27+
#include "nsapi_types.h"
28+
#include "mbed_retarget.h"
29+
30+
// KH fix
31+
#include <mbed_config.h>
32+
/////////////////////////
33+
34+
// Operating System
35+
#define NO_SYS 0
36+
37+
#if !MBED_CONF_LWIP_IPV4_ENABLED && !MBED_CONF_LWIP_IPV6_ENABLED
38+
#error "Either IPv4 or IPv6 must be enabled."
39+
#endif
40+
41+
#define LWIP_IPV4 MBED_CONF_LWIP_IPV4_ENABLED
42+
43+
#define LWIP_IPV6 MBED_CONF_LWIP_IPV6_ENABLED
44+
45+
#define LWIP_PROVIDE_ERRNO 0
46+
47+
// On dual stack configuration how long to wait for both or preferred stack
48+
// addresses before completing bring up.
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
57+
#else
58+
#define PREF_ADDR_TIMEOUT 0
59+
#define BOTH_ADDR_TIMEOUT 0
60+
#endif
61+
62+
63+
#define DHCP_TIMEOUT MBED_CONF_LWIP_DHCP_TIMEOUT
64+
65+
#define LINK_TIMEOUT 60
66+
67+
#define PREF_IPV4 1
68+
#define PREF_IPV6 2
69+
70+
#if MBED_CONF_LWIP_IP_VER_PREF == 6
71+
#define IP_VERSION_PREF PREF_IPV6
72+
#elif MBED_CONF_LWIP_IP_VER_PREF == 4
73+
#define IP_VERSION_PREF PREF_IPV4
74+
#else
75+
#error "Either IPv4 or IPv6 must be preferred."
76+
#endif
77+
78+
#undef LWIP_DEBUG
79+
#if MBED_CONF_LWIP_DEBUG_ENABLED
80+
#define LWIP_DEBUG 1
81+
#endif
82+
83+
#if NO_SYS == 0
84+
#include "cmsis_os2.h"
85+
86+
#define SYS_LIGHTWEIGHT_PROT 1
87+
88+
#define LWIP_RAW MBED_CONF_LWIP_RAW_SOCKET_ENABLED
89+
90+
#define MEMP_NUM_TCPIP_MSG_INPKT MBED_CONF_LWIP_MEMP_NUM_TCPIP_MSG_INPKT
91+
92+
// Thread stacks use 8-byte alignment
93+
#define LWIP_ALIGN_UP(pos, align) ((pos) % (align) ? (pos) + ((align) - (pos) % (align)) : (pos))
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
104+
105+
// Thread priority (osPriorityNormal by default)
106+
#define TCPIP_THREAD_PRIO (MBED_CONF_LWIP_TCPIP_THREAD_PRIORITY)
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
113+
114+
#define MEMP_NUM_SYS_TIMEOUT 16
115+
116+
#define sys_msleep(ms) sys_msleep(ms)
117+
118+
#endif
119+
120+
// 32-bit alignment
121+
#define MEM_ALIGNMENT 4
122+
123+
#define LWIP_RAM_HEAP_POINTER lwip_ram_heap
124+
125+
// Number of simultaneously queued TCP segments.
126+
#define MEMP_NUM_TCP_SEG MBED_CONF_LWIP_MEMP_NUM_TCP_SEG
127+
128+
// TCP Maximum segment size.
129+
#define TCP_MSS MBED_CONF_LWIP_TCP_MSS
130+
131+
// TCP sender buffer space (bytes).
132+
#define TCP_SND_BUF MBED_CONF_LWIP_TCP_SND_BUF
133+
134+
// TCP sender buffer space (bytes).
135+
#define TCP_WND MBED_CONF_LWIP_TCP_WND
136+
137+
#define TCP_MAXRTX MBED_CONF_LWIP_TCP_MAXRTX
138+
139+
#define TCP_SYNMAXRTX MBED_CONF_LWIP_TCP_SYNMAXRTX
140+
141+
// Number of pool pbufs.
142+
// Each requires 684 bytes of RAM (if MSS=536 and PBUF_POOL_BUFSIZE defaulting to be based on MSS)
143+
#define PBUF_POOL_SIZE MBED_CONF_LWIP_PBUF_POOL_SIZE
144+
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)
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
156+
#endif
157+
158+
#define MEM_SIZE MBED_CONF_LWIP_MEM_SIZE
159+
160+
// One tcp_pcb_listen is needed for each TCP server.
161+
// Each requires 72 bytes of RAM.
162+
#define MEMP_NUM_TCP_PCB_LISTEN MBED_CONF_LWIP_TCP_SERVER_MAX
163+
164+
// One is tcp_pcb needed for each TCPSocket.
165+
// Each requires 196 bytes of RAM.
166+
#define MEMP_NUM_TCP_PCB MBED_CONF_LWIP_TCP_SOCKET_MAX
167+
168+
// One udp_pcb is needed for each UDPSocket.
169+
// Each requires 84 bytes of RAM (total rounded to multiple of 512).
170+
#define MEMP_NUM_UDP_PCB MBED_CONF_LWIP_UDP_SOCKET_MAX
171+
172+
// Number of non-pool pbufs.
173+
// Each requires 92 bytes of RAM.
174+
#define MEMP_NUM_PBUF MBED_CONF_LWIP_NUM_PBUF
175+
176+
// Each netbuf requires 64 bytes of RAM.
177+
#define MEMP_NUM_NETBUF MBED_CONF_LWIP_NUM_NETBUF
178+
179+
// One netconn is needed for each UDPSocket or TCPSocket.
180+
// Each requires 236 bytes of RAM (total rounded to multiple of 512).
181+
#define MEMP_NUM_NETCONN MBED_CONF_LWIP_SOCKET_MAX
182+
183+
#if MBED_CONF_LWIP_TCP_ENABLED
184+
#define LWIP_TCP 1
185+
#define TCP_OVERSIZE 0
186+
#define LWIP_TCP_KEEPALIVE 1
187+
188+
#define TCP_CLOSE_TIMEOUT MBED_CONF_LWIP_TCP_CLOSE_TIMEOUT
189+
190+
#else
191+
#define LWIP_TCP 0
192+
#endif
193+
194+
#define LWIP_DNS 1
195+
// Only DNS address storage is enabled
196+
#define LWIP_FULL_DNS 0
197+
#define LWIP_SOCKET 0
198+
199+
#define SO_REUSE 1
200+
201+
// Support Multicast
202+
#include "stdlib.h"
203+
#define LWIP_IGMP LWIP_IPV4
204+
#define LWIP_RAND() lwip_get_random()
205+
206+
#define LWIP_COMPAT_SOCKETS 0
207+
#define LWIP_POSIX_SOCKETS_IO_NAMES 0
208+
209+
#define LWIP_BROADCAST_PING 1
210+
211+
// Fragmentation on, as per IPv4 default
212+
#define LWIP_IPV6_FRAG LWIP_IPV6
213+
214+
// Queuing, default is "disabled", as per IPv4 default (so actually queues 1)
215+
#define LWIP_ND6_QUEUEING MBED_CONF_ND6_QUEUEING
216+
217+
// Debug Options
218+
#define NETIF_DEBUG LWIP_DBG_OFF
219+
#define PBUF_DEBUG LWIP_DBG_OFF
220+
#define API_LIB_DEBUG LWIP_DBG_OFF
221+
#define API_MSG_DEBUG LWIP_DBG_OFF
222+
#define SOCKETS_DEBUG LWIP_DBG_OFF
223+
#define ICMP_DEBUG LWIP_DBG_OFF
224+
#define IGMP_DEBUG LWIP_DBG_OFF
225+
#define INET_DEBUG LWIP_DBG_OFF
226+
#define IP_DEBUG LWIP_DBG_OFF
227+
#define IP_REASS_DEBUG LWIP_DBG_OFF
228+
#define RAW_DEBUG LWIP_DBG_OFF
229+
#define MEM_DEBUG LWIP_DBG_OFF
230+
#define MEMP_DEBUG LWIP_DBG_OFF
231+
#define SYS_DEBUG LWIP_DBG_OFF
232+
#define TIMERS_DEBUG LWIP_DBG_OFF
233+
#define TCP_DEBUG LWIP_DBG_OFF
234+
#define TCP_INPUT_DEBUG LWIP_DBG_OFF
235+
#define TCP_FR_DEBUG LWIP_DBG_OFF
236+
#define TCP_RTO_DEBUG LWIP_DBG_OFF
237+
#define TCP_CWND_DEBUG LWIP_DBG_OFF
238+
#define TCP_WND_DEBUG LWIP_DBG_OFF
239+
#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF
240+
#define TCP_RST_DEBUG LWIP_DBG_OFF
241+
#define TCP_QLEN_DEBUG LWIP_DBG_OFF
242+
#define UDP_DEBUG LWIP_DBG_OFF
243+
#define TCPIP_DEBUG LWIP_DBG_OFF
244+
#define SLIP_DEBUG LWIP_DBG_OFF
245+
#define DHCP_DEBUG LWIP_DBG_OFF
246+
#define AUTOIP_DEBUG LWIP_DBG_OFF
247+
#define DNS_DEBUG LWIP_DBG_OFF
248+
#define IP6_DEBUG LWIP_DBG_OFF
249+
250+
#define ETHARP_DEBUG LWIP_DBG_OFF
251+
#define UDP_LPC_EMAC LWIP_DBG_OFF
252+
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
258+
#else
259+
#define LWIP_NOASSERT 1
260+
#define LWIP_STATS 0
261+
#endif
262+
263+
#define TRACE_TO_ASCII_HEX_DUMP 0
264+
265+
#define LWIP_PLATFORM_BYTESWAP 1
266+
267+
#define LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS 1
268+
269+
// Interface type configuration
270+
271+
#if MBED_CONF_LWIP_ETHERNET_ENABLED
272+
#define LWIP_ARP 1
273+
#define LWIP_ETHERNET 1
274+
#define LWIP_DHCP LWIP_IPV4
275+
#else
276+
#define LWIP_ARP 0
277+
#define LWIP_ETHERNET 0
278+
#endif // MBED_CONF_LWIP_ETHERNET_ENABLED
279+
280+
#if MBED_CONF_LWIP_L3IP_ENABLED
281+
#define LWIP_L3IP 1
282+
#else
283+
#define LWIP_L3IP 0
284+
#endif
285+
286+
//Maximum size of network interface name
287+
#define INTERFACE_NAME_MAX_SIZE NSAPI_INTERFACE_NAME_MAX_SIZE
288+
// Note generic macro name used rather than MBED_CONF_LWIP_PPP_ENABLED
289+
// to allow users like PPPCellularInterface to detect that nsapi_ppp.h is available.
290+
291+
// Enable PPP for now either from lwIP PPP configuration (obsolete) or from PPP service configuration
292+
#if MBED_CONF_PPP_ENABLED || MBED_CONF_LWIP_PPP_ENABLED
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
315+
316+
#endif
317+
318+
#define LWIP_NETBUF_RECVINFO MBED_CONF_LWIP_NETBUF_RECVINFO_ENABLED
319+
320+
// Make sure we default these to off, so
321+
// LWIP doesn't default to on
322+
#ifndef LWIP_ARP
323+
#define LWIP_ARP 0
324+
#endif
325+
326+
// Checksum-on-copy disabled due to https://savannah.nongnu.org/bugs/?50914
327+
#define LWIP_CHECKSUM_ON_COPY 0
328+
329+
#define LWIP_NETIF_HOSTNAME 1
330+
#define LWIP_NETIF_STATUS_CALLBACK 1
331+
#define LWIP_NETIF_LINK_CALLBACK 1
332+
333+
#define DNS_TABLE_SIZE 2
334+
#define DNS_MAX_NAME_LENGTH 128
335+
336+
#include "lwip_random.h"
337+
#include "lwip_tcp_isn.h"
338+
#define LWIP_HOOK_TCP_ISN lwip_hook_tcp_isn
339+
#ifdef MBEDTLS_MD5_C
340+
#define LWIP_USE_EXTERNAL_MBEDTLS 1
341+
#else
342+
#define LWIP_USE_EXTERNAL_MBEDTLS 0
343+
#endif
344+
345+
#define LWIP_ND6_RDNSS_MAX_DNS_SERVERS MBED_CONF_LWIP_ND6_RDNSS_MAX_DNS_SERVERS
346+
347+
#endif /* LWIPOPTS_H_ */

0 commit comments

Comments
 (0)