Contiki-NG
CC2650STK.c
1 /*
2  * Copyright (c) 2016-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 /*
34  * ====================== CC2650STK.c =========================================
35  * This file is responsible for setting up the board specific items for the
36  * CC2650STK board.
37  */
38 
39 #include <stdbool.h>
40 #include <stddef.h>
41 #include <stdint.h>
42 
43 #include <ti/drivers/Power.h>
44 #include <ti/drivers/power/PowerCC26XX.h>
45 
46 #include <ti/devices/DeviceFamily.h>
47 #include DeviceFamily_constructPath(driverlib/ioc.h)
48 #include DeviceFamily_constructPath(driverlib/udma.h)
49 #include DeviceFamily_constructPath(inc/hw_ints.h)
50 #include DeviceFamily_constructPath(inc/hw_memmap.h)
51 
52 #include "CC2650STK.h"
53 
54 /*
55  * =============================== Crypto ===============================
56  */
57 #include <ti/drivers/crypto/CryptoCC26XX.h>
58 
59 CryptoCC26XX_Object cryptoCC26XXObjects[CC2650STK_CRYPTOCOUNT];
60 
61 const CryptoCC26XX_HWAttrs cryptoCC26XXHWAttrs[CC2650STK_CRYPTOCOUNT] = {
62  {
63  .baseAddr = CRYPTO_BASE,
64  .powerMngrId = PowerCC26XX_PERIPH_CRYPTO,
65  .intNum = INT_CRYPTO_RESULT_AVAIL_IRQ,
66  .intPriority = ~0,
67  }
68 };
69 
70 const CryptoCC26XX_Config CryptoCC26XX_config[CC2650STK_CRYPTOCOUNT] = {
71  {
72  .object = &cryptoCC26XXObjects[CC2650STK_CRYPTO0],
73  .hwAttrs = &cryptoCC26XXHWAttrs[CC2650STK_CRYPTO0]
74  }
75 };
76 
77 /*
78  * =============================== GPIO ===============================
79  */
80 #include <ti/drivers/GPIO.h>
81 #include <ti/drivers/gpio/GPIOCC26XX.h>
82 
83 /*
84  * Array of Pin configurations
85  * NOTE: The order of the pin configurations must coincide with what was
86  * defined in CC2650STK.h
87  * NOTE: Pins not used for interrupts should be placed at the end of the
88  * array. Callback entries can be omitted from callbacks array to
89  * reduce memory usage.
90  */
91 GPIO_PinConfig gpioPinConfigs[] = {
92  /* Input pins */
93  GPIOCC26XX_DIO_15 | GPIO_DO_NOT_CONFIG, /* Button 0 */
94  GPIOCC26XX_DIO_04 | GPIO_DO_NOT_CONFIG, /* Button 1 */
95 
96  /* Output pins */
97  GPIOCC26XX_DIO_10 | GPIO_DO_NOT_CONFIG, /* LED */
98 
99  /* SPI Flash CSN */
100  GPIOCC26XX_DIO_14 | GPIO_DO_NOT_CONFIG,
101 };
102 
103 /*
104  * Array of callback function pointers
105  * NOTE: The order of the pin configurations must coincide with what was
106  * defined in CC2650STK.h
107  * NOTE: Pins not used for interrupts can be omitted from callbacks array to
108  * reduce memory usage (if placed at end of gpioPinConfigs array).
109  */
110 GPIO_CallbackFxn gpioCallbackFunctions[] = {
111  NULL, /* Button 0 */
112  NULL, /* Button 1 */
113 };
114 
115 const GPIOCC26XX_Config GPIOCC26XX_config = {
116  .pinConfigs = (GPIO_PinConfig *)gpioPinConfigs,
117  .callbacks = (GPIO_CallbackFxn *)gpioCallbackFunctions,
118  .numberOfPinConfigs = CC2650STK_GPIOCOUNT,
119  .numberOfCallbacks = sizeof(gpioCallbackFunctions)/sizeof(GPIO_CallbackFxn),
120  .intPriority = (~0)
121 };
122 
123 /*
124  * =============================== GPTimer ===============================
125  * Remove unused entries to reduce flash usage both in Board.c and Board.h
126  */
127 #include <ti/drivers/timer/GPTimerCC26XX.h>
128 
129 GPTimerCC26XX_Object gptimerCC26XXObjects[CC2650STK_GPTIMERCOUNT];
130 
131 const GPTimerCC26XX_HWAttrs gptimerCC26xxHWAttrs[CC2650STK_GPTIMERPARTSCOUNT] = {
132  { .baseAddr = GPT0_BASE, .intNum = INT_GPT0A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0A, },
133  { .baseAddr = GPT0_BASE, .intNum = INT_GPT0B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0B, },
134  { .baseAddr = GPT1_BASE, .intNum = INT_GPT1A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1A, },
135  { .baseAddr = GPT1_BASE, .intNum = INT_GPT1B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1B, },
136  { .baseAddr = GPT2_BASE, .intNum = INT_GPT2A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2A, },
137  { .baseAddr = GPT2_BASE, .intNum = INT_GPT2B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2B, },
138  { .baseAddr = GPT3_BASE, .intNum = INT_GPT3A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3A, },
139  { .baseAddr = GPT3_BASE, .intNum = INT_GPT3B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3B, },
140 };
141 
142 const GPTimerCC26XX_Config GPTimerCC26XX_config[CC2650STK_GPTIMERPARTSCOUNT] = {
143  { &gptimerCC26XXObjects[CC2650STK_GPTIMER0], &gptimerCC26xxHWAttrs[CC2650STK_GPTIMER0A], GPT_A },
144  { &gptimerCC26XXObjects[CC2650STK_GPTIMER0], &gptimerCC26xxHWAttrs[CC2650STK_GPTIMER0B], GPT_B },
145  { &gptimerCC26XXObjects[CC2650STK_GPTIMER1], &gptimerCC26xxHWAttrs[CC2650STK_GPTIMER1A], GPT_A },
146  { &gptimerCC26XXObjects[CC2650STK_GPTIMER1], &gptimerCC26xxHWAttrs[CC2650STK_GPTIMER1B], GPT_B },
147  { &gptimerCC26XXObjects[CC2650STK_GPTIMER2], &gptimerCC26xxHWAttrs[CC2650STK_GPTIMER2A], GPT_A },
148  { &gptimerCC26XXObjects[CC2650STK_GPTIMER2], &gptimerCC26xxHWAttrs[CC2650STK_GPTIMER2B], GPT_B },
149  { &gptimerCC26XXObjects[CC2650STK_GPTIMER3], &gptimerCC26xxHWAttrs[CC2650STK_GPTIMER3A], GPT_A },
150  { &gptimerCC26XXObjects[CC2650STK_GPTIMER3], &gptimerCC26xxHWAttrs[CC2650STK_GPTIMER3B], GPT_B },
151 };
152 
153 /*
154  * =============================== I2C ===============================
155 */
156 #include <ti/drivers/I2C.h>
157 #include <ti/drivers/i2c/I2CCC26XX.h>
158 
159 #if TI_I2C_CONF_ENABLE
160 
161 I2CCC26XX_Object i2cCC26xxObjects[CC2650STK_I2CCOUNT];
162 
163 const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC2650STK_I2CCOUNT] = {
164 #if TI_I2C_CONF_I2C0_ENABLE
165  {
166  .baseAddr = I2C0_BASE,
167  .powerMngrId = PowerCC26XX_PERIPH_I2C0,
168  .intNum = INT_I2C_IRQ,
169  .intPriority = ~0,
170  .swiPriority = 0,
171  .sdaPin = CC2650STK_I2C0_SDA0,
172  .sclPin = CC2650STK_I2C0_SCL0,
173  },
174 #endif
175 };
176 
177 const I2C_Config I2C_config[CC2650STK_I2CCOUNT] = {
178 #if TI_I2C_CONF_I2C0_ENABLE
179  {
180  .fxnTablePtr = &I2CCC26XX_fxnTable,
181  .object = &i2cCC26xxObjects[CC2650STK_I2C0],
182  .hwAttrs = &i2cCC26xxHWAttrs[CC2650STK_I2C0]
183  },
184 #endif
185 };
186 
187 const uint_least8_t I2C_count = CC2650STK_I2CCOUNT;
188 
189 #endif /* TI_I2C_CONF_ENABLE */
190 
191 /*
192  * =============================== NVS ===============================
193  */
194 #include <ti/drivers/NVS.h>
195 #include <ti/drivers/nvs/NVSSPI25X.h>
196 #include <ti/drivers/nvs/NVSCC26XX.h>
197 
198 #define NVS_REGIONS_BASE 0x1A000
199 #define SECTORSIZE 0x1000
200 #define REGIONSIZE (SECTORSIZE * 4)
201 
202 #if TI_NVS_CONF_ENABLE
203 
204 #if TI_NVS_CONF_NVS_INTERNAL_ENABLE
205 
206 /*
207  * Reserve flash sectors for NVS driver use by placing an uninitialized byte
208  * array at the desired flash address.
209  */
210 #if defined(__TI_COMPILER_VERSION__)
211 
212 /*
213  * Place uninitialized array at NVS_REGIONS_BASE
214  */
215 #pragma LOCATION(flashBuf, NVS_REGIONS_BASE);
216 #pragma NOINIT(flashBuf);
217 static char flashBuf[REGIONSIZE];
218 
219 #elif defined(__IAR_SYSTEMS_ICC__)
220 
221 /*
222  * Place uninitialized array at NVS_REGIONS_BASE
223  */
224 static __no_init char flashBuf[REGIONSIZE] @ NVS_REGIONS_BASE;
225 
226 #elif defined(__GNUC__)
227 
228 /*
229  * Place the flash buffers in the .nvs section created in the gcc linker file.
230  * The .nvs section enforces alignment on a sector boundary but may
231  * be placed anywhere in flash memory. If desired the .nvs section can be set
232  * to a fixed address by changing the following in the gcc linker file:
233  *
234  * .nvs (FIXED_FLASH_ADDR) (NOLOAD) : AT (FIXED_FLASH_ADDR) {
235  * *(.nvs)
236  * } > REGION_TEXT
237  */
238 __attribute__ ((section (".nvs")))
239 static char flashBuf[REGIONSIZE];
240 
241 #endif
242 
243 NVSCC26XX_Object nvsCC26xxObjects[1];
244 
245 /* Hardware attributes for NVS */
246 const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = {
247  {
248  .regionBase = (void *)flashBuf,
249  .regionSize = REGIONSIZE,
250  },
251 };
252 
253 #endif /* TI_NVS_CONF_NVS_INTERNAL_ENABLE */
254 
255 #if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
256 
257 #define SPISECTORSIZE 0x1000
258 #define SPIREGIONSIZE (SPISECTORSIZE * 32)
259 #define VERIFYBUFSIZE 64
260 
261 static uint8_t verifyBuf[VERIFYBUFSIZE];
262 
263 /* Allocate objects for NVS and NVS SPI */
264 NVSSPI25X_Object nvsSPI25XObjects[1];
265 
266 /* Hardware attributes for NVS SPI */
267 const NVSSPI25X_HWAttrs nvsSPI25XHWAttrs[1] = {
268  {
269  .regionBaseOffset = 0,
270  .regionSize = SPIREGIONSIZE,
271  .sectorSize = SPISECTORSIZE,
272  .verifyBuf = verifyBuf,
273  .verifyBufSize = VERIFYBUFSIZE,
274  .spiHandle = NULL,
275  .spiIndex = 0,
276  .spiBitRate = 4000000,
277  .spiCsnGpioIndex = CC2650STK_GPIO_SPI_FLASH_CS,
278  },
279 };
280 
281 #endif /* Board_EXCLUDE_NVS_EXTERNAL_FLASH */
282 
283 /* NVS Region index 0 and 1 refer to NVS and NVS SPI respectively */
284 const NVS_Config NVS_config[CC2650STK_NVSCOUNT] = {
285 #if TI_NVS_CONF_NVS_INTERNAL_ENABLE
286  {
287  .fxnTablePtr = &NVSCC26XX_fxnTable,
288  .object = &nvsCC26xxObjects[0],
289  .hwAttrs = &nvsCC26xxHWAttrs[0],
290  },
291 #endif
292 #if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
293  {
294  .fxnTablePtr = &NVSSPI25X_fxnTable,
295  .object = &nvsSPI25XObjects[0],
296  .hwAttrs = &nvsSPI25XHWAttrs[0],
297  },
298 #endif
299 };
300 
301 const uint_least8_t NVS_count = CC2650STK_NVSCOUNT;
302 
303 #endif /* TI_NVS_CONF_ENABLE */
304 
305 /*
306  * =============================== PDM ===============================
307 */
308 #include <ti/drivers/pdm/PDMCC26XX.h>
309 #include <ti/drivers/pdm/PDMCC26XX_util.h>
310 
311 PDMCC26XX_Object pdmCC26XXObjects[CC2650STK_PDMCOUNT];
312 PDMCC26XX_I2S_Object pdmCC26XXI2SObjects[CC2650STK_PDMCOUNT];
313 
314 const PDMCC26XX_HWAttrs pdmCC26XXHWAttrs[CC2650STK_PDMCOUNT] = {
315  {
316  .micPower = CC2650STK_MIC_POWER,
317  .taskPriority = 2
318  }
319 };
320 
321 const PDMCC26XX_Config PDMCC26XX_config[CC2650STK_PDMCOUNT] = {
322  {
323  .object = &pdmCC26XXObjects[CC2650STK_PDM0],
324  .hwAttrs = &pdmCC26XXHWAttrs[CC2650STK_PDM0]
325  }
326 };
327 
328 const PDMCC26XX_I2S_HWAttrs pdmC26XXI2SHWAttrs[CC2650STK_PDMCOUNT] = {
329  {
330  .baseAddr = I2S0_BASE,
331  .intNum = INT_I2S_IRQ,
332  .powerMngrId = PowerCC26XX_PERIPH_I2S,
333  .intPriority = ~0,
334  .mclkPin = PIN_UNASSIGNED,
335  .bclkPin = CC2650STK_AUDIO_CLK,
336  .wclkPin = PIN_UNASSIGNED,
337  .ad0Pin = CC2650STK_AUDIO_DI,
338  }
339 };
340 
341 const PDMCC26XX_I2S_Config PDMCC26XX_I2S_config[CC2650STK_PDMCOUNT] = {
342  {
343  .object = &pdmCC26XXI2SObjects[CC2650STK_PDM0],
344  .hwAttrs = &pdmC26XXI2SHWAttrs[CC2650STK_PDM0]
345  }
346 };
347 
348 /*
349  * =============================== PIN ===============================
350  */
351 #include <ti/drivers/PIN.h>
352 #include <ti/drivers/pin/PINCC26XX.h>
353 
354 const PIN_Config BoardGpioInitTable[] = {
355 
356  CC2650STK_PIN_LED1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
357  CC2650STK_KEY_LEFT | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
358  CC2650STK_KEY_RIGHT | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
359  CC2650STK_RELAY | PIN_INPUT_EN | PIN_PULLDOWN | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Relay is active high */
360  CC2650STK_MPU_INT | PIN_INPUT_EN | PIN_PULLDOWN | PIN_IRQ_NEGEDGE | PIN_HYSTERESIS, /* MPU_INT is active low */
361  CC2650STK_TMP_RDY | PIN_INPUT_EN | PIN_PULLUP | PIN_HYSTERESIS, /* TMP_RDY is active high */
362  CC2650STK_BUZZER | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* Buzzer initially off */
363  CC2650STK_MPU_POWER | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* MPU initially on */
364  CC2650STK_MIC_POWER | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* MIC initially off */
365  CC2650STK_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */
366  CC2650STK_SPI_DEVPK_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* DevPack chip select */
367  CC2650STK_AUDIO_DI | PIN_INPUT_EN | PIN_PULLDOWN, /* Audio DI */
368  CC2650STK_AUDIODO | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* Audio data out */
369  CC2650STK_AUDIO_CLK | PIN_INPUT_EN | PIN_PULLDOWN, /* DevPack */
370  CC2650STK_DP2 | PIN_INPUT_EN | PIN_PULLDOWN, /* DevPack */
371  CC2650STK_DP1 | PIN_INPUT_EN | PIN_PULLDOWN, /* DevPack */
372  CC2650STK_DP0 | PIN_INPUT_EN | PIN_PULLDOWN, /* DevPack */
373  CC2650STK_DP3 | PIN_INPUT_EN | PIN_PULLDOWN, /* DevPack */
374  CC2650STK_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* DevPack */
375  CC2650STK_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN, /* DevPack */
376  CC2650STK_DEVPK_ID | PIN_INPUT_EN | PIN_NOPULL, /* Device pack ID - external PU */
377  CC2650STK_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */
378  CC2650STK_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */
379  CC2650STK_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI clock */
380 
381  PIN_TERMINATE
382 };
383 
384 const PINCC26XX_HWAttrs PINCC26XX_hwAttrs = {
385  .intPriority = ~0,
386  .swiPriority = 0
387 };
388 
389 /*
390  * =============================== Power ===============================
391  */
392 const PowerCC26XX_Config PowerCC26XX_config = {
393  .policyInitFxn = NULL,
394  .policyFxn = &PowerCC26XX_standbyPolicy,
395  .calibrateFxn = &PowerCC26XX_calibrate,
396  .enablePolicy = true,
397  .calibrateRCOSC_LF = true,
398  .calibrateRCOSC_HF = true,
399 };
400 
401 /*
402  * =============================== PWM ===============================
403  * Remove unused entries to reduce flash usage both in Board.c and Board.h
404  */
405 #include <ti/drivers/PWM.h>
406 #include <ti/drivers/pwm/PWMTimerCC26XX.h>
407 
408 PWMTimerCC26XX_Object pwmtimerCC26xxObjects[CC2650STK_PWMCOUNT];
409 
410 const PWMTimerCC26XX_HwAttrs pwmtimerCC26xxHWAttrs[CC2650STK_PWMCOUNT] = {
411  { .pwmPin = CC2650STK_PWMPIN0, .gpTimerUnit = CC2650STK_GPTIMER0A },
412  { .pwmPin = CC2650STK_PWMPIN1, .gpTimerUnit = CC2650STK_GPTIMER0B },
413  { .pwmPin = CC2650STK_PWMPIN2, .gpTimerUnit = CC2650STK_GPTIMER1A },
414  { .pwmPin = CC2650STK_PWMPIN3, .gpTimerUnit = CC2650STK_GPTIMER1B },
415  { .pwmPin = CC2650STK_PWMPIN4, .gpTimerUnit = CC2650STK_GPTIMER2A },
416  { .pwmPin = CC2650STK_PWMPIN5, .gpTimerUnit = CC2650STK_GPTIMER2B },
417  { .pwmPin = CC2650STK_PWMPIN6, .gpTimerUnit = CC2650STK_GPTIMER3A },
418  { .pwmPin = CC2650STK_PWMPIN7, .gpTimerUnit = CC2650STK_GPTIMER3B },
419 };
420 
421 const PWM_Config PWM_config[CC2650STK_PWMCOUNT] = {
422  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650STK_PWM0], &pwmtimerCC26xxHWAttrs[CC2650STK_PWM0] },
423  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650STK_PWM1], &pwmtimerCC26xxHWAttrs[CC2650STK_PWM1] },
424  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650STK_PWM2], &pwmtimerCC26xxHWAttrs[CC2650STK_PWM2] },
425  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650STK_PWM3], &pwmtimerCC26xxHWAttrs[CC2650STK_PWM3] },
426  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650STK_PWM4], &pwmtimerCC26xxHWAttrs[CC2650STK_PWM4] },
427  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650STK_PWM5], &pwmtimerCC26xxHWAttrs[CC2650STK_PWM5] },
428  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650STK_PWM6], &pwmtimerCC26xxHWAttrs[CC2650STK_PWM6] },
429  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650STK_PWM7], &pwmtimerCC26xxHWAttrs[CC2650STK_PWM7] },
430 };
431 
432 const uint_least8_t PWM_count = CC2650STK_PWMCOUNT;
433 
434 /*
435  * =============================== RF Driver ===============================
436  */
437 #include <ti/drivers/rf/RF.h>
438 
439 const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = {
440  .hwiPriority = ~0, /* Lowest HWI priority */
441  .swiPriority = 0, /* Lowest SWI priority */
442  .xoscHfAlwaysNeeded = true, /* Keep XOSC dependency while in stanby */
443  .globalCallback = NULL, /* No board specific callback */
444  .globalEventMask = 0 /* No events subscribed to */
445 };
446 
447 /*
448  * =============================== SPI DMA ===============================
449  */
450 #include <ti/drivers/SPI.h>
451 #include <ti/drivers/spi/SPICC26XXDMA.h>
452 
453 #if TI_SPI_CONF_ENABLE
454 
455 SPICC26XXDMA_Object spiCC26XXDMAObjects[CC2650STK_SPICOUNT];
456 
457 const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC2650STK_SPICOUNT] = {
458 #if TI_SPI_CONF_SPI0_ENABLE
459  {
460  .baseAddr = SSI0_BASE,
461  .intNum = INT_SSI0_COMB,
462  .intPriority = ~0,
463  .swiPriority = 0,
464  .powerMngrId = PowerCC26XX_PERIPH_SSI0,
465  .defaultTxBufValue = 0,
466  .rxChannelBitMask = 1<<UDMA_CHAN_SSI0_RX,
467  .txChannelBitMask = 1<<UDMA_CHAN_SSI0_TX,
468  .mosiPin = CC2650STK_SPI0_MOSI,
469  .misoPin = CC2650STK_SPI0_MISO,
470  .clkPin = CC2650STK_SPI0_CLK,
471  .csnPin = CC2650STK_SPI0_CSN,
472  .minDmaTransferSize = 10
473  },
474 #endif
475 #if TI_SPI_CONF_SPI1_ENABLE
476  {
477  .baseAddr = SSI1_BASE,
478  .intNum = INT_SSI1_COMB,
479  .intPriority = ~0,
480  .swiPriority = 0,
481  .powerMngrId = PowerCC26XX_PERIPH_SSI1,
482  .defaultTxBufValue = 0,
483  .rxChannelBitMask = 1<<UDMA_CHAN_SSI1_RX,
484  .txChannelBitMask = 1<<UDMA_CHAN_SSI1_TX,
485  .mosiPin = CC2650STK_SPI1_MOSI,
486  .misoPin = CC2650STK_SPI1_MISO,
487  .clkPin = CC2650STK_SPI1_CLK,
488  .csnPin = CC2650STK_SPI1_CSN,
489  .minDmaTransferSize = 10
490  },
491 #endif
492 };
493 
494 const SPI_Config SPI_config[CC2650STK_SPICOUNT] = {
495 #if TI_SPI_CONF_SPI0_ENABLE
496  {
497  .fxnTablePtr = &SPICC26XXDMA_fxnTable,
498  .object = &spiCC26XXDMAObjects[CC2650STK_SPI0],
499  .hwAttrs = &spiCC26XXDMAHWAttrs[CC2650STK_SPI0]
500  },
501 #endif
502 #if TI_SPI_CONF_SPI1_ENABLE
503  {
504  .fxnTablePtr = &SPICC26XXDMA_fxnTable,
505  .object = &spiCC26XXDMAObjects[CC2650STK_SPI1],
506  .hwAttrs = &spiCC26XXDMAHWAttrs[CC2650STK_SPI1]
507  },
508 #endif
509 };
510 
511 const uint_least8_t SPI_count = CC2650STK_SPICOUNT;
512 
513 #endif /* TI_SPI_CONF_ENABLE */
514 
515 
516 /*
517  * =============================== TRNG ===============================
518  */
519 #include <ti/drivers/TRNG.h>
520 #include <ti/drivers/trng/TRNGCC26X0.h>
521 
522 TRNGCC26X0_Object trngCC26X0Object[CC2650STK_TRNGCOUNT];
523 
524 const TRNGCC26X0_HWAttrs trngCC26X0HWAttrs[CC2650STK_TRNGCOUNT] = {
525  {
526  .swiPriority = 0,
527  .intPriority = ~0,
528  }
529 };
530 
531 const TRNG_Config TRNG_config[] = {
532  { &trngCC26X0Object[0], &trngCC26X0HWAttrs[0] },
533 };
534 
535 const uint8_t TRNG_count = CC2650STK_TRNGCOUNT;
536 
537 
538 /*
539  * =============================== UART ===============================
540  */
541 #include <ti/drivers/UART.h>
542 #include <ti/drivers/uart/UARTCC26XX.h>
543 
544 #if TI_UART_CONF_ENABLE
545 
546 UARTCC26XX_Object uartCC26XXObjects[CC2650STK_UARTCOUNT];
547 
548 uint8_t uartCC26XXRingBuffer[CC2650STK_UARTCOUNT][32];
549 
550 const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC2650STK_UARTCOUNT] = {
551 #if TI_UART_CONF_UART0_ENABLE
552  {
553  .baseAddr = UART0_BASE,
554  .powerMngrId = PowerCC26XX_PERIPH_UART0,
555  .intNum = INT_UART0_COMB,
556  .intPriority = ~0,
557  .swiPriority = 0,
558  .txPin = CC2650STK_UART_TX,
559  .rxPin = CC2650STK_UART_RX,
560  .ctsPin = PIN_UNASSIGNED,
561  .rtsPin = PIN_UNASSIGNED,
562  .ringBufPtr = uartCC26XXRingBuffer[CC2650STK_UART0],
563  .ringBufSize = sizeof(uartCC26XXRingBuffer[CC2650STK_UART0]),
564  .txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8,
565  .rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8,
566  .errorFxn = NULL
567  },
568 #endif
569 };
570 
571 const UART_Config UART_config[CC2650STK_UARTCOUNT] = {
572 #if TI_UART_CONF_UART0_ENABLE
573  {
574  .fxnTablePtr = &UARTCC26XX_fxnTable,
575  .object = &uartCC26XXObjects[CC2650STK_UART0],
576  .hwAttrs = &uartCC26XXHWAttrs[CC2650STK_UART0]
577  },
578 #endif
579 };
580 
581 const uint_least8_t UART_count = CC2650STK_UARTCOUNT;
582 
583 #endif /* TI_UART_CONF_ENABLE */
584 
585 /*
586  * =============================== UDMA ===============================
587  */
588 #include <ti/drivers/dma/UDMACC26XX.h>
589 
590 UDMACC26XX_Object udmaObjects[CC2650STK_UDMACOUNT];
591 
592 const UDMACC26XX_HWAttrs udmaHWAttrs[CC2650STK_UDMACOUNT] = {
593  {
594  .baseAddr = UDMA0_BASE,
595  .powerMngrId = PowerCC26XX_PERIPH_UDMA,
596  .intNum = INT_DMA_ERR,
597  .intPriority = ~0
598  }
599 };
600 
601 const UDMACC26XX_Config UDMACC26XX_config[CC2650STK_UDMACOUNT] = {
602  {
603  .object = &udmaObjects[CC2650STK_UDMA0],
604  .hwAttrs = &udmaHWAttrs[CC2650STK_UDMA0]
605  },
606 };
607 
608 /*
609  * =============================== Watchdog ===============================
610  */
611 #include <ti/drivers/Watchdog.h>
612 #include <ti/drivers/watchdog/WatchdogCC26XX.h>
613 
614 WatchdogCC26XX_Object watchdogCC26XXObjects[CC2650STK_WATCHDOGCOUNT];
615 
616 const WatchdogCC26XX_HWAttrs watchdogCC26XXHWAttrs[CC2650STK_WATCHDOGCOUNT] = {
617  {
618  .baseAddr = WDT_BASE,
619  .reloadValue = 1000 /* Reload value in milliseconds */
620  },
621 };
622 
623 const Watchdog_Config Watchdog_config[CC2650STK_WATCHDOGCOUNT] = {
624  {
625  .fxnTablePtr = &WatchdogCC26XX_fxnTable,
626  .object = &watchdogCC26XXObjects[CC2650STK_WATCHDOG0],
627  .hwAttrs = &watchdogCC26XXHWAttrs[CC2650STK_WATCHDOG0]
628  },
629 };
630 
631 const uint_least8_t Watchdog_count = CC2650STK_WATCHDOGCOUNT;
632 
633 /*
634  * Board-specific initialization function to disable external flash.
635  * This function is defined in the file CC2650STK_fxns.c
636  */
637 extern void Board_initHook(void);
638 
639 /*
640  * ======== CC2650STK_initGeneral ========
641  */
643 {
644  Power_init();
645 
646  if ( PIN_init(BoardGpioInitTable) != PIN_SUCCESS) {
647  /* Error with PIN_init */
648  while (1);
649  }
650 
651  /* Perform board-specific initialization */
652  Board_initHook();
653 }
#define SSI1_BASE
Base address for SSI1.
Definition: ssi.h:59
============================================================================
#define SSI0_BASE
Base address for SSI0.
Definition: ssi.h:58
void CC2650STK_initGeneral(void)
Initialize the general board specific settings.
Definition: CC2650STK.c:642