lwipopts.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /*!
  2. \file lwipopts.h
  3. \brief LwIP options configuration
  4. */
  5. /*
  6. Copyright (C) 2016 GigaDevice
  7. 2016-08-15, V1.0.0, firmware for GD32F4xx
  8. */
  9. #ifndef LWIPOPTS_H
  10. #define LWIPOPTS_H
  11. #define ETHARP_TRUST_IP_MAC 0
  12. #define IP_REASSEMBLY 0
  13. #define IP_FRAG 0
  14. #define ARP_QUEUEING 0
  15. #define SYS_LIGHTWEIGHT_PROT 1 /* SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection \
  16. for certain critical regions during buffer allocation, \
  17. deallocation and memory allocation and deallocation */
  18. #define NO_SYS 0 /* NO_SYS==1: provides VERY minimal functionality. \
  19. Otherwise, use lwIP facilities */
  20. /* memory options */
  21. #define MEM_ALIGNMENT 4 /* should be set to the alignment of the CPU for which lwIP \
  22. is compiled. 4 byte alignment -> define MEM_ALIGNMENT \
  23. to 4, 2 byte alignment -> define MEM_ALIGNMENT to 2 */
  24. #define MEM_SIZE (12 * 1024) /* the size of the heap memory, if the application will \
  25. send a lot of data that needs to be copied, this should \
  26. be set high */
  27. #define MEMP_NUM_PBUF 20 /* the number of memp struct pbufs. If the application \
  28. sends a lot of data out of ROM (or other static memory), \
  29. this should be set high */
  30. #define MEMP_NUM_UDP_PCB 6 /* the number of UDP protocol control blocks, one \
  31. per active UDP "connection" */
  32. #define MEMP_NUM_TCP_PCB 10 /* the number of simulatenously active TCP connections */
  33. #define MEMP_NUM_TCP_PCB_LISTEN 5 /* the number of listening TCP connections */
  34. #define MEMP_NUM_TCP_SEG 20 /* the number of simultaneously queued TCP segments */
  35. #define MEMP_NUM_SYS_TIMEOUT 10 /* the number of simulateously active timeouts */
  36. #define MEMP_NUM_NETBUF 8 /* the number of struct netbufs */
  37. /* ---------- pbuf选项 ---------- */
  38. #define MEMP_NUM_PBUF 15 /* MEMP_NUM_PBUF:memp结构的pbuf数量,如果应用从ROM或者静态存储区发送大量数据时,这个值应该设置大一点 */
  39. #define PBUF_POOL_SIZE 15 /* PBUF_POOL_SIZE:pbuf内存池个数 */
  40. #define PBUF_POOL_BUFSIZE 1528 /* PBUF_POOL_BUFSIZE:每个pbuf内存池大小 */
  41. #define LWIP_SUPPORT_CUSTOM_PBUF 1
  42. /* TCP options */
  43. #define LWIP_TCP 1
  44. #define TCP_TTL 255
  45. #define TCP_QUEUE_OOSEQ 0 /* controls if TCP should queue segments that arrive out of \
  46. order, Define to 0 if your device is low on memory. */
  47. #undef TCPIP_MBOX_SIZE
  48. #define TCPIP_MBOX_SIZE MAX_QUEUE_ENTRIES /* the mailbox size for the tcpip thread messages */
  49. #undef DEFAULT_TCP_RECVMBOX_SIZE
  50. #define DEFAULT_TCP_RECVMBOX_SIZE MAX_QUEUE_ENTRIES /* the mailbox size for the incoming packets on a NETCONN_TCP */
  51. #undef DEFAULT_ACCEPTMBOX_SIZE /* the mailbox size for the incoming connections */
  52. #define DEFAULT_ACCEPTMBOX_SIZE MAX_QUEUE_ENTRIES
  53. #define DEFAULT_UDP_RECVMBOX_SIZE MAX_QUEUE_ENTRIES /* The mailbox size for the incoming packets on a NETCONN_UDP */
  54. #define TCP_MSS (1500 - 40) /* TCP Maximum segment size, \
  55. TCP_MSS = (Ethernet MTU - IP header size - TCP header size) */
  56. #define TCP_SND_BUF (5 * TCP_MSS) /* TCP sender buffer space (bytes) */
  57. #define TCP_SND_QUEUELEN ((4 * TCP_SND_BUF) / TCP_MSS) /* TCP sender buffer space (pbufs), this must be at least \
  58. as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work */
  59. #define TCP_WND (2 * TCP_MSS) /* TCP receive window */
  60. /* ICMP options */
  61. #define LWIP_ICMP 1
  62. /* DHCP options */
  63. #define LWIP_DHCP 0 /* define to 1 if you want DHCP configuration of interfaces, \
  64. DHCP is not implemented in lwIP 0.5.1, however, so \
  65. turning this on does currently not work. */
  66. #define LWIP_IPV4 1
  67. #define LWIP_IPV6 0
  68. /* UDP options */
  69. #define LWIP_UDP 1
  70. #define UDP_TTL 255
  71. /* statistics options */
  72. #define LWIP_STATS 0
  73. #define LWIP_PROVIDE_ERRNO 1
  74. /* checksum options */
  75. #define CHECKSUM_BY_HARDWARE /* computing and verifying the IP, UDP, TCP and ICMP \
  76. checksums by hardware */
  77. /* netconn options */
  78. #define LWIP_NETCONN 1 /* set to 1 to enable netconn API (require to use api_lib.c) */
  79. #define MEMP_NUM_NETCONN 4 /* the number of struct netconns */
  80. /* socket options */
  81. #define LWIP_SOCKET 1 /* set to 1 to enable socket API (require to use sockets.c) */
  82. #define LWIP_SO_RCVTIMEO 1 /* set to 1 to enable receive timeout for sockets/netconns and \
  83. SO_RCVTIMEO processing */
  84. #define LWIP_NETIF_LINK_CALLBACK 1
  85. /* Lwip debug options */
  86. #define LWIP_DEBUG 0
  87. #ifdef CHECKSUM_BY_HARDWARE
  88. /* CHECKSUM_GEN_IP==0: generate checksums by hardware for outgoing IP packets.*/
  89. #define CHECKSUM_GEN_IP 0
  90. /* CHECKSUM_GEN_UDP==0: generate checksums by hardware for outgoing UDP packets.*/
  91. #define CHECKSUM_GEN_UDP 0
  92. /* CHECKSUM_GEN_TCP==0: generate checksums by hardware for outgoing TCP packets.*/
  93. #define CHECKSUM_GEN_TCP 0
  94. /* CHECKSUM_CHECK_IP==0: check checksums by hardware for incoming IP packets.*/
  95. #define CHECKSUM_CHECK_IP 0
  96. /* CHECKSUM_CHECK_UDP==0: check checksums by hardware for incoming UDP packets.*/
  97. #define CHECKSUM_CHECK_UDP 0
  98. /* CHECKSUM_CHECK_TCP==0: check checksums by hardware for incoming TCP packets.*/
  99. #define CHECKSUM_CHECK_TCP 0
  100. #define CHECKSUM_GEN_ICMP 0
  101. #else
  102. /* CHECKSUM_GEN_IP==1: generate checksums in software for outgoing IP packets.*/
  103. #define CHECKSUM_GEN_IP 1
  104. /* CHECKSUM_GEN_UDP==1: generate checksums in software for outgoing UDP packets.*/
  105. #define CHECKSUM_GEN_UDP 1
  106. /* CHECKSUM_GEN_TCP==1: generate checksums in software for outgoing TCP packets.*/
  107. #define CHECKSUM_GEN_TCP 1
  108. /* CHECKSUM_CHECK_IP==1: check checksums in software for incoming IP packets.*/
  109. #define CHECKSUM_CHECK_IP 1
  110. /* CHECKSUM_CHECK_UDP==1: check checksums in software for incoming UDP packets.*/
  111. #define CHECKSUM_CHECK_UDP 1
  112. /* CHECKSUM_CHECK_TCP==1: check checksums in software for incoming TCP packets.*/
  113. #define CHECKSUM_CHECK_TCP 1
  114. #define CHECKSUM_GEN_ICMP 1
  115. #endif
  116. /*
  117. ---------------------------------
  118. ---------- OS options ----------
  119. ---------------------------------
  120. */
  121. #define TCPIP_THREAD_STACKSIZE 1000
  122. #define DEFAULT_THREAD_STACKSIZE 512
  123. #define LWIP_COMPAT_MUTEX 1
  124. #define TCPIP_THREAD_PRIO 5
  125. #define DEFAULT_THREAD_PRIO 2
  126. #endif /* LWIPOPTS_H */