Dependencies:   FatFileSystem mbed WeatherMeters SDFileSystem

Committer:
dcoban
Date:
Tue Apr 03 18:43:13 2012 +0000
Revision:
0:1a61c61d0845

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dcoban 0:1a61c61d0845 1 /**
dcoban 0:1a61c61d0845 2 * @file
dcoban 0:1a61c61d0845 3 * Modules initialization
dcoban 0:1a61c61d0845 4 *
dcoban 0:1a61c61d0845 5 */
dcoban 0:1a61c61d0845 6
dcoban 0:1a61c61d0845 7 /*
dcoban 0:1a61c61d0845 8 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
dcoban 0:1a61c61d0845 9 * All rights reserved.
dcoban 0:1a61c61d0845 10 *
dcoban 0:1a61c61d0845 11 * Redistribution and use in source and binary forms, with or without modification,
dcoban 0:1a61c61d0845 12 * are permitted provided that the following conditions are met:
dcoban 0:1a61c61d0845 13 *
dcoban 0:1a61c61d0845 14 * 1. Redistributions of source code must retain the above copyright notice,
dcoban 0:1a61c61d0845 15 * this list of conditions and the following disclaimer.
dcoban 0:1a61c61d0845 16 * 2. Redistributions in binary form must reproduce the above copyright notice,
dcoban 0:1a61c61d0845 17 * this list of conditions and the following disclaimer in the documentation
dcoban 0:1a61c61d0845 18 * and/or other materials provided with the distribution.
dcoban 0:1a61c61d0845 19 * 3. The name of the author may not be used to endorse or promote products
dcoban 0:1a61c61d0845 20 * derived from this software without specific prior written permission.
dcoban 0:1a61c61d0845 21 *
dcoban 0:1a61c61d0845 22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
dcoban 0:1a61c61d0845 23 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
dcoban 0:1a61c61d0845 24 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
dcoban 0:1a61c61d0845 25 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
dcoban 0:1a61c61d0845 26 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
dcoban 0:1a61c61d0845 27 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
dcoban 0:1a61c61d0845 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
dcoban 0:1a61c61d0845 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
dcoban 0:1a61c61d0845 30 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
dcoban 0:1a61c61d0845 31 * OF SUCH DAMAGE.
dcoban 0:1a61c61d0845 32 *
dcoban 0:1a61c61d0845 33 * This file is part of the lwIP TCP/IP stack.
dcoban 0:1a61c61d0845 34 *
dcoban 0:1a61c61d0845 35 * Author: Adam Dunkels <adam@sics.se>
dcoban 0:1a61c61d0845 36 *
dcoban 0:1a61c61d0845 37 */
dcoban 0:1a61c61d0845 38
dcoban 0:1a61c61d0845 39 #include "lwip/opt.h"
dcoban 0:1a61c61d0845 40
dcoban 0:1a61c61d0845 41 #include "lwip/init.h"
dcoban 0:1a61c61d0845 42 #include "lwip/stats.h"
dcoban 0:1a61c61d0845 43 #include "lwip/sys.h"
dcoban 0:1a61c61d0845 44 #include "lwip/mem.h"
dcoban 0:1a61c61d0845 45 #include "lwip/memp.h"
dcoban 0:1a61c61d0845 46 #include "lwip/pbuf.h"
dcoban 0:1a61c61d0845 47 #include "lwip/netif.h"
dcoban 0:1a61c61d0845 48 #include "lwip/sockets.h"
dcoban 0:1a61c61d0845 49 #include "lwip/ip.h"
dcoban 0:1a61c61d0845 50 #include "lwip/raw.h"
dcoban 0:1a61c61d0845 51 #include "lwip/udp.h"
dcoban 0:1a61c61d0845 52 #include "lwip/tcp_impl.h"
dcoban 0:1a61c61d0845 53 #include "lwip/snmp_msg.h"
dcoban 0:1a61c61d0845 54 #include "lwip/autoip.h"
dcoban 0:1a61c61d0845 55 #include "lwip/igmp.h"
dcoban 0:1a61c61d0845 56 #include "lwip/dns.h"
dcoban 0:1a61c61d0845 57 #include "lwip/timers.h"
dcoban 0:1a61c61d0845 58 #include "netif/etharp.h"
dcoban 0:1a61c61d0845 59
dcoban 0:1a61c61d0845 60 /* Compile-time sanity checks for configuration errors.
dcoban 0:1a61c61d0845 61 * These can be done independently of LWIP_DEBUG, without penalty.
dcoban 0:1a61c61d0845 62 */
dcoban 0:1a61c61d0845 63 #ifndef BYTE_ORDER
dcoban 0:1a61c61d0845 64 #error "BYTE_ORDER is not defined, you have to define it in your cc.h"
dcoban 0:1a61c61d0845 65 #endif
dcoban 0:1a61c61d0845 66 #if (!IP_SOF_BROADCAST && IP_SOF_BROADCAST_RECV)
dcoban 0:1a61c61d0845 67 #error "If you want to use broadcast filter per pcb on recv operations, you have to define IP_SOF_BROADCAST=1 in your lwipopts.h"
dcoban 0:1a61c61d0845 68 #endif
dcoban 0:1a61c61d0845 69 #if (!LWIP_ARP && ARP_QUEUEING)
dcoban 0:1a61c61d0845 70 #error "If you want to use ARP Queueing, you have to define LWIP_ARP=1 in your lwipopts.h"
dcoban 0:1a61c61d0845 71 #endif
dcoban 0:1a61c61d0845 72 #if (!LWIP_UDP && LWIP_UDPLITE)
dcoban 0:1a61c61d0845 73 #error "If you want to use UDP Lite, you have to define LWIP_UDP=1 in your lwipopts.h"
dcoban 0:1a61c61d0845 74 #endif
dcoban 0:1a61c61d0845 75 #if (!LWIP_UDP && LWIP_SNMP)
dcoban 0:1a61c61d0845 76 #error "If you want to use SNMP, you have to define LWIP_UDP=1 in your lwipopts.h"
dcoban 0:1a61c61d0845 77 #endif
dcoban 0:1a61c61d0845 78 #if (!LWIP_UDP && LWIP_DHCP)
dcoban 0:1a61c61d0845 79 #error "If you want to use DHCP, you have to define LWIP_UDP=1 in your lwipopts.h"
dcoban 0:1a61c61d0845 80 #endif
dcoban 0:1a61c61d0845 81 #if (!LWIP_UDP && LWIP_IGMP)
dcoban 0:1a61c61d0845 82 #error "If you want to use IGMP, you have to define LWIP_UDP=1 in your lwipopts.h"
dcoban 0:1a61c61d0845 83 #endif
dcoban 0:1a61c61d0845 84 #if (!LWIP_UDP && LWIP_SNMP)
dcoban 0:1a61c61d0845 85 #error "If you want to use SNMP, you have to define LWIP_UDP=1 in your lwipopts.h"
dcoban 0:1a61c61d0845 86 #endif
dcoban 0:1a61c61d0845 87 #if (!LWIP_UDP && LWIP_DNS)
dcoban 0:1a61c61d0845 88 #error "If you want to use DNS, you have to define LWIP_UDP=1 in your lwipopts.h"
dcoban 0:1a61c61d0845 89 #endif
dcoban 0:1a61c61d0845 90 #if (LWIP_ARP && ARP_QUEUEING && (MEMP_NUM_ARP_QUEUE<=0))
dcoban 0:1a61c61d0845 91 #error "If you want to use ARP Queueing, you have to define MEMP_NUM_ARP_QUEUE>=1 in your lwipopts.h"
dcoban 0:1a61c61d0845 92 #endif
dcoban 0:1a61c61d0845 93 #if (LWIP_RAW && (MEMP_NUM_RAW_PCB<=0))
dcoban 0:1a61c61d0845 94 #error "If you want to use RAW, you have to define MEMP_NUM_RAW_PCB>=1 in your lwipopts.h"
dcoban 0:1a61c61d0845 95 #endif
dcoban 0:1a61c61d0845 96 #if (LWIP_UDP && (MEMP_NUM_UDP_PCB<=0))
dcoban 0:1a61c61d0845 97 #error "If you want to use UDP, you have to define MEMP_NUM_UDP_PCB>=1 in your lwipopts.h"
dcoban 0:1a61c61d0845 98 #endif
dcoban 0:1a61c61d0845 99 #if (LWIP_TCP && (MEMP_NUM_TCP_PCB<=0))
dcoban 0:1a61c61d0845 100 #error "If you want to use TCP, you have to define MEMP_NUM_TCP_PCB>=1 in your lwipopts.h"
dcoban 0:1a61c61d0845 101 #endif
dcoban 0:1a61c61d0845 102 #if (LWIP_TCP && (TCP_WND > 0xffff))
dcoban 0:1a61c61d0845 103 #error "If you want to use TCP, TCP_WND must fit in an u16_t, so, you have to reduce it in your lwipopts.h"
dcoban 0:1a61c61d0845 104 #endif
dcoban 0:1a61c61d0845 105 #if (LWIP_TCP && (TCP_SND_QUEUELEN > 0xffff))
dcoban 0:1a61c61d0845 106 #error "If you want to use TCP, TCP_SND_QUEUELEN must fit in an u16_t, so, you have to reduce it in your lwipopts.h"
dcoban 0:1a61c61d0845 107 #endif
dcoban 0:1a61c61d0845 108 #if (LWIP_TCP && ((TCP_MAXRTX > 12) || (TCP_SYNMAXRTX > 12)))
dcoban 0:1a61c61d0845 109 #error "If you want to use TCP, TCP_MAXRTX and TCP_SYNMAXRTX must less or equal to 12 (due to tcp_backoff table), so, you have to reduce them in your lwipopts.h"
dcoban 0:1a61c61d0845 110 #endif
dcoban 0:1a61c61d0845 111 #if (LWIP_TCP && TCP_LISTEN_BACKLOG && (TCP_DEFAULT_LISTEN_BACKLOG < 0) || (TCP_DEFAULT_LISTEN_BACKLOG > 0xff))
dcoban 0:1a61c61d0845 112 #error "If you want to use TCP backlog, TCP_DEFAULT_LISTEN_BACKLOG must fit into an u8_t"
dcoban 0:1a61c61d0845 113 #endif
dcoban 0:1a61c61d0845 114 #if (LWIP_IGMP && (MEMP_NUM_IGMP_GROUP<=1))
dcoban 0:1a61c61d0845 115 #error "If you want to use IGMP, you have to define MEMP_NUM_IGMP_GROUP>1 in your lwipopts.h"
dcoban 0:1a61c61d0845 116 #endif
dcoban 0:1a61c61d0845 117 #if (LWIP_NETIF_API && (NO_SYS==1))
dcoban 0:1a61c61d0845 118 #error "If you want to use NETIF API, you have to define NO_SYS=0 in your lwipopts.h"
dcoban 0:1a61c61d0845 119 #endif
dcoban 0:1a61c61d0845 120 #if ((LWIP_SOCKET || LWIP_NETCONN) && (NO_SYS==1))
dcoban 0:1a61c61d0845 121 #error "If you want to use Sequential API, you have to define NO_SYS=0 in your lwipopts.h"
dcoban 0:1a61c61d0845 122 #endif
dcoban 0:1a61c61d0845 123 #if ((LWIP_NETCONN || LWIP_SOCKET) && (MEMP_NUM_TCPIP_MSG_API<=0))
dcoban 0:1a61c61d0845 124 #error "If you want to use Sequential API, you have to define MEMP_NUM_TCPIP_MSG_API>=1 in your lwipopts.h"
dcoban 0:1a61c61d0845 125 #endif
dcoban 0:1a61c61d0845 126 #if (!LWIP_NETCONN && LWIP_SOCKET)
dcoban 0:1a61c61d0845 127 #error "If you want to use Socket API, you have to define LWIP_NETCONN=1 in your lwipopts.h"
dcoban 0:1a61c61d0845 128 #endif
dcoban 0:1a61c61d0845 129 #if (((!LWIP_DHCP) || (!LWIP_AUTOIP)) && LWIP_DHCP_AUTOIP_COOP)
dcoban 0:1a61c61d0845 130 #error "If you want to use DHCP/AUTOIP cooperation mode, you have to define LWIP_DHCP=1 and LWIP_AUTOIP=1 in your lwipopts.h"
dcoban 0:1a61c61d0845 131 #endif
dcoban 0:1a61c61d0845 132 #if (((!LWIP_DHCP) || (!LWIP_ARP)) && DHCP_DOES_ARP_CHECK)
dcoban 0:1a61c61d0845 133 #error "If you want to use DHCP ARP checking, you have to define LWIP_DHCP=1 and LWIP_ARP=1 in your lwipopts.h"
dcoban 0:1a61c61d0845 134 #endif
dcoban 0:1a61c61d0845 135 #if (!LWIP_ARP && LWIP_AUTOIP)
dcoban 0:1a61c61d0845 136 #error "If you want to use AUTOIP, you have to define LWIP_ARP=1 in your lwipopts.h"
dcoban 0:1a61c61d0845 137 #endif
dcoban 0:1a61c61d0845 138 #if (LWIP_SNMP && (SNMP_CONCURRENT_REQUESTS<=0))
dcoban 0:1a61c61d0845 139 #error "If you want to use SNMP, you have to define SNMP_CONCURRENT_REQUESTS>=1 in your lwipopts.h"
dcoban 0:1a61c61d0845 140 #endif
dcoban 0:1a61c61d0845 141 #if (LWIP_SNMP && (SNMP_TRAP_DESTINATIONS<=0))
dcoban 0:1a61c61d0845 142 #error "If you want to use SNMP, you have to define SNMP_TRAP_DESTINATIONS>=1 in your lwipopts.h"
dcoban 0:1a61c61d0845 143 #endif
dcoban 0:1a61c61d0845 144 #if (LWIP_TCP && ((LWIP_EVENT_API && LWIP_CALLBACK_API) || (!LWIP_EVENT_API && !LWIP_CALLBACK_API)))
dcoban 0:1a61c61d0845 145 #error "One and exactly one of LWIP_EVENT_API and LWIP_CALLBACK_API has to be enabled in your lwipopts.h"
dcoban 0:1a61c61d0845 146 #endif
dcoban 0:1a61c61d0845 147 /* There must be sufficient timeouts, taking into account requirements of the subsystems. */
dcoban 0:1a61c61d0845 148 #if LWIP_TIMERS && (MEMP_NUM_SYS_TIMEOUT < (LWIP_TCP + IP_REASSEMBLY + LWIP_ARP + (2*LWIP_DHCP) + LWIP_AUTOIP + LWIP_IGMP + LWIP_DNS + PPP_SUPPORT))
dcoban 0:1a61c61d0845 149 #error "MEMP_NUM_SYS_TIMEOUT is too low to accomodate all required timeouts"
dcoban 0:1a61c61d0845 150 #endif
dcoban 0:1a61c61d0845 151 #if (IP_REASSEMBLY && (MEMP_NUM_REASSDATA > IP_REASS_MAX_PBUFS))
dcoban 0:1a61c61d0845 152 #error "MEMP_NUM_REASSDATA > IP_REASS_MAX_PBUFS doesn't make sense since each struct ip_reassdata must hold 2 pbufs at least!"
dcoban 0:1a61c61d0845 153 #endif
dcoban 0:1a61c61d0845 154 #if (MEM_LIBC_MALLOC && MEM_USE_POOLS)
dcoban 0:1a61c61d0845 155 #error "MEM_LIBC_MALLOC and MEM_USE_POOLS may not both be simultaneously enabled in your lwipopts.h"
dcoban 0:1a61c61d0845 156 #endif
dcoban 0:1a61c61d0845 157 #if (MEM_USE_POOLS && !MEMP_USE_CUSTOM_POOLS)
dcoban 0:1a61c61d0845 158 #error "MEM_USE_POOLS requires custom pools (MEMP_USE_CUSTOM_POOLS) to be enabled in your lwipopts.h"
dcoban 0:1a61c61d0845 159 #endif
dcoban 0:1a61c61d0845 160 #if (PBUF_POOL_BUFSIZE <= MEM_ALIGNMENT)
dcoban 0:1a61c61d0845 161 #error "PBUF_POOL_BUFSIZE must be greater than MEM_ALIGNMENT or the offset may take the full first pbuf"
dcoban 0:1a61c61d0845 162 #endif
dcoban 0:1a61c61d0845 163 #if (TCP_QUEUE_OOSEQ && !LWIP_TCP)
dcoban 0:1a61c61d0845 164 #error "TCP_QUEUE_OOSEQ requires LWIP_TCP"
dcoban 0:1a61c61d0845 165 #endif
dcoban 0:1a61c61d0845 166 #if (DNS_LOCAL_HOSTLIST && !DNS_LOCAL_HOSTLIST_IS_DYNAMIC && !(defined(DNS_LOCAL_HOSTLIST_INIT)))
dcoban 0:1a61c61d0845 167 #error "you have to define define DNS_LOCAL_HOSTLIST_INIT {{'host1', 0x123}, {'host2', 0x234}} to initialize DNS_LOCAL_HOSTLIST"
dcoban 0:1a61c61d0845 168 #endif
dcoban 0:1a61c61d0845 169 #if PPP_SUPPORT && !PPPOS_SUPPORT & !PPPOE_SUPPORT
dcoban 0:1a61c61d0845 170 #error "PPP_SUPPORT needs either PPPOS_SUPPORT or PPPOE_SUPPORT turned on"
dcoban 0:1a61c61d0845 171 #endif
dcoban 0:1a61c61d0845 172 #if !LWIP_ETHERNET && (LWIP_ARP || PPPOE_SUPPORT)
dcoban 0:1a61c61d0845 173 #error "LWIP_ETHERNET needs to be turned on for LWIP_ARP or PPPOE_SUPPORT"
dcoban 0:1a61c61d0845 174 #endif
dcoban 0:1a61c61d0845 175 #if LWIP_IGMP && !defined(LWIP_RAND)
dcoban 0:1a61c61d0845 176 #error "When using IGMP, LWIP_RAND() needs to be defined to a random-function returning an u32_t random value"
dcoban 0:1a61c61d0845 177 #endif
dcoban 0:1a61c61d0845 178 #if LWIP_TCPIP_CORE_LOCKING_INPUT && !LWIP_TCPIP_CORE_LOCKING
dcoban 0:1a61c61d0845 179 #error "When using LWIP_TCPIP_CORE_LOCKING_INPUT, LWIP_TCPIP_CORE_LOCKING must be enabled, too"
dcoban 0:1a61c61d0845 180 #endif
dcoban 0:1a61c61d0845 181 #if LWIP_TCP && LWIP_NETIF_TX_SINGLE_PBUF && !TCP_OVERSIZE
dcoban 0:1a61c61d0845 182 #error "LWIP_NETIF_TX_SINGLE_PBUF needs TCP_OVERSIZE enabled to create single-pbuf TCP packets"
dcoban 0:1a61c61d0845 183 #endif
dcoban 0:1a61c61d0845 184 #if IP_FRAG && IP_FRAG_USES_STATIC_BUF && LWIP_NETIF_TX_SINGLE_PBUF
dcoban 0:1a61c61d0845 185 #error "LWIP_NETIF_TX_SINGLE_PBUF does not work with IP_FRAG_USES_STATIC_BUF==1 as that creates pbuf queues"
dcoban 0:1a61c61d0845 186 #endif
dcoban 0:1a61c61d0845 187
dcoban 0:1a61c61d0845 188
dcoban 0:1a61c61d0845 189 /* Compile-time checks for deprecated options.
dcoban 0:1a61c61d0845 190 */
dcoban 0:1a61c61d0845 191 #ifdef MEMP_NUM_TCPIP_MSG
dcoban 0:1a61c61d0845 192 #error "MEMP_NUM_TCPIP_MSG option is deprecated. Remove it from your lwipopts.h."
dcoban 0:1a61c61d0845 193 #endif
dcoban 0:1a61c61d0845 194 #ifdef MEMP_NUM_API_MSG
dcoban 0:1a61c61d0845 195 #error "MEMP_NUM_API_MSG option is deprecated. Remove it from your lwipopts.h."
dcoban 0:1a61c61d0845 196 #endif
dcoban 0:1a61c61d0845 197 #ifdef TCP_REXMIT_DEBUG
dcoban 0:1a61c61d0845 198 #error "TCP_REXMIT_DEBUG option is deprecated. Remove it from your lwipopts.h."
dcoban 0:1a61c61d0845 199 #endif
dcoban 0:1a61c61d0845 200 #ifdef RAW_STATS
dcoban 0:1a61c61d0845 201 #error "RAW_STATS option is deprecated. Remove it from your lwipopts.h."
dcoban 0:1a61c61d0845 202 #endif
dcoban 0:1a61c61d0845 203 #ifdef ETHARP_QUEUE_FIRST
dcoban 0:1a61c61d0845 204 #error "ETHARP_QUEUE_FIRST option is deprecated. Remove it from your lwipopts.h."
dcoban 0:1a61c61d0845 205 #endif
dcoban 0:1a61c61d0845 206 #ifdef ETHARP_ALWAYS_INSERT
dcoban 0:1a61c61d0845 207 #error "ETHARP_ALWAYS_INSERT option is deprecated. Remove it from your lwipopts.h."
dcoban 0:1a61c61d0845 208 #endif
dcoban 0:1a61c61d0845 209
dcoban 0:1a61c61d0845 210 #ifdef LWIP_DEBUG
dcoban 0:1a61c61d0845 211 static void
dcoban 0:1a61c61d0845 212 lwip_sanity_check(void)
dcoban 0:1a61c61d0845 213 {
dcoban 0:1a61c61d0845 214 /* Warnings */
dcoban 0:1a61c61d0845 215 #if LWIP_NETCONN
dcoban 0:1a61c61d0845 216 if (MEMP_NUM_NETCONN > (MEMP_NUM_TCP_PCB+MEMP_NUM_TCP_PCB_LISTEN+MEMP_NUM_UDP_PCB+MEMP_NUM_RAW_PCB))
dcoban 0:1a61c61d0845 217 LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: MEMP_NUM_NETCONN should be less than the sum of MEMP_NUM_{TCP,RAW,UDP}_PCB+MEMP_NUM_TCP_PCB_LISTEN\n"));
dcoban 0:1a61c61d0845 218 #endif /* LWIP_NETCONN */
dcoban 0:1a61c61d0845 219 #if LWIP_TCP
dcoban 0:1a61c61d0845 220 if (MEMP_NUM_TCP_SEG < TCP_SND_QUEUELEN)
dcoban 0:1a61c61d0845 221 LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: MEMP_NUM_TCP_SEG should be at least as big as TCP_SND_QUEUELEN\n"));
dcoban 0:1a61c61d0845 222 if (TCP_SND_BUF < 2 * TCP_MSS)
dcoban 0:1a61c61d0845 223 LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: TCP_SND_BUF must be at least as much as (2 * TCP_MSS) for things to work smoothly\n"));
dcoban 0:1a61c61d0845 224 if (TCP_SND_QUEUELEN < (2 * (TCP_SND_BUF/TCP_MSS)))
dcoban 0:1a61c61d0845 225 LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: TCP_SND_QUEUELEN must be at least as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work\n"));
dcoban 0:1a61c61d0845 226 if (TCP_SNDLOWAT >= TCP_SND_BUF)
dcoban 0:1a61c61d0845 227 LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: TCP_SNDLOWAT must be less than TCP_SND_BUF.\n"));
dcoban 0:1a61c61d0845 228 if (TCP_SNDQUEUELOWAT >= TCP_SND_QUEUELEN)
dcoban 0:1a61c61d0845 229 LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: TCP_SNDQUEUELOWAT must be less than TCP_SND_QUEUELEN.\n"));
dcoban 0:1a61c61d0845 230 if (TCP_WND > (PBUF_POOL_SIZE*PBUF_POOL_BUFSIZE))
dcoban 0:1a61c61d0845 231 LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: TCP_WND is larger than space provided by PBUF_POOL_SIZE*PBUF_POOL_BUFSIZE\n"));
dcoban 0:1a61c61d0845 232 if (TCP_WND < TCP_MSS)
dcoban 0:1a61c61d0845 233 LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: TCP_WND is smaller than MSS\n"));
dcoban 0:1a61c61d0845 234 #endif /* LWIP_TCP */
dcoban 0:1a61c61d0845 235 #if LWIP_SOCKET
dcoban 0:1a61c61d0845 236 /* Check that the SO_* socket options and SOF_* lwIP-internal flags match */
dcoban 0:1a61c61d0845 237 if (SO_ACCEPTCONN != SOF_ACCEPTCONN)
dcoban 0:1a61c61d0845 238 LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: SO_ACCEPTCONN != SOF_ACCEPTCONN\n"));
dcoban 0:1a61c61d0845 239 if (SO_REUSEADDR != SOF_REUSEADDR)
dcoban 0:1a61c61d0845 240 LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: SO_REUSEADDR != SOF_REUSEADDR\n"));
dcoban 0:1a61c61d0845 241 if (SO_KEEPALIVE != SOF_KEEPALIVE)
dcoban 0:1a61c61d0845 242 LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: SO_KEEPALIVE != SOF_KEEPALIVE\n"));
dcoban 0:1a61c61d0845 243 if (SO_BROADCAST != SOF_BROADCAST)
dcoban 0:1a61c61d0845 244 LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: SO_BROADCAST != SOF_BROADCAST\n"));
dcoban 0:1a61c61d0845 245 if (SO_LINGER != SOF_LINGER)
dcoban 0:1a61c61d0845 246 LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: SO_LINGER != SOF_LINGER\n"));
dcoban 0:1a61c61d0845 247 #endif /* LWIP_SOCKET */
dcoban 0:1a61c61d0845 248 }
dcoban 0:1a61c61d0845 249 #else /* LWIP_DEBUG */
dcoban 0:1a61c61d0845 250 #define lwip_sanity_check()
dcoban 0:1a61c61d0845 251 #endif /* LWIP_DEBUG */
dcoban 0:1a61c61d0845 252
dcoban 0:1a61c61d0845 253 /**
dcoban 0:1a61c61d0845 254 * Perform Sanity check of user-configurable values, and initialize all modules.
dcoban 0:1a61c61d0845 255 */
dcoban 0:1a61c61d0845 256 void
dcoban 0:1a61c61d0845 257 lwip_init(void)
dcoban 0:1a61c61d0845 258 {
dcoban 0:1a61c61d0845 259 /* Sanity check user-configurable values */
dcoban 0:1a61c61d0845 260 lwip_sanity_check();
dcoban 0:1a61c61d0845 261
dcoban 0:1a61c61d0845 262 /* Modules initialization */
dcoban 0:1a61c61d0845 263 stats_init();
dcoban 0:1a61c61d0845 264 #if !NO_SYS
dcoban 0:1a61c61d0845 265 sys_init();
dcoban 0:1a61c61d0845 266 #endif /* !NO_SYS */
dcoban 0:1a61c61d0845 267 mem_init();
dcoban 0:1a61c61d0845 268 memp_init();
dcoban 0:1a61c61d0845 269 pbuf_init();
dcoban 0:1a61c61d0845 270 netif_init();
dcoban 0:1a61c61d0845 271 #if LWIP_SOCKET
dcoban 0:1a61c61d0845 272 lwip_socket_init();
dcoban 0:1a61c61d0845 273 #endif /* LWIP_SOCKET */
dcoban 0:1a61c61d0845 274 ip_init();
dcoban 0:1a61c61d0845 275 #if LWIP_ARP
dcoban 0:1a61c61d0845 276 etharp_init();
dcoban 0:1a61c61d0845 277 #endif /* LWIP_ARP */
dcoban 0:1a61c61d0845 278 #if LWIP_RAW
dcoban 0:1a61c61d0845 279 raw_init();
dcoban 0:1a61c61d0845 280 #endif /* LWIP_RAW */
dcoban 0:1a61c61d0845 281 #if LWIP_UDP
dcoban 0:1a61c61d0845 282 udp_init();
dcoban 0:1a61c61d0845 283 #endif /* LWIP_UDP */
dcoban 0:1a61c61d0845 284 #if LWIP_TCP
dcoban 0:1a61c61d0845 285 tcp_init();
dcoban 0:1a61c61d0845 286 #endif /* LWIP_TCP */
dcoban 0:1a61c61d0845 287 #if LWIP_SNMP
dcoban 0:1a61c61d0845 288 snmp_init();
dcoban 0:1a61c61d0845 289 #endif /* LWIP_SNMP */
dcoban 0:1a61c61d0845 290 #if LWIP_AUTOIP
dcoban 0:1a61c61d0845 291 autoip_init();
dcoban 0:1a61c61d0845 292 #endif /* LWIP_AUTOIP */
dcoban 0:1a61c61d0845 293 #if LWIP_IGMP
dcoban 0:1a61c61d0845 294 igmp_init();
dcoban 0:1a61c61d0845 295 #endif /* LWIP_IGMP */
dcoban 0:1a61c61d0845 296 #if LWIP_DNS
dcoban 0:1a61c61d0845 297 dns_init();
dcoban 0:1a61c61d0845 298 #endif /* LWIP_DNS */
dcoban 0:1a61c61d0845 299
dcoban 0:1a61c61d0845 300 #if LWIP_TIMERS
dcoban 0:1a61c61d0845 301 sys_timeouts_init();
dcoban 0:1a61c61d0845 302 #endif /* LWIP_TIMERS */
dcoban 0:1a61c61d0845 303 }