lwipopts.h 12 KB

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