contiki-conf.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2006, Technical University of Munich
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  * 1. Redistributions of source code must retain the above copyright
00009  *    notice, this list of conditions and the following disclaimer.
00010  * 2. Redistributions in binary form must reproduce the above copyright
00011  *    notice, this list of conditions and the following disclaimer in the
00012  *    documentation and/or other materials provided with the distribution.
00013  * 3. Neither the name of the Institute nor the names of its contributors
00014  *    may be used to endorse or promote products derived from this software
00015  *    without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
00018  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00019  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00020  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
00021  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00022  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00023  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00024  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00025  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00026  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00027  * SUCH DAMAGE.
00028  *
00029  * This file is part of the Contiki operating system.
00030  *
00031  * @(#)$$
00032  */
00033 
00034 /**
00035  * \file
00036  *         Configuration for Atmel Raven
00037  *
00038  * \author
00039  *         Simon Barner <barner@in.tum.de>
00040  *         David Kopf <dak664@embarqmail.com>
00041  */
00042 
00043 #ifndef __CONTIKI_CONF_H__
00044 #define __CONTIKI_CONF_H__
00045 
00046 /* MCU and clock rate */
00047 #define PLATFORM       PLATFORM_AVR
00048 #define RAVEN_REVISION RAVEN_D
00049 #ifndef F_CPU
00050 #define F_CPU          8000000UL
00051 #endif
00052 #include <stdint.h>
00053 
00054 typedef int32_t s32_t;
00055 typedef unsigned char u8_t;
00056 typedef unsigned short u16_t;
00057 typedef unsigned long u32_t;
00058 typedef unsigned short clock_time_t;
00059 typedef unsigned short uip_stats_t;
00060 typedef unsigned long off_t;
00061 
00062 void clock_delay(unsigned int us2);
00063 void clock_wait(int ms10);
00064 void clock_set_seconds(unsigned long s);
00065 unsigned long clock_seconds(void);
00066 
00067 /* Maximum timer interval for 16 bit clock_time_t */
00068 #define INFINITE_TIME 0xffff
00069 
00070 /* Clock ticks per second */
00071 #define CLOCK_CONF_SECOND 125
00072 
00073 /* Maximum tick interval is 0xffff/125 = 524 seconds */
00074 #define RIME_CONF_BROADCAST_ANNOUNCEMENT_MAX_TIME CLOCK_CONF_SECOND * 524UL /* Default uses 600UL */
00075 #define COLLECT_CONF_BROADCAST_ANNOUNCEMENT_MAX_TIME CLOCK_CONF_SECOND * 524UL /* Default uses 600UL */
00076 
00077 /* The 1284p can use TIMER2 with the external 32768Hz crystal to keep time. Else TIMER0 is used. */
00078 /* The sleep timer in raven-lcd.c also uses the crystal and adds a TIMER2 interrupt routine if not already define by clock.c */
00079 #define AVR_CONF_USE32KCRYSTAL 0
00080 
00081 /* COM port to be used for SLIP connection. Not tested on Raven */
00082 #define SLIP_PORT RS232_PORT_0
00083 
00084 /* Pre-allocated memory for loadable modules heap space (in bytes)*/
00085 /* Default is 4096. Currently used only when elfloader is present. Not tested on Raven */
00086 //#define MMEM_CONF_SIZE 256
00087 
00088 /* Starting address for code received via the codeprop facility. Not tested on Raven */
00089 //#define EEPROMFS_ADDR_CODEPROP 0x8000
00090 
00091 /* Network setup. The new NETSTACK interface requires RF230BB (as does ip4) */
00092 #if RF230BB
00093 #undef PACKETBUF_CONF_HDR_SIZE                  //Use the packetbuf default for header size
00094 #else
00095 #define PACKETBUF_CONF_HDR_SIZE    0            //RF230 combined driver/mac handles headers internally
00096 #endif /*RF230BB */
00097 
00098 #if UIP_CONF_IPV6
00099 #define RIMEADDR_CONF_SIZE        8
00100 #define UIP_CONF_ICMP6            1
00101 #define UIP_CONF_UDP              1
00102 #define UIP_CONF_TCP              1
00103 #define UIP_CONF_IPV6_RPL         1
00104 #define NETSTACK_CONF_NETWORK       sicslowpan_driver
00105 #define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_HC06
00106 #else
00107 /* ip4 should build but is largely untested */
00108 #define RIMEADDR_CONF_SIZE        2
00109 #define NETSTACK_CONF_NETWORK     rime_driver
00110 #endif /* UIP_CONF_IPV6 */
00111 
00112 /* See uip-ds6.h */
00113 #define UIP_CONF_DS6_NBR_NBU      20
00114 #define UIP_CONF_DS6_DEFRT_NBU    2
00115 #define UIP_CONF_DS6_PREFIX_NBU   3
00116 #define UIP_CONF_DS6_ROUTE_NBU    20
00117 #define UIP_CONF_DS6_ADDR_NBU     3
00118 #define UIP_CONF_DS6_MADDR_NBU    0
00119 #define UIP_CONF_DS6_AADDR_NBU    0
00120 
00121 #define UIP_CONF_LL_802154       1
00122 #define UIP_CONF_LLH_LEN         0
00123 
00124 /* 10 bytes per stateful address context - see sicslowpan.c */
00125 /* Default is 1 context with prefix aaaa::/64 */
00126 /* These must agree with all the other nodes or there will be a failure to communicate! */
00127 #define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 1
00128 #define SICSLOWPAN_CONF_ADDR_CONTEXT_0 {addr_contexts[0].prefix[0]=0xaa;addr_contexts[0].prefix[1]=0xaa;}
00129 #define SICSLOWPAN_CONF_ADDR_CONTEXT_1 {addr_contexts[1].prefix[0]=0xbb;addr_contexts[1].prefix[1]=0xbb;}
00130 #define SICSLOWPAN_CONF_ADDR_CONTEXT_2 {addr_contexts[2].prefix[0]=0x20;addr_contexts[2].prefix[1]=0x01;addr_contexts[2].prefix[2]=0x49;addr_contexts[2].prefix[3]=0x78,addr_contexts[2].prefix[4]=0x1d;addr_contexts[2].prefix[5]=0xb1;}
00131 
00132 /* 211 bytes per queue buffer */
00133 #define QUEUEBUF_CONF_NUM         8
00134 
00135 /* 54 bytes per queue ref buffer */
00136 #define QUEUEBUF_CONF_REF_NUM     2
00137 
00138 /* Take the default TCP maximum segment size for efficiency and simpler wireshark captures */
00139 /* Use this to prevent 6LowPAN fragmentation (whether or not fragmentation is enabled) */
00140 //#define UIP_CONF_TCP_MSS      48
00141 
00142 /* 30 bytes per TCP connection */
00143 /* 6LoWPAN does not do well with concurrent TCP streams, as new browser GETs collide with packets coming */
00144 /* from previous GETs, causing decreased throughput, retransmissions, and timeouts. Increase to study this. */
00145 #define UIP_CONF_MAX_CONNECTIONS 1
00146 
00147 /* 2 bytes per TCP listening port */
00148 #define UIP_CONF_MAX_LISTENPORTS 1
00149 
00150 /* 25 bytes per UDP connection */
00151 #define UIP_CONF_UDP_CONNS      10
00152 
00153 #define UIP_CONF_IP_FORWARD      0
00154 #define UIP_CONF_FWCACHE_SIZE    0
00155 
00156 #define UIP_CONF_IPV6_CHECKS     1
00157 #define UIP_CONF_IPV6_QUEUE_PKT  1
00158 #define UIP_CONF_IPV6_REASSEMBLY 0
00159 
00160 #define UIP_CONF_UDP_CHECKSUMS   1
00161 #define UIP_CONF_TCP_SPLIT       1
00162 #define UIP_CONF_DHCP_LIGHT      1
00163 
00164 
00165 #if 1 /* No radio cycling */
00166 
00167 #define NETSTACK_CONF_MAC         nullmac_driver
00168 #define NETSTACK_CONF_RDC         sicslowmac_driver
00169 #define NETSTACK_CONF_FRAMER      framer_802154
00170 #define NETSTACK_CONF_RADIO       rf230_driver
00171 #define CHANNEL_802_15_4          26
00172 /* AUTOACK receive mode gives better rssi measurements, even if ACK is never requested */
00173 #define RF230_CONF_AUTOACK        1
00174 /* Request 802.15.4 ACK on all packets sent (else autoretry). This is primarily for testing. */
00175 #define SICSLOWPAN_CONF_ACK_ALL   0
00176 /* Number of auto retry attempts 0-15 (0 implies don't use extended TX_ARET_ON mode with CCA) */
00177 #define RF230_CONF_AUTORETRIES    2
00178 /* CCA theshold energy -91 to -61 dBm (default -77). Set this smaller than the expected minimum rssi to avoid packet collisions */
00179 /* In particular the ACK to a FINACK seems to collide with Firefox SYN for the style sheet (if Firefox is set to 1 TCP connection per server) */
00180 #define RF230_CONF_CCA_THRES    -85
00181 /* Default is one RAM buffer for received packets. More than one may benefit multiple TCP connections or ports */
00182 //#define RF230_CONF_RX_BUFFERS     3
00183 #define SICSLOWPAN_CONF_FRAG      1
00184 /* Most browsers reissue GETs after 3 seconds which stops fragment reassembly so a longer MAXAGE does no good */
00185 #define SICSLOWPAN_CONF_MAXAGE    3
00186 /* How long to wait before terminating an idle TCP connection. Smaller to allow faster sleep. Default is 120 seconds */
00187 #define UIP_CONF_WAIT_TIMEOUT     5
00188 
00189 #elif 1  /* Contiki-mac radio cycling */
00190 //#define NETSTACK_CONF_MAC         nullmac_driver
00191 #define NETSTACK_CONF_MAC         csma_driver
00192 #define NETSTACK_CONF_RDC         contikimac_driver
00193 #define NETSTACK_CONF_FRAMER      framer_802154
00194 #define NETSTACK_CONF_RADIO       rf230_driver
00195 #define CHANNEL_802_15_4          26
00196 #define RF230_CONF_AUTOACK        0
00197 #define RF230_CONF_AUTORETRIES    0
00198 #define SICSLOWPAN_CONF_FRAG      1
00199 #define SICSLOWPAN_CONF_MAXAGE    3
00200 #define NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE 8
00201 
00202 #elif 1  /* cx-mac radio cycling */
00203 /* RF230 does clear-channel assessment in extended mode (autoretries>0) */
00204 #define RF230_CONF_AUTORETRIES    1
00205 #if RF230_CONF_AUTORETRIES
00206 #define NETSTACK_CONF_MAC         nullmac_driver
00207 #else
00208 #define NETSTACK_CONF_MAC         csma_driver
00209 #endif
00210 #define NETSTACK_CONF_RDC         cxmac_driver
00211 #define NETSTACK_CONF_FRAMER      framer_802154
00212 #define NETSTACK_CONF_RADIO       rf230_driver
00213 #define CHANNEL_802_15_4          26
00214 #define RF230_CONF_AUTOACK        1
00215 #define SICSLOWPAN_CONF_FRAG      1
00216 #define SICSLOWPAN_CONF_MAXAGE    3
00217 #define CXMAC_CONF_ANNOUNCEMENTS  0
00218 #define NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE 8
00219 
00220 //Below gives 10% duty cycle, undef for default 5%
00221 //#define CXMAC_CONF_ON_TIME (RTIMER_ARCH_SECOND / 80)
00222 //Below gives 50% duty cycle
00223 //#define CXMAC_CONF_ON_TIME (RTIMER_ARCH_SECOND / 16)
00224 
00225 #else
00226 #error Network configuration not specified!
00227 #endif   /* Network setup */
00228 
00229 /* Logging adds 200 bytes to program size */
00230 #define LOG_CONF_ENABLED         1
00231 
00232 /* ************************************************************************** */
00233 //#pragma mark RPL Settings
00234 /* ************************************************************************** */
00235 #if UIP_CONF_IPV6_RPL
00236 
00237 /* Define MAX_*X_POWER to reduce tx power and ignore weak rx packets for testing a miniature multihop network.
00238  * Leave undefined for full power and sensitivity.
00239  * tx=0 (3dbm, default) to 15 (-17.2dbm)
00240  * RF230_CONF_AUTOACK sets the extended mode using the energy-detect register with rx=0 (-91dBm) to 84 (-7dBm)
00241  *   else the rssi register is used having range 0 (91dBm) to 28 (-10dBm)
00242  *   For simplicity RF230_MIN_RX_POWER is based on the energy-detect value and divided by 3 when autoack is not set.
00243  * On the RF230 a reduced rx power threshold will not prevent autoack if enabled and requested.
00244  * These numbers applied to both Raven and Jackdaw give a maximum communication distance of about 15 cm
00245  * and a 10 meter range to a full-sensitivity RF230 sniffer.
00246 #define RF230_MAX_TX_POWER 15
00247 #define RF230_MIN_RX_POWER 30
00248  */
00249 
00250 #define UIP_CONF_ROUTER                 1
00251 #define UIP_CONF_ND6_SEND_RA                0
00252 #define UIP_CONF_ND6_REACHABLE_TIME     600000
00253 #define UIP_CONF_ND6_RETRANS_TIMER      10000
00254 
00255 #undef UIP_CONF_UDP_CONNS
00256 #define UIP_CONF_UDP_CONNS       12
00257 #undef UIP_CONF_FWCACHE_SIZE
00258 #define UIP_CONF_FWCACHE_SIZE    30
00259 #define UIP_CONF_BROADCAST       1
00260 #define UIP_ARCH_IPCHKSUM        1
00261 #define UIP_CONF_PINGADDRCONF    0
00262 #define UIP_CONF_LOGGING         0
00263 
00264 #endif /* RPL */
00265 
00266 #define CCIF
00267 #define CLIF
00268 
00269 #endif /* __CONTIKI_CONF_H__ */

Generated on Mon Apr 11 14:23:41 2011 for Contiki 2.5 by  doxygen 1.6.1