Contiki 2.6
|
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 /* Platform name, type, and MCU clock rate */ 00047 #define PLATFORM_NAME "Raven" 00048 #define PLATFORM_TYPE RAVEN_D 00049 #ifndef F_CPU 00050 #define F_CPU 8000000UL 00051 #endif 00052 00053 /* MCU_CONF_LOW_WEAR will remove the signature and eeprom from the .elf file */ 00054 /* This reduces reprogramming wear during development */ 00055 //#define MCU_CONF_LOW_WEAR 1 00056 00057 #include <stdint.h> 00058 00059 /* The AVR tick interrupt usually is done with an 8 bit counter around 128 Hz. 00060 * 125 Hz needs slightly more overhead during the interrupt, as does a 32 bit 00061 * clock_time_t. 00062 */ 00063 /* Clock ticks per second */ 00064 #define CLOCK_CONF_SECOND 128 00065 #if 1 00066 /* 16 bit counter overflows every ~10 minutes */ 00067 typedef unsigned short clock_time_t; 00068 #define CLOCK_LT(a,b) ((signed short)((a)-(b)) < 0) 00069 #define INFINITE_TIME 0xffff 00070 #define RIME_CONF_BROADCAST_ANNOUNCEMENT_MAX_TIME INFINITE_TIME/CLOCK_CONF_SECOND /* Default uses 600 */ 00071 #define COLLECT_CONF_BROADCAST_ANNOUNCEMENT_MAX_TIME INFINITE_TIME/CLOCK_CONF_SECOND /* Default uses 600 */ 00072 #else 00073 typedef unsigned long clock_time_t; 00074 #define CLOCK_LT(a,b) ((signed long)((a)-(b)) < 0) 00075 #define INFINITE_TIME 0xffffffff 00076 #endif 00077 /* These routines are not part of the contiki core but can be enabled in cpu/avr/clock.c */ 00078 void clock_delay_msec(uint16_t howlong); 00079 void clock_adjust_ticks(clock_time_t howmany); 00080 00081 /* The 1284p can use TIMER2 with the external 32768Hz crystal to keep time. Else TIMER0 is used. */ 00082 /* The sleep timer in raven-lcd.c also uses the crystal and adds a TIMER2 interrupt routine if not already define by clock.c */ 00083 /* If F_CPU is 0x800000 the clock tick interrupt routine will (attempt to) keep the cpu clock phase locked to the crystal. */ 00084 #define AVR_CONF_USE32KCRYSTAL 1 00085 00086 /* Rtimer is implemented through the 16 bit Timer1, clocked at F_CPU through a 1024 prescaler. */ 00087 /* This gives 7812 counts per second, 128 microsecond precision and maximum interval 8.388 seconds. */ 00088 /* Change clock source and prescaler for greater precision and shorter maximum interval. */ 00089 /* 0 will disable the Rtimer code */ 00090 //#define RTIMER_ARCH_PRESCALER 256UL /*0, 1, 8, 64, 256, 1024 */ 00091 00092 /* COM port to be used for SLIP connection. Not tested on Raven */ 00093 #define SLIP_PORT RS232_PORT_0 00094 00095 /* Pre-allocated memory for loadable modules heap space (in bytes)*/ 00096 /* Default is 4096. Currently used only when elfloader is present. Not tested on Raven */ 00097 //#define MMEM_CONF_SIZE 256 00098 00099 /* Starting address for code received via the codeprop facility. Not tested on Raven */ 00100 typedef unsigned long off_t; 00101 //#define EEPROMFS_ADDR_CODEPROP 0x8000 00102 00103 /* RADIO_CONF_CALIBRATE_INTERVAL is used in rf230bb and clock.c. If nonzero a 256 second interval is used */ 00104 /* Calibration is automatic when the radio wakes so is not necessary when the radio periodically sleeps */ 00105 //#define RADIO_CONF_CALIBRATE_INTERVAL 256 00106 00107 /* RADIOSTATS is used in rf230bb, clock.c and the webserver cgi to report radio usage */ 00108 #define RADIOSTATS 1 00109 00110 /* More extensive stats */ 00111 #define ENERGEST_CONF_ON 1 00112 00113 /* Packet statistics */ 00114 typedef unsigned short uip_stats_t; 00115 #define UIP_STATISTICS 0 00116 00117 00118 /* Possible watchdog timeouts depend on mcu. Default is WDTO_2S. -1 Disables the watchdog. */ 00119 /* AVR Studio simulator tends to reboot due to clocking the WD 8 times too fast */ 00120 //#define WATCHDOG_CONF_TIMEOUT -1 00121 00122 /* Debugflow macro, useful for tracing path through mac and radio interrupts */ 00123 //#define DEBUGFLOWSIZE 128 00124 00125 /* Define MAX_*X_POWER to reduce tx power and ignore weak rx packets for testing a miniature multihop network. 00126 * Leave undefined for full power and sensitivity. 00127 * tx=0 (3dbm, default) to 15 (-17.2dbm) 00128 * RF230_CONF_AUTOACK sets the extended mode using the energy-detect register with rx=0 (-91dBm) to 84 (-7dBm) 00129 * else the rssi register is used having range 0 (91dBm) to 28 (-10dBm) 00130 * For simplicity RF230_MIN_RX_POWER is based on the energy-detect value and divided by 3 when autoack is not set. 00131 * On the RF230 a reduced rx power threshold will not prevent autoack if enabled and requested. 00132 * These numbers applied to both Raven and Jackdaw give a maximum communication distance of about 15 cm 00133 * and a 10 meter range to a full-sensitivity RF230 sniffer. 00134 #define RF230_MAX_TX_POWER 15 00135 #define RF230_MIN_RX_POWER 30 00136 */ 00137 /* The rf231 and atmega128rfa1 can use an rssi threshold for triggering rx_busy that saves 0.5ma in rx mode */ 00138 /* 1 - 15 maps into -90 to -48 dBm; the register is written with RF230_MIN_RX_POWER/6 + 1. Undefine for -100dBm sensitivity */ 00139 //#define RF230_MIN_RX_POWER 0 00140 00141 /* Network setup. The new NETSTACK interface requires RF230BB (as does ip4) */ 00142 #if RF230BB 00143 #undef PACKETBUF_CONF_HDR_SIZE //Use the packetbuf default for header size 00144 /* TX routine passes the cca/ack result in the return parameter */ 00145 #define RDC_CONF_HARDWARE_ACK 1 00146 /* TX routine does automatic cca and optional backoff */ 00147 #define RDC_CONF_HARDWARE_CSMA 1 00148 /* Allow MCU sleeping between channel checks */ 00149 #define RDC_CONF_MCU_SLEEP 0 00150 #else 00151 #define PACKETBUF_CONF_HDR_SIZE 0 //RF230 combined driver/mac handles headers internally 00152 #endif /*RF230BB */ 00153 00154 #if UIP_CONF_IPV6 00155 #define RIMEADDR_CONF_SIZE 8 00156 #define UIP_CONF_ICMP6 1 00157 #define UIP_CONF_UDP 1 00158 #define UIP_CONF_TCP 1 00159 //#define UIP_CONF_IPV6_RPL 0 00160 #define NETSTACK_CONF_NETWORK sicslowpan_driver 00161 #define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_HC06 00162 #else 00163 /* ip4 should build but is largely untested */ 00164 #define RIMEADDR_CONF_SIZE 2 00165 #define NETSTACK_CONF_NETWORK rime_driver 00166 #endif /* UIP_CONF_IPV6 */ 00167 00168 #define UIP_CONF_LL_802154 1 00169 #define UIP_CONF_LLH_LEN 0 00170 00171 /* 10 bytes per stateful address context - see sicslowpan.c */ 00172 /* Default is 1 context with prefix aaaa::/64 */ 00173 /* These must agree with all the other nodes or there will be a failure to communicate! */ 00174 #define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 1 00175 #define SICSLOWPAN_CONF_ADDR_CONTEXT_0 {addr_contexts[0].prefix[0]=0xaa;addr_contexts[0].prefix[1]=0xaa;} 00176 #define SICSLOWPAN_CONF_ADDR_CONTEXT_1 {addr_contexts[1].prefix[0]=0xbb;addr_contexts[1].prefix[1]=0xbb;} 00177 #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;} 00178 00179 /* Take the default TCP maximum segment size for efficiency and simpler wireshark captures */ 00180 /* Use this to prevent 6LowPAN fragmentation (whether or not fragmentation is enabled) */ 00181 //#define UIP_CONF_TCP_MSS 48 00182 00183 #define UIP_CONF_IP_FORWARD 0 00184 #define UIP_CONF_FWCACHE_SIZE 0 00185 00186 #define UIP_CONF_IPV6_CHECKS 1 00187 #define UIP_CONF_IPV6_QUEUE_PKT 1 00188 #define UIP_CONF_IPV6_REASSEMBLY 0 00189 00190 #define UIP_CONF_UDP_CHECKSUMS 1 00191 #define UIP_CONF_TCP_SPLIT 1 00192 #define UIP_CONF_DHCP_LIGHT 1 00193 00194 #if 1 /* No radio cycling */ 00195 00196 #define NETSTACK_CONF_MAC nullmac_driver 00197 #define NETSTACK_CONF_RDC sicslowmac_driver 00198 #define NETSTACK_CONF_FRAMER framer_802154 00199 #define NETSTACK_CONF_RADIO rf230_driver 00200 #define CHANNEL_802_15_4 26 00201 #define RADIO_CONF_CALIBRATE_INTERVAL 256 00202 /* AUTOACK receive mode gives better rssi measurements, even if ACK is never requested */ 00203 #define RF230_CONF_AUTOACK 1 00204 /* Request 802.15.4 ACK on all packets sent (else autoretry). This is primarily for testing. */ 00205 #define SICSLOWPAN_CONF_ACK_ALL 0 00206 /* Number of auto retry attempts+1, 1-16. Set zero to disable extended TX_ARET_ON mode with CCA) */ 00207 #define RF230_CONF_AUTORETRIES 3 00208 /* Number of CSMA attempts 0-7. 802.15.4 2003 standard max is 5. */ 00209 #define RF230_CONF_CSMARETRIES 5 00210 /* CCA theshold energy -91 to -61 dBm (default -77). Set this smaller than the expected minimum rssi to avoid packet collisions */ 00211 /* The Jackdaw menu 'm' command is helpful for determining the smallest ever received rssi */ 00212 #define RF230_CONF_CCA_THRES -85 00213 /* Allow 6lowpan fragments (needed for large TCP maximum segment size) */ 00214 #define SICSLOWPAN_CONF_FRAG 1 00215 /* Most browsers reissue GETs after 3 seconds which stops fragment reassembly so a longer MAXAGE does no good */ 00216 #define SICSLOWPAN_CONF_MAXAGE 3 00217 /* How long to wait before terminating an idle TCP connection. Smaller to allow faster sleep. Default is 120 seconds */ 00218 #define UIP_CONF_WAIT_TIMEOUT 5 00219 /* 211 bytes per queue buffer */ 00220 #define QUEUEBUF_CONF_NUM 8 00221 /* 54 bytes per queue ref buffer */ 00222 #define QUEUEBUF_CONF_REF_NUM 2 00223 /* Allocate remaining RAM as desired */ 00224 /* 30 bytes per TCP connection */ 00225 /* 6LoWPAN does not do well with concurrent TCP streams, as new browser GETs collide with packets coming */ 00226 /* from previous GETs, causing decreased throughput, retransmissions, and timeouts. Increase to study this. */ 00227 /* ACKs to other ports become interleaved with computation-intensive GETs, so ACKs are particularly missed. */ 00228 /* Increasing the number of packet receive buffers in RAM helps to keep ACKs from being lost */ 00229 #define UIP_CONF_MAX_CONNECTIONS 4 00230 /* 2 bytes per TCP listening port */ 00231 #define UIP_CONF_MAX_LISTENPORTS 4 00232 /* 25 bytes per UDP connection */ 00233 #define UIP_CONF_UDP_CONNS 10 00234 /* See uip-ds6.h */ 00235 #define UIP_CONF_DS6_NBR_NBU 20 00236 #define UIP_CONF_DS6_DEFRT_NBU 2 00237 #define UIP_CONF_DS6_PREFIX_NBU 3 00238 #define UIP_CONF_DS6_ROUTE_NBU 20 00239 #define UIP_CONF_DS6_ADDR_NBU 3 00240 #define UIP_CONF_DS6_MADDR_NBU 0 00241 #define UIP_CONF_DS6_AADDR_NBU 0 00242 00243 #elif 1 /* Contiki-mac radio cycling */ 00244 //#define NETSTACK_CONF_MAC nullmac_driver 00245 /* csma needed for burst mode at present. Webserver won't work without it */ 00246 #define NETSTACK_CONF_MAC csma_driver 00247 #define NETSTACK_CONF_RDC contikimac_driver 00248 /* Default is two CCA separated by 500 usec */ 00249 #define NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE 8 00250 /* Wireshark won't decode with the header, but padded packets will fail ipv6 checksum */ 00251 #define CONTIKIMAC_CONF_WITH_CONTIKIMAC_HEADER 0 00252 /* So without the header this needed for RPL mesh to form */ 00253 #define CONTIKIMAC_CONF_SHORTEST_PACKET_SIZE 43-18 //multicast RPL DIS length 00254 /* Not tested much yet */ 00255 #define WITH_PHASE_OPTIMIZATION 0 00256 #define CONTIKIMAC_CONF_COMPOWER 1 00257 #define RIMESTATS_CONF_ON 1 00258 #define NETSTACK_CONF_FRAMER framer_802154 00259 #define NETSTACK_CONF_RADIO rf230_driver 00260 #define CHANNEL_802_15_4 26 00261 /* The radio needs to interrupt during an rtimer interrupt */ 00262 #define RTIMER_CONF_NESTED_INTERRUPTS 1 00263 #define RF230_CONF_AUTOACK 1 00264 /* A 0 here means non-extended mode; 1 means extended mode with no retry, >1 for retrys */ 00265 #define RF230_CONF_AUTORETRIES 1 00266 /* A 0 here means no cca; 1 means extended mode with cca but no retry, >1 for backoff retrys */ 00267 #define RF230_CONF_CSMARETRIES 1 00268 #define SICSLOWPAN_CONF_FRAG 1 00269 #define SICSLOWPAN_CONF_MAXAGE 3 00270 /* 211 bytes per queue buffer. Contikimac burst mode needs 15 for a 1280 byte MTU */ 00271 #define QUEUEBUF_CONF_NUM 15 00272 /* 54 bytes per queue ref buffer */ 00273 #define QUEUEBUF_CONF_REF_NUM 2 00274 /* Allocate remaining RAM. Not much left due to queuebuf increase */ 00275 #define UIP_CONF_MAX_CONNECTIONS 2 00276 #define UIP_CONF_MAX_LISTENPORTS 2 00277 #define UIP_CONF_UDP_CONNS 4 00278 #define UIP_CONF_DS6_NBR_NBU 10 00279 #define UIP_CONF_DS6_DEFRT_NBU 2 00280 #define UIP_CONF_DS6_PREFIX_NBU 2 00281 #define UIP_CONF_DS6_ROUTE_NBU 4 00282 #define UIP_CONF_DS6_ADDR_NBU 3 00283 #define UIP_CONF_DS6_MADDR_NBU 0 00284 #define UIP_CONF_DS6_AADDR_NBU 0 00285 00286 #elif 1 /* cx-mac radio cycling */ 00287 /* RF230 does clear-channel assessment in extended mode (autoretries>0) */ 00288 #define RF230_CONF_AUTORETRIES 1 00289 #if RF230_CONF_AUTORETRIES 00290 #define NETSTACK_CONF_MAC nullmac_driver 00291 #else 00292 #define NETSTACK_CONF_MAC csma_driver 00293 #endif 00294 #define NETSTACK_CONF_RDC cxmac_driver 00295 #define NETSTACK_CONF_FRAMER framer_802154 00296 #define NETSTACK_CONF_RADIO rf230_driver 00297 #define CHANNEL_802_15_4 26 00298 #define RF230_CONF_AUTOACK 1 00299 #define SICSLOWPAN_CONF_FRAG 1 00300 #define SICSLOWPAN_CONF_MAXAGE 3 00301 #define CXMAC_CONF_ANNOUNCEMENTS 0 00302 #define NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE 8 00303 /* 211 bytes per queue buffer. Burst mode will need 15 for a 1280 byte MTU */ 00304 #define QUEUEBUF_CONF_NUM 15 00305 /* 54 bytes per queue ref buffer */ 00306 #define QUEUEBUF_CONF_REF_NUM 2 00307 /* Allocate remaining RAM. Not much left due to queuebuf increase */ 00308 #define UIP_CONF_MAX_CONNECTIONS 2 00309 #define UIP_CONF_MAX_LISTENPORTS 4 00310 #define UIP_CONF_UDP_CONNS 5 00311 #define UIP_CONF_DS6_NBR_NBU 4 00312 #define UIP_CONF_DS6_DEFRT_NBU 2 00313 #define UIP_CONF_DS6_PREFIX_NBU 3 00314 #define UIP_CONF_DS6_ROUTE_NBU 4 00315 #define UIP_CONF_DS6_ADDR_NBU 3 00316 #define UIP_CONF_DS6_MADDR_NBU 0 00317 #define UIP_CONF_DS6_AADDR_NBU 0 00318 //Below gives 10% duty cycle, undef for default 5% 00319 //#define CXMAC_CONF_ON_TIME (RTIMER_ARCH_SECOND / 80) 00320 //Below gives 50% duty cycle 00321 //#define CXMAC_CONF_ON_TIME (RTIMER_ARCH_SECOND / 16) 00322 00323 00324 #else 00325 #error Network configuration not specified! 00326 #endif /* Network setup */ 00327 00328 /* Logging adds 200 bytes to program size */ 00329 #define LOG_CONF_ENABLED 1 00330 00331 /* ************************************************************************** */ 00332 //#pragma mark RPL Settings 00333 /* ************************************************************************** */ 00334 #if UIP_CONF_IPV6_RPL 00335 00336 #define UIP_CONF_ROUTER 1 00337 #define UIP_CONF_ND6_SEND_RA 0 00338 #define UIP_CONF_ND6_REACHABLE_TIME 600000 00339 #define UIP_CONF_ND6_RETRANS_TIMER 10000 00340 /* For slow slip connections, to prevent buffer overruns */ 00341 //#define UIP_CONF_RECEIVE_WINDOW 300 00342 #undef UIP_CONF_FWCACHE_SIZE 00343 #define UIP_CONF_FWCACHE_SIZE 30 00344 #define UIP_CONF_BROADCAST 1 00345 #define UIP_ARCH_IPCHKSUM 1 00346 #define UIP_CONF_PINGADDRCONF 0 00347 #define UIP_CONF_LOGGING 0 00348 00349 #endif /* RPL */ 00350 00351 #define CCIF 00352 #define CLIF 00353 00354 /* include the project config */ 00355 /* PROJECT_CONF_H might be defined in the project Makefile */ 00356 #ifdef PROJECT_CONF_H 00357 #include PROJECT_CONF_H 00358 #endif /* PROJECT_CONF_H */ 00359 00360 #endif /* __CONTIKI_CONF_H__ */