Contiki 3.x
contiki-conf.h
1 #ifndef CONTIKI_CONF_H_
2 #define CONTIKI_CONF_H_
3 
4 #include "8051def.h"
5 #include "sys/cc.h"
6 #include <string.h>
7 
8 /* Include Project Specific conf */
9 #ifdef PROJECT_CONF_H
10 #include "project-conf.h"
11 #endif /* PROJECT_CONF_H */
12 
13 /*
14  * Define this as 1 to poll the etimer process from within main instead of from
15  * the clock ISR. This reduces the ISR's stack usage and may prevent crashes.
16  */
17 #ifndef CLOCK_CONF_STACK_FRIENDLY
18 #define CLOCK_CONF_STACK_FRIENDLY 1
19 #endif
20 
21 /* Memory filesystem RAM size. */
22 #define CFS_RAM_CONF_SIZE 512
23 
24 /* Logging.. */
25 #define LOG_CONF_ENABLED 0
26 
27 #ifndef STACK_CONF_DEBUGGING
28 #define STACK_CONF_DEBUGGING 0
29 #endif
30 
31 /* Energest Module */
32 #ifndef ENERGEST_CONF_ON
33 #define ENERGEST_CONF_ON 0
34 #endif
35 
36 /* Verbose Startup? Turning this off reduces our footprint a fair bit */
37 #define STARTUP_CONF_VERBOSE 0
38 
39 /* More CODE space savings by turning off process names */
40 #define PROCESS_CONF_NO_PROCESS_NAMES 1
41 
42 /*
43  * UARTs: 1=>Enabled, 0=>Disabled. Default: Both Disabled (see uart.h)
44  * Disabling UARTs reduces our CODE footprint
45  * Disabling UART1 also disables all debugging output.
46  * Should be used when nodes are meant to run on batteries
47  *
48  * On N740, by enabling UART1, you are also enabling an ugly hack which aims
49  * to detect the USB connection during execution. It will then turn on/off
50  * UART1 RX interrupts accordingly. This seems to work but you have been warned
51  * If you start seeing random crashes when on battery, this is where to look.
52  */
53 #ifndef UART_ONE_CONF_ENABLE
54 #define UART_ONE_CONF_ENABLE 1
55 #endif
56 #ifndef UART_ONE_CONF_WITH_INPUT
57 #define UART_ONE_CONF_WITH_INPUT 0
58 #endif
59 #define UART_ZERO_CONF_ENABLE 0
60 
61 #ifndef UART_ONE_CONF_HIGH_SPEED
62 #define UART_ONE_CONF_HIGH_SPEED 0
63 #endif
64 
65 #define SLIP_RADIO_CONF_NO_PUTCHAR 1
66 
67 #if defined (UIP_FALLBACK_INTERFACE) || defined (CMD_CONF_OUTPUT)
68 #define SLIP_ARCH_CONF_ENABLE 1
69 #endif
70 
71 /* Are we a SLIP bridge? */
72 #if SLIP_ARCH_CONF_ENABLE
73 /* Make sure UART1 is enabled, with interrupts */
74 #undef UART_ONE_CONF_ENABLE
75 #undef UART_ONE_CONF_WITH_INPUT
76 #define UART_ONE_CONF_ENABLE 1
77 #define UART_ONE_CONF_WITH_INPUT 1
78 #endif
79 
80 /* Output all captured frames over the UART in hexdump format */
81 #ifndef CC2430_RF_CONF_HEXDUMP
82 #define CC2430_RF_CONF_HEXDUMP 0
83 #endif
84 
85 #if CC2430_RF_CONF_HEXDUMP
86 /* We need UART1 output */
87 #undef UART_ONE_CONF_ENABLE
88 #define UART_ONE_CONF_ENABLE 1
89 #endif
90 
91 /* Code Shortcuts */
92 /*
93  * When set, the RF driver is no longer a contiki process and the RX ISR is
94  * disabled. Instead of polling the radio process when data arrives, we
95  * periodically check for data by directly invoking the driver from main()
96  *
97  * When set, this directive also configures the following bypasses:
98  * - process_post_synch() in tcpip_input() (we call packet_input())
99  * - process_post_synch() in tcpip_uipcall (we call the relevant pthread)
100  * - mac_call_sent_callback() is replaced with sent() in various places
101  *
102  * These are good things to do, they reduce stack usage and prevent crashes
103  */
104 #define NETSTACK_CONF_SHORTCUTS 1
105 
106 /*
107  * Sensors
108  * It is harmless to #define XYZ 1
109  * even if the sensor is not present on our device
110  */
111 #ifndef BUTTON_SENSOR_CONF_ON
112 #define BUTTON_SENSOR_CONF_ON 1 /* Buttons */
113 #endif
114 /* ADC - Turning this off will disable everything below */
115 #ifndef ADC_SENSOR_CONF_ON
116 #define ADC_SENSOR_CONF_ON 1
117 #endif
118 #define TEMP_SENSOR_CONF_ON 1 /* Temperature */
119 #define BATTERY_SENSOR_CONF_ON 1 /* Battery */
120 #define VDD_SENSOR_CONF_ON 1 /* Supply Voltage */
121 #define ACC_SENSOR_CONF_ON 1 /* Accelerometer */
122 #define ACC_SENSOR_CONF_GSEL 0 /* Acc. g-Select => 1: +/-11g, 0: +/-3g */
123 #define LIGHT_SENSOR_CONF_ON 1 /* Light */
124 
125 /* Watchdog */
126 #define WDT_CONF_INTERVAL 0
127 #define WDT_CONF_TIMER_MODE 0 /* 0 or undefined for watchdog mode */
128 
129 /* Low Power Modes - We only support PM0/Idle and PM1 */
130 #ifndef LPM_CONF_MODE
131 #define LPM_CONF_MODE 1 /* 0: no LPM, 1: MCU IDLE, 2: Drop to PM1 */
132 #endif
133 
134 /* DMA Configuration */
135 #ifndef DMA_CONF_ON
136 #define DMA_CONF_ON 0
137 #endif
138 
139 /* N740 Serial Flash */
140 #ifndef M25P16_CONF_ON
141 #define M25P16_CONF_ON 1
142 #endif
143 
144 /* XXX argh, ugly hack to make stuff compile! */
145 #define snprintf(BUF, SIZE, ...) sprintf(BUF, __VA_ARGS__)
146 
147 /* Sensinode-Specific Tools and APPs */
148 /* Viztool on by default for IPv6 builds */
149 #if UIP_CONF_IPV6
150 #ifndef VIZTOOL_CONF_ON
151 #define VIZTOOL_CONF_ON 1
152 #endif /* VIZTOOL_CONF_ON */
153 #endif /* UIP_CONF_IPV6 */
154 
155 /* BatMon off by default unless we build with APPS += batmon */
156 #ifndef BATMON_CONF_ON
157 #define BATMON_CONF_ON 0
158 #endif
159 
160 /* Network Stack */
161 #ifndef NETSTACK_CONF_NETWORK
162 #if UIP_CONF_IPV6
163 #define NETSTACK_CONF_NETWORK sicslowpan_driver
164 #else
165 #define NETSTACK_CONF_NETWORK rime_driver
166 #endif /* UIP_CONF_IPV6 */
167 #endif /* NETSTACK_CONF_NETWORK */
168 
169 #ifndef NETSTACK_CONF_MAC
170 #define NETSTACK_CONF_MAC csma_driver
171 #endif
172 
173 #ifndef NETSTACK_CONF_RDC
174 #define NETSTACK_CONF_RDC nullrdc_driver
175 #define NULLRDC_802154_AUTOACK 1
176 #define NULLRDC_802154_AUTOACK_HW 1
177 #endif
178 
179 #ifndef NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE
180 #define NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE 8
181 #endif
182 
183 #ifndef NETSTACK_CONF_FRAMER
184 #define NETSTACK_CONF_FRAMER framer_802154
185 #endif
186 
187 #define NETSTACK_CONF_RADIO cc2430_rf_driver
188 
189 /* RF Config */
190 #define IEEE802154_CONF_PANID 0x4C55 /* LU */
191 
192 #ifndef CC2430_RF_CONF_CHANNEL
193 #define CC2430_RF_CONF_CHANNEL 25
194 #endif /* CC2430_RF_CONF_CHANNEL */
195 
196 #ifndef CC2430_RF_CONF_TX_POWER
197 #define CC2430_RF_CONF_TX_POWER 0x5F /* Datasheet recommended value */
198 #endif
199 
200 #ifndef CC2430_RF_CONF_AUTOACK
201 #define CC2430_RF_CONF_AUTOACK 1
202 #endif /* CC2430_CONF_AUTOACK */
203 
204 #if UIP_CONF_IPV6
205 /* Addresses, Sizes and Interfaces */
206 /* 8-byte addresses here, 2 otherwise */
207 #define LINKADDR_CONF_SIZE 8
208 #define UIP_CONF_LL_802154 1
209 #define UIP_CONF_LLH_LEN 0
210 #define UIP_CONF_NETIF_MAX_ADDRESSES 3
211 
212 /* TCP, UDP, ICMP */
213 #define UIP_CONF_TCP 0
214 #define UIP_CONF_UDP 1
215 #define UIP_CONF_UDP_CHECKSUMS 1
216 
217 /* ND and Routing */
218 #ifndef UIP_CONF_ROUTER
219 #define UIP_CONF_ROUTER 1
220 #endif
221 
222 #define UIP_CONF_ND6_SEND_RA 0
223 #define UIP_CONF_IP_FORWARD 0
224 #define RPL_CONF_STATS 0
225 #define RPL_CONF_MAX_DAG_ENTRIES 1
226 #ifndef RPL_CONF_OF
227 #define RPL_CONF_OF rpl_mrhof
228 #endif
229 
230 #define UIP_CONF_ND6_REACHABLE_TIME 600000
231 #define UIP_CONF_ND6_RETRANS_TIMER 10000
232 
233 #ifndef NBR_TABLE_CONF_MAX_NEIGHBORS
234 #define NBR_TABLE_CONF_MAX_NEIGHBORS 4 /* Handle n Neighbors */
235 #endif
236 #ifndef UIP_CONF_MAX_ROUTES
237 #define UIP_CONF_MAX_ROUTES 4 /* Handle n Routes */
238 #endif
239 
240 /* uIP */
241 #ifndef UIP_CONF_BUFFER_SIZE
242 #define UIP_CONF_BUFFER_SIZE 240
243 #endif
244 #define UIP_CONF_IPV6_QUEUE_PKT 0
245 #define UIP_CONF_IPV6_CHECKS 1
246 #define UIP_CONF_IPV6_REASSEMBLY 0
247 
248 /* 6lowpan */
249 #define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_HC06
250 #ifndef SICSLOWPAN_CONF_FRAG
251 #define SICSLOWPAN_CONF_FRAG 0 /* About 2KB of CODE if 1 */
252 #endif
253 #define SICSLOWPAN_CONF_MAXAGE 8
254 
255 /* Define our IPv6 prefixes/contexts here */
256 #define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 1
257 #define SICSLOWPAN_CONF_ADDR_CONTEXT_0 { \
258  addr_contexts[0].prefix[0] = 0x20; \
259  addr_contexts[0].prefix[1] = 0x01; \
260  addr_contexts[0].prefix[2] = 0x06; \
261  addr_contexts[0].prefix[3] = 0x30; \
262  addr_contexts[0].prefix[4] = 0x03; \
263  addr_contexts[0].prefix[5] = 0x01; \
264  addr_contexts[0].prefix[6] = 0x64; \
265  addr_contexts[0].prefix[7] = 0x53; \
266 }
267 
268 #define MAC_CONF_CHANNEL_CHECK_RATE 8
269 #ifndef QUEUEBUF_CONF_NUM
270 #define QUEUEBUF_CONF_NUM 6
271 #endif
272 
273 #else /* UIP_CONF_IPV6 */
274 /* Network setup for non-IPv6 (rime). */
275 #define UIP_CONF_IP_FORWARD 1
276 #define UIP_CONF_BUFFER_SIZE 108
277 #define RIME_CONF_NO_POLITE_ANNOUCEMENTS 0
278 #define QUEUEBUF_CONF_NUM 8
279 #endif /* UIP_CONF_IPV6 */
280 
281 /* Prevent SDCC compile error when UIP_CONF_ROUTER == 0 */
282 #if !UIP_CONF_ROUTER
283 #define UIP_CONF_DS6_AADDR_NBU 1
284 #endif
285 
286 #endif /* CONTIKI_CONF_H_ */
Default definitions of C compiler quirk work-arounds.