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 /* Configure CSMA for when it's selected */
117 
118 #if CC1200_CONF_SUBGHZ_50KBPS_MODE
119 #define NETSTACK_CONF_RADIO cc1200_driver
120 #define CC1200_CONF_RF_CFG cc1200_802154g_863_870_fsk_50kbps
121 #define ANTENNA_SW_SELECT_DEF_CONF ANTENNA_SW_SELECT_SUBGHZ
122 #define CC1200_CONF_USE_GPIO2 0
123 #define CC1200_CONF_USE_RX_WATCHDOG 0
124 
125 #define CSMA_CONF_ACK_WAIT_TIME (RTIMER_SECOND / 200)
126 #define CSMA_CONF_AFTER_ACK_DETECTED_WAIT_TIME (RTIMER_SECOND / 1500)
127 
128 #endif
129 
130 /* This can be overriden to use the cc1200_driver instead */
131 #ifndef NETSTACK_CONF_RADIO
132 #define NETSTACK_CONF_RADIO cc2538_rf_driver
133 #endif
134 
135 /*
136  * RE-Mote specific:
137  * If dual RF enabled, we set the RF switch to enable the CC1200 and use 2.4GHz
138  * on the available uFl/chip antenna (not mounted as default). In contiki main
139  * platform routine we set the right antenna depending on NETSTACK_CONF_RADIO,
140  * but as changing the RF antenna also implies enabling/disabling the CC1200,
141  * is better to start off with the right configuration
142  */
143 #if REMOTE_DUAL_RF_ENABLED
144 #define ANTENNA_SW_SELECT_DEFAULT ANTENNA_SW_SELECT_SUBGHZ
145 #else /* REMOTE_DUAL_RF_ENABLED */
146 #ifndef ANTENNA_SW_SELECT_DEF_CONF
147 #define ANTENNA_SW_SELECT_DEFAULT ANTENNA_SW_SELECT_2_4GHZ
148 #else /* ANTENNA_SW_SELECT_DEF_CONF */
149 #define ANTENNA_SW_SELECT_DEFAULT ANTENNA_SW_SELECT_DEF_CONF
150 #endif /* ANTENNA_SW_SELECT_DEF_CONF */
151 #endif /* REMOTE_DUAL_RF_ENABLED */
152 
153 /** @} */
154 /*---------------------------------------------------------------------------*/
155 /**
156  * \name LPM configuration
157  * @{
158  */
159 #ifndef LPM_CONF_ENABLE
160 #define LPM_CONF_ENABLE 1 /**< Set to 0 to disable LPM entirely */
161 #endif
162 
163 /**
164  * \brief Maximum PM
165  *
166  * The SoC will never drop to a Power Mode deeper than the one specified here.
167  * 0 for PM0, 1 for PM1 and 2 for PM2
168  */
169 #ifndef LPM_CONF_MAX_PM
170 #define LPM_CONF_MAX_PM 2
171 #endif
172 
173 #ifndef LPM_CONF_STATS
174 #define LPM_CONF_STATS 0 /**< Set to 1 to enable LPM-related stats */
175 #endif
176 /** @} */
177 /*---------------------------------------------------------------------------*/
178 /**
179  * \name RTC
180  *
181  * @{
182  */
183 #ifdef PLATFORM_HAS_RTC
184 
185 #ifndef RTC_CONF_INIT
186 #define RTC_CONF_INIT 0 /**< Whether to initialize the RTC */
187 #endif
188 
189 #ifndef RTC_CONF_SET_FROM_SYS
190 #define RTC_CONF_SET_FROM_SYS 0 /**< Whether to set the RTC from the build system */
191 #endif
192 
193 #else
194 #undef RTC_CONF_INIT
195 #define RTC_CONF_INIT 0
196 #endif
197 /** @} */
198 /*---------------------------------------------------------------------------*/
199 /* Include CPU-related configuration */
200 #include "cc2538-conf.h"
201 /*---------------------------------------------------------------------------*/
202 #endif /* CONTIKI_CONF_H_ */
203 /*---------------------------------------------------------------------------*/
204 /** @} */