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