Contiki 3.x
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 RSS2 (radio-sensors.com) platform
37  */
38 
39 #ifndef CONTIKI_CONF_H_
40 #define CONTIKI_CONF_H_
41 
42 /* include the project config */
43 /* PROJECT_CONF_H might be defined in the project Makefile */
44 #ifdef PROJECT_CONF_H
45 #include PROJECT_CONF_H
46 #endif
47 
48 /* Platform name, type, and MCU clock rate */
49 #define PLATFORM_NAME "rss2"
50 #define PLATFORM_TYPE ATMEGA256RFR2
51 #ifndef F_CPU
52 #define F_CPU 8000000UL
53 #endif
54 
55 #include <stdint.h>
56 
57 #ifndef NETSTACK_CONF_MAC
58 #define NETSTACK_CONF_MAC csma_driver
59 #endif
60 
61 #ifndef NETSTACK_CONF_RDC
62 #define NETSTACK_CONF_RDC contikimac_driver
63 #endif
64 
65 #ifndef NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE
66 #define NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE 8
67 #endif
68 
69 #ifndef NETSTACK_CONF_FRAMER
70 #if NETSTACK_CONF_WITH_IPV6
71 #define NETSTACK_CONF_FRAMER contikimac_framer
72 #else
73 #define NETSTACK_CONF_FRAMER framer_802154
74 #endif
75 #endif
76 
77 #ifndef NETSTACK_CONF_RADIO
78 #define NETSTACK_CONF_RADIO rf230_driver
79 #endif
80 
81 #ifndef CHANNEL_802_15_4
82 #define CHANNEL_802_15_4 26
83 #endif
84 
85 /* AUTOACK receive mode gives better rssi measurements, even if ACK is never requested */
86 #ifndef RF230_CONF_AUTOACK
87 #define RF230_CONF_AUTOACK 1
88 #endif
89 
90 #define MCUCSR MCUSR
91 
92 /* The AVR tick interrupt usually is done with an 8 bit counter around 128 Hz.
93  * 125 Hz needs slightly more overhead during the interrupt, as does a 32 bit
94  * clock_time_t.
95  */
96 /* Clock ticks per second */
97 
98 #define CLOCK_CONF_SECOND 128
99 typedef unsigned long clock_time_t;
100 #define CLOCK_LT(a, b) ((signed long)((a) - (b)) < 0)
101 #define INFINITE_TIME 0xffffffff
102 /* These routines are not part of the contiki core but can be enabled in cpu/avr/clock.c */
103 void clock_delay_msec(uint16_t howlong);
104 void clock_adjust_ticks(clock_time_t howmany);
105 
106 /* The radio needs to interrupt during an rtimer interrupt */
107 #define RTIMER_CONF_NESTED_INTERRUPTS 1
108 
109 /* RSS2 boards has a 32768Hz on TIMER2 */
110 #define AVR_CONF_USE32KCRYSTAL 1
111 #define SLIP_PORT RS232_PORT_0
112 
113 /* Pre-allocated memory for loadable modules heap space (in bytes)*/
114 /* Default is 4096. Currently used only when elfloader is present. Not tested on Raven */
115 /* #define MMEM_CONF_SIZE 256 */
116 
117 /* Starting address for code received via the codeprop facility. Not tested. */
118 typedef unsigned long off_t;
119 /* #define EEPROMFS_ADDR_CODEPROP 0x8000 */
120 
121 /* Logging adds 200 bytes to program size. RS232 output slows down webserver. */
122 /* #define LOG_CONF_ENABLED 1 */
123 
124 /* RADIOSTATS is used in rf230bb, clock.c and the webserver cgi to report radio usage */
125 /* It has less overhead than ENERGEST */
126 #define RADIOSTATS 1
127 
128 /* More extensive stats, via main loop printfs or webserver status pages */
129 #define ENERGEST_CONF_ON 1
130 
131 /* Packet statistics */
132 typedef unsigned short uip_stats_t;
133 #define UIP_STATISTICS 0
134 
135 /* Available watchdog timeouts depend on mcu. Default is WDTO_2S. -1 Disables the watchdog. */
136 /* AVR Studio simulator tends to reboot due to clocking the WD 8 times too fast */
137 /* #define WATCHDOG_CONF_TIMEOUT -1 */
138 
139 /* Debugflow macro, useful for tracing path through mac and radio interrupts */
140 /* #define DEBUGFLOWSIZE 128 */
141 
142 /* Define MAX_*X_POWER to reduce tx power and ignore weak rx packets for testing a miniature multihop network.
143  * Leave undefined for full power and sensitivity.
144  * tx=0 (3dbm, default) to 15 (-17.2dbm)
145  * RF230_CONF_AUTOACK sets the extended mode using the energy-detect register with rx=0 (-91dBm) to 84 (-7dBm)
146  * else the rssi register is used having range 0 (91dBm) to 28 (-10dBm)
147  * For simplicity RF230_MIN_RX_POWER is based on the energy-detect value and divided by 3 when autoack is not set.
148  * On the RF230 a reduced rx power threshold will not prevent autoack if enabled and requested.
149  * These numbers applied to both Raven and Jackdaw give a maximum communication distance of about 15 cm
150  * and a 10 meter range to a full-sensitivity RF230 sniffer.
151  *#define RF230_MAX_TX_POWER 15
152  *#define RF230_MIN_RX_POWER 30
153  */
154 /* The rf231 and atmega128rfa1 can use an rssi threshold for triggering rx_busy that saves 0.5ma in rx mode */
155 /* 1 - 15 maps into -90 to -48 dBm; the register is written with RF230_MIN_RX_POWER/6 + 1. Undefine for -100dBm sensitivity */
156 /* #define RF230_MIN_RX_POWER 0 */
157 
158 /* Network setup */
159 /* TX routine passes the cca/ack result in the return parameter */
160 #define RDC_CONF_HARDWARE_ACK 1
161 /* TX routine does automatic cca and optional backoffs */
162 #define RDC_CONF_HARDWARE_CSMA 1
163 /* Allow MCU sleeping between channel checks */
164 #define RDC_CONF_MCU_SLEEP 1
165 
166 #if NETSTACK_CONF_WITH_IPV6
167 #define LINKADDR_CONF_SIZE 8
168 #define UIP_CONF_ICMP6 1
169 #define UIP_CONF_UDP 1
170 #ifndef UIP_CONF_TCP
171 #define UIP_CONF_TCP 1
172 #endif
173 #define NETSTACK_CONF_NETWORK sicslowpan_driver
174 #define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_HC06
175 #else
176 /* ip4 should build but is largely untested */
177 #define LINKADDR_CONF_SIZE 2
178 #define NETSTACK_CONF_NETWORK rime_driver
179 #endif
180 
181 #define UIP_CONF_LL_802154 1
182 #define UIP_CONF_LLH_LEN 0
183 
184 /* 10 bytes per stateful address context - see sicslowpan.c */
185 /* Default is 1 context with prefix aaaa::/64 */
186 /* These must agree with all the other nodes or there will be a failure to communicate! */
187 #define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 1
188 #define SICSLOWPAN_CONF_ADDR_CONTEXT_0 { addr_contexts[0].prefix[0] = 0xaa; addr_contexts[0].prefix[1] = 0xaa; }
189 #define SICSLOWPAN_CONF_ADDR_CONTEXT_1 { addr_contexts[1].prefix[0] = 0xbb; addr_contexts[1].prefix[1] = 0xbb; }
190 #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; }
191 
192 /* Take the default TCP maximum segment size for efficiency and simpler wireshark captures */
193 /* Use this to prevent 6LowPAN fragmentation (whether or not fragmentation is enabled) */
194 /* #define UIP_CONF_TCP_MSS 48 */
195 
196 #define UIP_CONF_IP_FORWARD 0
197 #define UIP_CONF_FWCACHE_SIZE 0
198 
199 #define UIP_CONF_IPV6_CHECKS 1
200 #define UIP_CONF_IPV6_QUEUE_PKT 1
201 #define UIP_CONF_IPV6_REASSEMBLY 0
202 
203 #define UIP_CONF_UDP_CHECKSUMS 1
204 #define UIP_CONF_TCP_SPLIT 1
205 #define UIP_CONF_DHCP_LIGHT 1
206 
207 #if 0 /* No radio cycling */
208 
209 #define NETSTACK_CONF_MAC nullmac_driver
210 #define NETSTACK_CONF_RDC sicslowmac_driver
211 #define NETSTACK_CONF_FRAMER framer_802154
212 /* 1 + Number of auto retry attempts 0-15 (0 implies don't use extended TX_ARET_ON mode) */
213 #define RF230_CONF_FRAME_RETRIES 2
214 /* Number of csma retry attempts 0-5 in extended tx mode (7 does immediate tx with no csma) */
215 #define RF230_CONF_CSMA_RETRIES 5
216 /* Default is one RAM buffer for received packets. More than one may benefit multiple TCP connections or ports */
217 #define RF230_CONF_RX_BUFFERS 3
218 #define SICSLOWPAN_CONF_FRAG 1
219 /* Most browsers reissue GETs after 3 seconds which stops fragment reassembly so a longer MAXAGE does no good */
220 #define SICSLOWPAN_CONF_MAXAGE 3
221 /* How long to wait before terminating an idle TCP connection. Smaller to allow faster sleep. Default is 120 seconds */
222 /* If wait is too short the connection can be reset as a result of multiple fragment reassembly timeouts */
223 #define UIP_CONF_WAIT_TIMEOUT 20
224 /* 54 bytes per queue ref buffer */
225 #define QUEUEBUF_CONF_REF_NUM 2
226 /* Allocate remaining RAM as desired */
227 /* 30 bytes per TCP connection */
228 /* 6LoWPAN does not do well with concurrent TCP streams, as new browser GETs collide with packets coming */
229 /* from previous GETs, causing decreased throughput, retransmissions, and timeouts. Increase to study this. */
230 /* ACKs to other ports become interleaved with computation-intensive GETs, so ACKs are particularly missed. */
231 /* Increasing the number of packet receive buffers in RAM helps to keep ACKs from being lost */
232 #define UIP_CONF_MAX_CONNECTIONS 4
233 /* 2 bytes per TCP listening port */
234 #define UIP_CONF_MAX_LISTENPORTS 4
235 /* 25 bytes per UDP connection */
236 #define UIP_CONF_UDP_CONNS 10
237 /* See uip-ds6.h */
238 #define NBR_TABLE_CONF_MAX_NEIGHBORS 20
239 #define UIP_CONF_DS6_DEFRT_NBU 2
240 #define UIP_CONF_DS6_PREFIX_NBU 3
241 #define UIP_CONF_MAX_ROUTES 20
242 #define UIP_CONF_DS6_ADDR_NBU 3
243 #define UIP_CONF_DS6_MADDR_NBU 0
244 #define UIP_CONF_DS6_AADDR_NBU 0
245 
246 #elif 1 /* Contiki-mac radio cycling */
247 /* #define NETSTACK_CONF_MAC nullmac_driver */
248 /* csma needed for burst mode at present. Webserver won't work without it */
249 /* #define NETSTACK_CONF_MAC csma_driver */
250 /* #define NETSTACK_CONF_RDC contikimac_driver */
251 /* Default is two CCA separated by 500 usec */
252 
253 /* So without the header this needed for RPL mesh to form */
254 #define CONTIKIMAC_FRAMER_CONF_SHORTEST_PACKET_SIZE (43 - 18) /* multicast RPL DIS length */
255 /* Not tested much yet */
256 #define CONTIKIMAC_CONF_WITH_PHASE_OPTIMIZATION 0
257 #define CONTIKIMAC_CONF_COMPOWER 1
258 #define RIMESTATS_CONF_ENABLED 0
259 
260 /* A 0 here means non-extended mode; 1 means extended mode with no retry, >1 for retrys */
261 /* Contikimac strobes on its own, but hardware retries are faster */
262 #define RF230_CONF_FRAME_RETRIES 1
263 /* Long csma backoffs will compromise radio cycling; set to 0 for 1 csma */
264 #define RF230_CONF_CSMA_RETRIES 0
265 #define SICSLOWPAN_CONF_FRAG 1
266 #define SICSLOWPAN_CONF_MAXAGE 3
267 /* 54 bytes per queue ref buffer */
268 #define QUEUEBUF_CONF_REF_NUM 2
269 /* Allocate remaining RAM. Not much left due to queuebuf increase */
270 #define UIP_CONF_MAX_CONNECTIONS 2
271 #define UIP_CONF_MAX_LISTENPORTS 4
272 #define UIP_CONF_UDP_CONNS 5
273 #define NBR_TABLE_CONF_MAX_NEIGHBORS 20
274 #define UIP_CONF_DS6_DEFRT_NBU 2
275 #define UIP_CONF_DS6_PREFIX_NBU 3
276 #define UIP_CONF_MAX_ROUTES 4
277 #define UIP_CONF_DS6_ADDR_NBU 3
278 #define UIP_CONF_DS6_MADDR_NBU 0
279 #define UIP_CONF_DS6_AADDR_NBU 0
280 
281 #elif 0 /* cx-mac radio cycling */
282 /* RF230 does clear-channel assessment in extended mode (autoretries>0) */
283 /* These values are guesses */
284 #define RF230_CONF_FRAME_RETRIES 10
285 #define RF230_CONF_CSMA_RETRIES 2
286 #if RF230_CONF_CSMA_RETRIES
287 #define NETSTACK_CONF_MAC nullmac_driver
288 #else
289 #define NETSTACK_CONF_MAC csma_driver
290 #endif
291 #define NETSTACK_CONF_RDC cxmac_driver
292 #define NETSTACK_CONF_FRAMER framer_802154
293 #define SICSLOWPAN_CONF_FRAG 1
294 #define SICSLOWPAN_CONF_MAXAGE 3
295 #define CXMAC_CONF_ANNOUNCEMENTS 0
296 /* 54 bytes per queue ref buffer */
297 #define QUEUEBUF_CONF_REF_NUM 2
298 /* Allocate remaining RAM. Not much left due to queuebuf increase */
299 #define UIP_CONF_MAX_CONNECTIONS 2
300 #define UIP_CONF_MAX_LISTENPORTS 4
301 #define UIP_CONF_UDP_CONNS 5
302 #define NBR_TABLE_CONF_MAX_NEIGHBORS 4
303 #define UIP_CONF_DS6_DEFRT_NBU 2
304 #define UIP_CONF_DS6_PREFIX_NBU 3
305 #define UIP_CONF_MAX_ROUTES 4
306 #define UIP_CONF_DS6_ADDR_NBU 3
307 #define UIP_CONF_DS6_MADDR_NBU 0
308 #define UIP_CONF_DS6_AADDR_NBU 0
309 /* Below gives 10% duty cycle, undef for default 5% */
310 /* #define CXMAC_CONF_ON_TIME (RTIMER_ARCH_SECOND / 80) */
311 /* Below gives 50% duty cycle */
312 /* #define CXMAC_CONF_ON_TIME (RTIMER_ARCH_SECOND / 16) */
313 
314 #else
315 /* #error Network configuration not specified! */
316 #endif /* Network setup */
317 
318 #ifndef QUEUEBUF_CONF_NUM
319 #define QUEUEBUF_CONF_NUM 15
320 #endif
321 
322 /* ************************************************************************** */
323 /* #pragma mark RPL Settings */
324 /* ************************************************************************** */
325 #if UIP_CONF_IPV6_RPL
326 
327 #define UIP_CONF_ROUTER 1
328 #define UIP_CONF_ND6_SEND_RA 0
329 #define UIP_CONF_ND6_REACHABLE_TIME 600000
330 #define UIP_CONF_ND6_RETRANS_TIMER 10000
331 
332 /* For slow slip connections, to prevent buffer overruns */
333 /* #define UIP_CONF_RECEIVE_WINDOW 300 */
334 #undef UIP_CONF_FWCACHE_SIZE
335 #define UIP_CONF_BUFFER_SIZE 600 /* DHCPv4 packets by ip64 module */
336 #define UIP_CONF_FWCACHE_SIZE 30
337 #define UIP_CONF_BROADCAST 1
338 #define UIP_ARCH_IPCHKSUM 1
339 #define UIP_CONF_PINGADDRCONF 0
340 #define UIP_CONF_LOGGING 0
341 
342 #endif /* RPL */
343 
344 #define CCIF
345 #define CLIF
346 #ifndef CC_CONF_INLINE
347 #define CC_CONF_INLINE inline
348 #endif
349 
350 #endif /* CONTIKI_CONF_H_ */
void clock_delay_msec(uint16_t howlong)
Delay up to 65535 milliseconds.
Definition: clock.c:260
void clock_adjust_ticks(clock_time_t howmany)
Adjust the system current clock time.
Definition: clock.c:289