lwipopts.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /*!
  2. \file lwipopts.h
  3. \brief LwIP options configuration
  4. */
  5. /*
  6. Copyright (C) 2017 GigaDevice
  7. 2017-07-28, V1.0.0, demo for GD32F30x
  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 (5*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 100 /* 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 500 /* 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. #define TCP_MSS (1500 - 40) /* TCP Maximum segment size,
  46. TCP_MSS = (Ethernet MTU - IP header size - TCP header size) */
  47. #define TCP_SND_BUF (2*TCP_MSS) /* TCP sender buffer space (bytes) */
  48. #define TCP_SND_QUEUELEN ((4* TCP_SND_BUF)/TCP_MSS) /* TCP sender buffer space (pbufs), this must be at least
  49. as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work */
  50. #define TCP_WND (2*TCP_MSS) /* TCP receive window */
  51. /* ICMP options */
  52. #define LWIP_ICMP 1
  53. /* DHCP options */
  54. #define LWIP_DHCP 1 /* define to 1 if you want DHCP configuration of interfaces,
  55. DHCP is not implemented in lwIP 0.5.1, however, so
  56. turning this on does currently not work. */
  57. /* UDP options */
  58. #define LWIP_UDP 1
  59. #define UDP_TTL 255
  60. /* statistics options */
  61. #define LWIP_STATS 0
  62. #define LWIP_PROVIDE_ERRNO 1
  63. /* checksum options */
  64. #define CHECKSUM_BY_HARDWARE /* computing and verifying the IP, UDP, TCP and ICMP
  65. checksums by hardware */
  66. /* sequential layer options */
  67. #define LWIP_NETCONN 1 /* set to 1 to enable netconn API (require to use api_lib.c) */
  68. #define MEMP_NUM_NETCONN 4 /* the number of struct netconns */
  69. /* socket options */
  70. #define LWIP_SOCKET 1 /* set to 1 to enable socket API (require to use sockets.c) */
  71. #define LWIP_SO_RCVTIMEO 1 /* set to 1 to enable receive timeout for sockets/netconns and
  72. SO_RCVTIMEO processing */
  73. /* Lwip debug options */
  74. #define LWIP_DEBUG 1
  75. #ifdef CHECKSUM_BY_HARDWARE
  76. /* CHECKSUM_GEN_IP==0: generate checksums by hardware for outgoing IP packets.*/
  77. #define CHECKSUM_GEN_IP 0
  78. /* CHECKSUM_GEN_UDP==0: generate checksums by hardware for outgoing UDP packets.*/
  79. #define CHECKSUM_GEN_UDP 0
  80. /* CHECKSUM_GEN_TCP==0: generate checksums by hardware for outgoing TCP packets.*/
  81. #define CHECKSUM_GEN_TCP 0
  82. /* CHECKSUM_CHECK_IP==0: check checksums by hardware for incoming IP packets.*/
  83. #define CHECKSUM_CHECK_IP 0
  84. /* CHECKSUM_CHECK_UDP==0: check checksums by hardware for incoming UDP packets.*/
  85. #define CHECKSUM_CHECK_UDP 0
  86. /* CHECKSUM_CHECK_TCP==0: check checksums by hardware for incoming TCP packets.*/
  87. #define CHECKSUM_CHECK_TCP 0
  88. #define CHECKSUM_GEN_ICMP 0
  89. #else
  90. /* CHECKSUM_GEN_IP==1: generate checksums in software for outgoing IP packets.*/
  91. #define CHECKSUM_GEN_IP 1
  92. /* CHECKSUM_GEN_UDP==1: generate checksums in software for outgoing UDP packets.*/
  93. #define CHECKSUM_GEN_UDP 1
  94. /* CHECKSUM_GEN_TCP==1: generate checksums in software for outgoing TCP packets.*/
  95. #define CHECKSUM_GEN_TCP 1
  96. /* CHECKSUM_CHECK_IP==1: check checksums in software for incoming IP packets.*/
  97. #define CHECKSUM_CHECK_IP 1
  98. /* CHECKSUM_CHECK_UDP==1: check checksums in software for incoming UDP packets.*/
  99. #define CHECKSUM_CHECK_UDP 1
  100. /* CHECKSUM_CHECK_TCP==1: check checksums in software for incoming TCP packets.*/
  101. #define CHECKSUM_CHECK_TCP 1
  102. #define CHECKSUM_GEN_ICMP 1
  103. #endif
  104. /*
  105. ---------------------------------
  106. ---------- OS options ----------
  107. ---------------------------------
  108. */
  109. #define TCPIP_THREAD_NAME "TCP/IP"
  110. #define TCPIP_THREAD_STACKSIZE 1000
  111. #define TCPIP_MBOX_SIZE 5
  112. #define DEFAULT_THREAD_STACKSIZE 500
  113. #define TCPIP_THREAD_PRIO (configMAX_PRIORITIES - 2)
  114. #define LWIP_COMPAT_MUTEX 1
  115. #endif /* LWIPOPTS_H */