Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of F7_Ethernet by
net_decl_lwip.h
00001 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 00002 // Copyright (c) Microsoft Corporation. All rights reserved. 00003 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 00004 00005 #ifndef _NET_DECL_LWIP_H_ 00006 #define _NET_DECL_LWIP_H_ 00007 00008 #ifndef TCPIP_LWIP 00009 #include <lwip_selector.h> 00010 #endif 00011 00012 #ifndef TCPIP_LWIP 00013 #error Only include net_decl_lwip.h when using LWIP stack 00014 #endif 00015 00016 #include "network_defines_lwip.h" 00017 00018 #define NO_SYS 0 00019 #define ERRNO 1 00020 00021 00022 #ifdef PLATFORM_DEPENDENT__MEM_SIZE 00023 #define MEM_SIZE PLATFORM_DEPENDENT__MEM_SIZE 00024 #else 00025 #define MEM_SIZE MEM_SIZE__default 00026 #endif 00027 00028 #ifdef PLATFORM_DEPENDENT__MEMP_NUM_PBUF 00029 #define MEMP_NUM_PBUF PLATFORM_DEPENDENT__MEMP_NUM_PBUF 00030 #else 00031 #define MEMP_NUM_PBUF MEMP_NUM_PBUF__default 00032 #endif 00033 00034 #ifdef PLATFORM_DEPENDENT__MEMP_NUM_UDP_PCB 00035 #define MEMP_NUM_UDP_PCB PLATFORM_DEPENDENT__MEMP_NUM_UDP_PCB 00036 #else 00037 #define MEMP_NUM_UDP_PCB MEMP_NUM_UDP_PCB__default 00038 #endif 00039 00040 #ifdef PLATFORM_DEPENDENT__MEMP_NUM_TCP_PCB 00041 #define MEMP_NUM_TCP_PCB PLATFORM_DEPENDENT__MEMP_NUM_TCP_PCB 00042 #else 00043 #define MEMP_NUM_TCP_PCB MEMP_NUM_TCP_PCB__default 00044 #endif 00045 00046 #ifdef PLATFORM_DEPENDENT__MEMP_NUM_TCP_PCB_LISTEN 00047 #define MEMP_NUM_TCP_PCB_LISTEN PLATFORM_DEPENDENT__MEMP_NUM_TCP_PCB_LISTEN 00048 #else 00049 #define MEMP_NUM_TCP_PCB_LISTEN MEMP_NUM_TCP_PCB_LISTEN__default 00050 #endif 00051 00052 #ifdef PLATFORM_DEPENDENT__MEMP_NUM_TCP_SEG 00053 #define MEMP_NUM_TCP_SEG PLATFORM_DEPENDENT__MEMP_NUM_TCP_SEG 00054 #else 00055 #define MEMP_NUM_TCP_SEG MEMP_NUM_TCP_SEG__default 00056 #endif 00057 00058 #ifdef PLATFORM_DEPENDENT__MEMP_NUM_SYS_TIMEOUT 00059 #define MEMP_NUM_SYS_TIMEOUT PLATFORM_DEPENDENT__MEMP_NUM_SYS_TIMEOUT 00060 #else 00061 #define MEMP_NUM_SYS_TIMEOUT MEMP_NUM_SYS_TIMEOUT__default 00062 #endif 00063 00064 #ifdef PLATFORM_DEPENDENT__MEMP_NUM_NETBUF 00065 #define MEMP_NUM_NETBUF PLATFORM_DEPENDENT__MEMP_NUM_NETBUF 00066 #else 00067 #define MEMP_NUM_NETBUF MEMP_NUM_NETBUF__default 00068 #endif 00069 00070 #ifdef PLATFORM_DEPENDENT__MEMP_NUM_NETCONN 00071 #define MEMP_NUM_NETCONN PLATFORM_DEPENDENT__MEMP_NUM_NETCONN 00072 #else 00073 #define MEMP_NUM_NETCONN MEMP_NUM_NETCONN__default 00074 #endif 00075 00076 #ifdef PLATFORM_DEPENDENT__PBUF_POOL_SIZE 00077 #define PBUF_POOL_SIZE PLATFORM_DEPENDENT__PBUF_POOL_SIZE 00078 #else 00079 #define PBUF_POOL_SIZE PBUF_POOL_SIZE__default 00080 #endif 00081 00082 #ifdef PLATFORM_DEPENDENT__PBUF_POOL_BUFSIZE 00083 #define PBUF_POOL_BUFSIZE PLATFORM_DEPENDENT__PBUF_POOL_BUFSIZE 00084 #else 00085 #define PBUF_POOL_BUFSIZE PBUF_POOL_BUFSIZE__default 00086 #endif 00087 00088 #ifdef PLATFORM_DEPENDENT__TCP_MSS 00089 #define TCP_MSS PLATFORM_DEPENDENT__TCP_MSS 00090 #else 00091 #define TCP_MSS TCP_MSS__default 00092 #endif 00093 00094 #ifdef PLATFORM_DEPENDENT__TCP_SND_BUF 00095 #define TCP_SND_BUF PLATFORM_DEPENDENT__TCP_SND_BUF 00096 #else 00097 #define TCP_SND_BUF TCP_SND_BUF__default 00098 #endif 00099 00100 #ifdef PLATFORM_DEPENDENT__TCP_SND_QUEUELEN 00101 #define TCP_SND_QUEUELEN PLATFORM_DEPENDENT__TCP_SND_QUEUELEN 00102 #else 00103 #define TCP_SND_QUEUELEN TCP_SND_QUEUELEN__default 00104 #endif 00105 00106 #ifdef PLATFORM_DEPENDENT__TCP_WND 00107 #define TCP_WND PLATFORM_DEPENDENT__TCP_WND 00108 #else 00109 #define TCP_WND TCP_WND__default 00110 #endif 00111 00112 #ifdef PLATFORM_DEPENDENT__TCP_SNDLOWAT 00113 #define TCP_SNDLOWAT PLATFORM_DEPENDENT__TCP_SNDLOWAT 00114 #else 00115 #define TCP_SNDLOWAT TCP_SNDLOWAT__default 00116 #endif 00117 00118 //--// 00119 00120 /* LWIP options that are the same for all configurations */ 00121 00122 /* MEM_ALIGNMENT: should be set to the alignment of the CPU for which 00123 lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2 00124 byte alignment -> define MEM_ALIGNMENT to 2. */ 00125 #ifndef MEM_ALIGNMENT 00126 #define MEM_ALIGNMENT 4 00127 #endif 00128 00129 /* These two control whether reclaimer functions should be compiled 00130 in. Should always be turned on (1). */ 00131 #ifndef MEM_RECLAIM 00132 #define MEM_RECLAIM 1 00133 #endif 00134 #ifndef MEMP_RECLAIM 00135 #define MEMP_RECLAIM 1 00136 #endif 00137 00138 #ifndef ETH_PAD_SIZE 00139 #define ETH_PAD_SIZE 0 00140 #endif 00141 00142 /* PBUF_LINK_HLEN: the number of bytes that should be allocated for a 00143 link level header. */ 00144 #ifndef PBUF_LINK_HLEN 00145 #define PBUF_LINK_HLEN (14 + ETH_PAD_SIZE) 00146 #endif 00147 00148 /* ---------- TCP options ---------- */ 00149 #ifndef LWIP_TCP 00150 #define LWIP_TCP 1 00151 #endif 00152 #ifndef TCP_TTL 00153 #define TCP_TTL 255 00154 #endif 00155 00156 #ifndef TCP_OVERSIZE 00157 #define TCP_OVERSIZE TCP_MSS 00158 #endif 00159 00160 /* Controls if TCP should queue segments that arrive out of 00161 order. Define to 0 if your device is low on memory. */ 00162 #ifndef TCP_QUEUE_OOSEQ 00163 #define TCP_QUEUE_OOSEQ 0 00164 #endif 00165 00166 /* Maximum number of retransmissions of data segments. */ 00167 #ifndef TCP_MAXRTX 00168 #define TCP_MAXRTX 6 00169 #endif 00170 00171 /* Maximum number of retransmissions of SYN segments. */ 00172 #ifndef TCP_SYNMAXRTX 00173 #define TCP_SYNMAXRTX 4 00174 #endif 00175 00176 /* ---------- ARP options ---------- */ 00177 #ifndef ARP_TABLE_SIZE 00178 #define ARP_TABLE_SIZE 10 00179 #endif 00180 #ifndef ARP_QUEUEING 00181 #define ARP_QUEUEING 0 00182 #endif 00183 00184 /* ---------- IP options ---------- */ 00185 /* Define IP_FORWARD to 1 if you wish to have the ability to forward 00186 IP packets across network interfaces. If you are going to run lwIP 00187 on a device with only one network interface, define this to 0. */ 00188 #ifndef IP_FORWARD 00189 #define IP_FORWARD 1 00190 #endif 00191 00192 /* If defined to 1, IP options are allowed (but not parsed). If 00193 defined to 0, all packets with IP options are dropped. */ 00194 #ifndef IP_OPTIONS 00195 #define IP_OPTIONS 1 00196 #endif 00197 00198 /* IP reassembly and segmentation.These are orthogonal even 00199 * if they both deal with IP fragments */ 00200 #ifndef IP_REASSEMBLY 00201 #define IP_REASSEMBLY 1 00202 #endif 00203 #ifndef IP_FRAG 00204 #define IP_FRAG 1 00205 #endif 00206 00207 /* ---------- ICMP options ---------- */ 00208 #ifndef ICMP_TTL 00209 #define ICMP_TTL 255 00210 #endif 00211 00212 /* ---------- DHCP options ---------- */ 00213 /* Define LWIP_DHCP to 1 if you want DHCP configuration of 00214 interfaces. */ 00215 #ifndef LWIP_DHCP 00216 #define LWIP_DHCP 1 00217 #endif 00218 00219 /* 1 if you want to do an ARP check on the offered address 00220 (recommended). */ 00221 #ifndef DHCP_DOES_ARP_CHECK 00222 #define DHCP_DOES_ARP_CHECK 0 00223 #endif 00224 00225 /* ---------- UDP options ---------- */ 00226 #ifndef LWIP_UDP 00227 #define LWIP_UDP 1 00228 #endif 00229 #ifndef UDP_TTL 00230 #define UDP_TTL 255 00231 #endif 00232 00233 /* ---------- Statistics options ---------- */ 00234 #ifndef LWIP_STATS 00235 #define LWIP_STATS 0 00236 #endif 00237 00238 /** SYS_LIGHTWEIGHT_PROT 00239 * define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task 00240 * protection for certain critical regions during buffer allocation 00241 * and deallocation and memory allocation and deallocation. 00242 */ 00243 #ifndef SYS_LIGHTWEIGHT_PROT 00244 #define SYS_LIGHTWEIGHT_PROT 1 00245 #endif 00246 00247 #ifndef LWIP_COMPAT_SOCKETS 00248 #define LWIP_COMPAT_SOCKETS 1 00249 #endif 00250 00251 #ifndef LWIP_PROVIDE_ERRNO 00252 #define LWIP_PROVIDE_ERRNO 1 00253 #endif 00254 00255 /* ---------- SNMP options ---------- */ 00256 #ifndef LWIP_SNMP 00257 #define LWIP_SNMP 0 /*LwIP 1.2.0*/ 00258 #endif 00259 #ifndef LWIP_IGMP 00260 #define LWIP_IGMP 1 /*LwIP 1.2.0*/ 00261 #endif 00262 00263 // thread priorities are in VDK terms - 1 is highest, 30 is lowest 00264 #ifndef TCPIP_THREAD_PRIO 00265 #define TCPIP_THREAD_PRIO 5 00266 #endif 00267 #ifndef DEFAULT_THREAD_PRIO 00268 #define DEFAULT_THREAD_PRIO 10 00269 #endif 00270 #ifndef LOW_THREAD_PRIO 00271 #define LOW_THREAD_PRIO 29 00272 #endif 00273 00274 //--// RAM size estimate macro 00275 00276 #if 0 // TODO - implement similar for LWIP 00277 #define NETWORK_RAM_SIZE_ESTIMATE() (\ 00278 _NETWORK_SIZEOF_NONE + \ 00279 NETWORK_MULTICAST_LIST_SIZE * (_NETWORK_SIZEOF_MCLISTSIZE) + \ 00280 NETWORK_PACKET_POOL_0__NUM_PACKETS * (NETWORK_PACKET_POOL_0__PACKET_SIZE + _NETWORK_SIZEOF_DCU) + \ 00281 NETWORK_PACKET_POOL_1__NUM_PACKETS * (NETWORK_PACKET_POOL_1__PACKET_SIZE + _NETWORK_SIZEOF_DCU) + \ 00282 NETWORK_PACKET_POOL_2__NUM_PACKETS * (NETWORK_PACKET_POOL_2__PACKET_SIZE + _NETWORK_SIZEOF_DCU) + \ 00283 NETWORK_PACKET_POOL_3__NUM_PACKETS * (NETWORK_PACKET_POOL_3__PACKET_SIZE + _NETWORK_SIZEOF_DCU) + \ 00284 NETWORK_PACKET_POOL_4__NUM_PACKETS * (NETWORK_PACKET_POOL_4__PACKET_SIZE + _NETWORK_SIZEOF_DCU) + \ 00285 NETWORK_PACKET_POOL_5__NUM_PACKETS * (NETWORK_PACKET_POOL_5__PACKET_SIZE + _NETWORK_SIZEOF_DCU) + \ 00286 _NETWORK_TOTAL_PACKET_COUNT * _NETWORK_SIZEOF_PACKET_OVERHEAD + \ 00287 NETWORK_NUM_IFACES * _NETWORK_SIZEOF_IFACE + \ 00288 NETWORK_ROUTINGTABLE_SIZE * _NETWORK_SIZEOF_ROUTINGTABLE + \ 00289 NETWORK_ARP_NUM_TABLE_ENTRIES * _NETWORK_SIZEOF_ARP_ENTRY + \ 00290 NETWORK_TCP_NUM_PORTS__SUPPORTED * _NETWORK_SIZEOF_TCPPORT + \ 00291 NETWORK_UDP_NUM_PORTS__SUPPORTED * _NETWORK_SIZEOF_UDPPORT + \ 00292 NETWORK_FRAG_TABLE_SIZE * _NETWORK_SIZEOF_FRAG_ENTRY + \ 00293 NETWORK_NAT_NUM_ENTRIES * _NETWORK_SIZEOF_NAT_ENTRY ) \ 00294 00295 typedef char NETWORK_COMPILE_TIME_ASSERT[NETWORK_MEMORY_POOL__SIZE - NETWORK_RAM_SIZE_ESTIMATE()]; 00296 #endif 00297 00298 #endif //_NET_DECL_LWIP_H_ 00299
Generated on Wed Jul 13 2022 02:45:41 by
1.7.2
