lwipopts.h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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 0
  31. /**
  32. * NO_SYS==1: Provides VERY minimal functionality. Otherwise,
  33. * use lwIP facilities.
  34. */
  35. #define NO_SYS 1
  36. /* ---------- Memory options ---------- */
  37. /* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
  38. lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
  39. byte alignment -> define MEM_ALIGNMENT to 2. */
  40. #define MEM_ALIGNMENT 4
  41. /* MEM_SIZE: the size of the heap memory. If the application will send
  42. a lot of data that needs to be copied, this should be set high. */
  43. #define MEM_SIZE (5*1024)
  44. //#define MEM_SIZE (10*1024)
  45. /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
  46. sends a lot of data out of ROM (or other static memory), this
  47. should be set high. */
  48. //#define MEMP_NUM_PBUF 100
  49. ///#define MEMP_NUM_PBUF 40
  50. #define MEMP_NUM_PBUF 50
  51. /* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
  52. per active UDP "connection". */
  53. #define MEMP_NUM_UDP_PCB 6
  54. /* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
  55. connections. */
  56. #define MEMP_NUM_TCP_PCB 10
  57. //#define MEMP_NUM_TCP_PCB 5
  58. /* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
  59. connections. */
  60. #define MEMP_NUM_TCP_PCB_LISTEN 5
  61. //#define MEMP_NUM_TCP_PCB_LISTEN 15
  62. /* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
  63. segments. */
  64. #define MEMP_NUM_TCP_SEG 25
  65. //#define MEMP_NUM_TCP_SEG 100
  66. /* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
  67. timeouts. */
  68. #define MEMP_NUM_SYS_TIMEOUT 10
  69. //#define MEMP_NUM_SYS_TIMEOUT 100
  70. //#define MEMP_NUM_RAW_PCB 20
  71. /* ---------- Pbuf options ---------- */
  72. /* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
  73. #define PBUF_POOL_SIZE 15
  74. //#define PBUF_POOL_SIZE 25
  75. //#define PBUF_POOL_SIZE 18
  76. /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
  77. //#define PBUF_POOL_BUFSIZE 1500
  78. //#define PBUF_POOL_BUFSIZE 3024
  79. #define PBUF_POOL_BUFSIZE 1540
  80. /* ---------- TCP options ---------- */
  81. #define LWIP_TCP 1
  82. #define TCP_TTL 255
  83. /* Controls if TCP should queue segments that arrive out of
  84. order. Define to 0 if your device is low on memory. */
  85. #define TCP_QUEUE_OOSEQ 0
  86. /* TCP Maximum segment size. */
  87. #define TCP_MSS (1500 - 40) /* TCP_MSS = (Ethernet MTU - IP header size - TCP header size) */
  88. /* TCP sender buffer space (bytes). */
  89. //#define TCP_SND_BUF (5*TCP_MSS)
  90. //#define TCP_SND_BUF (18*TCP_MSS)
  91. #define TCP_SND_BUF (6*TCP_MSS)
  92. /* TCP_SND_QUEUELEN: TCP sender buffer space (pbufs). This must be at least
  93. as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work. */
  94. //20
  95. #define TCP_SND_QUEUELEN (4* TCP_SND_BUF/TCP_MSS)
  96. //#define TCP_SND_QUEUELEN (4* TCP_SND_BUF/TCP_MSS)
  97. /* TCP receive window. */
  98. #define TCP_WND (1*TCP_MSS)
  99. /* ---------- ICMP options ---------- */
  100. #define LWIP_ICMP 1
  101. //#define ICMP_TTL 128
  102. /* ---------- DHCP options ---------- */
  103. /* Define LWIP_DHCP to 1 if you want DHCP configuration of
  104. interfaces. DHCP is not implemented in lwIP 0.5.1, however, so
  105. turning this on does currently not work. */
  106. #define LWIP_DHCP 1
  107. /* ---------- UDP options ---------- */
  108. #define LWIP_UDP 1
  109. #define UDP_TTL 255
  110. /* ---------- Statistics options ---------- */
  111. #define LWIP_STATS 1
  112. #define LWIP_PROVIDE_ERRNO 1
  113. /*
  114. --------------------------------------
  115. ---------- Checksum options ----------
  116. --------------------------------------
  117. */
  118. /*
  119. The STM32F4x7 allows computing and verifying the IP, UDP, TCP and ICMP checksums by hardware:
  120. - To use this feature let the following define uncommented.
  121. - To disable it and process by CPU comment the the checksum.
  122. */
  123. #define CHECKSUM_BY_HARDWARE
  124. #ifdef CHECKSUM_BY_HARDWARE
  125. /* CHECKSUM_GEN_IP==0: Generate checksums by hardware for outgoing IP packets.*/
  126. #define CHECKSUM_GEN_IP 0
  127. /* CHECKSUM_GEN_UDP==0: Generate checksums by hardware for outgoing UDP packets.*/
  128. #define CHECKSUM_GEN_UDP 0
  129. /* CHECKSUM_GEN_TCP==0: Generate checksums by hardware for outgoing TCP packets.*/
  130. #define CHECKSUM_GEN_TCP 0
  131. /* CHECKSUM_CHECK_IP==0: Check checksums by hardware for incoming IP packets.*/
  132. #define CHECKSUM_CHECK_IP 0
  133. /* CHECKSUM_CHECK_UDP==0: Check checksums by hardware for incoming UDP packets.*/
  134. #define CHECKSUM_CHECK_UDP 0
  135. /* CHECKSUM_CHECK_TCP==0: Check checksums by hardware for incoming TCP packets.*/
  136. #define CHECKSUM_CHECK_TCP 0
  137. #else
  138. /* CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP packets.*/
  139. #define CHECKSUM_GEN_IP 1
  140. /* CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets.*/
  141. #define CHECKSUM_GEN_UDP 1
  142. /* CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets.*/
  143. #define CHECKSUM_GEN_TCP 1
  144. /* CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.*/
  145. #define CHECKSUM_CHECK_IP 1
  146. /* CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.*/
  147. #define CHECKSUM_CHECK_UDP 1
  148. /* CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets.*/
  149. #define CHECKSUM_CHECK_TCP 1
  150. #endif
  151. /*
  152. ----------------------------------------------
  153. ---------- Sequential layer options ----------
  154. ----------------------------------------------
  155. */
  156. /**
  157. * LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c)
  158. */
  159. #define LWIP_NETCONN 0
  160. /*
  161. ------------------------------------
  162. ---------- Socket options ----------
  163. ------------------------------------
  164. */
  165. /**
  166. * LWIP_SOCKET==1: Enable Socket API (require to use sockets.c)
  167. */
  168. #define LWIP_SOCKET 0
  169. /*
  170. -----------------------------------
  171. ---------- DEBUG options ----------
  172. -----------------------------------
  173. */
  174. //#define LWIP_DEBUG
  175. #define NETIF_DEBUG LWIP_DBG_OFF
  176. #define TCP_DEBUG LWIP_DBG_ON
  177. #define ETHARP_DEBUG LWIP_DBG_OFF
  178. #define PBUF_DEBUG LWIP_DBG_OFF
  179. #define IP_DEBUG LWIP_DBG_OFF
  180. #define TCPIP_DEBUG LWIP_DBG_ON
  181. #define DHCP_DEBUG LWIP_DBG_ON
  182. #define UDP_DEBUG LWIP_DBG_OFF
  183. #define SOCKETS_DEBUG LWIP_DBG_ON
  184. #define MEMP_DEBUG LWIP_DBG_ON
  185. #define MEM_DEBUG LWIP_DBG_ON
  186. #define PING_DEBUG LWIP_DBG_OFF
  187. #define SNMP_MSG_DEBUG LWIP_DBG_OFF
  188. #define SNMP_MIB_DEBUG LWIP_DBG_OFF
  189. #define RAW_DEBUG LWIP_DBG_ON
  190. #endif /* __LWIPOPTS_H__ */
  191. /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/