ProjetoBB

Dependencies:   F7_Ethernet WebSocketClient mbed mcp3008

Fork of Nucleo_F746ZG_Ethernet by Dieter Graef

Committer:
DieterGraef
Date:
Sat Jun 18 10:49:12 2016 +0000
Revision:
0:f9b6112278fe
Ethernet for the NUCLEO STM32F746 Board Testprogram uses DHCP and NTP to set the clock

Who changed what in which revision?

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