HPM APP
HPMicro Application solution
lwipopts.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021-2024 HPMicro
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 #ifndef LWIPOPTS_H
8 #define LWIPOPTS_H
9 
15 #define SYS_LIGHTWEIGHT_PROT 0
16 #define ETHARP_TRUST_IP_MAC 0
17 #define IP_REASSEMBLY 0
18 #define IP_FRAG 0
19 #define ARP_QUEUEING 0
20 #define LWIP_RAW 1
21 #define LWIP_IPV4 1
22 #define LWIP_TIMERS 1
23 #define LWIP_NETIF_TX_SINGLE_PBUF 1
28 #define NO_SYS 1
29 
30 /* ---------- Memory options ---------- */
31 /* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
32  lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
33  byte alignment -> define MEM_ALIGNMENT to 2. */
34 #define MEM_ALIGNMENT 4
35 
36 /* MEM_SIZE: the size of the heap memory. If the application will send
37 a lot of data that needs to be copied, this should be set high. */
38 #define MEM_SIZE (20*1024)
39 
40 /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
41  sends a lot of data out of ROM (or other static memory), this
42  should be set high. */
43 #define MEMP_NUM_PBUF 100
44 /* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
45  per active UDP "connection". */
46 #define MEMP_NUM_UDP_PCB 6
47 /* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
48  connections. */
49 #define MEMP_NUM_TCP_PCB 10
50 /* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
51  connections. */
52 #define MEMP_NUM_TCP_PCB_LISTEN 5
53 /* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
54  segments. */
55 #define MEMP_NUM_TCP_SEG 20
56 /* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
57  timeouts. */
58 #define MEMP_NUM_SYS_TIMEOUT 10
59 
60 
61 /* ---------- Pbuf options ---------- */
62 /* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
63 #define PBUF_POOL_SIZE 20
64 
65 /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
66 #define PBUF_POOL_BUFSIZE 1600
67 
68 
69 /* ---------- TCP options ---------- */
70 #define LWIP_TCP 1
71 #define TCP_TTL 255
72 
73 /* Controls if TCP should queue segments that arrive out of
74  order. Define to 0 if your device is low on memory. */
75 #define TCP_QUEUE_OOSEQ 0
76 
77 /* TCP Maximum segment size. */
78 #define TCP_MSS (1500 - 40) /* TCP_MSS = (Ethernet MTU - IP header size - TCP header size) */
79 
80 /* TCP sender buffer space (bytes). */
81 #define TCP_SND_BUF (5*TCP_MSS)
82 
83 /* TCP_SND_QUEUELEN: TCP sender buffer space (pbufs). This must be at least
84  as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work. */
85 
86 #define TCP_SND_QUEUELEN (4* TCP_SND_BUF/TCP_MSS)
87 
88 /* TCP receive window. */
89 #define TCP_WND (2*TCP_MSS)
90 
91 
92 /* ---------- ICMP options ---------- */
93 #define LWIP_ICMP 1
94 #define ICMP_TTL 64
95 
96 /* ---------- DHCP options ---------- */
97 /* Define LWIP_DHCP to 1 if you want DHCP configuration of
98  interfaces. DHCP is not implemented in lwIP 0.5.1, however, so
99  turning this on does currently not work. */
100 #ifndef LWIP_DHCP
101 #define LWIP_DHCP 0
102 #endif
103 
104 /* ---------- UDP options ---------- */
105 #define LWIP_UDP 1
106 #define UDP_TTL 255
107 
108 
109 /* ---------- Statistics options ---------- */
110 #define LWIP_STATS 0
111 #define LWIP_PROVIDE_ERRNO 1
112 
113 /* ---------- link callback options ---------- */
114 /* LWIP_NETIF_LINK_CALLBACK==1: Support a callback function from an interface
115  * whenever the link changes (i.e., link down)
116  */
117 #define LWIP_NETIF_LINK_CALLBACK 1
118 
119 /*
120  --------------------------------------
121  ---------- Checksum options ----------
122  --------------------------------------
123 */
124 
125 /*
126 Some MCUs allow computing and verifying the IP, UDP, TCP and ICMP checksums by hardware:
127  - To use this feature let the following define uncommented.
128  - To disable it and process by CPU comment the the checksum.
129 */
130 #define CHECKSUM_BY_HARDWARE 1
131 #ifdef CHECKSUM_BY_HARDWARE
132  /* CHECKSUM_GEN_IP==0: Generate checksums by hardware for outgoing IP packets.*/
133  #define CHECKSUM_GEN_IP 0
134  /* CHECKSUM_GEN_UDP==0: Generate checksums by hardware for outgoing UDP packets.*/
135  #define CHECKSUM_GEN_UDP 0
136  /* CHECKSUM_GEN_TCP==0: Generate checksums by hardware for outgoing TCP packets.*/
137  #define CHECKSUM_GEN_TCP 0
138  /* CHECKSUM_CHECK_IP==0: Check checksums by hardware for incoming IP packets.*/
139  #define CHECKSUM_CHECK_IP 0
140  /* CHECKSUM_CHECK_UDP==0: Check checksums by hardware for incoming UDP packets.*/
141  #define CHECKSUM_CHECK_UDP 0
142  /* CHECKSUM_CHECK_TCP==0: Check checksums by hardware for incoming TCP packets.*/
143  #define CHECKSUM_CHECK_TCP 0
144  /* CHECKSUM_CHECK_ICMP==0: Check checksums by hardware for incoming ICMP packets.*/
145  #define CHECKSUM_GEN_ICMP 0
146 #else
147  /* CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP packets.*/
148  #define CHECKSUM_GEN_IP 1
149  /* CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets.*/
150  #define CHECKSUM_GEN_UDP 1
151  /* CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets.*/
152  #define CHECKSUM_GEN_TCP 1
153  /* CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.*/
154  #define CHECKSUM_CHECK_IP 1
155  /* CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.*/
156  #define CHECKSUM_CHECK_UDP 1
157  /* CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets.*/
158  #define CHECKSUM_CHECK_TCP 1
159  /* CHECKSUM_CHECK_ICMP==1: Check checksums by software for incoming ICMP packets.*/
160  #define CHECKSUM_GEN_ICMP 1
161 #endif
162 
163 
164 /*
165  ----------------------------------------------
166  ---------- Sequential layer options ----------
167  ----------------------------------------------
168 */
172 #define LWIP_NETCONN 0
173 
174 /*
175  ------------------------------------
176  ---------- Socket options ----------
177  ------------------------------------
178 */
182 #define LWIP_SOCKET 0
183 
184 /*
185  -----------------------------------
186  ---------- DEBUG options ----------
187  -----------------------------------
188 */
189 
190 #define LWIP_DEBUG 1
191 
192 #ifdef LWIP_DEBUG
193 
194 #define LWIP_DBG_MIN_LEVEL 0
195 #define PPP_DEBUG LWIP_DBG_OFF
196 #define MEM_DEBUG LWIP_DBG_OFF
197 #define MEMP_DEBUG LWIP_DBG_OFF
198 #define PBUF_DEBUG LWIP_DBG_OFF
199 #define API_LIB_DEBUG LWIP_DBG_OFF
200 #define API_MSG_DEBUG LWIP_DBG_OFF
201 #define TCPIP_DEBUG LWIP_DBG_OFF
202 #define NETIF_DEBUG LWIP_DBG_OFF
203 #define SOCKETS_DEBUG LWIP_DBG_OFF
204 #define DNS_DEBUG LWIP_DBG_OFF
205 #define AUTOIP_DEBUG LWIP_DBG_OFF
206 #define DHCP_DEBUG LWIP_DBG_OFF
207 #define IP_DEBUG LWIP_DBG_OFF
208 #define IP_REASS_DEBUG LWIP_DBG_OFF
209 #define ICMP_DEBUG LWIP_DBG_OFF
210 #define IGMP_DEBUG LWIP_DBG_OFF
211 #define UDP_DEBUG LWIP_DBG_OFF
212 #define TCP_DEBUG LWIP_DBG_OFF
213 #define TCP_INPUT_DEBUG LWIP_DBG_OFF
214 #define TCP_OUTPUT_DEBUG LWIP_DBG_OFF
215 #define TCP_RTO_DEBUG LWIP_DBG_OFF
216 #define TCP_CWND_DEBUG LWIP_DBG_OFF
217 #define TCP_WND_DEBUG LWIP_DBG_OFF
218 #define TCP_FR_DEBUG LWIP_DBG_OFF
219 #define TCP_QLEN_DEBUG LWIP_DBG_OFF
220 #define TCP_RST_DEBUG LWIP_DBG_OFF
221 #define ETHARP_DEBUG LWIP_DBG_OFF
222 #endif
223 
224 
225 /*
226  ---------------------------------
227  ---------- OS options ----------
228  ---------------------------------
229 */
230 
231 #define TCPIP_THREAD_NAME "TCP/IP"
232 #define TCPIP_THREAD_STACKSIZE 1500
233 #define TCPIP_MBOX_SIZE 5
234 #define DEFAULT_UDP_RECVMBOX_SIZE 1000
235 #define DEFAULT_TCP_RECVMBOX_SIZE 1000
236 #define DEFAULT_ACCEPTMBOX_SIZE 1000
237 #define DEFAULT_THREAD_STACKSIZE 500
238 #define TCPIP_THREAD_PRIO 3
239 #define LWIP_SINGLE_NETIF 1
240 #define LWIP_COMPAT_MUTEX 0
241 
242 #endif /* __LWIPOPTS_H__ */