lwipopts.h


1
/**
2
  ******************************************************************************
3
  * @file    lwipopts.h
4
  * @author  MCD Application Team
5
  * @version V1.0.0
6
  * @date    31-October-2011
7
  * @brief   lwIP Options Configuration.
8
  *          This file is based on Utilities\lwip_v1.3.2\src\include\lwip\opt.h 
9
  *          and contains the lwIP configuration for the STM32F4x7 demonstration.
10
  ******************************************************************************
11
  * @attention
12
  *
13
  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
14
  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
15
  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
16
  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
17
  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
18
  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
19
  *
20
  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
21
  ******************************************************************************
22
  */
23
24
#ifndef __LWIPOPTS_H__
25
#define __LWIPOPTS_H__
26
27
/**
28
 * SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection for certain
29
 * critical regions during buffer allocation, deallocation and memory
30
 * allocation and deallocation.
31
 */
32
#define SYS_LIGHTWEIGHT_PROT    1
33
34
#define ETHARP_TRUST_IP_MAC     0
35
#define IP_REASSEMBLY           0
36
#define IP_FRAG                 0
37
#define ARP_QUEUEING            0
38
39
/**
40
 * NO_SYS==1: Provides VERY minimal functionality. Otherwise,
41
 * use lwIP facilities.
42
 */
43
#define NO_SYS                  0
44
45
/* ---------- Memory options ---------- */
46
/* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
47
   lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
48
   byte alignment -> define MEM_ALIGNMENT to 2. */
49
#define MEM_ALIGNMENT           4
50
51
/* MEM_SIZE: the size of the heap memory. If the application will send
52
a lot of data that needs to be copied, this should be set high. */
53
#define MEM_SIZE                (5*1024)
54
55
/* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
56
   sends a lot of data out of ROM (or other static memory), this
57
   should be set high. */
58
#define MEMP_NUM_PBUF           100
59
/* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
60
   per active UDP "connection". */
61
#define MEMP_NUM_UDP_PCB        6
62
/* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
63
   connections. */
64
#define MEMP_NUM_TCP_PCB        10
65
/* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
66
   connections. */
67
#define MEMP_NUM_TCP_PCB_LISTEN 5
68
/* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
69
   segments. */
70
#define MEMP_NUM_TCP_SEG        20
71
/* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
72
   timeouts. Default was 3*/
73
#define MEMP_NUM_SYS_TIMEOUT    10
74
75
76
/* ---------- Pbuf options ---------- */
77
/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
78
#define PBUF_POOL_SIZE          12
79
80
/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
81
#define PBUF_POOL_BUFSIZE       512
82
83
84
/* ---------- TCP options ---------- */
85
#define LWIP_TCP                1
86
#define TCP_TTL                 255
87
88
/* Controls if TCP should queue segments that arrive out of
89
   order. Define to 0 if your device is low on memory. */
90
#define TCP_QUEUE_OOSEQ         0
91
92
/* TCP Maximum segment size. */
93
#define TCP_MSS                 (1500 - 40)    /* TCP_MSS = (Ethernet MTU - IP header size - TCP header size) */
94
95
/* TCP sender buffer space (bytes). */
96
#define TCP_SND_BUF             (5*TCP_MSS)
97
98
/*  TCP_SND_QUEUELEN: TCP sender buffer space (pbufs). This must be at least
99
  as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work. */
100
101
#define TCP_SND_QUEUELEN        (4* TCP_SND_BUF/TCP_MSS)
102
103
/* TCP receive window. */
104
#define TCP_WND                 (2*TCP_MSS)
105
106
107
/* ---------- ICMP options ---------- */
108
#define LWIP_ICMP                       1
109
110
111
/* ---------- DHCP options ---------- */
112
/* Define LWIP_DHCP to 1 if you want DHCP configuration of
113
   interfaces. DHCP is not implemented in lwIP 0.5.1, however, so
114
   turning this on does currently not work. */
115
#define LWIP_DHCP               0
116
117
118
/* ---------- UDP options ---------- */
119
#define LWIP_UDP                1
120
#define UDP_TTL                 255
121
122
123
/* ---------- Statistics options ---------- */
124
#define LWIP_STATS 0
125
#define LWIP_PROVIDE_ERRNO 1
126
127
128
/*
129
   --------------------------------------
130
   ---------- Checksum options ----------
131
   --------------------------------------
132
*/
133
134
/* 
135
The STM32F4x7 allows computing and verifying the IP, UDP, TCP and ICMP checksums by hardware:
136
 - To use this feature let the following define uncommented.
137
 - To disable it and process by CPU comment the  the checksum.
138
*/
139
#define CHECKSUM_BY_HARDWARE 
140
141
142
#ifdef CHECKSUM_BY_HARDWARE
143
  /* CHECKSUM_GEN_IP==0: Generate checksums by hardware for outgoing IP packets.*/
144
  #define CHECKSUM_GEN_IP                 0
145
  /* CHECKSUM_GEN_UDP==0: Generate checksums by hardware for outgoing UDP packets.*/
146
  #define CHECKSUM_GEN_UDP                0
147
  /* CHECKSUM_GEN_TCP==0: Generate checksums by hardware for outgoing TCP packets.*/
148
  #define CHECKSUM_GEN_TCP                0 
149
  /* CHECKSUM_CHECK_IP==0: Check checksums by hardware for incoming IP packets.*/
150
  #define CHECKSUM_CHECK_IP               0
151
  /* CHECKSUM_CHECK_UDP==0: Check checksums by hardware for incoming UDP packets.*/
152
  #define CHECKSUM_CHECK_UDP              0
153
  /* CHECKSUM_CHECK_TCP==0: Check checksums by hardware for incoming TCP packets.*/
154
  #define CHECKSUM_CHECK_TCP              0
155
  /* CHECKSUM_CHECK_ICMP==0: Check checksums by hardware for incoming ICMP packets */
156
  #define CHECKSUM_GEN_ICMP               0
157
#else
158
  /* CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP packets.*/
159
  #define CHECKSUM_GEN_IP                 1
160
  /* CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets.*/
161
  #define CHECKSUM_GEN_UDP                1
162
  /* CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets.*/
163
  #define CHECKSUM_GEN_TCP                1
164
  /* CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.*/
165
  #define CHECKSUM_CHECK_IP               1
166
  /* CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.*/
167
  #define CHECKSUM_CHECK_UDP              1
168
  /* CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets.*/
169
  #define CHECKSUM_CHECK_TCP              1
170
  /* CHECKSUM_CHECK_ICMP==1: Check checksums in software for incoming ICMP packets */
171
  #define CHECKSUM_GEN_ICMP               1
172
#endif
173
174
175
/*
176
   ----------------------------------------------
177
   ---------- Sequential layer options ----------
178
   ----------------------------------------------
179
*/
180
/**
181
 * LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c)
182
 */
183
#define LWIP_NETCONN                    1
184
185
/*
186
   ------------------------------------
187
   ---------- Socket options ----------
188
   ------------------------------------
189
*/
190
/**
191
 * LWIP_SOCKET==1: Enable Socket API (require to use sockets.c)
192
 */
193
#define LWIP_SOCKET                     0
194
195
196
/*
197
   ----------------------------------------
198
   ---------- Lwip Debug options ----------
199
   ----------------------------------------
200
*/
201
//#define LWIP_DEBUG                      0
202
203
204
/*
205
   ---------------------------------
206
   ---------- OS options ----------
207
   ---------------------------------
208
*/
209
210
#define TCPIP_THREAD_NAME              "TCP/IP"
211
#define TCPIP_THREAD_STACKSIZE          1000
212
#define TCPIP_MBOX_SIZE                 5
213
#define DEFAULT_UDP_RECVMBOX_SIZE       2000
214
#define DEFAULT_TCP_RECVMBOX_SIZE       2000
215
#define DEFAULT_ACCEPTMBOX_SIZE         2000
216
#define DEFAULT_THREAD_STACKSIZE        500
217
#define TCPIP_THREAD_PRIO               (configMAX_PRIORITIES - 2)
218
219
#define LWIP_COMPAT_MUTEX 1
220
221
#endif /* __LWIPOPTS_H__ */
222
223
/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/