This short program illustrates how to use the DS130x_I2C library. My objective is to share the same RTC with Microchip 18F MCU.

Dependencies:   mbed DebugLibrary

Committer:
Yann
Date:
Wed Feb 09 13:57:49 2011 +0000
Revision:
0:f30e2135b0db
V0.0.0.1

Who changed what in which revision?

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