lwipopts.h 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. /**
  2. ******************************************************************************
  3. * @file LwIP/LwIP_HTTP_Server_Socket_RTOS/Inc/lwipopts.h
  4. * @author MCD Application Team
  5. * @brief lwIP Options Configuration.
  6. * This file is based on Utilities\lwip_v1.4.1\src\include\lwip\opt.h
  7. * and contains the lwIP configuration for the STM32F2x7 demonstration.
  8. ******************************************************************************
  9. * @attention
  10. *
  11. * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
  12. * All rights reserved.</center></h2>
  13. *
  14. * This software component is licensed by ST under BSD 3-Clause license,
  15. * the "License"; You may not use this file except in compliance with the
  16. * License. You may obtain a copy of the License at:
  17. * opensource.org/licenses/BSD-3-Clause
  18. *
  19. ******************************************************************************
  20. */
  21. #ifndef __LWIPOPTS_H__
  22. #define __LWIPOPTS_H__
  23. /**
  24. * NO_SYS==1: Provides VERY minimal functionality. Otherwise,
  25. * use lwIP facilities.
  26. */
  27. #define NO_SYS 0
  28. /* ---------- Memory options ---------- */
  29. /* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
  30. lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
  31. byte alignment -> define MEM_ALIGNMENT to 2. */
  32. #define MEM_ALIGNMENT 4
  33. /* MEM_SIZE: the size of the heap memory. If the application will send
  34. a lot of data that needs to be copied, this should be set high. */
  35. #define MEM_SIZE (10*1024)
  36. /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
  37. sends a lot of data out of ROM (or other static memory), this
  38. should be set high. */
  39. #define MEMP_NUM_PBUF 10
  40. /* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
  41. per active UDP "connection". */
  42. #define MEMP_NUM_UDP_PCB 6
  43. /* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
  44. connections. */
  45. #define MEMP_NUM_TCP_PCB 10
  46. /* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
  47. connections. */
  48. #define MEMP_NUM_TCP_PCB_LISTEN 5
  49. /* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
  50. segments. */
  51. #define MEMP_NUM_TCP_SEG 12
  52. /* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
  53. timeouts. */
  54. #define MEMP_NUM_SYS_TIMEOUT 10
  55. /* ---------- Pbuf options ---------- */
  56. /* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
  57. #define PBUF_POOL_SIZE 8
  58. /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
  59. #define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN)
  60. /* ---------- TCP options ---------- */
  61. #define LWIP_TCP 1
  62. #define TCP_TTL 255
  63. /* Controls if TCP should queue segments that arrive out of
  64. order. Define to 0 if your device is low on memory. */
  65. #define TCP_QUEUE_OOSEQ 0
  66. /* TCP Maximum segment size. */
  67. #define TCP_MSS (1500 - 40) /* TCP_MSS = (Ethernet MTU - IP header size - TCP header size) */
  68. /* TCP sender buffer space (bytes). */
  69. #define TCP_SND_BUF (4*TCP_MSS)
  70. /* TCP_SND_QUEUELEN: TCP sender buffer space (pbufs). This must be at least
  71. as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work. */
  72. #define TCP_SND_QUEUELEN (2* TCP_SND_BUF/TCP_MSS)
  73. /* TCP receive window. */
  74. #define TCP_WND (2*TCP_MSS)
  75. /* ---------- ICMP options ---------- */
  76. #define LWIP_ICMP 1
  77. /* ---------- DHCP options ---------- */
  78. #define LWIP_DHCP 1
  79. /* ---------- UDP options ---------- */
  80. #define LWIP_UDP 1
  81. #define UDP_TTL 255
  82. /* ---------- Statistics options ---------- */
  83. #define LWIP_STATS 0
  84. /* ---------- link callback options ---------- */
  85. /* LWIP_NETIF_LINK_CALLBACK==1: Support a callback function from an interface
  86. * whenever the link changes (i.e., link down)
  87. */
  88. #define LWIP_NETIF_LINK_CALLBACK 1
  89. /*
  90. --------------------------------------
  91. ---------- Checksum options ----------
  92. --------------------------------------
  93. */
  94. /*
  95. The STM32F2x7 allows computing and verifying the IP, UDP, TCP and ICMP checksums by hardware:
  96. - To use this feature let the following define uncommented.
  97. - To disable it and process by CPU comment the the checksum.
  98. */
  99. #define CHECKSUM_BY_HARDWARE
  100. #ifdef CHECKSUM_BY_HARDWARE
  101. /* CHECKSUM_GEN_IP==0: Generate checksums by hardware for outgoing IP packets.*/
  102. #define CHECKSUM_GEN_IP 0
  103. /* CHECKSUM_GEN_UDP==0: Generate checksums by hardware for outgoing UDP packets.*/
  104. #define CHECKSUM_GEN_UDP 0
  105. /* CHECKSUM_GEN_TCP==0: Generate checksums by hardware for outgoing TCP packets.*/
  106. #define CHECKSUM_GEN_TCP 0
  107. /* CHECKSUM_CHECK_IP==0: Check checksums by hardware for incoming IP packets.*/
  108. #define CHECKSUM_CHECK_IP 0
  109. /* CHECKSUM_CHECK_UDP==0: Check checksums by hardware for incoming UDP packets.*/
  110. #define CHECKSUM_CHECK_UDP 0
  111. /* CHECKSUM_CHECK_TCP==0: Check checksums by hardware for incoming TCP packets.*/
  112. #define CHECKSUM_CHECK_TCP 0
  113. /* CHECKSUM_CHECK_ICMP==0: Check checksums by hardware for incoming ICMP packets.*/
  114. #define CHECKSUM_GEN_ICMP 0
  115. #else
  116. /* CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP packets.*/
  117. #define CHECKSUM_GEN_IP 1
  118. /* CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets.*/
  119. #define CHECKSUM_GEN_UDP 1
  120. /* CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets.*/
  121. #define CHECKSUM_GEN_TCP 1
  122. /* CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.*/
  123. #define CHECKSUM_CHECK_IP 1
  124. /* CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.*/
  125. #define CHECKSUM_CHECK_UDP 1
  126. /* CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets.*/
  127. #define CHECKSUM_CHECK_TCP 1
  128. /* CHECKSUM_CHECK_ICMP==1: Check checksums by hardware for incoming ICMP packets.*/
  129. #define CHECKSUM_GEN_ICMP 1
  130. #endif
  131. /*
  132. ----------------------------------------------
  133. ---------- Sequential layer options ----------
  134. ----------------------------------------------
  135. */
  136. /**
  137. * LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c)
  138. */
  139. #define LWIP_NETCONN 1
  140. /*
  141. ------------------------------------
  142. ---------- Socket options ----------
  143. ------------------------------------
  144. */
  145. /**
  146. * LWIP_SOCKET==1: Enable Socket API (require to use sockets.c)
  147. */
  148. #define LWIP_SOCKET 1
  149. /*
  150. ------------------------------------
  151. ---------- httpd options ----------
  152. ------------------------------------
  153. */
  154. /** Set this to 1 to include "fsdata_custom.c" instead of "fsdata.c" for the
  155. * file system (to prevent changing the file included in CVS) */
  156. #define HTTPD_USE_CUSTOM_FSDATA 1
  157. /*
  158. ---------------------------------
  159. ---------- OS options ----------
  160. ---------------------------------
  161. */
  162. #define TCPIP_THREAD_NAME "TCP/IP"
  163. #define TCPIP_THREAD_STACKSIZE 1000
  164. #define TCPIP_MBOX_SIZE 6
  165. #define DEFAULT_UDP_RECVMBOX_SIZE 6
  166. #define DEFAULT_TCP_RECVMBOX_SIZE 6
  167. #define DEFAULT_ACCEPTMBOX_SIZE 6
  168. #define DEFAULT_THREAD_STACKSIZE 500
  169. #define TCPIP_THREAD_PRIO osPriorityHigh
  170. #endif /* __LWIPOPTS_H__ */
  171. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/