Add missing includes
[contiki-2.x.git] / platform / avr-ravenusb / contiki-conf.h
blob7150208a8807632cfe020fa61eb8f651f8118315
1 /*
2 * Copyright (c) 2006, Technical University of Munich
3 * All rights reserved.
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.
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.
29 * This file is part of the Contiki operating system.
31 * @(#)$$
34 /**
35 * \file
36 * Configuration for RZRAVEN USB stick "jackdaw"
38 * \author
39 * Simon Barner <barner@in.tum.de>
40 * David Kopf <dak664@embarqmail.com>
43 #ifndef __CONTIKI_CONF_H__
44 #define __CONTIKI_CONF_H__
46 #include <stdbool.h>
47 #include <stdint.h>
48 #include <string.h>
50 /* ************************************************************************** */
51 //#pragma mark Basic Configuration
52 /* ************************************************************************** */
54 /* MCU and clock rate */
55 #define MCU_MHZ 8
56 #define PLATFORM PLATFORM_AVR
57 #define RAVEN_REVISION RAVENUSB_C
59 /* Clock ticks per second */
60 #define CLOCK_CONF_SECOND 125
62 /* Mac address, RF channel, PANID from EEPROM settings manager */
63 /* Generate random MAC address on first startup */
64 /* Random number from radio clock skew or ADC noise */
65 #define JACKDAW_CONF_USE_SETTINGS 1
66 #define JACKDAW_CONF_RANDOM_MAC 0
67 #define RNG_CONF_USE_RADIO_CLOCK 1
68 //#define RNG_CONF_USE_ADC 1
70 /* Since clock_time_t is 16 bits, maximum interval is 524 seconds */
71 #define RIME_CONF_BROADCAST_ANNOUNCEMENT_MAX_TIME CLOCK_CONF_SECOND * 524UL /*Default uses 600*/
73 /* Maximum time interval (used for timers) */
74 #define INFINITE_TIME 0xffff
76 /* COM port to be used for SLIP connection */
77 #define SLIP_PORT RS232_PORT_0
79 /* Pre-allocated memory for loadable modules heap space (in bytes)*/
80 #define MMEM_CONF_SIZE 256
82 /* Use the following address for code received via the codeprop
83 * facility
85 #define EEPROMFS_ADDR_CODEPROP 0x8000
87 /* Use Atmel 'Route Under MAC', currently just in sniffer mode! */
88 //#define UIP_CONF_USE_RUM 1
90 #define CCIF
91 #define CLIF
93 /* ************************************************************************** */
94 //#pragma mark USB Ethernet Hooks
95 /* ************************************************************************** */
97 #ifndef USB_ETH_HOOK_IS_READY_FOR_INBOUND_PACKET
98 #if RF230BB
99 #define USB_ETH_HOOK_IS_READY_FOR_INBOUND_PACKET() rf230_is_ready_to_send()
100 #else
101 static inline uint8_t radio_is_ready_to_send_() {
102 switch(radio_get_trx_state()) {
103 case BUSY_TX:
104 case BUSY_TX_ARET:
105 return 0;
107 return 1;
109 #define USB_ETH_HOOK_IS_READY_FOR_INBOUND_PACKET() radio_is_ready_to_send_()
110 #endif
111 #endif
113 #ifndef USB_ETH_HOOK_HANDLE_INBOUND_PACKET
114 #define USB_ETH_HOOK_HANDLE_INBOUND_PACKET(buffer,len) do { uip_len = len ; mac_ethernetToLowpan(buffer); } while(0)
115 #endif
117 #ifndef USB_ETH_HOOK_SET_PROMISCIOUS_MODE
118 #if RF230BB
119 #define USB_ETH_HOOK_SET_PROMISCIOUS_MODE(value) rf230_set_promiscuous_mode(value)
120 #else
121 #define USB_ETH_HOOK_SET_PROMISCIOUS_MODE(value) radio_set_trx_state(value?RX_ON:RX_AACK_ON)
122 #endif
123 #endif
125 #ifndef USB_ETH_HOOK_INIT
126 #define USB_ETH_HOOK_INIT() mac_ethernetSetup()
127 #endif
129 /* ************************************************************************** */
130 //#pragma mark RF230BB Hooks
131 /* ************************************************************************** */
133 //#define RF230BB_HOOK_RADIO_OFF() Led1_off()
134 //#define RF230BB_HOOK_RADIO_ON() Led1_on()
135 #define RF230BB_HOOK_TX_PACKET(buffer,total_len) mac_log_802_15_4_tx(buffer,total_len)
136 #define RF230BB_HOOK_RX_PACKET(buffer,total_len) mac_log_802_15_4_rx(buffer,total_len)
137 #define RF230BB_HOOK_IS_SEND_ENABLED() mac_is_send_enabled()
138 extern bool mac_is_send_enabled(void);
139 extern void mac_log_802_15_4_tx(const uint8_t* buffer, size_t total_len);
140 extern void mac_log_802_15_4_rx(const uint8_t* buffer, size_t total_len);
143 /* ************************************************************************** */
144 //#pragma mark USB CDC-ACM (UART) Hooks
145 /* ************************************************************************** */
147 #define USB_CDC_ACM_HOOK_TX_END(char) vcptx_end_led()
148 #define USB_CDC_ACM_HOOK_CLS_CHANGED(state) vcptx_end_led()
149 #define USB_CDC_ACM_HOOK_CONFIGURED() vcptx_end_led()
151 /* ************************************************************************** */
152 //#pragma mark UIP Settings
153 /* ************************************************************************** */
155 #define UIP_CONF_LL_802154 1
156 #define UIP_CONF_LLH_LEN 14
157 #define UIP_CONF_BUFSIZE UIP_LINK_MTU + UIP_LLH_LEN + 4 // +4 for vlan on macosx
159 #define UIP_CONF_MAX_CONNECTIONS 4
160 #define UIP_CONF_MAX_LISTENPORTS 4
162 #define UIP_CONF_IP_FORWARD 0
163 #define UIP_CONF_FWCACHE_SIZE 0
165 #define UIP_CONF_IPV6 1
166 #define UIP_CONF_IPV6_CHECKS 1
167 #define UIP_CONF_IPV6_QUEUE_PKT 0
168 #define UIP_CONF_IPV6_REASSEMBLY 0
169 #define UIP_CONF_NETIF_MAX_ADDRESSES 3
170 #define UIP_CONF_ND6_MAX_PREFIXES 3
171 #define UIP_CONF_ND6_MAX_NEIGHBORS 4
172 #define UIP_CONF_ND6_MAX_DEFROUTERS 2
174 #define UIP_CONF_UDP 1
175 #define UIP_CONF_UDP_CHECKSUMS 1
177 #define UIP_CONF_TCP 1
178 #define UIP_CONF_TCP_SPLIT 1
180 #define UIP_CONF_STATISTICS 1
182 /* ************************************************************************** */
183 //#pragma mark Serial Port Settings
184 /* ************************************************************************** */
185 /* Set USB_CONF_MACINTOSH to prefer CDC-ECM+DEBUG enumeration for Mac/Linux
186 * Leave undefined to prefer RNDIS+DEBUG enumeration for Windows/Linux
187 * TODO:Serial port would enumerate in all cases and prevent falling through to
188 * the supported network interface if USB_CONF_MACINTOSH is used with Windows
189 * or vice versa. The Mac configuration is set up to still enumerate as RNDIS-ONLY
190 * on Windows (without the serial port).
191 * At present the Windows configuration will not enumerate on the Mac at all,
192 * since it wants a custom descriptor for USB composite devices.
194 #define USB_CONF_MACINTOSH 0
196 /* Set USB_CONF_SERIAL to enable the USB serial port that allows control of the
197 * run-time configuration (COMx on Windows, ttyACMx on Linux, tty.usbmodemx on Mac)
198 * Debug printfs will go to this port unless USB_CONF_RS232 is set.
200 #define USB_CONF_SERIAL 1
202 /* RS232 debugs have less effect on network timing and are less likely
203 * to be dropped due to buffer overflow. Only tx is implemented at present.
204 * The tx pad is the middle one behind the jackdaw leds.
205 * RS232 output will work with or without enabling the USB serial port
207 #define USB_CONF_RS232 0
209 /* Disable mass storage enumeration for more program space */
210 //#define USB_CONF_STORAGE 1 /* TODO: Mass storage is currently broken */
212 /* ************************************************************************** */
213 //#pragma mark RIME Settings
214 /* ************************************************************************** */
216 #define RIMEADDR_CONF_SIZE 8
218 /* ************************************************************************** */
219 //#pragma mark SICSLOWPAN Settings
220 /* ************************************************************************** */
222 #define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_HC06
223 #define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 2
224 #ifdef RF230BB
225 #define SICSLOWPAN_CONF_CONVENTIONAL_MAC 1 //for barebones driver, sicslowpan calls radio->read function
227 /* ************************************************************************** */
228 //#pragma mark NETSTACK Settings
229 /* ************************************************************************** */
231 #if 1 /* Network setup */
232 /* No radio cycling */
233 #define NETSTACK_CONF_NETWORK sicslowpan_driver
234 #define NETSTACK_CONF_MAC nullmac_driver
235 #define NETSTACK_CONF_RDC sicslowmac_driver
236 #define NETSTACK_CONF_FRAMER framer_802154
237 #define NETSTACK_CONF_RADIO rf230_driver
238 #define RF230_CONF_AUTOACK 1
239 #define RF230_CONF_AUTORETRIES 2
240 #define QUEUEBUF_CONF_NUM 1
241 #define QUEUEBUF_CONF_REF_NUM 1
242 #define SICSLOWPAN_CONF_FRAG 1
243 #define SICSLOWPAN_CONF_MAXAGE 5
245 #elif 0
246 /* Contiki-mac radio cycling */
247 #define NETSTACK_CONF_NETWORK sicslowpan_driver
248 #define NETSTACK_CONF_MAC nullmac_driver
249 #define NETSTACK_CONF_RDC contikimac_driver
250 #define NETSTACK_CONF_FRAMER framer_802154
251 #define NETSTACK_CONF_RADIO rf230_driver
252 #define RF230_CONF_AUTOACK 0
253 #define RF230_CONF_AUTORETRIES 0
255 #elif 1
256 /* cx-mac radio cycling */
257 #define NETSTACK_CONF_NETWORK sicslowpan_driver
258 #define NETSTACK_CONF_MAC nullmac_driver
259 #define NETSTACK_CONF_RDC cxmac_driver
260 #define NETSTACK_CONF_FRAMER framer_802154
261 #define NETSTACK_CONF_RADIO rf230_driver
262 #define RF230_CONF_AUTOACK 0
263 #define RF230_CONF_AUTORETRIES 0
264 #define MAC_CONF_CHANNEL_CHECK_RATE 8
265 #define SICSLOWPAN_CONF_FRAG 1
266 #define QUEUEBUF_CONF_NUM 3
267 #define QUEUEBUF_CONF_REF_NUM 1
268 #define SICSLOWPAN_CONF_MAXAGE 5
269 //following gives 50% duty cycle, undef for default 5%
270 #define CXMAC_CONF_ON_TIME (RTIMER_ARCH_SECOND / 16)
272 #else
273 #error Network configuration not specified!
274 #endif /* Network setup */
277 /* ************************************************************************** */
278 //#pragma mark RPL Settings
279 /* ************************************************************************** */
281 #define UIP_CONF_IPV6_RPL 0
283 #if UIP_CONF_IPV6_RPL
285 /* Not completely working yet. Link local pings work but address prefixes do not get assigned */
286 /* RPL requires the uip stack. Change #CONTIKI_NO_NET=1 to UIP_CONF_IPV6=1 in the examples makefile,
287 or include the needed source files in /plaftorm/avr-ravenusb/Makefile.avr-ravenusb */
289 #define UIP_CONF_ROUTER 1
290 #define RPL_CONF_STATS 0
291 #define PROCESS_CONF_NO_PROCESS_NAMES 0
292 #undef UIP_CONF_TCP //TCP needed to serve RPL neighbor web page
293 #define UIP_CONF_TCP 1
294 //#undef UIP_FALLBACK_INTERFACE
295 #define UIP_FALLBACK_INTERFACE rpl_interface
296 #undef UIP_CONF_MAX_CONNECTIONS
297 #define UIP_CONF_MAX_CONNECTIONS 1
298 //#undef UIP_CONF_MAX_LISTENPORTS
299 //#define UIP_CONF_MAX_LISTENPORTS 10
300 //#define UIP_CONF_BUFFER_SIZE 256
301 #define UIP_CONF_TCP_MSS 512
303 #if 0 //too much RAM!
304 /* Handle 10 neighbors */
305 #define UIP_CONF_DS6_NBR_NBU 10
306 /* Handle 10 routes */
307 #define UIP_CONF_DS6_ROUTE_NBU 10
309 #define UIP_CONF_ND6_SEND_RA 0
310 #define UIP_CONF_ND6_REACHABLE_TIME 600000
311 #define UIP_CONF_ND6_RETRANS_TIMER 10000
312 #undef UIP_CONF_IPV6_QUEUE_PKT
313 #define UIP_CONF_IPV6_QUEUE_PKT 1
314 //#define UIP_CONF_IPV6_CHECKS 1
315 #define UIP_CONF_NETIF_MAX_ADDRESSES 3
316 #define UIP_CONF_ND6_MAX_PREFIXES 3
317 #define UIP_CONF_ND6_MAX_NEIGHBORS 4
318 #define UIP_CONF_ND6_MAX_DEFROUTERS 2
319 #define UIP_CONF_IP_FORWARD 0
320 #define UIP_CONF_BUFFER_SIZE 240
321 #define UIP_CONF_ICMP_DEST_UNREACH 1
322 #define UIP_CONF_DHCP_LIGHT
324 #undef UIP_CONF_LLH_LEN
325 #define UIP_CONF_LLH_LEN 0
326 //#define UIP_CONF_RECEIVE_WINDOW 48
327 //#define UIP_CONF_TCP_MSS 48
328 #undef UIP_CONF_UDP_CONNS
329 #define UIP_CONF_UDP_CONNS 12
330 #undef UIP_CONF_FWCACHE_SIZE
331 #define UIP_CONF_FWCACHE_SIZE 30
332 #define UIP_CONF_BROADCAST 1
333 #define UIP_ARCH_IPCHKSUM 1
334 #define UIP_CONF_PINGADDRCONF 0
335 #define UIP_CONF_LOGGING 0
336 #endif
337 #endif /* UIP_CONF_IPV6_RPL */
338 #endif /* RF230BB */
340 /* ************************************************************************** */
341 //#pragma mark Other Settings
342 /* ************************************************************************** */
344 /* Route-Under-MAC uses 16-bit short addresses */
345 #if UIP_CONF_USE_RUM
346 #undef UIP_CONF_LL_802154
347 #define UIP_DATA_RUM_OFFSET 5
348 #endif
350 #include <stdint.h>
352 typedef int32_t s32_t;
353 typedef unsigned short clock_time_t;
354 typedef unsigned char u8_t;
355 typedef unsigned short u16_t;
356 typedef unsigned long u32_t;
357 typedef unsigned short uip_stats_t;
358 typedef unsigned long off_t;
360 void clock_delay(unsigned int us2);
361 void clock_wait(int ms10);
362 void clock_set_seconds(unsigned long s);
363 unsigned long clock_seconds(void);
365 #endif /* __CONTIKI_CONF_H__ */