lwipopts.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  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. #ifndef __LWIPOPTS_H__
  24. #define __LWIPOPTS_H__
  25. #include "common_config.h"
  26. /**
  27. * SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection for certain
  28. * critical regions during buffer allocation, deallocation and memory
  29. * allocation and deallocation.
  30. */
  31. #define SYS_LIGHTWEIGHT_PROT 1
  32. #define ETHARP_TRUST_IP_MAC 0
  33. #define IP_REASSEMBLY 0
  34. #define IP_FRAG 0
  35. #define ARP_QUEUEING 0
  36. /**
  37. * NO_SYS==1: Provides VERY minimal functionality. Otherwise,
  38. * use lwIP facilities.
  39. */
  40. #define NO_SYS 0
  41. /* ---------- Memory options ---------- */
  42. /* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
  43. lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
  44. byte alignment -> define MEM_ALIGNMENT to 2. */
  45. #define MEM_ALIGNMENT 4
  46. /* MEM_SIZE: the size of the heap memory. If the application will send
  47. a lot of data that needs to be copied, this should be set high. */
  48. #define MEM_SIZE (10*1024)
  49. //#define MEM_SIZE (10*1024)
  50. /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
  51. sends a lot of data out of ROM (or other static memory), this
  52. should be set high. */
  53. //#define MEMP_NUM_PBUF 100
  54. ///#define MEMP_NUM_PBUF 40
  55. #define MEMP_NUM_PBUF 50
  56. /* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
  57. per active UDP "connection". */
  58. #define MEMP_NUM_UDP_PCB 6
  59. /* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
  60. connections. */
  61. #define MEMP_NUM_TCP_PCB 12
  62. //#define MEMP_NUM_TCP_PCB 5
  63. /* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
  64. connections. */
  65. #define MEMP_NUM_TCP_PCB_LISTEN 5
  66. //#define MEMP_NUM_TCP_PCB_LISTEN 15
  67. /* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
  68. segments. */
  69. #define MEMP_NUM_TCP_SEG 25
  70. //#define MEMP_NUM_TCP_SEG 100
  71. /* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
  72. timeouts. */
  73. #define MEMP_NUM_SYS_TIMEOUT 10
  74. //#define MEMP_NUM_SYS_TIMEOUT 100
  75. /**
  76. * MEMP_NUM_NETCONN: the number of struct netconns.
  77. * (only needed if you use the sequential API, like api_lib.c)
  78. */
  79. #define MEMP_NUM_NETCONN 10
  80. /* ---------- Pbuf options ---------- */
  81. /* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
  82. #define PBUF_POOL_SIZE 15
  83. //#define PBUF_POOL_SIZE 25
  84. //#define PBUF_POOL_SIZE 18
  85. /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
  86. //#define PBUF_POOL_BUFSIZE 1500
  87. //#define PBUF_POOL_BUFSIZE 3024
  88. #define PBUF_POOL_BUFSIZE 1540
  89. /**
  90. * MEMP_NUM_NETBUF: the number of struct netbufs.
  91. * (only needed if you use the sequential API, like api_lib.c)
  92. */
  93. #define MEMP_NUM_NETBUF 7
  94. #define TCP_LISTEN_BACKLOG 1
  95. /* ---------- TCP options ---------- */
  96. #define LWIP_TCP 1
  97. #define TCP_TTL 255
  98. /* Controls if TCP should queue segments that arrive out of
  99. order. Define to 0 if your device is low on memory. */
  100. #define TCP_QUEUE_OOSEQ 0
  101. /* TCP Maximum segment size. */
  102. #define TCP_MSS (1500 - 40) /* TCP_MSS = (Ethernet MTU - IP header size - TCP header size) */
  103. /* TCP sender buffer space (bytes). */
  104. //#define TCP_SND_BUF (5*TCP_MSS)
  105. //#define TCP_SND_BUF (18*TCP_MSS)
  106. #define TCP_SND_BUF (18*TCP_MSS)
  107. /* TCP_SND_QUEUELEN: TCP sender buffer space (pbufs). This must be at least
  108. as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work. */
  109. //20
  110. #define TCP_SND_QUEUELEN (4* TCP_SND_BUF/TCP_MSS)
  111. //#define TCP_SND_QUEUELEN (4* TCP_SND_BUF/TCP_MSS)
  112. /* TCP receive window. */
  113. #define TCP_WND (4*TCP_MSS)
  114. /* ---------- ICMP options ---------- */
  115. #define LWIP_ICMP 1
  116. //#define ICMP_TTL 128
  117. /* ---------- DHCP options ---------- */
  118. /* Define LWIP_DHCP to 1 if you want DHCP configuration of
  119. interfaces. DHCP is not implemented in lwIP 0.5.1, however, so
  120. turning this on does currently not work. */
  121. #define LWIP_DHCP 1
  122. // ---------- SNMP options ----------
  123. #define LWIP_SNMP 1
  124. #define SNMP_LWIP_MIB2 1
  125. #define MIB2_STATS 1
  126. #define SNMP_USE_RAW 0
  127. #define SNMP_USE_NETCONN 1
  128. //#define SNMP_CONCURRENT_REQUESTS 1
  129. //#define SNMP_TRAP_DESTINATIONS 1
  130. //#define SNMP_PRIVATE_MIB 1
  131. //#define SNMP_SAFE_REQUESTS 1
  132. #define SNMP_MAX_COMMUNITY_STR_LEN 19
  133. /* ---------- UDP options ---------- */
  134. #define LWIP_UDP 1
  135. #define UDP_TTL 255
  136. #define LWIP_SO_RCVTIMEO 1 // Эта опция необходима для netconn_set_recvtimeout в модуле udp_netsetting.c
  137. #define LWIP_SO_SNDTIMEO 1 //
  138. /* ---------- Statistics options ---------- */
  139. #define LWIP_STATS 1
  140. #define LWIP_STATS_DISPLAY 0
  141. #define LWIP_PROVIDE_ERRNO 1
  142. #define LWIP_NETIF_LINK_CALLBACK 0
  143. /*
  144. --------------------------------------
  145. ---------- Checksum options ----------
  146. --------------------------------------
  147. */
  148. /*
  149. The STM32F4x7 allows computing and verifying the IP, UDP, TCP and ICMP checksums by hardware:
  150. - To use this feature let the following define uncommented.
  151. - To disable it and process by CPU comment the the checksum.
  152. */
  153. #define CHECKSUM_BY_HARDWARE
  154. #ifdef CHECKSUM_BY_HARDWARE
  155. /* CHECKSUM_GEN_IP==0: Generate checksums by hardware for outgoing IP packets.*/
  156. #define CHECKSUM_GEN_IP 0
  157. /* CHECKSUM_GEN_UDP==0: Generate checksums by hardware for outgoing UDP packets.*/
  158. #define CHECKSUM_GEN_UDP 0
  159. /* CHECKSUM_GEN_TCP==0: Generate checksums by hardware for outgoing TCP packets.*/
  160. #define CHECKSUM_GEN_TCP 0
  161. /* CHECKSUM_CHECK_IP==0: Check checksums by hardware for incoming IP packets.*/
  162. #define CHECKSUM_CHECK_IP 0
  163. /* CHECKSUM_CHECK_UDP==0: Check checksums by hardware for incoming UDP packets.*/
  164. #define CHECKSUM_CHECK_UDP 0
  165. /* CHECKSUM_CHECK_TCP==0: Check checksums by hardware for incoming TCP packets.*/
  166. #define CHECKSUM_CHECK_TCP 0
  167. /* CHECKSUM_CHECK_ICMP==0: Check checksums by hardware for incoming ICMP packets.*/
  168. #define CHECKSUM_GEN_ICMP 0
  169. #else
  170. /* CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP packets.*/
  171. #define CHECKSUM_GEN_IP 1
  172. /* CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets.*/
  173. #define CHECKSUM_GEN_UDP 1
  174. /* CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets.*/
  175. #define CHECKSUM_GEN_TCP 1
  176. /* CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.*/
  177. #define CHECKSUM_CHECK_IP 1
  178. /* CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.*/
  179. #define CHECKSUM_CHECK_UDP 1
  180. /* CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets.*/
  181. #define CHECKSUM_CHECK_TCP 1
  182. /* CHECKSUM_CHECK_ICMP==1: Check checksums by hardware for incoming ICMP packets.*/
  183. #define CHECKSUM_GEN_ICMP 1
  184. #endif
  185. /*
  186. ----------------------------------------------
  187. ---------- Sequential layer options ----------
  188. ----------------------------------------------
  189. */
  190. /**
  191. * LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c)
  192. */
  193. #define LWIP_NETCONN 1
  194. /*
  195. ------------------------------------
  196. ---------- Socket options ----------
  197. ------------------------------------
  198. */
  199. /**
  200. * LWIP_SOCKET==1: Enable Socket API (require to use sockets.c)
  201. */
  202. #define LWIP_SOCKET 1
  203. #define LWIP_DNS 1
  204. #define SO_REUSE 1
  205. /*
  206. -----------------------------------
  207. ---------- DEBUG options ----------
  208. -----------------------------------
  209. */
  210. //#define LWIP_DEBUG
  211. #define TCP_DEBUG LWIP_DBG_OFF
  212. #define ETHARP_DEBUG LWIP_DBG_OFF
  213. #define PBUF_DEBUG LWIP_DBG_OFF
  214. #define IP_DEBUG LWIP_DBG_OFF
  215. #define TCPIP_DEBUG LWIP_DBG_OFF
  216. #define DHCP_DEBUG LWIP_DBG_OFF
  217. #define UDP_DEBUG LWIP_DBG_OFF
  218. #define SOCKETS_DEBUG LWIP_DBG_OFF
  219. #define MEMP_DEBUG LWIP_DBG_OFF
  220. #define PING_DEBUG LWIP_DBG_OFF
  221. #define SNMP_DEBUG LWIP_DBG_OFF
  222. #define SNMP_MIB_DEBUG LWIP_DBG_OFF
  223. #define TIMERS_DEBUG LWIP_DBG_OFF
  224. #define ICMP_DEBUG LWIP_DBG_OFF
  225. /*
  226. ---------------------------------
  227. ---------- OS options ----------
  228. ---------------------------------
  229. */
  230. #define TCPIP_THREAD_STACKSIZE 400
  231. #define TCPIP_MBOX_SIZE 50
  232. #define DEFAULT_UDP_RECVMBOX_SIZE 20
  233. #define DEFAULT_TCP_RECVMBOX_SIZE 70
  234. #define DEFAULT_RAW_RECVMBOX_SIZE 10
  235. #define DEFAULT_ACCEPTMBOX_SIZE 20
  236. #define DEFAULT_THREAD_STACKSIZE 500
  237. #define TCPIP_THREAD_PRIO (configMAX_PRIORITIES - 2)
  238. #define MEMP_NUM_TCPIP_MSG_INPKT 20
  239. /*
  240. -----------------------------------
  241. ----------- HOOK options ----------
  242. -----------------------------------
  243. */
  244. #if defined WHITELIST_ENABLE
  245. #define LWIP_HOOK_FILENAME "lwip_hook_ip4_input.h"
  246. #endif
  247. #define SNMP_SYS_PARAM_FILENAME "snmp_api.h"
  248. #endif /* __LWIPOPTS_H__ */
  249. /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/