Read NTP time from Ethernet and drive six 7-segment LEDs using a MAX7221 to show time, date, month, week, year etc....

Dependencies:   NTPClient_NetServices mbed

Committer:
cheungderek
Date:
Wed Jun 22 01:31:47 2011 +0000
Revision:
0:e083abcfe7a8
First release.
Just some testing but working code to read NTP time and drive 6 LEDs to display time, date, month, year etc...

Who changed what in which revision?

UserRevisionLine numberNew contents of line
cheungderek 0:e083abcfe7a8 1 /*
cheungderek 0:e083abcfe7a8 2 * Copyright (c) 2001-2003 Swedish Institute of Computer Science.
cheungderek 0:e083abcfe7a8 3 * All rights reserved.
cheungderek 0:e083abcfe7a8 4 *
cheungderek 0:e083abcfe7a8 5 * Redistribution and use in source and binary forms, with or without modification,
cheungderek 0:e083abcfe7a8 6 * are permitted provided that the following conditions are met:
cheungderek 0:e083abcfe7a8 7 *
cheungderek 0:e083abcfe7a8 8 * 1. Redistributions of source code must retain the above copyright notice,
cheungderek 0:e083abcfe7a8 9 * this list of conditions and the following disclaimer.
cheungderek 0:e083abcfe7a8 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
cheungderek 0:e083abcfe7a8 11 * this list of conditions and the following disclaimer in the documentation
cheungderek 0:e083abcfe7a8 12 * and/or other materials provided with the distribution.
cheungderek 0:e083abcfe7a8 13 * 3. The name of the author may not be used to endorse or promote products
cheungderek 0:e083abcfe7a8 14 * derived from this software without specific prior written permission.
cheungderek 0:e083abcfe7a8 15 *
cheungderek 0:e083abcfe7a8 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
cheungderek 0:e083abcfe7a8 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
cheungderek 0:e083abcfe7a8 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
cheungderek 0:e083abcfe7a8 19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
cheungderek 0:e083abcfe7a8 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
cheungderek 0:e083abcfe7a8 21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
cheungderek 0:e083abcfe7a8 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
cheungderek 0:e083abcfe7a8 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
cheungderek 0:e083abcfe7a8 24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
cheungderek 0:e083abcfe7a8 25 * OF SUCH DAMAGE.
cheungderek 0:e083abcfe7a8 26 *
cheungderek 0:e083abcfe7a8 27 * This file is part of the lwIP TCP/IP stack.
cheungderek 0:e083abcfe7a8 28 *
cheungderek 0:e083abcfe7a8 29 * Author: Adam Dunkels <adam@sics.se>
cheungderek 0:e083abcfe7a8 30 *
cheungderek 0:e083abcfe7a8 31 */
cheungderek 0:e083abcfe7a8 32 #ifndef __LWIPOPTS_H__
cheungderek 0:e083abcfe7a8 33 #define __LWIPOPTS_H__
cheungderek 0:e083abcfe7a8 34
cheungderek 0:e083abcfe7a8 35 #include "netCfg.h"
cheungderek 0:e083abcfe7a8 36 #if NET_LWIP_STACK
cheungderek 0:e083abcfe7a8 37
cheungderek 0:e083abcfe7a8 38 //#include "arch/sys_arch.h"
cheungderek 0:e083abcfe7a8 39
cheungderek 0:e083abcfe7a8 40 /* <sys/time.h> is included in cc.h! */
cheungderek 0:e083abcfe7a8 41 #define LWIP_TIMEVAL_PRIVATE 0
cheungderek 0:e083abcfe7a8 42
cheungderek 0:e083abcfe7a8 43 //#define __LWIP_DEBUG
cheungderek 0:e083abcfe7a8 44 #include "dbg/dbg.h"
cheungderek 0:e083abcfe7a8 45
cheungderek 0:e083abcfe7a8 46 #ifdef __LWIP_DEBUG
cheungderek 0:e083abcfe7a8 47
cheungderek 0:e083abcfe7a8 48 #define LWIP_DEBUG 1
cheungderek 0:e083abcfe7a8 49
cheungderek 0:e083abcfe7a8 50 #define LWIP_DBG_MIN_LEVEL 0
cheungderek 0:e083abcfe7a8 51 //#define LWIP_COMPAT_SOCKETS 1
cheungderek 0:e083abcfe7a8 52 #define TAPIF_DEBUG LWIP_DBG_OFF
cheungderek 0:e083abcfe7a8 53 #define TUNIF_DEBUG LWIP_DBG_OFF
cheungderek 0:e083abcfe7a8 54 #define UNIXIF_DEBUG LWIP_DBG_OFF
cheungderek 0:e083abcfe7a8 55 #define DELIF_DEBUG LWIP_DBG_OFF
cheungderek 0:e083abcfe7a8 56 #define SIO_FIFO_DEBUG LWIP_DBG_ON
cheungderek 0:e083abcfe7a8 57 #define TCPDUMP_DEBUG LWIP_DBG_ON
cheungderek 0:e083abcfe7a8 58
cheungderek 0:e083abcfe7a8 59 #define PPP_DEBUG LWIP_DBG_OFF
cheungderek 0:e083abcfe7a8 60 #define MEM_DEBUG LWIP_DBG_OFF
cheungderek 0:e083abcfe7a8 61 #define MEMP_DEBUG LWIP_DBG_OFF
cheungderek 0:e083abcfe7a8 62 #define PBUF_DEBUG LWIP_DBG_OFF
cheungderek 0:e083abcfe7a8 63 #define API_LIB_DEBUG LWIP_DBG_OFF
cheungderek 0:e083abcfe7a8 64 #define API_MSG_DEBUG LWIP_DBG_OFF
cheungderek 0:e083abcfe7a8 65 #define TCPIP_DEBUG LWIP_DBG_OFF
cheungderek 0:e083abcfe7a8 66 #define NETIF_DEBUG LWIP_DBG_OFF
cheungderek 0:e083abcfe7a8 67 #define SOCKETS_DEBUG LWIP_DBG_OFF
cheungderek 0:e083abcfe7a8 68 #define DEMO_DEBUG LWIP_DBG_OFF
cheungderek 0:e083abcfe7a8 69 #define IP_DEBUG LWIP_DBG_OFF
cheungderek 0:e083abcfe7a8 70 #define IP_REASS_DEBUG LWIP_DBG_OFF
cheungderek 0:e083abcfe7a8 71 #define RAW_DEBUG LWIP_DBG_OFF
cheungderek 0:e083abcfe7a8 72 #define ICMP_DEBUG LWIP_DBG_OFF
cheungderek 0:e083abcfe7a8 73 #define IGMP_DEBUG LWIP_DBG_OFF
cheungderek 0:e083abcfe7a8 74 #define UDP_DEBUG LWIP_DBG_OFF
cheungderek 0:e083abcfe7a8 75 #define TCP_DEBUG LWIP_DBG_OFF
cheungderek 0:e083abcfe7a8 76 #define TCP_INPUT_DEBUG LWIP_DBG_OFF
cheungderek 0:e083abcfe7a8 77 #define TCP_OUTPUT_DEBUG LWIP_DBG_OFF
cheungderek 0:e083abcfe7a8 78 #define TCP_RTO_DEBUG LWIP_DBG_OFF
cheungderek 0:e083abcfe7a8 79 #define TCP_CWND_DEBUG LWIP_DBG_OFF
cheungderek 0:e083abcfe7a8 80 #define TCP_WND_DEBUG LWIP_DBG_OFF
cheungderek 0:e083abcfe7a8 81 #define TCP_FR_DEBUG LWIP_DBG_OFF
cheungderek 0:e083abcfe7a8 82 #define TCP_QLEN_DEBUG LWIP_DBG_OFF
cheungderek 0:e083abcfe7a8 83 #define TCP_RST_DEBUG LWIP_DBG_OFF
cheungderek 0:e083abcfe7a8 84 #define ETHARP_DEBUG LWIP_DBG_OFF
cheungderek 0:e083abcfe7a8 85 #define DNS_DEBUG LWIP_DBG_OFF
cheungderek 0:e083abcfe7a8 86
cheungderek 0:e083abcfe7a8 87 #endif
cheungderek 0:e083abcfe7a8 88
cheungderek 0:e083abcfe7a8 89 /*
cheungderek 0:e083abcfe7a8 90 extern unsigned char debug_flags;
cheungderek 0:e083abcfe7a8 91 #define LWIP_DBG_TYPES_ON debug_flags
cheungderek 0:e083abcfe7a8 92 */
cheungderek 0:e083abcfe7a8 93 #define NO_SYS 1
cheungderek 0:e083abcfe7a8 94 #define LWIP_SOCKET (NO_SYS==0)
cheungderek 0:e083abcfe7a8 95 #define LWIP_NETCONN (NO_SYS==0)
cheungderek 0:e083abcfe7a8 96
cheungderek 0:e083abcfe7a8 97
cheungderek 0:e083abcfe7a8 98 #define IP_FRAG_USES_STATIC_BUF 0
cheungderek 0:e083abcfe7a8 99
cheungderek 0:e083abcfe7a8 100
cheungderek 0:e083abcfe7a8 101
cheungderek 0:e083abcfe7a8 102 /* ---------- Memory options ---------- */
cheungderek 0:e083abcfe7a8 103 /* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
cheungderek 0:e083abcfe7a8 104 lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
cheungderek 0:e083abcfe7a8 105 byte alignment -> define MEM_ALIGNMENT to 2. */
cheungderek 0:e083abcfe7a8 106 /* MSVC port: intel processors don't need 4-byte alignment,
cheungderek 0:e083abcfe7a8 107 but are faster that way! */
cheungderek 0:e083abcfe7a8 108 #define MEM_ALIGNMENT 4
cheungderek 0:e083abcfe7a8 109
cheungderek 0:e083abcfe7a8 110 /* MEM_SIZE: the size of the heap memory. If the application will send
cheungderek 0:e083abcfe7a8 111 a lot of data that needs to be copied, this should be set high. */
cheungderek 0:e083abcfe7a8 112 //#define MEM_SIZE 10240
cheungderek 0:e083abcfe7a8 113
cheungderek 0:e083abcfe7a8 114 #if TARGET_LPC1768
cheungderek 0:e083abcfe7a8 115
cheungderek 0:e083abcfe7a8 116
cheungderek 0:e083abcfe7a8 117 #define MEM_SIZE 3000 //2000
cheungderek 0:e083abcfe7a8 118
cheungderek 0:e083abcfe7a8 119 ///
cheungderek 0:e083abcfe7a8 120
cheungderek 0:e083abcfe7a8 121 #define MEM_POSITION __attribute((section("AHBSRAM0")))
cheungderek 0:e083abcfe7a8 122
cheungderek 0:e083abcfe7a8 123 /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
cheungderek 0:e083abcfe7a8 124 sends a lot of data out of ROM (or other static memory), this
cheungderek 0:e083abcfe7a8 125 should be set high. */
cheungderek 0:e083abcfe7a8 126 #define MEMP_NUM_PBUF 16
cheungderek 0:e083abcfe7a8 127 /* MEMP_NUM_RAW_PCB: the number of UDP protocol control blocks. One
cheungderek 0:e083abcfe7a8 128 per active RAW "connection". */
cheungderek 0:e083abcfe7a8 129 //#define MEMP_NUM_RAW_PCB 3
cheungderek 0:e083abcfe7a8 130 /* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
cheungderek 0:e083abcfe7a8 131 per active UDP "connection". */
cheungderek 0:e083abcfe7a8 132 #define MEMP_NUM_UDP_PCB 4
cheungderek 0:e083abcfe7a8 133 /* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
cheungderek 0:e083abcfe7a8 134 connections. */
cheungderek 0:e083abcfe7a8 135 #define MEMP_NUM_TCP_PCB 3
cheungderek 0:e083abcfe7a8 136 /* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
cheungderek 0:e083abcfe7a8 137 connections. */
cheungderek 0:e083abcfe7a8 138 #define MEMP_NUM_TCP_PCB_LISTEN 2//4
cheungderek 0:e083abcfe7a8 139 /* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
cheungderek 0:e083abcfe7a8 140 segments. */
cheungderek 0:e083abcfe7a8 141 #define MEMP_NUM_TCP_SEG 16
cheungderek 0:e083abcfe7a8 142 /* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
cheungderek 0:e083abcfe7a8 143 timeouts. */
cheungderek 0:e083abcfe7a8 144 #define MEMP_NUM_SYS_TIMEOUT 12
cheungderek 0:e083abcfe7a8 145
cheungderek 0:e083abcfe7a8 146 /* The following four are used only with the sequential API and can be
cheungderek 0:e083abcfe7a8 147 set to 0 if the application only will use the raw API. */
cheungderek 0:e083abcfe7a8 148 /* MEMP_NUM_NETBUF: the number of struct netbufs. */
cheungderek 0:e083abcfe7a8 149 #define MEMP_NUM_NETBUF 0
cheungderek 0:e083abcfe7a8 150 /* MEMP_NUM_NETCONN: the number of struct netconns. */
cheungderek 0:e083abcfe7a8 151 #define MEMP_NUM_NETCONN 0
cheungderek 0:e083abcfe7a8 152 /* MEMP_NUM_TCPIP_MSG_*: the number of struct tcpip_msg, which is used
cheungderek 0:e083abcfe7a8 153 for sequential API communication and incoming packets. Used in
cheungderek 0:e083abcfe7a8 154 src/api/tcpip.c. */
cheungderek 0:e083abcfe7a8 155 #define MEMP_NUM_TCPIP_MSG_API 0
cheungderek 0:e083abcfe7a8 156 #define MEMP_NUM_TCPIP_MSG_INPKT 0
cheungderek 0:e083abcfe7a8 157
cheungderek 0:e083abcfe7a8 158 /* ---------- Pbuf options ---------- */
cheungderek 0:e083abcfe7a8 159 /* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
cheungderek 0:e083abcfe7a8 160 #define PBUF_POOL_SIZE 8//16//100
cheungderek 0:e083abcfe7a8 161
cheungderek 0:e083abcfe7a8 162 /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
cheungderek 0:e083abcfe7a8 163 //#define PBUF_POOL_BUFSIZE 128
cheungderek 0:e083abcfe7a8 164
cheungderek 0:e083abcfe7a8 165 /* PBUF_LINK_HLEN: the number of bytes that should be allocated for a
cheungderek 0:e083abcfe7a8 166 link level header. */
cheungderek 0:e083abcfe7a8 167 //#define PBUF_LINK_HLEN 16
cheungderek 0:e083abcfe7a8 168
cheungderek 0:e083abcfe7a8 169 /** SYS_LIGHTWEIGHT_PROT
cheungderek 0:e083abcfe7a8 170 * define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection
cheungderek 0:e083abcfe7a8 171 * for certain critical regions during buffer allocation, deallocation and memory
cheungderek 0:e083abcfe7a8 172 * allocation and deallocation.
cheungderek 0:e083abcfe7a8 173 */
cheungderek 0:e083abcfe7a8 174 #define SYS_LIGHTWEIGHT_PROT 0 //No sys here
cheungderek 0:e083abcfe7a8 175
cheungderek 0:e083abcfe7a8 176 /* ---------- TCP options ---------- */
cheungderek 0:e083abcfe7a8 177 #define LWIP_TCP 1
cheungderek 0:e083abcfe7a8 178 //#define TCP_TTL 255
cheungderek 0:e083abcfe7a8 179
cheungderek 0:e083abcfe7a8 180 /* Controls if TCP should queue segments that arrive out of
cheungderek 0:e083abcfe7a8 181 order. Define to 0 if your device is low on memory. */
cheungderek 0:e083abcfe7a8 182 #define TCP_QUEUE_OOSEQ 1
cheungderek 0:e083abcfe7a8 183
cheungderek 0:e083abcfe7a8 184 /* TCP Maximum segment size. */
cheungderek 0:e083abcfe7a8 185 //#define TCP_MSS 1024
cheungderek 0:e083abcfe7a8 186 #define TCP_MSS 536//1024//536//0x276
cheungderek 0:e083abcfe7a8 187
cheungderek 0:e083abcfe7a8 188 /* TCP sender buffer space (bytes). */
cheungderek 0:e083abcfe7a8 189 #define TCP_SND_BUF (3 * TCP_MSS) //2048
cheungderek 0:e083abcfe7a8 190
cheungderek 0:e083abcfe7a8 191 /* TCP sender buffer space (pbufs). This must be at least = 2 *
cheungderek 0:e083abcfe7a8 192 TCP_SND_BUF/TCP_MSS for things to work. */
cheungderek 0:e083abcfe7a8 193 #define TCP_SND_QUEUELEN (4 * (TCP_SND_BUF)/(TCP_MSS))
cheungderek 0:e083abcfe7a8 194
cheungderek 0:e083abcfe7a8 195 /* TCP writable space (bytes). This must be less than or equal
cheungderek 0:e083abcfe7a8 196 to TCP_SND_BUF. It is the amount of space which must be
cheungderek 0:e083abcfe7a8 197 available in the tcp snd_buf for select to return writable */
cheungderek 0:e083abcfe7a8 198 #define TCP_SNDLOWAT ((TCP_SND_BUF)/2)
cheungderek 0:e083abcfe7a8 199
cheungderek 0:e083abcfe7a8 200 /**
cheungderek 0:e083abcfe7a8 201 * TCP_WND: The size of a TCP window. This must be at least
cheungderek 0:e083abcfe7a8 202 * (2 * TCP_MSS) for things to work well
cheungderek 0:e083abcfe7a8 203 */
cheungderek 0:e083abcfe7a8 204 /* TCP receive window. */
cheungderek 0:e083abcfe7a8 205 #define TCP_WND (4 * TCP_MSS) //8096
cheungderek 0:e083abcfe7a8 206
cheungderek 0:e083abcfe7a8 207 /* Maximum number of retransmissions of data segments. */
cheungderek 0:e083abcfe7a8 208 //#define TCP_MAXRTX 12
cheungderek 0:e083abcfe7a8 209
cheungderek 0:e083abcfe7a8 210 /* Maximum number of retransmissions of SYN segments. */
cheungderek 0:e083abcfe7a8 211 //#define TCP_SYNMAXRTX 4
cheungderek 0:e083abcfe7a8 212
cheungderek 0:e083abcfe7a8 213 #elif TARGET_LPC2368
cheungderek 0:e083abcfe7a8 214
cheungderek 0:e083abcfe7a8 215 #define MEM_POSITION __attribute((section("AHBSRAM1")))
cheungderek 0:e083abcfe7a8 216
cheungderek 0:e083abcfe7a8 217 /* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
cheungderek 0:e083abcfe7a8 218 sends a lot of data out of ROM (or other static memory), this
cheungderek 0:e083abcfe7a8 219 should be set high. */
cheungderek 0:e083abcfe7a8 220 #define MEMP_NUM_PBUF 8
cheungderek 0:e083abcfe7a8 221 /* MEMP_NUM_RAW_PCB: the number of UDP protocol control blocks. One
cheungderek 0:e083abcfe7a8 222 per active RAW "connection". */
cheungderek 0:e083abcfe7a8 223 //#define MEMP_NUM_RAW_PCB 3
cheungderek 0:e083abcfe7a8 224 /* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
cheungderek 0:e083abcfe7a8 225 per active UDP "connection". */
cheungderek 0:e083abcfe7a8 226 #define MEMP_NUM_UDP_PCB 2
cheungderek 0:e083abcfe7a8 227 /* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
cheungderek 0:e083abcfe7a8 228 connections. */
cheungderek 0:e083abcfe7a8 229 #define MEMP_NUM_TCP_PCB 2
cheungderek 0:e083abcfe7a8 230 /* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
cheungderek 0:e083abcfe7a8 231 connections. */
cheungderek 0:e083abcfe7a8 232 #define MEMP_NUM_TCP_PCB_LISTEN 2//4
cheungderek 0:e083abcfe7a8 233 /* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
cheungderek 0:e083abcfe7a8 234 segments. */
cheungderek 0:e083abcfe7a8 235 #define MEMP_NUM_TCP_SEG 8
cheungderek 0:e083abcfe7a8 236 /* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
cheungderek 0:e083abcfe7a8 237 timeouts. */
cheungderek 0:e083abcfe7a8 238 #define MEMP_NUM_SYS_TIMEOUT 12
cheungderek 0:e083abcfe7a8 239
cheungderek 0:e083abcfe7a8 240 /* The following four are used only with the sequential API and can be
cheungderek 0:e083abcfe7a8 241 set to 0 if the application only will use the raw API. */
cheungderek 0:e083abcfe7a8 242 /* MEMP_NUM_NETBUF: the number of struct netbufs. */
cheungderek 0:e083abcfe7a8 243 #define MEMP_NUM_NETBUF 0
cheungderek 0:e083abcfe7a8 244 /* MEMP_NUM_NETCONN: the number of struct netconns. */
cheungderek 0:e083abcfe7a8 245 #define MEMP_NUM_NETCONN 0
cheungderek 0:e083abcfe7a8 246 /* MEMP_NUM_TCPIP_MSG_*: the number of struct tcpip_msg, which is used
cheungderek 0:e083abcfe7a8 247 for sequential API communication and incoming packets. Used in
cheungderek 0:e083abcfe7a8 248 src/api/tcpip.c. */
cheungderek 0:e083abcfe7a8 249 #define MEMP_NUM_TCPIP_MSG_API 0
cheungderek 0:e083abcfe7a8 250 #define MEMP_NUM_TCPIP_MSG_INPKT 0
cheungderek 0:e083abcfe7a8 251
cheungderek 0:e083abcfe7a8 252 /* ---------- Pbuf options ---------- */
cheungderek 0:e083abcfe7a8 253 /* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
cheungderek 0:e083abcfe7a8 254 #define PBUF_POOL_SIZE 8//16//100
cheungderek 0:e083abcfe7a8 255
cheungderek 0:e083abcfe7a8 256 /* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
cheungderek 0:e083abcfe7a8 257 //#define PBUF_POOL_BUFSIZE 128
cheungderek 0:e083abcfe7a8 258
cheungderek 0:e083abcfe7a8 259 /* PBUF_LINK_HLEN: the number of bytes that should be allocated for a
cheungderek 0:e083abcfe7a8 260 link level header. */
cheungderek 0:e083abcfe7a8 261 //#define PBUF_LINK_HLEN 16
cheungderek 0:e083abcfe7a8 262
cheungderek 0:e083abcfe7a8 263 /** SYS_LIGHTWEIGHT_PROT
cheungderek 0:e083abcfe7a8 264 * define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection
cheungderek 0:e083abcfe7a8 265 * for certain critical regions during buffer allocation, deallocation and memory
cheungderek 0:e083abcfe7a8 266 * allocation and deallocation.
cheungderek 0:e083abcfe7a8 267 */
cheungderek 0:e083abcfe7a8 268 #define SYS_LIGHTWEIGHT_PROT 0 //No sys here
cheungderek 0:e083abcfe7a8 269
cheungderek 0:e083abcfe7a8 270 /* ---------- TCP options ---------- */
cheungderek 0:e083abcfe7a8 271 #define LWIP_TCP 1
cheungderek 0:e083abcfe7a8 272 #define TCP_TTL 255
cheungderek 0:e083abcfe7a8 273
cheungderek 0:e083abcfe7a8 274 /* Controls if TCP should queue segments that arrive out of
cheungderek 0:e083abcfe7a8 275 order. Define to 0 if your device is low on memory. */
cheungderek 0:e083abcfe7a8 276 #define TCP_QUEUE_OOSEQ 0
cheungderek 0:e083abcfe7a8 277
cheungderek 0:e083abcfe7a8 278 /* TCP Maximum segment size. */
cheungderek 0:e083abcfe7a8 279 //#define TCP_MSS 1024
cheungderek 0:e083abcfe7a8 280 #define TCP_MSS 536//0x276//536//0x276
cheungderek 0:e083abcfe7a8 281
cheungderek 0:e083abcfe7a8 282 /* TCP sender buffer space (bytes). */
cheungderek 0:e083abcfe7a8 283 #define TCP_SND_BUF (3 * TCP_MSS)
cheungderek 0:e083abcfe7a8 284
cheungderek 0:e083abcfe7a8 285 /* TCP sender buffer space (pbufs). This must be at least = 2 *
cheungderek 0:e083abcfe7a8 286 TCP_SND_BUF/TCP_MSS for things to work. */
cheungderek 0:e083abcfe7a8 287 #define TCP_SND_QUEUELEN (2 * TCP_SND_BUF/TCP_MSS)//(4 * TCP_SND_BUF/TCP_MSS)
cheungderek 0:e083abcfe7a8 288
cheungderek 0:e083abcfe7a8 289 /* TCP writable space (bytes). This must be less than or equal
cheungderek 0:e083abcfe7a8 290 to TCP_SND_BUF. It is the amount of space which must be
cheungderek 0:e083abcfe7a8 291 available in the tcp snd_buf for select to return writable */
cheungderek 0:e083abcfe7a8 292 #define TCP_SNDLOWAT (TCP_SND_BUF/2)
cheungderek 0:e083abcfe7a8 293
cheungderek 0:e083abcfe7a8 294 /* TCP receive window. */
cheungderek 0:e083abcfe7a8 295 #define TCP_WND (3 * TCP_MSS) //8096
cheungderek 0:e083abcfe7a8 296
cheungderek 0:e083abcfe7a8 297 /* Maximum number of retransmissions of data segments. */
cheungderek 0:e083abcfe7a8 298 //#define TCP_MAXRTX 12
cheungderek 0:e083abcfe7a8 299
cheungderek 0:e083abcfe7a8 300 /* Maximum number of retransmissions of SYN segments. */
cheungderek 0:e083abcfe7a8 301 //#define TCP_SYNMAXRTX 4
cheungderek 0:e083abcfe7a8 302
cheungderek 0:e083abcfe7a8 303 #endif
cheungderek 0:e083abcfe7a8 304
cheungderek 0:e083abcfe7a8 305 /* ---------- ARP options ---------- */
cheungderek 0:e083abcfe7a8 306 #define LWIP_ARP (NET_ETH | NET_ZG2100)
cheungderek 0:e083abcfe7a8 307 #define ARP_TABLE_SIZE 4//10
cheungderek 0:e083abcfe7a8 308 #define ARP_QUEUEING 0
cheungderek 0:e083abcfe7a8 309 #define ETHARP_TRUST_IP_MAC 1
cheungderek 0:e083abcfe7a8 310
cheungderek 0:e083abcfe7a8 311 /* ---------- IP options ---------- */
cheungderek 0:e083abcfe7a8 312 /* Define IP_FORWARD to 1 if you wish to have the ability to forward
cheungderek 0:e083abcfe7a8 313 IP packets across network interfaces. If you are going to run lwIP
cheungderek 0:e083abcfe7a8 314 on a device with only one network interface, define this to 0. */
cheungderek 0:e083abcfe7a8 315 #define IP_FORWARD 0
cheungderek 0:e083abcfe7a8 316
cheungderek 0:e083abcfe7a8 317
cheungderek 0:e083abcfe7a8 318 /* IP reassembly and segmentation.These are orthogonal even
cheungderek 0:e083abcfe7a8 319 * if they both deal with IP fragments */
cheungderek 0:e083abcfe7a8 320 /*
cheungderek 0:e083abcfe7a8 321 #define IP_REASSEMBLY 1
cheungderek 0:e083abcfe7a8 322 #define IP_REASS_MAX_PBUFS 10
cheungderek 0:e083abcfe7a8 323 #define MEMP_NUM_REASSDATA 10
cheungderek 0:e083abcfe7a8 324 #define IP_FRAG 1
cheungderek 0:e083abcfe7a8 325 */
cheungderek 0:e083abcfe7a8 326 /* ---------- ICMP options ---------- */
cheungderek 0:e083abcfe7a8 327 #define ICMP_TTL 255
cheungderek 0:e083abcfe7a8 328
cheungderek 0:e083abcfe7a8 329 /* ---------- IGMP options ---------- */
cheungderek 0:e083abcfe7a8 330 #define LWIP_IGMP (NET_ETH | NET_ZG2100)
cheungderek 0:e083abcfe7a8 331
cheungderek 0:e083abcfe7a8 332 /* ---------- DHCP options ---------- */
cheungderek 0:e083abcfe7a8 333 /* Define LWIP_DHCP to 1 if you want DHCP configuration of
cheungderek 0:e083abcfe7a8 334 interfaces. */
cheungderek 0:e083abcfe7a8 335 #define LWIP_DHCP (NET_ETH | NET_ZG2100)
cheungderek 0:e083abcfe7a8 336
cheungderek 0:e083abcfe7a8 337 /* 1 if you want to do an ARP check on the offered address
cheungderek 0:e083abcfe7a8 338 (recommended if using DHCP). */
cheungderek 0:e083abcfe7a8 339 #define DHCP_DOES_ARP_CHECK (LWIP_DHCP)
cheungderek 0:e083abcfe7a8 340
cheungderek 0:e083abcfe7a8 341 /* ---------- AUTOIP options ------- */
cheungderek 0:e083abcfe7a8 342 #define LWIP_AUTOIP 0
cheungderek 0:e083abcfe7a8 343
cheungderek 0:e083abcfe7a8 344 /* ---------- SNMP options ---------- */
cheungderek 0:e083abcfe7a8 345 /** @todo SNMP is experimental for now
cheungderek 0:e083abcfe7a8 346 @note UDP must be available for SNMP transport */
cheungderek 0:e083abcfe7a8 347 #ifndef LWIP_SNMP
cheungderek 0:e083abcfe7a8 348 #define LWIP_SNMP 0
cheungderek 0:e083abcfe7a8 349 #endif
cheungderek 0:e083abcfe7a8 350
cheungderek 0:e083abcfe7a8 351
cheungderek 0:e083abcfe7a8 352 #ifndef SNMP_PRIVATE_MIB
cheungderek 0:e083abcfe7a8 353 #define SNMP_PRIVATE_MIB 0
cheungderek 0:e083abcfe7a8 354 #endif
cheungderek 0:e083abcfe7a8 355
cheungderek 0:e083abcfe7a8 356
cheungderek 0:e083abcfe7a8 357 /* ---------- UDP options ---------- */
cheungderek 0:e083abcfe7a8 358 #define LWIP_UDP 1
cheungderek 0:e083abcfe7a8 359 #define UDP_TTL 255
cheungderek 0:e083abcfe7a8 360
cheungderek 0:e083abcfe7a8 361 /* ---------- DNS options ---------- */
cheungderek 0:e083abcfe7a8 362 #define LWIP_DNS 1
cheungderek 0:e083abcfe7a8 363
cheungderek 0:e083abcfe7a8 364 /* ---------- RAW options ---------- */
cheungderek 0:e083abcfe7a8 365 #define LWIP_RAW 0
cheungderek 0:e083abcfe7a8 366 #define RAW_TTL 255
cheungderek 0:e083abcfe7a8 367
cheungderek 0:e083abcfe7a8 368 /* ---------- Statistics options ---------- */
cheungderek 0:e083abcfe7a8 369 /* individual STATS options can be turned off by defining them to 0
cheungderek 0:e083abcfe7a8 370 * (e.g #define TCP_STATS 0). All of them are turned off if LWIP_STATS
cheungderek 0:e083abcfe7a8 371 * is 0
cheungderek 0:e083abcfe7a8 372 * */
cheungderek 0:e083abcfe7a8 373
cheungderek 0:e083abcfe7a8 374 #define LWIP_STATS 0
cheungderek 0:e083abcfe7a8 375
cheungderek 0:e083abcfe7a8 376 /* ---------- PPP options ---------- */
cheungderek 0:e083abcfe7a8 377
cheungderek 0:e083abcfe7a8 378 #define PPP_SUPPORT NET_PPP /* Set > 0 for PPP */
cheungderek 0:e083abcfe7a8 379
cheungderek 0:e083abcfe7a8 380 #if PPP_SUPPORT > 0
cheungderek 0:e083abcfe7a8 381
cheungderek 0:e083abcfe7a8 382 #define NUM_PPP 1 /* Max PPP sessions. */
cheungderek 0:e083abcfe7a8 383
cheungderek 0:e083abcfe7a8 384
cheungderek 0:e083abcfe7a8 385 /* Select modules to enable. Ideally these would be set in the makefile but
cheungderek 0:e083abcfe7a8 386 * we're limited by the command line length so you need to modify the settings
cheungderek 0:e083abcfe7a8 387 * in this file.
cheungderek 0:e083abcfe7a8 388 */
cheungderek 0:e083abcfe7a8 389 #define PAP_SUPPORT 1 /* Set > 0 for PAP. */
cheungderek 0:e083abcfe7a8 390 #define CHAP_SUPPORT 1 /* Set > 0 for CHAP. */
cheungderek 0:e083abcfe7a8 391 #define MSCHAP_SUPPORT 0 /* Set > 0 for MSCHAP (NOT FUNCTIONAL!) */
cheungderek 0:e083abcfe7a8 392 #define CBCP_SUPPORT 0 /* Set > 0 for CBCP (NOT FUNCTIONAL!) */
cheungderek 0:e083abcfe7a8 393 #define CCP_SUPPORT 0 /* Set > 0 for CCP (NOT FUNCTIONAL!) */
cheungderek 0:e083abcfe7a8 394 #define VJ_SUPPORT 1 /* Set > 0 for VJ header compression. */
cheungderek 0:e083abcfe7a8 395 #define MD5_SUPPORT 1 /* Set > 0 for MD5 (see also CHAP) */
cheungderek 0:e083abcfe7a8 396
cheungderek 0:e083abcfe7a8 397
cheungderek 0:e083abcfe7a8 398 /*
cheungderek 0:e083abcfe7a8 399 * Timeouts.
cheungderek 0:e083abcfe7a8 400 */
cheungderek 0:e083abcfe7a8 401 #define FSM_DEFTIMEOUT 6 /* Timeout time in seconds */
cheungderek 0:e083abcfe7a8 402 #define FSM_DEFMAXTERMREQS 2 /* Maximum Terminate-Request transmissions */
cheungderek 0:e083abcfe7a8 403 #define FSM_DEFMAXCONFREQS 10 /* Maximum Configure-Request transmissions */
cheungderek 0:e083abcfe7a8 404 #define FSM_DEFMAXNAKLOOPS 5 /* Maximum number of nak loops */
cheungderek 0:e083abcfe7a8 405
cheungderek 0:e083abcfe7a8 406 #define UPAP_DEFTIMEOUT 6 /* Timeout (seconds) for retransmitting req */
cheungderek 0:e083abcfe7a8 407 #define UPAP_DEFREQTIME 30 /* Time to wait for auth-req from peer */
cheungderek 0:e083abcfe7a8 408
cheungderek 0:e083abcfe7a8 409 #define CHAP_DEFTIMEOUT 6 /* Timeout time in seconds */
cheungderek 0:e083abcfe7a8 410 #define CHAP_DEFTRANSMITS 10 /* max # times to send challenge */
cheungderek 0:e083abcfe7a8 411
cheungderek 0:e083abcfe7a8 412
cheungderek 0:e083abcfe7a8 413 /* Interval in seconds between keepalive echo requests, 0 to disable. */
cheungderek 0:e083abcfe7a8 414 #if 1
cheungderek 0:e083abcfe7a8 415 #define LCP_ECHOINTERVAL 0
cheungderek 0:e083abcfe7a8 416 #else
cheungderek 0:e083abcfe7a8 417
cheungderek 0:e083abcfe7a8 418 #define LCP_ECHOINTERVAL 10
cheungderek 0:e083abcfe7a8 419 #endif
cheungderek 0:e083abcfe7a8 420
cheungderek 0:e083abcfe7a8 421
cheungderek 0:e083abcfe7a8 422 /* Number of unanswered echo requests before failure. */
cheungderek 0:e083abcfe7a8 423 #define LCP_MAXECHOFAILS 3
cheungderek 0:e083abcfe7a8 424
cheungderek 0:e083abcfe7a8 425 /* Max Xmit idle time (in jiffies) before resend flag char. */
cheungderek 0:e083abcfe7a8 426 #define PPP_MAXIDLEFLAG 0//Send it every time//100
cheungderek 0:e083abcfe7a8 427
cheungderek 0:e083abcfe7a8 428 /*
cheungderek 0:e083abcfe7a8 429 * Packet sizes
cheungderek 0:e083abcfe7a8 430 *
cheungderek 0:e083abcfe7a8 431 * Note - lcp shouldn't be allowed to negotiate stuff outside these
cheungderek 0:e083abcfe7a8 432 * limits. See lcp.h in the pppd directory.
cheungderek 0:e083abcfe7a8 433 * (XXX - these constants should simply be shared by lcp.c instead
cheungderek 0:e083abcfe7a8 434 * of living in lcp.h)
cheungderek 0:e083abcfe7a8 435 */
cheungderek 0:e083abcfe7a8 436 #define PPP_MTU 1500 /* Default MTU (size of Info field) */
cheungderek 0:e083abcfe7a8 437 #if 0
cheungderek 0:e083abcfe7a8 438 #define PPP_MAXMTU 65535 - (PPP_HDRLEN + PPP_FCSLEN)
cheungderek 0:e083abcfe7a8 439 #else
cheungderek 0:e083abcfe7a8 440
cheungderek 0:e083abcfe7a8 441 #define PPP_MAXMTU 1500 /* Largest MTU we allow */
cheungderek 0:e083abcfe7a8 442 #endif
cheungderek 0:e083abcfe7a8 443
cheungderek 0:e083abcfe7a8 444 #define PPP_MINMTU 64
cheungderek 0:e083abcfe7a8 445 #define PPP_MRU 1500 /* default MRU = max length of info field */
cheungderek 0:e083abcfe7a8 446 #define PPP_MAXMRU 1500 /* Largest MRU we allow */
cheungderek 0:e083abcfe7a8 447 #define PPP_DEFMRU 296 /* Try for this */
cheungderek 0:e083abcfe7a8 448 #define PPP_MINMRU 128 /* No MRUs below this */
cheungderek 0:e083abcfe7a8 449
cheungderek 0:e083abcfe7a8 450
cheungderek 0:e083abcfe7a8 451 #define MAXNAMELEN 64 /* max length of hostname or name for auth */
cheungderek 0:e083abcfe7a8 452 #define MAXSECRETLEN 64 /* max length of password or secret */
cheungderek 0:e083abcfe7a8 453
cheungderek 0:e083abcfe7a8 454 #endif /* PPP_SUPPORT > 0 */
cheungderek 0:e083abcfe7a8 455
cheungderek 0:e083abcfe7a8 456 //C++ Compat
cheungderek 0:e083abcfe7a8 457 #define try vTry
cheungderek 0:e083abcfe7a8 458
cheungderek 0:e083abcfe7a8 459 #endif
cheungderek 0:e083abcfe7a8 460
cheungderek 0:e083abcfe7a8 461
cheungderek 0:e083abcfe7a8 462 #endif /* __LWIPOPTS_H__ */