Contiki-NG
CC1350DK_7XD.c
1 /*
2  * Copyright (c) 2016-2018, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 /*
34  * ====================== CC1350DK_7XD.c ===================================
35  * This file is responsible for setting up the board specific items for the
36  * CC1350DK_7XD board.
37  */
38 
39 #include <stdbool.h>
40 #include <stddef.h>
41 #include <stdint.h>
42 
43 #include <ti/devices/DeviceFamily.h>
44 #include DeviceFamily_constructPath(driverlib/ioc.h)
45 #include DeviceFamily_constructPath(driverlib/udma.h)
46 #include DeviceFamily_constructPath(inc/hw_ints.h)
47 #include DeviceFamily_constructPath(inc/hw_memmap.h)
48 
49 #include "CC1350DK_7XD.h"
50 
51 /*
52  * =============================== ADCBuf ===============================
53  */
54 #include <ti/drivers/ADCBuf.h>
55 #include <ti/drivers/adcbuf/ADCBufCC26XX.h>
56 
57 ADCBufCC26XX_Object adcBufCC26xxObjects[CC1350DK_7XD_ADCBUFCOUNT];
58 
59 /*
60  * This table converts a virtual adc channel into a dio and internal analogue
61  * input signal. This table is necessary for the functioning of the adcBuf
62  * driver. Comment out unused entries to save flash. Dio and internal signal
63  * pairs are hardwired. Do not remap them in the table. You may reorder entire
64  * entries. The mapping of dio and internal signals is package dependent.
65  */
66 const ADCBufCC26XX_AdcChannelLutEntry ADCBufCC26XX_adcChannelLut[CC1350DK_7XD_ADCBUF0CHANNELCOUNT] = {
67  {CC1350DK_7XD_ALS_OUT, ADC_COMPB_IN_AUXIO7},
68  {PIN_UNASSIGNED, ADC_COMPB_IN_DCOUPL},
69  {PIN_UNASSIGNED, ADC_COMPB_IN_VSS},
70  {PIN_UNASSIGNED, ADC_COMPB_IN_VDDS},
71 };
72 
73 const ADCBufCC26XX_HWAttrs adcBufCC26xxHWAttrs[CC1350DK_7XD_ADCBUFCOUNT] = {
74  {
75  .intPriority = ~0,
76  .swiPriority = 0,
77  .adcChannelLut = ADCBufCC26XX_adcChannelLut,
78  .gpTimerUnit = CC1350DK_7XD_GPTIMER0A,
79  .gptDMAChannelMask = 1 << UDMA_CHAN_TIMER0_A,
80  }
81 };
82 
83 const ADCBuf_Config ADCBuf_config[CC1350DK_7XD_ADCBUFCOUNT] = {
84  {
85  &ADCBufCC26XX_fxnTable,
86  &adcBufCC26xxObjects[CC1350DK_7XD_ADCBUF0],
87  &adcBufCC26xxHWAttrs[CC1350DK_7XD_ADCBUF0]
88  },
89 };
90 
91 const uint_least8_t ADCBuf_count = CC1350DK_7XD_ADCBUFCOUNT;
92 
93 /*
94  * =============================== ADC ===============================
95  */
96 #include <ti/drivers/ADC.h>
97 #include <ti/drivers/adc/ADCCC26XX.h>
98 
99 ADCCC26XX_Object adcCC26xxObjects[CC1350DK_7XD_ADCCOUNT];
100 
101 const ADCCC26XX_HWAttrs adcCC26xxHWAttrs[CC1350DK_7XD_ADCCOUNT] = {
102  {
103  .adcDIO = CC1350DK_7XD_DIO23_ANALOG,
104  .adcCompBInput = ADC_COMPB_IN_AUXIO7,
105  .refSource = ADCCC26XX_FIXED_REFERENCE,
106  .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
107  .inputScalingEnabled = true,
108  .triggerSource = ADCCC26XX_TRIGGER_MANUAL,
109  .returnAdjustedVal = false
110  },
111  {
112  .adcDIO = PIN_UNASSIGNED,
113  .adcCompBInput = ADC_COMPB_IN_DCOUPL,
114  .refSource = ADCCC26XX_FIXED_REFERENCE,
115  .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
116  .inputScalingEnabled = true,
117  .triggerSource = ADCCC26XX_TRIGGER_MANUAL,
118  .returnAdjustedVal = false
119  },
120  {
121  .adcDIO = PIN_UNASSIGNED,
122  .adcCompBInput = ADC_COMPB_IN_VSS,
123  .refSource = ADCCC26XX_FIXED_REFERENCE,
124  .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
125  .inputScalingEnabled = true,
126  .triggerSource = ADCCC26XX_TRIGGER_MANUAL,
127  .returnAdjustedVal = false
128  },
129  {
130  .adcDIO = PIN_UNASSIGNED,
131  .adcCompBInput = ADC_COMPB_IN_VDDS,
132  .refSource = ADCCC26XX_FIXED_REFERENCE,
133  .samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
134  .inputScalingEnabled = true,
135  .triggerSource = ADCCC26XX_TRIGGER_MANUAL,
136  .returnAdjustedVal = false
137  }
138 };
139 
140 const ADC_Config ADC_config[CC1350DK_7XD_ADCCOUNT] = {
141  {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350DK_7XD_ADCALS], &adcCC26xxHWAttrs[CC1350DK_7XD_ADCALS]},
142  {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350DK_7XD_ADCDCOUPL], &adcCC26xxHWAttrs[CC1350DK_7XD_ADCDCOUPL]},
143  {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350DK_7XD_ADCVSS], &adcCC26xxHWAttrs[CC1350DK_7XD_ADCVSS]},
144  {&ADCCC26XX_fxnTable, &adcCC26xxObjects[CC1350DK_7XD_ADCVDDS], &adcCC26xxHWAttrs[CC1350DK_7XD_ADCVDDS]},
145 };
146 
147 const uint_least8_t ADC_count = CC1350DK_7XD_ADCCOUNT;
148 
149 /*
150  * =============================== Crypto ===============================
151  */
152 #include <ti/drivers/crypto/CryptoCC26XX.h>
153 
154 CryptoCC26XX_Object cryptoCC26XXObjects[CC1350DK_7XD_CRYPTOCOUNT];
155 
156 const CryptoCC26XX_HWAttrs cryptoCC26XXHWAttrs[CC1350DK_7XD_CRYPTOCOUNT] = {
157  {
158  .baseAddr = CRYPTO_BASE,
159  .powerMngrId = PowerCC26XX_PERIPH_CRYPTO,
160  .intNum = INT_CRYPTO_RESULT_AVAIL_IRQ,
161  .intPriority = ~0,
162  }
163 };
164 
165 const CryptoCC26XX_Config CryptoCC26XX_config[CC1350DK_7XD_CRYPTOCOUNT] = {
166  {
167  .object = &cryptoCC26XXObjects[CC1350DK_7XD_CRYPTO0],
168  .hwAttrs = &cryptoCC26XXHWAttrs[CC1350DK_7XD_CRYPTO0]
169  },
170 };
171 
172 /*
173  * =============================== GPIO ===============================
174  */
175 #include <ti/drivers/GPIO.h>
176 #include <ti/drivers/gpio/GPIOCC26XX.h>
177 
178 /*
179  * Array of Pin configurations
180  * NOTE: The order of the pin configurations must coincide with what was
181  * defined in CC1350DK_7XD.h
182  * NOTE: Pins not used for interrupts should be placed at the end of the
183  * array. Callback entries can be omitted from callbacks array to
184  * reduce memory usage.
185  */
186 GPIO_PinConfig gpioPinConfigs[] = {
187  /* Input pins */
188  GPIOCC26XX_DIO_11 | GPIO_DO_NOT_CONFIG, /* Key Select */
189  GPIOCC26XX_DIO_19 | GPIO_DO_NOT_CONFIG, /* Key Up */
190  GPIOCC26XX_DIO_12 | GPIO_DO_NOT_CONFIG, /* Key Down */
191  GPIOCC26XX_DIO_15 | GPIO_DO_NOT_CONFIG, /* Key Left */
192  GPIOCC26XX_DIO_18 | GPIO_DO_NOT_CONFIG, /* Key Right */
193 
194  GPIOCC26XX_DIO_15 | GPIO_DO_NOT_CONFIG, /* CC1350DK_7XD_SPI_MASTER_READY */
195  GPIOCC26XX_DIO_21 | GPIO_DO_NOT_CONFIG, /* CC1350DK_7XD_SPI_SLAVE_READY */
196 
197  /* Output pins */
198  GPIOCC26XX_DIO_25 | GPIO_DO_NOT_CONFIG, /* LED 1 */
199  GPIOCC26XX_DIO_27 | GPIO_DO_NOT_CONFIG, /* LED 2 */
200  GPIOCC26XX_DIO_07 | GPIO_DO_NOT_CONFIG, /* LED 3 */
201  GPIOCC26XX_DIO_06 | GPIO_DO_NOT_CONFIG, /* LED 4 */
202 
203  /* SDCARD */
204  GPIOCC26XX_DIO_30 | GPIO_DO_NOT_CONFIG, /* SPI chip select */
205 
206  /* Accelerometer */
207  GPIOCC26XX_DIO_24 | GPIO_DO_NOT_CONFIG, /* SPI chip select */
208 };
209 
210 /*
211  * Array of callback function pointers
212  * NOTE: The order of the pin configurations must coincide with what was
213  * defined in CC2650_LAUNCH.h
214  * NOTE: Pins not used for interrupts can be omitted from callbacks array to
215  * reduce memory usage (if placed at end of gpioPinConfigs array).
216  */
217 GPIO_CallbackFxn gpioCallbackFunctions[] = {
218  NULL, /* Button 0 */
219  NULL, /* Button 1 */
220  NULL, /* CC1350DK_7XD_SPI_MASTER_READY */
221  NULL, /* CC1350DK_7XD_SPI_SLAVE_READY */
222 };
223 
224 const GPIOCC26XX_Config GPIOCC26XX_config = {
225  .pinConfigs = (GPIO_PinConfig *)gpioPinConfigs,
226  .callbacks = (GPIO_CallbackFxn *)gpioCallbackFunctions,
227  .numberOfPinConfigs = CC1350DK_7XD_GPIOCOUNT,
228  .numberOfCallbacks = sizeof(gpioCallbackFunctions)/sizeof(GPIO_CallbackFxn),
229  .intPriority = (~0)
230 };
231 
232 /*
233  * =============================== GPTimer ===============================
234  * Remove unused entries to reduce flash usage both in Board.c and Board.h
235  */
236 #include <ti/drivers/timer/GPTimerCC26XX.h>
237 
238 GPTimerCC26XX_Object gptimerCC26XXObjects[CC1350DK_7XD_GPTIMERCOUNT];
239 
240 const GPTimerCC26XX_HWAttrs gptimerCC26xxHWAttrs[CC1350DK_7XD_GPTIMERPARTSCOUNT] = {
241  { .baseAddr = GPT0_BASE, .intNum = INT_GPT0A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0A, },
242  { .baseAddr = GPT0_BASE, .intNum = INT_GPT0B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0B, },
243  { .baseAddr = GPT1_BASE, .intNum = INT_GPT1A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1A, },
244  { .baseAddr = GPT1_BASE, .intNum = INT_GPT1B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1B, },
245  { .baseAddr = GPT2_BASE, .intNum = INT_GPT2A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2A, },
246  { .baseAddr = GPT2_BASE, .intNum = INT_GPT2B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2B, },
247  { .baseAddr = GPT3_BASE, .intNum = INT_GPT3A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3A, },
248  { .baseAddr = GPT3_BASE, .intNum = INT_GPT3B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3B, },
249 };
250 
251 const GPTimerCC26XX_Config GPTimerCC26XX_config[CC1350DK_7XD_GPTIMERPARTSCOUNT] = {
252  { &gptimerCC26XXObjects[CC1350DK_7XD_GPTIMER0], &gptimerCC26xxHWAttrs[CC1350DK_7XD_GPTIMER0A], GPT_A },
253  { &gptimerCC26XXObjects[CC1350DK_7XD_GPTIMER0], &gptimerCC26xxHWAttrs[CC1350DK_7XD_GPTIMER0B], GPT_B },
254  { &gptimerCC26XXObjects[CC1350DK_7XD_GPTIMER1], &gptimerCC26xxHWAttrs[CC1350DK_7XD_GPTIMER1A], GPT_A },
255  { &gptimerCC26XXObjects[CC1350DK_7XD_GPTIMER1], &gptimerCC26xxHWAttrs[CC1350DK_7XD_GPTIMER1B], GPT_B },
256  { &gptimerCC26XXObjects[CC1350DK_7XD_GPTIMER2], &gptimerCC26xxHWAttrs[CC1350DK_7XD_GPTIMER2A], GPT_A },
257  { &gptimerCC26XXObjects[CC1350DK_7XD_GPTIMER2], &gptimerCC26xxHWAttrs[CC1350DK_7XD_GPTIMER2B], GPT_B },
258  { &gptimerCC26XXObjects[CC1350DK_7XD_GPTIMER3], &gptimerCC26xxHWAttrs[CC1350DK_7XD_GPTIMER3A], GPT_A },
259  { &gptimerCC26XXObjects[CC1350DK_7XD_GPTIMER3], &gptimerCC26xxHWAttrs[CC1350DK_7XD_GPTIMER3B], GPT_B },
260 };
261 
262 /*
263  * =============================== I2C ===============================
264 */
265 #include <ti/drivers/I2C.h>
266 #include <ti/drivers/i2c/I2CCC26XX.h>
267 
268 #if TI_I2C_CONF_ENABLE
269 
270 I2CCC26XX_Object i2cCC26xxObjects[CC1350DK_7XD_I2CCOUNT];
271 
272 const I2CCC26XX_HWAttrsV1 i2cCC26xxHWAttrs[CC1350DK_7XD_I2CCOUNT] = {
273 #if TI_I2C_CONF_I2C0_ENABLE
274  {
275  .baseAddr = I2C0_BASE,
276  .powerMngrId = PowerCC26XX_PERIPH_I2C0,
277  .intNum = INT_I2C_IRQ,
278  .intPriority = ~0,
279  .swiPriority = 0,
280  .sdaPin = CC1350DK_7XD_I2C0_SDA0,
281  .sclPin = CC1350DK_7XD_I2C0_SCL0,
282  },
283 #endif
284 };
285 
286 const I2C_Config I2C_config[CC1350DK_7XD_I2CCOUNT] = {
287 #if TI_I2C_CONF_I2C0_ENABLE
288  {
289  .fxnTablePtr = &I2CCC26XX_fxnTable,
290  .object = &i2cCC26xxObjects[CC1350DK_7XD_I2C0],
291  .hwAttrs = &i2cCC26xxHWAttrs[CC1350DK_7XD_I2C0]
292  },
293 #endif
294 };
295 
296 const uint_least8_t I2C_count = CC1350DK_7XD_I2CCOUNT;
297 
298 #endif /* TI_I2C_CONF_ENABLE */
299 
300 /*
301  * =============================== NVS ===============================
302  */
303 #include <ti/drivers/NVS.h>
304 #include <ti/drivers/nvs/NVSSPI25X.h>
305 #include <ti/drivers/nvs/NVSCC26XX.h>
306 
307 #define NVS_REGIONS_BASE 0x1A000
308 #define SECTORSIZE 0x1000
309 #define REGIONSIZE (SECTORSIZE * 4)
310 
311 #if TI_NVS_CONF_ENABLE
312 
313 #if TI_NVS_CONF_NVS_INTERNAL_ENABLE
314 /*
315  * Reserve flash sectors for NVS driver use by placing an uninitialized byte
316  * array at the desired flash address.
317  */
318 #if defined(__TI_COMPILER_VERSION__)
319 
320 /*
321  * Place uninitialized array at NVS_REGIONS_BASE
322  */
323 #pragma LOCATION(flashBuf, NVS_REGIONS_BASE);
324 #pragma NOINIT(flashBuf);
325 static char flashBuf[REGIONSIZE];
326 
327 #elif defined(__IAR_SYSTEMS_ICC__)
328 
329 /*
330  * Place uninitialized array at NVS_REGIONS_BASE
331  */
332 static __no_init char flashBuf[REGIONSIZE] @ NVS_REGIONS_BASE;
333 
334 #elif defined(__GNUC__)
335 
336 /*
337  * Place the flash buffers in the .nvs section created in the gcc linker file.
338  * The .nvs section enforces alignment on a sector boundary but may
339  * be placed anywhere in flash memory. If desired the .nvs section can be set
340  * to a fixed address by changing the following in the gcc linker file:
341  *
342  * .nvs (FIXED_FLASH_ADDR) (NOLOAD) : AT (FIXED_FLASH_ADDR) {
343  * *(.nvs)
344  * } > REGION_TEXT
345  */
346 __attribute__ ((section (".nvs")))
347 static char flashBuf[REGIONSIZE];
348 
349 #endif
350 
351 /* Allocate objects for NVS Internal Regions */
352 NVSCC26XX_Object nvsCC26xxObjects[1];
353 
354 /* Hardware attributes for NVS Internal Regions */
355 const NVSCC26XX_HWAttrs nvsCC26xxHWAttrs[1] = {
356  {
357  .regionBase = (void *)flashBuf,
358  .regionSize = REGIONSIZE,
359  },
360 };
361 
362 #endif /* TI_NVS_CONF_NVS_INTERNAL_ENABLE */
363 
364 /* NVS Region index 0 and 1 refer to NVS and NVS SPI respectively */
365 const NVS_Config NVS_config[CC1350DK_7XD_NVSCOUNT] = {
366 #if TI_NVS_CONF_NVS_INTERNAL_ENABLE
367  {
368  .fxnTablePtr = &NVSCC26XX_fxnTable,
369  .object = &nvsCC26xxObjects[0],
370  .hwAttrs = &nvsCC26xxHWAttrs[0],
371  },
372 #endif
373 };
374 
375 const uint_least8_t NVS_count = CC1350DK_7XD_NVSCOUNT;
376 
377 #endif /* TI_NVS_CONF_ENABLE */
378 
379 /*
380  * =============================== PIN ===============================
381  */
382 #include <ti/drivers/PIN.h>
383 #include <ti/drivers/pin/PINCC26XX.h>
384 
385 const PIN_Config BoardGpioInitTable[] = {
386 
387  CC1350DK_7XD_PIN_LED1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
388  CC1350DK_7XD_PIN_LED2 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
389  CC1350DK_7XD_PIN_LED3 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
390  CC1350DK_7XD_PIN_LED4 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */
391  CC1350DK_7XD_PIN_KEY_SELECT | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
392  CC1350DK_7XD_PIN_KEY_UP | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
393  CC1350DK_7XD_PIN_KEY_DOWN | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
394  CC1350DK_7XD_PIN_KEY_LEFT | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
395  CC1350DK_7XD_PIN_KEY_UP | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */
396  CC1350DK_7XD_SDCARD_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */
397  CC1350DK_7XD_ACC_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */
398  CC1350DK_7XD_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN, /* UART RX via debugger back channel */
399  CC1350DK_7XD_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* UART TX via debugger back channel */
400  CC1350DK_7XD_SPI0_MOSI | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master out - slave in */
401  CC1350DK_7XD_SPI0_MISO | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI master in - slave out */
402  CC1350DK_7XD_SPI0_CLK | PIN_INPUT_EN | PIN_PULLDOWN, /* SPI clock */
403 
404  PIN_TERMINATE
405 };
406 
407 const PINCC26XX_HWAttrs PINCC26XX_hwAttrs = {
408  .intPriority = ~0,
409  .swiPriority = 0
410 };
411 
412 /*
413  * =============================== Power ===============================
414  */
415 #include <ti/drivers/Power.h>
416 #include <ti/drivers/power/PowerCC26XX.h>
417 
418 const PowerCC26XX_Config PowerCC26XX_config = {
419  .policyInitFxn = NULL,
420  .policyFxn = &PowerCC26XX_standbyPolicy,
421  .calibrateFxn = &PowerCC26XX_calibrate,
422  .enablePolicy = true,
423  .calibrateRCOSC_LF = true,
424  .calibrateRCOSC_HF = true,
425 };
426 
427 /*
428  * =============================== PWM ===============================
429  * Remove unused entries to reduce flash usage both in Board.c and Board.h
430  */
431 #include <ti/drivers/PWM.h>
432 #include <ti/drivers/pwm/PWMTimerCC26XX.h>
433 
434 PWMTimerCC26XX_Object pwmtimerCC26xxObjects[CC1350DK_7XD_PWMCOUNT];
435 
436 const PWMTimerCC26XX_HwAttrs pwmtimerCC26xxHWAttrs[CC1350DK_7XD_PWMCOUNT] = {
437  { .pwmPin = CC1350DK_7XD_PWMPIN0, .gpTimerUnit = CC1350DK_7XD_GPTIMER0A },
438  { .pwmPin = CC1350DK_7XD_PWMPIN1, .gpTimerUnit = CC1350DK_7XD_GPTIMER0B },
439  { .pwmPin = CC1350DK_7XD_PWMPIN2, .gpTimerUnit = CC1350DK_7XD_GPTIMER1A },
440  { .pwmPin = CC1350DK_7XD_PWMPIN3, .gpTimerUnit = CC1350DK_7XD_GPTIMER1B },
441  { .pwmPin = CC1350DK_7XD_PWMPIN4, .gpTimerUnit = CC1350DK_7XD_GPTIMER2A },
442  { .pwmPin = CC1350DK_7XD_PWMPIN5, .gpTimerUnit = CC1350DK_7XD_GPTIMER2B },
443  { .pwmPin = CC1350DK_7XD_PWMPIN6, .gpTimerUnit = CC1350DK_7XD_GPTIMER3A },
444  { .pwmPin = CC1350DK_7XD_PWMPIN7, .gpTimerUnit = CC1350DK_7XD_GPTIMER3B },
445 };
446 
447 const PWM_Config PWM_config[CC1350DK_7XD_PWMCOUNT] = {
448  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350DK_7XD_PWM0], &pwmtimerCC26xxHWAttrs[CC1350DK_7XD_PWM0] },
449  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350DK_7XD_PWM1], &pwmtimerCC26xxHWAttrs[CC1350DK_7XD_PWM1] },
450  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350DK_7XD_PWM2], &pwmtimerCC26xxHWAttrs[CC1350DK_7XD_PWM2] },
451  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350DK_7XD_PWM3], &pwmtimerCC26xxHWAttrs[CC1350DK_7XD_PWM3] },
452  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350DK_7XD_PWM4], &pwmtimerCC26xxHWAttrs[CC1350DK_7XD_PWM4] },
453  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350DK_7XD_PWM5], &pwmtimerCC26xxHWAttrs[CC1350DK_7XD_PWM5] },
454  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350DK_7XD_PWM6], &pwmtimerCC26xxHWAttrs[CC1350DK_7XD_PWM6] },
455  { &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[CC1350DK_7XD_PWM7], &pwmtimerCC26xxHWAttrs[CC1350DK_7XD_PWM7] },
456 };
457 
458 const uint_least8_t PWM_count = CC1350DK_7XD_PWMCOUNT;
459 
460 /*
461  * =============================== RF Driver ===============================
462  */
463 #include <ti/drivers/rf/RF.h>
464 
465 const RFCC26XX_HWAttrsV2 RFCC26XX_hwAttrs = {
466  .hwiPriority = ~0, /* Lowest HWI priority */
467  .swiPriority = 0, /* Lowest SWI priority */
468  .xoscHfAlwaysNeeded = true, /* Keep XOSC dependency while in stanby */
469  .globalCallback = NULL, /* No board specific callback */
470  .globalEventMask = 0 /* No events subscribed to */
471 };
472 
473 /*
474  * =============================== SD ===============================
475  */
476 #include <ti/drivers/SD.h>
477 #include <ti/drivers/sd/SDSPI.h>
478 
479 #if TI_SD_CONF_ENABLE
480 
481 #if !(TI_SPI_CONF_SPI0_ENABLE)
482 #error "SD driver requires SPI0 enabled"
483 #endif
484 
485 SDSPI_Object sdspiObjects[CC1350DK_7XD_SDCOUNT];
486 
487 const SDSPI_HWAttrs sdspiHWAttrs[CC1350DK_7XD_SDCOUNT] = {
488  {
489  .spiIndex = CC1350DK_7XD_SPI0,
490  .spiCsGpioIndex = CC1350DK_7XD_SDCARD_CS
491  }
492 };
493 
494 const SD_Config SD_config[CC1350DK_7XD_SDCOUNT] = {
495  {
496  .fxnTablePtr = &SDSPI_fxnTable,
497  .object = &sdspiObjects[CC1350DK_7XD_SDSPI0],
498  .hwAttrs = &sdspiHWAttrs[CC1350DK_7XD_SDSPI0]
499  },
500 };
501 
502 const uint_least8_t SD_count = CC1350DK_7XD_SDCOUNT;
503 
504 #endif /* TI_SD_CONF_ENABLE */
505 
506 /*
507  * =============================== SPI DMA ===============================
508  */
509 #include <ti/drivers/SPI.h>
510 #include <ti/drivers/spi/SPICC26XXDMA.h>
511 
512 #if TI_SPI_CONF_ENABLE
513 
514 SPICC26XXDMA_Object spiCC26XXDMAObjects[CC1350DK_7XD_SPICOUNT];
515 
516 /*
517  * NOTE: The SPI instances below can be used by the SD driver to communicate
518  * with a SD card via SPI. The 'defaultTxBufValue' fields below are set to 0xFF
519  * to satisfy the SDSPI driver requirement.
520  */
521 const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[CC1350DK_7XD_SPICOUNT] = {
522 #if TI_SPI_CONF_SPI0_ENABLE
523  {
524  .baseAddr = SSI0_BASE,
525  .intNum = INT_SSI0_COMB,
526  .intPriority = ~0,
527  .swiPriority = 0,
528  .powerMngrId = PowerCC26XX_PERIPH_SSI0,
529  .defaultTxBufValue = 0xFF,
530  .rxChannelBitMask = 1<<UDMA_CHAN_SSI0_RX,
531  .txChannelBitMask = 1<<UDMA_CHAN_SSI0_TX,
532  .mosiPin = CC1350DK_7XD_SPI0_MOSI,
533  .misoPin = CC1350DK_7XD_SPI0_MISO,
534  .clkPin = CC1350DK_7XD_SPI0_CLK,
535  .csnPin = CC1350DK_7XD_SPI0_CSN,
536  .minDmaTransferSize = 10
537  },
538 #endif
539 #if TI_SPI_CONF_SPI1_ENABLE
540  {
541  .baseAddr = SSI1_BASE,
542  .intNum = INT_SSI1_COMB,
543  .intPriority = ~0,
544  .swiPriority = 0,
545  .powerMngrId = PowerCC26XX_PERIPH_SSI1,
546  .defaultTxBufValue = 0xFF,
547  .rxChannelBitMask = 1<<UDMA_CHAN_SSI1_RX,
548  .txChannelBitMask = 1<<UDMA_CHAN_SSI1_TX,
549  .mosiPin = CC1350DK_7XD_SPI1_MOSI,
550  .misoPin = CC1350DK_7XD_SPI1_MISO,
551  .clkPin = CC1350DK_7XD_SPI1_CLK,
552  .csnPin = CC1350DK_7XD_SPI1_CSN,
553  .minDmaTransferSize = 10
554  },
555 #endif
556 };
557 
558 const SPI_Config SPI_config[CC1350DK_7XD_SPICOUNT] = {
559 #if TI_SPI_CONF_SPI0_ENABLE
560  {
561  .fxnTablePtr = &SPICC26XXDMA_fxnTable,
562  .object = &spiCC26XXDMAObjects[CC1350DK_7XD_SPI0],
563  .hwAttrs = &spiCC26XXDMAHWAttrs[CC1350DK_7XD_SPI0]
564  },
565 #endif
566 #if TI_SPI_CONF_SPI1_ENABLE
567  {
568  .fxnTablePtr = &SPICC26XXDMA_fxnTable,
569  .object = &spiCC26XXDMAObjects[CC1350DK_7XD_SPI1],
570  .hwAttrs = &spiCC26XXDMAHWAttrs[CC1350DK_7XD_SPI1]
571  },
572 #endif
573 };
574 
575 const uint_least8_t SPI_count = CC1350DK_7XD_SPICOUNT;
576 
577 #endif /* TI_SPI_CONF_ENABLE */
578 
579 
580 /*
581  * =============================== TRNG ===============================
582  */
583 #include <ti/drivers/TRNG.h>
584 #include <ti/drivers/trng/TRNGCC26X0.h>
585 
586 TRNGCC26X0_Object trngCC26X0Object[CC1350DK_7XD_TRNGCOUNT];
587 
588 const TRNGCC26X0_HWAttrs trngCC26X0HWAttrs[CC1350DK_7XD_TRNGCOUNT] = {
589  {
590  .swiPriority = 0,
591  .intPriority = ~0,
592  }
593 };
594 
595 const TRNG_Config TRNG_config[] = {
596  { &trngCC26X0Object[0], &trngCC26X0HWAttrs[0] },
597 };
598 
599 const uint8_t TRNG_count = CC1350DK_7XD_TRNGCOUNT;
600 
601 
602 /*
603  * =============================== UART ===============================
604  */
605 #include <ti/drivers/UART.h>
606 #include <ti/drivers/uart/UARTCC26XX.h>
607 
608 #if TI_UART_CONF_ENABLE
609 
610 UARTCC26XX_Object uartCC26XXObjects[CC1350DK_7XD_UARTCOUNT];
611 
612 uint8_t uartCC26XXRingBuffer[CC1350DK_7XD_UARTCOUNT][32];
613 
614 const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[CC1350DK_7XD_UARTCOUNT] = {
615 #if TI_UART_CONF_UART0_ENABLE
616  {
617  .baseAddr = UART0_BASE,
618  .powerMngrId = PowerCC26XX_PERIPH_UART0,
619  .intNum = INT_UART0_COMB,
620  .intPriority = ~0,
621  .swiPriority = 0,
622  .txPin = CC1350DK_7XD_UART_TX,
623  .rxPin = CC1350DK_7XD_UART_RX,
624  .ctsPin = PIN_UNASSIGNED,
625  .rtsPin = PIN_UNASSIGNED,
626  .ringBufPtr = uartCC26XXRingBuffer[CC1350DK_7XD_UART0],
627  .ringBufSize = sizeof(uartCC26XXRingBuffer[CC1350DK_7XD_UART0]),
628  .txIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_1_8,
629  .rxIntFifoThr = UARTCC26XX_FIFO_THRESHOLD_4_8,
630  .errorFxn = NULL
631  },
632 #endif
633 };
634 
635 const UART_Config UART_config[CC1350DK_7XD_UARTCOUNT] = {
636 #if TI_UART_CONF_UART0_ENABLE
637  {
638  .fxnTablePtr = &UARTCC26XX_fxnTable,
639  .object = &uartCC26XXObjects[CC1350DK_7XD_UART0],
640  .hwAttrs = &uartCC26XXHWAttrs[CC1350DK_7XD_UART0]
641  },
642 #endif
643 };
644 
645 const uint_least8_t UART_count = CC1350DK_7XD_UARTCOUNT;
646 
647 #endif /* TI_UART_CONF_ENABLE */
648 
649 /*
650  * =============================== UDMA ===============================
651  */
652 #include <ti/drivers/dma/UDMACC26XX.h>
653 
654 UDMACC26XX_Object udmaObjects[CC1350DK_7XD_UDMACOUNT];
655 
656 const UDMACC26XX_HWAttrs udmaHWAttrs[CC1350DK_7XD_UDMACOUNT] = {
657  {
658  .baseAddr = UDMA0_BASE,
659  .powerMngrId = PowerCC26XX_PERIPH_UDMA,
660  .intNum = INT_DMA_ERR,
661  .intPriority = ~0
662  }
663 };
664 
665 const UDMACC26XX_Config UDMACC26XX_config[CC1350DK_7XD_UDMACOUNT] = {
666  {
667  .object = &udmaObjects[CC1350DK_7XD_UDMA0],
668  .hwAttrs = &udmaHWAttrs[CC1350DK_7XD_UDMA0]
669  },
670 };
671 
672 
673 
674 /*
675  * =============================== Watchdog ===============================
676  */
677 #include <ti/drivers/Watchdog.h>
678 #include <ti/drivers/watchdog/WatchdogCC26XX.h>
679 
680 WatchdogCC26XX_Object watchdogCC26XXObjects[CC1350DK_7XD_WATCHDOGCOUNT];
681 
682 const WatchdogCC26XX_HWAttrs watchdogCC26XXHWAttrs[CC1350DK_7XD_WATCHDOGCOUNT] = {
683  {
684  .baseAddr = WDT_BASE,
685  .reloadValue = 1000 /* Reload value in milliseconds */
686  },
687 };
688 
689 const Watchdog_Config Watchdog_config[CC1350DK_7XD_WATCHDOGCOUNT] = {
690  {
691  .fxnTablePtr = &WatchdogCC26XX_fxnTable,
692  .object = &watchdogCC26XXObjects[CC1350DK_7XD_WATCHDOG0],
693  .hwAttrs = &watchdogCC26XXHWAttrs[CC1350DK_7XD_WATCHDOG0]
694  },
695 };
696 
697 const uint_least8_t Watchdog_count = CC1350DK_7XD_WATCHDOGCOUNT;
698 
699 /*
700  * Board-specific initialization function to disable external flash.
701  * This function is defined in the file CC1350DK_7XD_fxns.c
702  */
703 extern void Board_initHook(void);
704 
705 /*
706  * ======== CC1350DK_7XD_initGeneral ========
707  */
709 {
710  Power_init();
711 
712  if (PIN_init(BoardGpioInitTable) != PIN_SUCCESS) {
713  /* Error with PIN_init */
714  while (1);
715  }
716 
717  /* Perform board-specific initialization */
718  Board_initHook();
719 }
#define SSI1_BASE
Base address for SSI1.
Definition: ssi.h:59
#define SSI0_BASE
Base address for SSI0.
Definition: ssi.h:58
============================================================================
void CC1350DK_7XD_initGeneral(void)
Initialize the general board specific settings.
Definition: CC1350DK_7XD.c:708