lwipopts.h 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  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 to be copied, this should be set high. */
  47. #define MEM_SIZE (5*1024)
  48. //#define MEM_SIZE (10*1024)
  49. /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
  50. sends a lot of data out of ROM (or other static memory), this
  51. should be set high. */
  52. //#define MEMP_NUM_PBUF 100
  53. ///#define MEMP_NUM_PBUF 40
  54. #define MEMP_NUM_PBUF 50
  55. /* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
  56. per active UDP "connection". */
  57. #define MEMP_NUM_UDP_PCB 6
  58. /* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
  59. connections. */
  60. #define MEMP_NUM_TCP_PCB 12
  61. //#define MEMP_NUM_TCP_PCB 5
  62. /* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
  63. connections. */
  64. #define MEMP_NUM_TCP_PCB_LISTEN 5
  65. //#define MEMP_NUM_TCP_PCB_LISTEN 15
  66. /* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
  67. segments. */
  68. #define MEMP_NUM_TCP_SEG 25
  69. //#define MEMP_NUM_TCP_SEG 100
  70. /* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
  71. timeouts. */
  72. #define MEMP_NUM_SYS_TIMEOUT 10
  73. //#define MEMP_NUM_SYS_TIMEOUT 100
  74. /* ---------- Pbuf options ---------- */
  75. /* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
  76. //#define PBUF_POOL_SIZE 15
  77. #define PBUF_POOL_SIZE 25
  78. //#define PBUF_POOL_SIZE 18
  79. /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
  80. //#define PBUF_POOL_BUFSIZE 1500
  81. //#define PBUF_POOL_BUFSIZE 3024
  82. #define PBUF_POOL_BUFSIZE 1540
  83. /* ---------- TCP options ---------- */
  84. #define LWIP_TCP 1
  85. #define TCP_TTL 255
  86. /* Controls if TCP should queue segments that arrive out of
  87. order. Define to 0 if your device is low on memory. */
  88. #define TCP_QUEUE_OOSEQ 0
  89. /* TCP Maximum segment size. */
  90. #define TCP_MSS (1500 - 40) /* TCP_MSS = (Ethernet MTU - IP header size - TCP header size) */
  91. /* TCP sender buffer space (bytes). */
  92. //#define TCP_SND_BUF (5*TCP_MSS)
  93. //#define TCP_SND_BUF (18*TCP_MSS)
  94. #define TCP_SND_BUF (18*TCP_MSS)
  95. /* TCP_SND_QUEUELEN: TCP sender buffer space (pbufs). This must be at least
  96. as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work. */
  97. //20
  98. #define TCP_SND_QUEUELEN (4* TCP_SND_BUF/TCP_MSS)
  99. //#define TCP_SND_QUEUELEN (4* TCP_SND_BUF/TCP_MSS)
  100. /* TCP receive window. */
  101. #define TCP_WND (4*TCP_MSS)
  102. /* ---------- ICMP options ---------- */
  103. #define LWIP_ICMP 1
  104. //#define ICMP_TTL 128
  105. /* ---------- DHCP options ---------- */
  106. /* Define LWIP_DHCP to 1 if you want DHCP configuration of
  107. interfaces. DHCP is not implemented in lwIP 0.5.1, however, so
  108. turning this on does currently not work. */
  109. #define LWIP_DHCP 1
  110. // ---------- SNMP options ----------
  111. //#define LWIP_SNMP 1
  112. //#define SNMP_CONCURRENT_REQUESTS 1
  113. //#define SNMP_TRAP_DESTINATIONS 1
  114. //#define SNMP_PRIVATE_MIB 1
  115. //#define SNMP_SAFE_REQUESTS 1
  116. /* ---------- UDP options ---------- */
  117. #define LWIP_UDP 1
  118. #define UDP_TTL 255
  119. #define LWIP_SO_RCVTIMEO 1 // Эта опция необходима для netconn_set_recvtimeout в модуле udp_netsetting.c
  120. /* ---------- Statistics options ---------- */
  121. #define LWIP_STATS 0
  122. #define LWIP_STATS_DISPLAY 0
  123. #define LWIP_PROVIDE_ERRNO 1
  124. #define LWIP_NETIF_LINK_CALLBACK 0
  125. /*
  126. --------------------------------------
  127. ---------- Checksum options ----------
  128. --------------------------------------
  129. */
  130. /*
  131. The STM32F4x7 allows computing and verifying the IP, UDP, TCP and ICMP checksums by hardware:
  132. - To use this feature let the following define uncommented.
  133. - To disable it and process by CPU comment the the checksum.
  134. */
  135. #define CHECKSUM_BY_HARDWARE
  136. #ifdef CHECKSUM_BY_HARDWARE
  137. /* CHECKSUM_GEN_IP==0: Generate checksums by hardware for outgoing IP packets.*/
  138. #define CHECKSUM_GEN_IP 0
  139. /* CHECKSUM_GEN_UDP==0: Generate checksums by hardware for outgoing UDP packets.*/
  140. #define CHECKSUM_GEN_UDP 0
  141. /* CHECKSUM_GEN_TCP==0: Generate checksums by hardware for outgoing TCP packets.*/
  142. #define CHECKSUM_GEN_TCP 0
  143. /* CHECKSUM_CHECK_IP==0: Check checksums by hardware for incoming IP packets.*/
  144. #define CHECKSUM_CHECK_IP 0
  145. /* CHECKSUM_CHECK_UDP==0: Check checksums by hardware for incoming UDP packets.*/
  146. #define CHECKSUM_CHECK_UDP 0
  147. /* CHECKSUM_CHECK_TCP==0: Check checksums by hardware for incoming TCP packets.*/
  148. #define CHECKSUM_CHECK_TCP 0
  149. /* CHECKSUM_CHECK_ICMP==0: Check checksums by hardware for incoming ICMP packets.*/
  150. #define CHECKSUM_GEN_ICMP 0
  151. #else
  152. /* CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP packets.*/
  153. #define CHECKSUM_GEN_IP 1
  154. /* CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets.*/
  155. #define CHECKSUM_GEN_UDP 1
  156. /* CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets.*/
  157. #define CHECKSUM_GEN_TCP 1
  158. /* CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.*/
  159. #define CHECKSUM_CHECK_IP 1
  160. /* CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.*/
  161. #define CHECKSUM_CHECK_UDP 1
  162. /* CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets.*/
  163. #define CHECKSUM_CHECK_TCP 1
  164. /* CHECKSUM_CHECK_ICMP==1: Check checksums by hardware for incoming ICMP packets.*/
  165. #define CHECKSUM_GEN_ICMP 1
  166. #endif
  167. /*
  168. ----------------------------------------------
  169. ---------- Sequential layer options ----------
  170. ----------------------------------------------
  171. */
  172. /**
  173. * LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c)
  174. */
  175. #define LWIP_NETCONN 1
  176. /*
  177. ------------------------------------
  178. ---------- Socket options ----------
  179. ------------------------------------
  180. */
  181. /**
  182. * LWIP_SOCKET==1: Enable Socket API (require to use sockets.c)
  183. */
  184. #define LWIP_SOCKET 1
  185. /*
  186. -----------------------------------
  187. ---------- DEBUG options ----------
  188. -----------------------------------
  189. */
  190. #define LWIP_DEBUG
  191. #define TCP_DEBUG LWIP_DBG_OFF
  192. #define ETHARP_DEBUG LWIP_DBG_OFF
  193. #define PBUF_DEBUG LWIP_DBG_OFF
  194. #define IP_DEBUG LWIP_DBG_OFF
  195. #define TCPIP_DEBUG LWIP_DBG_OFF
  196. #define DHCP_DEBUG LWIP_DBG_OFF
  197. #define UDP_DEBUG LWIP_DBG_OFF
  198. #define SOCKETS_DEBUG LWIP_DBG_OFF
  199. #define MEMP_DEBUG LWIP_DBG_OFF
  200. #define PING_DEBUG LWIP_DBG_OFF
  201. #define SNMP_MSG_DEBUG LWIP_DBG_OFF
  202. #define SNMP_MIB_DEBUG LWIP_DBG_OFF
  203. #define TIMERS_DEBUG LWIP_DBG_OFF
  204. #define ICMP_DEBUG LWIP_DBG_OFF
  205. /*
  206. ---------------------------------
  207. ---------- OS options ----------
  208. ---------------------------------
  209. */
  210. #define TCPIP_THREAD_STACKSIZE 400
  211. #define TCPIP_MBOX_SIZE 50
  212. #define DEFAULT_UDP_RECVMBOX_SIZE 20
  213. #define DEFAULT_TCP_RECVMBOX_SIZE 70
  214. #define DEFAULT_RAW_RECVMBOX_SIZE 10
  215. #define DEFAULT_ACCEPTMBOX_SIZE 20
  216. #define DEFAULT_THREAD_STACKSIZE 500
  217. #define TCPIP_THREAD_PRIO (configMAX_PRIORITIES - 2)
  218. #define MEMP_NUM_TCPIP_MSG_INPKT 20
  219. #endif /* __LWIPOPTS_H__ */
  220. /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/