Contiki-NG
CC2650DK_7ID.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  * ====================== CC2650DK_7ID.c ===================================
35  * This file is responsible for setting up the board specific items for the
36  * CC2650DK_7ID board.
37  */
38 
39 #include <stdbool.h>
40 #include <stddef.h>
41 #include <stdint.h>
42 
43 #include <ti/devices/DeviceFamily.h>
44 #include DeviceFamily_constructPath(driverlib/ioc.h)
45 #include DeviceFamily_constructPath(driverlib/udma.h)
46 #include DeviceFamily_constructPath(inc/hw_ints.h)
47 #include DeviceFamily_constructPath(inc/hw_memmap.h)
48 
49 #include "CC2650DK_7ID.h"
50 
51 /*
52  * =============================== ADCBuf ===============================
53  */
54 #include <ti/drivers/ADCBuf.h>
55 #include <ti/drivers/adcbuf/ADCBufCC26XX.h>
56 
57 ADCBufCC26XX_Object adcBufCC26xxObjects[CC2650DK_7ID_ADCBUFCOUNT];
58 
59 /*
60  * This table converts a virtual adc channel into a dio and internal analogue
61  * input signal. This table is necessary for the functioning of the adcBuf
62  * driver. Comment out unused entries to save flash. Dio and internal signal
63  * pairs are hardwired. Do not remap them in the table. You may reorder entire
64  * entries. The mapping of dio and internal signals is package dependent.
65  */
66 const ADCBufCC26XX_AdcChannelLutEntry ADCBufCC26XX_adcChannelLut[CC2650DK_7ID_ADCBUF0CHANNELCOUNT] = {
67  {CC2650DK_7ID_ALS_OUT, ADC_COMPB_IN_AUXIO7},
68  {PIN_UNASSIGNED, ADC_COMPB_IN_DCOUPL},
69  {PIN_UNASSIGNED, ADC_COMPB_IN_VSS},
70  {PIN_UNASSIGNED, ADC_COMPB_IN_VDDS},
71 };
72 
73 const ADCBufCC26XX_HWAttrs adcBufCC26xxHWAttrs[CC2650DK_7ID_ADCBUFCOUNT] = {
74  {
75  .intPriority = ~0,
76  .swiPriority = 0,
77  .adcChannelLut = ADCBufCC26XX_adcChannelLut,
78  .gpTimerUnit = CC2650DK_7ID_GPTIMER0A,
79  .gptDMAChannelMask = 1 << UDMA_CHAN_TIMER0_A,
80  }
81 };
82 
83 const ADCBuf_Config ADCBuf_config[CC2650DK_7ID_ADCBUFCOUNT] = {
84  {
85  &ADCBufCC26XX_fxnTable,
86  &adcBufCC26xxObjects[CC2650DK_7ID_ADCBUF0],
87  &adcBufCC26xxHWAttrs[CC2650DK_7ID_ADCBUF0]
88  },
89 };
90 
91 const uint_least8_t ADCBuf_count = CC2650DK_7ID_ADCBUFCOUNT;
92 
93 /*
94  * =============================== ADC ===============================
95  */
96 #include <ti/drivers/ADC.h>
97 #include <ti/drivers/adc/ADCCC26XX.h>
98 
99 ADCCC26XX_Object adcCC26xxObjects[CC2650DK_7ID_ADCCOUNT];
100 
101 const ADCCC26XX_HWAttrs adcCC26xxHWAttrs[CC2650DK_7ID_ADCCOUNT] = {
102  {
103  .adcDIO = CC2650DK_7ID_DIO23_ANALOG,
104  .adcCompBInput = ADC_COMPB_IN_AUXIO7,
105  .refSource = ADCCC26XX_FIXED_REFERENCE,
106  .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
107  .inputScalingEnabled = true,
108  .triggerSource = ADCCC26XX_TRIGGER_MANUAL,
109  .returnAdjustedVal = false
110  },
111  {
112  .adcDIO = PIN_UNASSIGNED,
113  .adcCompBInput = ADC_COMPB_IN_DCOUPL,
114  .refSource = ADCCC26XX_FIXED_REFERENCE,
115  .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
116  .inputScalingEnabled = true,
117  .triggerSource = ADCCC26XX_TRIGGER_MANUAL,
118  .returnAdjustedVal = false
119  },
120  {
121  .adcDIO = PIN_UNASSIGNED,
122  .adcCompBInput = ADC_COMPB_IN_VSS,
123  .refSource = ADCCC26XX_FIXED_REFERENCE,
124  .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
125  .inputScalingEnabled = true,
126  .triggerSource = ADCCC26XX_TRIGGER_MANUAL,
127  .returnAdjustedVal = false
128  },
129  {
130  .adcDIO = PIN_UNASSIGNED,
131  .adcCompBInput = ADC_COMPB_IN_VDDS,
132  .refSource = ADCCC26XX_FIXED_REFERENCE,
133  .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
134  .inputScalingEnabled = true,
135  .triggerSource = ADCCC26XX_TRIGGER_MANUAL,
136  .returnAdjustedVal = false
137  }
138 };
139 
140 const ADC_Config ADC_config[CC2650DK_7ID_ADCCOUNT] = {
141  {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC2650DK_7ID_ADCALS], &adcCC26xxHWAttrs[CC2650DK_7ID_ADCALS]},
142  {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC2650DK_7ID_ADCDCOUPL], &adcCC26xxHWAttrs[CC2650DK_7ID_ADCDCOUPL]},
143  {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC2650DK_7ID_ADCVSS], &adcCC26xxHWAttrs[CC2650DK_7ID_ADCVSS]},
144  {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC2650DK_7ID_ADCVDDS], &adcCC26xxHWAttrs[CC2650DK_7ID_ADCVDDS]},
145 };
146 
147 const uint_least8_t ADC_count = CC2650DK_7ID_ADCCOUNT;
148 
149 /*
150  * =============================== Crypto ===============================
151  */
152 #include <ti/drivers/crypto/CryptoCC26XX.h>
153 
154 CryptoCC26XX_Object cryptoCC26XXObjects[CC2650DK_7ID_CRYPTOCOUNT];
155 
156 const CryptoCC26XX_HWAttrs cryptoCC26XXHWAttrs[CC2650DK_7ID_CRYPTOCOUNT] = {
157  {
158  .baseAddr = CRYPTO_BASE,
159  .powerMngrId = PowerCC26XX_PERIPH_CRYPTO,
160  .intNum = INT_CRYPTO_RESULT_AVAIL_IRQ,
161  .intPriority = ~0,
162  }
163 };
164 
165 const CryptoCC26XX_Config CryptoCC26XX_config[CC2650DK_7ID_CRYPTOCOUNT] = {
166  {
167  .object = &cryptoCC26XXObjects[CC2650DK_7ID_CRYPTO0],
168  .hwAttrs = &cryptoCC26XXHWAttrs[CC2650DK_7ID_CRYPTO0]
169  },
170 };
171 
172 /*
173  * =============================== GPIO ===============================
174  */
175 #include <ti/drivers/GPIO.h>
176 #include <ti/drivers/gpio/GPIOCC26XX.h>
177 
178 /*
179  * Array of Pin configurations
180  * NOTE: The order of the pin configurations must coincide with what was
181  * defined in CC2650DK_7ID.h
182  * NOTE: Pins not used for interrupts should be placed at the end of the
183  * array. Callback entries can be omitted from callbacks array to
184  * reduce memory usage.
185  */
186 GPIO_PinConfig gpioPinConfigs[] = {
187  /* Input pins */
188  GPIOCC26XX_DIO_11 | GPIO_DO_NOT_CONFIG, /* Key Select */
189  GPIOCC26XX_DIO_19 | GPIO_DO_NOT_CONFIG, /* Key Up */
190  GPIOCC26XX_DIO_12 | GPIO_DO_NOT_CONFIG, /* Key Down */
191  GPIOCC26XX_DIO_15 | GPIO_DO_NOT_CONFIG, /* Key Left */
192  GPIOCC26XX_DIO_18 | GPIO_DO_NOT_CONFIG, /* Key Right */
193 
194  GPIOCC26XX_DIO_15 | GPIO_DO_NOT_CONFIG, /* CC2650DK_7ID_SPI_MASTER_READY */
195  GPIOCC26XX_DIO_21 | GPIO_DO_NOT_CONFIG, /* CC2650DK_7ID_SPI_SLAVE_READY */
196 
197  /* Output pins */
198  GPIOCC26XX_DIO_25 | GPIO_DO_NOT_CONFIG, /* LED 1 */
199  GPIOCC26XX_DIO_27 | GPIO_DO_NOT_CONFIG, /* LED 2 */
200  GPIOCC26XX_DIO_07 | GPIO_DO_NOT_CONFIG, /* LED 3 */
201  GPIOCC26XX_DIO_06 | GPIO_DO_NOT_CONFIG, /* LED 4 */
202 
203  /* SDCARD */
204  GPIOCC26XX_DIO_30 | GPIO_DO_NOT_CONFIG, /* SPI chip select */
205 
206  /* Accelerometer */
207  GPIOCC26XX_DIO_24 | GPIO_DO_NOT_CONFIG, /* SPI chip select */
208 };
209 
210 /*
211  * Array of callback function pointers
212  * NOTE: The order of the pin configurations must coincide with what was
213  * defined in CC2650_LAUNCH.h
214  * NOTE: Pins not used for interrupts can be omitted from callbacks array to
215  * reduce memory usage (if placed at end of gpioPinConfigs array).
216  */
217 GPIO_CallbackFxn gpioCallbackFunctions[] = {
218  NULL, /* Button 0 */
219  NULL, /* Button 1 */
220  NULL, /* CC2650DK_7ID_SPI_MASTER_READY */
221  NULL, /* CC2650DK_7ID_SPI_SLAVE_READY */
222 };
223 
224 const GPIOCC26XX_Config GPIOCC26XX_config = {
225  .pinConfigs = (GPIO_PinConfig *)gpioPinConfigs,
226  .callbacks = (GPIO_CallbackFxn *)gpioCallbackFunctions,
227  .numberOfPinConfigs = CC2650DK_7ID_GPIOCOUNT,
228  .numberOfCallbacks = sizeof(gpioCallbackFunctions)/sizeof(GPIO_CallbackFxn),
229  .intPriority = (~0)
230 };
231 
232 /*
233  * =============================== GPTimer ===============================
234  * Remove unused entries to reduce flash usage both in Board.c and Board.h
235  */
236 #include <ti/drivers/timer/GPTimerCC26XX.h>
237 
238 GPTimerCC26XX_Object gptimerCC26XXObjects[CC2650DK_7ID_GPTIMERCOUNT];
239 
240 const GPTimerCC26XX_HWAttrs gptimerCC26xxHWAttrs[CC2650DK_7ID_GPTIMERPARTSCOUNT] = {
241  { .baseAddr = GPT0_BASE, .intNum = INT_GPT0A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0A, },
242  { .baseAddr = GPT0_BASE, .intNum = INT_GPT0B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0B, },
243  { .baseAddr = GPT1_BASE, .intNum = INT_GPT1A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1A, },
244  { .baseAddr = GPT1_BASE, .intNum = INT_GPT1B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1B, },
245  { .baseAddr = GPT2_BASE, .intNum = INT_GPT2A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2A, },
246  { .baseAddr = GPT2_BASE, .intNum = INT_GPT2B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2B, },
247  { .baseAddr = GPT3_BASE, .intNum = INT_GPT3A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3A, },
248  { .baseAddr = GPT3_BASE, .intNum = INT_GPT3B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3B, },
249 };
250 
251 const GPTimerCC26XX_Config GPTimerCC26XX_config[CC2650DK_7ID_GPTIMERPARTSCOUNT] = {
252  { &gptimerCC26XXObjects[CC2650DK_7ID_GPTIMER0], &gptimerCC26xxHWAttrs[CC2650DK_7ID_GPTIMER0A], GPT_A },
253  { &gptimerCC26XXObjects[CC2650DK_7ID_GPTIMER0], &gptimerCC26xxHWAttrs[CC2650DK_7ID_GPTIMER0B], GPT_B },
254  { &gptimerCC26XXObjects[CC2650DK_7ID_GPTIMER1], &gptimerCC26xxHWAttrs[CC2650DK_7ID_GPTIMER1A], GPT_A },
255  { &gptimerCC26XXObjects[CC2650DK_7ID_GPTIMER1], &gptimerCC26xxHWAttrs[CC2650DK_7ID_GPTIMER1B], GPT_B },
256  { &gptimerCC26XXObjects[CC2650DK_7ID_GPTIMER2], &gptimerCC26xxHWAttrs[CC2650DK_7ID_GPTIMER2A], GPT_A },
257  { &gptimerCC26XXObjects[CC2650DK_7ID_GPTIMER2], &gptimerCC26xxHWAttrs[CC2650DK_7ID_GPTIMER2B], GPT_B },
258  { &gptimerCC26XXObjects[CC2650DK_7ID_GPTIMER3], &gptimerCC26xxHWAttrs[CC2650DK_7ID_GPTIMER3A], GPT_A },
259  { &gptimerCC26XXObjects[CC2650DK_7ID_GPTIMER3], &gptimerCC26xxHWAttrs[CC2650DK_7ID_GPTIMER3B], GPT_B },
260 };
261 
262 /*
263  * =============================== I2C ===============================
264 */
265 #include <ti/drivers/I2C.h>
266 #include <ti/drivers/i2c/I2CCC26XX.h>
267 
268 #if TI_I2C_CONF_ENABLE
269 
270 I2CCC26XX_Object i2cCC26xxObjects[CC2650DK_7ID_I2CCOUNT];
271 
272 const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC2650DK_7ID_I2CCOUNT] = {
273 #if TI_I2C_CONF_I2C0_ENABLE
274  {
275  .baseAddr = I2C0_BASE,
276  .powerMngrId = PowerCC26XX_PERIPH_I2C0,
277  .intNum = INT_I2C_IRQ,
278  .intPriority = ~0,
279  .swiPriority = 0,
280  .sdaPin = CC2650DK_7ID_I2C0_SDA0,
281  .sclPin = CC2650DK_7ID_I2C0_SCL0,
282  },
283 #endif
284 };
285 
286 const I2C_Config I2C_config[CC2650DK_7ID_I2CCOUNT] = {
287 #if TI_I2C_CONF_I2C0_ENABLE
288  {
289  .fxnTablePtr = &I2CCC26XX_fxnTable,
290  .object = &i2cCC26xxObjects[CC2650DK_7ID_I2C0],
291  .hwAttrs = &i2cCC26xxHWAttrs[CC2650DK_7ID_I2C0]
292  },
293 #endif
294 };
295 
296 const uint_least8_t I2C_count = CC2650DK_7ID_I2CCOUNT;
297 
298 #endif /* TI_I2C_CONF_ENABLE */
299 
300 /*
301  * =============================== NVS ===============================
302  */
303 #include <ti/drivers/NVS.h>
304 #include <ti/drivers/nvs/NVSSPI25X.h>
305 #include <ti/drivers/nvs/NVSCC26XX.h>
306 
307 #define NVS_REGIONS_BASE 0x1A000
308 #define SECTORSIZE 0x1000
309 #define REGIONSIZE (SECTORSIZE * 4)
310 
311 #if TI_NVS_CONF_ENABLE
312 
313 #if TI_NVS_CONF_NVS_INTERNAL_ENABLE
314 
315 /*
316  * Reserve flash sectors for NVS driver use by placing an uninitialized byte
317  * array at the desired flash address.
318  */
319 #if defined(__TI_COMPILER_VERSION__)
320 
321 /*
322  * Place uninitialized array at NVS_REGIONS_BASE
323  */
324 #pragma LOCATION(flashBuf, NVS_REGIONS_BASE);
325 #pragma NOINIT(flashBuf);
326 static char flashBuf[REGIONSIZE];
327 
328 #elif defined(__IAR_SYSTEMS_ICC__)
329 
330 /*
331  * Place uninitialized array at NVS_REGIONS_BASE
332  */
333 static __no_init char flashBuf[REGIONSIZE] @ NVS_REGIONS_BASE;
334 
335 #elif defined(__GNUC__)
336 
337 /*
338  * Place the flash buffers in the .nvs section created in the gcc linker file.
339  * The .nvs section enforces alignment on a sector boundary but may
340  * be placed anywhere in flash memory. If desired the .nvs section can be set
341  * to a fixed address by changing the following in the gcc linker file:
342  *
343  * .nvs (FIXED_FLASH_ADDR) (NOLOAD) : AT (FIXED_FLASH_ADDR) {
344  * *(.nvs)
345  * } > REGION_TEXT
346  */
347 __attribute__ ((section (".nvs")))
348 static char flashBuf[REGIONSIZE];
349 
350 #endif
351 
352 /* Allocate objects for NVS Internal Regions */
353 NVSCC26XX_Object nvsCC26xxObjects[1];
354 
355 /* Hardware attributes for NVS Internal Regions */
356 const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = {
357  {
358  .regionBase = (void *)flashBuf,
359  .regionSize = REGIONSIZE,
360  },
361 };
362 
363 #endif /* TI_NVS_CONF_NVS_INTERNAL_ENABLE */
364 
365 /* NVS Region index 0 and 1 refer to NVS and NVS SPI respectively */
366 const NVS_Config NVS_config[CC2650DK_7ID_NVSCOUNT] = {
367 #if TI_NVS_CONF_NVS_INTERNAL_ENABLE
368  {
369  .fxnTablePtr = &NVSCC26XX_fxnTable,
370  .object = &nvsCC26xxObjects[0],
371  .hwAttrs = &nvsCC26xxHWAttrs[0],
372  },
373 #endif
374 };
375 
376 const uint_least8_t NVS_count = CC2650DK_7ID_NVSCOUNT;
377 
378 #endif /* TI_NVS_CONF_ENABLE */
379 
380 /*
381  * =============================== PIN ===============================
382  */
383 #include <ti/drivers/PIN.h>
384 #include <ti/drivers/pin/PINCC26XX.h>
385 
386 const PIN_Config BoardGpioInitTable[] = {
387 
388  CC2650DK_7ID_PIN_LED1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
389  CC2650DK_7ID_PIN_LED2 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
390  CC2650DK_7ID_PIN_LED3 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
391  CC2650DK_7ID_PIN_LED4 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
392  CC2650DK_7ID_PIN_KEY_SELECT | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
393  CC2650DK_7ID_PIN_KEY_UP | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
394  CC2650DK_7ID_PIN_KEY_DOWN | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
395  CC2650DK_7ID_PIN_KEY_LEFT | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
396  CC2650DK_7ID_PIN_KEY_UP | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
397  CC2650DK_7ID_SDCARD_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */
398  CC2650DK_7ID_ACC_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */
399  CC2650DK_7ID_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN, /* UART RX via debugger back channel */
400  CC2650DK_7ID_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* UART TX via debugger back channel */
401  CC2650DK_7ID_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */
402  CC2650DK_7ID_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */
403  CC2650DK_7ID_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI clock */
404 
405  PIN_TERMINATE
406 };
407 
408 const PINCC26XX_HWAttrs PINCC26XX_hwAttrs = {
409  .intPriority = ~0,
410  .swiPriority = 0
411 };
412 
413 /*
414  * =============================== Power ===============================
415  */
416 #include <ti/drivers/Power.h>
417 #include <ti/drivers/power/PowerCC26XX.h>
418 
419 const PowerCC26XX_Config PowerCC26XX_config = {
420  .policyInitFxn = NULL,
421  .policyFxn = &PowerCC26XX_standbyPolicy,
422  .calibrateFxn = &PowerCC26XX_calibrate,
423  .enablePolicy = true,
424  .calibrateRCOSC_LF = true,
425  .calibrateRCOSC_HF = true,
426 };
427 
428 /*
429  * =============================== PWM ===============================
430  * Remove unused entries to reduce flash usage both in Board.c and Board.h
431  */
432 #include <ti/drivers/PWM.h>
433 #include <ti/drivers/pwm/PWMTimerCC26XX.h>
434 
435 PWMTimerCC26XX_Object pwmtimerCC26xxObjects[CC2650DK_7ID_PWMCOUNT];
436 
437 const PWMTimerCC26XX_HwAttrs pwmtimerCC26xxHWAttrs[CC2650DK_7ID_PWMCOUNT] = {
438  { .pwmPin = CC2650DK_7ID_PWMPIN0, .gpTimerUnit = CC2650DK_7ID_GPTIMER0A },
439  { .pwmPin = CC2650DK_7ID_PWMPIN1, .gpTimerUnit = CC2650DK_7ID_GPTIMER0B },
440  { .pwmPin = CC2650DK_7ID_PWMPIN2, .gpTimerUnit = CC2650DK_7ID_GPTIMER1A },
441  { .pwmPin = CC2650DK_7ID_PWMPIN3, .gpTimerUnit = CC2650DK_7ID_GPTIMER1B },
442  { .pwmPin = CC2650DK_7ID_PWMPIN4, .gpTimerUnit = CC2650DK_7ID_GPTIMER2A },
443  { .pwmPin = CC2650DK_7ID_PWMPIN5, .gpTimerUnit = CC2650DK_7ID_GPTIMER2B },
444  { .pwmPin = CC2650DK_7ID_PWMPIN6, .gpTimerUnit = CC2650DK_7ID_GPTIMER3A },
445  { .pwmPin = CC2650DK_7ID_PWMPIN7, .gpTimerUnit = CC2650DK_7ID_GPTIMER3B },
446 };
447 
448 const PWM_Config PWM_config[CC2650DK_7ID_PWMCOUNT] = {
449  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650DK_7ID_PWM0], &pwmtimerCC26xxHWAttrs[CC2650DK_7ID_PWM0] },
450  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650DK_7ID_PWM1], &pwmtimerCC26xxHWAttrs[CC2650DK_7ID_PWM1] },
451  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650DK_7ID_PWM2], &pwmtimerCC26xxHWAttrs[CC2650DK_7ID_PWM2] },
452  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650DK_7ID_PWM3], &pwmtimerCC26xxHWAttrs[CC2650DK_7ID_PWM3] },
453  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650DK_7ID_PWM4], &pwmtimerCC26xxHWAttrs[CC2650DK_7ID_PWM4] },
454  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650DK_7ID_PWM5], &pwmtimerCC26xxHWAttrs[CC2650DK_7ID_PWM5] },
455  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650DK_7ID_PWM6], &pwmtimerCC26xxHWAttrs[CC2650DK_7ID_PWM6] },
456  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650DK_7ID_PWM7], &pwmtimerCC26xxHWAttrs[CC2650DK_7ID_PWM7] },
457 };
458 
459 const uint_least8_t PWM_count = CC2650DK_7ID_PWMCOUNT;
460 
461 /*
462  * =============================== RF Driver ===============================
463  */
464 #include <ti/drivers/rf/RF.h>
465 
466 const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = {
467  .hwiPriority = ~0, /* Lowest HWI priority */
468  .swiPriority = 0, /* Lowest SWI priority */
469  .xoscHfAlwaysNeeded = true, /* Keep XOSC dependency while in stanby */
470  .globalCallback = NULL, /* No board specific callback */
471  .globalEventMask = 0 /* No events subscribed to */
472 };
473 
474 /*
475  * =============================== SD ===============================
476  */
477 #include <ti/drivers/SD.h>
478 #include <ti/drivers/sd/SDSPI.h>
479 
480 #if TI_SD_CONF_ENABLE
481 
482 #if !(TI_SPI_CONF_SPI0_ENABLE)
483 #error "SD driver requires SPI0 enabled"
484 #endif
485 
486 SDSPI_Object sdspiObjects[CC2650DK_7ID_SDCOUNT];
487 
488 const SDSPI_HWAttrs sdspiHWAttrs[CC2650DK_7ID_SDCOUNT] = {
489  {
490  .spiIndex = CC2650DK_7ID_SPI0,
491  .spiCsGpioIndex = CC2650DK_7ID_SDCARD_CS
492  }
493 };
494 
495 const SD_Config SD_config[CC2650DK_7ID_SDCOUNT] = {
496  {
497  .fxnTablePtr = &SDSPI_fxnTable,
498  .object = &sdspiObjects[CC2650DK_7ID_SDSPI0],
499  .hwAttrs = &sdspiHWAttrs[CC2650DK_7ID_SDSPI0]
500  },
501 };
502 
503 const uint_least8_t SD_count = CC2650DK_7ID_SDCOUNT;
504 
505 #endif /* TI_SD_CONF_ENABLE */
506 
507 /*
508  * =============================== SPI DMA ===============================
509  */
510 #include <ti/drivers/SPI.h>
511 #include <ti/drivers/spi/SPICC26XXDMA.h>
512 
513 #if TI_SPI_CONF_ENABLE
514 
515 SPICC26XXDMA_Object spiCC26XXDMAObjects[CC2650DK_7ID_SPICOUNT];
516 
517 /*
518  * NOTE: The SPI instances below can be used by the SD driver to communicate
519  * with a SD card via SPI. The 'defaultTxBufValue' fields below are set to 0xFF
520  * to satisfy the SDSPI driver requirement.
521  */
522 const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC2650DK_7ID_SPICOUNT] = {
523 #if TI_SPI_CONF_SPI0_ENABLE
524  {
525  .baseAddr = SSI0_BASE,
526  .intNum = INT_SSI0_COMB,
527  .intPriority = ~0,
528  .swiPriority = 0,
529  .powerMngrId = PowerCC26XX_PERIPH_SSI0,
530  .defaultTxBufValue = 0xFF,
531  .rxChannelBitMask = 1<<UDMA_CHAN_SSI0_RX,
532  .txChannelBitMask = 1<<UDMA_CHAN_SSI0_TX,
533  .mosiPin = CC2650DK_7ID_SPI0_MOSI,
534  .misoPin = CC2650DK_7ID_SPI0_MISO,
535  .clkPin = CC2650DK_7ID_SPI0_CLK,
536  .csnPin = CC2650DK_7ID_SPI0_CSN,
537  .minDmaTransferSize = 10
538  },
539 #endif
540 #if TI_SPI_CONF_SPI1_ENABLE
541  {
542  .baseAddr = SSI1_BASE,
543  .intNum = INT_SSI1_COMB,
544  .intPriority = ~0,
545  .swiPriority = 0,
546  .powerMngrId = PowerCC26XX_PERIPH_SSI1,
547  .defaultTxBufValue = 0xFF,
548  .rxChannelBitMask = 1<<UDMA_CHAN_SSI1_RX,
549  .txChannelBitMask = 1<<UDMA_CHAN_SSI1_TX,
550  .mosiPin = CC2650DK_7ID_SPI1_MOSI,
551  .misoPin = CC2650DK_7ID_SPI1_MISO,
552  .clkPin = CC2650DK_7ID_SPI1_CLK,
553  .csnPin = CC2650DK_7ID_SPI1_CSN,
554  .minDmaTransferSize = 10
555  },
556 #endif
557 };
558 
559 const SPI_Config SPI_config[CC2650DK_7ID_SPICOUNT] = {
560 #if TI_SPI_CONF_SPI0_ENABLE
561  {
562  .fxnTablePtr = &SPICC26XXDMA_fxnTable,
563  .object = &spiCC26XXDMAObjects[CC2650DK_7ID_SPI0],
564  .hwAttrs = &spiCC26XXDMAHWAttrs[CC2650DK_7ID_SPI0]
565  },
566 #endif
567 #if TI_SPI_CONF_SPI1_ENABLE
568  {
569  .fxnTablePtr = &SPICC26XXDMA_fxnTable,
570  .object = &spiCC26XXDMAObjects[CC2650DK_7ID_SPI1],
571  .hwAttrs = &spiCC26XXDMAHWAttrs[CC2650DK_7ID_SPI1]
572  },
573 #endif
574 };
575 
576 const uint_least8_t SPI_count = CC2650DK_7ID_SPICOUNT;
577 
578 #endif /* TI_SPI_CONF_ENABLE */
579 
580 
581 /*
582  * =============================== TRNG ===============================
583  */
584 #include <ti/drivers/TRNG.h>
585 #include <ti/drivers/trng/TRNGCC26X0.h>
586 
587 TRNGCC26X0_Object trngCC26X0Object[CC2650DK_7ID_TRNGCOUNT];
588 
589 const TRNGCC26X0_HWAttrs trngCC26X0HWAttrs[CC2650DK_7ID_TRNGCOUNT] = {
590  {
591  .swiPriority = 0,
592  .intPriority = ~0,
593  }
594 };
595 
596 const TRNG_Config TRNG_config[] = {
597  { &trngCC26X0Object[0], &trngCC26X0HWAttrs[0] },
598 };
599 
600 const uint8_t TRNG_count = CC2650DK_7ID_TRNGCOUNT;
601 
602 
603 /*
604  * =============================== UART ===============================
605  */
606 #include <ti/drivers/UART.h>
607 #include <ti/drivers/uart/UARTCC26XX.h>
608 
609 #if TI_UART_CONF_ENABLE
610 
611 UARTCC26XX_Object uartCC26XXObjects[CC2650DK_7ID_UARTCOUNT];
612 
613 uint8_t uartCC26XXRingBuffer[CC2650DK_7ID_UARTCOUNT][32];
614 
615 const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC2650DK_7ID_UARTCOUNT] = {
616 #if TI_UART_CONF_UART0_ENABLE
617  {
618  .baseAddr = UART0_BASE,
619  .powerMngrId = PowerCC26XX_PERIPH_UART0,
620  .intNum = INT_UART0_COMB,
621  .intPriority = ~0,
622  .swiPriority = 0,
623  .txPin = CC2650DK_7ID_UART_TX,
624  .rxPin = CC2650DK_7ID_UART_RX,
625  .ctsPin = PIN_UNASSIGNED,
626  .rtsPin = PIN_UNASSIGNED,
627  .ringBufPtr = uartCC26XXRingBuffer[CC2650DK_7ID_UART0],
628  .ringBufSize = sizeof(uartCC26XXRingBuffer[CC2650DK_7ID_UART0]),
629  .txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8,
630  .rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8,
631  .errorFxn = NULL
632  },
633 #endif
634 };
635 
636 const UART_Config UART_config[CC2650DK_7ID_UARTCOUNT] = {
637 #if TI_UART_CONF_UART0_ENABLE
638  {
639  .fxnTablePtr = &UARTCC26XX_fxnTable,
640  .object = &uartCC26XXObjects[CC2650DK_7ID_UART0],
641  .hwAttrs = &uartCC26XXHWAttrs[CC2650DK_7ID_UART0]
642  },
643 #endif
644 };
645 
646 const uint_least8_t UART_count = CC2650DK_7ID_UARTCOUNT;
647 
648 #endif /* TI_UART_CONF_ENABLE */
649 
650 /*
651  * =============================== UDMA ===============================
652  */
653 #include <ti/drivers/dma/UDMACC26XX.h>
654 
655 UDMACC26XX_Object udmaObjects[CC2650DK_7ID_UDMACOUNT];
656 
657 const UDMACC26XX_HWAttrs udmaHWAttrs[CC2650DK_7ID_UDMACOUNT] = {
658  {
659  .baseAddr = UDMA0_BASE,
660  .powerMngrId = PowerCC26XX_PERIPH_UDMA,
661  .intNum = INT_DMA_ERR,
662  .intPriority = ~0
663  }
664 };
665 
666 const UDMACC26XX_Config UDMACC26XX_config[CC2650DK_7ID_UDMACOUNT] = {
667  {
668  .object = &udmaObjects[CC2650DK_7ID_UDMA0],
669  .hwAttrs = &udmaHWAttrs[CC2650DK_7ID_UDMA0]
670  },
671 };
672 
673 
674 
675 /*
676  * =============================== Watchdog ===============================
677  */
678 #include <ti/drivers/Watchdog.h>
679 #include <ti/drivers/watchdog/WatchdogCC26XX.h>
680 
681 WatchdogCC26XX_Object watchdogCC26XXObjects[CC2650DK_7ID_WATCHDOGCOUNT];
682 
683 const WatchdogCC26XX_HWAttrs watchdogCC26XXHWAttrs[CC2650DK_7ID_WATCHDOGCOUNT] = {
684  {
685  .baseAddr = WDT_BASE,
686  .reloadValue = 1000 /* Reload value in milliseconds */
687  },
688 };
689 
690 const Watchdog_Config Watchdog_config[CC2650DK_7ID_WATCHDOGCOUNT] = {
691  {
692  .fxnTablePtr = &WatchdogCC26XX_fxnTable,
693  .object = &watchdogCC26XXObjects[CC2650DK_7ID_WATCHDOG0],
694  .hwAttrs = &watchdogCC26XXHWAttrs[CC2650DK_7ID_WATCHDOG0]
695  },
696 };
697 
698 const uint_least8_t Watchdog_count = CC2650DK_7ID_WATCHDOGCOUNT;
699 
700 /*
701  * Board-specific initialization function to disable external flash.
702  * This function is defined in the file CC2650DK_7ID_fxns.c
703  */
704 extern void Board_initHook(void);
705 
706 /*
707  * ======== CC2650DK_7ID_initGeneral ========
708  */
710 {
711  Power_init();
712 
713  if (PIN_init(BoardGpioInitTable) != PIN_SUCCESS) {
714  /* Error with PIN_init */
715  while (1);
716  }
717 
718  /* Perform board-specific initialization */
719  Board_initHook();
720 }
void CC2650DK_7ID_initGeneral(void)
Initialize the general board specific settings.
Definition: CC2650DK_7ID.c:709
#define SSI1_BASE
Base address for SSI1.
Definition: ssi.h:59
#define SSI0_BASE
Base address for SSI0.
Definition: ssi.h:58
============================================================================