TI-RTOS Drivers  tidrivers_full_2_20_00_08
ADCBufCC26XX.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2016, 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  */
228 #ifndef ti_drivers_adc_adcbufcc26xx__include
229 #define ti_drivers_adc_adcbufcc26xx__include
230 
231 #ifdef __cplusplus
232 extern "C" {
233 #endif
234 
235 #include <stdint.h>
236 #include <stdbool.h>
237 
238 #include <ti/drivers/ADCBuf.h>
239 #include <ti/drivers/PIN.h>
243 #include <ti/drivers/Power.h>
245 
246 #include <driverlib/aux_adc.h>
247 
248 /*
249  * The following allows this header file to be included in an application file
250  * which also includes ti/sysbios/hal/Hwi.h.
251  */
252 #define ti_sysbios_family_arm_m3_Hwi__nolocalnames
253 #include <ti/sysbios/family/arm/m3/Hwi.h>
254 #include <ti/sysbios/knl/Clock.h>
255 #include <ti/sysbios/knl/Semaphore.h>
256 #include <ti/sysbios/knl/Swi.h>
257 
270 /* Add ADCBufCC26XX_CMD_* macros here */
271 
285 #define ADCBufCC26XX_CMD_ACQUIRE_ADC_SEMAPHORE ADCBuf_CMD_RESERVED + 1
286 
300 #define ADCBufCC26XX_CMD_KEEP_ADC_SEMAPHORE ADCBuf_CMD_RESERVED + 2
301 
309 #define ADCBufCC26XX_CMD_KEEP_ADC_SEMAPHORE_DISABLE ADCBuf_CMD_RESERVED + 3
310 
316 #define ADCBufCC26XX_CMD_RELEASE_ADC_SEMAPHORE ADCBuf_CMD_RESERVED + 4
317 
323 #define ADCBufCC26XX_RESOLUTION 12
324 
325 #define ADCBufCC26XX_BYTES_PER_SAMPLE 2
326 
327 /*
328  * =============================================================================
329  * Constants
330  * =============================================================================
331  */
332 
333 /* ADCBuf function table pointer */
335 
336 
337 /*
338  * =============================================================================
339  * Enumerations
340  * =============================================================================
341  */
342 
357 
367  ADCBufCC26XX_SAMPLING_DURATION_2P7_US = AUXADC_SAMPLE_TIME_2P7_US,
368  ADCBufCC26XX_SAMPLING_DURATION_5P3_US = AUXADC_SAMPLE_TIME_5P3_US,
369  ADCBufCC26XX_SAMPLING_DURATION_10P6_US = AUXADC_SAMPLE_TIME_10P6_US,
370  ADCBufCC26XX_SAMPLING_DURATION_21P3_US = AUXADC_SAMPLE_TIME_21P3_US,
371  ADCBufCC26XX_SAMPLING_DURATION_42P6_US = AUXADC_SAMPLE_TIME_42P6_US,
372  ADCBufCC26XX_SAMPLING_DURATION_85P3_US = AUXADC_SAMPLE_TIME_85P3_US,
373  ADCBufCC26XX_SAMPLING_DURATION_170_US = AUXADC_SAMPLE_TIME_170_US,
374  ADCBufCC26XX_SAMPLING_DURATION_341_US = AUXADC_SAMPLE_TIME_341_US,
375  ADCBufCC26XX_SAMPLING_DURATION_682_US = AUXADC_SAMPLE_TIME_682_US,
376  ADCBufCC26XX_SAMPLING_DURATION_1P37_MS = AUXADC_SAMPLE_TIME_1P37_MS,
377  ADCBufCC26XX_SAMPLING_DURATION_2P73_MS = AUXADC_SAMPLE_TIME_2P73_MS,
378  ADCBufCC26XX_SAMPLING_DURATION_5P46_MS = AUXADC_SAMPLE_TIME_5P46_MS,
379  ADCBufCC26XX_SAMPLING_DURATION_10P9_MS = AUXADC_SAMPLE_TIME_10P9_MS
381 
382 
404  ADCBufCC26XX_FIXED_REFERENCE = AUXADC_REF_FIXED,
405  ADCBufCC26XX_VDDS_REFERENCE = AUXADC_REF_VDDS_REL
407 
408 
409 
410 /*
411  * =============================================================================
412  * Structs
413  * =============================================================================
414  */
415 
423  uint8_t dio;
424  uint8_t compBInput;
426 
458 
479 typedef struct ADCBufCC26XX_HWAttrs{
485  uint32_t swiPriority;
501  uint8_t intPriority;
505  uint8_t gpTimerUnit;
507 
508 
509 
515 typedef struct ADCBufCC26XX_Object{
516  /* ADC control variables */
517  bool isOpen;
522  uint8_t currentChannel;
530  /* ADC SYS/BIOS objects */
531  Hwi_Struct hwi;
532  Swi_Struct swi;
533  Semaphore_Struct conversionComplete;
537  /* PIN driver state object and handle */
541  /* UDMA driver handle */
544  /* GPTimer driver handle */
547  uint32_t semaphoreTimeout;
548  uint32_t samplingFrequency;
550 
551 /*
552  * =============================================================================
553  * Functions
554  * =============================================================================
555  */
556 
557 
558 /* Do not interfere with the app if they include the family Hwi module */
559 #undef ti_sysbios_family_arm_m3_Hwi__nolocalnames
560 
561 #ifdef __cplusplus
562 }
563 #endif
564 
565 #endif /* ti_drivers_adc_ADCBufCC26XX__include */
ADCBufCC26XX_Sampling_Mode
Specifies whether the internal reference of the ADC is sourced from the battery voltage or a fixed in...
Definition: ADCBufCC26XX.h:353
Hwi_Struct hwi
Definition: ADCBufCC26XX.h:531
Definition: ADCBufCC26XX.h:354
Definition: ADCBufCC26XX.h:405
Definition: ADCBufCC26XX.h:367
GPTimerCC26XX_Handle timerHandle
Definition: ADCBufCC26XX.h:545
GPTimer driver implementation for CC26XX/CC13XX.
ADCBufCC26XX_Reference_Source refSource
Definition: ADCBufCC26XX.h:440
struct ADCBufCC26XX_Object * ADCBufCC26XX_Handle
bool inputScalingEnabled
Definition: ADCBufCC26XX.h:456
bool adcSemaphoreInPossession
Definition: ADCBufCC26XX.h:521
Definition: ADCBufCC26XX.h:371
bool isOpen
Definition: ADCBufCC26XX.h:517
ADCBufCC26XX Hardware Attributes.
Definition: ADCBufCC26XX.h:479
uint32_t gptDMAChannelMask
Definition: ADCBufCC26XX.h:487
ADCBuf_Return_Mode returnMode
Definition: ADCBufCC26XX.h:528
Semaphore_Struct conversionComplete
Definition: ADCBufCC26XX.h:533
Definition: ADCBufCC26XX.h:378
Power manager interface.
ADCBuf driver interface.
Definition: ADCBufCC26XX.h:375
ADCBufCC26XX_Sampling_Mode samplingMode
Definition: ADCBufCC26XX.h:438
uint32_t swiPriority
ADC SWI priority. The higher the number, the higher the priority. The minimum is 0 and the maximum is...
Definition: ADCBufCC26XX.h:485
UDMACC26XX Global configuration.
Definition: UDMACC26XX.h:229
Power manager interface for CC26XX.
uint32_t semaphoreTimeout
Definition: ADCBufCC26XX.h:547
CC26XX specfic extension to ADCBuf_Params.
Definition: ADCBufCC26XX.h:434
PIN_Handle pinHandle
Definition: ADCBufCC26XX.h:539
Definition: ADCBufCC26XX.h:372
uint8_t intPriority
ADC peripheral's interrupt priority.
Definition: ADCBufCC26XX.h:501
ADCBufCC26XX_Reference_Source refSource
Definition: ADCBufCC26XX.h:523
Definition: ADCBufCC26XX.h:374
bool inputScalingEnabled
Definition: ADCBufCC26XX.h:519
Device-specific pin & GPIO driver for CC26xx family [def].
ADCBufCC26XX_Sampling_Duration samplingDuration
Definition: ADCBufCC26XX.h:436
Definition: ADCBufCC26XX.h:373
struct ADCBufCC26XX_Object ADCBufCC26XX_Object
ADCBufCC26XX Object.
bool keepADCSemaphore
Definition: ADCBufCC26XX.h:520
ADCBufCC26XX_Sampling_Duration samplingDuration
Definition: ADCBufCC26XX.h:525
ADCBuf_Callback callbackFxn
Definition: ADCBufCC26XX.h:526
ADCBuf_Recurrence_Mode recurrenceMode
Definition: ADCBufCC26XX.h:527
Definition: ADCBufCC26XX.h:376
Definition: ADCBufCC26XX.h:379
Swi_Struct swi
Definition: ADCBufCC26XX.h:532
The definition of an ADCBuf function table that contains the required set of functions to control a s...
Definition: ADCBuf.h:352
Definition: ADCBufCC26XX.h:355
UDMACC26XX driver implementation.
Definition: ADCBufCC26XX.h:370
Definition: ADCBufCC26XX.h:404
struct ADCBufCC26XX_ParamsExtension ADCBufCC26XX_ParamsExtension
CC26XX specfic extension to ADCBuf_Params.
ADCBufCC26XX_Reference_Source
Specifies whether the internal reference of the ADC is sourced from the battery voltage or a fixed in...
Definition: ADCBufCC26XX.h:403
UDMACC26XX_Handle udmaHandle
Definition: ADCBufCC26XX.h:542
Definition: ADCBufCC26XX.h:368
bool conversionInProgress
Definition: ADCBufCC26XX.h:518
uint8_t currentChannel
Definition: ADCBufCC26XX.h:522
struct ADCBufCC26XX_AdcChannelLutEntry ADCBufCC26XX_AdcChannelLutEntry
Table entry that maps a virtual adc channel to a dio and its corresponding internal analogue signal...
ADCBufCC26XX_AdcChannelLutEntry const * adcChannelLut
Definition: ADCBufCC26XX.h:503
GPTimer Global configuration.
Definition: GPTimerCC26XX.h:379
underlying data structure for type PIN_State
Definition: PIN.h:687
ADCBufCC26XX_Sampling_Mode samplingMode
Definition: ADCBufCC26XX.h:524
ADCBuf_Recurrence_Mode
ADC trigger mode settings.
Definition: ADCBuf.h:228
ADCBuf_Return_Mode
ADC return mode settings.
Definition: ADCBuf.h:248
uint8_t gpTimerUnit
Definition: ADCBufCC26XX.h:505
uint8_t dio
Definition: ADCBufCC26XX.h:423
PIN_State pinState
Definition: ADCBufCC26XX.h:538
ADCBuf_Conversion * currentConversion
Definition: ADCBufCC26XX.h:535
struct ADCBufCC26XX_HWAttrs ADCBufCC26XX_HWAttrs
ADCBufCC26XX Hardware Attributes.
uint32_t samplingFrequency
Definition: ADCBufCC26XX.h:548
void(* ADCBuf_Callback)(ADCBuf_Handle handle, ADCBuf_Conversion *conversion, void *completedADCBuffer, uint32_t completedChannel)
The definition of a callback function used by the ADC driver when used in ADCBuf_RETURN_MODE_CALLBACK...
Definition: ADCBuf.h:218
An ADCBuf_Conversion data structure is used with ADCBuf_convert(). It indicates which channel to perf...
Definition: ADCBuf.h:204
uint8_t compBInput
Definition: ADCBufCC26XX.h:424
Definition: ADCBufCC26XX.h:369
Definition: ADCBufCC26XX.h:377
ADCBufCC26XX Object.
Definition: ADCBufCC26XX.h:515
const ADCBuf_FxnTable ADCBufCC26XX_fxnTable
Table entry that maps a virtual adc channel to a dio and its corresponding internal analogue signal...
Definition: ADCBufCC26XX.h:422
Generic PIN & GPIO driver.
ADCBufCC26XX_Sampling_Duration
Amount of time the ADC spends sampling the analogue input.
Definition: ADCBufCC26XX.h:366
Copyright 2016, Texas Instruments Incorporated