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 ATmega128rfa1
37  * \author
38  * David Kopf <dak664@embarqmail.com>
39  */
40 
41 #ifndef __CONTIKI_CONF_H__
42 #define __CONTIKI_CONF_H__
43 
44 /* MCU and clock rate */
45 #define PLATFORM PLATFORM_AVR
46 #define HARWARE_REVISION ATMEGA128RFA1
47 #ifndef F_CPU
48 #define F_CPU 8000000UL
49 #endif
50 #include <stdint.h>
51 
52 typedef int32_t s32_t;
53 typedef unsigned char u8_t;
54 typedef unsigned short u16_t;
55 typedef unsigned long u32_t;
56 typedef unsigned short clock_time_t;
57 typedef unsigned short uip_stats_t;
58 typedef unsigned long off_t;
59 
60 void clock_delay(unsigned int us2);
61 void clock_wait(int ms10);
62 void clock_set_seconds(unsigned long s);
63 unsigned long clock_seconds(void);
64 
65 /* Maximum timer interval for 16 bit clock_time_t */
66 #define INFINITE_TIME 0xffff
67 
68 /* Clock ticks per second */
69 #define CLOCK_CONF_SECOND 128
70 
71 /* Maximum tick interval is 0xffff/128 = 511 seconds */
72 #define RIME_CONF_BROADCAST_ANNOUNCEMENT_MAX_TIME INFINITE_TIME/CLOCK_CONF_SECOND /* Default uses 600 */
73 #define COLLECT_CONF_BROADCAST_ANNOUNCEMENT_MAX_TIME INFINITE_TIME/CLOCK_CONF_SECOND /* Default uses 600 */
74 
75 /* Michael Hartman's atmega128rfa1 board has an external 32768Hz crystal connected to TOSC1 and 2 pins similar to the Raven 1284p */
76 /* and theoretically can use TIMER2 with it to keep time. Else TIMER0 is used. */
77 /* The sleep timer in raven-lcd.c also uses the crystal and adds a TIMER2 interrupt routine if not already define by clock.c */
78 /* This has not been tested yet */
79 #define AVR_CONF_USE32KCRYSTAL 0
80 
81 /* Michael Hartman's protobyte board has LED on PORTE1, can be used for pings and radio on indication */
82 /* However it requires disabling UART0. */
83 #define RF230BB_CONF_LEDONPORTE1 1
84 
85 /* COM port to be used for SLIP connection. This is usually UART0, but see above */
86 #if RF230BB_CONF_LEDONPORTE1
87 #define SLIP_PORT RS232_PORT_1
88 #else
89 #define SLIP_PORT RS232_PORT_0
90 #endif
91 
92 /* Pre-allocated memory for loadable modules heap space (in bytes)*/
93 /* Default is 4096. Currently used only when elfloader is present. Not tested on Raven */
94 //#define MMEM_CONF_SIZE 256
95 
96 /* Starting address for code received via the codeprop facility. Not tested on Raven */
97 //#define EEPROMFS_ADDR_CODEPROP 0x8000
98 
99 /* RADIOSTATS is used in rf230bb, clock.c and the webserver cgi to report radio usage */
100 #define RADIOSTATS 1
101 
102 /* More extensive stats */
103 #define ENERGEST_CONF_ON 1
104 
105 /* Possible watchdog timeouts depend on mcu. Default is WDTO_2S. -1 Disables the watchdog. */
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 #else
127 /* ip4 should build but is largely untested */
128 #define RIMEADDR_CONF_SIZE 2
129 #define NETSTACK_CONF_NETWORK rime_driver
130 #endif /* UIP_CONF_IPV6 */
131 
132 /* See uip-ds6.h */
133 #define UIP_CONF_DS6_NBR_NBU 20
134 #define UIP_CONF_DS6_DEFRT_NBU 2
135 #define UIP_CONF_DS6_PREFIX_NBU 3
136 #define UIP_CONF_DS6_ROUTE_NBU 20
137 #define UIP_CONF_DS6_ADDR_NBU 3
138 #define UIP_CONF_DS6_MADDR_NBU 0
139 #define UIP_CONF_DS6_AADDR_NBU 0
140 
141 #define UIP_CONF_LL_802154 1
142 #define UIP_CONF_LLH_LEN 0
143 
144 /* 10 bytes per stateful address context - see sicslowpan.c */
145 /* Default is 1 context with prefix aaaa::/64 */
146 /* These must agree with all the other nodes or there will be a failure to communicate! */
147 #define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 1
148 #define SICSLOWPAN_CONF_ADDR_CONTEXT_0 {addr_contexts[0].prefix[0]=0xaa;addr_contexts[0].prefix[1]=0xaa;}
149 #define SICSLOWPAN_CONF_ADDR_CONTEXT_1 {addr_contexts[1].prefix[0]=0xbb;addr_contexts[1].prefix[1]=0xbb;}
150 #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;}
151 
152 /* 211 bytes per queue buffer */
153 #define QUEUEBUF_CONF_NUM 8
154 
155 /* 54 bytes per queue ref buffer */
156 #define QUEUEBUF_CONF_REF_NUM 2
157 
158 /* Take the default TCP maximum segment size for efficiency and simpler wireshark captures */
159 /* Use this to prevent 6LowPAN fragmentation (whether or not fragmentation is enabled) */
160 //#define UIP_CONF_TCP_MSS 48
161 
162 /* 30 bytes per TCP connection */
163 /* 6LoWPAN does not do well with concurrent TCP streams, as new browser GETs collide with packets coming */
164 /* from previous GETs, causing decreased throughput, retransmissions, and timeouts. Increase to study this. */
165 /* ACKs to other ports become interleaved with computation-intensive GETs, so ACKs are particularly missed. */
166 /* Increasing the number of packet receive buffers in RAM helps to keep ACKs from being lost */
167 
168 #define UIP_CONF_MAX_CONNECTIONS 4
169 
170 /* 2 bytes per TCP listening port */
171 #define UIP_CONF_MAX_LISTENPORTS 4
172 
173 /* 25 bytes per UDP connection */
174 #define UIP_CONF_UDP_CONNS 10
175 
176 #define UIP_CONF_IP_FORWARD 0
177 #define UIP_CONF_FWCACHE_SIZE 0
178 
179 #define UIP_CONF_IPV6_CHECKS 1
180 #define UIP_CONF_IPV6_QUEUE_PKT 1
181 #define UIP_CONF_IPV6_REASSEMBLY 0
182 
183 #define UIP_CONF_UDP_CHECKSUMS 1
184 #define UIP_CONF_TCP_SPLIT 1
185 #define UIP_CONF_DHCP_LIGHT 1
186 
187 
188 #if 1 /* No radio cycling */
189 
190 #define NETSTACK_CONF_MAC nullmac_driver
191 #define NETSTACK_CONF_RDC sicslowmac_driver
192 #define NETSTACK_CONF_FRAMER framer_802154
193 #define NETSTACK_CONF_RADIO rf230_driver
194 #define CHANNEL_802_15_4 26
195 /* AUTOACK receive mode gives better rssi measurements, even if ACK is never requested */
196 #define RF230_CONF_AUTOACK 1
197 /* Request 802.15.4 ACK on all packets sent (else autoretry). This is primarily for testing. */
198 #define SICSLOWPAN_CONF_ACK_ALL 0
199 /* Number of auto retry attempts 0-15 (0 implies don't use extended TX_ARET_ON mode with CCA) */
200 #define RF230_CONF_AUTORETRIES 2
201 /* Default is one RAM buffer for received packets. More than one may benefit multiple TCP connections or ports */
202 #define RF230_CONF_RX_BUFFERS 3
203 #define SICSLOWPAN_CONF_FRAG 1
204 /* Most browsers reissue GETs after 3 seconds which stops fragment reassembly so a longer MAXAGE does no good */
205 #define SICSLOWPAN_CONF_MAXAGE 3
206 /* How long to wait before terminating an idle TCP connection. Smaller to allow faster sleep. Default is 120 seconds */
207 /* If wait is too short the connection can be reset as a result of multiple fragment reassembly timeouts */
208 #define UIP_CONF_WAIT_TIMEOUT 20
209 
210 #elif 1 /* Contiki-mac radio cycling */
211 #define NETSTACK_CONF_MAC nullmac_driver
212 //#define NETSTACK_CONF_MAC csma_driver
213 #define NETSTACK_CONF_RDC contikimac_driver
214 #define NETSTACK_CONF_FRAMER framer_802154
215 #define NETSTACK_CONF_RADIO rf230_driver
216 #define CHANNEL_802_15_4 26
217 /* The radio needs to interrupt during an rtimer interrupt */
218 #define RTIMER_CONF_NESTED_INTERRUPTS 1
219 #define RF230_CONF_AUTOACK 1
220 #define RF230_CONF_AUTORETRIES 1
221 #define RF230_CONF_CSMARETRIES 1
222 #define CONTIKIMAC_CONF_RADIO_ALWAYS_ON 0
223 #define SICSLOWPAN_CONF_FRAG 1
224 #define SICSLOWPAN_CONF_MAXAGE 3
225 #define NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE 8
226 
227 #elif 1 /* cx-mac radio cycling */
228 /* RF230 does clear-channel assessment in extended mode (autoretries>0) */
229 #define RF230_CONF_AUTORETRIES 1
230 #if RF230_CONF_AUTORETRIES
231 #define NETSTACK_CONF_MAC nullmac_driver
232 #else
233 #define NETSTACK_CONF_MAC csma_driver
234 #endif
235 #define NETSTACK_CONF_RDC cxmac_driver
236 #define NETSTACK_CONF_FRAMER framer_802154
237 #define NETSTACK_CONF_RADIO rf230_driver
238 #define CHANNEL_802_15_4 26
239 #define RF230_CONF_AUTOACK 1
240 #define SICSLOWPAN_CONF_FRAG 1
241 #define SICSLOWPAN_CONF_MAXAGE 3
242 #define CXMAC_CONF_ANNOUNCEMENTS 0
243 #define NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE 8
244 
245 //Below gives 10% duty cycle, undef for default 5%
246 //#define CXMAC_CONF_ON_TIME (RTIMER_ARCH_SECOND / 80)
247 //Below gives 50% duty cycle
248 //#define CXMAC_CONF_ON_TIME (RTIMER_ARCH_SECOND / 16)
249 
250 #else
251 #error Network configuration not specified!
252 #endif /* Network setup */
253 
254 /* Logging adds 200 bytes to program size */
255 #define LOG_CONF_ENABLED 1
256 
257 /* ************************************************************************** */
258 //#pragma mark RPL Settings
259 /* ************************************************************************** */
260 #if UIP_CONF_IPV6_RPL
261 
262 /* Define MAX_*X_POWER to reduce tx power and ignore weak rx packets for testing a miniature multihop network.
263  * Leave undefined for full power and sensitivity.
264  * tx=0 (3dbm, default) to 15 (-17.2dbm)
265  * RF230_CONF_AUTOACK sets the extended mode using the energy-detect register with rx=0 (-91dBm) to 84 (-7dBm)
266  * else the rssi register is used having range 0 (91dBm) to 28 (-10dBm)
267  * For simplicity RF230_MIN_RX_POWER is based on the energy-detect value and divided by 3 when autoack is not set.
268  * On the RF230 a reduced rx power threshold will not prevent autoack if enabled and requested.
269  * These numbers applied to both Raven and Jackdaw give a maximum communication distance of about 15 cm
270  * and a 10 meter range to a full-sensitivity RF230 sniffer.
271 #define RF230_MAX_TX_POWER 15
272 #define RF230_MIN_RX_POWER 30
273  */
274 
275 #define UIP_CONF_ROUTER 1
276 #define UIP_CONF_ND6_SEND_RA 0
277 #define UIP_CONF_ND6_REACHABLE_TIME 600000
278 #define UIP_CONF_ND6_RETRANS_TIMER 10000
279 
280 #undef UIP_CONF_UDP_CONNS
281 #define UIP_CONF_UDP_CONNS 12
282 /* For slow slip connections, to prevent buffer overruns */
283 //#define UIP_CONF_RECEIVE_WINDOW 300
284 #undef UIP_CONF_FWCACHE_SIZE
285 #define UIP_CONF_FWCACHE_SIZE 30
286 #define UIP_CONF_BROADCAST 1
287 #define UIP_ARCH_IPCHKSUM 1
288 #define UIP_CONF_PINGADDRCONF 0
289 #define UIP_CONF_LOGGING 0
290 
291 #endif /* RPL */
292 
293 #define CCIF
294 #define CLIF
295 
296 /* include the project config */
297 /* PROJECT_CONF_H might be defined in the project Makefile */
298 #ifdef PROJECT_CONF_H
299 #include PROJECT_CONF_H
300 #endif /* PROJECT_CONF_H */
301 #endif /* __CONTIKI_CONF_H__ */