Contiki-NG
CC1350DK_7XD.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  * ====================== CC1350DK_7XD.c ===================================
35  * This file is responsible for setting up the board specific items for the
36  * CC1350DK_7XD 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 "CC1350DK_7XD.h"
50 
51 /*
52  * =============================== ADCBuf ===============================
53  */
54 #include <ti/drivers/ADCBuf.h>
55 #include <ti/drivers/adcbuf/ADCBufCC26XX.h>
56 
57 ADCBufCC26XX_Object adcBufCC26xxObjects[CC1350DK_7XD_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[CC1350DK_7XD_ADCBUF0CHANNELCOUNT] = {
67  {CC1350DK_7XD_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[CC1350DK_7XD_ADCBUFCOUNT] = {
74  {
75  .intPriority = ~0,
76  .swiPriority = 0,
77  .adcChannelLut = ADCBufCC26XX_adcChannelLut,
78  }
79 };
80 
81 const ADCBuf_Config ADCBuf_config[CC1350DK_7XD_ADCBUFCOUNT] = {
82  {
83  &ADCBufCC26XX_fxnTable,
84  &adcBufCC26xxObjects[CC1350DK_7XD_ADCBUF0],
85  &adcBufCC26xxHWAttrs[CC1350DK_7XD_ADCBUF0]
86  },
87 };
88 
89 const uint_least8_t ADCBuf_count = CC1350DK_7XD_ADCBUFCOUNT;
90 
91 /*
92  * =============================== ADC ===============================
93  */
94 #include <ti/drivers/ADC.h>
95 #include <ti/drivers/adc/ADCCC26XX.h>
96 
97 ADCCC26XX_Object adcCC26xxObjects[CC1350DK_7XD_ADCCOUNT];
98 
99 const ADCCC26XX_HWAttrs adcCC26xxHWAttrs[CC1350DK_7XD_ADCCOUNT] = {
100  {
101  .adcDIO = CC1350DK_7XD_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[CC1350DK_7XD_ADCCOUNT] = {
139  {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350DK_7XD_ADCALS], &adcCC26xxHWAttrs[CC1350DK_7XD_ADCALS]},
140  {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350DK_7XD_ADCDCOUPL], &adcCC26xxHWAttrs[CC1350DK_7XD_ADCDCOUPL]},
141  {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350DK_7XD_ADCVSS], &adcCC26xxHWAttrs[CC1350DK_7XD_ADCVSS]},
142  {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350DK_7XD_ADCVDDS], &adcCC26xxHWAttrs[CC1350DK_7XD_ADCVDDS]},
143 };
144 
145 const uint_least8_t ADC_count = CC1350DK_7XD_ADCCOUNT;
146 
147 /*
148  * =============================== Crypto ===============================
149  */
150 #include <ti/drivers/crypto/CryptoCC26XX.h>
151 
152 CryptoCC26XX_Object cryptoCC26XXObjects[CC1350DK_7XD_CRYPTOCOUNT];
153 
154 const CryptoCC26XX_HWAttrs cryptoCC26XXHWAttrs[CC1350DK_7XD_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[CC1350DK_7XD_CRYPTOCOUNT] = {
164  {
165  .object = &cryptoCC26XXObjects[CC1350DK_7XD_CRYPTO0],
166  .hwAttrs = &cryptoCC26XXHWAttrs[CC1350DK_7XD_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[CC1350DK_7XD_AESCCMCOUNT];
177 
178 const AESCCMCC26XX_HWAttrs aesccmCC26XXHWAttrs[CC1350DK_7XD_AESCCMCOUNT] = {
179  {
180  .intPriority = ~0,
181  }
182 };
183 
184 const AESCCM_Config AESCCM_config[CC1350DK_7XD_AESCCMCOUNT] = {
185  {
186  .object = &aesccmCC26XXObjects[CC1350DK_7XD_AESCCM0],
187  .hwAttrs = &aesccmCC26XXHWAttrs[CC1350DK_7XD_AESCCM0]
188  },
189 };
190 
191 const uint_least8_t AESCCM_count = CC1350DK_7XD_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[CC1350DK_7XD_AESGCMCOUNT];
201 
202 const AESGCMCC26XX_HWAttrs aesgcmCC26XXHWAttrs[CC1350DK_7XD_AESGCMCOUNT] = {
203  {
204  .intPriority = ~0,
205  }
206 };
207 
208 const AESGCM_Config AESGCM_config[CC1350DK_7XD_AESGCMCOUNT] = {
209  {
210  .object = &aesgcmCC26XXObjects[CC1350DK_7XD_AESGCM0],
211  .hwAttrs = &aesgcmCC26XXHWAttrs[CC1350DK_7XD_AESGCM0]
212  },
213 };
214 
215 const uint_least8_t AESGCM_count = CC1350DK_7XD_AESGCMCOUNT;
216 
217 /*
218  * =============================== AESCBC ===============================
219  */
220 #include <ti/drivers/AESCBC.h>
221 #include <ti/drivers/aescbc/AESCBCCC26XX.h>
222 
223 AESCBCCC26XX_Object aescbcCC26XXObjects[CC1350DK_7XD_AESCBCCOUNT];
224 
225 const AESCBCCC26XX_HWAttrs aescbcCC26XXHWAttrs[CC1350DK_7XD_AESCBCCOUNT] = {
226  {
227  .intPriority = ~0,
228  }
229 };
230 
231 const AESCBC_Config AESCBC_config[CC1350DK_7XD_AESCBCCOUNT] = {
232  {
233  .object = &aescbcCC26XXObjects[CC1350DK_7XD_AESCBC0],
234  .hwAttrs = &aescbcCC26XXHWAttrs[CC1350DK_7XD_AESCBC0]
235  },
236 };
237 
238 const uint_least8_t AESCBC_count = CC1350DK_7XD_AESCBCCOUNT;
239 
240 /*
241  * =============================== AESCTR ===============================
242  */
243 #include <ti/drivers/AESCTR.h>
244 #include <ti/drivers/aesctr/AESCTRCC26XX.h>
245 
246 AESCTRCC26XX_Object aesctrCC26XXObjects[CC1350DK_7XD_AESCTRCOUNT];
247 
248 const AESCTRCC26XX_HWAttrs aesctrCC26XXHWAttrs[CC1350DK_7XD_AESCTRCOUNT] = {
249  {
250  .intPriority = ~0,
251  }
252 };
253 
254 const AESCTR_Config AESCTR_config[CC1350DK_7XD_AESCTRCOUNT] = {
255  {
256  .object = &aesctrCC26XXObjects[CC1350DK_7XD_AESCTR0],
257  .hwAttrs = &aesctrCC26XXHWAttrs[CC1350DK_7XD_AESCTR0]
258  },
259 };
260 
261 const uint_least8_t AESCTR_count = CC1350DK_7XD_AESCTRCOUNT;
262 
263 /*
264  * =============================== AESECB ===============================
265  */
266 #include <ti/drivers/AESECB.h>
267 #include <ti/drivers/aesecb/AESECBCC26XX.h>
268 
269 AESECBCC26XX_Object aesecbCC26XXObjects[CC1350DK_7XD_AESECBCOUNT];
270 
271 const AESECBCC26XX_HWAttrs aesecbCC26XXHWAttrs[CC1350DK_7XD_AESECBCOUNT] = {
272  {
273  .intPriority = ~0,
274  }
275 };
276 
277 const AESECB_Config AESECB_config[CC1350DK_7XD_AESECBCOUNT] = {
278  {
279  .object = &aesecbCC26XXObjects[CC1350DK_7XD_AESECB0],
280  .hwAttrs = &aesecbCC26XXHWAttrs[CC1350DK_7XD_AESECB0]
281  },
282 };
283 
284 const uint_least8_t AESECB_count = CC1350DK_7XD_AESECBCOUNT;
285 
286 /*
287  * =============================== AESCTRDRBG ===============================
288  */
289 #include <ti/drivers/AESCTRDRBG.h>
290 #include <ti/drivers/aesctrdrbg/AESCTRDRBGXX.h>
291 
292 AESCTRDRBGXX_Object aesctrdrbgXXObjects[CC1350DK_7XD_AESCTRDRBGCOUNT];
293 
294 const AESCTRDRBGXX_HWAttrs aesctrdrbgXXHWAttrs[CC1350DK_7XD_AESCTRDRBGCOUNT] = {
295  {
296  .aesctrIndex = CC1350DK_7XD_AESCTR0,
297  }
298 };
299 
300 const AESCTRDRBG_Config AESCTRDRBG_config[CC1350DK_7XD_AESCTRDRBGCOUNT] = {
301  {
302  .object = &aesctrdrbgXXObjects[CC1350DK_7XD_AESCTRDRBG0],
303  .hwAttrs = &aesctrdrbgXXHWAttrs[CC1350DK_7XD_AESCTRDRBG0]
304  },
305 };
306 
307 const uint_least8_t AESCTRDRBG_count = CC1350DK_7XD_AESCTRDRBGCOUNT;
308 
309 /*
310  * =============================== TRNG ===============================
311  */
312 #include <ti/drivers/TRNG.h>
313 #include <ti/drivers/trng/TRNGCC26XX.h>
314 
315 TRNGCC26XX_Object trngCC26XXObjects[CC1350DK_7XD_TRNGCOUNT];
316 
317 const TRNGCC26XX_HWAttrs trngCC26X2HWAttrs[CC1350DK_7XD_TRNGCOUNT] = {
318  {
319  .intPriority = ~0,
320  .swiPriority = 0,
321  .samplesPerCycle = 240000,
322  }
323 };
324 
325 const TRNG_Config TRNG_config[CC1350DK_7XD_TRNGCOUNT] = {
326  {
327  .object = &trngCC26XXObjects[CC1350DK_7XD_TRNG0],
328  .hwAttrs = &trngCC26X2HWAttrs[CC1350DK_7XD_TRNG0]
329  },
330 };
331 
332 const uint_least8_t TRNG_count = CC1350DK_7XD_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 CC1350DK_7XD.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, /* CC1350DK_7XD_SPI_MASTER_READY */
357  GPIOCC26XX_DIO_21 | GPIO_DO_NOT_CONFIG, /* CC1350DK_7XD_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 CC1350DK_7XD.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, /* CC1350DK_7XD_SPI_MASTER_READY */
383  NULL, /* CC1350DK_7XD_SPI_SLAVE_READY */
384 };
385 
386 const GPIOCC26XX_Config GPIOCC26XX_config = {
387  .pinConfigs = (GPIO_PinConfig *)gpioPinConfigs,
388  .callbacks = (GPIO_CallbackFxn *)gpioCallbackFunctions,
389  .numberOfPinConfigs = CC1350DK_7XD_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[CC1350DK_7XD_GPTIMERCOUNT];
401 
402 const GPTimerCC26XX_HWAttrs gptimerCC26xxHWAttrs[CC1350DK_7XD_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[CC1350DK_7XD_GPTIMERPARTSCOUNT] = {
414  { &gptimerCC26XXObjects[CC1350DK_7XD_GPTIMER0], &gptimerCC26xxHWAttrs[CC1350DK_7XD_GPTIMER0A], GPT_A },
415  { &gptimerCC26XXObjects[CC1350DK_7XD_GPTIMER0], &gptimerCC26xxHWAttrs[CC1350DK_7XD_GPTIMER0B], GPT_B },
416  { &gptimerCC26XXObjects[CC1350DK_7XD_GPTIMER1], &gptimerCC26xxHWAttrs[CC1350DK_7XD_GPTIMER1A], GPT_A },
417  { &gptimerCC26XXObjects[CC1350DK_7XD_GPTIMER1], &gptimerCC26xxHWAttrs[CC1350DK_7XD_GPTIMER1B], GPT_B },
418  { &gptimerCC26XXObjects[CC1350DK_7XD_GPTIMER2], &gptimerCC26xxHWAttrs[CC1350DK_7XD_GPTIMER2A], GPT_A },
419  { &gptimerCC26XXObjects[CC1350DK_7XD_GPTIMER2], &gptimerCC26xxHWAttrs[CC1350DK_7XD_GPTIMER2B], GPT_B },
420  { &gptimerCC26XXObjects[CC1350DK_7XD_GPTIMER3], &gptimerCC26xxHWAttrs[CC1350DK_7XD_GPTIMER3A], GPT_A },
421  { &gptimerCC26XXObjects[CC1350DK_7XD_GPTIMER3], &gptimerCC26xxHWAttrs[CC1350DK_7XD_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[CC1350DK_7XD_I2CCOUNT];
433 
434 const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC1350DK_7XD_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 = CC1350DK_7XD_I2C0_SDA0,
443  .sclPin = CC1350DK_7XD_I2C0_SCL0,
444  },
445 #endif
446 };
447 
448 const I2C_Config I2C_config[CC1350DK_7XD_I2CCOUNT] = {
449 #if TI_I2C_CONF_I2C0_ENABLE
450  {
451  .fxnTablePtr = &I2CCC26XX_fxnTable,
452  .object = &i2cCC26xxObjects[CC1350DK_7XD_I2C0],
453  .hwAttrs = &i2cCC26xxHWAttrs[CC1350DK_7XD_I2C0]
454  },
455 #endif
456 };
457 
458 const uint_least8_t I2C_count = CC1350DK_7XD_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[CC1350DK_7XD_I2SCOUNT];
469 
470 const I2SCC26XX_HWAttrs i2sCC26XXHWAttrs[CC1350DK_7XD_I2SCOUNT] = {
471  {
472  .pinSD1 = CC1350DK_7XD_I2S_ADI,
473  .pinSD0 = CC1350DK_7XD_I2S_ADO,
474  .pinSCK = CC1350DK_7XD_I2S_BCLK,
475  .pinMCLK = CC1350DK_7XD_I2S_MCLK,
476  .pinWS = CC1350DK_7XD_I2S_WCLK,
477  .intPriority = ~0,
478  }
479 };
480 
481 const I2S_Config I2S_config[CC1350DK_7XD_I2SCOUNT] = {
482  {
483  .object = &i2sCC26XXObjects[CC1350DK_7XD_I2S0],
484  .hwAttrs = &i2sCC26XXHWAttrs[CC1350DK_7XD_I2S0]
485  },
486 };
487 
488 const uint_least8_t I2S_count = CC1350DK_7XD_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  * Reserve flash sectors for NVS driver use by placing an uninitialized byte
506  * array at the desired flash address.
507  */
508 #if defined(__TI_COMPILER_VERSION__)
509 
510 /*
511  * Place uninitialized array at NVS_REGIONS_BASE
512  */
513 #pragma LOCATION(flashBuf, NVS_REGIONS_BASE);
514 #pragma NOINIT(flashBuf);
515 static char flashBuf[REGIONSIZE];
516 
517 #elif defined(__IAR_SYSTEMS_ICC__)
518 
519 /*
520  * Place uninitialized array at NVS_REGIONS_BASE
521  */
522 static __no_init char flashBuf[REGIONSIZE] @ NVS_REGIONS_BASE;
523 
524 #elif defined(__GNUC__)
525 
526 /*
527  * Place the flash buffers in the .nvs section created in the gcc linker file.
528  * The .nvs section enforces alignment on a sector boundary but may
529  * be placed anywhere in flash memory. If desired the .nvs section can be set
530  * to a fixed address by changing the following in the gcc linker file:
531  *
532  * .nvs (FIXED_FLASH_ADDR) (NOLOAD) : AT (FIXED_FLASH_ADDR) {
533  * *(.nvs)
534  * } > REGION_TEXT
535  */
536 __attribute__ ((section (".nvs")))
537 static char flashBuf[REGIONSIZE];
538 
539 #endif
540 
541 /* Allocate objects for NVS Internal Regions */
542 NVSCC26XX_Object nvsCC26xxObjects[1];
543 
544 /* Hardware attributes for NVS Internal Regions */
545 const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = {
546  {
547  .regionBase = (void *)flashBuf,
548  .regionSize = REGIONSIZE,
549  },
550 };
551 
552 #endif /* TI_NVS_CONF_NVS_INTERNAL_ENABLE */
553 
554 /* NVS Region index 0 and 1 refer to NVS and NVS SPI respectively */
555 const NVS_Config NVS_config[CC1350DK_7XD_NVSCOUNT] = {
556 #if TI_NVS_CONF_NVS_INTERNAL_ENABLE
557  {
558  .fxnTablePtr = &NVSCC26XX_fxnTable,
559  .object = &nvsCC26xxObjects[0],
560  .hwAttrs = &nvsCC26xxHWAttrs[0],
561  },
562 #endif
563 };
564 
565 const uint_least8_t NVS_count = CC1350DK_7XD_NVSCOUNT;
566 
567 #endif /* TI_NVS_CONF_ENABLE */
568 
569 /*
570  * =============================== PIN ===============================
571  */
572 #include <ti/drivers/PIN.h>
573 #include <ti/drivers/pin/PINCC26XX.h>
574 
575 const PIN_Config BoardGpioInitTable[] = {
576 
577  CC1350DK_7XD_PIN_LED1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
578  CC1350DK_7XD_PIN_LED2 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
579  CC1350DK_7XD_PIN_LED3 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
580  CC1350DK_7XD_PIN_LED4 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
581  CC1350DK_7XD_PIN_KEY_SELECT | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
582  CC1350DK_7XD_PIN_KEY_UP | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
583  CC1350DK_7XD_PIN_KEY_DOWN | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
584  CC1350DK_7XD_PIN_KEY_LEFT | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
585  CC1350DK_7XD_PIN_KEY_UP | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
586  CC1350DK_7XD_SPI_SDCARD_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */
587  CC1350DK_7XD_ACC_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */
588  CC1350DK_7XD_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN, /* UART RX via debugger back channel */
589  CC1350DK_7XD_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* UART TX via debugger back channel */
590  CC1350DK_7XD_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */
591  CC1350DK_7XD_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */
592  CC1350DK_7XD_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI clock */
593 
594  PIN_TERMINATE
595 };
596 
597 const PINCC26XX_HWAttrs PINCC26XX_hwAttrs = {
598  .intPriority = ~0,
599  .swiPriority = 0
600 };
601 
602 /*
603  * =============================== Power ===============================
604  */
605 #include <ti/drivers/Power.h>
606 #include <ti/drivers/power/PowerCC26XX.h>
607 #include "clock-arch.h"
608 
609 const PowerCC26XX_Config PowerCC26XX_config = {
610  .policyInitFxn = NULL,
611  .policyFxn = &clock_arch_standby_policy,
612  .calibrateFxn = &PowerCC26XX_calibrate,
613  .enablePolicy = true,
614  .calibrateRCOSC_LF = true,
615  .calibrateRCOSC_HF = true,
616 };
617 
618 /*
619  * =============================== PWM ===============================
620  * Remove unused entries to reduce flash usage both in Board.c and Board.h
621  */
622 #include <ti/drivers/PWM.h>
623 #include <ti/drivers/pwm/PWMTimerCC26XX.h>
624 
625 PWMTimerCC26XX_Object pwmtimerCC26xxObjects[CC1350DK_7XD_PWMCOUNT];
626 
627 const PWMTimerCC26XX_HwAttrs pwmtimerCC26xxHWAttrs[CC1350DK_7XD_PWMCOUNT] = {
628  { .pwmPin = CC1350DK_7XD_PWMPIN0, .gpTimerUnit = CC1350DK_7XD_GPTIMER0A },
629  { .pwmPin = CC1350DK_7XD_PWMPIN1, .gpTimerUnit = CC1350DK_7XD_GPTIMER0B },
630  { .pwmPin = CC1350DK_7XD_PWMPIN2, .gpTimerUnit = CC1350DK_7XD_GPTIMER1A },
631  { .pwmPin = CC1350DK_7XD_PWMPIN3, .gpTimerUnit = CC1350DK_7XD_GPTIMER1B },
632  { .pwmPin = CC1350DK_7XD_PWMPIN4, .gpTimerUnit = CC1350DK_7XD_GPTIMER2A },
633  { .pwmPin = CC1350DK_7XD_PWMPIN5, .gpTimerUnit = CC1350DK_7XD_GPTIMER2B },
634  { .pwmPin = CC1350DK_7XD_PWMPIN6, .gpTimerUnit = CC1350DK_7XD_GPTIMER3A },
635  { .pwmPin = CC1350DK_7XD_PWMPIN7, .gpTimerUnit = CC1350DK_7XD_GPTIMER3B },
636 };
637 
638 const PWM_Config PWM_config[CC1350DK_7XD_PWMCOUNT] = {
639  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350DK_7XD_PWM0], &pwmtimerCC26xxHWAttrs[CC1350DK_7XD_PWM0] },
640  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350DK_7XD_PWM1], &pwmtimerCC26xxHWAttrs[CC1350DK_7XD_PWM1] },
641  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350DK_7XD_PWM2], &pwmtimerCC26xxHWAttrs[CC1350DK_7XD_PWM2] },
642  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350DK_7XD_PWM3], &pwmtimerCC26xxHWAttrs[CC1350DK_7XD_PWM3] },
643  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350DK_7XD_PWM4], &pwmtimerCC26xxHWAttrs[CC1350DK_7XD_PWM4] },
644  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350DK_7XD_PWM5], &pwmtimerCC26xxHWAttrs[CC1350DK_7XD_PWM5] },
645  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350DK_7XD_PWM6], &pwmtimerCC26xxHWAttrs[CC1350DK_7XD_PWM6] },
646  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350DK_7XD_PWM7], &pwmtimerCC26xxHWAttrs[CC1350DK_7XD_PWM7] },
647 };
648 
649 const uint_least8_t PWM_count = CC1350DK_7XD_PWMCOUNT;
650 
651 /*
652  * =============================== RF Driver ===============================
653  */
654 #include <ti/drivers/rf/RF.h>
655 
656 const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = {
657  .hwiPriority = ~0, /* Lowest HWI priority */
658  .swiPriority = 0, /* Lowest SWI priority */
659  .xoscHfAlwaysNeeded = true, /* Keep XOSC dependency while in stanby */
660  .globalCallback = NULL, /* No board specific callback */
661  .globalEventMask = 0 /* No events subscribed to */
662 };
663 
664 /*
665  * =============================== SD ===============================
666  */
667 #include <ti/drivers/SD.h>
668 #include <ti/drivers/sd/SDSPI.h>
669 
670 #if TI_SD_CONF_ENABLE
671 
672 #if !(TI_SPI_CONF_SPI0_ENABLE)
673 #error "SD driver requires SPI0 enabled"
674 #endif
675 
676 SDSPI_Object sdspiObjects[CC1350DK_7XD_SDCOUNT];
677 
678 const SDSPI_HWAttrs sdspiHWAttrs[CC1350DK_7XD_SDCOUNT] = {
679  {
680  .spiIndex = CC1350DK_7XD_SPI0,
681  .spiCsGpioIndex = CC1350DK_7XD_SDSPI_CS
682  }
683 };
684 
685 const SD_Config SD_config[CC1350DK_7XD_SDCOUNT] = {
686  {
687  .fxnTablePtr = &SDSPI_fxnTable,
688  .object = &sdspiObjects[CC1350DK_7XD_SDSPI0],
689  .hwAttrs = &sdspiHWAttrs[CC1350DK_7XD_SDSPI0]
690  },
691 };
692 
693 const uint_least8_t SD_count = CC1350DK_7XD_SDCOUNT;
694 
695 #endif /* TI_SD_CONF_ENABLE */
696 
697 /*
698  * =============================== SPI DMA ===============================
699  */
700 #include <ti/drivers/SPI.h>
701 #include <ti/drivers/spi/SPICC26XXDMA.h>
702 
703 #if TI_SPI_CONF_ENABLE
704 
705 SPICC26XXDMA_Object spiCC26XXDMAObjects[CC1350DK_7XD_SPICOUNT];
706 
707 /*
708  * NOTE: The SPI instances below can be used by the SD driver to communicate
709  * with a SD card via SPI. The 'defaultTxBufValue' fields below are set to 0xFF
710  * to satisfy the SDSPI driver requirement.
711  */
712 const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1350DK_7XD_SPICOUNT] = {
713 #if TI_SPI_CONF_SPI0_ENABLE
714  {
715  .baseAddr = SSI0_BASE,
716  .intNum = INT_SSI0_COMB,
717  .intPriority = ~0,
718  .swiPriority = 0,
719  .powerMngrId = PowerCC26XX_PERIPH_SSI0,
720  .defaultTxBufValue = 0xFF,
721  .rxChannelBitMask = 1<<UDMA_CHAN_SSI0_RX,
722  .txChannelBitMask = 1<<UDMA_CHAN_SSI0_TX,
723  .mosiPin = CC1350DK_7XD_SPI0_MOSI,
724  .misoPin = CC1350DK_7XD_SPI0_MISO,
725  .clkPin = CC1350DK_7XD_SPI0_CLK,
726  .csnPin = CC1350DK_7XD_SPI0_CSN,
727  .minDmaTransferSize = 10
728  },
729 #endif
730 #if TI_SPI_CONF_SPI1_ENABLE
731  {
732  .baseAddr = SSI1_BASE,
733  .intNum = INT_SSI1_COMB,
734  .intPriority = ~0,
735  .swiPriority = 0,
736  .powerMngrId = PowerCC26XX_PERIPH_SSI1,
737  .defaultTxBufValue = 0xFF,
738  .rxChannelBitMask = 1<<UDMA_CHAN_SSI1_RX,
739  .txChannelBitMask = 1<<UDMA_CHAN_SSI1_TX,
740  .mosiPin = CC1350DK_7XD_SPI1_MOSI,
741  .misoPin = CC1350DK_7XD_SPI1_MISO,
742  .clkPin = CC1350DK_7XD_SPI1_CLK,
743  .csnPin = CC1350DK_7XD_SPI1_CSN,
744  .minDmaTransferSize = 10
745  },
746 #endif
747 };
748 
749 const SPI_Config SPI_config[CC1350DK_7XD_SPICOUNT] = {
750 #if TI_SPI_CONF_SPI0_ENABLE
751  {
752  .fxnTablePtr = &SPICC26XXDMA_fxnTable,
753  .object = &spiCC26XXDMAObjects[CC1350DK_7XD_SPI0],
754  .hwAttrs = &spiCC26XXDMAHWAttrs[CC1350DK_7XD_SPI0]
755  },
756 #endif
757 #if TI_SPI_CONF_SPI1_ENABLE
758  {
759  .fxnTablePtr = &SPICC26XXDMA_fxnTable,
760  .object = &spiCC26XXDMAObjects[CC1350DK_7XD_SPI1],
761  .hwAttrs = &spiCC26XXDMAHWAttrs[CC1350DK_7XD_SPI1]
762  },
763 #endif
764 };
765 
766 const uint_least8_t SPI_count = CC1350DK_7XD_SPICOUNT;
767 
768 #endif /* TI_SPI_CONF_ENABLE */
769 
770 /*
771  * =============================== UART ===============================
772  */
773 #include <ti/drivers/UART.h>
774 #include <ti/drivers/uart/UARTCC26XX.h>
775 
776 #if TI_UART_CONF_ENABLE
777 
778 UARTCC26XX_Object uartCC26XXObjects[CC1350DK_7XD_UARTCOUNT];
779 
780 uint8_t uartCC26XXRingBuffer[CC1350DK_7XD_UARTCOUNT][32];
781 
782 const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1350DK_7XD_UARTCOUNT] = {
783 #if TI_UART_CONF_UART0_ENABLE
784  {
785  .baseAddr = UART0_BASE,
786  .powerMngrId = PowerCC26XX_PERIPH_UART0,
787  .intNum = INT_UART0_COMB,
788  .intPriority = ~0,
789  .swiPriority = 0,
790  .txPin = CC1350DK_7XD_UART_TX,
791  .rxPin = CC1350DK_7XD_UART_RX,
792  .ctsPin = PIN_UNASSIGNED,
793  .rtsPin = PIN_UNASSIGNED,
794  .ringBufPtr = uartCC26XXRingBuffer[CC1350DK_7XD_UART0],
795  .ringBufSize = sizeof(uartCC26XXRingBuffer[CC1350DK_7XD_UART0]),
796  .txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8,
797  .rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8,
798  .errorFxn = NULL
799  },
800 #endif
801 };
802 
803 const UART_Config UART_config[CC1350DK_7XD_UARTCOUNT] = {
804 #if TI_UART_CONF_UART0_ENABLE
805  {
806  .fxnTablePtr = &UARTCC26XX_fxnTable,
807  .object = &uartCC26XXObjects[CC1350DK_7XD_UART0],
808  .hwAttrs = &uartCC26XXHWAttrs[CC1350DK_7XD_UART0]
809  },
810 #endif
811 };
812 
813 const uint_least8_t UART_count = CC1350DK_7XD_UARTCOUNT;
814 
815 #endif /* TI_UART_CONF_ENABLE */
816 
817 /*
818  * =============================== UDMA ===============================
819  */
820 #include <ti/drivers/dma/UDMACC26XX.h>
821 
822 UDMACC26XX_Object udmaObjects[CC1350DK_7XD_UDMACOUNT];
823 
824 const UDMACC26XX_HWAttrs udmaHWAttrs[CC1350DK_7XD_UDMACOUNT] = {
825  {
826  .baseAddr = UDMA0_BASE,
827  .powerMngrId = PowerCC26XX_PERIPH_UDMA,
828  .intNum = INT_DMA_ERR,
829  .intPriority = ~0
830  }
831 };
832 
833 const UDMACC26XX_Config UDMACC26XX_config[CC1350DK_7XD_UDMACOUNT] = {
834  {
835  .object = &udmaObjects[CC1350DK_7XD_UDMA0],
836  .hwAttrs = &udmaHWAttrs[CC1350DK_7XD_UDMA0]
837  },
838 };
839 
840 
841 
842 /*
843  * =============================== Watchdog ===============================
844  */
845 #include <ti/drivers/Watchdog.h>
846 #include <ti/drivers/watchdog/WatchdogCC26XX.h>
847 
848 WatchdogCC26XX_Object watchdogCC26XXObjects[CC1350DK_7XD_WATCHDOGCOUNT];
849 
850 const WatchdogCC26XX_HWAttrs watchdogCC26XXHWAttrs[CC1350DK_7XD_WATCHDOGCOUNT] = {
851  {
852  .baseAddr = WDT_BASE,
853  .reloadValue = 1000 /* Reload value in milliseconds */
854  },
855 };
856 
857 const Watchdog_Config Watchdog_config[CC1350DK_7XD_WATCHDOGCOUNT] = {
858  {
859  .fxnTablePtr = &WatchdogCC26XX_fxnTable,
860  .object = &watchdogCC26XXObjects[CC1350DK_7XD_WATCHDOG0],
861  .hwAttrs = &watchdogCC26XXHWAttrs[CC1350DK_7XD_WATCHDOG0]
862  },
863 };
864 
865 const uint_least8_t Watchdog_count = CC1350DK_7XD_WATCHDOGCOUNT;
866 
867 /*
868  * Board-specific initialization function to disable external flash.
869  * This function is defined in the file CC1350DK_7XD_fxns.c
870  */
871 extern void Board_initHook(void);
872 
873 /*
874  * ======== CC1350DK_7XD_initGeneral ========
875  */
877 {
878  Power_init();
879 
880  if (PIN_init(BoardGpioInitTable) != PIN_SUCCESS) {
881  /* Error with PIN_init */
882  while (1);
883  }
884 
885  /* Perform board-specific initialization */
886  Board_initHook();
887 }
888 
889 /*
890  * ======== Board_init ========
891  */
892 void Board_init(void)
893 {
895 }
#define SSI1_BASE
Base address for SSI1.
Definition: ssi.h:59
#define SSI0_BASE
Base address for SSI0.
Definition: ssi.h:58
============================================================================
void CC1350DK_7XD_initGeneral(void)
Initialize the general board specific settings.
Definition: CC1350DK_7XD.c:876
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