Contiki-NG
CC26X2R1_LAUNCHXL.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2018, Texas Instruments Incorporated
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  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 /** ============================================================================
33  * @file CC26X2R1_LAUNCHXL.h
34  *
35  * @brief CC26X2R1_LAUNCHXL Board Specific header file.
36  *
37  * The CC26X2R1_LAUNCHXL header file should be included in an application as
38  * follows:
39  * @code
40  * #include "CC26X2R1_LAUNCHXL.h"
41  * @endcode
42  *
43  * ============================================================================
44  */
45 #ifndef __CC26X2R1_LAUNCHXL_BOARD_H__
46 #define __CC26X2R1_LAUNCHXL_BOARD_H__
47 
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
52 #include "contiki-conf.h"
53 
54 /* Includes */
55 #include <ti/drivers/PIN.h>
56 #include <ti/devices/DeviceFamily.h>
57 #include DeviceFamily_constructPath(driverlib/ioc.h)
58 
59 /* Externs */
60 extern const PIN_Config BoardGpioInitTable[];
61 
62 /* Defines */
63 #define CC26X2R1_LAUNCHXL
64 /* Mapping of pins to board signals using general board aliases
65  * <board signal alias> <pin mapping>
66  */
67 
68 /* Mapping of pins to board signals using general board aliases
69  * <board signal alias> <pin mapping>
70  */
71 
72 /* Analog Capable DIOs */
73 #define CC26X2R1_LAUNCHXL_DIO23_ANALOG IOID_23
74 #define CC26X2R1_LAUNCHXL_DIO24_ANALOG IOID_24
75 #define CC26X2R1_LAUNCHXL_DIO25_ANALOG IOID_25
76 #define CC26X2R1_LAUNCHXL_DIO26_ANALOG IOID_26
77 #define CC26X2R1_LAUNCHXL_DIO27_ANALOG IOID_27
78 #define CC26X2R1_LAUNCHXL_DIO28_ANALOG IOID_28
79 #define CC26X2R1_LAUNCHXL_DIO29_ANALOG IOID_29
80 #define CC26X2R1_LAUNCHXL_DIO30_ANALOG IOID_30
81 
82 /* Digital IOs */
83 #define CC26X2R1_LAUNCHXL_DIO0 IOID_0
84 #define CC26X2R1_LAUNCHXL_DIO1_RFSW IOID_1
85 #define CC26X2R1_LAUNCHXL_DIO12 IOID_12
86 #define CC26X2R1_LAUNCHXL_DIO15 IOID_15
87 #define CC26X2R1_LAUNCHXL_DIO16_TDO IOID_16
88 #define CC26X2R1_LAUNCHXL_DIO17_TDI IOID_17
89 #define CC26X2R1_LAUNCHXL_DIO21 IOID_21
90 #define CC26X2R1_LAUNCHXL_DIO22 IOID_22
91 
92 /* Discrete Inputs */
93 #define CC26X2R1_LAUNCHXL_PIN_BTN1 IOID_13
94 #define CC26X2R1_LAUNCHXL_PIN_BTN2 IOID_14
95 
96 /* GPIO */
97 #define CC26X2R1_LAUNCHXL_GPIO_LED_ON 1
98 #define CC26X2R1_LAUNCHXL_GPIO_LED_OFF 0
99 
100 /* I2C */
101 #define CC26X2R1_LAUNCHXL_I2C0_SCL0 IOID_4
102 #define CC26X2R1_LAUNCHXL_I2C0_SDA0 IOID_5
103 
104 /* LEDs */
105 #define CC26X2R1_LAUNCHXL_PIN_LED_ON 1
106 #define CC26X2R1_LAUNCHXL_PIN_LED_OFF 0
107 #define CC26X2R1_LAUNCHXL_PIN_RLED IOID_6
108 #define CC26X2R1_LAUNCHXL_PIN_GLED IOID_7
109 
110 /* PWM Outputs */
111 #define CC26X2R1_LAUNCHXL_PWMPIN0 CC26X2R1_LAUNCHXL_PIN_RLED
112 #define CC26X2R1_LAUNCHXL_PWMPIN1 CC26X2R1_LAUNCHXL_PIN_GLED
113 #define CC26X2R1_LAUNCHXL_PWMPIN2 PIN_UNASSIGNED
114 #define CC26X2R1_LAUNCHXL_PWMPIN3 PIN_UNASSIGNED
115 #define CC26X2R1_LAUNCHXL_PWMPIN4 PIN_UNASSIGNED
116 #define CC26X2R1_LAUNCHXL_PWMPIN5 PIN_UNASSIGNED
117 #define CC26X2R1_LAUNCHXL_PWMPIN6 PIN_UNASSIGNED
118 #define CC26X2R1_LAUNCHXL_PWMPIN7 PIN_UNASSIGNED
119 
120 /* SPI */
121 #define CC26X2R1_LAUNCHXL_SPI_FLASH_CS IOID_20
122 #define CC26X2R1_LAUNCHXL_FLASH_CS_ON 0
123 #define CC26X2R1_LAUNCHXL_FLASH_CS_OFF 1
124 
125 /* SPI Board */
126 #define CC26X2R1_LAUNCHXL_SPI0_MISO IOID_8 /* RF1.20 */
127 #define CC26X2R1_LAUNCHXL_SPI0_MOSI IOID_9 /* RF1.18 */
128 #define CC26X2R1_LAUNCHXL_SPI0_CLK IOID_10 /* RF1.16 */
129 #define CC26X2R1_LAUNCHXL_SPI0_CSN PIN_UNASSIGNED
130 #define CC26X2R1_LAUNCHXL_SPI1_MISO PIN_UNASSIGNED
131 #define CC26X2R1_LAUNCHXL_SPI1_MOSI PIN_UNASSIGNED
132 #define CC26X2R1_LAUNCHXL_SPI1_CLK PIN_UNASSIGNED
133 #define CC26X2R1_LAUNCHXL_SPI1_CSN PIN_UNASSIGNED
134 
135 /* UART Board */
136 #define CC26X2R1_LAUNCHXL_UART0_RX IOID_2 /* RXD */
137 #define CC26X2R1_LAUNCHXL_UART0_TX IOID_3 /* TXD */
138 #define CC26X2R1_LAUNCHXL_UART0_CTS IOID_19 /* CTS */
139 #define CC26X2R1_LAUNCHXL_UART0_RTS IOID_18 /* RTS */
140 #define CC26X2R1_LAUNCHXL_UART1_RX PIN_UNASSIGNED
141 #define CC26X2R1_LAUNCHXL_UART1_TX PIN_UNASSIGNED
142 #define CC26X2R1_LAUNCHXL_UART1_CTS PIN_UNASSIGNED
143 #define CC26X2R1_LAUNCHXL_UART1_RTS PIN_UNASSIGNED
144 /* For backward compatibility */
145 #define CC26X2R1_LAUNCHXL_UART_RX CC26X2R1_LAUNCHXL_UART0_RX
146 #define CC26X2R1_LAUNCHXL_UART_TX CC26X2R1_LAUNCHXL_UART0_TX
147 #define CC26X2R1_LAUNCHXL_UART_CTS CC26X2R1_LAUNCHXL_UART0_CTS
148 #define CC26X2R1_LAUNCHXL_UART_RTS CC26X2R1_LAUNCHXL_UART0_RTS
149 
150 /*!
151  * @brief Initialize the general board specific settings
152  *
153  * This function initializes the general board specific settings.
154  */
156 
157 /*!
158  * @brief Shut down the external flash present on the board files
159  *
160  * This function bitbangs the SPI sequence necessary to turn off
161  * the external flash on LaunchPads.
162  */
164 
165 /*!
166  * @brief Wake up the external flash present on the board files
167  *
168  * This function toggles the chip select for the amount of time needed
169  * to wake the chip up.
170  */
172 
173 
174 /*!
175  * @def CC26X2R1_LAUNCHXL_ADCBufName
176  * @brief Enum of ADCs
177  */
178 typedef enum CC26X2R1_LAUNCHXL_ADCBufName {
179  CC26X2R1_LAUNCHXL_ADCBUF0 = 0,
180 
181  CC26X2R1_LAUNCHXL_ADCBUFCOUNT
182 } CC26X2R1_LAUNCHXL_ADCBufName;
183 
184 /*!
185  * @def CC26X2R1_LAUNCHXL_ADCBuf0ChannelName
186  * @brief Enum of ADCBuf channels
187  */
188 typedef enum CC26X2R1_LAUNCHXL_ADCBuf0ChannelName {
189  CC26X2R1_LAUNCHXL_ADCBUF0CHANNEL0 = 0,
190  CC26X2R1_LAUNCHXL_ADCBUF0CHANNEL1,
191  CC26X2R1_LAUNCHXL_ADCBUF0CHANNEL2,
192  CC26X2R1_LAUNCHXL_ADCBUF0CHANNEL3,
193  CC26X2R1_LAUNCHXL_ADCBUF0CHANNEL4,
194  CC26X2R1_LAUNCHXL_ADCBUF0CHANNEL5,
195  CC26X2R1_LAUNCHXL_ADCBUF0CHANNEL6,
196  CC26X2R1_LAUNCHXL_ADCBUF0CHANNEL7,
197  CC26X2R1_LAUNCHXL_ADCBUF0CHANNELVDDS,
198  CC26X2R1_LAUNCHXL_ADCBUF0CHANNELDCOUPL,
199  CC26X2R1_LAUNCHXL_ADCBUF0CHANNELVSS,
200 
201  CC26X2R1_LAUNCHXL_ADCBUF0CHANNELCOUNT
202 } CC26X2R1_LAUNCHXL_ADCBuf0ChannelName;
203 
204 /*!
205  * @def CC26X2R1_LAUNCHXL_ADCName
206  * @brief Enum of ADCs
207  */
208 typedef enum CC26X2R1_LAUNCHXL_ADCName {
209  CC26X2R1_LAUNCHXL_ADC0 = 0,
210  CC26X2R1_LAUNCHXL_ADC1,
211  CC26X2R1_LAUNCHXL_ADC2,
212  CC26X2R1_LAUNCHXL_ADC3,
213  CC26X2R1_LAUNCHXL_ADC4,
214  CC26X2R1_LAUNCHXL_ADC5,
215  CC26X2R1_LAUNCHXL_ADC6,
216  CC26X2R1_LAUNCHXL_ADC7,
217  CC26X2R1_LAUNCHXL_ADCDCOUPL,
218  CC26X2R1_LAUNCHXL_ADCVSS,
219  CC26X2R1_LAUNCHXL_ADCVDDS,
220 
221  CC26X2R1_LAUNCHXL_ADCCOUNT
222 } CC26X2R1_LAUNCHXL_ADCName;
223 
224 /*!
225  * @def CC26X2R1_LAUNCHXL_ECDHName
226  * @brief Enum of ECDH names
227  */
228 typedef enum CC26X2R1_LAUNCHXL_ECDHName {
229  CC26X2R1_LAUNCHXL_ECDH0 = 0,
230 
231  CC26X2R1_LAUNCHXL_ECDHCOUNT
232 } CC26X2R1_LAUNCHXL_ECDHName;
233 
234 /*!
235  * @def CC26X2R1_LAUNCHXL_ECDSAName
236  * @brief Enum of ECDSA names
237  */
238 typedef enum CC26X2R1_LAUNCHXL_ECDSAName {
239  CC26X2R1_LAUNCHXL_ECDSA0 = 0,
240 
241  CC26X2R1_LAUNCHXL_ECDSACOUNT
242 } CC26X2R1_LAUNCHXL_ECDSAName;
243 
244 /*!
245  * @def CC26X2R1_LAUNCHXL_ECJPAKEName
246  * @brief Enum of ECJPAKE names
247  */
248 typedef enum CC26X2R1_LAUNCHXL_ECJPAKEName {
249  CC26X2R1_LAUNCHXL_ECJPAKE0 = 0,
250 
251  CC26X2R1_LAUNCHXL_ECJPAKECOUNT
252 } CC26X2R1_LAUNCHXL_ECJPAKEName;
253 
254 /*!
255  * @def CC26X2R1_LAUNCHXL_AESCCMName
256  * @brief Enum of AESCCM names
257  */
258 typedef enum CC26X2R1_LAUNCHXL_AESCCMName {
259  CC26X2R1_LAUNCHXL_AESCCM0 = 0,
260 
261  CC26X2R1_LAUNCHXL_AESCCMCOUNT
262 } CC26X2R1_LAUNCHXL_AESCCMName;
263 
264 /*!
265  * @def CC26X2R1_LAUNCHXL_AESECBName
266  * @brief Enum of AESECB names
267  */
268 typedef enum CC26X2R1_LAUNCHXL_AESECBName {
269  CC26X2R1_LAUNCHXL_AESECB0 = 0,
270 
271  CC26X2R1_LAUNCHXL_AESECBCOUNT
272 } CC26X2R1_LAUNCHXL_AESECBName;
273 
274 /*!
275  * @def CC26X2R1_LAUNCHXL_SHA2Name
276  * @brief Enum of SHA2 names
277  */
278 typedef enum CC26X2R1_LAUNCHXL_SHA2Name {
279  CC26X2R1_LAUNCHXL_SHA20 = 0,
280 
281  CC26X2R1_LAUNCHXL_SHA2COUNT
282 } CC26X2R1_LAUNCHXL_SHA2Name;
283 
284 /*!
285  * @def CC26X2R1_LAUNCHXL_GPIOName
286  * @brief Enum of GPIO names
287  */
288 typedef enum CC26X2R1_LAUNCHXL_GPIOName {
289  CC26X2R1_LAUNCHXL_GPIO_S1 = 0,
290  CC26X2R1_LAUNCHXL_GPIO_S2,
291  CC26X2R1_LAUNCHXL_SPI_MASTER_READY,
292  CC26X2R1_LAUNCHXL_SPI_SLAVE_READY,
293  CC26X2R1_LAUNCHXL_GPIO_LED_GREEN,
294  CC26X2R1_LAUNCHXL_GPIO_LED_RED,
295  CC26X2R1_LAUNCHXL_GPIO_SPI_FLASH_CS,
296  CC26X2R1_LAUNCHXL_SDSPI_CS,
297  CC26X2R1_LAUNCHXL_GPIOCOUNT
298 } CC26X2R1_LAUNCHXL_GPIOName;
299 
300 /*!
301  * @def CC26X2R1_LAUNCHXL_GPTimerName
302  * @brief Enum of GPTimer parts
303  */
304 typedef enum CC26X2R1_LAUNCHXL_GPTimerName {
305  CC26X2R1_LAUNCHXL_GPTIMER0A = 0,
306  CC26X2R1_LAUNCHXL_GPTIMER0B,
307  CC26X2R1_LAUNCHXL_GPTIMER1A,
308  CC26X2R1_LAUNCHXL_GPTIMER1B,
309  CC26X2R1_LAUNCHXL_GPTIMER2A,
310  CC26X2R1_LAUNCHXL_GPTIMER2B,
311  CC26X2R1_LAUNCHXL_GPTIMER3A,
312  CC26X2R1_LAUNCHXL_GPTIMER3B,
313 
314  CC26X2R1_LAUNCHXL_GPTIMERPARTSCOUNT
315 } CC26X2R1_LAUNCHXL_GPTimerName;
316 
317 /*!
318  * @def CC26X2R1_LAUNCHXL_GPTimers
319  * @brief Enum of GPTimers
320  */
321 typedef enum CC26X2R1_LAUNCHXL_GPTimers {
322  CC26X2R1_LAUNCHXL_GPTIMER0 = 0,
323  CC26X2R1_LAUNCHXL_GPTIMER1,
324  CC26X2R1_LAUNCHXL_GPTIMER2,
325  CC26X2R1_LAUNCHXL_GPTIMER3,
326 
327  CC26X2R1_LAUNCHXL_GPTIMERCOUNT
328 } CC26X2R1_LAUNCHXL_GPTimers;
329 
330 /*!
331  * @def CC26X2R1_LAUNCHXL_I2CName
332  * @brief Enum of I2C names
333  */
334 typedef enum CC26X2R1_LAUNCHXL_I2CName {
335 #if TI_I2C_CONF_I2C0_ENABLE
336  CC26X2R1_LAUNCHXL_I2C0 = 0,
337 #endif
338 
339  CC26X2R1_LAUNCHXL_I2CCOUNT
340 } CC26X2R1_LAUNCHXL_I2CName;
341 
342 /*!
343  * @def CC26X2R1_LAUNCHXL_NVSName
344  * @brief Enum of NVS names
345  */
346 typedef enum CC26X2R1_LAUNCHXL_NVSName {
347 #if TI_NVS_CONF_NVS_INTERNAL_ENABLE
348  CC26X2R1_LAUNCHXL_NVSCC26XX0 = 0,
349 #endif
350 #if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
351  CC26X2R1_LAUNCHXL_NVSSPI25X0,
352 #endif
353 
354  CC26X2R1_LAUNCHXL_NVSCOUNT
355 } CC26X2R1_LAUNCHXL_NVSName;
356 
357 /*!
358  * @def CC26X2R1_LAUNCHXL_PWMName
359  * @brief Enum of PWM outputs
360  */
361 typedef enum CC26X2R1_LAUNCHXL_PWMName {
362  CC26X2R1_LAUNCHXL_PWM0 = 0,
363  CC26X2R1_LAUNCHXL_PWM1,
364  CC26X2R1_LAUNCHXL_PWM2,
365  CC26X2R1_LAUNCHXL_PWM3,
366  CC26X2R1_LAUNCHXL_PWM4,
367  CC26X2R1_LAUNCHXL_PWM5,
368  CC26X2R1_LAUNCHXL_PWM6,
369  CC26X2R1_LAUNCHXL_PWM7,
370 
371  CC26X2R1_LAUNCHXL_PWMCOUNT
372 } CC26X2R1_LAUNCHXL_PWMName;
373 
374 /*!
375  * @def CC26X2R1_LAUNCHXL_SDName
376  * @brief Enum of SD names
377  */
378 typedef enum CC26X2R1_LAUNCHXL_SDName {
379  CC26X2R1_LAUNCHXL_SDSPI0 = 0,
380 
381  CC26X2R1_LAUNCHXL_SDCOUNT
382 } CC26X2R1_LAUNCHXL_SDName;
383 
384 /*!
385  * @def CC26X2R1_LAUNCHXL_SPIName
386  * @brief Enum of SPI names
387  */
388 typedef enum CC26X2R1_LAUNCHXL_SPIName {
389 #if TI_SPI_CONF_SPI0_ENABLE
390  CC26X2R1_LAUNCHXL_SPI0 = 0,
391 #endif
392 #if TI_SPI_CONF_SPI1_ENABLE
393  CC26X2R1_LAUNCHXL_SPI1,
394 #endif
395 
396  CC26X2R1_LAUNCHXL_SPICOUNT
397 } CC26X2R1_LAUNCHXL_SPIName;
398 
399 /*!
400  * @def CC26X2R1_LAUNCHXL_TRNGName
401  * @brief Enum of TRNGs
402  */
403 typedef enum CC26X2R1_LAUNCHXL_TRNGName {
404  CC26X2R1_LAUNCHXL_TRNG0 = 0,
405 
406  CC26X2R1_LAUNCHXL_TRNGCOUNT
407 } CC26X2R1_LAUNCHXL_TRNGName;
408 
409 /*!
410  * @def CC26X2R1_LAUNCHXL_UARTName
411  * @brief Enum of UARTs
412  */
413 typedef enum CC26X2R1_LAUNCHXL_UARTName {
414 #if TI_UART_CONF_UART0_ENABLE
415  CC26X2R1_LAUNCHXL_UART0 = 0,
416 #endif
417 #if TI_UART_CONF_UART1_ENABLE
418  CC26X2R1_LAUNCHXL_UART1,
419 #endif
420 
421  CC26X2R1_LAUNCHXL_UARTCOUNT
422 } CC26X2R1_LAUNCHXL_UARTName;
423 
424 /*!
425  * @def CC26X2R1_LAUNCHXL_UDMAName
426  * @brief Enum of DMA buffers
427  */
428 typedef enum CC26X2R1_LAUNCHXL_UDMAName {
429  CC26X2R1_LAUNCHXL_UDMA0 = 0,
430 
431  CC26X2R1_LAUNCHXL_UDMACOUNT
432 } CC26X2R1_LAUNCHXL_UDMAName;
433 
434 /*!
435  * @def CC26X2R1_LAUNCHXL_WatchdogName
436  * @brief Enum of Watchdogs
437  */
438 typedef enum CC26X2R1_LAUNCHXL_WatchdogName {
439  CC26X2R1_LAUNCHXL_WATCHDOG0 = 0,
440 
441  CC26X2R1_LAUNCHXL_WATCHDOGCOUNT
442 } CC26X2R1_LAUNCHXL_WatchdogName;
443 
444 #ifdef __cplusplus
445 }
446 #endif
447 
448 #endif /* __CC26X2R1_LAUNCHXL_BOARD_H__ */
void CC26X2R1_LAUNCHXL_shutDownExtFlash(void)
Shut down the external flash present on the board files.
void CC26X2R1_LAUNCHXL_wakeUpExtFlash(void)
Wake up the external flash present on the board files.
void CC26X2R1_LAUNCHXL_initGeneral(void)
Initialize the general board specific settings.