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