CC26xx Driver Library |

- Main Page
- Related Pages
- CC26xx APIs
- Register Descriptions
- Online Resources

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
aux_adc.h
Go to the documentation of this file.
1 /******************************************************************************
2 * Filename: aux_adc.h
3 * Revised: 2015-01-13 16:59:55 +0100 (ti, 13 jan 2015)
4 * Revision: 42365
5 *
6 * Description: Defines and prototypes for the AUX Analog-to-Digital
7 * Converter
8 *
9 * Copyright (c) 2015, Texas Instruments Incorporated
10 * All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions are met:
14 *
15 * 1) Redistributions of source code must retain the above copyright notice,
16 * this list of conditions and the following disclaimer.
17 *
18 * 2) Redistributions in binary form must reproduce the above copyright notice,
19 * this list of conditions and the following disclaimer in the documentation
20 * and/or other materials provided with the distribution.
21 *
22 * 3) Neither the name of the ORGANIZATION nor the names of its contributors may
23 * be used to endorse or promote products derived from this software without
24 * specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
30 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 *
38 ******************************************************************************/
39
40 //*****************************************************************************
41 //
44 //
45 //*****************************************************************************
46
47 #ifndef __AUX_ADC_H__
48 #define __AUX_ADC_H__
49
50 //*****************************************************************************
51 //
52 // If building with a C++ compiler, make all of the definitions in this header
53 // have a C binding.
54 //
55 //*****************************************************************************
56 #ifdef __cplusplus
57 extern "C"
58 {
59 #endif
60
61 #include <stdbool.h>
62 #include <stdint.h>
63 #include <inc/hw_types.h>
64 #include <inc/hw_memmap.h>
65 #include <inc/hw_event.h>
66 #include <inc/hw_adi.h>
67 #include <inc/hw_adi_4_aux.h>
68 #include <inc/hw_aux_anaif.h>
69 #include <driverlib/rom.h>
70
71 //*****************************************************************************
72 //
73 // Defines for ADC reference sources.
74 //
75 //*****************************************************************************
76 #define AUXADC_REF_FIXED (0 << ADI_4_AUX_ADCREF0_SRC_S)
77 #define AUXADC_REF_VDDA_REL (1 << ADI_4_AUX_ADCREF0_SRC_S)
78
79 //*****************************************************************************
80 //
81 // Defines for the ADC FIFO status bits.
82 //
83 //*****************************************************************************
84 #define AUXADC_FIFO_EMPTY_M AUX_ANAIF_ADCFIFOSTAT_EMPTY_M
85 #define AUXADC_FIFO_ALMOST_FULL_M AUX_ANAIF_ADCFIFOSTAT_ALMOST_FULL_M
86 #define AUXADC_FIFO_FULL_M AUX_ANAIF_ADCFIFOSTAT_FULL_M
87 #define AUXADC_FIFO_UNDERFLOW_M AUX_ANAIF_ADCFIFOSTAT_UNDERFLOW_M
88 #define AUXADC_FIFO_OVERFLOW_M AUX_ANAIF_ADCFIFOSTAT_OVERFLOW_M
89
90 //*****************************************************************************
91 //
92 // Defines for supported ADC triggers.
93 //
94 //*****************************************************************************
95 #define AUXADC_TRIGGER_MANUAL EVENT_AUXSEL0_EV_NONE
96 #define AUXADC_TRIGGER_GPT0A EVENT_AUXSEL0_EV_GPT0A
97 #define AUXADC_TRIGGER_GPT0B EVENT_AUXSEL0_EV_GPT0B
98 #define AUXADC_TRIGGER_GPT1A EVENT_AUXSEL0_EV_GPT1A
99 #define AUXADC_TRIGGER_GPT1B EVENT_AUXSEL0_EV_GPT1B
100 #define AUXADC_TRIGGER_GPT2A EVENT_AUXSEL0_EV_GPT2A
101 #define AUXADC_TRIGGER_GPT2B EVENT_AUXSEL0_EV_GPT2B
102 #define AUXADC_TRIGGER_GPT3A EVENT_AUXSEL0_EV_GPT3A
103 #define AUXADC_TRIGGER_GPT3B EVENT_AUXSEL0_EV_GPT3B
104
105 //*****************************************************************************
106 //
107 // Defines for ADC sampling type for synchronous operation.
108 //
109 //*****************************************************************************
110 #define AUXADC_SAMPLE_TIME_2P7_US (3 << ADI_4_AUX_ADC0_SMPL_CYCLE_EXP_S)
111 #define AUXADC_SAMPLE_TIME_5P3_US (4 << ADI_4_AUX_ADC0_SMPL_CYCLE_EXP_S)
112 #define AUXADC_SAMPLE_TIME_10P6_US (5 << ADI_4_AUX_ADC0_SMPL_CYCLE_EXP_S)
113 #define AUXADC_SAMPLE_TIME_21P3_US (6 << ADI_4_AUX_ADC0_SMPL_CYCLE_EXP_S)
114 #define AUXADC_SAMPLE_TIME_42P6_US (7 << ADI_4_AUX_ADC0_SMPL_CYCLE_EXP_S)
115 #define AUXADC_SAMPLE_TIME_85P3_US (8 << ADI_4_AUX_ADC0_SMPL_CYCLE_EXP_S)
116 #define AUXADC_SAMPLE_TIME_170_US (9 << ADI_4_AUX_ADC0_SMPL_CYCLE_EXP_S)
117 #define AUXADC_SAMPLE_TIME_341_US (10 << ADI_4_AUX_ADC0_SMPL_CYCLE_EXP_S)
118 #define AUXADC_SAMPLE_TIME_682_US (11 << ADI_4_AUX_ADC0_SMPL_CYCLE_EXP_S)
119 #define AUXADC_SAMPLE_TIME_1P37_MS (12 << ADI_4_AUX_ADC0_SMPL_CYCLE_EXP_S)
120 #define AUXADC_SAMPLE_TIME_2P73_MS (13 << ADI_4_AUX_ADC0_SMPL_CYCLE_EXP_S)
121 #define AUXADC_SAMPLE_TIME_5P46_MS (14 << ADI_4_AUX_ADC0_SMPL_CYCLE_EXP_S)
122 #define AUXADC_SAMPLE_TIME_10P9_MS (15 << ADI_4_AUX_ADC0_SMPL_CYCLE_EXP_S)
123
124
125 //*****************************************************************************
126 //
127 // API Functions and prototypes
128 //
129 //*****************************************************************************
130
131
132 //*****************************************************************************
133 //
135 //
136 //*****************************************************************************
137 extern void
138 AUXADCDisable(void);
139
140 //*****************************************************************************
141 //
165 //
166 //*****************************************************************************
167 extern void
168 AUXADCEnableAsync(uint32_t refSource, uint32_t trigger);
169
170 //*****************************************************************************
171 //
211 //
212 //*****************************************************************************
213 extern void
214 AUXADCEnableSync(uint32_t refSource, uint32_t sampleTime, uint32_t trigger);
215
216 //*****************************************************************************
217 //
223 //
224 //*****************************************************************************
225 extern void
226 AUXADCFlushFifo(void);
227
228 //*****************************************************************************
229 //
234 //
235 //*****************************************************************************
236 __STATIC_INLINE void
237 AUXADCGenManualTrigger(void)
238 {
239 HWREG(AUX_ANAIF_BASE + AUX_ANAIF_O_ADCTRIG) = 0;
240 }
241
242 //*****************************************************************************
243 //
250 //| A combination (bitwise OR) of the following flags:
256 //
257 //*****************************************************************************
258 __STATIC_INLINE uint32_t
259 AUXADCGetFifoStatus(void)
260 {
261 return HWREG(AUX_ANAIF_BASE + AUX_ANAIF_O_ADCFIFOSTAT);
262 }
263
264 //*****************************************************************************
265 //
276 //
277 //*****************************************************************************
278 extern uint32_t
279 AUXADCReadFifo(void);
280
281 //*****************************************************************************
282 //
300 //
301 //*****************************************************************************
302 __STATIC_INLINE void
303 AUXADCSelectInput(uint32_t input)
304 {
305 HapiSelectADCCompBInput(input);
306 }
307
308 //*****************************************************************************
309 //
310 // Mark the end of the C bindings section for C++ compilers.
311 //
312 //*****************************************************************************
313 #ifdef __cplusplus
314 }
315 #endif
316
317 #endif // __AUX_ADC_H__
318
319 //*****************************************************************************
320 //
323 //
324 //*****************************************************************************
AUXADCGenManualTrigger
__STATIC_INLINE void AUXADCGenManualTrigger(void)
Generates a single manual ADC trigger.
Definition: aux_adc.h:237
AUXADCGetFifoStatus
__STATIC_INLINE uint32_t AUXADCGetFifoStatus(void)
Returns flags indicating the status of the ADC FIFO.
Definition: aux_adc.h:259
AUXADCEnableAsync
void AUXADCEnableAsync(uint32_t refSource, uint32_t trigger)
Enables the ADC for asynchronous operation.
Definition: aux_adc.c:72
AUXADCDisable
void AUXADCDisable(void)
Disables the ADC.
Definition: aux_adc.c:51
HapiSelectADCCompBInput
#define HapiSelectADCCompBInput(a)
Definition: rom.h:193
AUXADCEnableSync
void AUXADCEnableSync(uint32_t refSource, uint32_t sampleTime, uint32_t trigger)
Enables the ADC for synchronous operation.
Definition: aux_adc.c:103
AUXADCSelectInput
__STATIC_INLINE void AUXADCSelectInput(uint32_t input)
Selects internal or external input for the ADC.
Definition: aux_adc.h:303
rom.h
AUXADCFlushFifo
void AUXADCFlushFifo(void)
Flushes the ADC FIFO.
Definition: aux_adc.c:138
AUXADCReadFifo
uint32_t AUXADCReadFifo(void)
Waits for and returns the first sample in the ADC FIFO.
Definition: aux_adc.c:150