Contiki-NG
contiki-conf.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015, Zolertia - http://www.zolertia.com
3  * All rights reserved.
4  *
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  *
14  * 3. Neither the name of the copyright holder nor the names of its
15  * contributors may be used to endorse or promote products derived
16  * from this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29  * OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31 /**
32  * \addtogroup zoul-core
33  * @{
34  *
35  * \defgroup zoul-platforms Zolertia Zoul platforms
36  *
37  * The Zoul allows a fast reuse and easy integration to most applications and
38  * products. Its small size and module format eases to place in different PCB
39  * designs and to integrate in existing products. The Zoul-based platforms
40  * share most of the Zoul core implementation.
41  *
42  * \file
43  * Configuration for the Zoul-based platforms
44  */
45 #ifndef CONTIKI_CONF_H_
46 #define CONTIKI_CONF_H_
47 
48 #include <stdint.h>
49 #include <string.h>
50 #include <inttypes.h>
51 /*---------------------------------------------------------------------------*/
52 /* Include Project Specific conf */
53 #ifdef PROJECT_CONF_PATH
54 #include PROJECT_CONF_PATH
55 #endif /* PROJECT_CONF_PATH */
56 /*---------------------------------------------------------------------------*/
57 #include "cc2538-def.h"
58 
59 unsigned radio_phy_overhead(void);
60 unsigned radio_byte_air_time(void);
61 unsigned radio_delay_before_tx(void);
62 unsigned radio_delay_before_rx(void);
63 unsigned radio_delay_before_detect(void);
64 uint16_t *radio_tsch_timeslot_timing(void);
65 
66 /** @} */
67 /*---------------------------------------------------------------------------*/
68 
69 #define RADIO_PHY_OVERHEAD radio_phy_overhead()
70 #define RADIO_BYTE_AIR_TIME radio_byte_air_time()
71 #define RADIO_DELAY_BEFORE_TX radio_delay_before_tx()
72 #define RADIO_DELAY_BEFORE_RX radio_delay_before_rx()
73 #define RADIO_DELAY_BEFORE_DETECT radio_delay_before_detect()
74 
75 #define TSCH_CONF_DEFAULT_TIMESLOT_TIMING radio_tsch_timeslot_timing()
76 
77 /*---------------------------------------------------------------------------*/
78 /**
79  * \name Serial Boot Loader Backdoor configuration
80  *
81  * @{
82  */
83 #ifndef FLASH_CCA_CONF_BOOTLDR_BACKDOOR
84 #define FLASH_CCA_CONF_BOOTLDR_BACKDOOR 1 /**<Enable the boot loader backdoor */
85 #endif
86 
87 #ifndef FLASH_CCA_CONF_BOOTLDR_BACKDOOR_PORT_A_PIN
88 #define FLASH_CCA_CONF_BOOTLDR_BACKDOOR_PORT_A_PIN 3 /**< Pin PA_3 (user button), activates the boot loader */
89 #endif
90 
91 #ifndef FLASH_CCA_CONF_BOOTLDR_BACKDOOR_ACTIVE_HIGH
92 #define FLASH_CCA_CONF_BOOTLDR_BACKDOOR_ACTIVE_HIGH 0 /**< A logic low level activates the boot loader */
93 #endif
94 /** @} */
95 /*---------------------------------------------------------------------------*/
96 /**
97  * \name CC2538 System Control configuration
98  *
99  * @{
100  */
101 #ifndef SYS_CTRL_CONF_OSC32K_USE_XTAL
102 #define SYS_CTRL_CONF_OSC32K_USE_XTAL 1 /**< Use the on-board 32.768-kHz crystal */
103 #endif
104 /** @} */
105 /*---------------------------------------------------------------------------*/
106 /* board.h assumes that basic configuration is done */
107 #include "board.h"
108 
109 #define PLATFORM_SUPPORTS_BUTTON_HAL PLATFORM_HAS_BUTTON
110 /*---------------------------------------------------------------------------*/
111 /**
112  * \name Radio Configuration
113  *
114  * @{
115  */
116 #ifndef ZOUL_CONF_USE_CC1200_RADIO
117 #define ZOUL_CONF_USE_CC1200_RADIO 0
118 #endif
119 
120 #if ZOUL_CONF_USE_CC1200_RADIO
121 #define NETSTACK_CONF_RADIO cc1200_driver
122 #define ANTENNA_SW_SELECT_DEF_CONF ANTENNA_SW_SELECT_SUBGHZ
123 #define CC1200_CONF_USE_GPIO2 0
124 #define CC1200_CONF_USE_RX_WATCHDOG 0
125 
126 #define CSMA_CONF_ACK_WAIT_TIME (RTIMER_SECOND / 200)
127 #define CSMA_CONF_AFTER_ACK_DETECTED_WAIT_TIME (RTIMER_SECOND / 1500)
128 
129 #ifndef CC1200_CONF_RF_CFG
130 #define CC1200_CONF_RF_CFG cc1200_802154g_863_870_fsk_50kbps
131 #endif
132 #endif
133 
134 /* This can be overriden to use the cc1200_driver instead */
135 #ifndef NETSTACK_CONF_RADIO
136 #define NETSTACK_CONF_RADIO cc2538_rf_driver
137 #endif
138 
139 /*
140  * RE-Mote specific:
141  * If dual RF enabled, we set the RF switch to enable the CC1200 and use 2.4GHz
142  * on the available uFl/chip antenna (not mounted as default). In contiki main
143  * platform routine we set the right antenna depending on NETSTACK_CONF_RADIO,
144  * but as changing the RF antenna also implies enabling/disabling the CC1200,
145  * is better to start off with the right configuration
146  */
147 #if REMOTE_DUAL_RF_ENABLED
148 #define ANTENNA_SW_SELECT_DEFAULT ANTENNA_SW_SELECT_SUBGHZ
149 #else /* REMOTE_DUAL_RF_ENABLED */
150 #ifndef ANTENNA_SW_SELECT_DEF_CONF
151 #define ANTENNA_SW_SELECT_DEFAULT ANTENNA_SW_SELECT_2_4GHZ
152 #else /* ANTENNA_SW_SELECT_DEF_CONF */
153 #define ANTENNA_SW_SELECT_DEFAULT ANTENNA_SW_SELECT_DEF_CONF
154 #endif /* ANTENNA_SW_SELECT_DEF_CONF */
155 #endif /* REMOTE_DUAL_RF_ENABLED */
156 
157 /** @} */
158 /*---------------------------------------------------------------------------*/
159 /**
160  * \name LPM configuration
161  * @{
162  */
163 #ifndef LPM_CONF_ENABLE
164 #define LPM_CONF_ENABLE 1 /**< Set to 0 to disable LPM entirely */
165 #endif
166 
167 /**
168  * \brief Maximum PM
169  *
170  * The SoC will never drop to a Power Mode deeper than the one specified here.
171  * 0 for PM0, 1 for PM1 and 2 for PM2
172  */
173 #ifndef LPM_CONF_MAX_PM
174 #define LPM_CONF_MAX_PM 2
175 #endif
176 
177 #ifndef LPM_CONF_STATS
178 #define LPM_CONF_STATS 0 /**< Set to 1 to enable LPM-related stats */
179 #endif
180 /** @} */
181 /*---------------------------------------------------------------------------*/
182 /**
183  * \name RTC
184  *
185  * @{
186  */
187 #ifdef PLATFORM_HAS_RTC
188 
189 #ifndef RTC_CONF_INIT
190 #define RTC_CONF_INIT 0 /**< Whether to initialize the RTC */
191 #endif
192 
193 #ifndef RTC_CONF_SET_FROM_SYS
194 #define RTC_CONF_SET_FROM_SYS 0 /**< Whether to set the RTC from the build system */
195 #endif
196 
197 #else
198 #undef RTC_CONF_INIT
199 #define RTC_CONF_INIT 0
200 #endif
201 /** @} */
202 /*---------------------------------------------------------------------------*/
203 /* Include CPU-related configuration */
204 #include "cc2538-conf.h"
205 /*---------------------------------------------------------------------------*/
206 #endif /* CONTIKI_CONF_H_ */
207 /*---------------------------------------------------------------------------*/
208 /** @} */