Contiki-NG
CC1352P_2_LAUNCHXL.c
1 /*
2  * Copyright (c) 2017-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  * ====================== CC1352P_2_LAUNCHXL.c ===================================
35  * This file is responsible for setting up the board specific items for the
36  * CC1352P_2_LAUNCHXL 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 "CC1352P_2_LAUNCHXL.h"
50 
51 /*
52  * =============================== ADCBuf ===============================
53  */
54 #include <ti/drivers/ADCBuf.h>
55 #include <ti/drivers/adcbuf/ADCBufCC26X2.h>
56 
57 ADCBufCC26X2_Object adcBufCC26xxObjects[CC1352P_2_LAUNCHXL_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 ADCBufCC26X2_AdcChannelLutEntry ADCBufCC26X2_adcChannelLut[CC1352P_2_LAUNCHXL_ADCBUF0CHANNELCOUNT] = {
67  {CC1352P_2_LAUNCHXL_DIO23_ANALOG, ADC_COMPB_IN_AUXIO7},
68  {CC1352P_2_LAUNCHXL_DIO24_ANALOG, ADC_COMPB_IN_AUXIO6},
69  {CC1352P_2_LAUNCHXL_DIO25_ANALOG, ADC_COMPB_IN_AUXIO5},
70  {CC1352P_2_LAUNCHXL_DIO26_ANALOG, ADC_COMPB_IN_AUXIO4},
71  {CC1352P_2_LAUNCHXL_DIO27_ANALOG, ADC_COMPB_IN_AUXIO3},
72  {PIN_UNASSIGNED, ADC_COMPB_IN_VDDS},
73  {PIN_UNASSIGNED, ADC_COMPB_IN_DCOUPL},
74  {PIN_UNASSIGNED, ADC_COMPB_IN_VSS},
75 };
76 
77 const ADCBufCC26X2_HWAttrs adcBufCC26xxHWAttrs[CC1352P_2_LAUNCHXL_ADCBUFCOUNT] = {
78  {
79  .intPriority = ~0,
80  .swiPriority = 0,
81  .adcChannelLut = ADCBufCC26X2_adcChannelLut,
82  .gpTimerUnit = CC1352P_2_LAUNCHXL_GPTIMER0A,
83  }
84 };
85 
86 const ADCBuf_Config ADCBuf_config[CC1352P_2_LAUNCHXL_ADCBUFCOUNT] = {
87  {
88  &ADCBufCC26X2_fxnTable,
89  &adcBufCC26xxObjects[CC1352P_2_LAUNCHXL_ADCBUF0],
90  &adcBufCC26xxHWAttrs[CC1352P_2_LAUNCHXL_ADCBUF0]
91  },
92 };
93 
94 const uint_least8_t ADCBuf_count = CC1352P_2_LAUNCHXL_ADCBUFCOUNT;
95 
96 /*
97  * =============================== ADC ===============================
98  */
99 #include <ti/drivers/ADC.h>
100 #include <ti/drivers/adc/ADCCC26XX.h>
101 
102 ADCCC26XX_Object adcCC26xxObjects[CC1352P_2_LAUNCHXL_ADCCOUNT];
103 
104 const ADCCC26XX_HWAttrs adcCC26xxHWAttrs[CC1352P_2_LAUNCHXL_ADCCOUNT] = {
105  {
106  .adcDIO = CC1352P_2_LAUNCHXL_DIO23_ANALOG,
107  .adcCompBInput = ADC_COMPB_IN_AUXIO7,
108  .refSource = ADCCC26XX_FIXED_REFERENCE,
109  .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
110  .inputScalingEnabled = true,
111  .triggerSource = ADCCC26XX_TRIGGER_MANUAL,
112  .returnAdjustedVal = false
113  },
114  {
115  .adcDIO = CC1352P_2_LAUNCHXL_DIO24_ANALOG,
116  .adcCompBInput = ADC_COMPB_IN_AUXIO6,
117  .refSource = ADCCC26XX_FIXED_REFERENCE,
118  .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
119  .inputScalingEnabled = true,
120  .triggerSource = ADCCC26XX_TRIGGER_MANUAL,
121  .returnAdjustedVal = false
122  },
123  {
124  .adcDIO = CC1352P_2_LAUNCHXL_DIO25_ANALOG,
125  .adcCompBInput = ADC_COMPB_IN_AUXIO5,
126  .refSource = ADCCC26XX_FIXED_REFERENCE,
127  .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
128  .inputScalingEnabled = true,
129  .triggerSource = ADCCC26XX_TRIGGER_MANUAL,
130  .returnAdjustedVal = false
131  },
132  {
133  .adcDIO = CC1352P_2_LAUNCHXL_DIO26_ANALOG,
134  .adcCompBInput = ADC_COMPB_IN_AUXIO4,
135  .refSource = ADCCC26XX_FIXED_REFERENCE,
136  .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
137  .inputScalingEnabled = true,
138  .triggerSource = ADCCC26XX_TRIGGER_MANUAL,
139  .returnAdjustedVal = false
140  },
141  {
142  .adcDIO = CC1352P_2_LAUNCHXL_DIO27_ANALOG,
143  .adcCompBInput = ADC_COMPB_IN_AUXIO3,
144  .refSource = ADCCC26XX_FIXED_REFERENCE,
145  .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
146  .inputScalingEnabled = true,
147  .triggerSource = ADCCC26XX_TRIGGER_MANUAL,
148  .returnAdjustedVal = false
149  },
150  {
151  .adcDIO = PIN_UNASSIGNED,
152  .adcCompBInput = ADC_COMPB_IN_DCOUPL,
153  .refSource = ADCCC26XX_FIXED_REFERENCE,
154  .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
155  .inputScalingEnabled = true,
156  .triggerSource = ADCCC26XX_TRIGGER_MANUAL,
157  .returnAdjustedVal = false
158  },
159  {
160  .adcDIO = PIN_UNASSIGNED,
161  .adcCompBInput = ADC_COMPB_IN_VSS,
162  .refSource = ADCCC26XX_FIXED_REFERENCE,
163  .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
164  .inputScalingEnabled = true,
165  .triggerSource = ADCCC26XX_TRIGGER_MANUAL,
166  .returnAdjustedVal = false
167  },
168  {
169  .adcDIO = PIN_UNASSIGNED,
170  .adcCompBInput = ADC_COMPB_IN_VDDS,
171  .refSource = ADCCC26XX_FIXED_REFERENCE,
172  .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
173  .inputScalingEnabled = true,
174  .triggerSource = ADCCC26XX_TRIGGER_MANUAL,
175  .returnAdjustedVal = false
176  }
177 };
178 
179 const ADC_Config ADC_config[CC1352P_2_LAUNCHXL_ADCCOUNT] = {
180  {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P_2_LAUNCHXL_ADC0], &adcCC26xxHWAttrs[CC1352P_2_LAUNCHXL_ADC0]},
181  {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P_2_LAUNCHXL_ADC1], &adcCC26xxHWAttrs[CC1352P_2_LAUNCHXL_ADC1]},
182  {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P_2_LAUNCHXL_ADC2], &adcCC26xxHWAttrs[CC1352P_2_LAUNCHXL_ADC2]},
183  {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P_2_LAUNCHXL_ADC3], &adcCC26xxHWAttrs[CC1352P_2_LAUNCHXL_ADC3]},
184  {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P_2_LAUNCHXL_ADC4], &adcCC26xxHWAttrs[CC1352P_2_LAUNCHXL_ADC4]},
185  {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P_2_LAUNCHXL_ADCDCOUPL], &adcCC26xxHWAttrs[CC1352P_2_LAUNCHXL_ADCDCOUPL]},
186  {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P_2_LAUNCHXL_ADCVSS], &adcCC26xxHWAttrs[CC1352P_2_LAUNCHXL_ADCVSS]},
187  {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P_2_LAUNCHXL_ADCVDDS], &adcCC26xxHWAttrs[CC1352P_2_LAUNCHXL_ADCVDDS]},
188 };
189 
190 const uint_least8_t ADC_count = CC1352P_2_LAUNCHXL_ADCCOUNT;
191 
192 /*
193  * =============================== ECDH ===============================
194  */
195 #include <ti/drivers/ECDH.h>
196 #include <ti/drivers/ecdh/ECDHCC26X2.h>
197 
198 ECDHCC26X2_Object ecdhCC26X2Objects[CC1352P_2_LAUNCHXL_ECDHCOUNT];
199 
200 const ECDHCC26X2_HWAttrs ecdhCC26X2HWAttrs[CC1352P_2_LAUNCHXL_ECDHCOUNT] = {
201  {
202  .intPriority = ~0,
203  }
204 };
205 
206 const ECDH_Config ECDH_config[CC1352P_2_LAUNCHXL_ECDHCOUNT] = {
207  {
208  .object = &ecdhCC26X2Objects[CC1352P_2_LAUNCHXL_ECDH0],
209  .hwAttrs = &ecdhCC26X2HWAttrs[CC1352P_2_LAUNCHXL_ECDH0]
210  },
211 };
212 
213 const uint_least8_t ECDH_count = CC1352P_2_LAUNCHXL_ECDHCOUNT;
214 
215 /*
216  * =============================== ECDSA ===============================
217  */
218 #include <ti/drivers/ECDSA.h>
219 #include <ti/drivers/ecdsa/ECDSACC26X2.h>
220 
221 ECDSACC26X2_Object ecdsaCC26X2Objects[CC1352P_2_LAUNCHXL_ECDSACOUNT];
222 
223 const ECDSACC26X2_HWAttrs ecdsaCC26X2HWAttrs[CC1352P_2_LAUNCHXL_ECDSACOUNT] = {
224  {
225  .intPriority = ~0,
226  }
227 };
228 
229 const ECDSA_Config ECDSA_config[CC1352P_2_LAUNCHXL_ECDSACOUNT] = {
230  {
231  .object = &ecdsaCC26X2Objects[CC1352P_2_LAUNCHXL_ECDSA0],
232  .hwAttrs = &ecdsaCC26X2HWAttrs[CC1352P_2_LAUNCHXL_ECDSA0]
233  },
234 };
235 
236 const uint_least8_t ECDSA_count = CC1352P_2_LAUNCHXL_ECDSACOUNT;
237 
238 /*
239  * =============================== ECJPAKE ===============================
240  */
241 #include <ti/drivers/ECJPAKE.h>
242 #include <ti/drivers/ecjpake/ECJPAKECC26X2.h>
243 
244 ECJPAKECC26X2_Object ecjpakeCC26X2Objects[CC1352P_2_LAUNCHXL_ECJPAKECOUNT];
245 
246 const ECJPAKECC26X2_HWAttrs ecjpakeCC26X2HWAttrs[CC1352P_2_LAUNCHXL_ECJPAKECOUNT] = {
247  {
248  .intPriority = ~0,
249  }
250 };
251 
252 const ECJPAKE_Config ECJPAKE_config[CC1352P_2_LAUNCHXL_ECJPAKECOUNT] = {
253  {
254  .object = &ecjpakeCC26X2Objects[CC1352P_2_LAUNCHXL_ECJPAKE0],
255  .hwAttrs = &ecjpakeCC26X2HWAttrs[CC1352P_2_LAUNCHXL_ECJPAKE0]
256  },
257 };
258 
259 const uint_least8_t ECJPAKE_count = CC1352P_2_LAUNCHXL_ECJPAKECOUNT;
260 
261 
262 /*
263  * =============================== SHA2 ===============================
264  */
265 #include <ti/drivers/SHA2.h>
266 #include <ti/drivers/sha2/SHA2CC26X2.h>
267 
268 SHA2CC26X2_Object sha2CC26X2Objects[CC1352P_2_LAUNCHXL_SHA2COUNT];
269 
270 const SHA2CC26X2_HWAttrs sha2CC26X2HWAttrs[CC1352P_2_LAUNCHXL_SHA2COUNT] = {
271  {
272  .intPriority = ~0,
273  }
274 };
275 
276 const SHA2_Config SHA2_config[CC1352P_2_LAUNCHXL_SHA2COUNT] = {
277  {
278  .object = &sha2CC26X2Objects[CC1352P_2_LAUNCHXL_SHA20],
279  .hwAttrs = &sha2CC26X2HWAttrs[CC1352P_2_LAUNCHXL_SHA20]
280  },
281 };
282 
283 const uint_least8_t SHA2_count = CC1352P_2_LAUNCHXL_SHA2COUNT;
284 
285 /*
286  * =============================== AESCCM ===============================
287  */
288 #include <ti/drivers/AESCCM.h>
289 #include <ti/drivers/aesccm/AESCCMCC26XX.h>
290 
291 AESCCMCC26XX_Object aesccmCC26XXObjects[CC1352P_2_LAUNCHXL_AESCCMCOUNT];
292 
293 const AESCCMCC26XX_HWAttrs aesccmCC26XXHWAttrs[CC1352P_2_LAUNCHXL_AESCCMCOUNT] = {
294  {
295  .intPriority = ~0,
296  }
297 };
298 
299 const AESCCM_Config AESCCM_config[CC1352P_2_LAUNCHXL_AESCCMCOUNT] = {
300  {
301  .object = &aesccmCC26XXObjects[CC1352P_2_LAUNCHXL_AESCCM0],
302  .hwAttrs = &aesccmCC26XXHWAttrs[CC1352P_2_LAUNCHXL_AESCCM0]
303  },
304 };
305 
306 const uint_least8_t AESCCM_count = CC1352P_2_LAUNCHXL_AESCCMCOUNT;
307 
308 /*
309  * =============================== AESGCM ===============================
310  */
311 #include <ti/drivers/AESGCM.h>
312 #include <ti/drivers/aesgcm/AESGCMCC26XX.h>
313 
314 AESGCMCC26XX_Object aesgcmCC26XXObjects[CC1352P_2_LAUNCHXL_AESGCMCOUNT];
315 
316 const AESGCMCC26XX_HWAttrs aesgcmCC26XXHWAttrs[CC1352P_2_LAUNCHXL_AESGCMCOUNT] = {
317  {
318  .intPriority = ~0,
319  }
320 };
321 
322 const AESGCM_Config AESGCM_config[CC1352P_2_LAUNCHXL_AESGCMCOUNT] = {
323  {
324  .object = &aesgcmCC26XXObjects[CC1352P_2_LAUNCHXL_AESGCM0],
325  .hwAttrs = &aesgcmCC26XXHWAttrs[CC1352P_2_LAUNCHXL_AESGCM0]
326  },
327 };
328 
329 const uint_least8_t AESGCM_count = CC1352P_2_LAUNCHXL_AESGCMCOUNT;
330 
331 /*
332  * =============================== AESCBC ===============================
333  */
334 #include <ti/drivers/AESCBC.h>
335 #include <ti/drivers/aescbc/AESCBCCC26XX.h>
336 
337 AESCBCCC26XX_Object aescbcCC26XXObjects[CC1352P_2_LAUNCHXL_AESCBCCOUNT];
338 
339 const AESCBCCC26XX_HWAttrs aescbcCC26XXHWAttrs[CC1352P_2_LAUNCHXL_AESCBCCOUNT] = {
340  {
341  .intPriority = ~0,
342  }
343 };
344 
345 const AESCBC_Config AESCBC_config[CC1352P_2_LAUNCHXL_AESCBCCOUNT] = {
346  {
347  .object = &aescbcCC26XXObjects[CC1352P_2_LAUNCHXL_AESCBC0],
348  .hwAttrs = &aescbcCC26XXHWAttrs[CC1352P_2_LAUNCHXL_AESCBC0]
349  },
350 };
351 
352 const uint_least8_t AESCBC_count = CC1352P_2_LAUNCHXL_AESCBCCOUNT;
353 
354 /*
355  * =============================== AESCTR ===============================
356  */
357 #include <ti/drivers/AESCTR.h>
358 #include <ti/drivers/aesctr/AESCTRCC26XX.h>
359 
360 AESCTRCC26XX_Object aesctrCC26XXObjects[CC1352P_2_LAUNCHXL_AESCTRCOUNT];
361 
362 const AESCTRCC26XX_HWAttrs aesctrCC26XXHWAttrs[CC1352P_2_LAUNCHXL_AESCTRCOUNT] = {
363  {
364  .intPriority = ~0,
365  }
366 };
367 
368 const AESCTR_Config AESCTR_config[CC1352P_2_LAUNCHXL_AESCTRCOUNT] = {
369  {
370  .object = &aesctrCC26XXObjects[CC1352P_2_LAUNCHXL_AESCTR0],
371  .hwAttrs = &aesctrCC26XXHWAttrs[CC1352P_2_LAUNCHXL_AESCTR0]
372  },
373 };
374 
375 const uint_least8_t AESCTR_count = CC1352P_2_LAUNCHXL_AESCTRCOUNT;
376 
377 /*
378  * =============================== AESECB ===============================
379  */
380 #include <ti/drivers/AESECB.h>
381 #include <ti/drivers/aesecb/AESECBCC26XX.h>
382 
383 AESECBCC26XX_Object aesecbCC26XXObjects[CC1352P_2_LAUNCHXL_AESECBCOUNT];
384 
385 const AESECBCC26XX_HWAttrs aesecbCC26XXHWAttrs[CC1352P_2_LAUNCHXL_AESECBCOUNT] = {
386  {
387  .intPriority = ~0,
388  }
389 };
390 
391 const AESECB_Config AESECB_config[CC1352P_2_LAUNCHXL_AESECBCOUNT] = {
392  {
393  .object = &aesecbCC26XXObjects[CC1352P_2_LAUNCHXL_AESECB0],
394  .hwAttrs = &aesecbCC26XXHWAttrs[CC1352P_2_LAUNCHXL_AESECB0]
395  },
396 };
397 
398 const uint_least8_t AESECB_count = CC1352P_2_LAUNCHXL_AESECBCOUNT;
399 
400 /*
401  * =============================== AESCTRDRBG ===============================
402  */
403 #include <ti/drivers/AESCTRDRBG.h>
404 #include <ti/drivers/aesctrdrbg/AESCTRDRBGXX.h>
405 
406 AESCTRDRBGXX_Object aesctrdrbgXXObjects[CC1352P_2_LAUNCHXL_AESCTRDRBGCOUNT];
407 
408 const AESCTRDRBGXX_HWAttrs aesctrdrbgXXHWAttrs[CC1352P_2_LAUNCHXL_AESCTRDRBGCOUNT] = {
409  {
410  .aesctrIndex = CC1352P_2_LAUNCHXL_AESCTR0,
411  }
412 };
413 
414 const AESCTRDRBG_Config AESCTRDRBG_config[CC1352P_2_LAUNCHXL_AESCTRDRBGCOUNT] = {
415  {
416  .object = &aesctrdrbgXXObjects[CC1352P_2_LAUNCHXL_AESCTRDRBG0],
417  .hwAttrs = &aesctrdrbgXXHWAttrs[CC1352P_2_LAUNCHXL_AESCTRDRBG0]
418  },
419 };
420 
421 const uint_least8_t AESCTRDRBG_count = CC1352P_2_LAUNCHXL_AESCTRDRBGCOUNT;
422 
423 /*
424  * =============================== TRNG ===============================
425  */
426 #include <ti/drivers/TRNG.h>
427 #include <ti/drivers/trng/TRNGCC26XX.h>
428 
429 TRNGCC26XX_Object trngCC26XXObjects[CC1352P_2_LAUNCHXL_TRNGCOUNT];
430 
431 const TRNGCC26XX_HWAttrs trngCC26X2HWAttrs[CC1352P_2_LAUNCHXL_TRNGCOUNT] = {
432  {
433  .intPriority = ~0,
434  .swiPriority = 0,
435  .samplesPerCycle = 240000,
436  }
437 };
438 
439 const TRNG_Config TRNG_config[CC1352P_2_LAUNCHXL_TRNGCOUNT] = {
440  {
441  .object = &trngCC26XXObjects[CC1352P_2_LAUNCHXL_TRNG0],
442  .hwAttrs = &trngCC26X2HWAttrs[CC1352P_2_LAUNCHXL_TRNG0]
443  },
444 };
445 
446 const uint_least8_t TRNG_count = CC1352P_2_LAUNCHXL_TRNGCOUNT;
447 
448 /*
449  * =============================== GPIO ===============================
450  */
451 #include <ti/drivers/GPIO.h>
452 #include <ti/drivers/gpio/GPIOCC26XX.h>
453 
454 /*
455  * Array of Pin configurations
456  * NOTE: The order of the pin configurations must coincide with what was
457  * defined in CC1352P_2_LAUNCHXL.h
458  * NOTE: Pins not used for interrupts should be placed at the end of the
459  * array. Callback entries can be omitted from callbacks array to
460  * reduce memory usage.
461  */
462 GPIO_PinConfig gpioPinConfigs[] = {
463  /* Input pins */
464  GPIOCC26XX_DIO_15 | GPIO_DO_NOT_CONFIG, /* Button 0 */
465  GPIOCC26XX_DIO_14 | GPIO_DO_NOT_CONFIG, /* Button 1 */
466 
467  GPIOCC26XX_DIO_15 | GPIO_DO_NOT_CONFIG, /* CC1352P_2_LAUNCHXL_SPI_MASTER_READY */
468  GPIOCC26XX_DIO_21 | GPIO_DO_NOT_CONFIG, /* CC1352P_2_LAUNCHXL_SPI_SLAVE_READY */
469 
470  /* Output pins */
471  GPIOCC26XX_DIO_07 | GPIO_DO_NOT_CONFIG, /* Green LED */
472  GPIOCC26XX_DIO_06 | GPIO_DO_NOT_CONFIG, /* Red LED */
473 
474  /* SPI Flash CSN */
475  GPIOCC26XX_DIO_20 | GPIO_DO_NOT_CONFIG,
476 
477  /* SD CS */
478  GPIOCC26XX_DIO_19 | GPIO_DO_NOT_CONFIG,
479 };
480 
481 /*
482  * Array of callback function pointers
483  * NOTE: The order of the pin configurations must coincide with what was
484  * defined in CC1352P_LAUNCH.h
485  * NOTE: Pins not used for interrupts can be omitted from callbacks array to
486  * reduce memory usage (if placed at end of gpioPinConfigs array).
487  */
488 GPIO_CallbackFxn gpioCallbackFunctions[] = {
489  NULL, /* Button 0 */
490  NULL, /* Button 1 */
491  NULL, /* CC1352P_2_LAUNCHXL_SPI_MASTER_READY */
492  NULL, /* CC1352P_2_LAUNCHXL_SPI_SLAVE_READY */
493 };
494 
495 const GPIOCC26XX_Config GPIOCC26XX_config = {
496  .pinConfigs = (GPIO_PinConfig *)gpioPinConfigs,
497  .callbacks = (GPIO_CallbackFxn *)gpioCallbackFunctions,
498  .numberOfPinConfigs = CC1352P_2_LAUNCHXL_GPIOCOUNT,
499  .numberOfCallbacks = sizeof(gpioCallbackFunctions)/sizeof(GPIO_CallbackFxn),
500  .intPriority = (~0)
501 };
502 
503 /*
504  * =============================== GPTimer ===============================
505  * Remove unused entries to reduce flash usage both in Board.c and Board.h
506  */
507 #include <ti/drivers/timer/GPTimerCC26XX.h>
508 
509 GPTimerCC26XX_Object gptimerCC26XXObjects[CC1352P_2_LAUNCHXL_GPTIMERCOUNT];
510 
511 const GPTimerCC26XX_HWAttrs gptimerCC26xxHWAttrs[CC1352P_2_LAUNCHXL_GPTIMERPARTSCOUNT] = {
512  { .baseAddr = GPT0_BASE, .intNum = INT_GPT0A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0A, },
513  { .baseAddr = GPT0_BASE, .intNum = INT_GPT0B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0B, },
514  { .baseAddr = GPT1_BASE, .intNum = INT_GPT1A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1A, },
515  { .baseAddr = GPT1_BASE, .intNum = INT_GPT1B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1B, },
516  { .baseAddr = GPT2_BASE, .intNum = INT_GPT2A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2A, },
517  { .baseAddr = GPT2_BASE, .intNum = INT_GPT2B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2B, },
518  { .baseAddr = GPT3_BASE, .intNum = INT_GPT3A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3A, },
519  { .baseAddr = GPT3_BASE, .intNum = INT_GPT3B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3B, },
520 };
521 
522 const GPTimerCC26XX_Config GPTimerCC26XX_config[CC1352P_2_LAUNCHXL_GPTIMERPARTSCOUNT] = {
523  { &gptimerCC26XXObjects[CC1352P_2_LAUNCHXL_GPTIMER0], &gptimerCC26xxHWAttrs[CC1352P_2_LAUNCHXL_GPTIMER0A], GPT_A },
524  { &gptimerCC26XXObjects[CC1352P_2_LAUNCHXL_GPTIMER0], &gptimerCC26xxHWAttrs[CC1352P_2_LAUNCHXL_GPTIMER0B], GPT_B },
525  { &gptimerCC26XXObjects[CC1352P_2_LAUNCHXL_GPTIMER1], &gptimerCC26xxHWAttrs[CC1352P_2_LAUNCHXL_GPTIMER1A], GPT_A },
526  { &gptimerCC26XXObjects[CC1352P_2_LAUNCHXL_GPTIMER1], &gptimerCC26xxHWAttrs[CC1352P_2_LAUNCHXL_GPTIMER1B], GPT_B },
527  { &gptimerCC26XXObjects[CC1352P_2_LAUNCHXL_GPTIMER2], &gptimerCC26xxHWAttrs[CC1352P_2_LAUNCHXL_GPTIMER2A], GPT_A },
528  { &gptimerCC26XXObjects[CC1352P_2_LAUNCHXL_GPTIMER2], &gptimerCC26xxHWAttrs[CC1352P_2_LAUNCHXL_GPTIMER2B], GPT_B },
529  { &gptimerCC26XXObjects[CC1352P_2_LAUNCHXL_GPTIMER3], &gptimerCC26xxHWAttrs[CC1352P_2_LAUNCHXL_GPTIMER3A], GPT_A },
530  { &gptimerCC26XXObjects[CC1352P_2_LAUNCHXL_GPTIMER3], &gptimerCC26xxHWAttrs[CC1352P_2_LAUNCHXL_GPTIMER3B], GPT_B },
531 };
532 
533 /*
534  * =============================== I2C ===============================
535 */
536 #include <ti/drivers/I2C.h>
537 #include <ti/drivers/i2c/I2CCC26XX.h>
538 
539 #if TI_I2C_CONF_ENABLE
540 
541 I2CCC26XX_Object i2cCC26xxObjects[CC1352P_2_LAUNCHXL_I2CCOUNT];
542 
543 const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC1352P_2_LAUNCHXL_I2CCOUNT] = {
544 #if TI_I2C_CONF_I2C0_ENABLE
545  {
546  .baseAddr = I2C0_BASE,
547  .powerMngrId = PowerCC26XX_PERIPH_I2C0,
548  .intNum = INT_I2C_IRQ,
549  .intPriority = ~0,
550  .swiPriority = 0,
551  .sdaPin = CC1352P_2_LAUNCHXL_I2C0_SDA0,
552  .sclPin = CC1352P_2_LAUNCHXL_I2C0_SCL0,
553  },
554 #endif
555 };
556 
557 const I2C_Config I2C_config[CC1352P_2_LAUNCHXL_I2CCOUNT] = {
558 #if TI_I2C_CONF_I2C0_ENABLE
559  {
560  .fxnTablePtr = &I2CCC26XX_fxnTable,
561  .object = &i2cCC26xxObjects[CC1352P_2_LAUNCHXL_I2C0],
562  .hwAttrs = &i2cCC26xxHWAttrs[CC1352P_2_LAUNCHXL_I2C0]
563  },
564 #endif
565 };
566 
567 const uint_least8_t I2C_count = CC1352P_2_LAUNCHXL_I2CCOUNT;
568 
569 #endif /* TI_I2C_CONF_ENABLE */
570 
571 /*
572  * =============================== I2S ===============================
573 */
574 #include <ti/drivers/I2S.h>
575 #include <ti/drivers/i2s/I2SCC26XX.h>
576 
577 I2SCC26XX_Object i2sCC26XXObjects[CC1352P_2_LAUNCHXL_I2SCOUNT];
578 
579 const I2SCC26XX_HWAttrs i2sCC26XXHWAttrs[CC1352P_2_LAUNCHXL_I2SCOUNT] = {
580  {
581  .pinSD1 = CC1352P_2_LAUNCHXL_I2S_ADI,
582  .pinSD0 = CC1352P_2_LAUNCHXL_I2S_ADO,
583  .pinSCK = CC1352P_2_LAUNCHXL_I2S_BCLK,
584  .pinMCLK = CC1352P_2_LAUNCHXL_I2S_MCLK,
585  .pinWS = CC1352P_2_LAUNCHXL_I2S_WCLK,
586  .intPriority = ~0,
587  }
588 };
589 
590 const I2S_Config I2S_config[CC1352P_2_LAUNCHXL_I2SCOUNT] = {
591  {
592  .object = &i2sCC26XXObjects[CC1352P_2_LAUNCHXL_I2S0],
593  .hwAttrs = &i2sCC26XXHWAttrs[CC1352P_2_LAUNCHXL_I2S0]
594  },
595 };
596 
597 const uint_least8_t I2S_count = CC1352P_2_LAUNCHXL_I2SCOUNT;
598 
599 /*
600  * =============================== NVS ===============================
601  */
602 #include <ti/drivers/NVS.h>
603 #include <ti/drivers/nvs/NVSSPI25X.h>
604 #include <ti/drivers/nvs/NVSCC26XX.h>
605 
606 #define NVS_REGIONS_BASE 0x48000
607 #define SECTORSIZE 0x2000
608 #define REGIONSIZE (SECTORSIZE * 4)
609 
610 #if TI_NVS_CONF_ENABLE
611 
612 #if TI_NVS_CONF_NVS_INTERNAL_ENABLE
613 
614 /*
615  * Reserve flash sectors for NVS driver use by placing an uninitialized byte
616  * array at the desired flash address.
617  */
618 #if defined(__TI_COMPILER_VERSION__)
619 
620 /*
621  * Place uninitialized array at NVS_REGIONS_BASE
622  */
623 #pragma LOCATION(flashBuf, NVS_REGIONS_BASE);
624 #pragma NOINIT(flashBuf);
625 static char flashBuf[REGIONSIZE];
626 
627 #elif defined(__IAR_SYSTEMS_ICC__)
628 
629 /*
630  * Place uninitialized array at NVS_REGIONS_BASE
631  */
632 static __no_init char flashBuf[REGIONSIZE] @ NVS_REGIONS_BASE;
633 
634 #elif defined(__GNUC__)
635 
636 /*
637  * Place the flash buffers in the .nvs section created in the gcc linker file.
638  * The .nvs section enforces alignment on a sector boundary but may
639  * be placed anywhere in flash memory. If desired the .nvs section can be set
640  * to a fixed address by changing the following in the gcc linker file:
641  *
642  * .nvs (FIXED_FLASH_ADDR) (NOLOAD) : AT (FIXED_FLASH_ADDR) {
643  * *(.nvs)
644  * } > REGION_TEXT
645  */
646 __attribute__ ((section (".nvs")))
647 static char flashBuf[REGIONSIZE];
648 
649 #endif
650 
651 /* Allocate objects for NVS Internal Regions */
652 NVSCC26XX_Object nvsCC26xxObjects[1];
653 
654 /* Hardware attributes for NVS Internal Regions */
655 const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = {
656  {
657  .regionBase = (void *)flashBuf,
658  .regionSize = REGIONSIZE,
659  },
660 };
661 
662 #endif /* TI_NVS_CONF_NVS_INTERNAL_ENABLE */
663 
664 #if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
665 
666 #define SPISECTORSIZE 0x1000
667 #define SPIREGIONSIZE (SPISECTORSIZE * 32)
668 #define VERIFYBUFSIZE 64
669 
670 static uint8_t verifyBuf[VERIFYBUFSIZE];
671 
672 /* Allocate objects for NVS External Regions */
673 NVSSPI25X_Object nvsSPI25XObjects[1];
674 
675 /* Hardware attributes for NVS External Regions */
676 const NVSSPI25X_HWAttrs nvsSPI25XHWAttrs[1] = {
677  {
678  .regionBaseOffset = 0,
679  .regionSize = SPIREGIONSIZE,
680  .sectorSize = SPISECTORSIZE,
681  .verifyBuf = verifyBuf,
682  .verifyBufSize = VERIFYBUFSIZE,
683  .spiHandle = NULL,
684  .spiIndex = 0,
685  .spiBitRate = 4000000,
686  .spiCsnGpioIndex = CC1352P_2_LAUNCHXL_GPIO_SPI_FLASH_CS,
687  .statusPollDelayUs = 100,
688  },
689 };
690 
691 #endif /* TI_NVS_CONF_NVS_EXTERNAL_ENABLE */
692 
693 /* NVS Region index 0 and 1 refer to NVS and NVS SPI respectively */
694 const NVS_Config NVS_config[CC1352P_2_LAUNCHXL_NVSCOUNT] = {
695 #if TI_NVS_CONF_NVS_INTERNAL_ENABLE
696  {
697  .fxnTablePtr = &NVSCC26XX_fxnTable,
698  .object = &nvsCC26xxObjects[0],
699  .hwAttrs = &nvsCC26xxHWAttrs[0],
700  },
701 #endif
702 #if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
703  {
704  .fxnTablePtr = &NVSSPI25X_fxnTable,
705  .object = &nvsSPI25XObjects[0],
706  .hwAttrs = &nvsSPI25XHWAttrs[0],
707  },
708 #endif
709 };
710 
711 const uint_least8_t NVS_count = CC1352P_2_LAUNCHXL_NVSCOUNT;
712 
713 #endif /* TI_NVS_CONF_ENABLE */
714 
715 /*
716  * =============================== PIN ===============================
717  */
718 #include <ti/drivers/PIN.h>
719 #include <ti/drivers/pin/PINCC26XX.h>
720 
721 const PIN_Config BoardGpioInitTable[] = {
722 
723  CC1352P_2_LAUNCHXL_PIN_RLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
724  CC1352P_2_LAUNCHXL_PIN_GLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
725  CC1352P_2_LAUNCHXL_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
726  CC1352P_2_LAUNCHXL_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
727  CC1352P_2_LAUNCHXL_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */
728  CC1352P_2_LAUNCHXL_UART0_RX | PIN_INPUT_EN | PIN_PULLDOWN, /* UART RX via debugger back channel */
729  CC1352P_2_LAUNCHXL_UART0_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL, /* UART TX via debugger back channel */
730  CC1352P_2_LAUNCHXL_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */
731  CC1352P_2_LAUNCHXL_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */
732  CC1352P_2_LAUNCHXL_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI clock */
733  CC1352P_2_LAUNCHXL_DIO28_RF_24GHZ | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* Path disabled */
734  CC1352P_2_LAUNCHXL_DIO29_RF_HIGH_PA | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* Path disabled */
735  CC1352P_2_LAUNCHXL_DIO30_RF_SUB1GHZ | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* Path disabled */
736  PIN_TERMINATE
737 };
738 
739 const PINCC26XX_HWAttrs PINCC26XX_hwAttrs = {
740  .intPriority = ~0,
741  .swiPriority = 0
742 };
743 
744 /*
745  * =============================== Power ===============================
746  */
747 #include <ti/drivers/Power.h>
748 #include <ti/drivers/power/PowerCC26X2.h>
749 #include "clock-arch.h"
750 
751 const PowerCC26X2_Config PowerCC26X2_config = {
752  .policyInitFxn = NULL,
753  .policyFxn = &clock_arch_standby_policy,
754  .calibrateFxn = &PowerCC26XX_calibrate,
755  .enablePolicy = true,
756  .calibrateRCOSC_LF = true,
757  .calibrateRCOSC_HF = true,
758 };
759 
760 /*
761  * =============================== PWM ===============================
762  * Remove unused entries to reduce flash usage both in Board.c and Board.h
763  */
764 #include <ti/drivers/PWM.h>
765 #include <ti/drivers/pwm/PWMTimerCC26XX.h>
766 
767 PWMTimerCC26XX_Object pwmtimerCC26xxObjects[CC1352P_2_LAUNCHXL_PWMCOUNT];
768 
769 const PWMTimerCC26XX_HwAttrs pwmtimerCC26xxHWAttrs[CC1352P_2_LAUNCHXL_PWMCOUNT] = {
770  { .pwmPin = CC1352P_2_LAUNCHXL_PWMPIN0, .gpTimerUnit = CC1352P_2_LAUNCHXL_GPTIMER0A },
771  { .pwmPin = CC1352P_2_LAUNCHXL_PWMPIN1, .gpTimerUnit = CC1352P_2_LAUNCHXL_GPTIMER0B },
772  { .pwmPin = CC1352P_2_LAUNCHXL_PWMPIN2, .gpTimerUnit = CC1352P_2_LAUNCHXL_GPTIMER1A },
773  { .pwmPin = CC1352P_2_LAUNCHXL_PWMPIN3, .gpTimerUnit = CC1352P_2_LAUNCHXL_GPTIMER1B },
774  { .pwmPin = CC1352P_2_LAUNCHXL_PWMPIN4, .gpTimerUnit = CC1352P_2_LAUNCHXL_GPTIMER2A },
775  { .pwmPin = CC1352P_2_LAUNCHXL_PWMPIN5, .gpTimerUnit = CC1352P_2_LAUNCHXL_GPTIMER2B },
776  { .pwmPin = CC1352P_2_LAUNCHXL_PWMPIN6, .gpTimerUnit = CC1352P_2_LAUNCHXL_GPTIMER3A },
777  { .pwmPin = CC1352P_2_LAUNCHXL_PWMPIN7, .gpTimerUnit = CC1352P_2_LAUNCHXL_GPTIMER3B },
778 };
779 
780 const PWM_Config PWM_config[CC1352P_2_LAUNCHXL_PWMCOUNT] = {
781  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P_2_LAUNCHXL_PWM0], &pwmtimerCC26xxHWAttrs[CC1352P_2_LAUNCHXL_PWM0] },
782  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P_2_LAUNCHXL_PWM1], &pwmtimerCC26xxHWAttrs[CC1352P_2_LAUNCHXL_PWM1] },
783  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P_2_LAUNCHXL_PWM2], &pwmtimerCC26xxHWAttrs[CC1352P_2_LAUNCHXL_PWM2] },
784  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P_2_LAUNCHXL_PWM3], &pwmtimerCC26xxHWAttrs[CC1352P_2_LAUNCHXL_PWM3] },
785  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P_2_LAUNCHXL_PWM4], &pwmtimerCC26xxHWAttrs[CC1352P_2_LAUNCHXL_PWM4] },
786  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P_2_LAUNCHXL_PWM5], &pwmtimerCC26xxHWAttrs[CC1352P_2_LAUNCHXL_PWM5] },
787  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P_2_LAUNCHXL_PWM6], &pwmtimerCC26xxHWAttrs[CC1352P_2_LAUNCHXL_PWM6] },
788  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P_2_LAUNCHXL_PWM7], &pwmtimerCC26xxHWAttrs[CC1352P_2_LAUNCHXL_PWM7] },
789 };
790 
791 const uint_least8_t PWM_count = CC1352P_2_LAUNCHXL_PWMCOUNT;
792 
793 /*
794  * =============================== RF Driver ===============================
795  */
796 #include <ti/drivers/rf/RF.h>
797 
798 /*
799  * Board-specific callback function to set the correct antenna path.
800  *
801  * This function is called by the RF driver on global driver events.
802  * It contains a default implementation to set the correct antenna path.
803  * This function is defined in the file CC1352P_2_LAUNCHXL_fxns.c
804  */
805 extern void rfDriverCallback(RF_Handle client, RF_GlobalEvent events, void* arg);
806 
807 const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = {
808  .hwiPriority = ~0, /* Lowest HWI priority */
809  .swiPriority = 0, /* Lowest SWI priority */
810  .xoscHfAlwaysNeeded = true, /* Keep XOSC dependency while in standby */
811 
812  /* Register the board specific callback */
813  .globalCallback = &rfDriverCallback,
814 
815  /* Subscribe the callback to both events */
816  .globalEventMask = RF_GlobalEventRadioSetup | RF_GlobalEventRadioPowerDown
817 };
818 
819 /*
820  * =============================== SD ===============================
821  */
822 #include <ti/drivers/SD.h>
823 #include <ti/drivers/sd/SDSPI.h>
824 
825 #if TI_SD_CONF_ENABLE
826 
827 #if !(TI_SPI_CONF_SPI0_ENABLE)
828 #error "SD driver requires SPI0 enabled"
829 #endif
830 
831 SDSPI_Object sdspiObjects[CC1352P_2_LAUNCHXL_SDCOUNT];
832 
833 const SDSPI_HWAttrs sdspiHWAttrs[CC1352P_2_LAUNCHXL_SDCOUNT] = {
834  {
835  .spiIndex = CC1352P_2_LAUNCHXL_SPI0,
836  .spiCsGpioIndex = CC1352P_2_LAUNCHXL_GPIO_DIO_19
837  }
838 };
839 
840 const SD_Config SD_config[CC1352P_2_LAUNCHXL_SDCOUNT] = {
841  {
842  .fxnTablePtr = &SDSPI_fxnTable,
843  .object = &sdspiObjects[CC1352P_2_LAUNCHXL_SDSPI0],
844  .hwAttrs = &sdspiHWAttrs[CC1352P_2_LAUNCHXL_SDSPI0]
845  },
846 };
847 
848 const uint_least8_t SD_count = CC1352P_2_LAUNCHXL_SDCOUNT;
849 
850 #endif /* TI_SD_CONF_ENABLE */
851 
852 /*
853  * =============================== SPI DMA ===============================
854  */
855 #include <ti/drivers/SPI.h>
856 #include <ti/drivers/spi/SPICC26X2DMA.h>
857 
858 #if TI_SPI_CONF_ENABLE
859 
860 SPICC26X2DMA_Object spiCC26X2DMAObjects[CC1352P_2_LAUNCHXL_SPICOUNT];
861 
862 /*
863  * NOTE: The SPI instances below can be used by the SD driver to communicate
864  * with a SD card via SPI. The 'defaultTxBufValue' fields below are set to 0xFF
865  * to satisfy the SDSPI driver requirement.
866  */
867 const SPICC26X2DMA_HWAttrs spiCC26X2DMAHWAttrs[CC1352P_2_LAUNCHXL_SPICOUNT] = {
868 #if TI_SPI_CONF_SPI0_ENABLE
869  {
870  .baseAddr = SSI0_BASE,
871  .intNum = INT_SSI0_COMB,
872  .intPriority = ~0,
873  .swiPriority = 0,
874  .powerMngrId = PowerCC26XX_PERIPH_SSI0,
875  .defaultTxBufValue = 0xFF,
876  .rxChannelBitMask = 1<<UDMA_CHAN_SSI0_RX,
877  .txChannelBitMask = 1<<UDMA_CHAN_SSI0_TX,
878  .mosiPin = CC1352P_2_LAUNCHXL_SPI0_MOSI,
879  .misoPin = CC1352P_2_LAUNCHXL_SPI0_MISO,
880  .clkPin = CC1352P_2_LAUNCHXL_SPI0_CLK,
881  .csnPin = CC1352P_2_LAUNCHXL_SPI0_CSN,
882  .minDmaTransferSize = 10
883  },
884 #endif
885 #if TI_SPI_CONF_SPI1_ENABLE
886  {
887  .baseAddr = SSI1_BASE,
888  .intNum = INT_SSI1_COMB,
889  .intPriority = ~0,
890  .swiPriority = 0,
891  .powerMngrId = PowerCC26XX_PERIPH_SSI1,
892  .defaultTxBufValue = 0xFF,
893  .rxChannelBitMask = 1<<UDMA_CHAN_SSI1_RX,
894  .txChannelBitMask = 1<<UDMA_CHAN_SSI1_TX,
895  .mosiPin = CC1352P_2_LAUNCHXL_SPI1_MOSI,
896  .misoPin = CC1352P_2_LAUNCHXL_SPI1_MISO,
897  .clkPin = CC1352P_2_LAUNCHXL_SPI1_CLK,
898  .csnPin = CC1352P_2_LAUNCHXL_SPI1_CSN,
899  .minDmaTransferSize = 10
900  },
901 #endif
902 };
903 
904 const SPI_Config SPI_config[CC1352P_2_LAUNCHXL_SPICOUNT] = {
905 #if TI_SPI_CONF_SPI0_ENABLE
906  {
907  .fxnTablePtr = &SPICC26X2DMA_fxnTable,
908  .object = &spiCC26X2DMAObjects[CC1352P_2_LAUNCHXL_SPI0],
909  .hwAttrs = &spiCC26X2DMAHWAttrs[CC1352P_2_LAUNCHXL_SPI0]
910  },
911 #endif
912 #if TI_SPI_CONF_SPI1_ENABLE
913  {
914  .fxnTablePtr = &SPICC26X2DMA_fxnTable,
915  .object = &spiCC26X2DMAObjects[CC1352P_2_LAUNCHXL_SPI1],
916  .hwAttrs = &spiCC26X2DMAHWAttrs[CC1352P_2_LAUNCHXL_SPI1]
917  },
918 #endif
919 };
920 
921 const uint_least8_t SPI_count = CC1352P_2_LAUNCHXL_SPICOUNT;
922 
923 #endif /* TI_SPI_CONF_ENABLE */
924 
925 /*
926  * =============================== UART ===============================
927  */
928 #include <ti/drivers/UART.h>
929 #include <ti/drivers/uart/UARTCC26XX.h>
930 
931 #if TI_UART_CONF_ENABLE
932 
933 UARTCC26XX_Object uartCC26XXObjects[CC1352P_2_LAUNCHXL_UARTCOUNT];
934 
935 uint8_t uartCC26XXRingBuffer[CC1352P_2_LAUNCHXL_UARTCOUNT][32];
936 
937 const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1352P_2_LAUNCHXL_UARTCOUNT] = {
938 #if TI_UART_CONF_UART0_ENABLE
939  {
940  .baseAddr = UART0_BASE,
941  .powerMngrId = PowerCC26XX_PERIPH_UART0,
942  .intNum = INT_UART0_COMB,
943  .intPriority = ~0,
944  .swiPriority = 0,
945  .txPin = CC1352P_2_LAUNCHXL_UART0_TX,
946  .rxPin = CC1352P_2_LAUNCHXL_UART0_RX,
947  .ctsPin = PIN_UNASSIGNED,
948  .rtsPin = PIN_UNASSIGNED,
949  .ringBufPtr = uartCC26XXRingBuffer[CC1352P_2_LAUNCHXL_UART0],
950  .ringBufSize = sizeof(uartCC26XXRingBuffer[CC1352P_2_LAUNCHXL_UART0]),
951  .txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8,
952  .rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8,
953  .errorFxn = NULL
954  },
955 #endif
957  {
958  .baseAddr = UART1_BASE,
959  .powerMngrId = PowerCC26X2_PERIPH_UART1,
960  .intNum = INT_UART1_COMB,
961  .intPriority = ~0,
962  .swiPriority = 0,
963  .txPin = CC1352P_2_LAUNCHXL_UART1_TX,
964  .rxPin = CC1352P_2_LAUNCHXL_UART1_RX,
965  .ctsPin = PIN_UNASSIGNED,
966  .rtsPin = PIN_UNASSIGNED,
967  .ringBufPtr = uartCC26XXRingBuffer[CC1352P_2_LAUNCHXL_UART1],
968  .ringBufSize = sizeof(uartCC26XXRingBuffer[CC1352P_2_LAUNCHXL_UART1]),
969  .txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8,
970  .rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8,
971  .errorFxn = NULL
972  },
973 #endif
974 };
975 
976 const UART_Config UART_config[CC1352P_2_LAUNCHXL_UARTCOUNT] = {
977 #if TI_UART_CONF_UART0_ENABLE
978  {
979  .fxnTablePtr = &UARTCC26XX_fxnTable,
980  .object = &uartCC26XXObjects[CC1352P_2_LAUNCHXL_UART0],
981  .hwAttrs = &uartCC26XXHWAttrs[CC1352P_2_LAUNCHXL_UART0]
982  },
983 #endif
984 #if TI_UART_CONF_UART1_ENABLE
985  {
986  .fxnTablePtr = &UARTCC26XX_fxnTable,
987  .object = &uartCC26XXObjects[CC1352P_2_LAUNCHXL_UART1],
988  .hwAttrs = &uartCC26XXHWAttrs[CC1352P_2_LAUNCHXL_UART1]
989  },
990 #endif
991 };
992 
993 const uint_least8_t UART_count = CC1352P_2_LAUNCHXL_UARTCOUNT;
994 
995 #endif /* TI_UART_CONF_ENABLE */
996 
997 /*
998  * =============================== UDMA ===============================
999  */
1000 #include <ti/drivers/dma/UDMACC26XX.h>
1001 
1002 UDMACC26XX_Object udmaObjects[CC1352P_2_LAUNCHXL_UDMACOUNT];
1003 
1004 const UDMACC26XX_HWAttrs udmaHWAttrs[CC1352P_2_LAUNCHXL_UDMACOUNT] = {
1005  {
1006  .baseAddr = UDMA0_BASE,
1007  .powerMngrId = PowerCC26XX_PERIPH_UDMA,
1008  .intNum = INT_DMA_ERR,
1009  .intPriority = ~0
1010  }
1011 };
1012 
1013 const UDMACC26XX_Config UDMACC26XX_config[CC1352P_2_LAUNCHXL_UDMACOUNT] = {
1014  {
1015  .object = &udmaObjects[CC1352P_2_LAUNCHXL_UDMA0],
1016  .hwAttrs = &udmaHWAttrs[CC1352P_2_LAUNCHXL_UDMA0]
1017  },
1018 };
1019 
1020 
1021 
1022 /*
1023  * =============================== Watchdog ===============================
1024  */
1025 #include <ti/drivers/Watchdog.h>
1026 #include <ti/drivers/watchdog/WatchdogCC26XX.h>
1027 
1028 WatchdogCC26XX_Object watchdogCC26XXObjects[CC1352P_2_LAUNCHXL_WATCHDOGCOUNT];
1029 
1030 const WatchdogCC26XX_HWAttrs watchdogCC26XXHWAttrs[CC1352P_2_LAUNCHXL_WATCHDOGCOUNT] = {
1031  {
1032  .baseAddr = WDT_BASE,
1033  .reloadValue = 1000 /* Reload value in milliseconds */
1034  },
1035 };
1036 
1037 const Watchdog_Config Watchdog_config[CC1352P_2_LAUNCHXL_WATCHDOGCOUNT] = {
1038  {
1039  .fxnTablePtr = &WatchdogCC26XX_fxnTable,
1040  .object = &watchdogCC26XXObjects[CC1352P_2_LAUNCHXL_WATCHDOG0],
1041  .hwAttrs = &watchdogCC26XXHWAttrs[CC1352P_2_LAUNCHXL_WATCHDOG0]
1042  },
1043 };
1044 
1045 const uint_least8_t Watchdog_count = CC1352P_2_LAUNCHXL_WATCHDOGCOUNT;
1046 
1047 /*
1048  * Board-specific initialization function to disable external flash.
1049  * This function is defined in the file CC1352P_2_LAUNCHXL_fxns.c
1050  */
1051 extern void Board_initHook(void);
1052 
1053 /*
1054  * ======== CC1352P_2_LAUNCHXL_initGeneral ========
1055  */
1057 {
1058  Power_init();
1059 
1060  if (PIN_init(BoardGpioInitTable) != PIN_SUCCESS) {
1061  /* Error with PIN_init */
1062  while (1);
1063  }
1064 
1065  /* Perform board-specific initialization */
1066  Board_initHook();
1067 }
1068 
1069 /*
1070  * ======== Board_init ========
1071  */
1072 void Board_init(void)
1073 {
1075 }
#define SSI1_BASE
Base address for SSI1.
Definition: ssi.h:59
#define SSI0_BASE
Base address for SSI0.
Definition: ssi.h:58
===========================================================================
#define TI_UART_CONF_UART1_ENABLE
Enable or disable UART1 peripheral.
Header file for the CC13xx/CC26xx clock implementation.
void CC1352P_2_LAUNCHXL_initGeneral(void)
Initialize the general board specific settings.
void clock_arch_standby_policy(void)
Called by the Power driver when dropping to some low-power state.
Definition: clock-arch.c:184