Contiki-Inga 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  * Build for SmartRF05EB+CC2530EM by default.
15  * This define needs to have its final value before inclusion of models.h
16  */
17 #ifndef MODELS_CONF_CC2531_USB_STICK
18 #define MODELS_CONF_CC2531_USB_STICK 0
19 #endif
20 
21 #include "models.h"
22 
23 /*
24  * Define this as 1 to poll the etimer process from within main instead of from
25  * the clock ISR. This reduces the ISR's stack usage and may prevent crashes.
26  */
27 #ifndef CLOCK_CONF_STACK_FRIENDLY
28 #define CLOCK_CONF_STACK_FRIENDLY 1
29 #endif
30 
31 #ifndef STACK_CONF_DEBUGGING
32 #define STACK_CONF_DEBUGGING 0
33 #endif
34 
35 /* Energest Module */
36 #ifndef ENERGEST_CONF_ON
37 #define ENERGEST_CONF_ON 0
38 #endif
39 
40 /* Verbose Startup? Turning this off saves plenty of bytes of CODE in HOME */
41 #ifndef STARTUP_CONF_VERBOSE
42 #define STARTUP_CONF_VERBOSE 0
43 #endif
44 
45 /* More CODE space savings by turning off process names */
46 #define PROCESS_CONF_NO_PROCESS_NAMES 1
47 
48 /*
49  * USARTs:
50  * SmartRF RS232 -> USART0 / Alternative 1 (UART)
51  * SmartRF LCD -> USART1 / Alternative 2 (SPI)
52  */
53 #define UART_ON_USART 0
54 
55 #define UART1_CONF_ENABLE 0
56 
57 #ifndef UART0_CONF_ENABLE
58 #define UART0_CONF_ENABLE 1
59 #endif
60 #ifndef UART0_CONF_WITH_INPUT
61 #define UART0_CONF_WITH_INPUT 0
62 #endif
63 
64 #ifndef UART0_CONF_HIGH_SPEED
65 #define UART0_CONF_HIGH_SPEED 0
66 #endif
67 
68 /* USB output buffering enabled by default (relevant to cc2531 builds only) */
69 #ifndef USB_SERIAL_CONF_BUFFERED
70 #define USB_SERIAL_CONF_BUFFERED 1
71 #endif
72 
73 #define SLIP_RADIO_CONF_NO_PUTCHAR 1
74 
75 #if defined (UIP_FALLBACK_INTERFACE) || defined (CMD_CONF_OUTPUT)
76 #define SLIP_ARCH_CONF_ENABLE 1
77 #endif
78 
79 /* Are we a SLIP bridge? */
80 #if SLIP_ARCH_CONF_ENABLE
81 /* Make sure the UART is enabled, with interrupts */
82 #undef UART0_CONF_ENABLE
83 #undef UART0_CONF_WITH_INPUT
84 #define UART0_CONF_ENABLE 1
85 #define UART0_CONF_WITH_INPUT 1
86 #endif
87 
88 /* Output all captured frames over the UART in hexdump format */
89 #ifndef CC2530_RF_CONF_HEXDUMP
90 #define CC2530_RF_CONF_HEXDUMP 0
91 #endif
92 
93 #if CC2530_RF_CONF_HEXDUMP
94 /* We need UART1 output */
95 #undef UART_ZERO_CONF_ENABLE
96 #define UART_ZERO_CONF_ENABLE 1
97 #endif
98 
99 /* Code Shortcuts */
100 /*
101  * When set, this directive also configures the following bypasses:
102  * - process_post_synch() in tcpip_input() (we call packet_input())
103  * - process_post_synch() in tcpip_uipcall (we call the relevant pthread)
104  * - mac_call_sent_callback() is replaced with sent() in various places
105  *
106  * These are good things to do, they reduce stack usage and prevent crashes
107  */
108 #define NETSTACK_CONF_SHORTCUTS 1
109 
110 /*
111  * By default we read our MAC from the (read-only) Information Page (primary
112  * location). In order to have a user-programmable mac, define this as 0 to
113  * use the secondary location (addresses 0xFFE8 - 0xFFEF on the last flash page)
114  */
115 #ifndef CC2530_CONF_MAC_FROM_PRIMARY
116 #define CC2530_CONF_MAC_FROM_PRIMARY 1
117 #endif
118 
119 /* Interrupt Number 6: Shared between P2 Inputs, I2C and USB
120  * A single ISR handles all of the above. Leave this as is if you are not
121  * interested in any of the above. Define as 1 (e.g. in project-conf.h) if
122  * at least one of those interrupt sources will need handled */
123 #ifndef PORT_2_ISR_ENABLED
124 #define PORT_2_ISR_ENABLED 0
125 #endif
126 
127 /*
128  * Sensors
129  * It is harmless to #define XYZ 1
130  * even if the sensor is not present on our device
131  */
132 #ifndef BUTTON_SENSOR_CONF_ON
133 #define BUTTON_SENSOR_CONF_ON 1 /* Buttons */
134 #endif
135 
136 /* B2 on the cc2531 USB stick can be a reset button or a general-purpose one */
137 #ifndef CC2531_CONF_B2_REBOOTS
138 #define CC2531_CONF_B2_REBOOTS 0 /* General Purpose by default */
139 #endif
140 
141 /* ADC - Turning this off will disable everything below */
142 #ifndef ADC_SENSOR_CONF_ON
143 #define ADC_SENSOR_CONF_ON 1
144 #endif
145 #define TEMP_SENSOR_CONF_ON 1 /* Temperature */
146 #define VDD_SENSOR_CONF_ON 1 /* Supply Voltage */
147 #define BATTERY_SENSOR_CONF_ON 0 /* Battery */
148 
149 /* Low Power Modes - We only support PM0/Idle and PM1 */
150 #ifndef LPM_CONF_MODE
151 #define LPM_CONF_MODE 0 /* 0: no LPM, 1: MCU IDLE, 2: Drop to PM1 */
152 #endif
153 
154 /* DMA Configuration */
155 #ifndef DMA_CONF_ON
156 #define DMA_CONF_ON 0
157 #endif
158 
159 /* Viztool on by default for IPv6 builds */
160 #if UIP_CONF_IPV6
161 #ifndef VIZTOOL_CONF_ON
162 #define VIZTOOL_CONF_ON 1
163 #endif /* VIZTOOL_CONF_ON */
164 #endif /* UIP_CONF_IPV6 */
165 
166 /* Network Stack */
167 #ifndef NETSTACK_CONF_NETWORK
168 #if UIP_CONF_IPV6
169 #define NETSTACK_CONF_NETWORK sicslowpan_driver
170 #else
171 #define NETSTACK_CONF_NETWORK rime_driver
172 #endif /* UIP_CONF_IPV6 */
173 #endif /* NETSTACK_CONF_NETWORK */
174 
175 #ifndef NETSTACK_CONF_MAC
176 #define NETSTACK_CONF_MAC csma_driver
177 #endif
178 
179 #ifndef NETSTACK_CONF_RDC
180 #define NETSTACK_CONF_RDC nullrdc_driver
181 #define NULLRDC_802154_AUTOACK 1
182 #define NULLRDC_802154_AUTOACK_HW 1
183 #endif
184 
185 #ifndef NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE
186 #define NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE 8
187 #endif
188 
189 #ifndef NETSTACK_CONF_FRAMER
190 #define NETSTACK_CONF_FRAMER framer_802154
191 #endif
192 
193 #define NETSTACK_CONF_RADIO cc2530_rf_driver
194 
195 /* RF Config */
196 #define IEEE802154_CONF_PANID 0x5449 /* TI */
197 
198 #ifndef CC2530_RF_CONF_CHANNEL
199 #define CC2530_RF_CONF_CHANNEL 25
200 #endif /* CC2530_RF_CONF_CHANNEL */
201 
202 #ifndef CC2530_RF_CONF_AUTOACK
203 #define CC2530_RF_CONF_AUTOACK 1
204 #endif /* CC2530_CONF_AUTOACK */
205 
206 #if UIP_CONF_IPV6
207 /* Addresses, Sizes and Interfaces */
208 /* 8-byte addresses here, 2 otherwise */
209 #define LINKADDR_CONF_SIZE 8
210 #define UIP_CONF_LL_802154 1
211 #define UIP_CONF_LLH_LEN 0
212 #define UIP_CONF_NETIF_MAX_ADDRESSES 3
213 
214 /* TCP, UDP, ICMP */
215 #define UIP_CONF_TCP 0
216 #define UIP_CONF_UDP 1
217 #define UIP_CONF_UDP_CHECKSUMS 1
218 
219 /* ND and Routing */
220 #ifndef UIP_CONF_ROUTER
221 #define UIP_CONF_ROUTER 1
222 #endif
223 
224 #define UIP_CONF_ND6_SEND_RA 0
225 #define UIP_CONF_IP_FORWARD 0
226 #define RPL_CONF_STATS 0
227 #define RPL_CONF_MAX_DAG_ENTRIES 1
228 #ifndef RPL_CONF_OF
229 #define RPL_CONF_OF rpl_mrhof
230 #endif
231 
232 #define UIP_CONF_ND6_REACHABLE_TIME 600000
233 #define UIP_CONF_ND6_RETRANS_TIMER 10000
234 
235 #ifndef NBR_TABLE_CONF_MAX_NEIGHBORS
236 #define NBR_TABLE_CONF_MAX_NEIGHBORS 4 /* Handle n Neighbors */
237 #endif
238 #ifndef UIP_CONF_MAX_ROUTES
239 #define UIP_CONF_MAX_ROUTES 4 /* Handle n Routes */
240 #endif
241 
242 /* uIP */
243 #ifndef UIP_CONF_BUFFER_SIZE
244 #define UIP_CONF_BUFFER_SIZE 240
245 #endif
246 #define UIP_CONF_IPV6_QUEUE_PKT 0
247 #define UIP_CONF_IPV6_CHECKS 1
248 #define UIP_CONF_IPV6_REASSEMBLY 0
249 
250 /* 6lowpan */
251 #define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_HC06
252 #ifndef SICSLOWPAN_CONF_FRAG
253 #define SICSLOWPAN_CONF_FRAG 0 /* About 2KB of CODE if 1 */
254 #endif
255 #define SICSLOWPAN_CONF_MAXAGE 8
256 
257 /* Define our IPv6 prefixes/contexts here */
258 #define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 1
259 #define SICSLOWPAN_CONF_ADDR_CONTEXT_0 { \
260  addr_contexts[0].prefix[0] = 0xaa; \
261  addr_contexts[0].prefix[1] = 0xaa; \
262 }
263 
264 #define MAC_CONF_CHANNEL_CHECK_RATE 8
265 
266 #ifndef QUEUEBUF_CONF_NUM
267 #define QUEUEBUF_CONF_NUM 6
268 #endif
269 
270 #else /* UIP_CONF_IPV6 */
271 /* Network setup for non-IPv6 (rime). */
272 #define UIP_CONF_IP_FORWARD 1
273 #define UIP_CONF_BUFFER_SIZE 108
274 #define RIME_CONF_NO_POLITE_ANNOUCEMENTS 0
275 #define QUEUEBUF_CONF_NUM 8
276 #endif /* UIP_CONF_IPV6 */
277 
278 /* Prevent SDCC compile error when UIP_CONF_ROUTER == 0 */
279 #if !UIP_CONF_ROUTER
280 #define UIP_CONF_DS6_AADDR_NBU 1
281 #endif
282 
283 #endif /* CONTIKI_CONF_H_ */