Contiki 2.6

contiki-conf.h

00001 #ifndef __CONTIKI_CONF_H__
00002 #define __CONTIKI_CONF_H__
00003 
00004 #include "8051def.h"
00005 #include "sys/cc.h"
00006 #include <string.h>
00007 
00008 /* Include Project Specific conf */
00009 #ifdef PROJECT_CONF_H
00010 #include "project-conf.h"
00011 #endif /* PROJECT_CONF_H */
00012 
00013 /*
00014  * Define this as 1 to poll the etimer process from within main instead of from
00015  * the clock ISR. This reduces the ISR's stack usage and may prevent crashes.
00016  */
00017 #ifndef CLOCK_CONF_STACK_FRIENDLY
00018 #define CLOCK_CONF_STACK_FRIENDLY 1
00019 #endif
00020 
00021 /* Memory filesystem RAM size. */
00022 #define CFS_RAM_CONF_SIZE               512
00023 
00024 /* Logging.. */
00025 #define LOG_CONF_ENABLED                0
00026 
00027 /* Energest Module */
00028 #ifndef ENERGEST_CONF_ON
00029 #define ENERGEST_CONF_ON      0
00030 #endif
00031 
00032 /* Verbose Startup? Turning this off reduces our footprint a fair bit */
00033 #define STARTUP_CONF_VERBOSE  0
00034 
00035 /* More CODE space savings by turning off process names */
00036 #define PROCESS_CONF_NO_PROCESS_NAMES 1
00037 
00038 /*
00039  * UARTs: 1=>Enabled, 0=>Disabled. Default: Both Disabled (see uart.h)
00040  * Disabling UARTs reduces our CODE footprint
00041  * Disabling UART1 also disables all debugging output.
00042  * Should be used when nodes are meant to run on batteries
00043  *
00044  * On N740, by enabling UART1, you are also enabling an ugly hack which aims
00045  * to detect the USB connection during execution. It will then turn on/off
00046  * UART1 RX interrupts accordingly. This seems to work but you have been warned
00047  * If you start seeing random crashes when on battery, this is where to look.
00048  */
00049 #ifndef UART_ONE_CONF_ENABLE
00050 #define UART_ONE_CONF_ENABLE  1
00051 #endif
00052 #ifndef UART_ONE_CONF_WITH_INPUT
00053 #define UART_ONE_CONF_WITH_INPUT 0
00054 #endif
00055 #define UART_ZERO_CONF_ENABLE 0
00056 
00057 #ifndef UART_ONE_CONF_HIGH_SPEED
00058 #define UART_ONE_CONF_HIGH_SPEED 0
00059 #endif
00060 
00061 /* Are we a SLIP bridge? */
00062 #if SLIP_ARCH_CONF_ENABLE
00063 /* Make sure UART1 is enabled, with interrupts */
00064 #undef UART_ONE_CONF_ENABLE
00065 #undef UART_ONE_CONF_WITH_INPUT
00066 #define UART_ONE_CONF_ENABLE  1
00067 #define UART_ONE_CONF_WITH_INPUT 1
00068 #define UIP_FALLBACK_INTERFACE slip_interface
00069 #endif
00070 
00071 /* Output all captured frames over the UART in hexdump format */
00072 #ifndef CC2430_RF_CONF_HEXDUMP
00073 #define CC2430_RF_CONF_HEXDUMP 0
00074 #endif
00075 
00076 #if CC2430_RF_CONF_HEXDUMP
00077 /* We need UART1 output */
00078 #undef UART_ONE_CONF_ENABLE
00079 #define UART_ONE_CONF_ENABLE   1
00080 #endif
00081 
00082 /* Code Shortcuts */
00083 /*
00084  * When set, the RF driver is no longer a contiki process and the RX ISR is
00085  * disabled. Instead of polling the radio process when data arrives, we
00086  * periodically check for data by directly invoking the driver from main()
00087  *
00088  * When set, this directive also configures the following bypasses:
00089  *   - process_post_synch() in tcpip_input() (we call packet_input())
00090  *   - process_post_synch() in tcpip_uipcall (we call the relevant pthread)
00091  *   - mac_call_sent_callback() is replaced with sent() in various places
00092  *
00093  * These are good things to do, they reduce stack usage and prevent crashes
00094  */
00095 #define NETSTACK_CONF_SHORTCUTS   1
00096 
00097 /*
00098  * Sensors
00099  * It is harmless to #define XYZ 1
00100  * even if the sensor is not present on our device
00101  */
00102 #ifndef BUTTON_SENSOR_CONF_ON
00103 #define BUTTON_SENSOR_CONF_ON   1  /* Buttons */
00104 #endif
00105 /* ADC - Turning this off will disable everything below */
00106 #ifndef ADC_SENSOR_CONF_ON
00107 #define ADC_SENSOR_CONF_ON      1
00108 #endif
00109 #define TEMP_SENSOR_CONF_ON     1  /* Temperature */
00110 #define BATTERY_SENSOR_CONF_ON  1  /* Battery */
00111 #define VDD_SENSOR_CONF_ON      1  /* Supply Voltage */
00112 #define ACC_SENSOR_CONF_ON      1  /* Accelerometer */
00113 #define ACC_SENSOR_CONF_GSEL    0  /* Acc. g-Select => 1: +/-11g, 0: +/-3g */
00114 #define LIGHT_SENSOR_CONF_ON    1  /* Light */
00115 
00116 /* Watchdog */
00117 #define WDT_CONF_INTERVAL     0
00118 #define WDT_CONF_TIMER_MODE   0 /* 0 or undefined for watchdog mode */
00119 
00120 /* Low Power Modes - We only support PM0/Idle and PM1 */
00121 #ifndef LPM_CONF_MODE
00122 #define LPM_CONF_MODE         1 /* 0: no LPM, 1: MCU IDLE, 2: Drop to PM1 */
00123 #endif
00124 
00125 /* DMA Configuration */
00126 #ifndef DMA_CONF_ON
00127 #define DMA_CONF_ON 0
00128 #endif
00129 
00130 /* N740 Serial Flash */
00131 #ifndef M25P16_CONF_ON
00132 #define M25P16_CONF_ON  1
00133 #endif
00134 
00135 /* XXX argh, ugly hack to make stuff compile! */
00136 #define snprintf(BUF, SIZE, ...) sprintf(BUF, __VA_ARGS__)
00137 
00138 /* Sensinode-Specific Tools and APPs */
00139 /* Viztool on by default for IPv6 builds */
00140 #if UIP_CONF_IPV6
00141 #ifndef VIZTOOL_CONF_ON
00142 #define VIZTOOL_CONF_ON        1
00143 #endif /* VIZTOOL_CONF_ON */
00144 #endif /* UIP_CONF_IPV6 */
00145 
00146 /* BatMon off by default unless we build with APPS += batmon */
00147 #ifndef BATMON_CONF_ON
00148 #define BATMON_CONF_ON         0
00149 #endif
00150 
00151 /* Network Stack */
00152 #if UIP_CONF_IPV6
00153 #define NETSTACK_CONF_NETWORK sicslowpan_driver
00154 #else
00155 #define NETSTACK_CONF_NETWORK rime_driver
00156 #endif
00157 
00158 #ifndef NETSTACK_CONF_MAC
00159 #define NETSTACK_CONF_MAC     csma_driver
00160 #endif
00161 
00162 #ifndef NETSTACK_CONF_RDC
00163 #define NETSTACK_CONF_RDC     nullrdc_driver
00164 #define NULLRDC_802154_AUTOACK 1
00165 #define NULLRDC_802154_AUTOACK_HW 1
00166 #endif
00167 
00168 #ifndef NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE
00169 #define NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE 8
00170 #endif
00171 
00172 #define NETSTACK_CONF_FRAMER  framer_802154
00173 #define NETSTACK_CONF_RADIO   cc2430_rf_driver
00174 
00175 /* RF Config */
00176 #define IEEE802154_CONF_PANID 0x4C55 /* LU */
00177 
00178 #ifndef CC2430_RF_CONF_CHANNEL
00179 #define CC2430_RF_CONF_CHANNEL    25
00180 #endif /* CC2430_RF_CONF_CHANNEL */
00181 
00182 #ifndef CC2430_RF_CONF_TX_POWER
00183 #define CC2430_RF_CONF_TX_POWER 0x5F /* Datasheet recommended value */
00184 #endif
00185 
00186 #ifndef CC2430_RF_CONF_AUTOACK
00187 #define CC2430_RF_CONF_AUTOACK 1
00188 #endif /* CC2430_CONF_AUTOACK */
00189 
00190 #if UIP_CONF_IPV6
00191 /* Addresses, Sizes and Interfaces */
00192 /* 8-byte addresses here, 2 otherwise */
00193 #define RIMEADDR_CONF_SIZE                   8
00194 #define UIP_CONF_LL_802154                   1
00195 #define UIP_CONF_LLH_LEN                     0
00196 #define UIP_CONF_NETIF_MAX_ADDRESSES         3
00197 
00198 /* TCP, UDP, ICMP */
00199 #define UIP_CONF_TCP                         0
00200 #define UIP_CONF_UDP                         1
00201 #define UIP_CONF_UDP_CHECKSUMS               1
00202 
00203 /* ND and Routing */
00204 #ifndef UIP_CONF_ROUTER
00205 #define UIP_CONF_ROUTER                      1 
00206 #endif
00207 
00208 /* Prevent SDCC compile error when UIP_CONF_ROUTER == 0 */
00209 #if !UIP_CONF_ROUTER
00210 #define UIP_CONF_DS6_AADDR_NBU               1
00211 #endif
00212 
00213 #define UIP_CONF_ND6_SEND_RA                 0
00214 #define UIP_CONF_IP_FORWARD                  0
00215 #define RPL_CONF_STATS                       0
00216 #define RPL_CONF_MAX_DAG_ENTRIES             1
00217 #ifndef RPL_CONF_OF
00218 #define RPL_CONF_OF rpl_of_etx
00219 #endif
00220 
00221 #define UIP_CONF_ND6_REACHABLE_TIME     600000
00222 #define UIP_CONF_ND6_RETRANS_TIMER       10000
00223 
00224 #ifndef UIP_CONF_DS6_NBR_NBU
00225 #define UIP_CONF_DS6_NBR_NBU                 4 /* Handle n Neighbors */
00226 #endif
00227 #ifndef UIP_CONF_DS6_ROUTE_NBU
00228 #define UIP_CONF_DS6_ROUTE_NBU               4 /* Handle n Routes */
00229 #endif
00230 
00231 /* uIP */
00232 #define UIP_CONF_BUFFER_SIZE               240
00233 #define UIP_CONF_IPV6_QUEUE_PKT              0
00234 #define UIP_CONF_IPV6_CHECKS                 1
00235 #define UIP_CONF_IPV6_REASSEMBLY             0
00236 
00237 /* 6lowpan */
00238 #define SICSLOWPAN_CONF_COMPRESSION          SICSLOWPAN_COMPRESSION_HC06
00239 #ifndef SICSLOWPAN_CONF_FRAG
00240 #define SICSLOWPAN_CONF_FRAG                 0 /* About 2KB of CODE if 1 */
00241 #endif
00242 #define SICSLOWPAN_CONF_MAXAGE               8
00243 
00244 /* Define our IPv6 prefixes/contexts here */
00245 #define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS    2
00246 #define SICSLOWPAN_CONF_ADDR_CONTEXT_0 { \
00247   addr_contexts[0].prefix[0] = 0x20; \
00248   addr_contexts[0].prefix[1] = 0x01; \
00249   addr_contexts[0].prefix[2] = 0x06; \
00250   addr_contexts[0].prefix[3] = 0x30; \
00251   addr_contexts[0].prefix[4] = 0x03; \
00252   addr_contexts[0].prefix[5] = 0x01; \
00253   addr_contexts[0].prefix[6] = 0x64; \
00254   addr_contexts[0].prefix[7] = 0x53; \
00255 }
00256 #define SICSLOWPAN_CONF_ADDR_CONTEXT_1 { \
00257   addr_contexts[1].prefix[0] = 0x20; \
00258   addr_contexts[1].prefix[1] = 0x01; \
00259   addr_contexts[1].prefix[2] = 0x06; \
00260   addr_contexts[1].prefix[3] = 0x30; \
00261   addr_contexts[1].prefix[4] = 0x03; \
00262   addr_contexts[1].prefix[5] = 0x01; \
00263   addr_contexts[1].prefix[6] = 0x11; \
00264   addr_contexts[1].prefix[7] = 0x00; \
00265 }
00266 
00267 #define MAC_CONF_CHANNEL_CHECK_RATE          8
00268 #ifndef QUEUEBUF_CONF_NUM
00269 #define QUEUEBUF_CONF_NUM                    6
00270 #endif
00271 
00272 #else /* UIP_CONF_IPV6 */
00273 /* Network setup for non-IPv6 (rime). */
00274 #define UIP_CONF_IP_FORWARD                  1
00275 #define UIP_CONF_BUFFER_SIZE               108
00276 #define RIME_CONF_NO_POLITE_ANNOUCEMENTS     0
00277 #define QUEUEBUF_CONF_NUM                    8
00278 #endif /* UIP_CONF_IPV6 */
00279 
00280 #endif /* __CONTIKI_CONF_H__ */