Simon Cooksey / mbed-os
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 #include "lwipopts_conf.h"
00023 
00024 // Workaround for Linux timeval
00025 #if defined (TOOLCHAIN_GCC)
00026 #define LWIP_TIMEVAL_PRIVATE 0
00027 #include <sys/time.h>
00028 #endif
00029 
00030 // Operating System 
00031 #define NO_SYS                      0
00032 
00033 #if MBED_CONF_LWIP_IPV4_ENABLED
00034 #define LWIP_IPV4                   1
00035 #else
00036 #define LWIP_IPV4                   0
00037 #endif
00038 #if MBED_CONF_LWIP_IPV6_ENABLED
00039 #define LWIP_IPV6                   1
00040 #else
00041 #define LWIP_IPV6                   0
00042 #endif
00043 #if !MBED_CONF_LWIP_IPV4_ENABLED && !MBED_CONF_LWIP_IPV6_ENABLED
00044 #error "Either IPv4 or IPv6 must be enabled."
00045 #endif
00046 
00047 // On dual stack configuration how long wait for preferred stack
00048 // before selecting either IPv6 or IPv4
00049 #if LWIP_IPV4 && LWIP_IPV6
00050 #define ADDR_TIMEOUT                MBED_CONF_LWIP_ADDR_TIMEOUT
00051 #else
00052 #define ADDR_TIMEOUT                0
00053 #endif
00054 
00055 #define PREF_IPV4                   1
00056 #define PREF_IPV6                   2
00057 
00058 #if MBED_CONF_LWIP_IP_VER_PREF == 4
00059 #define IP_VERSION_PREF             PREF_IPV4
00060 #endif
00061 #if MBED_CONF_LWIP_IP_VER_PREF == 6
00062 #define IP_VERSION_PREF             PREF_IPV6
00063 #endif
00064 #ifndef IP_VERSION_PREF
00065 #error "Either IPv4 or IPv6 must be preferred."
00066 #endif
00067 
00068 //#define LWIP_DEBUG
00069 
00070 #if NO_SYS == 0
00071 #include "cmsis_os.h"
00072 
00073 #define SYS_LIGHTWEIGHT_PROT        1
00074 
00075 #define LWIP_RAW                    0
00076 
00077 #define TCPIP_MBOX_SIZE             8
00078 #define DEFAULT_TCP_RECVMBOX_SIZE   8
00079 #define DEFAULT_UDP_RECVMBOX_SIZE   8
00080 #define DEFAULT_RAW_RECVMBOX_SIZE   8
00081 #define DEFAULT_ACCEPTMBOX_SIZE     8
00082 
00083 #ifdef LWIP_DEBUG
00084 #define TCPIP_THREAD_STACKSIZE      1200*2
00085 #else
00086 #define TCPIP_THREAD_STACKSIZE      1200
00087 #endif
00088 
00089 #define TCPIP_THREAD_PRIO           (osPriorityNormal)
00090 
00091 #ifdef LWIP_DEBUG
00092 #define DEFAULT_THREAD_STACKSIZE    512*2
00093 #else
00094 #define DEFAULT_THREAD_STACKSIZE    512
00095 #endif
00096 
00097 #define MEMP_NUM_SYS_TIMEOUT        16
00098 
00099 #define sys_msleep(ms) sys_msleep(ms)
00100 
00101 #endif
00102 
00103 // 32-bit alignment
00104 #define MEM_ALIGNMENT               4
00105 
00106 #define LWIP_RAM_HEAP_POINTER       lwip_ram_heap
00107 
00108 #define PBUF_POOL_SIZE              5
00109 #define MEMP_NUM_TCP_PCB_LISTEN     4
00110 #define MEMP_NUM_TCP_PCB            4
00111 #define MEMP_NUM_UDP_PCB            4
00112 #define MEMP_NUM_PBUF               8
00113 #define MEMP_NUM_NETBUF             8
00114 
00115 #define TCP_QUEUE_OOSEQ             0
00116 #define TCP_OVERSIZE                0
00117 
00118 #define LWIP_DHCP                   LWIP_IPV4
00119 #define LWIP_DNS                    1
00120 #define LWIP_SOCKET                 0
00121 
00122 #define SO_REUSE                    1
00123 
00124 // Support Multicast
00125 #include "stdlib.h"
00126 #define LWIP_IGMP                   LWIP_IPV4
00127 #define LWIP_RAND()                 rand()
00128 
00129 #define LWIP_COMPAT_SOCKETS         0
00130 #define LWIP_POSIX_SOCKETS_IO_NAMES 0
00131 #define LWIP_SO_RCVTIMEO            1
00132 #define LWIP_TCP_KEEPALIVE          1
00133 
00134 // Fragmentation on, as per IPv4 default
00135 #define LWIP_IPV6_FRAG              LWIP_IPV6
00136 
00137 // Queuing "disabled", as per IPv4 default (so actually queues 1)
00138 #define LWIP_ND6_QUEUEING           0
00139 
00140 // Debug Options
00141 #define NETIF_DEBUG                 LWIP_DBG_OFF
00142 #define PBUF_DEBUG                  LWIP_DBG_OFF
00143 #define API_LIB_DEBUG               LWIP_DBG_OFF
00144 #define API_MSG_DEBUG               LWIP_DBG_OFF
00145 #define SOCKETS_DEBUG               LWIP_DBG_OFF
00146 #define ICMP_DEBUG                  LWIP_DBG_OFF
00147 #define IGMP_DEBUG                  LWIP_DBG_OFF
00148 #define INET_DEBUG                  LWIP_DBG_OFF
00149 #define IP_DEBUG                    LWIP_DBG_OFF
00150 #define IP_REASS_DEBUG              LWIP_DBG_OFF
00151 #define RAW_DEBUG                   LWIP_DBG_OFF
00152 #define MEM_DEBUG                   LWIP_DBG_OFF
00153 #define MEMP_DEBUG                  LWIP_DBG_OFF
00154 #define SYS_DEBUG                   LWIP_DBG_OFF
00155 #define TIMERS_DEBUG                LWIP_DBG_OFF
00156 #define TCP_DEBUG                   LWIP_DBG_OFF
00157 #define TCP_INPUT_DEBUG             LWIP_DBG_OFF
00158 #define TCP_FR_DEBUG                LWIP_DBG_OFF
00159 #define TCP_RTO_DEBUG               LWIP_DBG_OFF
00160 #define TCP_CWND_DEBUG              LWIP_DBG_OFF
00161 #define TCP_WND_DEBUG               LWIP_DBG_OFF
00162 #define TCP_OUTPUT_DEBUG            LWIP_DBG_OFF
00163 #define TCP_RST_DEBUG               LWIP_DBG_OFF
00164 #define TCP_QLEN_DEBUG              LWIP_DBG_OFF
00165 #define UDP_DEBUG                   LWIP_DBG_OFF
00166 #define TCPIP_DEBUG                 LWIP_DBG_OFF
00167 #define SLIP_DEBUG                  LWIP_DBG_OFF
00168 #define DHCP_DEBUG                  LWIP_DBG_OFF
00169 #define AUTOIP_DEBUG                LWIP_DBG_OFF
00170 #define DNS_DEBUG                   LWIP_DBG_OFF
00171 #define IP6_DEBUG                   LWIP_DBG_OFF
00172 
00173 #define PPP_DEBUG                   LWIP_DBG_OFF
00174 #define ETHARP_DEBUG                LWIP_DBG_OFF
00175 #define UDP_LPC_EMAC                LWIP_DBG_OFF
00176 
00177 #ifdef LWIP_DEBUG
00178 #define MEMP_OVERFLOW_CHECK         1
00179 #define MEMP_SANITY_CHECK           1
00180 #else
00181 #define LWIP_NOASSERT               1
00182 #define LWIP_STATS                  0
00183 #endif
00184 
00185 #define LWIP_DBG_TYPES_ON           LWIP_DBG_ON
00186 #define LWIP_DBG_MIN_LEVEL          LWIP_DBG_LEVEL_ALL
00187 
00188 #define LWIP_PLATFORM_BYTESWAP      1
00189 
00190 #define LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS 1
00191 
00192 #if LWIP_TRANSPORT_ETHERNET
00193 
00194 // Broadcast
00195 #define IP_SOF_BROADCAST            1
00196 #define IP_SOF_BROADCAST_RECV       1
00197 
00198 #define LWIP_BROADCAST_PING         1
00199 
00200 #define LWIP_CHECKSUM_ON_COPY       1
00201 
00202 #define LWIP_NETIF_HOSTNAME         1
00203 #define LWIP_NETIF_STATUS_CALLBACK  1
00204 #define LWIP_NETIF_LINK_CALLBACK    1
00205 
00206 #elif LWIP_TRANSPORT_PPP
00207 
00208 #define TCP_SND_BUF                     (3 * 536)
00209 #define TCP_WND                         (2 * 536)
00210 
00211 #define LWIP_ARP 0
00212 
00213 #define PPP_SUPPORT 1
00214 #define CHAP_SUPPORT                    1
00215 #define PAP_SUPPORT                     1
00216 #define PPP_THREAD_STACKSIZE            4*192
00217 #define PPP_THREAD_PRIO 0
00218 
00219 #define MAXNAMELEN                      64     /* max length of hostname or name for auth */
00220 #define MAXSECRETLEN                    64
00221 
00222 #else
00223 #error A transport mechanism (Ethernet or PPP) must be defined
00224 #endif
00225 
00226 #endif /* LWIPOPTS_H_ */