Contiki-Inga 3.x
contiki-conf.h
Go to the documentation of this file.
1 /**
2  * \addtogroup cc2538
3  * @{
4  *
5  * \file
6  * Configuration for the cc2538dk platform
7  */
8 #ifndef CONTIKI_CONF_H_
9 #define CONTIKI_CONF_H_
10 
11 #include <stdint.h>
12 #include <string.h>
13 /*---------------------------------------------------------------------------*/
14 /* Include Project Specific conf */
15 #ifdef PROJECT_CONF_H
16 #include PROJECT_CONF_H
17 #endif /* PROJECT_CONF_H */
18 /*---------------------------------------------------------------------------*/
19 /**
20  * \name Compiler configuration and platform-specific type definitions
21  *
22  * Those values are not meant to be modified by the user
23  * @{
24  */
25 #define CLOCK_CONF_SECOND 128
26 
27 /* Compiler configurations */
28 #define CCIF
29 #define CLIF
30 
31 /* Platform typedefs */
32 typedef uint32_t clock_time_t;
33 typedef uint32_t uip_stats_t;
34 
35 /*
36  * rtimer.h typedefs rtimer_clock_t as unsigned short. We need to define
37  * RTIMER_CLOCK_LT to override this
38  */
39 typedef uint32_t rtimer_clock_t;
40 #define RTIMER_CLOCK_LT(a,b) ((int32_t)((a)-(b)) < 0)
41 /** @} */
42 /*---------------------------------------------------------------------------*/
43 /**
44  * \name Serial Boot Loader Backdoor configuration
45  *
46  * @{
47  */
48 #ifndef FLASH_CCA_CONF_BOOTLDR_BACKDOOR
49 #define FLASH_CCA_CONF_BOOTLDR_BACKDOOR 1 /**<Enable the boot loader backdoor */
50 #endif
51 /** @} */
52 /*---------------------------------------------------------------------------*/
53 /**
54  * \name USB 'core' configuration
55  *
56  * Those values are not meant to be modified by the user, except where stated
57  * otherwise
58  * @{
59  */
60 #define CTRL_EP_SIZE 8
61 #define USB_EP1_SIZE 32
62 #define USB_EP2_SIZE 64
63 #define USB_EP3_SIZE 64
64 #define USB_ARCH_WRITE_NOTIFY 0
65 
66 #ifndef USB_ARCH_CONF_DMA
67 #define USB_ARCH_CONF_DMA 1 /**< Change to Enable/Disable USB DMA */
68 
69 #endif
70 /** @} */
71 /*---------------------------------------------------------------------------*/
72 /**
73  * \name Generic Configuration directives
74  *
75  * @{
76  */
77 #ifndef ENERGEST_CONF_ON
78 #define ENERGEST_CONF_ON 0 /**< Energest Module */
79 #endif
80 
81 #ifndef STARTUP_CONF_VERBOSE
82 #define STARTUP_CONF_VERBOSE 1 /**< Set to 0 to decrease startup verbosity */
83 #endif
84 /** @} */
85 /*---------------------------------------------------------------------------*/
86 /**
87  * \name uDMA Configuration and channel allocations
88  *
89  * @{
90  */
91 #define USB_ARCH_CONF_RX_DMA_CHAN 0 /**< USB -> RAM DMA channel */
92 #define USB_ARCH_CONF_TX_DMA_CHAN 1 /**< RAM -> USB DMA channel */
93 #define CC2538_RF_CONF_TX_DMA_CHAN 2 /**< RF -> RAM DMA channel */
94 #define CC2538_RF_CONF_RX_DMA_CHAN 3 /**< RAM -> RF DMA channel */
95 #define UDMA_CONF_MAX_CHANNEL CC2538_RF_CONF_RX_DMA_CHAN
96 /** @} */
97 /*---------------------------------------------------------------------------*/
98 /**
99  * \name Character I/O Configuration
100  *
101  * @{
102  */
103 #ifndef UART_CONF_ENABLE
104 #define UART_CONF_ENABLE 1 /**< Enable/Disable UART I/O */
105 #endif
106 
107 #ifndef UART_CONF_BAUD_RATE
108 #define UART_CONF_BAUD_RATE 115200 /**< Default baud rate */
109 #endif
110 
111 #ifndef SLIP_ARCH_CONF_USB
112 #define SLIP_ARCH_CONF_USB 0 /**< SLIP over UART by default */
113 #endif
114 #ifndef CC2538_RF_CONF_SNIFFER_USB
115 #define CC2538_RF_CONF_SNIFFER_USB 0 /**< Sniffer out over UART by default */
116 #endif
117 #ifndef DBG_CONF_USB
118 #define DBG_CONF_USB 0 /**< All debugging over UART by default */
119 #endif
120 
121 /* Turn off example-provided putchars */
122 #define SLIP_BRIDGE_CONF_NO_PUTCHAR 1
123 #define SLIP_RADIO_CONF_NO_PUTCHAR 1
124 
125 #ifndef SLIP_ARCH_CONF_ENABLED
126 /*
127  * Determine whether we need SLIP
128  * This will keep working while UIP_FALLBACK_INTERFACE and CMD_CONF_OUTPUT
129  * keep using SLIP
130  */
131 #if defined (UIP_FALLBACK_INTERFACE) || defined (CMD_CONF_OUTPUT)
132 #define SLIP_ARCH_CONF_ENABLED 1
133 #endif
134 #endif
135 
136 /*
137  * When set, the radio turns off address filtering and sends all captured
138  * frames down a peripheral (UART or USB, depending on the value of
139  * CC2538_RF_CONF_SNIFFER_USB)
140  */
141 #ifndef CC2538_RF_CONF_SNIFFER
142 #define CC2538_RF_CONF_SNIFFER 0
143 #endif
144 
145 /**
146  * \brief Define this as 1 to build a headless node.
147  *
148  * The UART will not be initialised its clock will be gated, offering some
149  * energy savings. The USB will not be initialised either
150  */
151 #ifndef CC2538_CONF_QUIET
152 #define CC2538_CONF_QUIET 0
153 #endif
154 
155 /* CC2538_CONF_QUIET is hard and overrides all other related defines */
156 #if CC2538_CONF_QUIET
157 #undef USB_SERIAL_CONF_ENABLE
158 #define USB_SERIAL_CONF_ENABLE 0
159 
160 #undef UART_CONF_ENABLE
161 #define UART_CONF_ENABLE 0
162 
163 #undef STARTUP_CONF_VERBOSE
164 #define STARTUP_CONF_VERBOSE 0
165 
166 /* Little sanity check: We can't have quiet sniffers */
167 #if CC2538_RF_CONF_SNIFFER
168 #error "CC2538_RF_CONF_SNIFFER == 1 and CC2538_CONF_QUIET == 1"
169 #error "These values are conflicting. Please set either to 0"
170 #endif
171 #endif /* CC2538_CONF_QUIET */
172 
173 /**
174  * \brief Enable the USB core only if we need it
175  */
176 #ifndef USB_SERIAL_CONF_ENABLE
177 #define USB_SERIAL_CONF_ENABLE \
178  ((SLIP_ARCH_CONF_USB & SLIP_ARCH_CONF_ENABLED) | \
179  DBG_CONF_USB | \
180  (CC2538_RF_CONF_SNIFFER & CC2538_RF_CONF_SNIFFER_USB))
181 #endif
182 
183 /*
184  * If debugging and SLIP use the same peripheral, this will be 1. Don't modify
185  * this
186  */
187 #if SLIP_ARCH_CONF_ENABLED
188 #define DBG_CONF_SLIP_MUX (SLIP_ARCH_CONF_USB==DBG_CONF_USB)
189 #endif
190 /** @} */
191 /*---------------------------------------------------------------------------*/
192 /* board.h assumes that basic configuration is done */
193 #include "board.h"
194 /*---------------------------------------------------------------------------*/
195 /**
196  * \name Network Stack Configuration
197  *
198  * @{
199  */
200 #ifndef NETSTACK_CONF_NETWORK
201 #if UIP_CONF_IPV6
202 #define NETSTACK_CONF_NETWORK sicslowpan_driver
203 #else
204 #define NETSTACK_CONF_NETWORK rime_driver
205 #endif /* UIP_CONF_IPV6 */
206 #endif /* NETSTACK_CONF_NETWORK */
207 
208 #ifndef NETSTACK_CONF_MAC
209 #define NETSTACK_CONF_MAC csma_driver
210 #endif
211 
212 #ifndef NETSTACK_CONF_RDC
213 #define NETSTACK_CONF_RDC contikimac_driver
214 #endif
215 
216 /* Configure NullRDC for when it's selected */
217 #define NULLRDC_802154_AUTOACK 1
218 #define NULLRDC_802154_AUTOACK_HW 1
219 
220 /* Configure ContikiMAC for when it's selected */
221 #define CONTIKIMAC_CONF_WITH_CONTIKIMAC_HEADER 0
222 #define CONTIKIMAC_CONF_WITH_PHASE_OPTIMIZATION 0
223 #define WITH_FAST_SLEEP 1
224 
225 #ifndef NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE
226 #define NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE 8
227 #endif
228 
229 #ifndef NETSTACK_CONF_FRAMER
230 #define NETSTACK_CONF_FRAMER framer_802154
231 #endif
232 
233 #define NETSTACK_CONF_RADIO cc2538_rf_driver
234 /** @} */
235 /*---------------------------------------------------------------------------*/
236 /**
237  * \name LPM configuration
238  * @{
239  */
240 #ifndef LPM_CONF_ENABLE
241 #define LPM_CONF_ENABLE 1 /**< Set to 0 to disable LPM entirely */
242 #endif
243 
244 /**
245  * \brief Maximum PM
246  *
247  * The SoC will never drop to a Power Mode deeper than the one specified here.
248  * 0 for PM0, 1 for PM1 and 2 for PM2
249  */
250 #ifndef LPM_CONF_MAX_PM
251 #define LPM_CONF_MAX_PM 1
252 #endif
253 
254 #ifndef LPM_CONF_STATS
255 #define LPM_CONF_STATS 0 /**< Set to 1 to enable LPM-related stats */
256 #endif
257 /** @} */
258 /*---------------------------------------------------------------------------*/
259 /**
260  * \name IEEE address configuration
261  *
262  * Used to generate our RIME & IPv6 address
263  * @{
264  */
265 /**
266  * \brief Location of the IEEE address
267  * 0 => Read from InfoPage,
268  * 1 => Use a hardcoded address, configured by IEEE_ADDR_CONF_ADDRESS
269  */
270 #ifndef IEEE_ADDR_CONF_HARDCODED
271 #define IEEE_ADDR_CONF_HARDCODED 0
272 #endif
273 
274 /**
275  * \brief The hardcoded IEEE address to be used when IEEE_ADDR_CONF_HARDCODED
276  * is defined as 1
277  */
278 #ifndef IEEE_ADDR_CONF_ADDRESS
279 #define IEEE_ADDR_CONF_ADDRESS { 0x00, 0x12, 0x4B, 0x00, 0x89, 0xAB, 0xCD, 0xEF }
280 #endif
281 
282 /**
283  * \brief Location of the IEEE address in the InfoPage when
284  * IEEE_ADDR_CONF_HARDCODED is defined as 0
285  * 0 => Use the primary address location
286  * 1 => Use the secondary address location
287  */
288 #ifndef IEEE_ADDR_CONF_USE_SECONDARY_LOCATION
289 #define IEEE_ADDR_CONF_USE_SECONDARY_LOCATION 0
290 #endif
291 /** @} */
292 /*---------------------------------------------------------------------------*/
293 /**
294  * \name RF configuration
295  *
296  * @{
297  */
298 /* RF Config */
299 #ifndef IEEE802154_CONF_PANID
300 #define IEEE802154_CONF_PANID 0x5449 /**< Default PAN ID: TI */
301 #endif
302 
303 #ifndef CC2538_RF_CONF_CHANNEL
304 #define CC2538_RF_CONF_CHANNEL 25
305 #endif /* CC2538_RF_CONF_CHANNEL */
306 
307 #ifndef CC2538_RF_CONF_AUTOACK
308 #define CC2538_RF_CONF_AUTOACK 1 /**< RF H/W generates ACKs */
309 #endif /* CC2538_CONF_AUTOACK */
310 
311 #ifndef CC2538_RF_CONF_TX_USE_DMA
312 #define CC2538_RF_CONF_TX_USE_DMA 1 /**< RF TX over DMA */
313 #endif
314 
315 #ifndef CC2538_RF_CONF_RX_USE_DMA
316 #define CC2538_RF_CONF_RX_USE_DMA 1 /**< RF RX over DMA */
317 #endif
318 /** @} */
319 /*---------------------------------------------------------------------------*/
320 /**
321  * \name IPv6, RIME and network buffer configuration
322  *
323  * @{
324  */
325 
326 /* Don't let contiki-default-conf.h decide if we are an IPv6 build */
327 #ifndef UIP_CONF_IPV6
328 #define UIP_CONF_IPV6 0
329 #endif
330 
331 #if UIP_CONF_IPV6
332 /* Addresses, Sizes and Interfaces */
333 /* 8-byte addresses here, 2 otherwise */
334 #define LINKADDR_CONF_SIZE 8
335 #define UIP_CONF_LL_802154 1
336 #define UIP_CONF_LLH_LEN 0
337 #define UIP_CONF_NETIF_MAX_ADDRESSES 3
338 
339 /* TCP, UDP, ICMP */
340 #ifndef UIP_CONF_TCP
341 #define UIP_CONF_TCP 1
342 #endif
343 #ifndef UIP_CONF_TCP_MSS
344 #define UIP_CONF_TCP_MSS 64
345 #endif
346 #define UIP_CONF_UDP 1
347 #define UIP_CONF_UDP_CHECKSUMS 1
348 #define UIP_CONF_ICMP6 1
349 
350 /* ND and Routing */
351 #ifndef UIP_CONF_ROUTER
352 #define UIP_CONF_ROUTER 1
353 #endif
354 
355 #ifndef UIP_CONF_IPV6_RPL
356 #define UIP_CONF_IPV6_RPL 1
357 #endif
358 
359 #define UIP_CONF_ND6_SEND_RA 0
360 #define UIP_CONF_IP_FORWARD 0
361 #define RPL_CONF_STATS 0
362 #define RPL_CONF_MAX_DAG_ENTRIES 1
363 #ifndef RPL_CONF_OF
364 #define RPL_CONF_OF rpl_mrhof
365 #endif
366 
367 #define UIP_CONF_ND6_REACHABLE_TIME 600000
368 #define UIP_CONF_ND6_RETRANS_TIMER 10000
369 
370 #ifndef NBR_TABLE_CONF_MAX_NEIGHBORS
371 #define NBR_TABLE_CONF_MAX_NEIGHBORS 20
372 #endif
373 #ifndef UIP_CONF_MAX_ROUTES
374 #define UIP_CONF_MAX_ROUTES 20
375 #endif
376 
377 /* uIP */
378 #ifndef UIP_CONF_BUFFER_SIZE
379 #define UIP_CONF_BUFFER_SIZE 1300
380 #endif
381 
382 #define UIP_CONF_IPV6_QUEUE_PKT 0
383 #define UIP_CONF_IPV6_CHECKS 1
384 #define UIP_CONF_IPV6_REASSEMBLY 0
385 #define UIP_CONF_MAX_LISTENPORTS 8
386 
387 /* 6lowpan */
388 #define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_HC06
389 #ifndef SICSLOWPAN_CONF_COMPRESSION_THRESHOLD
390 #define SICSLOWPAN_CONF_COMPRESSION_THRESHOLD 63
391 #endif
392 #ifndef SICSLOWPAN_CONF_FRAG
393 #define SICSLOWPAN_CONF_FRAG 1
394 #endif
395 #define SICSLOWPAN_CONF_MAXAGE 8
396 
397 /* Define our IPv6 prefixes/contexts here */
398 #define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 1
399 #ifndef SICSLOWPAN_CONF_ADDR_CONTEXT_0
400 #define SICSLOWPAN_CONF_ADDR_CONTEXT_0 { \
401  addr_contexts[0].prefix[0] = 0xaa; \
402  addr_contexts[0].prefix[1] = 0xaa; \
403 }
404 #endif
405 
406 #define MAC_CONF_CHANNEL_CHECK_RATE 8
407 
408 #ifndef QUEUEBUF_CONF_NUM
409 #define QUEUEBUF_CONF_NUM 8
410 #endif
411 /*---------------------------------------------------------------------------*/
412 #else /* UIP_CONF_IPV6 */
413 /* Network setup for non-IPv6 (rime). */
414 #define UIP_CONF_IP_FORWARD 1
415 
416 #ifndef UIP_CONF_BUFFER_SIZE
417 #define UIP_CONF_BUFFER_SIZE 108
418 #endif
419 
420 #define RIME_CONF_NO_POLITE_ANNOUCEMENTS 0
421 
422 #ifndef QUEUEBUF_CONF_NUM
423 #define QUEUEBUF_CONF_NUM 8
424 #endif
425 
426 #endif /* UIP_CONF_IPV6 */
427 /** @} */
428 /*---------------------------------------------------------------------------*/
429 
430 #endif /* CONTIKI_CONF_H_ */
431 
432 /** @} */