10#define _FSL_ADC_ETC_H_
12#include "fsl_common.h"
23#define FSL_ADC_ETC_DRIVER_VERSION (MAKE_VERSION(2, 2, 1))
25#define ADC_ETC_DMA_CTRL_TRGn_REQ_MASK 0xFF0000U
32 kADC_ETC_Done0StatusFlagMask = 1U << 0U,
33 kADC_ETC_Done1StatusFlagMask = 1U << 1U,
34 kADC_ETC_Done2StatusFlagMask = 1U << 2U,
35#if defined(FSL_FEATURE_ADC_ETC_HAS_TRIGm_CHAIN_a_b_IEn_EN) && FSL_FEATURE_ADC_ETC_HAS_TRIGm_CHAIN_a_b_IEn_EN
36 kADC_ETC_Done3StatusFlagMask = 1U << 3U,
37 kADC_ETC_ErrorStatusFlagMask = 1U << 4U,
39 kADC_ETC_ErrorStatusFlagMask = 1U << 3U,
49 kADC_ETC_Trg0TriggerSource = 0U,
50 kADC_ETC_Trg1TriggerSource = 1U,
51 kADC_ETC_Trg2TriggerSource = 2U,
52 kADC_ETC_Trg3TriggerSource = 3U,
53 kADC_ETC_Trg4TriggerSource = 4U,
54 kADC_ETC_Trg5TriggerSource = 5U,
55 kADC_ETC_Trg6TriggerSource = 6U,
56 kADC_ETC_Trg7TriggerSource = 7U,
58 kADC_ETC_TSC0TriggerSource = 8U,
59 kADC_ETC_TSC1TriggerSource = 9U,
67#if defined(FSL_FEATURE_ADC_ETC_HAS_TRIGm_CHAIN_a_b_IEn_EN) && FSL_FEATURE_ADC_ETC_HAS_TRIGm_CHAIN_a_b_IEn_EN
68 kADC_ETC_Done0InterruptEnable = 0U,
69 kADC_ETC_Done1InterruptEnable = 1U,
70 kADC_ETC_Done2InterruptEnable = 2U,
71 kADC_ETC_Done3InterruptEnable = 3U,
73 kADC_ETC_InterruptDisable = 0U,
74 kADC_ETC_Done0InterruptEnable = 1U,
75 kADC_ETC_Done1InterruptEnable = 2U,
76 kADC_ETC_Done2InterruptEnable = 3U,
80#if defined(FSL_FEATURE_ADC_ETC_HAS_CTRL_DMA_MODE_SEL) && FSL_FEATURE_ADC_ETC_HAS_CTRL_DMA_MODE_SEL
84typedef enum _adc_etc_dma_mode_selection
86 kADC_ETC_TrigDMAWithLatchedSignal =
88 kADC_ETC_TrigDMAWithPulsedSignal = 1U,
89} adc_etc_dma_mode_selection_t;
97#if ((!(defined(FSL_FEATURE_ADC_ETC_HAS_NO_TSC0_TRIG) && FSL_FEATURE_ADC_ETC_HAS_NO_TSC0_TRIG)) || \
98 (!(defined(FSL_FEATURE_ADC_ETC_HAS_NO_TSC1_TRIG) && FSL_FEATURE_ADC_ETC_HAS_NO_TSC1_TRIG)))
103#if !(defined(FSL_FEATURE_ADC_ETC_HAS_NO_TSC0_TRIG) && FSL_FEATURE_ADC_ETC_HAS_NO_TSC0_TRIG)
104 bool enableTSC0Trigger;
107#if !(defined(FSL_FEATURE_ADC_ETC_HAS_NO_TSC1_TRIG) && FSL_FEATURE_ADC_ETC_HAS_NO_TSC1_TRIG)
108 bool enableTSC1Trigger;
111#if defined(FSL_FEATURE_ADC_ETC_HAS_CTRL_DMA_MODE_SEL) && FSL_FEATURE_ADC_ETC_HAS_CTRL_DMA_MODE_SEL
112 adc_etc_dma_mode_selection_t dmaMode;
115#if !(defined(FSL_FEATURE_ADC_ETC_HAS_NO_TSC0_TRIG) && FSL_FEATURE_ADC_ETC_HAS_NO_TSC0_TRIG)
116 uint32_t TSC0triggerPriority;
119#if !(defined(FSL_FEATURE_ADC_ETC_HAS_NO_TSC1_TRIG) && FSL_FEATURE_ADC_ETC_HAS_NO_TSC1_TRIG)
120 uint32_t TSC1triggerPriority;
122 uint32_t clockPreDivider;
124 uint32_t XBARtriggerMask;
137 uint32_t ADCHCRegisterSelect;
138 uint32_t ADCChannelSelect;
140#if defined(FSL_FEATURE_ADC_ETC_HAS_TRIGm_CHAIN_a_b_IEn_EN) && FSL_FEATURE_ADC_ETC_HAS_TRIGm_CHAIN_a_b_IEn_EN
152 bool enableSWTriggerMode;
153 uint32_t triggerChainLength;
154 uint32_t triggerPriority;
155 uint32_t sampleIntervalDelay;
156 uint32_t initialDelay;
162#if defined(__cplusplus)
223 uint32_t triggerGroup,
254static inline void ADC_ETC_EnableDMA(
ADC_ETC_Type *base, uint32_t triggerGroup)
257 base->DMA_CTRL = (base->DMA_CTRL | ((uint32_t)ADC_ETC_DMA_CTRL_TRIG0_ENABLE_MASK << (uint32_t)triggerGroup)) &
258 ~ADC_ETC_DMA_CTRL_TRGn_REQ_MASK;
267static inline void ADC_ETC_DisableDMA(
ADC_ETC_Type *base, uint32_t triggerGroup)
270 base->DMA_CTRL = (base->DMA_CTRL & ~((uint32_t)ADC_ETC_DMA_CTRL_TRIG0_ENABLE_MASK << (uint32_t)triggerGroup)) &
271 ~ADC_ETC_DMA_CTRL_TRGn_REQ_MASK;
281static inline uint32_t ADC_ETC_GetDMAStatusFlags(
ADC_ETC_Type *base)
293static inline void ADC_ETC_ClearDMAStatusFlags(
ADC_ETC_Type *base, uint32_t mask)
304static inline void ADC_ETC_DoSoftwareReset(
ADC_ETC_Type *base,
bool enable)
308 base->CTRL |= ADC_ETC_CTRL_SOFTRST_MASK;
312 base->CTRL &= ~ADC_ETC_CTRL_SOFTRST_MASK;
325static inline void ADC_ETC_DoSoftwareTrigger(
ADC_ETC_Type *base, uint32_t triggerGroup)
327 assert(triggerGroup < ADC_ETC_TRIGn_CTRL_COUNT);
329 base->TRIG[triggerGroup].TRIGn_CTRL |= ADC_ETC_TRIGn_CTRL_SW_TRIG_MASK;
346#if defined(__cplusplus)
void ADC_ETC_ClearInterruptStatusFlags(ADC_ETC_Type *base, adc_etc_external_trigger_source_t sourceIndex, uint32_t mask)
Clears the ADC_ETC's interrupt status falgs.
Definition: fsl_adc_etc.c:373
enum _adc_etc_external_trigger_source adc_etc_external_trigger_source_t
External triggers sources.
void ADC_ETC_SetTriggerChainConfig(ADC_ETC_Type *base, uint32_t triggerGroup, uint32_t chainGroup, const adc_etc_trigger_chain_config_t *config)
Set the external XBAR trigger chain configuration. For example, if triggerGroup is set to 0U and chai...
Definition: fsl_adc_etc.c:227
enum _adc_etc_interrupt_enable adc_etc_interrupt_enable_t
Interrupt enable/disable mask.
_adc_etc_external_trigger_source
External triggers sources.
Definition: fsl_adc_etc.h:47
uint32_t ADC_ETC_GetADCConversionValue(ADC_ETC_Type *base, uint32_t triggerGroup, uint32_t chainGroup)
Get ADC conversion result from external XBAR sources. For example, if triggerGroup is set to 0U and c...
Definition: fsl_adc_etc.c:409
void ADC_ETC_SetTriggerConfig(ADC_ETC_Type *base, uint32_t triggerGroup, const adc_etc_trigger_config_t *config)
Set the external XBAR trigger configuration.
Definition: fsl_adc_etc.c:191
struct _adc_etc_config adc_etc_config_t
ADC_ETC configuration.
struct _adc_etc_trigger_chain_config adc_etc_trigger_chain_config_t
ADC_ETC trigger chain configuration.
void ADC_ETC_Init(ADC_ETC_Type *base, const adc_etc_config_t *config)
Initialize the ADC_ETC module.
Definition: fsl_adc_etc.c:66
struct _adc_etc_trigger_config adc_etc_trigger_config_t
ADC_ETC trigger configuration.
uint32_t ADC_ETC_GetInterruptStatusFlags(ADC_ETC_Type *base, adc_etc_external_trigger_source_t sourceIndex)
Gets the interrupt status flags of external XBAR and TSC triggers.
Definition: fsl_adc_etc.c:332
void ADC_ETC_GetDefaultConfig(adc_etc_config_t *config)
Gets an available pre-defined settings for the ADC_ETC's configuration. This function initializes the...
Definition: fsl_adc_etc.c:151
_adc_etc_status_flag_mask
ADC_ETC customized status flags mask.
Definition: fsl_adc_etc.h:31
#define ADC_ETC_DMA_CTRL_TRGn_REQ_MASK
The mask of status flags cleared by writing 1.
Definition: fsl_adc_etc.h:25
_adc_etc_interrupt_enable
Interrupt enable/disable mask.
Definition: fsl_adc_etc.h:66
void ADC_ETC_Deinit(ADC_ETC_Type *base)
De-Initialize the ADC_ETC module.
Definition: fsl_adc_etc.c:123
Definition: MIMXRT1052.h:1683
ADC_ETC configuration.
Definition: fsl_adc_etc.h:96
ADC_ETC trigger chain configuration.
Definition: fsl_adc_etc.h:134
ADC_ETC trigger configuration.
Definition: fsl_adc_etc.h:149
Definition: deflate.c:114