Contiki-Inga 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 INGA platform
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 #include <stdint.h>
48 #include "platform-conf.h"
49 
50 #include <avr/eeprom.h>
51 
52 /* Skip the last four bytes of the EEPROM, to leave room for things
53  * like the avrdude erase count and bootloader signaling. */
54 #define EEPROM_CONF_SIZE ((E2END + 1) - 4)
55 
56 /* @todo: Just a temporary solution... */
57 #define CFS_CONF_OFFSET_SIZE uint32_t
58 
59 /* Maximum timer interval for 16 bit clock_time_t */
60 #define INFINITE_TIME 0xffff
61 
62 #ifndef PLATFORM_CONF_RADIO
63  #define PLATFORM_RADIO 1
64 #else
65  #define PLATFORM_RADIO PLATFORM_CONF_RADIO
66 #endif
67 
68 /* Maximum tick interval is 0xffff/128 = 511 seconds */
69 #define RIME_CONF_BROADCAST_ANNOUNCEMENT_MAX_TIME INFINITE_TIME/CLOCK_CONF_SECOND /* Default uses 600 */
70 #define COLLECT_CONF_BROADCAST_ANNOUNCEMENT_MAX_TIME INFINITE_TIME/CLOCK_CONF_SECOND /* Default uses 600 */
71 
72 /* The 1284p can use TIMER2 with the external 32768Hz crystal to keep time. Else TIMER0 is used. */
73 /* The sleep timer in raven-lcd.c also uses the crystal and adds a TIMER2 interrupt routine if not already define by clock.c */
74 #define AVR_CONF_USE32KCRYSTAL 1
75 
76 /* Rtimer is implemented through the 16 bit Timer1, clocked at F_CPU through a 1024 prescaler. */
77 /* This gives 7812 counts per second, 128 microsecond precision and maximum interval 8.388 seconds. */
78 /* Change clock source and prescaler for greater precision and shorter maximum interval. */
79 /* 0 will disable the Rtimer code */
80 //#define RTIMER_ARCH_PRESCALER 256UL /*0, 1, 8, 64, 256, 1024 */
81 
82 /* COM port to be used for SLIP connection. */
83 #define SLIP_PORT RS232_PORT_0
84 
85 /* Pre-allocated memory for loadable modules heap space (in bytes)*/
86 /* Default is 4096. Currently used only when elfloader is present. Not tested on Inga */
87 //#define MMEM_CONF_SIZE 256
88 
89 /* Starting address for code received via the codeprop facility. Not tested on Inga */
90 //#define EEPROMFS_ADDR_CODEPROP 0x8000
91 
92 /* RADIO_CONF_CALIBRATE_INTERVAL is used in rf230bb and clock.c. If nonzero a 256 second interval is used */
93 /* Calibration is automatic when the radio wakes so is not necessary when the radio periodically sleeps */
94 //#define RADIO_CONF_CALIBRATE_INTERVAL 256
95 
96 /* RADIOSTATS is used in rf230bb, clock.c and the webserver cgi to report radio usage */
97 #define RADIOSTATS 1
98 
99 /* More extensive stats */
100 #define ENERGEST_CONF_ON 0
101 
102 /* Possible watchdog timeouts depend on mcu. Default is WDTO_2S. -1 Disables the watchdog. */
103 /* AVR Studio simulator tends to reboot due to clocking the WD 8 times too fast */
104 //#define WATCHDOG_CONF_TIMEOUT -1
105 
106 /* Debugflow macro, useful for tracing path through mac and radio interrupts */
107 //#define DEBUGFLOWSIZE 128
108 
109 
110 /* ************************************************************************** */
111 /* Network setup */
112 /* ************************************************************************** */
113 
114 /* Network setup. The new NETSTACK interface requires RF230BB (as does ip4) */
115 #if RF230BB
116 #undef PACKETBUF_CONF_HDR_SIZE //Use the packetbuf default for header size
117 #else /* RF230BB */
118 #define PACKETBUF_CONF_HDR_SIZE 0 //RF230 combined driver/mac handles headers internally
119 #endif /* RF230BB */
120 
121 /* Replace lower 2 bytes of MAC with node ID */
122 #define EUI64_BY_NODE_ID 1
123 
124 /* 211 bytes per queue buffer */
125 #define QUEUEBUF_CONF_NUM 8
126 /* 54 bytes per queue ref buffer */
127 #define QUEUEBUF_CONF_REF_NUM 2
128 
129 /* -- Default network stack */
130 
131 #ifndef NETSTACK_CONF_MAC
132 #define NETSTACK_CONF_MAC nullmac_driver
133 #endif /* NETSTACK_CONF_MAC */
134 
135 #ifndef NETSTACK_CONF_RDC
136 #define NETSTACK_CONF_RDC nullrdc_driver
137 #endif /* NETSTACK_CONF_RDC */
138 
139 #ifndef NETSTACK_CONF_RADIO
140 #define NETSTACK_CONF_RADIO rf230_driver
141 #endif /* NETSTACK_CONF_RADIO */
142 
143 #ifndef NETSTACK_CONF_FRAMER
144 #define NETSTACK_CONF_FRAMER framer_802154
145 #endif /* NETSTACK_CONF_FRAMER */
146 
147 /*
148  * Network stack setup.
149  */
150 #if WITH_UIP6
151 #define NETSTACK_CONF_NETWORK sicslowpan_driver
152 
153 #define LINKADDR_CONF_SIZE 8
154 
155 /* -- UIP IPv6 settings */
156 #define UIP_CONF_ICMP6 1
157 #define UIP_CONF_IPV6 1
158 #define UIP_CONF_IPV6_CHECKS 1
159 #define UIP_CONF_IPV6_QUEUE_PKT 1
160 #define UIP_CONF_IPV6_REASSEMBLY 0
161 /* -- SICSLOWPAN driver settings */
162 #define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_HC06
163 /* Allow 6lowpan fragments (needed for large TCP maximum segment size) */
164 #define SICSLOWPAN_CONF_FRAG 1
165 /* Most browsers reissue GETs after 3 seconds which stops fragment reassembly
166  * so a longer MAXAGE does no good */
167 #define SICSLOWPAN_CONF_MAXAGE 3
168 /* Request 802.15.4 ACK on all packets sent (else autoretry).
169  * This is primarily for testing. */
170 #define SICSLOWPAN_CONF_ACK_ALL 0
171 /* 10 bytes per stateful address context - see sicslowpan.c */
172 /* Default is 1 context with prefix aaaa::/64 */
173 /* These must agree with all the other nodes or there will be a failure to communicate! */
174 #define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 1
175 #define SICSLOWPAN_CONF_ADDR_CONTEXT_0 {addr_contexts[0].prefix[0]=0xaa;addr_contexts[0].prefix[1]=0xaa;}
176 #define SICSLOWPAN_CONF_ADDR_CONTEXT_1 {addr_contexts[1].prefix[0]=0xbb;addr_contexts[1].prefix[1]=0xbb;}
177 #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;}
178 
179 /* See uip-ds6.h */
180 #define UIP_CONF_DS6_NBR_NBU 20
181 #define UIP_CONF_DS6_DEFRT_NBU 2
182 #define UIP_CONF_DS6_PREFIX_NBU 3
183 #define UIP_CONF_MAX_ROUTES 20
184 #define UIP_CONF_DS6_ADDR_NBU 3
185 #define UIP_CONF_DS6_MADDR_NBU 0
186 #define UIP_CONF_DS6_AADDR_NBU 0
187 
188 #else /* WITH_UIP6 */
189 /* ip4 should build but is largely untested */
190 #define NETSTACK_CONF_NETWORK rime_driver
191 
192 #define LINKADDR_CONF_SIZE 2
193 
194 #endif /* WITH_UIP6 */
195 
196 /* -- Radio driver settings */
197 #define CHANNEL_802_15_4 26
198 #define RADIO_CONF_CALIBRATE_INTERVAL 256
199 /* AUTOACK receive mode gives better rssi measurements,
200  * even if ACK is never requested */
201 #define RF230_CONF_AUTOACK 1
202 /* Make nullrdc wait for the proper ACK before proceeding */
203 #define NULLRDC_CONF_802154_AUTOACK 1
204 /* Let the RF230 radio driver generate fake acknowledgements to make nullrdc happy */
205 #define RF320_CONF_INSERTACK 1
206 /* Number of CSMA attempts 0-7. 802.15.4 2003 standard max is 5. */
207 #define RF230_CONF_FRAME_RETRIES 5
208 /* CCA theshold energy -91 to -61 dBm (default -77).
209  * Set this smaller than the expected minimum rssi to avoid packet collisions */
210 /* The Jackdaw menu 'm' command is helpful for determining the smallest ever received rssi */
211 #define RF230_CONF_CCA_THRES -85
212 /* Default is one RAM buffer for received packets. More than one may benefit multiple TCP connections or ports */
213 #define RF230_CONF_RX_BUFFERS 3
214 
215 /* -- UIP settings */
216 #define UIP_CONF_UDP 1
217 #define UIP_CONF_UDP_CHECKSUMS 1
218 #ifndef UIP_CONF_TCP
219 #define UIP_CONF_TCP 1
220 #endif
221 /* How long to wait before terminating an idle TCP connection.
222  * Smaller to allow faster sleep. Default is 120 seconds */
223 #define UIP_CONF_WAIT_TIMEOUT 5
224 /* Take the default TCP maximum segment size for efficiency and simpler wireshark captures */
225 /* Use this to prevent 6LowPAN fragmentation (whether or not fragmentation is enabled) */
226 //#define UIP_CONF_TCP_MSS 48
227 
228 /* 30 bytes per TCP connection */
229 /* 6LoWPAN does not do well with concurrent TCP streams, as new browser GETs collide with packets coming */
230 /* from previous GETs, causing decreased throughput, retransmissions, and timeouts. Increase to study this. */
231 #define UIP_CONF_MAX_CONNECTIONS 1
232 
233 /* 2 bytes per TCP listening port */
234 #define UIP_CONF_MAX_LISTENPORTS 1
235 
236 /* 25 bytes per UDP connection */
237 #define UIP_CONF_UDP_CONNS 10
238 
239 #define UIP_CONF_IP_FORWARD 0
240 #define UIP_CONF_FWCACHE_SIZE 0
241 
242 #define UIP_CONF_DHCP_LIGHT 1
243 /* uip uses 802.15.4 adresses */
244 #define UIP_CONF_LL_802154 1
245 /* no link level header */
246 #define UIP_CONF_LLH_LEN 0
247 
248 #define UIP_CONF_TCP_SPLIT 1
249 
250 /* ************************************************************************** */
251 /* Preset configurable pan Settings */
252 /* ************************************************************************** */
253 
254 // RADIO_PAN_ID
255 #ifndef RADIO_CONF_PAN_ID
256 #define RADIO_PAN_ID IEEE802154_PANID
257 #else /* RADIO_CONF_PAN_ID */
258 #define RADIO_PAN_ID RADIO_CONF_PAN_ID
259 #endif /* RADIO_CONF_PAN_ID */
260 
261 /* Assure NODE_ID is not set manually */
262 #ifdef NODE_ID
263 #undef NODE_ID
264 #warning Use NODE_CONF_ID to define your NodeId
265 #endif /* NODE_ID */
266 
267 // NODE_ID
268 #ifndef NODE_CONF_ID
269 #define NODE_ID 0
270 #else /* NODE_CONF_ID */
271 #define NODE_ID NODE_CONF_ID
272 #endif /* NODE_CONF_ID */
273 
274 #ifndef NODE_CONF_EUI64
275 #define NODE_EUI64 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // means NULL
276 //#define NODE_EUI64 0x02, 0x00, 0x00, 0xFF, 0xFE, 0x00, (NODE_ID >> 6), (NODE_ID & 0xFF)
277 #else
278 #define NODE_EUI64 NODE_CONF_EUI64
279 #endif
280 
281 // RADIO_CHANNEL
282 #ifndef RADIO_CONF_CHANNEL
283 #define RADIO_CHANNEL 26
284 #else /* RADIO_CONF_CHANNEL */
285 #define RADIO_CHANNEL RADIO_CONF_CHANNEL
286 #endif /* RADIO_CONF_CHANNEL */
287 
288 // RADIO_TX_POWER
289 #ifndef RADIO_CONF_TX_POWER
290 #define RADIO_TX_POWER 0
291 #else /* RADIO_CONF_TX_POWER */
292 #define RADIO_TX_POWER RADIO_CONF_TX_POWER
293 #endif /* RADIO_CONF_TX_POWER */
294 
295 /* ************************************************************************** */
296 /* RPL Settings */
297 /* ************************************************************************** */
298 #if UIP_CONF_IPV6_RPL
299 
300 /* Define MAX_*X_POWER to reduce tx power and ignore weak rx packets
301  * for testing a miniature multihop network.
302  * Leave undefined for full power and sensitivity.
303  * tx=0 (3dbm, default) to 15 (-17.2dbm)
304  * RF230_CONF_AUTOACK sets the extended mode using the energy-detect register
305  * with rx=0 (-91dBm) to 84 (-7dBm)
306  * else the rssi register is used having range 0 (91dBm) to 28 (-10dBm)
307  * For simplicity RF230_MIN_RX_POWER is based on the energy-detect value
308  * and divided by 3 when autoack is not set.
309  * On the RF230 a reduced rx power threshold will not prevent autoack
310  * if enabled and requested.
311  * These numbers applied to both Raven and Jackdaw give a maximum
312  * communication distance of about 15 cm
313  * and a 10 meter range to a full-sensitivity RF230 sniffer.
314 #define RF230_MAX_TX_POWER 15
315 #define RF230_MIN_RX_POWER 30
316  */
317 
318 #define UIP_CONF_ROUTER 1
319 #define UIP_CONF_ND6_SEND_RA 0
320 #define UIP_CONF_ND6_REACHABLE_TIME 600000
321 #define UIP_CONF_ND6_RETRANS_TIMER 10000
322 
323 #undef UIP_CONF_UDP_CONNS
324 #define UIP_CONF_UDP_CONNS 12
325 #undef UIP_CONF_FWCACHE_SIZE
326 #define UIP_CONF_FWCACHE_SIZE 30
327 #define UIP_CONF_BROADCAST 1
328 #define UIP_ARCH_IPCHKSUM 1
329 #define UIP_CONF_PINGADDRCONF 0
330 #define UIP_CONF_LOGGING 0
331 
332 #endif /* UIP_CONF_IPV6_RPL */
333 
334 /* Logging adds 200 bytes to program size */
335 #define LOG_CONF_ENABLED 1
336 
337 /** Contiki Core Interface (has no function here)*/
338 #define CCIF
339 /** Contiki Loadable Interface (has no function here) */
340 #define CLIF
341 
342 #ifndef CC_CONF_INLINE
343 #define CC_CONF_INLINE inline
344 #endif
345 
346 /* Include the project config.
347  * PROJECT_CONF_H might be defined in the project Makefile */
348 #ifdef PROJECT_CONF_H
349 #include PROJECT_CONF_H
350 #endif /* PROJECT_CONF_H */
351 
352 #endif /* __CONTIKI_CONF_H__ */