Contiki 3.x
contiki-conf.h
Go to the documentation of this file.
1 /**
2  * \addtogroup cc2538dk
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_DIFF to override this
38  */
39 typedef uint32_t rtimer_clock_t;
40 #define RTIMER_CLOCK_DIFF(a,b) ((int32_t)((a)-(b)))
41 /** @} */
42 /*---------------------------------------------------------------------------*/
43 #define TSCH_CONF_HW_FRAME_FILTERING 0
44 
45 /* 352us from calling transmit() until the SFD byte has been sent */
46 #define RADIO_DELAY_BEFORE_TX ((unsigned)US_TO_RTIMERTICKS(352))
47 /* 192us as in datasheet but ACKs are not always received, so adjusted to 250us */
48 #define RADIO_DELAY_BEFORE_RX ((unsigned)US_TO_RTIMERTICKS(250))
49 #define RADIO_DELAY_BEFORE_DETECT 0
50 /*---------------------------------------------------------------------------*/
51 /**
52  * \name Serial Boot Loader Backdoor configuration
53  *
54  * @{
55  */
56 #ifndef FLASH_CCA_CONF_BOOTLDR_BACKDOOR
57 #define FLASH_CCA_CONF_BOOTLDR_BACKDOOR 1 /**<Enable the boot loader backdoor */
58 #endif
59 
60 #ifndef FLASH_CCA_CONF_BOOTLDR_BACKDOOR_PORT_A_PIN
61 #define FLASH_CCA_CONF_BOOTLDR_BACKDOOR_PORT_A_PIN 3 /**< Pin PA_3 (Select button) activates the boot loader */
62 #endif
63 
64 #ifndef FLASH_CCA_CONF_BOOTLDR_BACKDOOR_ACTIVE_HIGH
65 #define FLASH_CCA_CONF_BOOTLDR_BACKDOOR_ACTIVE_HIGH 0 /**< A logic low level activates the boot loader */
66 #endif
67 /** @} */
68 /*---------------------------------------------------------------------------*/
69 /**
70  * \name Watchdog Timer configuration
71  *
72  * @{
73  */
74 #ifndef WATCHDOG_CONF_ENABLE
75 #define WATCHDOG_CONF_ENABLE 1 /**< Enable the watchdog timer */
76 #endif
77 /** @} */
78 /*---------------------------------------------------------------------------*/
79 /**
80  * \name USB 'core' configuration
81  *
82  * Those values are not meant to be modified by the user, except where stated
83  * otherwise
84  * @{
85  */
86 #define CTRL_EP_SIZE 8
87 #define USB_EP1_SIZE 32
88 #define USB_EP2_SIZE 64
89 #define USB_EP3_SIZE 64
90 #define USB_ARCH_WRITE_NOTIFY 0
91 
92 #ifndef USB_ARCH_CONF_DMA
93 #define USB_ARCH_CONF_DMA 1 /**< Change to Enable/Disable USB DMA */
94 
95 #endif
96 /** @} */
97 /*---------------------------------------------------------------------------*/
98 /**
99  * \name Generic Configuration directives
100  *
101  * @{
102  */
103 #ifndef ENERGEST_CONF_ON
104 #define ENERGEST_CONF_ON 0 /**< Energest Module */
105 #endif
106 
107 #ifndef STARTUP_CONF_VERBOSE
108 #define STARTUP_CONF_VERBOSE 1 /**< Set to 0 to decrease startup verbosity */
109 #endif
110 /** @} */
111 /*---------------------------------------------------------------------------*/
112 /**
113  * \name uDMA Configuration and channel allocations
114  *
115  * @{
116  */
117 #define USB_ARCH_CONF_RX_DMA_CHAN 0 /**< USB -> RAM DMA channel */
118 #define USB_ARCH_CONF_TX_DMA_CHAN 1 /**< RAM -> USB DMA channel */
119 #define CC2538_RF_CONF_TX_DMA_CHAN 2 /**< RF -> RAM DMA channel */
120 #define CC2538_RF_CONF_RX_DMA_CHAN 3 /**< RAM -> RF DMA channel */
121 #define UDMA_CONF_MAX_CHANNEL CC2538_RF_CONF_RX_DMA_CHAN
122 /** @} */
123 /*---------------------------------------------------------------------------*/
124 /**
125  * \name Character I/O Configuration
126  *
127  * @{
128  */
129 #ifndef UART_CONF_ENABLE
130 #define UART_CONF_ENABLE 1 /**< Enable/Disable UART I/O */
131 #endif
132 
133 #ifndef UART0_CONF_BAUD_RATE
134 #define UART0_CONF_BAUD_RATE 115200 /**< Default UART0 baud rate */
135 #endif
136 
137 #ifndef UART1_CONF_BAUD_RATE
138 #define UART1_CONF_BAUD_RATE 115200 /**< Default UART1 baud rate */
139 #endif
140 
141 #ifndef SLIP_ARCH_CONF_USB
142 #define SLIP_ARCH_CONF_USB 0 /**< SLIP over UART by default */
143 #endif
144 
145 #ifndef CC2538_RF_CONF_SNIFFER_USB
146 #define CC2538_RF_CONF_SNIFFER_USB 0 /**< Sniffer out over UART by default */
147 #endif
148 
149 #ifndef DBG_CONF_USB
150 #define DBG_CONF_USB 0 /**< All debugging over UART by default */
151 #endif
152 
153 #ifndef SERIAL_LINE_CONF_UART
154 #define SERIAL_LINE_CONF_UART 0 /**< UART to use with serial line */
155 #endif
156 
157 #if !SLIP_ARCH_CONF_USB
158 #ifndef SLIP_ARCH_CONF_UART
159 #define SLIP_ARCH_CONF_UART 0 /**< UART to use with SLIP */
160 #endif
161 #endif
162 
163 #if !CC2538_RF_CONF_SNIFFER_USB
164 #ifndef CC2538_RF_CONF_SNIFFER_UART
165 #define CC2538_RF_CONF_SNIFFER_UART 0 /**< UART to use with sniffer */
166 #endif
167 #endif
168 
169 #if !DBG_CONF_USB
170 #ifndef DBG_CONF_UART
171 #define DBG_CONF_UART 0 /**< UART to use for debugging */
172 #endif
173 #endif
174 
175 #ifndef UART1_CONF_UART
176 #define UART1_CONF_UART 0 /**< UART to use for examples relying on
177  the uart1_* API */
178 #endif
179 
180 /* Turn off example-provided putchars */
181 #define SLIP_BRIDGE_CONF_NO_PUTCHAR 1
182 #define SLIP_RADIO_CONF_NO_PUTCHAR 1
183 
184 #ifndef SLIP_ARCH_CONF_ENABLED
185 /*
186  * Determine whether we need SLIP
187  * This will keep working while UIP_FALLBACK_INTERFACE and CMD_CONF_OUTPUT
188  * keep using SLIP
189  */
190 #if defined (UIP_FALLBACK_INTERFACE) || defined (CMD_CONF_OUTPUT)
191 #define SLIP_ARCH_CONF_ENABLED 1
192 #endif
193 #endif
194 
195 /*
196  * When set, the radio turns off address filtering and sends all captured
197  * frames down a peripheral (UART or USB, depending on the value of
198  * CC2538_RF_CONF_SNIFFER_USB)
199  */
200 #ifndef CC2538_RF_CONF_SNIFFER
201 #define CC2538_RF_CONF_SNIFFER 0
202 #endif
203 
204 /**
205  * \brief Define this as 1 to build a headless node.
206  *
207  * The UART will not be initialised its clock will be gated, offering some
208  * energy savings. The USB will not be initialised either
209  */
210 #ifndef CC2538_CONF_QUIET
211 #define CC2538_CONF_QUIET 0
212 #endif
213 
214 /* CC2538_CONF_QUIET is hard and overrides all other related defines */
215 #if CC2538_CONF_QUIET
216 #undef USB_SERIAL_CONF_ENABLE
217 #define USB_SERIAL_CONF_ENABLE 0
218 
219 #undef UART_CONF_ENABLE
220 #define UART_CONF_ENABLE 0
221 
222 #undef STARTUP_CONF_VERBOSE
223 #define STARTUP_CONF_VERBOSE 0
224 
225 /* Little sanity check: We can't have quiet sniffers */
226 #if CC2538_RF_CONF_SNIFFER
227 #error "CC2538_RF_CONF_SNIFFER == 1 and CC2538_CONF_QUIET == 1"
228 #error "These values are conflicting. Please set either to 0"
229 #endif
230 #endif /* CC2538_CONF_QUIET */
231 
232 /**
233  * \brief Enable the USB core only if we need it
234  */
235 #ifndef USB_SERIAL_CONF_ENABLE
236 #define USB_SERIAL_CONF_ENABLE \
237  ((SLIP_ARCH_CONF_USB & SLIP_ARCH_CONF_ENABLED) | \
238  DBG_CONF_USB | \
239  (CC2538_RF_CONF_SNIFFER & CC2538_RF_CONF_SNIFFER_USB))
240 #endif
241 
242 /*
243  * If debugging and SLIP use the same peripheral, this will be 1. Don't modify
244  * this
245  */
246 #if SLIP_ARCH_CONF_ENABLED
247 #define DBG_CONF_SLIP_MUX (SLIP_ARCH_CONF_USB == DBG_CONF_USB && \
248  (SLIP_ARCH_CONF_USB || \
249  SLIP_ARCH_CONF_UART == DBG_CONF_UART))
250 #endif
251 
252 /*
253  * Automatic detection of whether a specific UART is in use
254  */
255 #define UART_IN_USE_BY_SERIAL_LINE(u) (SERIAL_LINE_CONF_UART == (u))
256 #define UART_IN_USE_BY_SLIP(u) (SLIP_ARCH_CONF_ENABLED && \
257  !SLIP_ARCH_CONF_USB && \
258  SLIP_ARCH_CONF_UART == (u))
259 #define UART_IN_USE_BY_RF_SNIFFER(u) (CC2538_RF_CONF_SNIFFER && \
260  !CC2538_RF_CONF_SNIFFER_USB && \
261  CC2538_RF_CONF_SNIFFER_UART == (u))
262 #define UART_IN_USE_BY_DBG(u) (!DBG_CONF_USB && DBG_CONF_UART == (u))
263 #define UART_IN_USE_BY_UART1(u) (UART1_CONF_UART == (u))
264 
265 #define UART_IN_USE(u) ( \
266  UART_CONF_ENABLE && \
267  (UART_IN_USE_BY_SERIAL_LINE(u) || \
268  UART_IN_USE_BY_SLIP(u) || \
269  UART_IN_USE_BY_RF_SNIFFER(u) || \
270  UART_IN_USE_BY_DBG(u) || \
271  UART_IN_USE_BY_UART1(u)) \
272 )
273 /** @} */
274 /*---------------------------------------------------------------------------*/
275 /* board.h assumes that basic configuration is done */
276 #include "board.h"
277 /*---------------------------------------------------------------------------*/
278 /**
279  * \name Network Stack Configuration
280  *
281  * @{
282  */
283 #ifndef NETSTACK_CONF_NETWORK
284 #if NETSTACK_CONF_WITH_IPV6
285 #define NETSTACK_CONF_NETWORK sicslowpan_driver
286 #else
287 #define NETSTACK_CONF_NETWORK rime_driver
288 #endif /* NETSTACK_CONF_WITH_IPV6 */
289 #endif /* NETSTACK_CONF_NETWORK */
290 
291 #ifndef NETSTACK_CONF_MAC
292 #define NETSTACK_CONF_MAC csma_driver
293 #endif
294 
295 #ifndef NETSTACK_CONF_RDC
296 #define NETSTACK_CONF_RDC contikimac_driver
297 #endif
298 
299 /* Configure NullRDC for when it's selected */
300 #define NULLRDC_802154_AUTOACK 1
301 #define NULLRDC_802154_AUTOACK_HW 1
302 
303 /* Configure ContikiMAC for when it's selected */
304 #define CONTIKIMAC_CONF_WITH_PHASE_OPTIMIZATION 0
305 #define WITH_FAST_SLEEP 1
306 
307 #ifndef NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE
308 #define NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE 8
309 #endif
310 
311 #ifndef NETSTACK_CONF_FRAMER
312 #if NETSTACK_CONF_WITH_IPV6
313 #define NETSTACK_CONF_FRAMER framer_802154
314 #else /* NETSTACK_CONF_WITH_IPV6 */
315 #define NETSTACK_CONF_FRAMER contikimac_framer
316 #endif /* NETSTACK_CONF_WITH_IPV6 */
317 #endif /* NETSTACK_CONF_FRAMER */
318 
319 #define NETSTACK_CONF_RADIO cc2538_rf_driver
320 /** @} */
321 /*---------------------------------------------------------------------------*/
322 /**
323  * \name LPM configuration
324  * @{
325  */
326 #ifndef LPM_CONF_ENABLE
327 #define LPM_CONF_ENABLE 1 /**< Set to 0 to disable LPM entirely */
328 #endif
329 
330 /**
331  * \brief Maximum PM
332  *
333  * The SoC will never drop to a Power Mode deeper than the one specified here.
334  * 0 for PM0, 1 for PM1 and 2 for PM2
335  */
336 #ifndef LPM_CONF_MAX_PM
337 #define LPM_CONF_MAX_PM 1
338 #endif
339 
340 #ifndef LPM_CONF_STATS
341 #define LPM_CONF_STATS 0 /**< Set to 1 to enable LPM-related stats */
342 #endif
343 /** @} */
344 /*---------------------------------------------------------------------------*/
345 /**
346  * \name IEEE address configuration
347  *
348  * Used to generate our RIME & IPv6 address
349  * @{
350  */
351 /**
352  * \brief Location of the IEEE address
353  * 0 => Read from InfoPage,
354  * 1 => Use a hardcoded address, configured by IEEE_ADDR_CONF_ADDRESS
355  */
356 #ifndef IEEE_ADDR_CONF_HARDCODED
357 #define IEEE_ADDR_CONF_HARDCODED 0
358 #endif
359 
360 /**
361  * \brief The hardcoded IEEE address to be used when IEEE_ADDR_CONF_HARDCODED
362  * is defined as 1
363  */
364 #ifndef IEEE_ADDR_CONF_ADDRESS
365 #define IEEE_ADDR_CONF_ADDRESS { 0x00, 0x12, 0x4B, 0x00, 0x89, 0xAB, 0xCD, 0xEF }
366 #endif
367 
368 /**
369  * \brief Location of the IEEE address in the InfoPage when
370  * IEEE_ADDR_CONF_HARDCODED is defined as 0
371  * 0 => Use the primary address location
372  * 1 => Use the secondary address location
373  */
374 #ifndef IEEE_ADDR_CONF_USE_SECONDARY_LOCATION
375 #define IEEE_ADDR_CONF_USE_SECONDARY_LOCATION 0
376 #endif
377 /** @} */
378 /*---------------------------------------------------------------------------*/
379 /**
380  * \name RF configuration
381  *
382  * @{
383  */
384 /* RF Config */
385 #ifndef IEEE802154_CONF_PANID
386 #define IEEE802154_CONF_PANID 0xABCD
387 #endif
388 
389 #ifndef CC2538_RF_CONF_CHANNEL
390 #define CC2538_RF_CONF_CHANNEL 25
391 #endif /* CC2538_RF_CONF_CHANNEL */
392 
393 #ifndef CC2538_RF_CONF_AUTOACK
394 #define CC2538_RF_CONF_AUTOACK 1 /**< RF H/W generates ACKs */
395 #endif /* CC2538_CONF_AUTOACK */
396 
397 #ifndef CC2538_RF_CONF_TX_USE_DMA
398 #define CC2538_RF_CONF_TX_USE_DMA 1 /**< RF TX over DMA */
399 #endif
400 
401 #ifndef CC2538_RF_CONF_RX_USE_DMA
402 #define CC2538_RF_CONF_RX_USE_DMA 1 /**< RF RX over DMA */
403 #endif
404 /** @} */
405 /*---------------------------------------------------------------------------*/
406 /**
407  * \name IPv6, RIME and network buffer configuration
408  *
409  * @{
410  */
411 
412 /* Don't let contiki-default-conf.h decide if we are an IPv6 build */
413 #ifndef NETSTACK_CONF_WITH_IPV6
414 #define NETSTACK_CONF_WITH_IPV6 0
415 #endif
416 
417 #if NETSTACK_CONF_WITH_IPV6
418 /* Addresses, Sizes and Interfaces */
419 /* 8-byte addresses here, 2 otherwise */
420 #define LINKADDR_CONF_SIZE 8
421 #define UIP_CONF_LL_802154 1
422 #define UIP_CONF_LLH_LEN 0
423 #define UIP_CONF_NETIF_MAX_ADDRESSES 3
424 
425 /* TCP, UDP, ICMP */
426 #ifndef UIP_CONF_TCP
427 #define UIP_CONF_TCP 1
428 #endif
429 #ifndef UIP_CONF_TCP_MSS
430 #define UIP_CONF_TCP_MSS 64
431 #endif
432 #define UIP_CONF_UDP 1
433 #define UIP_CONF_UDP_CHECKSUMS 1
434 #define UIP_CONF_ICMP6 1
435 
436 /* ND and Routing */
437 #ifndef UIP_CONF_ROUTER
438 #define UIP_CONF_ROUTER 1
439 #endif
440 
441 #define UIP_CONF_ND6_SEND_RA 0
442 #define UIP_CONF_IP_FORWARD 0
443 #define RPL_CONF_STATS 0
444 
445 #ifndef RPL_CONF_OF
446 #define RPL_CONF_OF rpl_mrhof
447 #endif
448 
449 #define UIP_CONF_ND6_REACHABLE_TIME 600000
450 #define UIP_CONF_ND6_RETRANS_TIMER 10000
451 
452 #ifndef NBR_TABLE_CONF_MAX_NEIGHBORS
453 #define NBR_TABLE_CONF_MAX_NEIGHBORS 20
454 #endif
455 #ifndef UIP_CONF_MAX_ROUTES
456 #define UIP_CONF_MAX_ROUTES 20
457 #endif
458 
459 /* uIP */
460 #ifndef UIP_CONF_BUFFER_SIZE
461 #define UIP_CONF_BUFFER_SIZE 1300
462 #endif
463 
464 #define UIP_CONF_IPV6_QUEUE_PKT 0
465 #define UIP_CONF_IPV6_CHECKS 1
466 #define UIP_CONF_IPV6_REASSEMBLY 0
467 #define UIP_CONF_MAX_LISTENPORTS 8
468 
469 /* 6lowpan */
470 #define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_HC06
471 #ifndef SICSLOWPAN_CONF_COMPRESSION_THRESHOLD
472 #define SICSLOWPAN_CONF_COMPRESSION_THRESHOLD 63
473 #endif
474 #ifndef SICSLOWPAN_CONF_FRAG
475 #define SICSLOWPAN_CONF_FRAG 1
476 #endif
477 #define SICSLOWPAN_CONF_MAXAGE 8
478 
479 /* Define our IPv6 prefixes/contexts here */
480 #define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 1
481 #ifndef SICSLOWPAN_CONF_ADDR_CONTEXT_0
482 #define SICSLOWPAN_CONF_ADDR_CONTEXT_0 { \
483  addr_contexts[0].prefix[0] = UIP_DS6_DEFAULT_PREFIX_0; \
484  addr_contexts[0].prefix[1] = UIP_DS6_DEFAULT_PREFIX_1; \
485 }
486 #endif
487 
488 #define MAC_CONF_CHANNEL_CHECK_RATE 8
489 
490 #ifndef QUEUEBUF_CONF_NUM
491 #define QUEUEBUF_CONF_NUM 8
492 #endif
493 /*---------------------------------------------------------------------------*/
494 #else /* NETSTACK_CONF_WITH_IPV6 */
495 /* Network setup for non-IPv6 (rime). */
496 #define UIP_CONF_IP_FORWARD 1
497 
498 #ifndef UIP_CONF_BUFFER_SIZE
499 #define UIP_CONF_BUFFER_SIZE 108
500 #endif
501 
502 #define RIME_CONF_NO_POLITE_ANNOUCEMENTS 0
503 
504 #ifndef QUEUEBUF_CONF_NUM
505 #define QUEUEBUF_CONF_NUM 8
506 #endif
507 
508 #endif /* NETSTACK_CONF_WITH_IPV6 */
509 /** @} */
510 /*---------------------------------------------------------------------------*/
511 /**
512  * \name Security
513  *
514  * @{
515  */
516 #ifndef CRYPTO_CONF_INIT
517 #define CRYPTO_CONF_INIT 1 /**< Whether to init cryptoprocessor */
518 #endif
519 
520 #ifndef AES_128_CONF
521 #define AES_128_CONF cc2538_aes_128_driver /**< AES-128 driver */
522 #endif
523 
524 #ifndef CCM_STAR_CONF
525 #define CCM_STAR_CONF cc2538_ccm_star_driver /**< AES-CCM* driver */
526 #endif
527 /** @} */
528 /*---------------------------------------------------------------------------*/
529 
530 #endif /* CONTIKI_CONF_H_ */
531 
532 /** @} */