Contiki-NG
CC1352P1_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  * ====================== CC1352P1_LAUNCHXL.c ===================================
35  * This file is responsible for setting up the board specific items for the
36  * CC1352P1_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 "CC1352P1_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[CC1352P1_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[CC1352P1_LAUNCHXL_ADCBUF0CHANNELCOUNT] = {
67  {CC1352P1_LAUNCHXL_DIO23_ANALOG, ADC_COMPB_IN_AUXIO7},
68  {CC1352P1_LAUNCHXL_DIO24_ANALOG, ADC_COMPB_IN_AUXIO6},
69  {CC1352P1_LAUNCHXL_DIO25_ANALOG, ADC_COMPB_IN_AUXIO5},
70  {CC1352P1_LAUNCHXL_DIO26_ANALOG, ADC_COMPB_IN_AUXIO4},
71  {CC1352P1_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[CC1352P1_LAUNCHXL_ADCBUFCOUNT] = {
78  {
79  .intPriority = ~0,
80  .swiPriority = 0,
81  .adcChannelLut = ADCBufCC26X2_adcChannelLut,
82  .gpTimerUnit = CC1352P1_LAUNCHXL_GPTIMER0A,
83  }
84 };
85 
86 const ADCBuf_Config ADCBuf_config[CC1352P1_LAUNCHXL_ADCBUFCOUNT] = {
87  {
88  &ADCBufCC26X2_fxnTable,
89  &adcBufCC26xxObjects[CC1352P1_LAUNCHXL_ADCBUF0],
90  &adcBufCC26xxHWAttrs[CC1352P1_LAUNCHXL_ADCBUF0]
91  },
92 };
93 
94 const uint_least8_t ADCBuf_count = CC1352P1_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[CC1352P1_LAUNCHXL_ADCCOUNT];
103 
104 const ADCCC26XX_HWAttrs adcCC26xxHWAttrs[CC1352P1_LAUNCHXL_ADCCOUNT] = {
105  {
106  .adcDIO = CC1352P1_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 = CC1352P1_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 = CC1352P1_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 = CC1352P1_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 = CC1352P1_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[CC1352P1_LAUNCHXL_ADCCOUNT] = {
180  {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P1_LAUNCHXL_ADC0], &adcCC26xxHWAttrs[CC1352P1_LAUNCHXL_ADC0]},
181  {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P1_LAUNCHXL_ADC1], &adcCC26xxHWAttrs[CC1352P1_LAUNCHXL_ADC1]},
182  {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P1_LAUNCHXL_ADC2], &adcCC26xxHWAttrs[CC1352P1_LAUNCHXL_ADC2]},
183  {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P1_LAUNCHXL_ADC3], &adcCC26xxHWAttrs[CC1352P1_LAUNCHXL_ADC3]},
184  {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P1_LAUNCHXL_ADC4], &adcCC26xxHWAttrs[CC1352P1_LAUNCHXL_ADC4]},
185  {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P1_LAUNCHXL_ADCDCOUPL], &adcCC26xxHWAttrs[CC1352P1_LAUNCHXL_ADCDCOUPL]},
186  {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P1_LAUNCHXL_ADCVSS], &adcCC26xxHWAttrs[CC1352P1_LAUNCHXL_ADCVSS]},
187  {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1352P1_LAUNCHXL_ADCVDDS], &adcCC26xxHWAttrs[CC1352P1_LAUNCHXL_ADCVDDS]},
188 };
189 
190 const uint_least8_t ADC_count = CC1352P1_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[CC1352P1_LAUNCHXL_ECDHCOUNT];
199 
200 const ECDHCC26X2_HWAttrs ecdhCC26X2HWAttrs[CC1352P1_LAUNCHXL_ECDHCOUNT] = {
201  {
202  .intPriority = ~0,
203  }
204 };
205 
206 const ECDH_Config ECDH_config[CC1352P1_LAUNCHXL_ECDHCOUNT] = {
207  {
208  .object = &ecdhCC26X2Objects[CC1352P1_LAUNCHXL_ECDH0],
209  .hwAttrs = &ecdhCC26X2HWAttrs[CC1352P1_LAUNCHXL_ECDH0]
210  },
211 };
212 
213 const uint_least8_t ECDH_count = CC1352P1_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[CC1352P1_LAUNCHXL_ECDSACOUNT];
222 
223 const ECDSACC26X2_HWAttrs ecdsaCC26X2HWAttrs[CC1352P1_LAUNCHXL_ECDSACOUNT] = {
224  {
225  .intPriority = ~0,
226  }
227 };
228 
229 const ECDSA_Config ECDSA_config[CC1352P1_LAUNCHXL_ECDSACOUNT] = {
230  {
231  .object = &ecdsaCC26X2Objects[CC1352P1_LAUNCHXL_ECDSA0],
232  .hwAttrs = &ecdsaCC26X2HWAttrs[CC1352P1_LAUNCHXL_ECDSA0]
233  },
234 };
235 
236 const uint_least8_t ECDSA_count = CC1352P1_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[CC1352P1_LAUNCHXL_ECJPAKECOUNT];
245 
246 const ECJPAKECC26X2_HWAttrs ecjpakeCC26X2HWAttrs[CC1352P1_LAUNCHXL_ECJPAKECOUNT] = {
247  {
248  .intPriority = ~0,
249  }
250 };
251 
252 const ECJPAKE_Config ECJPAKE_config[CC1352P1_LAUNCHXL_ECJPAKECOUNT] = {
253  {
254  .object = &ecjpakeCC26X2Objects[CC1352P1_LAUNCHXL_ECJPAKE0],
255  .hwAttrs = &ecjpakeCC26X2HWAttrs[CC1352P1_LAUNCHXL_ECJPAKE0]
256  },
257 };
258 
259 const uint_least8_t ECJPAKE_count = CC1352P1_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[CC1352P1_LAUNCHXL_SHA2COUNT];
269 
270 const SHA2CC26X2_HWAttrs sha2CC26X2HWAttrs[CC1352P1_LAUNCHXL_SHA2COUNT] = {
271  {
272  .intPriority = ~0,
273  }
274 };
275 
276 const SHA2_Config SHA2_config[CC1352P1_LAUNCHXL_SHA2COUNT] = {
277  {
278  .object = &sha2CC26X2Objects[CC1352P1_LAUNCHXL_SHA20],
279  .hwAttrs = &sha2CC26X2HWAttrs[CC1352P1_LAUNCHXL_SHA20]
280  },
281 };
282 
283 const uint_least8_t SHA2_count = CC1352P1_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[CC1352P1_LAUNCHXL_AESCCMCOUNT];
292 
293 const AESCCMCC26XX_HWAttrs aesccmCC26XXHWAttrs[CC1352P1_LAUNCHXL_AESCCMCOUNT] = {
294  {
295  .intPriority = ~0,
296  }
297 };
298 
299 const AESCCM_Config AESCCM_config[CC1352P1_LAUNCHXL_AESCCMCOUNT] = {
300  {
301  .object = &aesccmCC26XXObjects[CC1352P1_LAUNCHXL_AESCCM0],
302  .hwAttrs = &aesccmCC26XXHWAttrs[CC1352P1_LAUNCHXL_AESCCM0]
303  },
304 };
305 
306 const uint_least8_t AESCCM_count = CC1352P1_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[CC1352P1_LAUNCHXL_AESGCMCOUNT];
315 
316 const AESGCMCC26XX_HWAttrs aesgcmCC26XXHWAttrs[CC1352P1_LAUNCHXL_AESGCMCOUNT] = {
317  {
318  .intPriority = ~0,
319  }
320 };
321 
322 const AESGCM_Config AESGCM_config[CC1352P1_LAUNCHXL_AESGCMCOUNT] = {
323  {
324  .object = &aesgcmCC26XXObjects[CC1352P1_LAUNCHXL_AESGCM0],
325  .hwAttrs = &aesgcmCC26XXHWAttrs[CC1352P1_LAUNCHXL_AESGCM0]
326  },
327 };
328 
329 const uint_least8_t AESGCM_count = CC1352P1_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[CC1352P1_LAUNCHXL_AESCBCCOUNT];
338 
339 const AESCBCCC26XX_HWAttrs aescbcCC26XXHWAttrs[CC1352P1_LAUNCHXL_AESCBCCOUNT] = {
340  {
341  .intPriority = ~0,
342  }
343 };
344 
345 const AESCBC_Config AESCBC_config[CC1352P1_LAUNCHXL_AESCBCCOUNT] = {
346  {
347  .object = &aescbcCC26XXObjects[CC1352P1_LAUNCHXL_AESCBC0],
348  .hwAttrs = &aescbcCC26XXHWAttrs[CC1352P1_LAUNCHXL_AESCBC0]
349  },
350 };
351 
352 const uint_least8_t AESCBC_count = CC1352P1_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[CC1352P1_LAUNCHXL_AESCTRCOUNT];
361 
362 const AESCTRCC26XX_HWAttrs aesctrCC26XXHWAttrs[CC1352P1_LAUNCHXL_AESCTRCOUNT] = {
363  {
364  .intPriority = ~0,
365  }
366 };
367 
368 const AESCTR_Config AESCTR_config[CC1352P1_LAUNCHXL_AESCTRCOUNT] = {
369  {
370  .object = &aesctrCC26XXObjects[CC1352P1_LAUNCHXL_AESCTR0],
371  .hwAttrs = &aesctrCC26XXHWAttrs[CC1352P1_LAUNCHXL_AESCTR0]
372  },
373 };
374 
375 const uint_least8_t AESCTR_count = CC1352P1_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[CC1352P1_LAUNCHXL_AESECBCOUNT];
384 
385 const AESECBCC26XX_HWAttrs aesecbCC26XXHWAttrs[CC1352P1_LAUNCHXL_AESECBCOUNT] = {
386  {
387  .intPriority = ~0,
388  }
389 };
390 
391 const AESECB_Config AESECB_config[CC1352P1_LAUNCHXL_AESECBCOUNT] = {
392  {
393  .object = &aesecbCC26XXObjects[CC1352P1_LAUNCHXL_AESECB0],
394  .hwAttrs = &aesecbCC26XXHWAttrs[CC1352P1_LAUNCHXL_AESECB0]
395  },
396 };
397 
398 const uint_least8_t AESECB_count = CC1352P1_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[CC1352P1_LAUNCHXL_AESCTRDRBGCOUNT];
407 
408 const AESCTRDRBGXX_HWAttrs aesctrdrbgXXHWAttrs[CC1352P1_LAUNCHXL_AESCTRDRBGCOUNT] = {
409  {
410  .aesctrIndex = CC1352P1_LAUNCHXL_AESCTR0,
411  }
412 };
413 
414 const AESCTRDRBG_Config AESCTRDRBG_config[CC1352P1_LAUNCHXL_AESCTRDRBGCOUNT] = {
415  {
416  .object = &aesctrdrbgXXObjects[CC1352P1_LAUNCHXL_AESCTRDRBG0],
417  .hwAttrs = &aesctrdrbgXXHWAttrs[CC1352P1_LAUNCHXL_AESCTRDRBG0]
418  },
419 };
420 
421 const uint_least8_t AESCTRDRBG_count = CC1352P1_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[CC1352P1_LAUNCHXL_TRNGCOUNT];
430 
431 const TRNGCC26XX_HWAttrs trngCC26X2HWAttrs[CC1352P1_LAUNCHXL_TRNGCOUNT] = {
432  {
433  .intPriority = ~0,
434  .swiPriority = 0,
435  .samplesPerCycle = 240000,
436  }
437 };
438 
439 const TRNG_Config TRNG_config[CC1352P1_LAUNCHXL_TRNGCOUNT] = {
440  {
441  .object = &trngCC26XXObjects[CC1352P1_LAUNCHXL_TRNG0],
442  .hwAttrs = &trngCC26X2HWAttrs[CC1352P1_LAUNCHXL_TRNG0]
443  },
444 };
445 
446 const uint_least8_t TRNG_count = CC1352P1_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 CC1352P1_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, /* CC1352P1_LAUNCHXL_SPI_MASTER_READY */
468  GPIOCC26XX_DIO_21 | GPIO_DO_NOT_CONFIG, /* CC1352P1_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  * On CC1352P LaunchPads, the default LaunchPad header for SD CS is not
479  * connected. DIO_14 is mapped to the alternate SD CS pin on the SHARP128
480  * BoosterPack. To enable the alternate SD CS BoosterPack pin, you need to
481  * remove the SHARP128 R16 and solder it onto the unpopulated R17 instead.
482  * When using the SD CS in this manner, BTN-2 is unavaillable since they
483  * both map to DIO_14.
484  * Alternatively, you can jumper wire the following on the LaunchPad:
485  * J1.8 to DIO14
486  */
487  GPIOCC26XX_DIO_14 | GPIO_DO_NOT_CONFIG,
488 };
489 
490 /*
491  * Array of callback function pointers
492  * NOTE: The order of the pin configurations must coincide with what was
493  * defined in CC1352P_LAUNCH.h
494  * NOTE: Pins not used for interrupts can be omitted from callbacks array to
495  * reduce memory usage (if placed at end of gpioPinConfigs array).
496  */
497 GPIO_CallbackFxn gpioCallbackFunctions[] = {
498  NULL, /* Button 0 */
499  NULL, /* Button 1 */
500  NULL, /* CC1352P1_LAUNCHXL_SPI_MASTER_READY */
501  NULL, /* CC1352P1_LAUNCHXL_SPI_SLAVE_READY */
502 };
503 
504 const GPIOCC26XX_Config GPIOCC26XX_config = {
505  .pinConfigs = (GPIO_PinConfig *)gpioPinConfigs,
506  .callbacks = (GPIO_CallbackFxn *)gpioCallbackFunctions,
507  .numberOfPinConfigs = CC1352P1_LAUNCHXL_GPIOCOUNT,
508  .numberOfCallbacks = sizeof(gpioCallbackFunctions)/sizeof(GPIO_CallbackFxn),
509  .intPriority = (~0)
510 };
511 
512 /*
513  * =============================== GPTimer ===============================
514  * Remove unused entries to reduce flash usage both in Board.c and Board.h
515  */
516 #include <ti/drivers/timer/GPTimerCC26XX.h>
517 
518 GPTimerCC26XX_Object gptimerCC26XXObjects[CC1352P1_LAUNCHXL_GPTIMERCOUNT];
519 
520 const GPTimerCC26XX_HWAttrs gptimerCC26xxHWAttrs[CC1352P1_LAUNCHXL_GPTIMERPARTSCOUNT] = {
521  { .baseAddr = GPT0_BASE, .intNum = INT_GPT0A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0A, },
522  { .baseAddr = GPT0_BASE, .intNum = INT_GPT0B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0B, },
523  { .baseAddr = GPT1_BASE, .intNum = INT_GPT1A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1A, },
524  { .baseAddr = GPT1_BASE, .intNum = INT_GPT1B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1B, },
525  { .baseAddr = GPT2_BASE, .intNum = INT_GPT2A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2A, },
526  { .baseAddr = GPT2_BASE, .intNum = INT_GPT2B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2B, },
527  { .baseAddr = GPT3_BASE, .intNum = INT_GPT3A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3A, },
528  { .baseAddr = GPT3_BASE, .intNum = INT_GPT3B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3B, },
529 };
530 
531 const GPTimerCC26XX_Config GPTimerCC26XX_config[CC1352P1_LAUNCHXL_GPTIMERPARTSCOUNT] = {
532  { &gptimerCC26XXObjects[CC1352P1_LAUNCHXL_GPTIMER0], &gptimerCC26xxHWAttrs[CC1352P1_LAUNCHXL_GPTIMER0A], GPT_A },
533  { &gptimerCC26XXObjects[CC1352P1_LAUNCHXL_GPTIMER0], &gptimerCC26xxHWAttrs[CC1352P1_LAUNCHXL_GPTIMER0B], GPT_B },
534  { &gptimerCC26XXObjects[CC1352P1_LAUNCHXL_GPTIMER1], &gptimerCC26xxHWAttrs[CC1352P1_LAUNCHXL_GPTIMER1A], GPT_A },
535  { &gptimerCC26XXObjects[CC1352P1_LAUNCHXL_GPTIMER1], &gptimerCC26xxHWAttrs[CC1352P1_LAUNCHXL_GPTIMER1B], GPT_B },
536  { &gptimerCC26XXObjects[CC1352P1_LAUNCHXL_GPTIMER2], &gptimerCC26xxHWAttrs[CC1352P1_LAUNCHXL_GPTIMER2A], GPT_A },
537  { &gptimerCC26XXObjects[CC1352P1_LAUNCHXL_GPTIMER2], &gptimerCC26xxHWAttrs[CC1352P1_LAUNCHXL_GPTIMER2B], GPT_B },
538  { &gptimerCC26XXObjects[CC1352P1_LAUNCHXL_GPTIMER3], &gptimerCC26xxHWAttrs[CC1352P1_LAUNCHXL_GPTIMER3A], GPT_A },
539  { &gptimerCC26XXObjects[CC1352P1_LAUNCHXL_GPTIMER3], &gptimerCC26xxHWAttrs[CC1352P1_LAUNCHXL_GPTIMER3B], GPT_B },
540 };
541 
542 /*
543  * =============================== I2C ===============================
544 */
545 #include <ti/drivers/I2C.h>
546 #include <ti/drivers/i2c/I2CCC26XX.h>
547 
548 #if TI_I2C_CONF_ENABLE
549 
550 I2CCC26XX_Object i2cCC26xxObjects[CC1352P1_LAUNCHXL_I2CCOUNT];
551 
552 const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC1352P1_LAUNCHXL_I2CCOUNT] = {
553 #if TI_I2C_CONF_I2C0_ENABLE
554  {
555  .baseAddr = I2C0_BASE,
556  .powerMngrId = PowerCC26XX_PERIPH_I2C0,
557  .intNum = INT_I2C_IRQ,
558  .intPriority = ~0,
559  .swiPriority = 0,
560  .sdaPin = CC1352P1_LAUNCHXL_I2C0_SDA0,
561  .sclPin = CC1352P1_LAUNCHXL_I2C0_SCL0,
562  },
563 #endif
564 };
565 
566 const I2C_Config I2C_config[CC1352P1_LAUNCHXL_I2CCOUNT] = {
567 #if TI_I2C_CONF_I2C0_ENABLE
568  {
569  .fxnTablePtr = &I2CCC26XX_fxnTable,
570  .object = &i2cCC26xxObjects[CC1352P1_LAUNCHXL_I2C0],
571  .hwAttrs = &i2cCC26xxHWAttrs[CC1352P1_LAUNCHXL_I2C0]
572  },
573 #endif
574 };
575 
576 const uint_least8_t I2C_count = CC1352P1_LAUNCHXL_I2CCOUNT;
577 
578 #endif /* TI_I2C_CONF_ENABLE */
579 
580 /*
581  * =============================== I2S ===============================
582 */
583 #include <ti/drivers/I2S.h>
584 #include <ti/drivers/i2s/I2SCC26XX.h>
585 
586 I2SCC26XX_Object i2sCC26XXObjects[CC1352P1_LAUNCHXL_I2SCOUNT];
587 
588 const I2SCC26XX_HWAttrs i2sCC26XXHWAttrs[CC1352P1_LAUNCHXL_I2SCOUNT] = {
589  {
590  .pinSD1 = CC1352P1_LAUNCHXL_I2S_ADI,
591  .pinSD0 = CC1352P1_LAUNCHXL_I2S_ADO,
592  .pinSCK = CC1352P1_LAUNCHXL_I2S_BCLK,
593  .pinMCLK = CC1352P1_LAUNCHXL_I2S_MCLK,
594  .pinWS = CC1352P1_LAUNCHXL_I2S_WCLK,
595  .intPriority = ~0,
596  }
597 };
598 
599 const I2S_Config I2S_config[CC1352P1_LAUNCHXL_I2SCOUNT] = {
600  {
601  .object = &i2sCC26XXObjects[CC1352P1_LAUNCHXL_I2S0],
602  .hwAttrs = &i2sCC26XXHWAttrs[CC1352P1_LAUNCHXL_I2S0]
603  },
604 };
605 
606 const uint_least8_t I2S_count = CC1352P1_LAUNCHXL_I2SCOUNT;
607 
608 /*
609  * =============================== NVS ===============================
610  */
611 #include <ti/drivers/NVS.h>
612 #include <ti/drivers/nvs/NVSSPI25X.h>
613 #include <ti/drivers/nvs/NVSCC26XX.h>
614 
615 #define NVS_REGIONS_BASE 0x48000
616 #define SECTORSIZE 0x2000
617 #define REGIONSIZE (SECTORSIZE * 4)
618 
619 #if TI_NVS_CONF_ENABLE
620 
621 #if TI_NVS_CONF_NVS_INTERNAL_ENABLE
622 
623 /*
624  * Reserve flash sectors for NVS driver use by placing an uninitialized byte
625  * array at the desired flash address.
626  */
627 #if defined(__TI_COMPILER_VERSION__)
628 
629 /*
630  * Place uninitialized array at NVS_REGIONS_BASE
631  */
632 #pragma LOCATION(flashBuf, NVS_REGIONS_BASE);
633 #pragma NOINIT(flashBuf);
634 static char flashBuf[REGIONSIZE];
635 
636 #elif defined(__IAR_SYSTEMS_ICC__)
637 
638 /*
639  * Place uninitialized array at NVS_REGIONS_BASE
640  */
641 static __no_init char flashBuf[REGIONSIZE] @ NVS_REGIONS_BASE;
642 
643 #elif defined(__GNUC__)
644 
645 /*
646  * Place the flash buffers in the .nvs section created in the gcc linker file.
647  * The .nvs section enforces alignment on a sector boundary but may
648  * be placed anywhere in flash memory. If desired the .nvs section can be set
649  * to a fixed address by changing the following in the gcc linker file:
650  *
651  * .nvs (FIXED_FLASH_ADDR) (NOLOAD) : AT (FIXED_FLASH_ADDR) {
652  * *(.nvs)
653  * } > REGION_TEXT
654  */
655 __attribute__ ((section (".nvs")))
656 static char flashBuf[REGIONSIZE];
657 
658 #endif
659 
660 /* Allocate objects for NVS Internal Regions */
661 NVSCC26XX_Object nvsCC26xxObjects[1];
662 
663 /* Hardware attributes for NVS Internal Regions */
664 const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = {
665  {
666  .regionBase = (void *)flashBuf,
667  .regionSize = REGIONSIZE,
668  },
669 };
670 
671 #endif /* TI_NVS_CONF_NVS_INTERNAL_ENABLE */
672 
673 #if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
674 
675 #define SPISECTORSIZE 0x1000
676 #define SPIREGIONSIZE (SPISECTORSIZE * 32)
677 #define VERIFYBUFSIZE 64
678 
679 static uint8_t verifyBuf[VERIFYBUFSIZE];
680 
681 /* Allocate objects for NVS External Regions */
682 NVSSPI25X_Object nvsSPI25XObjects[1];
683 
684 /* Hardware attributes for NVS External Regions */
685 const NVSSPI25X_HWAttrs nvsSPI25XHWAttrs[1] = {
686  {
687  .regionBaseOffset = 0,
688  .regionSize = SPIREGIONSIZE,
689  .sectorSize = SPISECTORSIZE,
690  .verifyBuf = verifyBuf,
691  .verifyBufSize = VERIFYBUFSIZE,
692  .spiHandle = NULL,
693  .spiIndex = 0,
694  .spiBitRate = 4000000,
695  .spiCsnGpioIndex = CC1352P1_LAUNCHXL_GPIO_SPI_FLASH_CS,
696  .statusPollDelayUs = 100,
697  },
698 };
699 
700 #endif /* TI_NVS_CONF_NVS_EXTERNAL_ENABLE */
701 
702 /* NVS Region index 0 and 1 refer to NVS and NVS SPI respectively */
703 const NVS_Config NVS_config[CC1352P1_LAUNCHXL_NVSCOUNT] = {
704 #if TI_NVS_CONF_NVS_INTERNAL_ENABLE
705  {
706  .fxnTablePtr = &NVSCC26XX_fxnTable,
707  .object = &nvsCC26xxObjects[0],
708  .hwAttrs = &nvsCC26xxHWAttrs[0],
709  },
710 #endif
711 #if TI_NVS_CONF_NVS_EXTERNAL_ENABLE
712  {
713  .fxnTablePtr = &NVSSPI25X_fxnTable,
714  .object = &nvsSPI25XObjects[0],
715  .hwAttrs = &nvsSPI25XHWAttrs[0],
716  },
717 #endif
718 };
719 
720 const uint_least8_t NVS_count = CC1352P1_LAUNCHXL_NVSCOUNT;
721 
722 #endif /* TI_NVS_CONF_ENABLE */
723 
724 /*
725  * =============================== PIN ===============================
726  */
727 #include <ti/drivers/PIN.h>
728 #include <ti/drivers/pin/PINCC26XX.h>
729 
730 const PIN_Config BoardGpioInitTable[] = {
731 
732  CC1352P1_LAUNCHXL_PIN_RLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
733  CC1352P1_LAUNCHXL_PIN_GLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
734  CC1352P1_LAUNCHXL_PIN_BTN1 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
735  CC1352P1_LAUNCHXL_PIN_BTN2 | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
736  CC1352P1_LAUNCHXL_SPI_FLASH_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */
737  CC1352P1_LAUNCHXL_UART0_RX | PIN_INPUT_EN | PIN_PULLDOWN, /* UART RX via debugger back channel */
738  CC1352P1_LAUNCHXL_UART0_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL, /* UART TX via debugger back channel */
739  CC1352P1_LAUNCHXL_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */
740  CC1352P1_LAUNCHXL_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */
741  CC1352P1_LAUNCHXL_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI clock */
742  CC1352P1_LAUNCHXL_DIO28_RF_24GHZ | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* Path disabled */
743  CC1352P1_LAUNCHXL_DIO29_RF_HIGH_PA | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* Path disabled */
744  CC1352P1_LAUNCHXL_DIO30_RF_SUB1GHZ | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* Path disabled */
745  PIN_TERMINATE
746 };
747 
748 const PINCC26XX_HWAttrs PINCC26XX_hwAttrs = {
749  .intPriority = ~0,
750  .swiPriority = 0
751 };
752 
753 /*
754  * =============================== Power ===============================
755  */
756 #include <ti/drivers/Power.h>
757 #include <ti/drivers/power/PowerCC26X2.h>
758 #include "clock-arch.h"
759 
760 const PowerCC26X2_Config PowerCC26X2_config = {
761  .policyInitFxn = NULL,
762  .policyFxn = &clock_arch_standby_policy,
763  .calibrateFxn = &PowerCC26XX_calibrate,
764  .enablePolicy = true,
765  .calibrateRCOSC_LF = true,
766  .calibrateRCOSC_HF = true,
767 };
768 
769 /*
770  * =============================== PWM ===============================
771  * Remove unused entries to reduce flash usage both in Board.c and Board.h
772  */
773 #include <ti/drivers/PWM.h>
774 #include <ti/drivers/pwm/PWMTimerCC26XX.h>
775 
776 PWMTimerCC26XX_Object pwmtimerCC26xxObjects[CC1352P1_LAUNCHXL_PWMCOUNT];
777 
778 const PWMTimerCC26XX_HwAttrs pwmtimerCC26xxHWAttrs[CC1352P1_LAUNCHXL_PWMCOUNT] = {
779  { .pwmPin = CC1352P1_LAUNCHXL_PWMPIN0, .gpTimerUnit = CC1352P1_LAUNCHXL_GPTIMER0A },
780  { .pwmPin = CC1352P1_LAUNCHXL_PWMPIN1, .gpTimerUnit = CC1352P1_LAUNCHXL_GPTIMER0B },
781  { .pwmPin = CC1352P1_LAUNCHXL_PWMPIN2, .gpTimerUnit = CC1352P1_LAUNCHXL_GPTIMER1A },
782  { .pwmPin = CC1352P1_LAUNCHXL_PWMPIN3, .gpTimerUnit = CC1352P1_LAUNCHXL_GPTIMER1B },
783  { .pwmPin = CC1352P1_LAUNCHXL_PWMPIN4, .gpTimerUnit = CC1352P1_LAUNCHXL_GPTIMER2A },
784  { .pwmPin = CC1352P1_LAUNCHXL_PWMPIN5, .gpTimerUnit = CC1352P1_LAUNCHXL_GPTIMER2B },
785  { .pwmPin = CC1352P1_LAUNCHXL_PWMPIN6, .gpTimerUnit = CC1352P1_LAUNCHXL_GPTIMER3A },
786  { .pwmPin = CC1352P1_LAUNCHXL_PWMPIN7, .gpTimerUnit = CC1352P1_LAUNCHXL_GPTIMER3B },
787 };
788 
789 const PWM_Config PWM_config[CC1352P1_LAUNCHXL_PWMCOUNT] = {
790  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P1_LAUNCHXL_PWM0], &pwmtimerCC26xxHWAttrs[CC1352P1_LAUNCHXL_PWM0] },
791  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P1_LAUNCHXL_PWM1], &pwmtimerCC26xxHWAttrs[CC1352P1_LAUNCHXL_PWM1] },
792  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P1_LAUNCHXL_PWM2], &pwmtimerCC26xxHWAttrs[CC1352P1_LAUNCHXL_PWM2] },
793  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P1_LAUNCHXL_PWM3], &pwmtimerCC26xxHWAttrs[CC1352P1_LAUNCHXL_PWM3] },
794  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P1_LAUNCHXL_PWM4], &pwmtimerCC26xxHWAttrs[CC1352P1_LAUNCHXL_PWM4] },
795  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P1_LAUNCHXL_PWM5], &pwmtimerCC26xxHWAttrs[CC1352P1_LAUNCHXL_PWM5] },
796  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P1_LAUNCHXL_PWM6], &pwmtimerCC26xxHWAttrs[CC1352P1_LAUNCHXL_PWM6] },
797  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1352P1_LAUNCHXL_PWM7], &pwmtimerCC26xxHWAttrs[CC1352P1_LAUNCHXL_PWM7] },
798 };
799 
800 const uint_least8_t PWM_count = CC1352P1_LAUNCHXL_PWMCOUNT;
801 
802 /*
803  * =============================== RF Driver ===============================
804  */
805 #include <ti/drivers/rf/RF.h>
806 
807 /*
808  * Board-specific callback function to set the correct antenna path.
809  *
810  * This function is called by the RF driver on global driver events.
811  * It contains a default implementation to set the correct antenna path.
812  * This function is defined in the file CC1352P1_LAUNCHXL_fxns.c
813  */
814 extern void rfDriverCallback(RF_Handle client, RF_GlobalEvent events, void* arg);
815 
816 const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = {
817  .hwiPriority = ~0, /* Lowest HWI priority */
818  .swiPriority = 0, /* Lowest SWI priority */
819  .xoscHfAlwaysNeeded = true, /* Keep XOSC dependency while in standby */
820 
821  /* Register the board specific callback */
822  .globalCallback = &rfDriverCallback,
823 
824  /* Subscribe the callback to both events */
825  .globalEventMask = RF_GlobalEventRadioSetup | RF_GlobalEventRadioPowerDown
826 };
827 
828 /*
829  * =============================== SD ===============================
830  */
831 #include <ti/drivers/SD.h>
832 #include <ti/drivers/sd/SDSPI.h>
833 
834 #if TI_SD_CONF_ENABLE
835 
836 #if !(TI_SPI_CONF_SPI0_ENABLE)
837 #error "SD driver requires SPI0 enabled"
838 #endif
839 
840 SDSPI_Object sdspiObjects[CC1352P1_LAUNCHXL_SDCOUNT];
841 
842 const SDSPI_HWAttrs sdspiHWAttrs[CC1352P1_LAUNCHXL_SDCOUNT] = {
843  {
844  .spiIndex = CC1352P1_LAUNCHXL_SPI0,
845  .spiCsGpioIndex = CC1352P1_LAUNCHXL_SDSPI_CS
846  }
847 };
848 
849 const SD_Config SD_config[CC1352P1_LAUNCHXL_SDCOUNT] = {
850  {
851  .fxnTablePtr = &SDSPI_fxnTable,
852  .object = &sdspiObjects[CC1352P1_LAUNCHXL_SDSPI0],
853  .hwAttrs = &sdspiHWAttrs[CC1352P1_LAUNCHXL_SDSPI0]
854  },
855 };
856 
857 const uint_least8_t SD_count = CC1352P1_LAUNCHXL_SDCOUNT;
858 
859 #endif /* TI_SD_CONF_ENABLE */
860 
861 /*
862  * =============================== SPI DMA ===============================
863  */
864 #include <ti/drivers/SPI.h>
865 #include <ti/drivers/spi/SPICC26X2DMA.h>
866 
867 #if TI_SPI_CONF_ENABLE
868 
869 SPICC26X2DMA_Object spiCC26X2DMAObjects[CC1352P1_LAUNCHXL_SPICOUNT];
870 
871 /*
872  * NOTE: The SPI instances below can be used by the SD driver to communicate
873  * with a SD card via SPI. The 'defaultTxBufValue' fields below are set to 0xFF
874  * to satisfy the SDSPI driver requirement.
875  */
876 const SPICC26X2DMA_HWAttrs spiCC26X2DMAHWAttrs[CC1352P1_LAUNCHXL_SPICOUNT] = {
877 #if TI_SPI_CONF_SPI0_ENABLE
878  {
879  .baseAddr = SSI0_BASE,
880  .intNum = INT_SSI0_COMB,
881  .intPriority = ~0,
882  .swiPriority = 0,
883  .powerMngrId = PowerCC26XX_PERIPH_SSI0,
884  .defaultTxBufValue = 0xFF,
885  .rxChannelBitMask = 1<<UDMA_CHAN_SSI0_RX,
886  .txChannelBitMask = 1<<UDMA_CHAN_SSI0_TX,
887  .mosiPin = CC1352P1_LAUNCHXL_SPI0_MOSI,
888  .misoPin = CC1352P1_LAUNCHXL_SPI0_MISO,
889  .clkPin = CC1352P1_LAUNCHXL_SPI0_CLK,
890  .csnPin = CC1352P1_LAUNCHXL_SPI0_CSN,
891  .minDmaTransferSize = 10
892  },
893 #endif
894 #if TI_SPI_CONF_SPI1_ENABLE
895  {
896  .baseAddr = SSI1_BASE,
897  .intNum = INT_SSI1_COMB,
898  .intPriority = ~0,
899  .swiPriority = 0,
900  .powerMngrId = PowerCC26XX_PERIPH_SSI1,
901  .defaultTxBufValue = 0xFF,
902  .rxChannelBitMask = 1<<UDMA_CHAN_SSI1_RX,
903  .txChannelBitMask = 1<<UDMA_CHAN_SSI1_TX,
904  .mosiPin = CC1352P1_LAUNCHXL_SPI1_MOSI,
905  .misoPin = CC1352P1_LAUNCHXL_SPI1_MISO,
906  .clkPin = CC1352P1_LAUNCHXL_SPI1_CLK,
907  .csnPin = CC1352P1_LAUNCHXL_SPI1_CSN,
908  .minDmaTransferSize = 10
909  },
910 #endif
911 };
912 
913 const SPI_Config SPI_config[CC1352P1_LAUNCHXL_SPICOUNT] = {
914 #if TI_SPI_CONF_SPI0_ENABLE
915  {
916  .fxnTablePtr = &SPICC26X2DMA_fxnTable,
917  .object = &spiCC26X2DMAObjects[CC1352P1_LAUNCHXL_SPI0],
918  .hwAttrs = &spiCC26X2DMAHWAttrs[CC1352P1_LAUNCHXL_SPI0]
919  },
920 #endif
921 #if TI_SPI_CONF_SPI1_ENABLE
922  {
923  .fxnTablePtr = &SPICC26X2DMA_fxnTable,
924  .object = &spiCC26X2DMAObjects[CC1352P1_LAUNCHXL_SPI1],
925  .hwAttrs = &spiCC26X2DMAHWAttrs[CC1352P1_LAUNCHXL_SPI1]
926  },
927 #endif
928 };
929 
930 const uint_least8_t SPI_count = CC1352P1_LAUNCHXL_SPICOUNT;
931 
932 #endif /* TI_SPI_CONF_ENABLE */
933 
934 /*
935  * =============================== UART ===============================
936  */
937 #include <ti/drivers/UART.h>
938 #include <ti/drivers/uart/UARTCC26XX.h>
939 
940 #if TI_UART_CONF_ENABLE
941 
942 UARTCC26XX_Object uartCC26XXObjects[CC1352P1_LAUNCHXL_UARTCOUNT];
943 
944 uint8_t uartCC26XXRingBuffer[CC1352P1_LAUNCHXL_UARTCOUNT][32];
945 
946 const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1352P1_LAUNCHXL_UARTCOUNT] = {
947 #if TI_UART_CONF_UART0_ENABLE
948  {
949  .baseAddr = UART0_BASE,
950  .powerMngrId = PowerCC26XX_PERIPH_UART0,
951  .intNum = INT_UART0_COMB,
952  .intPriority = ~0,
953  .swiPriority = 0,
954  .txPin = CC1352P1_LAUNCHXL_UART0_TX,
955  .rxPin = CC1352P1_LAUNCHXL_UART0_RX,
956  .ctsPin = PIN_UNASSIGNED,
957  .rtsPin = PIN_UNASSIGNED,
958  .ringBufPtr = uartCC26XXRingBuffer[CC1352P1_LAUNCHXL_UART0],
959  .ringBufSize = sizeof(uartCC26XXRingBuffer[CC1352P1_LAUNCHXL_UART0]),
960  .txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8,
961  .rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8,
962  .errorFxn = NULL
963  },
964 #endif
966  {
967  .baseAddr = UART1_BASE,
968  .powerMngrId = PowerCC26X2_PERIPH_UART1,
969  .intNum = INT_UART1_COMB,
970  .intPriority = ~0,
971  .swiPriority = 0,
972  .txPin = CC1352P1_LAUNCHXL_UART1_TX,
973  .rxPin = CC1352P1_LAUNCHXL_UART1_RX,
974  .ctsPin = PIN_UNASSIGNED,
975  .rtsPin = PIN_UNASSIGNED,
976  .ringBufPtr = uartCC26XXRingBuffer[CC1352P1_LAUNCHXL_UART1],
977  .ringBufSize = sizeof(uartCC26XXRingBuffer[CC1352P1_LAUNCHXL_UART1]),
978  .txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8,
979  .rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8,
980  .errorFxn = NULL
981  },
982 #endif
983 };
984 
985 const UART_Config UART_config[CC1352P1_LAUNCHXL_UARTCOUNT] = {
986 #if TI_UART_CONF_UART0_ENABLE
987  {
988  .fxnTablePtr = &UARTCC26XX_fxnTable,
989  .object = &uartCC26XXObjects[CC1352P1_LAUNCHXL_UART0],
990  .hwAttrs = &uartCC26XXHWAttrs[CC1352P1_LAUNCHXL_UART0]
991  },
992 #endif
993 #if TI_UART_CONF_UART1_ENABLE
994  {
995  .fxnTablePtr = &UARTCC26XX_fxnTable,
996  .object = &uartCC26XXObjects[CC1352P1_LAUNCHXL_UART1],
997  .hwAttrs = &uartCC26XXHWAttrs[CC1352P1_LAUNCHXL_UART1]
998  },
999 #endif
1000 };
1001 
1002 const uint_least8_t UART_count = CC1352P1_LAUNCHXL_UARTCOUNT;
1003 
1004 #endif /* TI_UART_CONF_ENABLE */
1005 
1006 /*
1007  * =============================== UDMA ===============================
1008  */
1009 #include <ti/drivers/dma/UDMACC26XX.h>
1010 
1011 UDMACC26XX_Object udmaObjects[CC1352P1_LAUNCHXL_UDMACOUNT];
1012 
1013 const UDMACC26XX_HWAttrs udmaHWAttrs[CC1352P1_LAUNCHXL_UDMACOUNT] = {
1014  {
1015  .baseAddr = UDMA0_BASE,
1016  .powerMngrId = PowerCC26XX_PERIPH_UDMA,
1017  .intNum = INT_DMA_ERR,
1018  .intPriority = ~0
1019  }
1020 };
1021 
1022 const UDMACC26XX_Config UDMACC26XX_config[CC1352P1_LAUNCHXL_UDMACOUNT] = {
1023  {
1024  .object = &udmaObjects[CC1352P1_LAUNCHXL_UDMA0],
1025  .hwAttrs = &udmaHWAttrs[CC1352P1_LAUNCHXL_UDMA0]
1026  },
1027 };
1028 
1029 
1030 
1031 /*
1032  * =============================== Watchdog ===============================
1033  */
1034 #include <ti/drivers/Watchdog.h>
1035 #include <ti/drivers/watchdog/WatchdogCC26XX.h>
1036 
1037 WatchdogCC26XX_Object watchdogCC26XXObjects[CC1352P1_LAUNCHXL_WATCHDOGCOUNT];
1038 
1039 const WatchdogCC26XX_HWAttrs watchdogCC26XXHWAttrs[CC1352P1_LAUNCHXL_WATCHDOGCOUNT] = {
1040  {
1041  .baseAddr = WDT_BASE,
1042  .reloadValue = 1000 /* Reload value in milliseconds */
1043  },
1044 };
1045 
1046 const Watchdog_Config Watchdog_config[CC1352P1_LAUNCHXL_WATCHDOGCOUNT] = {
1047  {
1048  .fxnTablePtr = &WatchdogCC26XX_fxnTable,
1049  .object = &watchdogCC26XXObjects[CC1352P1_LAUNCHXL_WATCHDOG0],
1050  .hwAttrs = &watchdogCC26XXHWAttrs[CC1352P1_LAUNCHXL_WATCHDOG0]
1051  },
1052 };
1053 
1054 const uint_least8_t Watchdog_count = CC1352P1_LAUNCHXL_WATCHDOGCOUNT;
1055 
1056 /*
1057  * Board-specific initialization function to disable external flash.
1058  * This function is defined in the file CC1352P1_LAUNCHXL_fxns.c
1059  */
1060 extern void Board_initHook(void);
1061 
1062 /*
1063  * ======== CC1352P1_LAUNCHXL_initGeneral ========
1064  */
1066 {
1067  Power_init();
1068 
1069  if (PIN_init(BoardGpioInitTable) != PIN_SUCCESS) {
1070  /* Error with PIN_init */
1071  while (1);
1072  }
1073 
1074  /* Perform board-specific initialization */
1075  Board_initHook();
1076 }
1077 
1078 /*
1079  * ======== Board_init ========
1080  */
1081 void Board_init(void)
1082 {
1084 }
#define SSI1_BASE
Base address for SSI1.
Definition: ssi.h:59
#define SSI0_BASE
Base address for SSI0.
Definition: ssi.h:58
void CC1352P1_LAUNCHXL_initGeneral(void)
Initialize the general board specific settings.
#define TI_UART_CONF_UART1_ENABLE
Enable or disable UART1 peripheral.
===========================================================================
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