1 //*****************************************************************************
2 //
3 //! @file am_hal_adc.h
4 //!
5 //! @brief Functions for Interfacing with the Analog to Digital Converter
6 //!
7 //! @addtogroup adc3p ADC - Analog-to-Digital Converter
8 //! @ingroup apollo3p_hal
9 //! @{
10 //
11 //*****************************************************************************
12 
13 //*****************************************************************************
14 //
15 // Copyright (c) 2023, Ambiq Micro, Inc.
16 // All rights reserved.
17 //
18 // Redistribution and use in source and binary forms, with or without
19 // modification, are permitted provided that the following conditions are met:
20 //
21 // 1. Redistributions of source code must retain the above copyright notice,
22 // this list of conditions and the following disclaimer.
23 //
24 // 2. Redistributions in binary form must reproduce the above copyright
25 // notice, this list of conditions and the following disclaimer in the
26 // documentation and/or other materials provided with the distribution.
27 //
28 // 3. Neither the name of the copyright holder nor the names of its
29 // contributors may be used to endorse or promote products derived from this
30 // software without specific prior written permission.
31 //
32 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
33 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
34 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
35 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
36 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
37 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
38 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
39 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
40 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
41 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42 // POSSIBILITY OF SUCH DAMAGE.
43 //
44 // This is part of revision release_sdk_3_1_1-10cda4b5e0 of the AmbiqSuite Development Package.
45 //
46 //*****************************************************************************
47 #ifndef AM_HAL_ADC_H
48 #define AM_HAL_ADC_H
49 
50 //*****************************************************************************
51 //
52 //! CMSIS-style macro for handling a variable IOM module number.
53 //
54 #define ADCn(n) ((ADC_Type*)(ADC_BASE + (n * (ADC_BASE - ADC_BASE))))
55 //*****************************************************************************
56 
57 //
58 //! Maximum number of slots.
59 //
60 #define AM_HAL_ADC_MAX_SLOTS            8
61 
62 // ****************************************************************************
63 //
64 //! Default slope (in degK / V) of the Apollo3p temperature sensor.
65 //
66 // ****************************************************************************
67 #define AM_HAL_ADC_TEMPSENSOR_SLOPE     290.0F
68 
69 //
70 //! ADC clock selection.
71 //
72 typedef enum
73 {
74     AM_HAL_ADC_CLKSEL_OFF,
75     AM_HAL_ADC_CLKSEL_HFRC,
76     AM_HAL_ADC_CLKSEL_HFRC_DIV2
77 } am_hal_adc_clksel_e;
78 
79 //
80 //! ADC trigger polarity
81 //
82 typedef enum
83 {
84     AM_HAL_ADC_TRIGPOL_RISING,
85     AM_HAL_ADC_TRIGPOL_FALLING
86 } am_hal_adc_trigpol_e;
87 
88 //
89 //! ADC trigger selection
90 //
91 typedef enum
92 {
93     AM_HAL_ADC_TRIGSEL_EXT0,
94     AM_HAL_ADC_TRIGSEL_EXT1,
95     AM_HAL_ADC_TRIGSEL_EXT2,
96     AM_HAL_ADC_TRIGSEL_EXT3,
97     AM_HAL_ADC_TRIGSEL_VCOMP,
98     AM_HAL_ADC_TRIGSEL_SOFTWARE = 7
99 } am_hal_adc_trigsel_e;
100 
101 //
102 //! ADC reference selection.
103 //
104 typedef enum
105 {
106     AM_HAL_ADC_REFSEL_INT_2P0,
107     AM_HAL_ADC_REFSEL_INT_1P5,
108     AM_HAL_ADC_REFSEL_EXT_2P0,
109     AM_HAL_ADC_REFSEL_EXT_1P5
110 } am_hal_adc_refsel_e;
111 
112 //
113 //! ADC clock mode selection.
114 //
115 typedef enum
116 {
117     AM_HAL_ADC_CLKMODE_LOW_POWER,   //!< Disable the clock between scans for LPMODE0.
118                                     //!< Set LPCKMODE to 0x1 while configuring the ADC.
119     AM_HAL_ADC_CLKMODE_LOW_LATENCY  //!< Low Latency Clock Mode. When set, HFRC and the
120                                     //!< adc_clk will remain on while in functioning in LPMODE0.
121 } am_hal_adc_clkmode_e;
122 
123 //
124 //! ADC low-power mode selection.
125 //
126 typedef enum
127 {
128     AM_HAL_ADC_LPMODE0,  //!< Low Latency Clock Mode. When set, HFRC and the adc_clk
129                          //!< will remain on while in functioning in LPMODE0.
130     AM_HAL_ADC_LPMODE1   //!< Powers down all circuity and clocks associated with the
131                          //!< ADC until the next trigger event. Between scans, the reference
132                          //!< buffer requires up to 50us of delay from a scan trigger event
133                          //!< before the conversion will commence while operating in this mode.
134 } am_hal_adc_lpmode_e;
135 
136 //
137 //! ADC repetition selection.
138 //
139 typedef enum
140 {
141     AM_HAL_ADC_SINGLE_SCAN,
142     AM_HAL_ADC_REPEATING_SCAN
143 } am_hal_adc_repeat_e;
144 
145 //
146 //! ADC measurement averaging configuration.
147 //
148 typedef enum
149 {
150     AM_HAL_ADC_SLOT_AVG_1,
151     AM_HAL_ADC_SLOT_AVG_2,
152     AM_HAL_ADC_SLOT_AVG_4,
153     AM_HAL_ADC_SLOT_AVG_8,
154     AM_HAL_ADC_SLOT_AVG_16,
155     AM_HAL_ADC_SLOT_AVG_32,
156     AM_HAL_ADC_SLOT_AVG_64,
157     AM_HAL_ADC_SLOT_AVG_128
158 } am_hal_adc_meas_avg_e;
159 
160 //
161 //! ADC slot precision mode.
162 //
163 typedef enum
164 {
165     AM_HAL_ADC_SLOT_14BIT,
166     AM_HAL_ADC_SLOT_12BIT,
167     AM_HAL_ADC_SLOT_10BIT,
168     AM_HAL_ADC_SLOT_8BIT
169 } am_hal_adc_slot_prec_e;
170 
171 //
172 //! ADC slot channel selection enum.
173 //
174 typedef enum
175 {
176     //! Single-ended channels
177     AM_HAL_ADC_SLOT_CHSEL_SE0,
178     AM_HAL_ADC_SLOT_CHSEL_SE1,
179     AM_HAL_ADC_SLOT_CHSEL_SE2,
180     AM_HAL_ADC_SLOT_CHSEL_SE3,
181     AM_HAL_ADC_SLOT_CHSEL_SE4,
182     AM_HAL_ADC_SLOT_CHSEL_SE5,
183     AM_HAL_ADC_SLOT_CHSEL_SE6,
184     AM_HAL_ADC_SLOT_CHSEL_SE7,
185     AM_HAL_ADC_SLOT_CHSEL_SE8,
186     AM_HAL_ADC_SLOT_CHSEL_SE9,
187     //! Differential channels.
188     AM_HAL_ADC_SLOT_CHSEL_DF0,
189     AM_HAL_ADC_SLOT_CHSEL_DF1,
190     //! Miscellaneous other signals.
191     AM_HAL_ADC_SLOT_CHSEL_TEMP,
192     AM_HAL_ADC_SLOT_CHSEL_BATT,
193     AM_HAL_ADC_SLOT_CHSEL_VSS
194 } am_hal_adc_slot_chan_e;
195 
196 //
197 //! DMA priority enum.
198 //
199 typedef enum
200 {
201     AM_HAL_ADC_PRIOR_BEST_EFFORT,
202     AM_HAL_ADC_PRIOR_SERVICE_IMMED
203 } am_hal_adc_dma_prior_e;
204 
205 //*****************************************************************************
206 //!
207 //! @brief ADC control function request types for am_hal_adc_control().
208 //!
209 //! AM_HAL_ADC_REQ_TEMP_CELSIUS_GET:
210 //!     pArgs must point to an array of 3 floats.  To assure that the
211 //!     array is valid, upon calling the 3rd float (pArgs[2]) must be
212 //!     set to the value -123.456F.
213 //! AM_HAL_ADC_REQ_TEMP_TRIMS_GET:
214 //!     pArgs must point to an array of 4 floats.  To assure that the
215 //!     array is valid, upon calling the 4th float (pArgs[3]) must be
216 //!     set to the to the value -123.456F.
217 //!     On return, pArgs[3] is set to 1 if the returned values are
218 //!     calibrated, or 0 if default calibration values.
219 //!
220 //*****************************************************************************
221 typedef enum
222 {
223     AM_HAL_ADC_REQ_WINDOW_CONFIG,
224     AM_HAL_ADC_REQ_TEMP_CELSIUS_GET,
225     AM_HAL_ADC_REQ_TEMP_TRIMS_GET,
226 } am_hal_adc_request_e;
227 
228 //
229 //! ADC Sample structure.
230 //
231 typedef struct
232 {
233   uint32_t      ui32Sample;
234   uint32_t      ui32Slot;
235 } am_hal_adc_sample_t;
236 
237 
238 //*****************************************************************************
239 //
240 //! @brief Configuration structure for the ADC.
241 //
242 //*****************************************************************************
243 typedef struct
244 {
245     //! Select the ADC clock source.
246     am_hal_adc_clksel_e           eClock;
247 
248     //! Select the ADC trigger polarity.
249     am_hal_adc_trigpol_e          ePolarity;
250 
251     //! Select the ADC trigger source.
252     am_hal_adc_trigsel_e          eTrigger;
253 
254     //! Select the ADC reference voltage.
255     am_hal_adc_refsel_e           eReference;
256 
257     //! Whether to disable clocks between samples.
258     am_hal_adc_clkmode_e          eClockMode;
259 
260     //! Select the ADC power mode.
261     am_hal_adc_lpmode_e           ePowerMode;
262 
263     //! Select whether the ADC will re-trigger based on a signal from timer 3.
264     am_hal_adc_repeat_e           eRepeat;
265 
266 } am_hal_adc_config_t;
267 
268 //*****************************************************************************
269 //
270 //! @brief Configuration structure for the ADC slot.
271 //
272 //*****************************************************************************
273 typedef struct
274 {
275     //! Select the number of measurements to average
276     am_hal_adc_meas_avg_e         eMeasToAvg;
277 
278     //! Select the precision mode
279     am_hal_adc_slot_prec_e        ePrecisionMode;
280 
281     //! Select the channel
282     am_hal_adc_slot_chan_e        eChannel;
283 
284     //! Select window comparison mode
285     bool                          bWindowCompare;
286 
287     //! Enable the slot
288     bool                          bEnabled;
289 
290 } am_hal_adc_slot_config_t;
291 
292 //*****************************************************************************
293 //
294 //! @brief Configuration structure for the ADC DMA
295 //
296 //*****************************************************************************
297 typedef struct
298 {
299     //! ADC DMA dynamic priority enabled.
300     bool                          bDynamicPriority;
301 
302     //! ADC DMA static priority.
303     am_hal_adc_dma_prior_e        ePriority;
304 
305     //! Enable DMA for ADC
306     bool                          bDMAEnable;
307 
308     //! Transfer count in samples
309     uint32_t                      ui32SampleCount;
310 
311     //! Target address
312     uint32_t                      ui32TargetAddress;
313 
314 } am_hal_adc_dma_config_t;
315 
316 //*****************************************************************************
317 //
318 //! @brief Window configuration structure for the ADC.
319 //
320 //*****************************************************************************
321 typedef struct
322 {
323     //! Scale window comparison
324     bool                          bScaleLimits;
325 
326     //! Window limits
327     uint32_t                      ui32Upper;
328     uint32_t                      ui32Lower;
329 
330 } am_hal_adc_window_config_t;
331 
332 //*****************************************************************************
333 //
334 //! @brief Capabilities structure for the ADC.
335 //
336 //*****************************************************************************
337 typedef struct
338 {
339     uint32_t      dummy;
340 
341 } am_hal_adc_capabilities_t;
342 
343 
344 //*****************************************************************************
345 //
346 //! @brief Status structure for the ADC.
347 //
348 //*****************************************************************************
349 typedef struct
350 {
351     //
352     //! ADC power status.
353     //
354     bool                          bPoweredOn;
355     bool                          bLPMode1;
356 
357     //
358     //! DMA status.
359     //
360     bool                          bErr;
361     bool                          bCmp;
362     bool                          bTIP;
363 
364 } am_hal_adc_status_t;
365 
366 //
367 //! Transfer callback function prototype
368 //
369 typedef void (*am_hal_adc_callback_t)(void *pCallbackCtxt, uint32_t status);
370 
371 //*****************************************************************************
372 //
373 //! @name ADC Interrupts
374 //! @brief Interrupt Status Bits for enable/disble use
375 //!
376 //! These macros may be used to enable an individual ADC interrupt cause.
377 //! @{
378 //
379 //*****************************************************************************
380 #define AM_HAL_ADC_INT_DERR               (_VAL2FLD(ADC_INTEN_DERR, 1))
381 #define AM_HAL_ADC_INT_DCMP               (_VAL2FLD(ADC_INTEN_DCMP, 1))
382 #define AM_HAL_ADC_INT_WCINC              (_VAL2FLD(ADC_INTEN_WCINC, 1))
383 #define AM_HAL_ADC_INT_WCEXC              (_VAL2FLD(ADC_INTEN_WCEXC, 1))
384 #define AM_HAL_ADC_INT_FIFOOVR2           (_VAL2FLD(ADC_INTEN_FIFOOVR2, 1))
385 #define AM_HAL_ADC_INT_FIFOOVR1           (_VAL2FLD(ADC_INTEN_FIFOOVR1, 1))
386 #define AM_HAL_ADC_INT_SCNCMP             (_VAL2FLD(ADC_INTEN_SCNCMP, 1))
387 #define AM_HAL_ADC_INT_CNVCMP             (_VAL2FLD(ADC_INTEN_CNVCMP, 1))
388 //! @}
389 
390 //*****************************************************************************
391 //
392 //! @brief ADC Fifo Read macros
393 //!
394 //! These are helper macros for interpreting FIFO data. Each ADC FIFO entry
395 //! contains information about the slot number and the FIFO depth alongside the
396 //! current sample. These macros perform the correct masking and shifting to
397 //! read those values.
398 //!
399 //! The SAMPLE and FULL_SAMPLE options refer to the fractional part of averaged
400 //! samples. If you are not using hardware averaging or don't need the
401 //! fractional part of the ADC sample, you should just use
402 //! AM_HAL_ADC_FIFO_SAMPLE.
403 //!
404 //! If you do need the fractional part, use AM_HAL_ADC_FIFO_FULL_SAMPLE. This
405 //! macro will keep six bits of precision past the decimal point. Depending on
406 //! the number of averaged samples, anywhere between 1 and 6 of these bits will
407 //! be valid. Please consult the datasheet to find out how many bits of data
408 //! are valid for your chosen averaging settings.
409 //!
410 //! @{
411 //
412 //*****************************************************************************
413 #define AM_HAL_ADC_FIFO_SAMPLE(value)       (_FLD2VAL(ADC_FIFO_DATA, value) >> 6)
414 #define AM_HAL_ADC_FIFO_FULL_SAMPLE(value)  (_FLD2VAL(ADC_FIFO_DATA, value))
415 #define AM_HAL_ADC_FIFO_SLOT(value)         (_FLD2VAL(ADC_FIFO_SLOTNUM, value))
416 #define AM_HAL_ADC_FIFO_COUNT(value)        (_FLD2VAL(ADC_FIFO_COUNT, value))
417 //! @}
418 
419 #ifdef __cplusplus
420 extern "C"
421 {
422 #endif
423 
424   //*****************************************************************************
425   //
426   //! @brief ADC initialization function
427   //!
428   //! @param ui32Module   - module instance.
429   //! @param ppHandle       - returns the handle for the module instance.
430   //!
431   //! This function accepts a module instance, allocates the interface and then
432   //! returns a handle to be used by the remaining interface functions.
433   //!
434   //! @return status      - generic or interface specific status.
435   //
436   //*****************************************************************************
437   extern uint32_t am_hal_adc_initialize(uint32_t ui32Module, void **ppHandle);
438 
439   //*****************************************************************************
440   //
441   //! @brief MSPI deinitialization function
442   //!
443   //! @param pHandle       - returns the handle for the module instance.
444   //!
445   //! This function accepts a handle to an instance and de-initializes the
446   //! interface.
447   //!
448   //! @return status      - generic or interface specific status.
449   //
450   //*****************************************************************************
451   extern uint32_t am_hal_adc_deinitialize(void *pHandle);
452 
453   //*****************************************************************************
454   //
455   //! @brief ADC configuration function
456   //! @note This function configures the ADC for operation.
457   //!
458   //! @param pHandle   - handle for the module instance.
459   //! @param psConfig  - pointer to the configuration structure.
460   //!
461   //!
462   //! @return status      - generic or interface specific status.
463   //
464   //*****************************************************************************
465   extern uint32_t am_hal_adc_configure(void *pHandle,
466                                        am_hal_adc_config_t *psConfig);
467 
468   //*****************************************************************************
469   //
470   //! @brief ADC slot configuration function
471   //! @note This function configures the ADC slot for operation.
472   //!
473   //! @param pHandle        - handle for the module instance.
474   //! @param ui32SlotNumber - slot number
475   //! @param pSlotConfig    - pointer to the configuration structure
476   //!
477   //!
478   //! @return status      - generic or interface specific status.
479   //
480   //*****************************************************************************
481   extern uint32_t am_hal_adc_configure_slot(void *pHandle,
482                                             uint32_t ui32SlotNumber,
483                                             am_hal_adc_slot_config_t *pSlotConfig);
484 
485   //*****************************************************************************
486   //
487   //! @brief ADC DMA configuration function
488   //! @note This function configures the ADC DMA for operation.
489   //!
490   //! @param pHandle    - handle for the module instance.
491   //! @param pDMAConfig - pointer to the configuration structure.
492   //!
493   //! @return status      - generic or interface specific status.
494   //
495   //*****************************************************************************
496   extern uint32_t am_hal_adc_configure_dma(void *pHandle,
497                                            am_hal_adc_dma_config_t *pDMAConfig);
498 
499   //*****************************************************************************
500   //
501   //! @brief ADC device specific control function.
502   //!
503   //! @param pHandle   - handle for the module instance.
504   //! @param eRequest - One of:
505   //!     - AM_HAL_ADC_REQ_WINDOW_CONFIG
506   //!     - AM_HAL_ADC_REQ_TEMP_CELSIUS_GET (pArgs is required, see enums).
507   //!     - AM_HAL_ADC_REQ_TEMP_TRIMS_GET   (pArgs is required, see enums).
508   //! @param pArgs     - pointer to pArgs (array of three floats)
509   //!
510   //! This function provides for special control functions for the ADC operation.
511   //!
512   //! @return status      - generic or interface specific status.
513   //
514   //*****************************************************************************
515   extern uint32_t am_hal_adc_control(void *pHandle,
516                                      am_hal_adc_request_e eRequest,
517                                      void *pArgs);
518 
519   //*****************************************************************************
520   //
521   //! @brief ADC enable function
522   //!
523   //! @param pHandle - handle for the module instance.
524   //!
525   //! This function enables the ADC operation.
526   //!
527   //! @return status      - generic or interface specific status.
528   //
529   //*****************************************************************************
530   extern uint32_t am_hal_adc_enable(void *pHandle);
531 
532   //*****************************************************************************
533   //
534   //! @brief ADC disable function
535   //!
536   //! @param pHandle - handle for the module instance.
537   //!
538   //! This function disables the ADC operation.
539   //!
540   //! @return status      - generic or interface specific status.
541   //
542   //*****************************************************************************
543   extern uint32_t am_hal_adc_disable(void *pHandle);
544 
545   //*****************************************************************************
546   //
547   //! @brief ADC status function
548   //!
549   //! @param pHandle       - handle for the interface.
550   //! @param pStatus       - returns status here
551   //!
552   //! This function returns the current status of the DMA operation.
553   //!
554   //! @return status      - DMA status flags.
555   //
556   //*****************************************************************************
557   extern uint32_t am_hal_adc_status_get(void *pHandle,
558                                         am_hal_adc_status_t *pStatus );
559 
560   //*****************************************************************************
561   //
562   //! @brief ADC enable interrupts function
563   //!
564   //! @param pHandle       - handle for the interface.
565   //! @param ui32IntMask  - ADC interrupt mask.
566   //!
567   //! This function enables the specific indicated interrupts.
568   //!
569   //! @return status      - generic or interface specific status.
570   //
571   //*****************************************************************************
572   extern uint32_t am_hal_adc_interrupt_enable(void *pHandle, uint32_t ui32IntMask);
573 
574   //*****************************************************************************
575   //
576   //! @brief ADC disable interrupts function
577   //!
578   //! @param pHandle       - handle for the interface.
579   //! @param ui32IntMask  - ADC interrupt mask.
580   //!
581   //! This function disable the specific indicated interrupts.
582   //!
583   //! @return status      - generic or interface specific status.
584   //
585   //*****************************************************************************
586   extern uint32_t am_hal_adc_interrupt_disable(void *pHandle, uint32_t ui32IntMask);
587 
588   //*****************************************************************************
589   //
590   //! @brief ADC interrupt status function
591   //!
592   //! @param pHandle       - handle for the interface.
593   //! @param pui32Status   - returns interrupts mask
594   //! @param bEnabledOnly  - if true, only returns enabled interrupts
595   //!
596   //! This function returns the specific indicated interrupt status.
597   //!
598   //! @return status      - generic or interface specific status.
599   //
600   //*****************************************************************************
601   extern uint32_t am_hal_adc_interrupt_status(void *pHandle,
602                                               uint32_t  *pui32Status,
603                                               bool bEnabledOnly);
604 
605   //*****************************************************************************
606   //
607   //! @brief ADC interrupt clear
608   //!
609   //! @param pHandle         - handle for the interface.
610   //! @param ui32IntMask    - uint32_t for interrupts to clear
611   //!
612   //! This function clears the interrupts for the given peripheral.
613   //!
614   //! @return status      - generic or interface specific status.
615   //
616   //*****************************************************************************
617   extern uint32_t am_hal_adc_interrupt_clear(void *pHandle, uint32_t ui32IntMask);
618 
619   //*****************************************************************************
620   //
621   //! @brief ADC sample read function
622   //!
623   //! @param pHandle              - handle for the module instance.
624   //! @param bFullSample          - true to get a full sample including
625   //!                               the fractional part.
626   //! @param pui32InSampleBuffer  - Ptr to the input sample buffer.
627   //!                               If NULL then samples will be read directly
628   //!                               from the FIFO.
629   //! @param pui32InOutNumberSamples - Ptr to variable containing the number of
630   //!                                  samples.
631   //! @param pui32OutBuffer       - Ptr to the required output sample buffer.
632   //!
633   //! This function reads samples from the ADC FIFO or an SRAM sample buffer
634   //! returned by a DMA operation.
635   //!
636   //! @return status      - generic or interface specific status.
637   //
638   //*****************************************************************************
639   extern uint32_t am_hal_adc_samples_read(void *pHandle, bool bFullSample,
640                                           uint32_t *pui32InSampleBuffer,
641                                           uint32_t *pui32InOutNumberSamples,
642                                           am_hal_adc_sample_t *pui32OutBuffer);
643 
644   //*****************************************************************************
645   //
646   //! @brief ADC FIFO trigger function
647   //!
648   //! @param pHandle - handle for the module instance.
649   //!
650   //! This function triggers the ADC operation.
651   //!
652   //! @return status      - generic or interface specific status.
653   //
654   //*****************************************************************************
655   extern uint32_t am_hal_adc_sw_trigger(void *pHandle);
656 
657   //*****************************************************************************
658   //
659   //! @brief ADC power control function
660   //!
661   //! @param pHandle       - handle for the interface.
662   //! @param ePowerState  - the desired power state to move the peripheral to.
663   //! @param bRetainState - flag (if true) to save/restore peripheral state upon
664   //!                       power state change.
665   //!
666   //! This function updates the peripheral to a given power state.
667   //!
668   //! @return status      - generic or interface specific status.
669   //
670   //*****************************************************************************
671   extern uint32_t am_hal_adc_power_control(void *pHandle,
672                                            am_hal_sysctrl_power_state_e ePowerState,
673                                            bool bRetainState);
674 
675 #ifdef __cplusplus
676 }
677 #endif
678 
679 #endif // AM_HAL_ADC_H
680 
681 //*****************************************************************************
682 //
683 // End Doxygen group.
684 //! @}
685 //
686 //*****************************************************************************
687 
688