Contiki-NG
CC2650DK_7ID.c
1 /*
2  * Copyright (c) 2016-2019, 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  }
79 };
80 
81 const ADCBuf_Config ADCBuf_config[CC2650DK_7ID_ADCBUFCOUNT] = {
82  {
83  &ADCBufCC26XX_fxnTable,
84  &adcBufCC26xxObjects[CC2650DK_7ID_ADCBUF0],
85  &adcBufCC26xxHWAttrs[CC2650DK_7ID_ADCBUF0]
86  },
87 };
88 
89 const uint_least8_t ADCBuf_count = CC2650DK_7ID_ADCBUFCOUNT;
90 
91 /*
92  * =============================== ADC ===============================
93  */
94 #include <ti/drivers/ADC.h>
95 #include <ti/drivers/adc/ADCCC26XX.h>
96 
97 ADCCC26XX_Object adcCC26xxObjects[CC2650DK_7ID_ADCCOUNT];
98 
99 const ADCCC26XX_HWAttrs adcCC26xxHWAttrs[CC2650DK_7ID_ADCCOUNT] = {
100  {
101  .adcDIO = CC2650DK_7ID_DIO23_ANALOG,
102  .adcCompBInput = ADC_COMPB_IN_AUXIO7,
103  .refSource = ADCCC26XX_FIXED_REFERENCE,
104  .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
105  .inputScalingEnabled = true,
106  .triggerSource = ADCCC26XX_TRIGGER_MANUAL,
107  .returnAdjustedVal = false
108  },
109  {
110  .adcDIO = PIN_UNASSIGNED,
111  .adcCompBInput = ADC_COMPB_IN_DCOUPL,
112  .refSource = ADCCC26XX_FIXED_REFERENCE,
113  .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
114  .inputScalingEnabled = true,
115  .triggerSource = ADCCC26XX_TRIGGER_MANUAL,
116  .returnAdjustedVal = false
117  },
118  {
119  .adcDIO = PIN_UNASSIGNED,
120  .adcCompBInput = ADC_COMPB_IN_VSS,
121  .refSource = ADCCC26XX_FIXED_REFERENCE,
122  .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
123  .inputScalingEnabled = true,
124  .triggerSource = ADCCC26XX_TRIGGER_MANUAL,
125  .returnAdjustedVal = false
126  },
127  {
128  .adcDIO = PIN_UNASSIGNED,
129  .adcCompBInput = ADC_COMPB_IN_VDDS,
130  .refSource = ADCCC26XX_FIXED_REFERENCE,
131  .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
132  .inputScalingEnabled = true,
133  .triggerSource = ADCCC26XX_TRIGGER_MANUAL,
134  .returnAdjustedVal = false
135  }
136 };
137 
138 const ADC_Config ADC_config[CC2650DK_7ID_ADCCOUNT] = {
139  {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC2650DK_7ID_ADCALS], &adcCC26xxHWAttrs[CC2650DK_7ID_ADCALS]},
140  {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC2650DK_7ID_ADCDCOUPL], &adcCC26xxHWAttrs[CC2650DK_7ID_ADCDCOUPL]},
141  {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC2650DK_7ID_ADCVSS], &adcCC26xxHWAttrs[CC2650DK_7ID_ADCVSS]},
142  {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC2650DK_7ID_ADCVDDS], &adcCC26xxHWAttrs[CC2650DK_7ID_ADCVDDS]},
143 };
144 
145 const uint_least8_t ADC_count = CC2650DK_7ID_ADCCOUNT;
146 
147 /*
148  * =============================== Crypto ===============================
149  */
150 #include <ti/drivers/crypto/CryptoCC26XX.h>
151 
152 CryptoCC26XX_Object cryptoCC26XXObjects[CC2650DK_7ID_CRYPTOCOUNT];
153 
154 const CryptoCC26XX_HWAttrs cryptoCC26XXHWAttrs[CC2650DK_7ID_CRYPTOCOUNT] = {
155  {
156  .baseAddr = CRYPTO_BASE,
157  .powerMngrId = PowerCC26XX_PERIPH_CRYPTO,
158  .intNum = INT_CRYPTO_RESULT_AVAIL_IRQ,
159  .intPriority = ~0,
160  }
161 };
162 
163 const CryptoCC26XX_Config CryptoCC26XX_config[CC2650DK_7ID_CRYPTOCOUNT] = {
164  {
165  .object = &cryptoCC26XXObjects[CC2650DK_7ID_CRYPTO0],
166  .hwAttrs = &cryptoCC26XXHWAttrs[CC2650DK_7ID_CRYPTO0]
167  },
168 };
169 
170 /*
171  * =============================== AESCCM ===============================
172  */
173 #include <ti/drivers/AESCCM.h>
174 #include <ti/drivers/aesccm/AESCCMCC26XX.h>
175 
176 AESCCMCC26XX_Object aesccmCC26XXObjects[CC2650DK_7ID_AESCCMCOUNT];
177 
178 const AESCCMCC26XX_HWAttrs aesccmCC26XXHWAttrs[CC2650DK_7ID_AESCCMCOUNT] = {
179  {
180  .intPriority = ~0,
181  }
182 };
183 
184 const AESCCM_Config AESCCM_config[CC2650DK_7ID_AESCCMCOUNT] = {
185  {
186  .object = &aesccmCC26XXObjects[CC2650DK_7ID_AESCCM0],
187  .hwAttrs = &aesccmCC26XXHWAttrs[CC2650DK_7ID_AESCCM0]
188  },
189 };
190 
191 const uint_least8_t AESCCM_count = CC2650DK_7ID_AESCCMCOUNT;
192 
193 
194 /*
195  * =============================== AESGCM ===============================
196  */
197 #include <ti/drivers/AESGCM.h>
198 #include <ti/drivers/aesgcm/AESGCMCC26XX.h>
199 
200 AESGCMCC26XX_Object aesgcmCC26XXObjects[CC2650DK_7ID_AESGCMCOUNT];
201 
202 const AESGCMCC26XX_HWAttrs aesgcmCC26XXHWAttrs[CC2650DK_7ID_AESGCMCOUNT] = {
203  {
204  .intPriority = ~0,
205  }
206 };
207 
208 const AESGCM_Config AESGCM_config[CC2650DK_7ID_AESGCMCOUNT] = {
209  {
210  .object = &aesgcmCC26XXObjects[CC2650DK_7ID_AESGCM0],
211  .hwAttrs = &aesgcmCC26XXHWAttrs[CC2650DK_7ID_AESGCM0]
212  },
213 };
214 
215 const uint_least8_t AESGCM_count = CC2650DK_7ID_AESGCMCOUNT;
216 
217 /*
218  * =============================== AESCBC ===============================
219  */
220 #include <ti/drivers/AESCBC.h>
221 #include <ti/drivers/aescbc/AESCBCCC26XX.h>
222 
223 AESCBCCC26XX_Object aescbcCC26XXObjects[CC2650DK_7ID_AESCBCCOUNT];
224 
225 const AESCBCCC26XX_HWAttrs aescbcCC26XXHWAttrs[CC2650DK_7ID_AESCBCCOUNT] = {
226  {
227  .intPriority = ~0,
228  }
229 };
230 
231 const AESCBC_Config AESCBC_config[CC2650DK_7ID_AESCBCCOUNT] = {
232  {
233  .object = &aescbcCC26XXObjects[CC2650DK_7ID_AESCBC0],
234  .hwAttrs = &aescbcCC26XXHWAttrs[CC2650DK_7ID_AESCBC0]
235  },
236 };
237 
238 const uint_least8_t AESCBC_count = CC2650DK_7ID_AESCBCCOUNT;
239 
240 /*
241  * =============================== AESCTR ===============================
242  */
243 #include <ti/drivers/AESCTR.h>
244 #include <ti/drivers/aesctr/AESCTRCC26XX.h>
245 
246 AESCTRCC26XX_Object aesctrCC26XXObjects[CC2650DK_7ID_AESCTRCOUNT];
247 
248 const AESCTRCC26XX_HWAttrs aesctrCC26XXHWAttrs[CC2650DK_7ID_AESCTRCOUNT] = {
249  {
250  .intPriority = ~0,
251  }
252 };
253 
254 const AESCTR_Config AESCTR_config[CC2650DK_7ID_AESCTRCOUNT] = {
255  {
256  .object = &aesctrCC26XXObjects[CC2650DK_7ID_AESCTR0],
257  .hwAttrs = &aesctrCC26XXHWAttrs[CC2650DK_7ID_AESCTR0]
258  },
259 };
260 
261 const uint_least8_t AESCTR_count = CC2650DK_7ID_AESCTRCOUNT;
262 
263 /*
264  * =============================== AESECB ===============================
265  */
266 #include <ti/drivers/AESECB.h>
267 #include <ti/drivers/aesecb/AESECBCC26XX.h>
268 
269 AESECBCC26XX_Object aesecbCC26XXObjects[CC2650DK_7ID_AESECBCOUNT];
270 
271 const AESECBCC26XX_HWAttrs aesecbCC26XXHWAttrs[CC2650DK_7ID_AESECBCOUNT] = {
272  {
273  .intPriority = ~0,
274  }
275 };
276 
277 const AESECB_Config AESECB_config[CC2650DK_7ID_AESECBCOUNT] = {
278  {
279  .object = &aesecbCC26XXObjects[CC2650DK_7ID_AESECB0],
280  .hwAttrs = &aesecbCC26XXHWAttrs[CC2650DK_7ID_AESECB0]
281  },
282 };
283 
284 const uint_least8_t AESECB_count = CC2650DK_7ID_AESECBCOUNT;
285 
286 /*
287  * =============================== AESCTRDRBG ===============================
288  */
289 #include <ti/drivers/AESCTRDRBG.h>
290 #include <ti/drivers/aesctrdrbg/AESCTRDRBGXX.h>
291 
292 AESCTRDRBGXX_Object aesctrdrbgXXObjects[CC2650DK_7ID_AESCTRDRBGCOUNT];
293 
294 const AESCTRDRBGXX_HWAttrs aesctrdrbgXXHWAttrs[CC2650DK_7ID_AESCTRDRBGCOUNT] = {
295  {
296  .aesctrIndex = CC2650DK_7ID_AESCTR0,
297  }
298 };
299 
300 const AESCTRDRBG_Config AESCTRDRBG_config[CC2650DK_7ID_AESCTRDRBGCOUNT] = {
301  {
302  .object = &aesctrdrbgXXObjects[CC2650DK_7ID_AESCTRDRBG0],
303  .hwAttrs = &aesctrdrbgXXHWAttrs[CC2650DK_7ID_AESCTRDRBG0]
304  },
305 };
306 
307 const uint_least8_t AESCTRDRBG_count = CC2650DK_7ID_AESCTRDRBGCOUNT;
308 
309 /*
310  * =============================== TRNG ===============================
311  */
312 #include <ti/drivers/TRNG.h>
313 #include <ti/drivers/trng/TRNGCC26XX.h>
314 
315 TRNGCC26XX_Object trngCC26XXObjects[CC2650DK_7ID_TRNGCOUNT];
316 
317 const TRNGCC26XX_HWAttrs trngCC26X2HWAttrs[CC2650DK_7ID_TRNGCOUNT] = {
318  {
319  .intPriority = ~0,
320  .swiPriority = 0,
321  .samplesPerCycle = 240000,
322  }
323 };
324 
325 const TRNG_Config TRNG_config[CC2650DK_7ID_TRNGCOUNT] = {
326  {
327  .object = &trngCC26XXObjects[CC2650DK_7ID_TRNG0],
328  .hwAttrs = &trngCC26X2HWAttrs[CC2650DK_7ID_TRNG0]
329  },
330 };
331 
332 const uint_least8_t TRNG_count = CC2650DK_7ID_TRNGCOUNT;
333 
334 /*
335  * =============================== GPIO ===============================
336  */
337 #include <ti/drivers/GPIO.h>
338 #include <ti/drivers/gpio/GPIOCC26XX.h>
339 
340 /*
341  * Array of Pin configurations
342  * NOTE: The order of the pin configurations must coincide with what was
343  * defined in CC2650DK_7ID.h
344  * NOTE: Pins not used for interrupts should be placed at the end of the
345  * array. Callback entries can be omitted from callbacks array to
346  * reduce memory usage.
347  */
348 GPIO_PinConfig gpioPinConfigs[] = {
349  /* Input pins */
350  GPIOCC26XX_DIO_11 | GPIO_DO_NOT_CONFIG, /* Key Select */
351  GPIOCC26XX_DIO_19 | GPIO_DO_NOT_CONFIG, /* Key Up */
352  GPIOCC26XX_DIO_12 | GPIO_DO_NOT_CONFIG, /* Key Down */
353  GPIOCC26XX_DIO_15 | GPIO_DO_NOT_CONFIG, /* Key Left */
354  GPIOCC26XX_DIO_18 | GPIO_DO_NOT_CONFIG, /* Key Right */
355 
356  GPIOCC26XX_DIO_15 | GPIO_DO_NOT_CONFIG, /* CC2650DK_7ID_SPI_MASTER_READY */
357  GPIOCC26XX_DIO_21 | GPIO_DO_NOT_CONFIG, /* CC2650DK_7ID_SPI_SLAVE_READY */
358 
359  /* Output pins */
360  GPIOCC26XX_DIO_25 | GPIO_DO_NOT_CONFIG, /* LED 1 */
361  GPIOCC26XX_DIO_27 | GPIO_DO_NOT_CONFIG, /* LED 2 */
362  GPIOCC26XX_DIO_07 | GPIO_DO_NOT_CONFIG, /* LED 3 */
363  GPIOCC26XX_DIO_06 | GPIO_DO_NOT_CONFIG, /* LED 4 */
364 
365  /* SDCARD */
366  GPIOCC26XX_DIO_30 | GPIO_DO_NOT_CONFIG, /* SPI chip select */
367 
368  /* Accelerometer */
369  GPIOCC26XX_DIO_24 | GPIO_DO_NOT_CONFIG, /* SPI chip select */
370 };
371 
372 /*
373  * Array of callback function pointers
374  * NOTE: The order of the pin configurations must coincide with what was
375  * defined in CC2650_LAUNCH.h
376  * NOTE: Pins not used for interrupts can be omitted from callbacks array to
377  * reduce memory usage (if placed at end of gpioPinConfigs array).
378  */
379 GPIO_CallbackFxn gpioCallbackFunctions[] = {
380  NULL, /* Button 0 */
381  NULL, /* Button 1 */
382  NULL, /* CC2650DK_7ID_SPI_MASTER_READY */
383  NULL, /* CC2650DK_7ID_SPI_SLAVE_READY */
384 };
385 
386 const GPIOCC26XX_Config GPIOCC26XX_config = {
387  .pinConfigs = (GPIO_PinConfig *)gpioPinConfigs,
388  .callbacks = (GPIO_CallbackFxn *)gpioCallbackFunctions,
389  .numberOfPinConfigs = CC2650DK_7ID_GPIOCOUNT,
390  .numberOfCallbacks = sizeof(gpioCallbackFunctions)/sizeof(GPIO_CallbackFxn),
391  .intPriority = (~0)
392 };
393 
394 /*
395  * =============================== GPTimer ===============================
396  * Remove unused entries to reduce flash usage both in Board.c and Board.h
397  */
398 #include <ti/drivers/timer/GPTimerCC26XX.h>
399 
400 GPTimerCC26XX_Object gptimerCC26XXObjects[CC2650DK_7ID_GPTIMERCOUNT];
401 
402 const GPTimerCC26XX_HWAttrs gptimerCC26xxHWAttrs[CC2650DK_7ID_GPTIMERPARTSCOUNT] = {
403  { .baseAddr = GPT0_BASE, .intNum = INT_GPT0A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0A, },
404  { .baseAddr = GPT0_BASE, .intNum = INT_GPT0B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0B, },
405  { .baseAddr = GPT1_BASE, .intNum = INT_GPT1A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1A, },
406  { .baseAddr = GPT1_BASE, .intNum = INT_GPT1B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1B, },
407  { .baseAddr = GPT2_BASE, .intNum = INT_GPT2A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2A, },
408  { .baseAddr = GPT2_BASE, .intNum = INT_GPT2B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2B, },
409  { .baseAddr = GPT3_BASE, .intNum = INT_GPT3A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3A, },
410  { .baseAddr = GPT3_BASE, .intNum = INT_GPT3B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3B, },
411 };
412 
413 const GPTimerCC26XX_Config GPTimerCC26XX_config[CC2650DK_7ID_GPTIMERPARTSCOUNT] = {
414  { &gptimerCC26XXObjects[CC2650DK_7ID_GPTIMER0], &gptimerCC26xxHWAttrs[CC2650DK_7ID_GPTIMER0A], GPT_A },
415  { &gptimerCC26XXObjects[CC2650DK_7ID_GPTIMER0], &gptimerCC26xxHWAttrs[CC2650DK_7ID_GPTIMER0B], GPT_B },
416  { &gptimerCC26XXObjects[CC2650DK_7ID_GPTIMER1], &gptimerCC26xxHWAttrs[CC2650DK_7ID_GPTIMER1A], GPT_A },
417  { &gptimerCC26XXObjects[CC2650DK_7ID_GPTIMER1], &gptimerCC26xxHWAttrs[CC2650DK_7ID_GPTIMER1B], GPT_B },
418  { &gptimerCC26XXObjects[CC2650DK_7ID_GPTIMER2], &gptimerCC26xxHWAttrs[CC2650DK_7ID_GPTIMER2A], GPT_A },
419  { &gptimerCC26XXObjects[CC2650DK_7ID_GPTIMER2], &gptimerCC26xxHWAttrs[CC2650DK_7ID_GPTIMER2B], GPT_B },
420  { &gptimerCC26XXObjects[CC2650DK_7ID_GPTIMER3], &gptimerCC26xxHWAttrs[CC2650DK_7ID_GPTIMER3A], GPT_A },
421  { &gptimerCC26XXObjects[CC2650DK_7ID_GPTIMER3], &gptimerCC26xxHWAttrs[CC2650DK_7ID_GPTIMER3B], GPT_B },
422 };
423 
424 /*
425  * =============================== I2C ===============================
426 */
427 #include <ti/drivers/I2C.h>
428 #include <ti/drivers/i2c/I2CCC26XX.h>
429 
430 #if TI_I2C_CONF_ENABLE
431 
432 I2CCC26XX_Object i2cCC26xxObjects[CC2650DK_7ID_I2CCOUNT];
433 
434 const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC2650DK_7ID_I2CCOUNT] = {
435 #if TI_I2C_CONF_I2C0_ENABLE
436  {
437  .baseAddr = I2C0_BASE,
438  .powerMngrId = PowerCC26XX_PERIPH_I2C0,
439  .intNum = INT_I2C_IRQ,
440  .intPriority = ~0,
441  .swiPriority = 0,
442  .sdaPin = CC2650DK_7ID_I2C0_SDA0,
443  .sclPin = CC2650DK_7ID_I2C0_SCL0,
444  },
445 #endif
446 };
447 
448 const I2C_Config I2C_config[CC2650DK_7ID_I2CCOUNT] = {
449 #if TI_I2C_CONF_I2C0_ENABLE
450  {
451  .fxnTablePtr = &I2CCC26XX_fxnTable,
452  .object = &i2cCC26xxObjects[CC2650DK_7ID_I2C0],
453  .hwAttrs = &i2cCC26xxHWAttrs[CC2650DK_7ID_I2C0]
454  },
455 #endif
456 };
457 
458 const uint_least8_t I2C_count = CC2650DK_7ID_I2CCOUNT;
459 
460 #endif /* TI_I2C_CONF_ENABLE */
461 
462 /*
463  * =============================== I2S ===============================
464 */
465 #include <ti/drivers/I2S.h>
466 #include <ti/drivers/i2s/I2SCC26XX.h>
467 
468 I2SCC26XX_Object i2sCC26XXObjects[CC2650DK_7ID_I2SCOUNT];
469 
470 const I2SCC26XX_HWAttrs i2sCC26XXHWAttrs[CC2650DK_7ID_I2SCOUNT] = {
471  {
472  .pinSD1 = CC2650DK_7ID_I2S_ADI,
473  .pinSD0 = CC2650DK_7ID_I2S_ADO,
474  .pinSCK = CC2650DK_7ID_I2S_BCLK,
475  .pinMCLK = CC2650DK_7ID_I2S_MCLK,
476  .pinWS = CC2650DK_7ID_I2S_WCLK,
477  .intPriority = ~0,
478  }
479 };
480 
481 const I2S_Config I2S_config[CC2650DK_7ID_I2SCOUNT] = {
482  {
483  .object = &i2sCC26XXObjects[CC2650DK_7ID_I2S0],
484  .hwAttrs = &i2sCC26XXHWAttrs[CC2650DK_7ID_I2S0]
485  },
486 };
487 
488 const uint_least8_t I2S_count = CC2650DK_7ID_I2SCOUNT;
489 
490 /*
491  * =============================== NVS ===============================
492  */
493 #include <ti/drivers/NVS.h>
494 #include <ti/drivers/nvs/NVSSPI25X.h>
495 #include <ti/drivers/nvs/NVSCC26XX.h>
496 
497 #define NVS_REGIONS_BASE 0x1A000
498 #define SECTORSIZE 0x1000
499 #define REGIONSIZE (SECTORSIZE * 4)
500 
501 #if TI_NVS_CONF_ENABLE
502 
503 #if TI_NVS_CONF_NVS_INTERNAL_ENABLE
504 
505 /*
506  * Reserve flash sectors for NVS driver use by placing an uninitialized byte
507  * array at the desired flash address.
508  */
509 #if defined(__TI_COMPILER_VERSION__)
510 
511 /*
512  * Place uninitialized array at NVS_REGIONS_BASE
513  */
514 #pragma LOCATION(flashBuf, NVS_REGIONS_BASE);
515 #pragma NOINIT(flashBuf);
516 static char flashBuf[REGIONSIZE];
517 
518 #elif defined(__IAR_SYSTEMS_ICC__)
519 
520 /*
521  * Place uninitialized array at NVS_REGIONS_BASE
522  */
523 static __no_init char flashBuf[REGIONSIZE] @ NVS_REGIONS_BASE;
524 
525 #elif defined(__GNUC__)
526 
527 /*
528  * Place the flash buffers in the .nvs section created in the gcc linker file.
529  * The .nvs section enforces alignment on a sector boundary but may
530  * be placed anywhere in flash memory. If desired the .nvs section can be set
531  * to a fixed address by changing the following in the gcc linker file:
532  *
533  * .nvs (FIXED_FLASH_ADDR) (NOLOAD) : AT (FIXED_FLASH_ADDR) {
534  * *(.nvs)
535  * } > REGION_TEXT
536  */
537 __attribute__ ((section (".nvs")))
538 static char flashBuf[REGIONSIZE];
539 
540 #endif
541 
542 /* Allocate objects for NVS Internal Regions */
543 NVSCC26XX_Object nvsCC26xxObjects[1];
544 
545 /* Hardware attributes for NVS Internal Regions */
546 const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = {
547  {
548  .regionBase = (void *)flashBuf,
549  .regionSize = REGIONSIZE,
550  },
551 };
552 
553 #endif /* TI_NVS_CONF_NVS_INTERNAL_ENABLE */
554 
555 /* NVS Region index 0 and 1 refer to NVS and NVS SPI respectively */
556 const NVS_Config NVS_config[CC2650DK_7ID_NVSCOUNT] = {
557 #if TI_NVS_CONF_NVS_INTERNAL_ENABLE
558  {
559  .fxnTablePtr = &NVSCC26XX_fxnTable,
560  .object = &nvsCC26xxObjects[0],
561  .hwAttrs = &nvsCC26xxHWAttrs[0],
562  },
563 #endif
564 };
565 
566 const uint_least8_t NVS_count = CC2650DK_7ID_NVSCOUNT;
567 
568 #endif /* TI_NVS_CONF_ENABLE */
569 
570 /*
571  * =============================== PIN ===============================
572  */
573 #include <ti/drivers/PIN.h>
574 #include <ti/drivers/pin/PINCC26XX.h>
575 
576 const PIN_Config BoardGpioInitTable[] = {
577 
578  CC2650DK_7ID_PIN_LED1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
579  CC2650DK_7ID_PIN_LED2 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
580  CC2650DK_7ID_PIN_LED3 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
581  CC2650DK_7ID_PIN_LED4 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
582  CC2650DK_7ID_PIN_KEY_SELECT | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
583  CC2650DK_7ID_PIN_KEY_UP | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
584  CC2650DK_7ID_PIN_KEY_DOWN | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
585  CC2650DK_7ID_PIN_KEY_LEFT | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
586  CC2650DK_7ID_PIN_KEY_UP | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
587  CC2650DK_7ID_SPI_SDCARD_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */
588  CC2650DK_7ID_ACC_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */
589  CC2650DK_7ID_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN, /* UART RX via debugger back channel */
590  CC2650DK_7ID_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* UART TX via debugger back channel */
591  CC2650DK_7ID_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */
592  CC2650DK_7ID_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */
593  CC2650DK_7ID_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI clock */
594 
595  PIN_TERMINATE
596 };
597 
598 const PINCC26XX_HWAttrs PINCC26XX_hwAttrs = {
599  .intPriority = ~0,
600  .swiPriority = 0
601 };
602 
603 /*
604  * =============================== Power ===============================
605  */
606 #include <ti/drivers/Power.h>
607 #include <ti/drivers/power/PowerCC26XX.h>
608 #include "clock-arch.h"
609 
610 const PowerCC26XX_Config PowerCC26XX_config = {
611  .policyInitFxn = NULL,
612  .policyFxn = &clock_arch_standby_policy,
613  .calibrateFxn = &PowerCC26XX_calibrate,
614  .enablePolicy = true,
615  .calibrateRCOSC_LF = true,
616  .calibrateRCOSC_HF = true,
617 };
618 
619 /*
620  * =============================== PWM ===============================
621  * Remove unused entries to reduce flash usage both in Board.c and Board.h
622  */
623 #include <ti/drivers/PWM.h>
624 #include <ti/drivers/pwm/PWMTimerCC26XX.h>
625 
626 PWMTimerCC26XX_Object pwmtimerCC26xxObjects[CC2650DK_7ID_PWMCOUNT];
627 
628 const PWMTimerCC26XX_HwAttrs pwmtimerCC26xxHWAttrs[CC2650DK_7ID_PWMCOUNT] = {
629  { .pwmPin = CC2650DK_7ID_PWMPIN0, .gpTimerUnit = CC2650DK_7ID_GPTIMER0A },
630  { .pwmPin = CC2650DK_7ID_PWMPIN1, .gpTimerUnit = CC2650DK_7ID_GPTIMER0B },
631  { .pwmPin = CC2650DK_7ID_PWMPIN2, .gpTimerUnit = CC2650DK_7ID_GPTIMER1A },
632  { .pwmPin = CC2650DK_7ID_PWMPIN3, .gpTimerUnit = CC2650DK_7ID_GPTIMER1B },
633  { .pwmPin = CC2650DK_7ID_PWMPIN4, .gpTimerUnit = CC2650DK_7ID_GPTIMER2A },
634  { .pwmPin = CC2650DK_7ID_PWMPIN5, .gpTimerUnit = CC2650DK_7ID_GPTIMER2B },
635  { .pwmPin = CC2650DK_7ID_PWMPIN6, .gpTimerUnit = CC2650DK_7ID_GPTIMER3A },
636  { .pwmPin = CC2650DK_7ID_PWMPIN7, .gpTimerUnit = CC2650DK_7ID_GPTIMER3B },
637 };
638 
639 const PWM_Config PWM_config[CC2650DK_7ID_PWMCOUNT] = {
640  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650DK_7ID_PWM0], &pwmtimerCC26xxHWAttrs[CC2650DK_7ID_PWM0] },
641  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650DK_7ID_PWM1], &pwmtimerCC26xxHWAttrs[CC2650DK_7ID_PWM1] },
642  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650DK_7ID_PWM2], &pwmtimerCC26xxHWAttrs[CC2650DK_7ID_PWM2] },
643  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650DK_7ID_PWM3], &pwmtimerCC26xxHWAttrs[CC2650DK_7ID_PWM3] },
644  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650DK_7ID_PWM4], &pwmtimerCC26xxHWAttrs[CC2650DK_7ID_PWM4] },
645  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650DK_7ID_PWM5], &pwmtimerCC26xxHWAttrs[CC2650DK_7ID_PWM5] },
646  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650DK_7ID_PWM6], &pwmtimerCC26xxHWAttrs[CC2650DK_7ID_PWM6] },
647  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC2650DK_7ID_PWM7], &pwmtimerCC26xxHWAttrs[CC2650DK_7ID_PWM7] },
648 };
649 
650 const uint_least8_t PWM_count = CC2650DK_7ID_PWMCOUNT;
651 
652 /*
653  * =============================== RF Driver ===============================
654  */
655 #include <ti/drivers/rf/RF.h>
656 
657 const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = {
658  .hwiPriority = ~0, /* Lowest HWI priority */
659  .swiPriority = 0, /* Lowest SWI priority */
660  .xoscHfAlwaysNeeded = true, /* Keep XOSC dependency while in stanby */
661  .globalCallback = NULL, /* No board specific callback */
662  .globalEventMask = 0 /* No events subscribed to */
663 };
664 
665 /*
666  * =============================== SD ===============================
667  */
668 #include <ti/drivers/SD.h>
669 #include <ti/drivers/sd/SDSPI.h>
670 
671 #if TI_SD_CONF_ENABLE
672 
673 #if !(TI_SPI_CONF_SPI0_ENABLE)
674 #error "SD driver requires SPI0 enabled"
675 #endif
676 
677 SDSPI_Object sdspiObjects[CC2650DK_7ID_SDCOUNT];
678 
679 const SDSPI_HWAttrs sdspiHWAttrs[CC2650DK_7ID_SDCOUNT] = {
680  {
681  .spiIndex = CC2650DK_7ID_SPI0,
682  .spiCsGpioIndex = CC2650DK_7ID_SDSPI_CS
683  }
684 };
685 
686 const SD_Config SD_config[CC2650DK_7ID_SDCOUNT] = {
687  {
688  .fxnTablePtr = &SDSPI_fxnTable,
689  .object = &sdspiObjects[CC2650DK_7ID_SDSPI0],
690  .hwAttrs = &sdspiHWAttrs[CC2650DK_7ID_SDSPI0]
691  },
692 };
693 
694 const uint_least8_t SD_count = CC2650DK_7ID_SDCOUNT;
695 
696 #endif /* TI_SD_CONF_ENABLE */
697 
698 /*
699  * =============================== SPI DMA ===============================
700  */
701 #include <ti/drivers/SPI.h>
702 #include <ti/drivers/spi/SPICC26XXDMA.h>
703 
704 #if TI_SPI_CONF_ENABLE
705 
706 SPICC26XXDMA_Object spiCC26XXDMAObjects[CC2650DK_7ID_SPICOUNT];
707 
708 /*
709  * NOTE: The SPI instances below can be used by the SD driver to communicate
710  * with a SD card via SPI. The 'defaultTxBufValue' fields below are set to 0xFF
711  * to satisfy the SDSPI driver requirement.
712  */
713 const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC2650DK_7ID_SPICOUNT] = {
714 #if TI_SPI_CONF_SPI0_ENABLE
715  {
716  .baseAddr = SSI0_BASE,
717  .intNum = INT_SSI0_COMB,
718  .intPriority = ~0,
719  .swiPriority = 0,
720  .powerMngrId = PowerCC26XX_PERIPH_SSI0,
721  .defaultTxBufValue = 0xFF,
722  .rxChannelBitMask = 1<<UDMA_CHAN_SSI0_RX,
723  .txChannelBitMask = 1<<UDMA_CHAN_SSI0_TX,
724  .mosiPin = CC2650DK_7ID_SPI0_MOSI,
725  .misoPin = CC2650DK_7ID_SPI0_MISO,
726  .clkPin = CC2650DK_7ID_SPI0_CLK,
727  .csnPin = CC2650DK_7ID_SPI0_CSN,
728  .minDmaTransferSize = 10
729  },
730 #endif
731 #if TI_SPI_CONF_SPI1_ENABLE
732  {
733  .baseAddr = SSI1_BASE,
734  .intNum = INT_SSI1_COMB,
735  .intPriority = ~0,
736  .swiPriority = 0,
737  .powerMngrId = PowerCC26XX_PERIPH_SSI1,
738  .defaultTxBufValue = 0xFF,
739  .rxChannelBitMask = 1<<UDMA_CHAN_SSI1_RX,
740  .txChannelBitMask = 1<<UDMA_CHAN_SSI1_TX,
741  .mosiPin = CC2650DK_7ID_SPI1_MOSI,
742  .misoPin = CC2650DK_7ID_SPI1_MISO,
743  .clkPin = CC2650DK_7ID_SPI1_CLK,
744  .csnPin = CC2650DK_7ID_SPI1_CSN,
745  .minDmaTransferSize = 10
746  },
747 #endif
748 };
749 
750 const SPI_Config SPI_config[CC2650DK_7ID_SPICOUNT] = {
751 #if TI_SPI_CONF_SPI0_ENABLE
752  {
753  .fxnTablePtr = &SPICC26XXDMA_fxnTable,
754  .object = &spiCC26XXDMAObjects[CC2650DK_7ID_SPI0],
755  .hwAttrs = &spiCC26XXDMAHWAttrs[CC2650DK_7ID_SPI0]
756  },
757 #endif
758 #if TI_SPI_CONF_SPI1_ENABLE
759  {
760  .fxnTablePtr = &SPICC26XXDMA_fxnTable,
761  .object = &spiCC26XXDMAObjects[CC2650DK_7ID_SPI1],
762  .hwAttrs = &spiCC26XXDMAHWAttrs[CC2650DK_7ID_SPI1]
763  },
764 #endif
765 };
766 
767 const uint_least8_t SPI_count = CC2650DK_7ID_SPICOUNT;
768 
769 #endif /* TI_SPI_CONF_ENABLE */
770 
771 /*
772  * =============================== UART ===============================
773  */
774 #include <ti/drivers/UART.h>
775 #include <ti/drivers/uart/UARTCC26XX.h>
776 
777 #if TI_UART_CONF_ENABLE
778 
779 UARTCC26XX_Object uartCC26XXObjects[CC2650DK_7ID_UARTCOUNT];
780 
781 uint8_t uartCC26XXRingBuffer[CC2650DK_7ID_UARTCOUNT][32];
782 
783 const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC2650DK_7ID_UARTCOUNT] = {
784 #if TI_UART_CONF_UART0_ENABLE
785  {
786  .baseAddr = UART0_BASE,
787  .powerMngrId = PowerCC26XX_PERIPH_UART0,
788  .intNum = INT_UART0_COMB,
789  .intPriority = ~0,
790  .swiPriority = 0,
791  .txPin = CC2650DK_7ID_UART_TX,
792  .rxPin = CC2650DK_7ID_UART_RX,
793  .ctsPin = PIN_UNASSIGNED,
794  .rtsPin = PIN_UNASSIGNED,
795  .ringBufPtr = uartCC26XXRingBuffer[CC2650DK_7ID_UART0],
796  .ringBufSize = sizeof(uartCC26XXRingBuffer[CC2650DK_7ID_UART0]),
797  .txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8,
798  .rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8,
799  .errorFxn = NULL
800  },
801 #endif
802 };
803 
804 const UART_Config UART_config[CC2650DK_7ID_UARTCOUNT] = {
805 #if TI_UART_CONF_UART0_ENABLE
806  {
807  .fxnTablePtr = &UARTCC26XX_fxnTable,
808  .object = &uartCC26XXObjects[CC2650DK_7ID_UART0],
809  .hwAttrs = &uartCC26XXHWAttrs[CC2650DK_7ID_UART0]
810  },
811 #endif
812 };
813 
814 const uint_least8_t UART_count = CC2650DK_7ID_UARTCOUNT;
815 
816 #endif /* TI_UART_CONF_ENABLE */
817 
818 /*
819  * =============================== UDMA ===============================
820  */
821 #include <ti/drivers/dma/UDMACC26XX.h>
822 
823 UDMACC26XX_Object udmaObjects[CC2650DK_7ID_UDMACOUNT];
824 
825 const UDMACC26XX_HWAttrs udmaHWAttrs[CC2650DK_7ID_UDMACOUNT] = {
826  {
827  .baseAddr = UDMA0_BASE,
828  .powerMngrId = PowerCC26XX_PERIPH_UDMA,
829  .intNum = INT_DMA_ERR,
830  .intPriority = ~0
831  }
832 };
833 
834 const UDMACC26XX_Config UDMACC26XX_config[CC2650DK_7ID_UDMACOUNT] = {
835  {
836  .object = &udmaObjects[CC2650DK_7ID_UDMA0],
837  .hwAttrs = &udmaHWAttrs[CC2650DK_7ID_UDMA0]
838  },
839 };
840 
841 
842 
843 /*
844  * =============================== Watchdog ===============================
845  */
846 #include <ti/drivers/Watchdog.h>
847 #include <ti/drivers/watchdog/WatchdogCC26XX.h>
848 
849 WatchdogCC26XX_Object watchdogCC26XXObjects[CC2650DK_7ID_WATCHDOGCOUNT];
850 
851 const WatchdogCC26XX_HWAttrs watchdogCC26XXHWAttrs[CC2650DK_7ID_WATCHDOGCOUNT] = {
852  {
853  .baseAddr = WDT_BASE,
854  .reloadValue = 1000 /* Reload value in milliseconds */
855  },
856 };
857 
858 const Watchdog_Config Watchdog_config[CC2650DK_7ID_WATCHDOGCOUNT] = {
859  {
860  .fxnTablePtr = &WatchdogCC26XX_fxnTable,
861  .object = &watchdogCC26XXObjects[CC2650DK_7ID_WATCHDOG0],
862  .hwAttrs = &watchdogCC26XXHWAttrs[CC2650DK_7ID_WATCHDOG0]
863  },
864 };
865 
866 const uint_least8_t Watchdog_count = CC2650DK_7ID_WATCHDOGCOUNT;
867 
868 /*
869  * Board-specific initialization function to disable external flash.
870  * This function is defined in the file CC2650DK_7ID_fxns.c
871  */
872 extern void Board_initHook(void);
873 
874 /*
875  * ======== CC2650DK_7ID_initGeneral ========
876  */
878 {
879  Power_init();
880 
881  if (PIN_init(BoardGpioInitTable) != PIN_SUCCESS) {
882  /* Error with PIN_init */
883  while (1);
884  }
885 
886  /* Perform board-specific initialization */
887  Board_initHook();
888 }
889 
890 /*
891  * ======== Board_init ========
892  */
893 void Board_init(void)
894 {
896 }
void CC2650DK_7ID_initGeneral(void)
Initialize the general board specific settings.
Definition: CC2650DK_7ID.c:877
#define SSI1_BASE
Base address for SSI1.
Definition: ssi.h:59
#define SSI0_BASE
Base address for SSI0.
Definition: ssi.h:58
============================================================================
Header file for the CC13xx/CC26xx clock implementation.
void clock_arch_standby_policy(void)
Called by the Power driver when dropping to some low-power state.
Definition: clock-arch.c:184