Advertisement
I3luefir3

lwip 1.4.1 lwipopts.h

Aug 29th, 2017
427
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 9.40 KB | None | 0 0
  1. /**
  2.   ******************************************************************************
  3.   * @file    lwipopts.h
  4.   * @author  MCD Application Team
  5.   * @version V1.1.0
  6.   * @date    31-July-2013
  7.   * @brief   lwIP Options Configuration.
  8.   *          This file is based on Utilities\lwip_v1.4.1\src\include\lwip\opt.h
  9.   *          and contains the lwIP configuration for the STM32F4x7 demonstration.
  10.   ******************************************************************************
  11.   * @attention
  12.   *
  13.   * <h2><center>&copy; COPYRIGHT 2013 STMicroelectronics</center></h2>
  14.   *
  15.   * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
  16.   * You may not use this file except in compliance with the License.
  17.   * You may obtain a copy of the License at:
  18.   *
  19.   *        http://www.st.com/software_license_agreement_liberty_v2
  20.   *
  21.   * Unless required by applicable law or agreed to in writing, software
  22.   * distributed under the License is distributed on an "AS IS" BASIS,
  23.   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  24.   * See the License for the specific language governing permissions and
  25.   * limitations under the License.
  26.   *
  27.   ******************************************************************************
  28.   */
  29.  
  30. #ifndef __LWIPOPTS_H__
  31. #define __LWIPOPTS_H__
  32.  
  33. #define LWIP_NETIF_HOSTNAME 1
  34.  
  35. #define LWIP_TCP_KEEPALIVE 1
  36.  
  37. /**
  38.  * SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection for certain
  39.  * critical regions during buffer allocation, deallocation and memory
  40.  * allocation and deallocation.
  41.  */
  42. #define SYS_LIGHTWEIGHT_PROT    1
  43.  
  44. #define ETHARP_TRUST_IP_MAC     0
  45. #define IP_REASSEMBLY           1
  46. #define IP_FRAG                 1
  47. #define ARP_QUEUEING            1
  48. #define TCP_LISTEN_BACKLOG      0
  49.  
  50. /**
  51.  * NO_SYS==1: Provides VERY minimal functionality. Otherwise,
  52.  * use lwIP facilities.
  53.  */
  54. #define NO_SYS                  0
  55.  
  56. #define LWIP_ARP                1
  57.  
  58. /* ---------- Memory options ---------- */
  59. /* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
  60.    lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
  61.    byte alignment -> define MEM_ALIGNMENT to 2. */
  62. #define MEM_ALIGNMENT           4
  63.  
  64. /* MEM_SIZE: the size of the heap memory. If the application will send
  65. a lot of data that needs to be copied, this should be set high. */
  66. #define MEM_SIZE                (20*1024)
  67.  
  68. /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
  69.    sends a lot of data out of ROM (or other static memory), this
  70.    should be set high. */
  71. #define MEMP_NUM_PBUF           30
  72. /* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
  73.    per active UDP "connection". */
  74. #define MEMP_NUM_UDP_PCB        5
  75. /* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
  76.    connections. */
  77. #define MEMP_NUM_TCP_PCB        25
  78. /* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
  79.    connections. */
  80. #define MEMP_NUM_TCP_PCB_LISTEN 15
  81. /* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
  82.    segments. */
  83. #define MEMP_NUM_TCP_SEG        20
  84. /* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
  85.    timeouts. */
  86. #define MEMP_NUM_SYS_TIMEOUT    30
  87.  
  88. #define MEMP_NUM_NETCONN        16
  89.  
  90.  
  91. /* ---------- Pbuf options ---------- */
  92. /* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
  93. #define PBUF_POOL_SIZE          256//60
  94.  
  95. /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
  96. #define PBUF_POOL_BUFSIZE       256//250
  97.  
  98.  
  99. /* ---------- TCP options ---------- */
  100. #define LWIP_TCP                1
  101. #define TCP_TTL                 255
  102.  
  103. /* Controls if TCP should queue segments that arrive out of
  104.    order. Define to 0 if your device is low on memory. */
  105. #define TCP_QUEUE_OOSEQ         0
  106.  
  107. /* TCP Maximum segment size. */
  108. #define TCP_MSS                 (750 - 40)    /* TCP_MSS = (Ethernet MTU - IP header size - TCP header size) */
  109.  
  110. /* TCP sender buffer space (bytes). */
  111. #define TCP_SND_BUF             (4*TCP_MSS)  // LAP: orig 2*
  112.  
  113. /*  TCP_SND_QUEUELEN: TCP sender buffer space (pbufs). This must be at least
  114.   as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work. */
  115.  
  116. #define TCP_SND_QUEUELEN        (4* TCP_SND_BUF/TCP_MSS)
  117.  
  118. /* TCP receive window. */
  119. #define TCP_WND                 (4*TCP_MSS)
  120.  
  121.  
  122. /* ---------- ICMP options ---------- */
  123. #define LWIP_ICMP                       1
  124.  
  125.  
  126. /* ---------- DHCP options ---------- */
  127. /* Define LWIP_DHCP to 1 if you want DHCP configuration of
  128.    interfaces. DHCP is not implemented in lwIP 0.5.1, however, so
  129.    turning this on does currently not work. */
  130. #define LWIP_DHCP               1
  131. #define DHCP_DOES_ARP_CHECK     1
  132.  
  133.  
  134. /* ---------- UDP options ---------- */
  135. #define LWIP_UDP                1
  136. #define UDP_TTL                 255
  137.  
  138.  
  139. /* ---------- Statistics options ---------- */
  140. #define LWIP_STATS 0/*1
  141. #define LWIP_STATS_DISPLAY 1
  142. #define MEMP_STATS 1
  143. #define MEM_STATS 1*/
  144. #define LWIP_PROVIDE_ERRNO 1
  145.  
  146. /* ---------- link callback options ---------- */
  147. /* LWIP_NETIF_LINK_CALLBACK==1: Support a callback function from an interface
  148.  * whenever the link changes (i.e., link down)
  149.  */
  150. #define LWIP_NETIF_LINK_CALLBACK        0
  151.  
  152. /*
  153.    --------------------------------------
  154.    ---------- Checksum options ----------
  155.    --------------------------------------
  156. */
  157.  
  158. /*
  159. The STM32F4x7 allows computing and verifying the IP, UDP, TCP and ICMP checksums by hardware:
  160.  - To use this feature let the following define uncommented.
  161.  - To disable it and process by CPU comment the  the checksum.
  162. */
  163. #define CHECKSUM_BY_HARDWARE
  164.  
  165.  
  166. #ifdef CHECKSUM_BY_HARDWARE
  167.   /* CHECKSUM_GEN_IP==0: Generate checksums by hardware for outgoing IP packets.*/
  168.   #define CHECKSUM_GEN_IP                 0
  169.   /* CHECKSUM_GEN_UDP==0: Generate checksums by hardware for outgoing UDP packets.*/
  170.   #define CHECKSUM_GEN_UDP                0
  171.   /* CHECKSUM_GEN_TCP==0: Generate checksums by hardware for outgoing TCP packets.*/
  172.   #define CHECKSUM_GEN_TCP                0
  173.   /* CHECKSUM_CHECK_IP==0: Check checksums by hardware for incoming IP packets.*/
  174.   #define CHECKSUM_CHECK_IP               0
  175.   /* CHECKSUM_CHECK_UDP==0: Check checksums by hardware for incoming UDP packets.*/
  176.   #define CHECKSUM_CHECK_UDP              0
  177.   /* CHECKSUM_CHECK_TCP==0: Check checksums by hardware for incoming TCP packets.*/
  178.   #define CHECKSUM_CHECK_TCP              0
  179.   /* CHECKSUM_CHECK_ICMP==0: Check checksums by hardware for incoming ICMP packets.*/
  180.   #define CHECKSUM_GEN_ICMP               0
  181. #else
  182.   /* CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP packets.*/
  183.   #define CHECKSUM_GEN_IP                 1
  184.   /* CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets.*/
  185.   #define CHECKSUM_GEN_UDP                1
  186.   /* CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets.*/
  187.   #define CHECKSUM_GEN_TCP                1
  188.   /* CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.*/
  189.   #define CHECKSUM_CHECK_IP               1
  190.   /* CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.*/
  191.   #define CHECKSUM_CHECK_UDP              1
  192.   /* CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets.*/
  193.   #define CHECKSUM_CHECK_TCP              1
  194.   /* CHECKSUM_CHECK_ICMP==1: Check checksums by hardware for incoming ICMP packets.*/
  195.   #define CHECKSUM_GEN_ICMP               1
  196. #endif
  197.  
  198.  
  199. /*
  200.    ----------------------------------------------
  201.    ---------- Sequential layer options ----------
  202.    ----------------------------------------------
  203. */
  204. /**
  205.  * LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c)
  206.  */
  207. #define LWIP_NETCONN                    1
  208.  
  209. /*
  210.    ------------------------------------
  211.    ---------- Socket options ----------
  212.    ------------------------------------
  213. */
  214. /**
  215.  * LWIP_SOCKET==1: Enable Socket API (require to use sockets.c)
  216.  */
  217. #define LWIP_SOCKET                     1
  218. #define LWIP_SO_RCVTIMEO                1
  219.  
  220. /*
  221.    -----------------------------------
  222.    ---------- DEBUG options ----------
  223.    -----------------------------------
  224. */
  225.  
  226. #define LWIP_DEBUG                      1
  227.  
  228. #define TCP_DEBUG                       LWIP_DBG_ON
  229. #define ICMP_DEBUG                      LWIP_DBG_OFF
  230. #define ETHARP_DEBUG                    LWIP_DBG_OFF
  231. #define PBUF_DEBUG                      LWIP_DBG_OFF
  232. #define IP_DEBUG                        LWIP_DBG_OFF
  233. #define TCPIP_DEBUG                     LWIP_DBG_OFF
  234. #define DHCP_DEBUG                      LWIP_DBG_OFF
  235. #define UDP_DEBUG                       LWIP_DBG_OFF
  236. #define SOCKETS_DEBUG                   LWIP_DBG_OFF
  237. #define NETIF_DEBUG                     LWIP_DBG_OFF
  238. #define PING_DEBUG                      LWIP_DBG_OFF
  239. #define RAW_DEBUG                       LWIP_DBG_OFF
  240. #define API_LIB_DEBUG                   LWIP_DBG_OFF
  241. #define LWIP_DBG_TYPES_ON               LWIP_DBG_ON
  242. #define LWIP_DBG_MIN_LEVEL              LWIP_DBG_LEVEL_OFF
  243.  
  244. extern void _sys_debug(const char *fmt, ...);
  245.  
  246. #define LWIP_PLATFORM_DIAG(x) do {_sys_debug x;} while(0)
  247.  
  248. /*
  249.    ---------------------------------
  250.    ---------- OS options ----------
  251.    ---------------------------------
  252. */
  253.  
  254. #define TCPIP_THREAD_NAME              "TCP/IP"
  255. #define TCPIP_THREAD_STACKSIZE          1024
  256. #define TCPIP_MBOX_SIZE                 0
  257. #define DEFAULT_UDP_RECVMBOX_SIZE       512
  258. #define DEFAULT_TCP_RECVMBOX_SIZE       4096
  259. #define DEFAULT_ACCEPTMBOX_SIZE         4096
  260. #define DEFAULT_THREAD_STACKSIZE        1024
  261. #define TCPIP_THREAD_PRIO               ( tskIDLE_PRIORITY + 4 )
  262. #define LWIP_COMPAT_MUTEX               1
  263.  
  264.  
  265.  
  266. #endif /* __LWIPOPTS_H__ */
  267.  
  268. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement