mbed-os

Fork of mbed-os by erkin yucel

Committer:
xuaner
Date:
Thu Jul 20 14:26:57 2017 +0000
Revision:
1:3deb71413561
Parent:
0:f269e3021894
mbed_os

Who changed what in which revision?

UserRevisionLine numberNew contents of line
elessair 0:f269e3021894 1 /* Copyright (C) 2012 mbed.org, MIT License
elessair 0:f269e3021894 2 *
elessair 0:f269e3021894 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
elessair 0:f269e3021894 4 * and associated documentation files (the "Software"), to deal in the Software without restriction,
elessair 0:f269e3021894 5 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
elessair 0:f269e3021894 6 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
elessair 0:f269e3021894 7 * furnished to do so, subject to the following conditions:
elessair 0:f269e3021894 8 *
elessair 0:f269e3021894 9 * The above copyright notice and this permission notice shall be included in all copies or
elessair 0:f269e3021894 10 * substantial portions of the Software.
elessair 0:f269e3021894 11 *
elessair 0:f269e3021894 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
elessair 0:f269e3021894 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
elessair 0:f269e3021894 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
elessair 0:f269e3021894 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
elessair 0:f269e3021894 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
elessair 0:f269e3021894 17 */
elessair 0:f269e3021894 18
elessair 0:f269e3021894 19 #ifndef LWIPOPTS_H
elessair 0:f269e3021894 20 #define LWIPOPTS_H
elessair 0:f269e3021894 21
elessair 0:f269e3021894 22 #include "lwipopts_conf.h"
elessair 0:f269e3021894 23
elessair 0:f269e3021894 24 // Workaround for Linux timeval
elessair 0:f269e3021894 25 #if defined (TOOLCHAIN_GCC)
elessair 0:f269e3021894 26 #define LWIP_TIMEVAL_PRIVATE 0
elessair 0:f269e3021894 27 #include <sys/time.h>
elessair 0:f269e3021894 28 #endif
elessair 0:f269e3021894 29
elessair 0:f269e3021894 30 // Operating System
elessair 0:f269e3021894 31 #define NO_SYS 0
elessair 0:f269e3021894 32
elessair 0:f269e3021894 33 #if MBED_CONF_LWIP_IPV4_ENABLED
elessair 0:f269e3021894 34 #define LWIP_IPV4 1
elessair 0:f269e3021894 35 #else
elessair 0:f269e3021894 36 #define LWIP_IPV4 0
elessair 0:f269e3021894 37 #endif
elessair 0:f269e3021894 38 #if MBED_CONF_LWIP_IPV6_ENABLED
elessair 0:f269e3021894 39 #define LWIP_IPV6 1
elessair 0:f269e3021894 40 #else
elessair 0:f269e3021894 41 #define LWIP_IPV6 0
elessair 0:f269e3021894 42 #endif
elessair 0:f269e3021894 43 #if !MBED_CONF_LWIP_IPV4_ENABLED && !MBED_CONF_LWIP_IPV6_ENABLED
elessair 0:f269e3021894 44 #error "Either IPv4 or IPv6 must be enabled."
elessair 0:f269e3021894 45 #endif
elessair 0:f269e3021894 46
elessair 0:f269e3021894 47 // On dual stack configuration how long wait for preferred stack
elessair 0:f269e3021894 48 // before selecting either IPv6 or IPv4
elessair 0:f269e3021894 49 #if LWIP_IPV4 && LWIP_IPV6
elessair 0:f269e3021894 50 #define ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT
elessair 0:f269e3021894 51 #else
elessair 0:f269e3021894 52 #define ADDR_TIMEOUT 0
elessair 0:f269e3021894 53 #endif
elessair 0:f269e3021894 54
elessair 0:f269e3021894 55 #define PREF_IPV4 1
elessair 0:f269e3021894 56 #define PREF_IPV6 2
elessair 0:f269e3021894 57
elessair 0:f269e3021894 58 #if MBED_CONF_LWIP_IP_VER_PREF == 4
elessair 0:f269e3021894 59 #define IP_VERSION_PREF PREF_IPV4
elessair 0:f269e3021894 60 #endif
elessair 0:f269e3021894 61 #if MBED_CONF_LWIP_IP_VER_PREF == 6
elessair 0:f269e3021894 62 #define IP_VERSION_PREF PREF_IPV6
elessair 0:f269e3021894 63 #endif
elessair 0:f269e3021894 64 #ifndef IP_VERSION_PREF
elessair 0:f269e3021894 65 #error "Either IPv4 or IPv6 must be preferred."
elessair 0:f269e3021894 66 #endif
elessair 0:f269e3021894 67
elessair 0:f269e3021894 68 //#define LWIP_DEBUG
elessair 0:f269e3021894 69
elessair 0:f269e3021894 70 #if NO_SYS == 0
elessair 0:f269e3021894 71 #include "cmsis_os.h"
elessair 0:f269e3021894 72
elessair 0:f269e3021894 73 #define SYS_LIGHTWEIGHT_PROT 1
elessair 0:f269e3021894 74
elessair 0:f269e3021894 75 #define LWIP_RAW 0
elessair 0:f269e3021894 76
elessair 0:f269e3021894 77 #define TCPIP_MBOX_SIZE 8
elessair 0:f269e3021894 78 #define DEFAULT_TCP_RECVMBOX_SIZE 8
elessair 0:f269e3021894 79 #define DEFAULT_UDP_RECVMBOX_SIZE 8
elessair 0:f269e3021894 80 #define DEFAULT_RAW_RECVMBOX_SIZE 8
elessair 0:f269e3021894 81 #define DEFAULT_ACCEPTMBOX_SIZE 8
elessair 0:f269e3021894 82
elessair 0:f269e3021894 83 #ifdef LWIP_DEBUG
elessair 0:f269e3021894 84 #define TCPIP_THREAD_STACKSIZE 1200*2
elessair 0:f269e3021894 85 #else
elessair 0:f269e3021894 86 #define TCPIP_THREAD_STACKSIZE 1200
elessair 0:f269e3021894 87 #endif
elessair 0:f269e3021894 88
elessair 0:f269e3021894 89 #define TCPIP_THREAD_PRIO (osPriorityNormal)
elessair 0:f269e3021894 90
elessair 0:f269e3021894 91 #ifdef LWIP_DEBUG
elessair 0:f269e3021894 92 #define DEFAULT_THREAD_STACKSIZE 512*2
elessair 0:f269e3021894 93 #else
elessair 0:f269e3021894 94 #define DEFAULT_THREAD_STACKSIZE 512
elessair 0:f269e3021894 95 #endif
elessair 0:f269e3021894 96
elessair 0:f269e3021894 97 #define MEMP_NUM_SYS_TIMEOUT 16
elessair 0:f269e3021894 98
elessair 0:f269e3021894 99 #define sys_msleep(ms) sys_msleep(ms)
elessair 0:f269e3021894 100
elessair 0:f269e3021894 101 #endif
elessair 0:f269e3021894 102
elessair 0:f269e3021894 103 // 32-bit alignment
elessair 0:f269e3021894 104 #define MEM_ALIGNMENT 4
elessair 0:f269e3021894 105
elessair 0:f269e3021894 106 #define LWIP_RAM_HEAP_POINTER lwip_ram_heap
elessair 0:f269e3021894 107
elessair 0:f269e3021894 108 #define PBUF_POOL_SIZE 5
elessair 0:f269e3021894 109 #define MEMP_NUM_TCP_PCB_LISTEN 4
elessair 0:f269e3021894 110 #define MEMP_NUM_TCP_PCB 4
elessair 0:f269e3021894 111 #define MEMP_NUM_UDP_PCB 4
elessair 0:f269e3021894 112 #define MEMP_NUM_PBUF 8
elessair 0:f269e3021894 113 #define MEMP_NUM_NETBUF 8
elessair 0:f269e3021894 114
elessair 0:f269e3021894 115 #define TCP_QUEUE_OOSEQ 0
elessair 0:f269e3021894 116 #define TCP_OVERSIZE 0
elessair 0:f269e3021894 117
elessair 0:f269e3021894 118 #define LWIP_DHCP LWIP_IPV4
elessair 0:f269e3021894 119 #define LWIP_DNS 1
elessair 0:f269e3021894 120 #define LWIP_SOCKET 0
elessair 0:f269e3021894 121
elessair 0:f269e3021894 122 #define SO_REUSE 1
elessair 0:f269e3021894 123
elessair 0:f269e3021894 124 // Support Multicast
elessair 0:f269e3021894 125 #include "stdlib.h"
elessair 0:f269e3021894 126 #define LWIP_IGMP LWIP_IPV4
elessair 0:f269e3021894 127 #define LWIP_RAND() rand()
elessair 0:f269e3021894 128
elessair 0:f269e3021894 129 #define LWIP_COMPAT_SOCKETS 0
elessair 0:f269e3021894 130 #define LWIP_POSIX_SOCKETS_IO_NAMES 0
elessair 0:f269e3021894 131 #define LWIP_SO_RCVTIMEO 1
elessair 0:f269e3021894 132 #define LWIP_TCP_KEEPALIVE 1
elessair 0:f269e3021894 133
elessair 0:f269e3021894 134 // Fragmentation on, as per IPv4 default
elessair 0:f269e3021894 135 #define LWIP_IPV6_FRAG LWIP_IPV6
elessair 0:f269e3021894 136
elessair 0:f269e3021894 137 // Queuing "disabled", as per IPv4 default (so actually queues 1)
elessair 0:f269e3021894 138 #define LWIP_ND6_QUEUEING 0
elessair 0:f269e3021894 139
elessair 0:f269e3021894 140 // Debug Options
elessair 0:f269e3021894 141 #define NETIF_DEBUG LWIP_DBG_OFF
elessair 0:f269e3021894 142 #define PBUF_DEBUG LWIP_DBG_OFF
elessair 0:f269e3021894 143 #define API_LIB_DEBUG LWIP_DBG_OFF
elessair 0:f269e3021894 144 #define API_MSG_DEBUG LWIP_DBG_OFF
elessair 0:f269e3021894 145 #define SOCKETS_DEBUG LWIP_DBG_OFF
elessair 0:f269e3021894 146 #define ICMP_DEBUG LWIP_DBG_OFF
elessair 0:f269e3021894 147 #define IGMP_DEBUG LWIP_DBG_OFF
elessair 0:f269e3021894 148 #define INET_DEBUG LWIP_DBG_OFF
elessair 0:f269e3021894 149 #define IP_DEBUG LWIP_DBG_OFF
elessair 0:f269e3021894 150 #define IP_REASS_DEBUG LWIP_DBG_OFF
elessair 0:f269e3021894 151 #define RAW_DEBUG LWIP_DBG_OFF
elessair 0:f269e3021894 152 #define MEM_DEBUG LWIP_DBG_OFF
elessair 0:f269e3021894 153 #define MEMP_DEBUG LWIP_DBG_OFF
elessair 0:f269e3021894 154 #define SYS_DEBUG LWIP_DBG_OFF
elessair 0:f269e3021894 155 #define TIMERS_DEBUG LWIP_DBG_OFF
elessair 0:f269e3021894 156 #define TCP_DEBUG LWIP_DBG_OFF
elessair 0:f269e3021894 157 #define TCP_INPUT_DEBUG LWIP_DBG_OFF
elessair 0:f269e3021894 158 #define TCP_FR_DEBUG LWIP_DBG_OFF
elessair 0:f269e3021894 159 #define TCP_RTO_DEBUG LWIP_DBG_OFF
elessair 0:f269e3021894 160 #define TCP_CWND_DEBUG LWIP_DBG_OFF
elessair 0:f269e3021894 161 #define TCP_WND_DEBUG LWIP_DBG_OFF
elessair 0:f269e3021894 162 #define TCP_OUTPUT_DEBUG LWIP_DBG_OFF
elessair 0:f269e3021894 163 #define TCP_RST_DEBUG LWIP_DBG_OFF
elessair 0:f269e3021894 164 #define TCP_QLEN_DEBUG LWIP_DBG_OFF
elessair 0:f269e3021894 165 #define UDP_DEBUG LWIP_DBG_OFF
elessair 0:f269e3021894 166 #define TCPIP_DEBUG LWIP_DBG_OFF
elessair 0:f269e3021894 167 #define SLIP_DEBUG LWIP_DBG_OFF
elessair 0:f269e3021894 168 #define DHCP_DEBUG LWIP_DBG_OFF
elessair 0:f269e3021894 169 #define AUTOIP_DEBUG LWIP_DBG_OFF
elessair 0:f269e3021894 170 #define DNS_DEBUG LWIP_DBG_OFF
elessair 0:f269e3021894 171 #define IP6_DEBUG LWIP_DBG_OFF
elessair 0:f269e3021894 172
elessair 0:f269e3021894 173 #define PPP_DEBUG LWIP_DBG_OFF
elessair 0:f269e3021894 174 #define ETHARP_DEBUG LWIP_DBG_OFF
elessair 0:f269e3021894 175 #define UDP_LPC_EMAC LWIP_DBG_OFF
elessair 0:f269e3021894 176
elessair 0:f269e3021894 177 #ifdef LWIP_DEBUG
elessair 0:f269e3021894 178 #define MEMP_OVERFLOW_CHECK 1
elessair 0:f269e3021894 179 #define MEMP_SANITY_CHECK 1
elessair 0:f269e3021894 180 #else
elessair 0:f269e3021894 181 #define LWIP_NOASSERT 1
elessair 0:f269e3021894 182 #define LWIP_STATS 0
elessair 0:f269e3021894 183 #endif
elessair 0:f269e3021894 184
elessair 0:f269e3021894 185 #define LWIP_DBG_TYPES_ON LWIP_DBG_ON
elessair 0:f269e3021894 186 #define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL
elessair 0:f269e3021894 187
elessair 0:f269e3021894 188 #define LWIP_PLATFORM_BYTESWAP 1
elessair 0:f269e3021894 189
elessair 0:f269e3021894 190 #define LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS 1
elessair 0:f269e3021894 191
elessair 0:f269e3021894 192 #if LWIP_TRANSPORT_ETHERNET
elessair 0:f269e3021894 193
elessair 0:f269e3021894 194 // Broadcast
elessair 0:f269e3021894 195 #define IP_SOF_BROADCAST 1
elessair 0:f269e3021894 196 #define IP_SOF_BROADCAST_RECV 1
elessair 0:f269e3021894 197
elessair 0:f269e3021894 198 #define LWIP_BROADCAST_PING 1
elessair 0:f269e3021894 199
elessair 0:f269e3021894 200 #define LWIP_CHECKSUM_ON_COPY 1
elessair 0:f269e3021894 201
elessair 0:f269e3021894 202 #define LWIP_NETIF_HOSTNAME 1
elessair 0:f269e3021894 203 #define LWIP_NETIF_STATUS_CALLBACK 1
elessair 0:f269e3021894 204 #define LWIP_NETIF_LINK_CALLBACK 1
elessair 0:f269e3021894 205
elessair 0:f269e3021894 206 #elif LWIP_TRANSPORT_PPP
elessair 0:f269e3021894 207
elessair 0:f269e3021894 208 #define TCP_SND_BUF (3 * 536)
elessair 0:f269e3021894 209 #define TCP_WND (2 * 536)
elessair 0:f269e3021894 210
elessair 0:f269e3021894 211 #define LWIP_ARP 0
elessair 0:f269e3021894 212
elessair 0:f269e3021894 213 #define PPP_SUPPORT 1
elessair 0:f269e3021894 214 #define CHAP_SUPPORT 1
elessair 0:f269e3021894 215 #define PAP_SUPPORT 1
elessair 0:f269e3021894 216 #define PPP_THREAD_STACKSIZE 4*192
elessair 0:f269e3021894 217 #define PPP_THREAD_PRIO 0
elessair 0:f269e3021894 218
elessair 0:f269e3021894 219 #define MAXNAMELEN 64 /* max length of hostname or name for auth */
elessair 0:f269e3021894 220 #define MAXSECRETLEN 64
elessair 0:f269e3021894 221
elessair 0:f269e3021894 222 #else
elessair 0:f269e3021894 223 #error A transport mechanism (Ethernet or PPP) must be defined
elessair 0:f269e3021894 224 #endif
elessair 0:f269e3021894 225
elessair 0:f269e3021894 226 #endif /* LWIPOPTS_H_ */