Contiki-Inga 3.x
contiki-conf.h
1 #ifndef __CONTIKI_CONF_H__
2 #define __CONTIKI_CONF_H__
3 
4 #include <avr/io.h>
5 #include <stdint.h>
6 #include <avrdef.h>
7 
8 // Only when RTC is defined (--> On Battery Backups we still use the timer)
9 #ifdef RTC
10  // Defining this constant will cause the RTC to be used instead of a HW timer
11  // Setting this constant to 0 will use the RTC compare interrupt directly
12  // Setting this constant to 1 will use an event channel for timer source
13  #define XMEGA_TIMER_RTC 0
14 
15  // Enables Clock Output on PortD Pin7
16  #define PLATFORM_CLOCKOUT_D7 1
17 
18  // Force PowerReduction for the RTC to be off
19  #undef POWERREDUCTION_CONF_RTC
20  #define POWERREDUCTION_CONF_RTC 0
21 
22  #include "xmega_rtc.h"
23 #endif
24 
25 
26 #ifndef PLATFORM_CONF_RADIO
27  #define PLATFORM_RADIO 1
28 #else
29  #define PLATFORM_RADIO PLATFORM_CONF_RADIO
30 #endif
31 
32 // include drivers for this platform here because there are #ifdef's in the .h files that we need immedeately
33 #include "xmega_clock.h"
34 #include "xmega_interrupt.h"
35 #include "xmega_powerreduction.h"
36 #include "xmega_timer.h"
37 #include "xmega_spi.h"
38 // #include "xmega_adc.h"
39 
40 /*************************************************************************/
41 
42 #define PLATFORM_HAS_LEDS 1
43 
44 // @TODO this is only for XMega Xplained
45 #define LEDS_PxDIR PORTR.DIRSET
46 #define LEDS_PxOUT PORTR.OUT
47 #define LEDS_CONF_GREEN PIN0_bm
48 #define LEDS_CONF_YELLOW PIN1_bm
49 #define LEDS_CONF_ALL (PIN0_bm | PIN1_bm)
50 
51 #define WATCHDOG_CONF_TIMEOUT WDT_PER_2KCLK_gc
52 
53 // RF230 / 231 / 232 / 233
54 
55 // Radio: RF230/231/232/233
56 #define SSPORT C
57 #define SSPIN (0x04)
58 #define SPIPORT C
59 #define MOSIPIN (0x05)
60 #define MISOPIN (0x06)
61 #define SCKPIN (0x07)
62 #define RSTPORT C
63 #define RSTPIN (0x00)
64 #define IRQPORT C
65 #define IRQPIN (0x02)
66 #define SLPTRPORT C
67 #define SLPTRPIN (0x03)
68 //#define TXCWPORT C
69 //#define TXCWPIN (0x00)
70 //#define USART 0
71 //#define USARTVECT USART0_RX_vect
72 // #define TICKTIMER 3
73 
74 //#define UIP_CONF_IPV6 1
75 
76 #define ENERGEST_CONF_ON 0
77 
78 #if RF230BB
79  #undef PACKETBUF_CONF_HDR_SIZE
80 #endif
81 
82 #if UIP_CONF_IPV6
83  #define RIMEADDR_CONF_SIZE 8
84  #define UIP_CONF_ICMP6 1
85  #define UIP_CONF_UDP 1
86  #define UIP_CONF_TCP 1
87  //#define UIP_CONF_IPV6_RPL 0
88  #define NETSTACK_CONF_NETWORK sicslowpan_driver
89  #define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_HC06
90 #else
91  #define RIMEADDR_CONF_SIZE 2
92  #define NETSTACK_CONF_NETWORK rime_driver
93 #endif
94 #define UIP_CONF_DS6_NBR_NBU 20
95 #define UIP_CONF_DS6_DEFRT_NBU 2
96 #define UIP_CONF_DS6_PREFIX_NBU 3
97 #define UIP_CONF_DS6_ROUTE_NBU 20
98 #define UIP_CONF_DS6_ADDR_NBU 3
99 #define UIP_CONF_DS6_MADDR_NBU 0
100 #define UIP_CONF_DS6_AADDR_NBU 0
101 
102 #define UIP_CONF_LL_802154 1
103 #define UIP_CONF_LLH_LEN 0
104 
105 /* 10 bytes per stateful address context - see sicslowpan.c */
106 /* Default is 1 context with prefix aaaa::/64 */
107 /* These must agree with all the other nodes or there will be a failure to communicate! */
108 #define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 1
109 #define SICSLOWPAN_CONF_ADDR_CONTEXT_0 {addr_contexts[0].prefix[0]=0xaa;addr_contexts[0].prefix[1]=0xaa;}
110 #define SICSLOWPAN_CONF_ADDR_CONTEXT_1 {addr_contexts[1].prefix[0]=0xbb;addr_contexts[1].prefix[1]=0xbb;}
111 #define SICSLOWPAN_CONF_ADDR_CONTEXT_2 {addr_contexts[2].prefix[0]=0x20;addr_contexts[2].prefix[1]=0x01;addr_contexts[2].prefix[2]=0x49;addr_contexts[2].prefix[3]=0x78,addr_contexts[2].prefix[4]=0x1d;addr_contexts[2].prefix[5]=0xb1;}
112 
113 /* 211 bytes per queue buffer */
114 #define QUEUEBUF_CONF_NUM 8
115 
116 /* 54 bytes per queue ref buffer */
117 #define QUEUEBUF_CONF_REF_NUM 2
118 
119 /* Take the default TCP maximum segment size for efficiency and simpler wireshark captures */
120 /* Use this to prevent 6LowPAN fragmentation (whether or not fragmentation is enabled) */
121 //#define UIP_CONF_TCP_MSS 48
122 
123 /* 30 bytes per TCP connection */
124 /* 6LoWPAN does not do well with concurrent TCP streams, as new browser GETs collide with packets coming */
125 /* from previous GETs, causing decreased throughput, retransmissions, and timeouts. Increase to study this. */
126 #define UIP_CONF_MAX_CONNECTIONS 1
127 
128 /* 2 bytes per TCP listening port */
129 #define UIP_CONF_MAX_LISTENPORTS 1
130 
131 /* 25 bytes per UDP connection */
132 #define UIP_CONF_UDP_CONNS 10
133 
134 #define UIP_CONF_IP_FORWARD 0
135 #define UIP_CONF_FWCACHE_SIZE 0
136 
137 #define UIP_CONF_IPV6_CHECKS 1
138 #define UIP_CONF_IPV6_QUEUE_PKT 1
139 #define UIP_CONF_IPV6_REASSEMBLY 0
140 
141 #define UIP_CONF_UDP_CHECKSUMS 1
142 #define UIP_CONF_TCP_SPLIT 1
143 #define UIP_CONF_DHCP_LIGHT 1
144 
145 #define NETSTACK_CONF_MAC nullmac_driver
146 #define NETSTACK_CONF_RDC nullrdc_driver
147 #define NETSTACK_CONF_FRAMER framer_802154
148 #define NETSTACK_CONF_RADIO rf230_driver
149 
150 #define RADIO_CONF_CALIBRATE_INTERVAL 256
151 /* AUTOACK receive mode gives better rssi measurements, even if ACK is never requested */
152 #define RF230_CONF_AUTOACK 0
153 /* Request 802.15.4 ACK on all packets sent (else autoretry). This is primarily for testing. */
154 #define SICSLOWPAN_CONF_ACK_ALL 0
155 /* Number of auto retry attempts+1, 1-16. Set zero to disable extended TX_ARET_ON mode with CCA) */
156 #define RF230_CONF_AUTORETRIES 3
157 /* Number of CSMA attempts 0-7. 802.15.4 2003 standard max is 5. */
158 #define RF230_CONF_CSMARETRIES 5
159 /* CCA theshold energy -91 to -61 dBm (default -77). Set this smaller than the expected minimum rssi to avoid packet collisions */
160 /* The Jackdaw menu 'm' command is helpful for determining the smallest ever received rssi */
161 #define RF230_CONF_CCA_THRES -85
162 /* Allow 6lowpan fragments (needed for large TCP maximum segment size) */
163 #define SICSLOWPAN_CONF_FRAG 1
164 /* Most browsers reissue GETs after 3 seconds which stops fragment reassembly so a longer MAXAGE does no good */
165 #define SICSLOWPAN_CONF_MAXAGE 3
166 /* How long to wait before terminating an idle TCP connection. Smaller to allow faster sleep. Default is 120 seconds */
167 #define UIP_CONF_WAIT_TIMEOUT 5
168 
169 // RADIO_CHANNEL
170 #ifndef RADIO_CONF_CHANNEL
171  #define RADIO_CHANNEL 26
172 #else
173  #define RADIO_CHANNEL RADIO_CONF_CHANNEL
174 #endif
175 
176 // RADIO_TX_POWER
177 #ifndef RADIO_CONF_TX_POWER
178  #define RADIO_TX_POWER 0
179 #else
180  #define RADIO_TX_POWER RADIO_CONF_TX_POWER
181 #endif
182 
183 // NODE_ID
184 #ifdef NODE_ID
185  #undef NODE_ID
186  #warning Use NODE_CONF_ID to define your NodeId
187 #endif
188 
189 #ifndef NODE_CONF_ID
190  #define NODE_ID 0
191 #else
192  #define NODE_ID NODE_CONF_ID
193 #endif
194 
195 // RADIO_TX_POWER
196 #ifndef RADIO_CONF_PAN_ID
197  #define RADIO_PAN_ID 0xABCD
198 #else
199  #define RADIO_PAN_ID RADIO_CONF_TX_POWER
200 #endif
201 
202 #ifndef RADIO_CONF_PRESCALER
203  #define RADIO_PRESCALER SPI_PRESCALER_DIV8_gc
204 #else
205  #define RADIO_PRESCALER RADIO_CONF_PRESCALER
206 #endif
207 
208 /*************************************************************************/
209 
210 // #define RTIMER_ARCH_PRESCALER 1
211 
212 void platform_radio_init(void);
213 void platform_enable_clockout(void);
214 
215 /*************************************************************************/
216 
217 #define PLATFORM PLATFORM_AVR
218 #define CCIF
219 #define CLIF
220 
221 // This is for serial line IP communication
222 #define SLIP_PORT RS232_PORT_0
223 
224 #endif /* __CONTIKI_CONF_H__ */