Gleb Klochkov / Mbed OS Climatcontroll_Main

Dependencies:   esp8266-driver

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers lwipopts.h Source File

lwipopts.h

00001 /* Copyright (C) 2012 mbed.org, MIT License
00002  *
00003  * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
00004  * and associated documentation files (the "Software"), to deal in the Software without restriction,
00005  * including without limitation the rights to use, copy, modify, merge, publish, distribute,
00006  * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
00007  * furnished to do so, subject to the following conditions:
00008  *
00009  * The above copyright notice and this permission notice shall be included in all copies or
00010  * substantial portions of the Software.
00011  *
00012  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
00013  * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00014  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
00015  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00016  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00017  */
00018 
00019 #ifndef LWIPOPTS_H
00020 #define LWIPOPTS_H
00021 
00022 #if MBED_CONF_LWIP_ETHERNET_ENABLED
00023 #include "lwipopts_conf.h"
00024 #endif
00025 
00026 // Workaround for Linux timeval
00027 #if defined (TOOLCHAIN_GCC)
00028 #define LWIP_TIMEVAL_PRIVATE 0
00029 #include <sys/time.h>
00030 #endif
00031 
00032 // Operating System 
00033 #define NO_SYS                      0
00034 
00035 #if MBED_CONF_LWIP_IPV4_ENABLED
00036 #define LWIP_IPV4                   1
00037 #else
00038 #define LWIP_IPV4                   0
00039 #endif
00040 #if MBED_CONF_LWIP_IPV6_ENABLED
00041 #define LWIP_IPV6                   1
00042 #else
00043 #define LWIP_IPV6                   0
00044 #endif
00045 #if !MBED_CONF_LWIP_IPV4_ENABLED && !MBED_CONF_LWIP_IPV6_ENABLED
00046 #error "Either IPv4 or IPv6 must be enabled."
00047 #endif
00048 
00049 // On dual stack configuration how long to wait for both or preferred stack
00050 // addresses before completing bring up.
00051 #if LWIP_IPV4 && LWIP_IPV6
00052 #if MBED_CONF_LWIP_ADDR_TIMEOUT_MODE
00053 #define BOTH_ADDR_TIMEOUT           MBED_CONF_LWIP_ADDR_TIMEOUT
00054 #define PREF_ADDR_TIMEOUT           0
00055 #else
00056 #define PREF_ADDR_TIMEOUT           MBED_CONF_LWIP_ADDR_TIMEOUT
00057 #define BOTH_ADDR_TIMEOUT           0
00058 #endif
00059 #else
00060 #define PREF_ADDR_TIMEOUT           0
00061 #define BOTH_ADDR_TIMEOUT           0
00062 #endif
00063 
00064 #define DHCP_TIMEOUT                60
00065 
00066 #define PREF_IPV4                   1
00067 #define PREF_IPV6                   2
00068 
00069 #if MBED_CONF_LWIP_IP_VER_PREF == 4
00070 #define IP_VERSION_PREF             PREF_IPV4
00071 #endif
00072 #if MBED_CONF_LWIP_IP_VER_PREF == 6
00073 #define IP_VERSION_PREF             PREF_IPV6
00074 #endif
00075 #ifndef IP_VERSION_PREF
00076 #error "Either IPv4 or IPv6 must be preferred."
00077 #endif
00078 
00079 #undef  LWIP_DEBUG
00080 #if MBED_CONF_LWIP_DEBUG_ENABLED
00081 #define LWIP_DEBUG                  1
00082 #endif
00083 
00084 #if NO_SYS == 0
00085 #include "cmsis_os2.h"
00086 
00087 #define SYS_LIGHTWEIGHT_PROT        1
00088 
00089 #define LWIP_RAW                    0
00090 
00091 #define TCPIP_MBOX_SIZE             8
00092 #define DEFAULT_TCP_RECVMBOX_SIZE   8
00093 #define DEFAULT_UDP_RECVMBOX_SIZE   8
00094 #define DEFAULT_RAW_RECVMBOX_SIZE   8
00095 #define DEFAULT_ACCEPTMBOX_SIZE     8
00096 
00097 // Thread stack size for lwip tcpip thread
00098 #ifndef MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE
00099 #define MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE      1200
00100 #endif
00101 
00102 #ifdef LWIP_DEBUG
00103 #define TCPIP_THREAD_STACKSIZE      MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE*2
00104 #else
00105 #define TCPIP_THREAD_STACKSIZE      MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE
00106 #endif
00107 
00108 #define TCPIP_THREAD_PRIO           (osPriorityNormal)
00109 
00110 // Thread stack size for lwip system threads
00111 #ifndef MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE
00112 #define MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE    512
00113 #endif
00114 
00115 // Thread stack size for private PPP thread
00116 #ifndef MBED_CONF_LWIP_PPP_THREAD_STACKSIZE
00117 #define MBED_CONF_LWIP_PPP_THREAD_STACKSIZE    768
00118 #endif
00119 
00120 #ifdef LWIP_DEBUG
00121 #define DEFAULT_THREAD_STACKSIZE    MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE*2
00122 #define PPP_THREAD_STACK_SIZE       MBED_CONF_LWIP_PPP_THREAD_STACKSIZE*2
00123 #else
00124 #define DEFAULT_THREAD_STACKSIZE    MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE
00125 #define PPP_THREAD_STACK_SIZE       MBED_CONF_LWIP_PPP_THREAD_STACKSIZE
00126 #endif
00127 
00128 #define MEMP_NUM_SYS_TIMEOUT        16
00129 
00130 #define sys_msleep(ms) sys_msleep(ms)
00131 
00132 #endif
00133 
00134 // 32-bit alignment
00135 #define MEM_ALIGNMENT               4
00136 
00137 #define LWIP_RAM_HEAP_POINTER       lwip_ram_heap
00138 
00139 // Number of pool pbufs.
00140 // Each requires 684 bytes of RAM (if MSS=536 and PBUF_POOL_BUFSIZE defaulting to be based on MSS)
00141 #ifdef MBED_CONF_LWIP_PBUF_POOL_SIZE
00142 #undef PBUF_POOL_SIZE
00143 #define PBUF_POOL_SIZE              MBED_CONF_LWIP_PBUF_POOL_SIZE
00144 #else
00145 #ifndef PBUF_POOL_SIZE
00146 #define PBUF_POOL_SIZE              5
00147 #endif
00148 #endif
00149 
00150 #ifdef MBED_CONF_LWIP_PBUF_POOL_BUFSIZE
00151 #undef PBUF_POOL_BUFSIZE
00152 #define PBUF_POOL_BUFSIZE           MBED_CONF_LWIP_PBUF_POOL_BUFSIZE
00153 #else
00154 #ifndef PBUF_POOL_BUFSIZE
00155 #if LWIP_IPV6
00156 #define PBUF_POOL_BUFSIZE               LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN)
00157 #elif LWIP_IPV4
00158 #define PBUF_POOL_BUFSIZE               LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+20+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN)
00159 #endif
00160 #endif
00161 #endif
00162 
00163 #ifdef MBED_CONF_LWIP_MEM_SIZE
00164 #undef MEM_SIZE
00165 #define MEM_SIZE                    MBED_CONF_LWIP_MEM_SIZE
00166 #endif
00167 
00168 // One tcp_pcb_listen is needed for each TCPServer.
00169 // Each requires 72 bytes of RAM.
00170 #ifdef MBED_CONF_LWIP_TCP_SERVER_MAX
00171 #define MEMP_NUM_TCP_PCB_LISTEN     MBED_CONF_LWIP_TCP_SERVER_MAX
00172 #else
00173 #define MEMP_NUM_TCP_PCB_LISTEN     4
00174 #endif
00175 
00176 // One is tcp_pcb needed for each TCPSocket.
00177 // Each requires 196 bytes of RAM.
00178 #ifdef MBED_CONF_LWIP_TCP_SOCKET_MAX
00179 #define MEMP_NUM_TCP_PCB            MBED_CONF_LWIP_TCP_SOCKET_MAX
00180 #else
00181 #define MEMP_NUM_TCP_PCB            4
00182 #endif
00183 
00184 // One udp_pcb is needed for each UDPSocket.
00185 // Each requires 84 bytes of RAM (total rounded to multiple of 512).
00186 #ifdef MBED_CONF_LWIP_UDP_SOCKET_MAX
00187 #define MEMP_NUM_UDP_PCB            MBED_CONF_LWIP_UDP_SOCKET_MAX
00188 #else
00189 #define MEMP_NUM_UDP_PCB            4
00190 #endif
00191 
00192 // Number of non-pool pbufs.
00193 // Each requires 92 bytes of RAM.
00194 #ifndef MEMP_NUM_PBUF
00195 #define MEMP_NUM_PBUF               8
00196 #endif
00197 
00198 // Each netbuf requires 64 bytes of RAM.
00199 #ifndef MEMP_NUM_NETBUF
00200 #define MEMP_NUM_NETBUF             8
00201 #endif
00202 
00203 // One netconn is needed for each UDPSocket, TCPSocket or TCPServer.
00204 // Each requires 236 bytes of RAM (total rounded to multiple of 512).
00205 #ifdef MBED_CONF_LWIP_SOCKET_MAX
00206 #define MEMP_NUM_NETCONN            MBED_CONF_LWIP_SOCKET_MAX
00207 #else
00208 #define MEMP_NUM_NETCONN            4
00209 #endif
00210 
00211 #if MBED_CONF_LWIP_TCP_ENABLED
00212 #define LWIP_TCP                    1
00213 #define TCP_QUEUE_OOSEQ             0
00214 #define TCP_OVERSIZE                0
00215 #define LWIP_TCP_KEEPALIVE          1
00216 #else
00217 #define LWIP_TCP                    0
00218 #endif
00219 
00220 #define LWIP_DNS                    1
00221 #define LWIP_SOCKET                 0
00222 
00223 #define SO_REUSE                    1
00224 
00225 // Support Multicast
00226 #include "stdlib.h"
00227 #define LWIP_IGMP                   LWIP_IPV4
00228 #define LWIP_RAND()                 lwip_get_random()
00229 
00230 #define LWIP_COMPAT_SOCKETS         0
00231 #define LWIP_POSIX_SOCKETS_IO_NAMES 0
00232 #define LWIP_SO_RCVTIMEO            1
00233 
00234 #define LWIP_BROADCAST_PING         1
00235 
00236 // Fragmentation on, as per IPv4 default
00237 #define LWIP_IPV6_FRAG              LWIP_IPV6
00238 
00239 // Queuing "disabled", as per IPv4 default (so actually queues 1)
00240 #define LWIP_ND6_QUEUEING           0
00241 
00242 // Debug Options
00243 #define NETIF_DEBUG                 LWIP_DBG_OFF
00244 #define PBUF_DEBUG                  LWIP_DBG_OFF
00245 #define API_LIB_DEBUG               LWIP_DBG_OFF
00246 #define API_MSG_DEBUG               LWIP_DBG_OFF
00247 #define SOCKETS_DEBUG               LWIP_DBG_OFF
00248 #define ICMP_DEBUG                  LWIP_DBG_OFF
00249 #define IGMP_DEBUG                  LWIP_DBG_OFF
00250 #define INET_DEBUG                  LWIP_DBG_OFF
00251 #define IP_DEBUG                    LWIP_DBG_OFF
00252 #define IP_REASS_DEBUG              LWIP_DBG_OFF
00253 #define RAW_DEBUG                   LWIP_DBG_OFF
00254 #define MEM_DEBUG                   LWIP_DBG_OFF
00255 #define MEMP_DEBUG                  LWIP_DBG_OFF
00256 #define SYS_DEBUG                   LWIP_DBG_OFF
00257 #define TIMERS_DEBUG                LWIP_DBG_OFF
00258 #define TCP_DEBUG                   LWIP_DBG_OFF
00259 #define TCP_INPUT_DEBUG             LWIP_DBG_OFF
00260 #define TCP_FR_DEBUG                LWIP_DBG_OFF
00261 #define TCP_RTO_DEBUG               LWIP_DBG_OFF
00262 #define TCP_CWND_DEBUG              LWIP_DBG_OFF
00263 #define TCP_WND_DEBUG               LWIP_DBG_OFF
00264 #define TCP_OUTPUT_DEBUG            LWIP_DBG_OFF
00265 #define TCP_RST_DEBUG               LWIP_DBG_OFF
00266 #define TCP_QLEN_DEBUG              LWIP_DBG_OFF
00267 #define UDP_DEBUG                   LWIP_DBG_OFF
00268 #define TCPIP_DEBUG                 LWIP_DBG_OFF
00269 #define SLIP_DEBUG                  LWIP_DBG_OFF
00270 #define DHCP_DEBUG                  LWIP_DBG_OFF
00271 #define AUTOIP_DEBUG                LWIP_DBG_OFF
00272 #define DNS_DEBUG                   LWIP_DBG_OFF
00273 #define IP6_DEBUG                   LWIP_DBG_OFF
00274 
00275 #if MBED_CONF_LWIP_ENABLE_PPP_TRACE
00276 #define PPP_DEBUG                   LWIP_DBG_ON
00277 #else
00278 #define PPP_DEBUG                   LWIP_DBG_OFF
00279 #endif //MBED_CONF_LWIP_ENABLE_PPP_TRACE
00280 #define ETHARP_DEBUG                LWIP_DBG_OFF
00281 #define UDP_LPC_EMAC                LWIP_DBG_OFF
00282 
00283 #ifdef LWIP_DEBUG
00284 #define MEMP_OVERFLOW_CHECK         1
00285 #define MEMP_SANITY_CHECK           1
00286 #define LWIP_DBG_TYPES_ON           LWIP_DBG_ON
00287 #define LWIP_DBG_MIN_LEVEL          LWIP_DBG_LEVEL_ALL
00288 #else
00289 #define LWIP_NOASSERT               1
00290 #define LWIP_STATS                  0
00291 #endif
00292 
00293 #define TRACE_TO_ASCII_HEX_DUMP     0
00294 
00295 #define LWIP_PLATFORM_BYTESWAP      1
00296 
00297 #define LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS 1
00298 
00299 // Interface type configuration
00300 
00301 #if MBED_CONF_LWIP_ETHERNET_ENABLED
00302 #define LWIP_ARP                    1
00303 #define LWIP_ETHERNET               1
00304 #define LWIP_DHCP                   LWIP_IPV4
00305 #else
00306 #define LWIP_ARP                    0
00307 #define LWIP_ETHERNET               0
00308 #endif // MBED_CONF_LWIP_ETHERNET_ENABLED
00309 
00310 // Note generic macro name used rather than MBED_CONF_LWIP_PPP_ENABLED
00311 // to allow users like PPPCellularInterface to detect that nsapi_ppp.h is available.
00312 #if NSAPI_PPP_AVAILABLE
00313 #define PPP_SUPPORT                    1
00314 #if MBED_CONF_LWIP_IPV6_ENABLED
00315 #define PPP_IPV6_SUPPORT               1
00316 // Disable DAD for PPP
00317 #define LWIP_IPV6_DUP_DETECT_ATTEMPTS  0
00318 #endif
00319 #define CHAP_SUPPORT                   1
00320 #define PPP_INPROC_IRQ_SAFE            1
00321 // Save RAM
00322 #define PAP_SUPPORT                    0
00323 #define VJ_SUPPORT                     0
00324 #define PRINTPKT_SUPPORT               0
00325 
00326 // Broadcast
00327 #define IP_SOF_BROADCAST               0
00328 #define IP_SOF_BROADCAST_RECV          0
00329 
00330 #define MAXNAMELEN                     64     /* max length of hostname or name for auth */
00331 #define MAXSECRETLEN                   64
00332 #endif // NSAPI_PPP_AVAILABLE
00333 
00334 // Make sure we default these to off, so
00335 // LWIP doesn't default to on
00336 #ifndef LWIP_ARP
00337 #define LWIP_ARP                    0
00338 #endif
00339 // Checksum-on-copy disabled due to https://savannah.nongnu.org/bugs/?50914
00340 #define LWIP_CHECKSUM_ON_COPY       0
00341 
00342 #define LWIP_NETIF_HOSTNAME         1
00343 #define LWIP_NETIF_STATUS_CALLBACK  1
00344 #define LWIP_NETIF_LINK_CALLBACK    1
00345 
00346 #define DNS_TABLE_SIZE                  2
00347 #define DNS_MAX_NAME_LENGTH             128
00348 
00349 #include "lwip_random.h"
00350 #include "lwip_tcp_isn.h"
00351 #define LWIP_HOOK_TCP_ISN lwip_hook_tcp_isn
00352 #ifdef MBEDTLS_MD5_C
00353 #include "mbedtls/inc/mbedtls/md5.h"
00354 #define LWIP_USE_EXTERNAL_MBEDTLS 1
00355 #endif
00356 
00357 #endif /* LWIPOPTS_H_ */