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 ATmega128rfa1
00037  * \author
00038  *         David Kopf <dak664@embarqmail.com>
00039  */
00040 
00041 #ifndef __CONTIKI_CONF_H__
00042 #define __CONTIKI_CONF_H__
00043 
00044 /* MCU and clock rate */
00045 #define PLATFORM       PLATFORM_AVR
00046 #define HARWARE_REVISION ATMEGA128RFA1
00047 #ifndef F_CPU
00048 #define F_CPU          8000000UL
00049 #endif
00050 #include <stdint.h>
00051 
00052 typedef int32_t s32_t;
00053 typedef unsigned char u8_t;
00054 typedef unsigned short u16_t;
00055 typedef unsigned long u32_t;
00056 typedef unsigned short clock_time_t;
00057 typedef unsigned short uip_stats_t;
00058 typedef unsigned long off_t;
00059 
00060 void clock_delay(unsigned int us2);
00061 void clock_wait(int ms10);
00062 void clock_set_seconds(unsigned long s);
00063 unsigned long clock_seconds(void);
00064 
00065 /* Maximum timer interval for 16 bit clock_time_t */
00066 #define INFINITE_TIME 0xffff
00067 
00068 /* Clock ticks per second */
00069 #define CLOCK_CONF_SECOND 125
00070 
00071 /* Maximum tick interval is 0xffff/125 = 524 seconds */
00072 #define RIME_CONF_BROADCAST_ANNOUNCEMENT_MAX_TIME CLOCK_CONF_SECOND * 524UL /* Default uses 600UL */
00073 #define COLLECT_CONF_BROADCAST_ANNOUNCEMENT_MAX_TIME CLOCK_CONF_SECOND * 524UL /* Default uses 600UL */
00074 
00075 /* Michael Hartman's atmega128rfa1 board has an external 32768Hz crystal connected to TOSC1 and 2 pins similar to the Raven 1284p */
00076 /* and theoretically can use TIMER2 with it to keep time. Else TIMER0 is used. */
00077 /* The sleep timer in raven-lcd.c also uses the crystal and adds a TIMER2 interrupt routine if not already define by clock.c */
00078 /* This has not been tested yet */
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 #ifndef UIP_CONF_IPV6_RPL
00104 #define UIP_CONF_IPV6_RPL         0
00105 #endif
00106 #define NETSTACK_CONF_NETWORK       sicslowpan_driver
00107 #define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_HC06
00108 #else
00109 /* ip4 should build but is largely untested */
00110 #define RIMEADDR_CONF_SIZE        2
00111 #define NETSTACK_CONF_NETWORK     rime_driver
00112 #endif /* UIP_CONF_IPV6 */
00113 
00114 /* See uip-ds6.h */
00115 #define UIP_CONF_DS6_NBR_NBU      20
00116 #define UIP_CONF_DS6_DEFRT_NBU    2
00117 #define UIP_CONF_DS6_PREFIX_NBU   3
00118 #define UIP_CONF_DS6_ROUTE_NBU    20
00119 #define UIP_CONF_DS6_ADDR_NBU     3
00120 #define UIP_CONF_DS6_MADDR_NBU    0
00121 #define UIP_CONF_DS6_AADDR_NBU    0
00122 
00123 #define UIP_CONF_LL_802154        1
00124 #define UIP_CONF_LLH_LEN          0
00125 
00126 /* 10 bytes per stateful address context - see sicslowpan.c */
00127 /* Default is 1 context with prefix aaaa::/64 */
00128 /* These must agree with all the other nodes or there will be a failure to communicate! */
00129 #define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 1
00130 #define SICSLOWPAN_CONF_ADDR_CONTEXT_0 {addr_contexts[0].prefix[0]=0xaa;addr_contexts[0].prefix[1]=0xaa;}
00131 #define SICSLOWPAN_CONF_ADDR_CONTEXT_1 {addr_contexts[1].prefix[0]=0xbb;addr_contexts[1].prefix[1]=0xbb;}
00132 #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;}
00133 
00134 /* 211 bytes per queue buffer */
00135 #define QUEUEBUF_CONF_NUM         8
00136 
00137 /* 54 bytes per queue ref buffer */
00138 #define QUEUEBUF_CONF_REF_NUM     2
00139 
00140 /* Take the default TCP maximum segment size for efficiency and simpler wireshark captures */
00141 /* Use this to prevent 6LowPAN fragmentation (whether or not fragmentation is enabled) */
00142 //#define UIP_CONF_TCP_MSS       48
00143 
00144 /* 30 bytes per TCP connection */
00145 /* 6LoWPAN does not do well with concurrent TCP streams, as new browser GETs collide with packets coming */
00146 /* from previous GETs, causing decreased throughput, retransmissions, and timeouts. Increase to study this. */
00147 /* ACKs to other ports become interleaved with computation-intensive GETs, so ACKs are particularly missed. */
00148 /* Increasing the number of packet receive buffers in RAM helps to keep ACKs from being lost */
00149 
00150 #define UIP_CONF_MAX_CONNECTIONS 4
00151 
00152 /* 2 bytes per TCP listening port */
00153 #define UIP_CONF_MAX_LISTENPORTS 4
00154 
00155 /* 25 bytes per UDP connection */
00156 #define UIP_CONF_UDP_CONNS      10
00157 
00158 #define UIP_CONF_IP_FORWARD      0
00159 #define UIP_CONF_FWCACHE_SIZE    0
00160 
00161 #define UIP_CONF_IPV6_CHECKS     1
00162 #define UIP_CONF_IPV6_QUEUE_PKT  1
00163 #define UIP_CONF_IPV6_REASSEMBLY 0
00164 
00165 #define UIP_CONF_UDP_CHECKSUMS   1
00166 #define UIP_CONF_TCP_SPLIT       1
00167 #define UIP_CONF_DHCP_LIGHT      1
00168 
00169 
00170 #if 1 /* No radio cycling */
00171 
00172 #define NETSTACK_CONF_MAC         nullmac_driver
00173 #define NETSTACK_CONF_RDC         sicslowmac_driver
00174 #define NETSTACK_CONF_FRAMER      framer_802154
00175 #define NETSTACK_CONF_RADIO       rf230_driver
00176 #define CHANNEL_802_15_4          26
00177 /* AUTOACK receive mode gives better rssi measurements, even if ACK is never requested */
00178 #define RF230_CONF_AUTOACK        1
00179 /* Request 802.15.4 ACK on all packets sent (else autoretry). This is primarily for testing. */
00180 #define SICSLOWPAN_CONF_ACK_ALL   0
00181 /* Number of auto retry attempts 0-15 (0 implies don't use extended TX_ARET_ON mode with CCA) */
00182 #define RF230_CONF_AUTORETRIES    2
00183 /* CCA theshold energy -91 to -61 dBm (default -77). Set this smaller than the expected minimum rssi to avoid packet collisions */
00184 #define RF230_CONF_CCA_THRES    -85
00185 /* Default is one RAM buffer for received packets. More than one may benefit multiple TCP connections or ports */
00186 #define RF230_CONF_RX_BUFFERS     3
00187 #define SICSLOWPAN_CONF_FRAG      1
00188 /* Most browsers reissue GETs after 3 seconds which stops fragment reassembly so a longer MAXAGE does no good */
00189 #define SICSLOWPAN_CONF_MAXAGE    3
00190 /* How long to wait before terminating an idle TCP connection. Smaller to allow faster sleep. Default is 120 seconds */
00191 /* If wait is too short the connection can be reset as a result of multiple fragment reassembly timeouts */
00192 #define UIP_CONF_WAIT_TIMEOUT     20
00193 
00194 #elif 1  /* Contiki-mac radio cycling */
00195 //#define NETSTACK_CONF_MAC         nullmac_driver
00196 #define NETSTACK_CONF_MAC         csma_driver
00197 #define NETSTACK_CONF_RDC         contikimac_driver
00198 #define NETSTACK_CONF_FRAMER      framer_802154
00199 #define NETSTACK_CONF_RADIO       rf230_driver
00200 #define CHANNEL_802_15_4          26
00201 #define RF230_CONF_AUTOACK        0
00202 #define RF230_CONF_AUTORETRIES    0
00203 #define SICSLOWPAN_CONF_FRAG      1
00204 #define SICSLOWPAN_CONF_MAXAGE    3
00205 #define NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE 8
00206 
00207 #elif 1  /* cx-mac radio cycling */
00208 /* RF230 does clear-channel assessment in extended mode (autoretries>0) */
00209 #define RF230_CONF_AUTORETRIES    1
00210 #if RF230_CONF_AUTORETRIES
00211 #define NETSTACK_CONF_MAC         nullmac_driver
00212 #else
00213 #define NETSTACK_CONF_MAC         csma_driver
00214 #endif
00215 #define NETSTACK_CONF_RDC         cxmac_driver
00216 #define NETSTACK_CONF_FRAMER      framer_802154
00217 #define NETSTACK_CONF_RADIO       rf230_driver
00218 #define CHANNEL_802_15_4          26
00219 #define RF230_CONF_AUTOACK        1
00220 #define SICSLOWPAN_CONF_FRAG      1
00221 #define SICSLOWPAN_CONF_MAXAGE    3
00222 #define CXMAC_CONF_ANNOUNCEMENTS  0
00223 #define NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE 8
00224 
00225 //Below gives 10% duty cycle, undef for default 5%
00226 //#define CXMAC_CONF_ON_TIME (RTIMER_ARCH_SECOND / 80)
00227 //Below gives 50% duty cycle
00228 //#define CXMAC_CONF_ON_TIME (RTIMER_ARCH_SECOND / 16)
00229 
00230 #else
00231 #error Network configuration not specified!
00232 #endif   /* Network setup */
00233 
00234 /* Logging adds 200 bytes to program size */
00235 #define LOG_CONF_ENABLED         1
00236 
00237 /* ************************************************************************** */
00238 //#pragma mark RPL Settings
00239 /* ************************************************************************** */
00240 #if UIP_CONF_IPV6_RPL
00241 
00242 /* Define MAX_*X_POWER to reduce tx power and ignore weak rx packets for testing a miniature multihop network.
00243  * Leave undefined for full power and sensitivity.
00244  * tx=0 (3dbm, default) to 15 (-17.2dbm)
00245  * RF230_CONF_AUTOACK sets the extended mode using the energy-detect register with rx=0 (-91dBm) to 84 (-7dBm)
00246  *   else the rssi register is used having range 0 (91dBm) to 28 (-10dBm)
00247  *   For simplicity RF230_MIN_RX_POWER is based on the energy-detect value and divided by 3 when autoack is not set.
00248  * On the RF230 a reduced rx power threshold will not prevent autoack if enabled and requested.
00249  * These numbers applied to both Raven and Jackdaw give a maximum communication distance of about 15 cm
00250  * and a 10 meter range to a full-sensitivity RF230 sniffer.
00251 #define RF230_MAX_TX_POWER 15
00252 #define RF230_MIN_RX_POWER 30
00253  */
00254 
00255 #define UIP_CONF_ROUTER                 1
00256 #define UIP_CONF_ND6_SEND_RA                0
00257 #define UIP_CONF_ND6_REACHABLE_TIME     600000
00258 #define UIP_CONF_ND6_RETRANS_TIMER      10000
00259 
00260 #undef UIP_CONF_UDP_CONNS
00261 #define UIP_CONF_UDP_CONNS       12
00262 #undef UIP_CONF_FWCACHE_SIZE
00263 #define UIP_CONF_FWCACHE_SIZE    30
00264 #define UIP_CONF_BROADCAST       1
00265 #define UIP_ARCH_IPCHKSUM        1
00266 #define UIP_CONF_PINGADDRCONF    0
00267 #define UIP_CONF_LOGGING         0
00268 
00269 #endif /* RPL */
00270 
00271 #define CCIF
00272 #define CLIF
00273 
00274 #endif /* __CONTIKI_CONF_H__ */

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