Contiki 2.5
contiki-conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2006, Technical University of Munich
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of the Institute nor the names of its contributors
14  * may be used to endorse or promote products derived from this software
15  * without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  *
29  * This file is part of the Contiki operating system.
30  *
31  * @(#)$$
32  */
33 
34 /**
35  * \file
36  * Configuration for Atmel Raven
37  *
38  * \author
39  * Simon Barner <barner@in.tum.de>
40  * David Kopf <dak664@embarqmail.com>
41  */
42 
43 #ifndef __CONTIKI_CONF_H__
44 #define __CONTIKI_CONF_H__
45 
46 /* MCU and clock rate */
47 #define PLATFORM PLATFORM_AVR
48 //#define RAVEN_REVISION RAVEN_D
49 #define INGA_REVISION INGA_12
50 #include <stdint.h>
51 #include "platform-conf.h"
52 
53 typedef int32_t s32_t;
54 typedef unsigned char u8_t;
55 typedef unsigned short u16_t;
56 typedef unsigned long u32_t;
57 
58 void clock_delay(unsigned int us2);
59 void clock_wait(int ms10);
60 void clock_set_seconds(unsigned long s);
61 unsigned long clock_seconds(void);
62 
63 /* Maximum timer interval for 16 bit clock_time_t */
64 #define INFINITE_TIME 0xffff
65 
66 /* Maximum tick interval is 0xffff/128 = 511 seconds */
67 #define RIME_CONF_BROADCAST_ANNOUNCEMENT_MAX_TIME INFINITE_TIME/CLOCK_CONF_SECOND /* Default uses 600 */
68 #define COLLECT_CONF_BROADCAST_ANNOUNCEMENT_MAX_TIME INFINITE_TIME/CLOCK_CONF_SECOND /* Default uses 600 */
69 
70 /* The 1284p can use TIMER2 with the external 32768Hz crystal to keep time. Else TIMER0 is used. */
71 /* The sleep timer in raven-lcd.c also uses the crystal and adds a TIMER2 interrupt routine if not already define by clock.c */
72 #define AVR_CONF_USE32KCRYSTAL 1
73 
74 /* Rtimer is implemented through the 16 bit Timer1, clocked at F_CPU through a 1024 prescaler. */
75 /* This gives 7812 counts per second, 128 microsecond precision and maximum interval 8.388 seconds. */
76 /* Change clock source and prescaler for greater precision and shorter maximum interval. */
77 /* 0 will disable the Rtimer code */
78 //#define RTIMER_ARCH_PRESCALER 256UL /*0, 1, 8, 64, 256, 1024 */
79 
80 /* COM port to be used for SLIP connection. Not tested on Raven */
81 #define SLIP_PORT RS232_PORT_0
82 
83 /* Pre-allocated memory for loadable modules heap space (in bytes)*/
84 /* Default is 4096. Currently used only when elfloader is present. Not tested on Raven */
85 //#define MMEM_CONF_SIZE 256
86 
87 /* Starting address for code received via the codeprop facility. Not tested on Raven */
88 //#define EEPROMFS_ADDR_CODEPROP 0x8000
89 
90 /* RADIO_CONF_CALIBRATE_INTERVAL is used in rf230bb and clock.c. If nonzero a 256 second interval is used */
91 /* Calibration is automatic when the radio wakes so is not necessary when the radio periodically sleeps */
92 //#define RADIO_CONF_CALIBRATE_INTERVAL 256
93 
94 /* RADIOSTATS is used in rf230bb, clock.c and the webserver cgi to report radio usage */
95 #define RADIOSTATS 1
96 
97 /* More extensive stats */
98 #define ENERGEST_CONF_ON 0
99 
100 /* Use settings manager to save configuration in EEPROM */
101 /* Adds ~1700 bytes to progmem */
102 #define CONTIKI_CONF_SETTINGS_MANAGER 1
103 
104 /* Possible watchdog timeouts depend on mcu. Default is WDTO_2S. -1 Disables the watchdog. */
105 /* AVR Studio simulator tends to reboot due to clocking the WD 8 times too fast */
106 //#define WATCHDOG_CONF_TIMEOUT -1
107 
108 /* Debugflow macro, useful for tracing path through mac and radio interrupts */
109 //#define DEBUGFLOWSIZE 128
110 
111 /* Network setup. The new NETSTACK interface requires RF230BB (as does ip4) */
112 #if RF230BB
113 #undef PACKETBUF_CONF_HDR_SIZE //Use the packetbuf default for header size
114 #else
115 #define PACKETBUF_CONF_HDR_SIZE 0 //RF230 combined driver/mac handles headers internally
116 #endif /*RF230BB */
117 
118 #if UIP_CONF_IPV6
119 #define RIMEADDR_CONF_SIZE 8
120 #define UIP_CONF_ICMP6 1
121 #define UIP_CONF_UDP 1
122 #define UIP_CONF_TCP 1
123 //#define UIP_CONF_IPV6_RPL 0
124 #define NETSTACK_CONF_NETWORK sicslowpan_driver
125 #define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_HC06
126 
127 
128 
129 #elif WITH_DTN
130 #define NETSTACK_CONF_NETWORK dtn_network_driver
131 #define RIMEADDR_CONF_SIZE 2
132 #define UIP_CONF_UDP 0
133 #define UIP_CONF_ICMP6 0
134 #define UIP_CONF_UDP 0
135 #define UIP_CONF_TCP 0
136 #define UIP_CONF_BUFFER_SIZE 1
137 
138 #else
139 /* ip4 should build but is largely untested */
140 #define RIMEADDR_CONF_SIZE 2
141 #define NETSTACK_CONF_NETWORK rime_driver
142 #endif /* UIP_CONF_IPV6 */
143 
144 /* See uip-ds6.h */
145 #define UIP_CONF_DS6_NBR_NBU 20
146 #define UIP_CONF_DS6_DEFRT_NBU 2
147 #define UIP_CONF_DS6_PREFIX_NBU 3
148 #define UIP_CONF_DS6_ROUTE_NBU 20
149 #define UIP_CONF_DS6_ADDR_NBU 3
150 #define UIP_CONF_DS6_MADDR_NBU 0
151 #define UIP_CONF_DS6_AADDR_NBU 0
152 
153 #define UIP_CONF_LL_802154 1
154 #define UIP_CONF_LLH_LEN 0
155 
156 /* 10 bytes per stateful address context - see sicslowpan.c */
157 /* Default is 1 context with prefix aaaa::/64 */
158 /* These must agree with all the other nodes or there will be a failure to communicate! */
159 #define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 1
160 #define SICSLOWPAN_CONF_ADDR_CONTEXT_0 {addr_contexts[0].prefix[0]=0xaa;addr_contexts[0].prefix[1]=0xaa;}
161 #define SICSLOWPAN_CONF_ADDR_CONTEXT_1 {addr_contexts[1].prefix[0]=0xbb;addr_contexts[1].prefix[1]=0xbb;}
162 #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;}
163 
164 /* 211 bytes per queue buffer */
165 #define QUEUEBUF_CONF_NUM 8
166 
167 /* 54 bytes per queue ref buffer */
168 #define QUEUEBUF_CONF_REF_NUM 2
169 
170 /* Take the default TCP maximum segment size for efficiency and simpler wireshark captures */
171 /* Use this to prevent 6LowPAN fragmentation (whether or not fragmentation is enabled) */
172 //#define UIP_CONF_TCP_MSS 48
173 
174 /* 30 bytes per TCP connection */
175 /* 6LoWPAN does not do well with concurrent TCP streams, as new browser GETs collide with packets coming */
176 /* from previous GETs, causing decreased throughput, retransmissions, and timeouts. Increase to study this. */
177 #define UIP_CONF_MAX_CONNECTIONS 1
178 
179 /* 2 bytes per TCP listening port */
180 #define UIP_CONF_MAX_LISTENPORTS 1
181 
182 /* 25 bytes per UDP connection */
183 #define UIP_CONF_UDP_CONNS 10
184 
185 #define UIP_CONF_IP_FORWARD 0
186 #define UIP_CONF_FWCACHE_SIZE 0
187 
188 #define UIP_CONF_IPV6_CHECKS 1
189 #define UIP_CONF_IPV6_QUEUE_PKT 1
190 #define UIP_CONF_IPV6_REASSEMBLY 0
191 
192 #define UIP_CONF_UDP_CHECKSUMS 1
193 #define UIP_CONF_TCP_SPLIT 1
194 #define UIP_CONF_DHCP_LIGHT 1
195 
196 
197 #if WITH_DTN
198 #define CHANNEL_802_15_4 23
199 #define NETSTACK_CONF_MAC csma_driver
200 #define NETSTACK_CONF_RDC nullrdc_driver
201 #define NETSTACK_CONF_FRAMER framer_802154
202 #define NETSTACK_CONF_RADIO rf230_driver
203 #define RF230_CONF_AUTOACK 1
204 #define SICSLOWPAN_CONF_ACK_ALL 0
205 #define RF230_CONF_AUTORETRIES 2
206 
207 #ifndef QUEUEBUF_CONF_NUM
208 #define QUEUEBUF_CONF_NUM 16
209 #endif
210 
211 #elif 1 /* No radio cycling */
212 #define NETSTACK_CONF_MAC nullmac_driver
213 #define NETSTACK_CONF_RDC nullrdc_driver
214 #define NETSTACK_CONF_FRAMER framer_802154
215 #define NETSTACK_CONF_RADIO rf230_driver
216 #define CHANNEL_802_15_4 26
217 #define RADIO_CONF_CALIBRATE_INTERVAL 256
218 /* AUTOACK receive mode gives better rssi measurements, even if ACK is never requested */
219 #define RF230_CONF_AUTOACK 1
220 /* Request 802.15.4 ACK on all packets sent (else autoretry). This is primarily for testing. */
221 #define SICSLOWPAN_CONF_ACK_ALL 0
222 /* Number of auto retry attempts+1, 1-16. Set zero to disable extended TX_ARET_ON mode with CCA) */
223 #define RF230_CONF_AUTORETRIES 3
224 /* Number of CSMA attempts 0-7. 802.15.4 2003 standard max is 5. */
225 #define RF230_CONF_CSMARETRIES 5
226 /* CCA theshold energy -91 to -61 dBm (default -77). Set this smaller than the expected minimum rssi to avoid packet collisions */
227 /* The Jackdaw menu 'm' command is helpful for determining the smallest ever received rssi */
228 #define RF230_CONF_CCA_THRES -85
229 /* Allow 6lowpan fragments (needed for large TCP maximum segment size) */
230 #define SICSLOWPAN_CONF_FRAG 1
231 /* Most browsers reissue GETs after 3 seconds which stops fragment reassembly so a longer MAXAGE does no good */
232 #define SICSLOWPAN_CONF_MAXAGE 3
233 /* How long to wait before terminating an idle TCP connection. Smaller to allow faster sleep. Default is 120 seconds */
234 #define UIP_CONF_WAIT_TIMEOUT 5
235 
236 #elif 1 /* Contiki-mac radio cycling */
237 #define NETSTACK_CONF_MAC nullmac_driver
238 //#define NETSTACK_CONF_MAC csma_driver
239 #define NETSTACK_CONF_RDC nullrdc_driver
240 #define NETSTACK_CONF_FRAMER framer_802154
241 #define NETSTACK_CONF_RADIO rf230_driver
242 #define CHANNEL_802_15_4 26
243 /* The radio needs to interrupt during an rtimer interrupt */
244 #define RTIMER_CONF_NESTED_INTERRUPTS 1
245 #define RF230_CONF_AUTOACK 1
246 #define RF230_CONF_AUTORETRIES 1
247 #define RF230_CONF_CSMARETRIES 1
248 #define CONTIKIMAC_CONF_RADIO_ALWAYS_ON 0
249 #define SICSLOWPAN_CONF_FRAG 1
250 #define SICSLOWPAN_CONF_MAXAGE 3
251 #define NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE 8
252 
253 #elif 1 /* cx-mac radio cycling */
254 /* RF230 does clear-channel assessment in extended mode (autoretries>0) */
255 #define RF230_CONF_AUTORETRIES 1
256 #if RF230_CONF_AUTORETRIES
257 #define NETSTACK_CONF_MAC nullmac_driver
258 #else
259 #define NETSTACK_CONF_MAC csma_driver
260 #endif
261 #define NETSTACK_CONF_RDC cxmac_driver
262 #define NETSTACK_CONF_FRAMER framer_802154
263 #define NETSTACK_CONF_RADIO rf230_driver
264 #define CHANNEL_802_15_4 26
265 #define RF230_CONF_AUTOACK 1
266 #define SICSLOWPAN_CONF_FRAG 1
267 #define SICSLOWPAN_CONF_MAXAGE 3
268 #define CXMAC_CONF_ANNOUNCEMENTS 0
269 #define NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE 8
270 
271 //Below gives 10% duty cycle, undef for default 5%
272 //#define CXMAC_CONF_ON_TIME (RTIMER_ARCH_SECOND / 80)
273 //Below gives 50% duty cycle
274 //#define CXMAC_CONF_ON_TIME (RTIMER_ARCH_SECOND / 16)
275 
276 #else
277 #error Network configuration not specified!
278 #endif /* Network setup */
279 
280 /* Logging adds 200 bytes to program size */
281 #define LOG_CONF_ENABLED 1
282 
283 /* ************************************************************************** */
284 //#pragma mark RPL Settings
285 /* ************************************************************************** */
286 #if UIP_CONF_IPV6_RPL
287 
288 /* Define MAX_*X_POWER to reduce tx power and ignore weak rx packets for testing a miniature multihop network.
289  * Leave undefined for full power and sensitivity.
290  * tx=0 (3dbm, default) to 15 (-17.2dbm)
291  * RF230_CONF_AUTOACK sets the extended mode using the energy-detect register with rx=0 (-91dBm) to 84 (-7dBm)
292  * else the rssi register is used having range 0 (91dBm) to 28 (-10dBm)
293  * For simplicity RF230_MIN_RX_POWER is based on the energy-detect value and divided by 3 when autoack is not set.
294  * On the RF230 a reduced rx power threshold will not prevent autoack if enabled and requested.
295  * These numbers applied to both Raven and Jackdaw give a maximum communication distance of about 15 cm
296  * and a 10 meter range to a full-sensitivity RF230 sniffer.
297 #define RF230_MAX_TX_POWER 15
298 #define RF230_MIN_RX_POWER 30
299  */
300 
301 #define UIP_CONF_ROUTER 1
302 #define UIP_CONF_ND6_SEND_RA 0
303 #define UIP_CONF_ND6_REACHABLE_TIME 600000
304 #define UIP_CONF_ND6_RETRANS_TIMER 10000
305 
306 #undef UIP_CONF_UDP_CONNS
307 #define UIP_CONF_UDP_CONNS 12
308 #undef UIP_CONF_FWCACHE_SIZE
309 #define UIP_CONF_FWCACHE_SIZE 30
310 #define UIP_CONF_BROADCAST 1
311 #define UIP_ARCH_IPCHKSUM 1
312 #define UIP_CONF_PINGADDRCONF 0
313 #define UIP_CONF_LOGGING 0
314 
315 #endif /* RPL */
316 
317 #define CCIF
318 #define CLIF
319 
320 /* include the project config */
321 /* PROJECT_CONF_H might be defined in the project Makefile */
322 #ifdef PROJECT_CONF_H
323 #include PROJECT_CONF_H
324 #endif /* PROJECT_CONF_H */
325 
326 #endif /* __CONTIKI_CONF_H__ */