lwipopts.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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 options */
  38. #define PBUF_POOL_SIZE 20 /* the number of buffers in the pbuf pool */
  39. #define PBUF_POOL_BUFSIZE 512 /* the size of each pbuf in the pbuf pool */
  40. /* TCP options */
  41. #define LWIP_TCP 1
  42. #define TCP_TTL 255
  43. #define TCP_QUEUE_OOSEQ 0 /* controls if TCP should queue segments that arrive out of \
  44. order, Define to 0 if your device is low on memory. */
  45. #undef TCPIP_MBOX_SIZE
  46. #define TCPIP_MBOX_SIZE MAX_QUEUE_ENTRIES /* the mailbox size for the tcpip thread messages */
  47. #undef DEFAULT_TCP_RECVMBOX_SIZE
  48. #define DEFAULT_TCP_RECVMBOX_SIZE MAX_QUEUE_ENTRIES /* the mailbox size for the incoming packets on a NETCONN_TCP */
  49. #undef DEFAULT_ACCEPTMBOX_SIZE /* the mailbox size for the incoming connections */
  50. #define DEFAULT_ACCEPTMBOX_SIZE MAX_QUEUE_ENTRIES
  51. #define DEFAULT_UDP_RECVMBOX_SIZE MAX_QUEUE_ENTRIES /* The mailbox size for the incoming packets on a NETCONN_UDP */
  52. #define TCP_MSS (1500 - 40) /* TCP Maximum segment size, \
  53. TCP_MSS = (Ethernet MTU - IP header size - TCP header size) */
  54. #define TCP_SND_BUF (5 * TCP_MSS) /* TCP sender buffer space (bytes) */
  55. #define TCP_SND_QUEUELEN ((4 * TCP_SND_BUF) / TCP_MSS) /* TCP sender buffer space (pbufs), this must be at least \
  56. as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work */
  57. #define TCP_WND (2 * TCP_MSS) /* TCP receive window */
  58. /* ICMP options */
  59. #define LWIP_ICMP 1
  60. /* DHCP options */
  61. #define LWIP_DHCP 1 /* define to 1 if you want DHCP configuration of interfaces, \
  62. DHCP is not implemented in lwIP 0.5.1, however, so \
  63. turning this on does currently not work. */
  64. #define LWIP_IPV4 1
  65. #define LWIP_IPV6 0
  66. /* UDP options */
  67. #define LWIP_UDP 1
  68. #define UDP_TTL 255
  69. /* statistics options */
  70. #define LWIP_STATS 0
  71. #define LWIP_PROVIDE_ERRNO 1
  72. /* checksum options */
  73. //#define CHECKSUM_BY_HARDWARE /* computing and verifying the IP, UDP, TCP and ICMP
  74. // checksums by hardware */
  75. /* netconn options */
  76. #define LWIP_NETCONN 1 /* set to 1 to enable netconn API (require to use api_lib.c) */
  77. #define MEMP_NUM_NETCONN 4 /* the number of struct netconns */
  78. /* socket options */
  79. #define LWIP_SOCKET 1 /* set to 1 to enable socket API (require to use sockets.c) */
  80. #define LWIP_SO_RCVTIMEO 1 /* set to 1 to enable receive timeout for sockets/netconns and \
  81. SO_RCVTIMEO processing */
  82. /* Lwip debug options */
  83. #define LWIP_DEBUG 0
  84. #ifdef CHECKSUM_BY_HARDWARE
  85. /* CHECKSUM_GEN_IP==0: generate checksums by hardware for outgoing IP packets.*/
  86. #define CHECKSUM_GEN_IP 0
  87. /* CHECKSUM_GEN_UDP==0: generate checksums by hardware for outgoing UDP packets.*/
  88. #define CHECKSUM_GEN_UDP 0
  89. /* CHECKSUM_GEN_TCP==0: generate checksums by hardware for outgoing TCP packets.*/
  90. #define CHECKSUM_GEN_TCP 0
  91. /* CHECKSUM_CHECK_IP==0: check checksums by hardware for incoming IP packets.*/
  92. #define CHECKSUM_CHECK_IP 0
  93. /* CHECKSUM_CHECK_UDP==0: check checksums by hardware for incoming UDP packets.*/
  94. #define CHECKSUM_CHECK_UDP 0
  95. /* CHECKSUM_CHECK_TCP==0: check checksums by hardware for incoming TCP packets.*/
  96. #define CHECKSUM_CHECK_TCP 0
  97. #define CHECKSUM_GEN_ICMP 0
  98. #else
  99. /* CHECKSUM_GEN_IP==1: generate checksums in software for outgoing IP packets.*/
  100. #define CHECKSUM_GEN_IP 1
  101. /* CHECKSUM_GEN_UDP==1: generate checksums in software for outgoing UDP packets.*/
  102. #define CHECKSUM_GEN_UDP 1
  103. /* CHECKSUM_GEN_TCP==1: generate checksums in software for outgoing TCP packets.*/
  104. #define CHECKSUM_GEN_TCP 1
  105. /* CHECKSUM_CHECK_IP==1: check checksums in software for incoming IP packets.*/
  106. #define CHECKSUM_CHECK_IP 1
  107. /* CHECKSUM_CHECK_UDP==1: check checksums in software for incoming UDP packets.*/
  108. #define CHECKSUM_CHECK_UDP 1
  109. /* CHECKSUM_CHECK_TCP==1: check checksums in software for incoming TCP packets.*/
  110. #define CHECKSUM_CHECK_TCP 1
  111. #define CHECKSUM_GEN_ICMP 1
  112. #endif
  113. /*
  114. ---------------------------------
  115. ---------- OS options ----------
  116. ---------------------------------
  117. */
  118. #define TCPIP_THREAD_STACKSIZE 1000
  119. #define DEFAULT_THREAD_STACKSIZE 512
  120. #define LWIP_COMPAT_MUTEX 1
  121. #define TCPIP_THREAD_PRIO 5
  122. #define DEFAULT_THREAD_PRIO 2
  123. #endif /* LWIPOPTS_H */