ON Semiconductor / mbed-os

Dependents:   mbed-TFT-example-NCS36510 mbed-Accelerometer-example-NCS36510 mbed-Accelerometer-example-NCS36510

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 // Number of pool pbufs.
00109 // Each requires 684 bytes of RAM.
00110 #ifndef PBUF_POOL_SIZE
00111 #define PBUF_POOL_SIZE              5
00112 #endif
00113 
00114 // One tcp_pcb_listen is needed for each TCPServer.
00115 // Each requires 72 bytes of RAM.
00116 #ifdef MBED_CONF_LWIP_TCP_SERVER_MAX
00117 #define MEMP_NUM_TCP_PCB_LISTEN     MBED_CONF_LWIP_TCP_SERVER_MAX
00118 #else
00119 #define MEMP_NUM_TCP_PCB_LISTEN     4
00120 #endif
00121 
00122 // One is tcp_pcb needed for each TCPSocket.
00123 // Each requires 196 bytes of RAM.
00124 #ifdef MBED_CONF_LWIP_TCP_SOCKET_MAX
00125 #define MEMP_NUM_TCP_PCB            MBED_CONF_LWIP_TCP_SOCKET_MAX
00126 #else
00127 #define MEMP_NUM_TCP_PCB            4
00128 #endif
00129 
00130 // One udp_pcb is needed for each UDPSocket.
00131 // Each requires 84 bytes of RAM (total rounded to multiple of 512).
00132 #ifdef MBED_CONF_LWIP_UDP_SOCKET_MAX
00133 #define MEMP_NUM_UDP_PCB            MBED_CONF_LWIP_UDP_SOCKET_MAX
00134 #else
00135 #define MEMP_NUM_UDP_PCB            4
00136 #endif
00137 
00138 // Number of non-pool pbufs.
00139 // Each requires 92 bytes of RAM.
00140 #ifndef MEMP_NUM_PBUF
00141 #define MEMP_NUM_PBUF               8
00142 #endif
00143 
00144 // Each netbuf requires 64 bytes of RAM.
00145 #ifndef MEMP_NUM_NETBUF
00146 #define MEMP_NUM_NETBUF             8
00147 #endif
00148 
00149 // One netconn is needed for each UDPSocket, TCPSocket or TCPServer.
00150 // Each requires 236 bytes of RAM (total rounded to multiple of 512).
00151 #ifdef MBED_CONF_LWIP_SOCKET_MAX
00152 #define MEMP_NUM_NETCONN            MBED_CONF_LWIP_SOCKET_MAX
00153 #else
00154 #define MEMP_NUM_NETCONN            4
00155 #endif
00156 
00157 #define TCP_QUEUE_OOSEQ             0
00158 #define TCP_OVERSIZE                0
00159 
00160 #define LWIP_DHCP                   LWIP_IPV4
00161 #define LWIP_DNS                    1
00162 #define LWIP_SOCKET                 0
00163 
00164 #define SO_REUSE                    1
00165 
00166 // Support Multicast
00167 #include "stdlib.h"
00168 #define LWIP_IGMP                   LWIP_IPV4
00169 #define LWIP_RAND()                 rand()
00170 
00171 #define LWIP_COMPAT_SOCKETS         0
00172 #define LWIP_POSIX_SOCKETS_IO_NAMES 0
00173 #define LWIP_SO_RCVTIMEO            1
00174 #define LWIP_TCP_KEEPALIVE          1
00175 
00176 // Fragmentation on, as per IPv4 default
00177 #define LWIP_IPV6_FRAG              LWIP_IPV6
00178 
00179 // Queuing "disabled", as per IPv4 default (so actually queues 1)
00180 #define LWIP_ND6_QUEUEING           0
00181 
00182 // Debug Options
00183 #define NETIF_DEBUG                 LWIP_DBG_OFF
00184 #define PBUF_DEBUG                  LWIP_DBG_OFF
00185 #define API_LIB_DEBUG               LWIP_DBG_OFF
00186 #define API_MSG_DEBUG               LWIP_DBG_OFF
00187 #define SOCKETS_DEBUG               LWIP_DBG_OFF
00188 #define ICMP_DEBUG                  LWIP_DBG_OFF
00189 #define IGMP_DEBUG                  LWIP_DBG_OFF
00190 #define INET_DEBUG                  LWIP_DBG_OFF
00191 #define IP_DEBUG                    LWIP_DBG_OFF
00192 #define IP_REASS_DEBUG              LWIP_DBG_OFF
00193 #define RAW_DEBUG                   LWIP_DBG_OFF
00194 #define MEM_DEBUG                   LWIP_DBG_OFF
00195 #define MEMP_DEBUG                  LWIP_DBG_OFF
00196 #define SYS_DEBUG                   LWIP_DBG_OFF
00197 #define TIMERS_DEBUG                LWIP_DBG_OFF
00198 #define TCP_DEBUG                   LWIP_DBG_OFF
00199 #define TCP_INPUT_DEBUG             LWIP_DBG_OFF
00200 #define TCP_FR_DEBUG                LWIP_DBG_OFF
00201 #define TCP_RTO_DEBUG               LWIP_DBG_OFF
00202 #define TCP_CWND_DEBUG              LWIP_DBG_OFF
00203 #define TCP_WND_DEBUG               LWIP_DBG_OFF
00204 #define TCP_OUTPUT_DEBUG            LWIP_DBG_OFF
00205 #define TCP_RST_DEBUG               LWIP_DBG_OFF
00206 #define TCP_QLEN_DEBUG              LWIP_DBG_OFF
00207 #define UDP_DEBUG                   LWIP_DBG_OFF
00208 #define TCPIP_DEBUG                 LWIP_DBG_OFF
00209 #define SLIP_DEBUG                  LWIP_DBG_OFF
00210 #define DHCP_DEBUG                  LWIP_DBG_OFF
00211 #define AUTOIP_DEBUG                LWIP_DBG_OFF
00212 #define DNS_DEBUG                   LWIP_DBG_OFF
00213 #define IP6_DEBUG                   LWIP_DBG_OFF
00214 
00215 #define PPP_DEBUG                   LWIP_DBG_OFF
00216 #define ETHARP_DEBUG                LWIP_DBG_OFF
00217 #define UDP_LPC_EMAC                LWIP_DBG_OFF
00218 
00219 #ifdef LWIP_DEBUG
00220 #define MEMP_OVERFLOW_CHECK         1
00221 #define MEMP_SANITY_CHECK           1
00222 #else
00223 #define LWIP_NOASSERT               1
00224 #define LWIP_STATS                  0
00225 #endif
00226 
00227 #define LWIP_DBG_TYPES_ON           LWIP_DBG_ON
00228 #define LWIP_DBG_MIN_LEVEL          LWIP_DBG_LEVEL_ALL
00229 
00230 #define LWIP_PLATFORM_BYTESWAP      1
00231 
00232 #define LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS 1
00233 
00234 #if LWIP_TRANSPORT_ETHERNET
00235 
00236 // Broadcast
00237 #define IP_SOF_BROADCAST            1
00238 #define IP_SOF_BROADCAST_RECV       1
00239 
00240 #define LWIP_BROADCAST_PING         1
00241 
00242 #define LWIP_CHECKSUM_ON_COPY       1
00243 
00244 #define LWIP_NETIF_HOSTNAME         1
00245 #define LWIP_NETIF_STATUS_CALLBACK  1
00246 #define LWIP_NETIF_LINK_CALLBACK    1
00247 
00248 #elif LWIP_TRANSPORT_PPP
00249 
00250 #define TCP_SND_BUF                     (3 * 536)
00251 #define TCP_WND                         (2 * 536)
00252 
00253 #define LWIP_ARP 0
00254 
00255 #define PPP_SUPPORT 1
00256 #define CHAP_SUPPORT                    1
00257 #define PAP_SUPPORT                     1
00258 #define PPP_THREAD_STACKSIZE            4*192
00259 #define PPP_THREAD_PRIO 0
00260 
00261 #define MAXNAMELEN                      64     /* max length of hostname or name for auth */
00262 #define MAXSECRETLEN                    64
00263 
00264 #else
00265 #error A transport mechanism (Ethernet or PPP) must be defined
00266 #endif
00267 
00268 #endif /* LWIPOPTS_H_ */