ADCBufCC26X2.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 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  */
233 #ifndef ti_drivers_adc_adcbufcc26xx__include
234 #define ti_drivers_adc_adcbufcc26xx__include
235 
236 #ifdef __cplusplus
237 extern "C" {
238 #endif
239 
240 #include <stdint.h>
241 #include <stdbool.h>
242 
243 #include <ti/drivers/ADCBuf.h>
244 #include <ti/drivers/PIN.h>
248 #include <ti/drivers/Power.h>
250 
251 #include <ti/devices/DeviceFamily.h>
252 #include DeviceFamily_constructPath(driverlib/aux_adc.h)
253 
254 #include <ti/drivers/dpl/HwiP.h>
255 #include <ti/drivers/dpl/ClockP.h>
256 #include <ti/drivers/dpl/SemaphoreP.h>
257 #include <ti/drivers/dpl/SwiP.h>
258 
271 /* Add ADCBufCC26X2_CMD_* macros here */
272 
286 #define ADCBufCC26X2_CMD_ACQUIRE_ADC_SEMAPHORE ADCBuf_CMD_RESERVED + 1
287 
301 #define ADCBufCC26X2_CMD_KEEP_ADC_SEMAPHORE ADCBuf_CMD_RESERVED + 2
302 
310 #define ADCBufCC26X2_CMD_KEEP_ADC_SEMAPHORE_DISABLE ADCBuf_CMD_RESERVED + 3
311 
317 #define ADCBufCC26X2_CMD_RELEASE_ADC_SEMAPHORE ADCBuf_CMD_RESERVED + 4
318 
324 #define ADCBufCC26X2_RESOLUTION 12
325 
326 #define ADCBufCC26X2_BYTES_PER_SAMPLE 2
327 
328 /*
329  * =============================================================================
330  * Constants
331  * =============================================================================
332  */
333 
334 /* ADCBuf function table pointer */
336 
337 
338 /*
339  * =============================================================================
340  * Enumerations
341  * =============================================================================
342  */
343 
358 
368  ADCBufCC26X2_SAMPLING_DURATION_2P7_US = AUXADC_SAMPLE_TIME_2P7_US,
369  ADCBufCC26X2_SAMPLING_DURATION_5P3_US = AUXADC_SAMPLE_TIME_5P3_US,
370  ADCBufCC26X2_SAMPLING_DURATION_10P6_US = AUXADC_SAMPLE_TIME_10P6_US,
371  ADCBufCC26X2_SAMPLING_DURATION_21P3_US = AUXADC_SAMPLE_TIME_21P3_US,
372  ADCBufCC26X2_SAMPLING_DURATION_42P6_US = AUXADC_SAMPLE_TIME_42P6_US,
373  ADCBufCC26X2_SAMPLING_DURATION_85P3_US = AUXADC_SAMPLE_TIME_85P3_US,
374  ADCBufCC26X2_SAMPLING_DURATION_170_US = AUXADC_SAMPLE_TIME_170_US,
375  ADCBufCC26X2_SAMPLING_DURATION_341_US = AUXADC_SAMPLE_TIME_341_US,
376  ADCBufCC26X2_SAMPLING_DURATION_682_US = AUXADC_SAMPLE_TIME_682_US,
377  ADCBufCC26X2_SAMPLING_DURATION_1P37_MS = AUXADC_SAMPLE_TIME_1P37_MS,
378  ADCBufCC26X2_SAMPLING_DURATION_2P73_MS = AUXADC_SAMPLE_TIME_2P73_MS,
379  ADCBufCC26X2_SAMPLING_DURATION_5P46_MS = AUXADC_SAMPLE_TIME_5P46_MS,
380  ADCBufCC26X2_SAMPLING_DURATION_10P9_MS = AUXADC_SAMPLE_TIME_10P9_MS
382 
383 
405  ADCBufCC26X2_FIXED_REFERENCE = AUXADC_REF_FIXED,
406  ADCBufCC26X2_VDDS_REFERENCE = AUXADC_REF_VDDS_REL
408 
409 
410 
411 /*
412  * =============================================================================
413  * Structs
414  * =============================================================================
415  */
416 
424  uint8_t dio;
425  uint8_t compBInput;
427 
437  ADCBufCC26X2_Sampling_Duration samplingDuration;
439  ADCBufCC26X2_Sampling_Mode samplingMode;
441  ADCBufCC26X2_Reference_Source refSource;
459 
478 typedef struct ADCBufCC26X2_HWAttrs{
484  uint32_t swiPriority;
498  uint8_t intPriority;
502  uint8_t gpTimerUnit;
504 
505 
506 
512 typedef struct ADCBufCC26X2_Object{
513  /* ADC control variables */
514  bool isOpen;
519  uint8_t currentChannel;
520  ADCBufCC26X2_Reference_Source refSource;
521  ADCBufCC26X2_Sampling_Mode samplingMode;
522  ADCBufCC26X2_Sampling_Duration samplingDuration;
526  uint16_t *activeSampleBuffer;
528  /* ADC SYS/BIOS objects */
529  HwiP_Struct hwi;
530  SwiP_Struct swi;
531  SemaphoreP_Struct conversionComplete;
535  /* PIN driver state object and handle */
539  /* UDMA driver handle */
542  /* GPTimer driver handle */
545  uint32_t semaphoreTimeout;
546  uint32_t samplingFrequency;
548 
549 /*
550  * =============================================================================
551  * Functions
552  * =============================================================================
553  */
554 
555 
556 #ifdef __cplusplus
557 }
558 #endif
559 
560 #endif /* ti_drivers_adc_ADCBufCC26XX__include */
Power manager interface for CC26X2.
ADCBufCC26X2 Hardware Attributes.
Definition: ADCBufCC26X2.h:478
Definition: ADCBufCC26X2.h:371
SemaphoreP_Struct conversionComplete
Definition: ADCBufCC26X2.h:531
Definition: ADCBufCC26X2.h:356
struct ADCBufCC26X2_ParamsExtension ADCBufCC26X2_ParamsExtension
CC26X2 specfic extension to ADCBuf_Params.
GPTimer driver implementation for CC26XX/CC13XX.
Definition: ADCBufCC26X2.h:373
enum ADCBuf_Recurrence_Mode_ ADCBuf_Recurrence_Mode
ADC trigger mode settings.
ADCBufCC26X2_Reference_Source refSource
Definition: ADCBufCC26X2.h:441
ADCBufCC26X2_AdcChannelLutEntry const * adcChannelLut
Definition: ADCBufCC26X2.h:500
uint32_t samplingFrequency
Definition: ADCBufCC26X2.h:546
ADCBuf_Recurrence_Mode recurrenceMode
Definition: ADCBufCC26X2.h:524
ADCBuf_Return_Mode returnMode
Definition: ADCBufCC26X2.h:525
An ADCBuf_Conversion data structure is used with ADCBuf_convert(). It indicates which channel to perf...
Definition: ADCBuf.h:237
Table entry that maps a virtual adc channel to a dio and its corresponding internal analogue signal...
Definition: ADCBufCC26X2.h:423
Power Manager interface.
ADCBuf driver interface.
enum ADCBuf_Return_Mode_ ADCBuf_Return_Mode
ADC return mode settings.
UDMACC26XX Global configuration.
Definition: UDMACC26XX.h:231
PIN_State pinState
Definition: ADCBufCC26X2.h:536
HwiP_Struct hwi
Definition: ADCBufCC26X2.h:529
ADCBuf_Callback callbackFxn
Definition: ADCBufCC26X2.h:523
ADCBufCC26X2_Sampling_Mode samplingMode
Definition: ADCBufCC26X2.h:521
Definition: ADCBufCC26X2.h:370
uint8_t currentChannel
Definition: ADCBufCC26X2.h:519
Definition: ADCBufCC26X2.h:369
struct ADCBufCC26X2_HWAttrs ADCBufCC26X2_HWAttrs
ADCBufCC26X2 Hardware Attributes.
Definition: ADCBufCC26X2.h:355
PIN_Handle pinHandle
Definition: ADCBufCC26X2.h:537
ADCBufCC26X2_Sampling_Duration
Amount of time the ADC spends sampling the analogue input.
Definition: ADCBufCC26X2.h:367
Definition: ADCBufCC26X2.h:377
Device-specific pin & GPIO driver for CC26xx family [def].
ADCBufCC26X2_Sampling_Duration samplingDuration
Definition: ADCBufCC26X2.h:522
bool conversionInProgress
Definition: ADCBufCC26X2.h:515
Definition: ADCBufCC26X2.h:405
bool inputScalingEnabled
Definition: ADCBufCC26X2.h:457
ADCBufCC26X2_Reference_Source refSource
Definition: ADCBufCC26X2.h:520
The definition of an ADCBuf function table that contains the required set of functions to control a s...
Definition: ADCBuf.h:385
uint8_t compBInput
Definition: ADCBufCC26X2.h:425
ADCBufCC26X2 Object.
Definition: ADCBufCC26X2.h:512
UDMACC26XX driver implementation.
Definition: ADCBufCC26X2.h:375
CC26X2 specfic extension to ADCBuf_Params.
Definition: ADCBufCC26X2.h:435
ADCBufCC26X2_Sampling_Duration samplingDuration
Definition: ADCBufCC26X2.h:437
ADCBuf_Conversion * currentConversion
Definition: ADCBufCC26X2.h:533
uint32_t semaphoreTimeout
Definition: ADCBufCC26X2.h:545
UDMACC26XX_Handle udmaHandle
Definition: ADCBufCC26X2.h:540
Definition: ADCBufCC26X2.h:374
struct ADCBufCC26X2_Object ADCBufCC26X2_Object
ADCBufCC26X2 Object.
uint8_t dio
Definition: ADCBufCC26X2.h:424
Definition: ADCBufCC26X2.h:376
GPTimer Global configuration.
Definition: GPTimerCC26XX.h:378
underlying data structure for type PIN_State
Definition: PIN.h:707
const ADCBuf_FxnTable ADCBufCC26X2_fxnTable
ADCBufCC26X2_Sampling_Mode samplingMode
Definition: ADCBufCC26X2.h:439
Definition: ADCBufCC26X2.h:372
struct ADCBufCC26X2_AdcChannelLutEntry ADCBufCC26X2_AdcChannelLutEntry
Table entry that maps a virtual adc channel to a dio and its corresponding internal analogue signal...
GPTimerCC26XX_Handle timerHandle
Definition: ADCBufCC26X2.h:543
Definition: ADCBufCC26X2.h:406
Definition: ADCBufCC26X2.h:380
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:251
uint32_t swiPriority
ADC SWI priority. The higher the number, the higher the priority. The minimum is 0 and the maximum is...
Definition: ADCBufCC26X2.h:484
bool adcSemaphoreInPossession
Definition: ADCBufCC26X2.h:518
uint8_t intPriority
ADC peripheral&#39;s interrupt priority.
Definition: ADCBufCC26X2.h:498
Definition: ADCBufCC26X2.h:378
bool keepADCSemaphore
Definition: ADCBufCC26X2.h:517
Definition: ADCBufCC26X2.h:368
SwiP_Struct swi
Definition: ADCBufCC26X2.h:530
bool isOpen
Definition: ADCBufCC26X2.h:514
Definition: ADCBufCC26X2.h:379
bool inputScalingEnabled
Definition: ADCBufCC26X2.h:516
ADCBufCC26X2_Reference_Source
Specifies whether the internal reference of the ADC is sourced from the battery voltage or a fixed in...
Definition: ADCBufCC26X2.h:404
struct ADCBufCC26X2_Object * ADCBufCC26X2_Handle
Generic PIN & GPIO driver.
uint16_t * activeSampleBuffer
Definition: ADCBufCC26X2.h:526
ADCBufCC26X2_Sampling_Mode
Specifies whether the internal reference of the ADC is sourced from the battery voltage or a fixed in...
Definition: ADCBufCC26X2.h:354
uint8_t gpTimerUnit
Definition: ADCBufCC26X2.h:502
Copyright 2018, Texas Instruments Incorporated