Ethernet for Nucleo and Disco board STM32F746 works with gcc and arm. IAC is untested

Dependents:   STM32F746_iothub_client_sample_mqtt DISCO-F746NG_Ethernet Nucleo_F746ZG_Ethernet thethingsiO-DISCO_F746NG-mqtt ... more

Committer:
DieterGraef
Date:
Thu Jun 23 09:04:23 2016 +0000
Revision:
1:28ba13dd96f7
Parent:
0:d26c1b55cfca
corrected MAC issue. The MAC is now 02:00:00:xx:xx:xx where xx is the sum over the unique device register

Who changed what in which revision?

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