1 /**************************************************************************//**
2  * @file     eadc.h
3  * @version  V0.10
4  * @brief    EADC driver header file
5  *
6  * SPDX-License-Identifier: Apache-2.0
7  * @copyright (C) 2021 Nuvoton Technology Corp. All rights reserved.
8 *****************************************************************************/
9 #ifndef __EADC_H__
10 #define __EADC_H__
11 
12 #ifdef __cplusplus
13 extern "C"
14 {
15 #endif
16 
17 
18 /** @addtogroup Standard_Driver Standard Driver
19   @{
20 */
21 
22 /** @addtogroup EADC_Driver EADC Driver
23   @{
24 */
25 
26 /** @addtogroup EADC_EXPORTED_CONSTANTS EADC Exported Constants
27   @{
28 */
29 
30 /*---------------------------------------------------------------------------------------------------------*/
31 /*  EADC_CTL Constant Definitions                                                                          */
32 /*---------------------------------------------------------------------------------------------------------*/
33 #define EADC_CTL_DIFFEN_SINGLE_END          (0UL<<EADC_CTL_DIFFEN_Pos)   /*!< Single-end input mode      \hideinitializer */
34 #define EADC_CTL_DIFFEN_DIFFERENTIAL        (1UL<<EADC_CTL_DIFFEN_Pos)   /*!< Differential input mode    \hideinitializer */
35 
36 #define EADC_CTL_DMOF_STRAIGHT_BINARY       (0UL<<EADC_CTL_DMOF_Pos)     /*!< Select the straight binary format as the output format of the conversion result   \hideinitializer */
37 #define EADC_CTL_DMOF_TWOS_COMPLEMENT       (1UL<<EADC_CTL_DMOF_Pos)     /*!< Select the 2's complement format as the output format of the conversion result    \hideinitializer */
38 
39 /*---------------------------------------------------------------------------------------------------------*/
40 /* EADC_SCTL Constant Definitions                                                                          */
41 /*---------------------------------------------------------------------------------------------------------*/
42 #define EADC_SCTL_CHSEL(x)                  ((x) << EADC_SCTL_CHSEL_Pos)       /*!< A/D sample module channel selection \hideinitializer */
43 #define EADC_SCTL_TRGDLYDIV(x)              ((x) << EADC_SCTL_TRGDLYDIV_Pos)   /*!< A/D sample module start of conversion trigger delay clock divider selection \hideinitializer */
44 #define EADC_SCTL_TRGDLYCNT(x)              ((x) << EADC_SCTL_TRGDLYCNT_Pos)   /*!< A/D sample module start of conversion trigger delay time \hideinitializer */
45 
46 #define EADC_SOFTWARE_TRIGGER               (0UL<<EADC_SCTL_TRGSEL_Pos)      /*!< Software trigger \hideinitializer */
47 #define EADC_FALLING_EDGE_TRIGGER           (EADC_SCTL_EXTFEN_Msk | (1UL<<EADC_SCTL_TRGSEL_Pos))       /*!< STADC pin falling edge trigger \hideinitializer */
48 #define EADC_RISING_EDGE_TRIGGER            (EADC_SCTL_EXTREN_Msk | (1UL<<EADC_SCTL_TRGSEL_Pos))       /*!< STADC pin rising edge trigger \hideinitializer */
49 #define EADC_FALLING_RISING_EDGE_TRIGGER    (EADC_SCTL_EXTFEN_Msk | EADC_SCTL_EXTREN_Msk | (1UL<<EADC_SCTL_TRGSEL_Pos)) /*!< STADC pin both falling and rising edge trigger \hideinitializer */
50 #define EADC_ADINT0_TRIGGER                 (2UL<<EADC_SCTL_TRGSEL_Pos)      /*!< ADC ADINT0 interrupt EOC pulse trigger \hideinitializer */
51 #define EADC_ADINT1_TRIGGER                 (3UL<<EADC_SCTL_TRGSEL_Pos)      /*!< ADC ADINT1 interrupt EOC pulse trigger \hideinitializer */
52 #define EADC_TIMER0_TRIGGER                 (4UL<<EADC_SCTL_TRGSEL_Pos)      /*!< Timer0 overflow pulse trigger \hideinitializer */
53 #define EADC_TIMER1_TRIGGER                 (5UL<<EADC_SCTL_TRGSEL_Pos)      /*!< Timer1 overflow pulse trigger \hideinitializer */
54 #define EADC_TIMER2_TRIGGER                 (6UL<<EADC_SCTL_TRGSEL_Pos)      /*!< Timer2 overflow pulse trigger \hideinitializer */
55 #define EADC_TIMER3_TRIGGER                 (7UL<<EADC_SCTL_TRGSEL_Pos)      /*!< Timer3 overflow pulse trigger \hideinitializer */
56 #define EADC_EPWM0TG0_TRIGGER               (8UL<<EADC_SCTL_TRGSEL_Pos)      /*!< EPWM0TG0 trigger \hideinitializer */
57 #define EADC_EPWM0TG1_TRIGGER               (9UL<<EADC_SCTL_TRGSEL_Pos)      /*!< EPWM0TG1 trigger \hideinitializer */
58 #define EADC_EPWM0TG2_TRIGGER               (0xAUL<<EADC_SCTL_TRGSEL_Pos)    /*!< EPWM0TG2 trigger \hideinitializer */
59 #define EADC_EPWM0TG3_TRIGGER               (0xBUL<<EADC_SCTL_TRGSEL_Pos)    /*!< EPWM0TG3 trigger \hideinitializer */
60 #define EADC_EPWM0TG4_TRIGGER               (0xCUL<<EADC_SCTL_TRGSEL_Pos)    /*!< EPWM0TG4 trigger \hideinitializer */
61 #define EADC_EPWM0TG5_TRIGGER               (0xDUL<<EADC_SCTL_TRGSEL_Pos)    /*!< EPWM0TG5 trigger \hideinitializer */
62 #define EADC_EPWM1TG0_TRIGGER               (0xEUL<<EADC_SCTL_TRGSEL_Pos)    /*!< EPWM1TG0 trigger \hideinitializer */
63 #define EADC_EPWM1TG1_TRIGGER               (0xFUL<<EADC_SCTL_TRGSEL_Pos)    /*!< EPWM1TG1 trigger \hideinitializer */
64 #define EADC_EPWM1TG2_TRIGGER               (0x10UL<<EADC_SCTL_TRGSEL_Pos)   /*!< EPWM1TG2 trigger \hideinitializer */
65 #define EADC_EPWM1TG3_TRIGGER               (0x11UL<<EADC_SCTL_TRGSEL_Pos)   /*!< EPWM1TG3 trigger \hideinitializer */
66 #define EADC_EPWM1TG4_TRIGGER               (0x12UL<<EADC_SCTL_TRGSEL_Pos)   /*!< EPWM1TG4 trigger \hideinitializer */
67 #define EADC_EPWM1TG5_TRIGGER               (0x13UL<<EADC_SCTL_TRGSEL_Pos)   /*!< EPWM1TG5 trigger \hideinitializer */
68 #define EADC_BPWM0TG_TRIGGER                (0x14UL<<EADC_SCTL_TRGSEL_Pos)   /*!< BPWM0TG trigger \hideinitializer */
69 #define EADC_BPWM1TG_TRIGGER                (0x15UL<<EADC_SCTL_TRGSEL_Pos)   /*!< BPWM1TG trigger \hideinitializer */
70 
71 #define EADC_SCTL_TRGDLYDIV_DIVIDER_1       (0UL<<EADC_SCTL_TRGDLYDIV_Pos)           /*!< Trigger delay clock frequency is ADC_CLK/1 \hideinitializer */
72 #define EADC_SCTL_TRGDLYDIV_DIVIDER_2       (0x1UL<<EADC_SCTL_TRGDLYDIV_Pos)       /*!< Trigger delay clock frequency is ADC_CLK/2 \hideinitializer */
73 #define EADC_SCTL_TRGDLYDIV_DIVIDER_4       (0x2UL<<EADC_SCTL_TRGDLYDIV_Pos)       /*!< Trigger delay clock frequency is ADC_CLK/4 \hideinitializer */
74 #define EADC_SCTL_TRGDLYDIV_DIVIDER_16      (0x3UL<<EADC_SCTL_TRGDLYDIV_Pos)       /*!< Trigger delay clock frequency is ADC_CLK/16 \hideinitializer */
75 
76 
77 /*---------------------------------------------------------------------------------------------------------*/
78 /* EADC_CMP Constant Definitions                                                                           */
79 /*---------------------------------------------------------------------------------------------------------*/
80 #define EADC_CMP_CMPCOND_LESS_THAN          (0UL<<EADC_CMP_CMPCOND_Pos)   /*!< The compare condition is "less than" \hideinitializer */
81 #define EADC_CMP_CMPCOND_GREATER_OR_EQUAL   (1UL<<EADC_CMP_CMPCOND_Pos)   /*!< The compare condition is "greater than or equal to" \hideinitializer */
82 #define EADC_CMP_CMPWEN_ENABLE              (EADC_CMP_CMPWEN_Msk)    /*!< Compare window mode enable \hideinitializer */
83 #define EADC_CMP_CMPWEN_DISABLE             (~EADC_CMP_CMPWEN_Msk)   /*!< Compare window mode disable \hideinitializer */
84 #define EADC_CMP_ADCMPIE_ENABLE             (EADC_CMP_ADCMPIE_Msk)   /*!< A/D result compare interrupt enable \hideinitializer */
85 #define EADC_CMP_ADCMPIE_DISABLE            (~EADC_CMP_ADCMPIE_Msk)  /*!< A/D result compare interrupt disable \hideinitializer */
86 
87 /*---------------------------------------------------------------------------------------------------------*/
88 /* EADC_MnCTL1 Constant Definitions                                                                        */
89 /*---------------------------------------------------------------------------------------------------------*/
90 #define EADC_MCTL1_ACU_1                    (0x0UL<<EADC_MCTL1_ACU_Pos)   /*!< Accumulated 1 time \hideinitializer */
91 #define EADC_MCTL1_ACU_2                    (0x1UL<<EADC_MCTL1_ACU_Pos)   /*!< Accumulated 2 times \hideinitializer */
92 #define EADC_MCTL1_ACU_4                    (0x2UL<<EADC_MCTL1_ACU_Pos)   /*!< Accumulated 4 times \hideinitializer */
93 #define EADC_MCTL1_ACU_8                    (0x3UL<<EADC_MCTL1_ACU_Pos)   /*!< Accumulated 8 times \hideinitializer */
94 #define EADC_MCTL1_ACU_16                   (0x4UL<<EADC_MCTL1_ACU_Pos)   /*!< Accumulated 16 times \hideinitializer */
95 #define EADC_MCTL1_ACU_32                   (0x5UL<<EADC_MCTL1_ACU_Pos)   /*!< Accumulated 32 times \hideinitializer */
96 #define EADC_MCTL1_ACU_64                   (0x6UL<<EADC_MCTL1_ACU_Pos)   /*!< Accumulated 64 times \hideinitializer */
97 #define EADC_MCTL1_ACU_128                  (0x7UL<<EADC_MCTL1_ACU_Pos)   /*!< Accumulated 128 times \hideinitializer */
98 #define EADC_MCTL1_ACU_256                  (0x8UL<<EADC_MCTL1_ACU_Pos)   /*!< Accumulated 256 times \hideinitializer */
99 
100 /*---------------------------------------------------------------------------------------------------------*/
101 /* EADC Define Error Code                                                                                  */
102 /*---------------------------------------------------------------------------------------------------------*/
103 #define EADC_TIMEOUT_ERR                    (-1)    /*!< EADC operation abort due to timeout error \hideinitializer */
104 #define EADC_CAL_ERR                        (-2)    /*!< EADC do calibration error \hideinitializer */
105 #define EADC_CLKDIV_ERR                     (-3)    /*!< EADC clock frequency is faster than PCLK error \hideinitializer */
106 
107 /*@}*/ /* end of group EADC_EXPORTED_CONSTANTS */
108 
109 /** @addtogroup EADC_EXPORTED_FUNCTIONS EADC Exported Functions
110   @{
111 */
112 /*---------------------------------------------------------------------------------------------------------*/
113 /*  EADC Macro Definitions                                                                                 */
114 /*---------------------------------------------------------------------------------------------------------*/
115 
116 /**
117   * @brief A/D Converter Control Circuits Reset.
118   * @param[in] eadc The pointer of the specified EADC module.
119   * @return None
120   * @details ADCRST bit (EADC_CTL[1]) remains 1 during EADC reset, when EADC reset end, the ADCRST bit is automatically cleared to 0.
121   * \hideinitializer
122   */
123 #define EADC_CONV_RESET(eadc) ((eadc)->CTL |= EADC_CTL_ADCRST_Msk)
124 
125 /**
126   * @brief Enable Sample Module PDMA transfer.
127   * @param[in] eadc The pointer of the specified EADC module.
128   * @param[in] u32ModuleMask the combination of sample module interrupt status bits. Each bit corresponds to a sample module interrupt status.
129   *                          This parameter decides which sample module interrupts will be disabled, valid range are between 1~0x7FFFF.
130   * @return None
131   * @details When A/D conversion is completed, the converted data is loaded into EADC_DATn (n: 0 ~ 18) register,
132   *         user can enable this bit to generate a PDMA data transfer request.
133   * \hideinitializer
134   */
135 #define EADC_ENABLE_SAMPLE_MODULE_PDMA(eadc, u32ModuleMask) ((eadc)->PDMACTL |= u32ModuleMask)
136 
137 /**
138   * @brief Disable Sample Module PDMA transfer.
139   * @param[in] eadc The pointer of the specified EADC module.
140   * @param[in] u32ModuleMask the combination of sample module interrupt status bits. Each bit corresponds to a sample module interrupt status.
141   *                          This parameter decides which sample module interrupts will be disabled, valid range are between 1~0x7FFFF.
142   * @return None
143   * @details This macro is used to disable sample module PDMA transfer.
144   * \hideinitializer
145   */
146 #define EADC_DISABLE_SAMPLE_MODULE_PDMA(eadc, u32ModuleMask) ((eadc)->PDMACTL &= (~u32ModuleMask))
147 
148 /**
149   * @brief Enable double buffer mode.
150   * @param[in] eadc The pointer of the specified EADC module.
151   * @param[in] u32ModuleNum Decides the sample module number, valid value are from 0 to 3.
152   * @return None
153   * @details The EADC controller supports a double buffer mode in sample module 0~3.
154   *         If user enable DBMEN (EADC_SCTLn[23], n=0~3), the double buffer mode will enable.
155   * \hideinitializer
156   */
157 #define EADC_ENABLE_DOUBLE_BUFFER(eadc, u32ModuleNum) ((eadc)->SCTL[(u32ModuleNum)] |= EADC_SCTL_DBMEN_Msk)
158 
159 /**
160   * @brief Disable double buffer mode.
161   * @param[in] eadc The pointer of the specified EADC module.
162   * @param[in] u32ModuleNum Decides the sample module number, valid value are from 0 to 3.
163   * @return None
164   * @details Sample has one sample result register.
165   * \hideinitializer
166   */
167 #define EADC_DISABLE_DOUBLE_BUFFER(eadc, u32ModuleNum) ((eadc)->SCTL[(u32ModuleNum)] &= ~EADC_SCTL_DBMEN_Msk)
168 
169 /**
170   * @brief Set ADIFn at A/D end of conversion.
171   * @param[in] eadc The pointer of the specified EADC module.
172   * @param[in] u32ModuleNum Decides the sample module number, valid value are from 0 to 15.
173   * @return None
174   * @details The A/D converter generates ADIFn (EADC_STATUS2[3:0], n=0~3) at the start of conversion.
175   * \hideinitializer
176   */
177 #define EADC_ENABLE_INT_POSITION(eadc, u32ModuleNum) ((eadc)->SCTL[(u32ModuleNum)] |= EADC_SCTL_INTPOS_Msk)
178 
179 /**
180   * @brief Set ADIFn at A/D start of conversion.
181   * @param[in] eadc The pointer of the specified EADC module.
182   * @param[in] u32ModuleNum Decides the sample module number, valid value are from 0 to 15.
183   * @return None
184   * @details The A/D converter generates ADIFn (EADC_STATUS2[3:0], n=0~3) at the end of conversion.
185   * \hideinitializer
186   */
187 #define EADC_DISABLE_INT_POSITION(eadc, u32ModuleNum) ((eadc)->SCTL[(u32ModuleNum)] &= ~EADC_SCTL_INTPOS_Msk)
188 
189 /**
190   * @brief Enable the interrupt.
191   * @param[in] eadc The pointer of the specified EADC module.
192   * @param[in] u32Mask Decides the combination of interrupt status bits. Each bit corresponds to a interrupt status.
193   *                    This parameter decides which interrupts will be enabled. Bit 0 is ADCIEN0, bit 1 is ADCIEN1..., bit 3 is ADCIEN3.
194   * @return None
195   * @details The A/D converter generates a conversion end ADIFn (EADC_STATUS2[n]) upon the end of specific sample module A/D conversion.
196   *         If ADCIENn bit (EADC_CTL[n+2]) is set then conversion end interrupt request ADINTn is generated (n=0~3).
197   * \hideinitializer
198   */
199 #define EADC_ENABLE_INT(eadc, u32Mask) ((eadc)->CTL |= ((u32Mask) << EADC_CTL_ADCIEN0_Pos))
200 
201 /**
202   * @brief Disable the interrupt.
203   * @param[in] eadc The pointer of the specified EADC module.
204   * @param[in] u32Mask Decides the combination of interrupt status bits. Each bit corresponds to a interrupt status.
205   *                    This parameter decides which interrupts will be disabled. Bit 0 is ADCIEN0, bit 1 is ADCIEN1..., bit 3 is ADCIEN3.
206   * @return None
207   * @details Specific sample module A/D ADINT0 interrupt function Disabled.
208   * \hideinitializer
209   */
210 #define EADC_DISABLE_INT(eadc, u32Mask) ((eadc)->CTL &= ~((u32Mask) << EADC_CTL_ADCIEN0_Pos))
211 
212 /**
213   * @brief Enable the sample module interrupt.
214   * @param[in] eadc The pointer of the specified EADC module.
215   * @param[in] u32IntSel Decides which interrupt source will be used, valid value are from 0 to 3.
216   * @param[in] u32ModuleMask the combination of sample module interrupt status bits. Each bit corresponds to a sample module interrupt status.
217   *                          This parameter decides which sample module interrupts will be enabled, valid range are between 1~0x7FFFF.
218   * @return None
219   * @details There are 4 EADC interrupts ADINT0~3, and each of these interrupts has its own interrupt vector address.
220   * \hideinitializer
221   */
222 #define EADC_ENABLE_SAMPLE_MODULE_INT(eadc, u32IntSel, u32ModuleMask) ((eadc)->INTSRC[(u32IntSel)] |= (u32ModuleMask))
223 
224 /**
225   * @brief Disable the sample module interrupt.
226   * @param[in] eadc The pointer of the specified EADC module.
227   * @param[in] u32IntSel Decides which interrupt source will be used, valid value are from 0 to 3.
228   * @param[in] u32ModuleMask the combination of sample module interrupt status bits. Each bit corresponds to a sample module interrupt status.
229   *                          This parameter decides which sample module interrupts will be disabled, valid range are between 1~0x7FFFF.
230   * @return None
231   * @details There are 4 EADC interrupts ADINT0~3, and each of these interrupts has its own interrupt vector address.
232   * \hideinitializer
233   */
234 #define EADC_DISABLE_SAMPLE_MODULE_INT(eadc, u32IntSel, u32ModuleMask) ((eadc)->INTSRC[(u32IntSel)] &= (uint32_t)(~(u32ModuleMask)))
235 
236 /**
237   * @brief Set the input mode output format.
238   * @param[in] eadc The pointer of the specified EADC module.
239   * @param[in] u32Format Decides the output format. Valid values are:
240   *                       - \ref EADC_CTL_DMOF_STRAIGHT_BINARY      :Select the straight binary format as the output format of the conversion result.
241   *                       - \ref EADC_CTL_DMOF_TWOS_COMPLEMENT      :Select the 2's complement format as the output format of the conversion result.
242   * @return None
243   * @details The macro is used to set A/D input mode output format.
244   * \hideinitializer
245   */
246 #define EADC_SET_DMOF(eadc, u32Format) ((eadc)->CTL = ((eadc)->CTL & ~EADC_CTL_DMOF_Msk) | (u32Format))
247 
248 /**
249   * @brief Start the A/D conversion.
250   * @param[in] eadc The pointer of the specified EADC module.
251   * @param[in] u32ModuleMask The combination of sample module. Each bit corresponds to a sample module.
252   *                         This parameter decides which sample module will be conversion, valid range are between 1~0x7FFFF.
253   *                         Bit 0 is sample module 0, bit 1 is sample module 1..., bit 18 is sample module 18.
254   * @return None
255   * @details After write EADC_SWTRG register to start EADC conversion, the EADC_PENDSTS register will show which SAMPLE will conversion.
256   * \hideinitializer
257   */
258 #define EADC_START_CONV(eadc, u32ModuleMask) ((eadc)->SWTRG = (u32ModuleMask))
259 
260 /**
261   * @brief Cancel the conversion for sample module.
262   * @param[in] eadc The pointer of the specified EADC module.
263   * @param[in] u32ModuleMask The combination of sample module. Each bit corresponds to a sample module.
264   *                         This parameter decides which sample module will stop the conversion, valid range are between 1~0x7FFFF.
265   *                         Bit 0 is sample module 0, bit 1 is sample module 1..., bit 18 is sample module18.
266   * @return None
267   * @details If user want to disable the conversion of the sample module, user can write EADC_PENDSTS register to clear it.
268   * \hideinitializer
269   */
270 #define EADC_STOP_CONV(eadc, u32ModuleMask) ((eadc)->PENDSTS = (u32ModuleMask))
271 
272 /**
273   * @brief Get the conversion pending flag.
274   * @param[in] eadc The pointer of the specified EADC module.
275   * @return Return the conversion pending sample module.
276   * @details This STPFn(EADC_PENDSTS[18:0]) bit remains 1 during pending state, when the respective ADC conversion is end,
277   *         the STPFn (n=0~18) bit is automatically cleared to 0.
278   * \hideinitializer
279   */
280 #define EADC_GET_PENDING_CONV(eadc) ((eadc)->PENDSTS)
281 
282 /**
283   * @brief Get the conversion data of the user-specified sample module.
284   * @param[in] eadc The pointer of the specified EADC module.
285   * @param[in] u32ModuleNum Decides the sample module number, valid value are from 0 to 18.
286   * @return Return the conversion data of the user-specified sample module.
287   * @details This macro is used to read RESULT bit (EADC_DATn[15:0], n=0~18) field to get conversion data.
288   * \hideinitializer
289   */
290 #define EADC_GET_CONV_DATA(eadc, u32ModuleNum) ((eadc)->DAT[(u32ModuleNum)] & EADC_DAT_RESULT_Msk)
291 
292 /**
293   * @brief Get the data overrun flag of the user-specified sample module.
294   * @param[in] eadc The pointer of the specified EADC module.
295   * @param[in] u32ModuleMask The combination of data overrun status bits. Each bit corresponds to a data overrun status, valid range are between 1~0x7FFFF.
296   * @return Return the data overrun flag of the user-specified sample module.
297   * @details This macro is used to read OV bit (EADC_STATUS0[31:16], EADC_STATUS1[18:16]) field to get data overrun status.
298   * \hideinitializer
299   */
300 #define EADC_GET_DATA_OVERRUN_FLAG(eadc, u32ModuleMask) ((((eadc)->STATUS0 >> EADC_STATUS0_OV_Pos) | ((eadc)->STATUS1 & EADC_STATUS1_OV_Msk)) & (u32ModuleMask))
301 
302 /**
303   * @brief Get the data valid flag of the user-specified sample module.
304   * @param[in] eadc The pointer of the specified EADC module.
305   * @param[in] u32ModuleMask The combination of data valid status bits. Each bit corresponds to a data valid status, valid range are between 1~0x7FFFF.
306   * @return Return the data valid flag of the user-specified sample module.
307   * @details This macro is used to read VALID bit (EADC_STATUS0[15:0], EADC_STATUS1[2:0]) field to get data valid status.
308   * \hideinitializer
309   */
310 #define EADC_GET_DATA_VALID_FLAG(eadc, u32ModuleMask) ((((eadc)->STATUS0 & EADC_STATUS0_VALID_Msk) | (((eadc)->STATUS1 & EADC_STATUS1_VALID_Msk) << 16)) & (u32ModuleMask))
311 
312 /**
313   * @brief Get the double data of the user-specified sample module.
314   * @param[in] eadc The pointer of the specified EADC module.
315   * @param[in] u32ModuleNum Decides the sample module number, valid value are from 0 to 18.
316   * @return Return the double data of the user-specified sample module.
317   * @details This macro is used to read RESULT bit (EADC_DDATn[15:0], n=0~3) field to get conversion data.
318   * \hideinitializer
319   */
320 #define EADC_GET_DOUBLE_DATA(eadc, u32ModuleNum) ((eadc)->DDAT[(u32ModuleNum)] & EADC_DDAT0_RESULT_Msk)
321 
322 /**
323   * @brief Get the user-specified interrupt flags.
324   * @param[in] eadc The pointer of the specified EADC module.
325   * @param[in] u32Mask The combination of interrupt status bits. Each bit corresponds to a interrupt status.
326   *                    Bit 0 is ADIF0, bit 1 is ADIF1..., bit 3 is ADIF3.
327   *                    Bit 4 is ADCMPF0, bit 5 is ADCMPF1..., bit 7 is ADCMPF3.
328   * @return Return the user-specified interrupt flags.
329   * @details This macro is used to get the user-specified interrupt flags.
330   * \hideinitializer
331   */
332 #define EADC_GET_INT_FLAG(eadc, u32Mask) ((eadc)->STATUS2 & (u32Mask))
333 
334 /**
335   * @brief Get the user-specified sample module overrun flags.
336   * @param[in] eadc The pointer of the specified EADC module.
337   * @param[in] u32ModuleMask The combination of sample module overrun status bits. Each bit corresponds to a sample module overrun status, valid range are between 1~0x7FFFF.
338   * @return Return the user-specified sample module overrun flags.
339   * @details This macro is used to get the user-specified sample module overrun flags.
340   * \hideinitializer
341   */
342 #define EADC_GET_SAMPLE_MODULE_OV_FLAG(eadc, u32ModuleMask) ((eadc)->OVSTS & (u32ModuleMask))
343 
344 /**
345   * @brief Clear the selected interrupt status bits.
346   * @param[in] eadc The pointer of the specified EADC module.
347   * @param[in] u32Mask The combination of compare interrupt status bits. Each bit corresponds to a compare interrupt status.
348   *                    Bit 0 is ADIF0, bit 1 is ADIF1..., bit 3 is ADIF3.
349   *                    Bit 4 is ADCMPF0, bit 5 is ADCMPF1..., bit 7 is ADCMPF3.
350   * @return None
351   * @details This macro is used to clear clear the selected interrupt status bits.
352   * \hideinitializer
353   */
354 #define EADC_CLR_INT_FLAG(eadc, u32Mask) ((eadc)->STATUS2 = (u32Mask))
355 
356 /**
357   * @brief Clear the selected sample module overrun status bits.
358   * @param[in] eadc The pointer of the specified EADC module.
359   * @param[in] u32ModuleMask The combination of sample module overrun status bits. Each bit corresponds to a sample module overrun status.
360   *                      Bit 0 is SPOVF0, bit 1 is SPOVF1..., bit 18 is SPOVF18.
361   * @return None
362   * @details This macro is used to clear the selected sample module overrun status bits.
363   * \hideinitializer
364   */
365 #define EADC_CLR_SAMPLE_MODULE_OV_FLAG(eadc, u32ModuleMask) ((eadc)->OVSTS = (u32ModuleMask))
366 
367 /**
368   * @brief Check all sample module A/D result data register overrun flags.
369   * @param[in] eadc The pointer of the specified EADC module.
370   * @retval 0 None of sample module data register overrun flag is set to 1.
371   * @retval 1 Any one of sample module data register overrun flag is set to 1.
372   * @details The AOV bit (EADC_STATUS2[27]) will keep 1 when any one of sample module data register overrun flag OVn (EADC_DATn[16]) is set to 1.
373   * \hideinitializer
374   */
375 #define EADC_IS_DATA_OV(eadc) (((eadc)->STATUS2 & EADC_STATUS2_AOV_Msk) >> EADC_STATUS2_AOV_Pos)
376 
377 /**
378   * @brief Check all sample module A/D result data register valid flags.
379   * @param[in] eadc The pointer of the specified EADC module.
380   * @retval 0 None of sample module data register valid flag is set to 1.
381   * @retval 1 Any one of sample module data register valid flag is set to 1.
382   * @details The AVALID bit (EADC_STATUS2[26]) will keep 1 when any one of sample module data register valid flag VALIDn (EADC_DATn[17]) is set to 1.
383   * \hideinitializer
384   */
385 #define EADC_IS_DATA_VALID(eadc) (((eadc)->STATUS2 & EADC_STATUS2_AVALID_Msk) >> EADC_STATUS2_AVALID_Pos)
386 
387 /**
388   * @brief Check all A/D sample module start of conversion overrun flags.
389   * @param[in] eadc The pointer of the specified EADC module.
390   * @retval 0 None of sample module event overrun flag is set to 1.
391   * @retval 1 Any one of sample module event overrun flag is set to 1.
392   * @details The STOVF bit (EADC_STATUS2[25]) will keep 1 when any one of sample module event overrun flag SPOVFn (EADC_OVSTS[n]) is set to 1.
393   * \hideinitializer
394   */
395 #define EADC_IS_SAMPLE_MODULE_OV(eadc) (((eadc)->STATUS2 & EADC_STATUS2_STOVF_Msk) >> EADC_STATUS2_STOVF_Pos)
396 
397 /**
398   * @brief Check all A/D interrupt flag overrun bits.
399   * @param[in] eadc The pointer of the specified EADC module.
400   * @retval 0 None of ADINT interrupt flag is overwritten to 1.
401   * @retval 1 Any one of ADINT interrupt flag is overwritten to 1.
402   * @details The ADOVIF bit (EADC_STATUS2[24]) will keep 1 when any one of ADINT interrupt flag ADOVIFn (EADC_STATUS2[11:8]) is overwritten to 1.
403   * \hideinitializer
404   */
405 #define EADC_IS_INT_FLAG_OV(eadc) (((eadc)->STATUS2 & EADC_STATUS2_ADOVIF_Msk) >> EADC_STATUS2_ADOVIF_Pos)
406 
407 /**
408   * @brief Get the busy state of EADC.
409   * @param[in] eadc The pointer of the specified EADC module.
410   * @retval 0 Idle state.
411   * @retval 1 Busy state.
412   * @details This macro is used to read BUSY bit (EADC_STATUS2[23]) to get busy state.
413   * \hideinitializer
414   */
415 #define EADC_IS_BUSY(eadc) (((eadc)->STATUS2 & EADC_STATUS2_BUSY_Msk) >> EADC_STATUS2_BUSY_Pos)
416 
417 /**
418   * @brief Configure the comparator 0 and enable it.
419   * @param[in] eadc The pointer of the specified EADC module.
420   * @param[in] u32ModuleNum specifies the compare sample module, valid value are from 0 to 18.
421   * @param[in] u32Condition specifies the compare condition. Valid values are:
422   *                        - \ref EADC_CMP_CMPCOND_LESS_THAN            :The compare condition is "less than the compare value"
423   *                        - \ref EADC_CMP_CMPCOND_GREATER_OR_EQUAL     :The compare condition is "greater than or equal to the compare value
424   * @param[in] u16CMPData specifies the compare value, valid range are between 0~0xFFF.
425   * @param[in] u32MatchCount specifies the match count setting, valid range are between 0~0xF.
426   * @return None
427   * @details For example, ADC_ENABLE_CMP0(EADC, 5, ADC_ADCMPR_CMPCOND_GREATER_OR_EQUAL, 0x800, 10, EADC_CMP_CMPWEN_DISABLE, EADC_CMP_ADCMPIE_ENABLE);
428   *         Means EADC will assert comparator 0 flag if sample module 5 conversion result is greater or
429   *         equal to 0x800 for 10 times continuously, and a compare interrupt request is generated.
430   * \hideinitializer
431   */
432 #define EADC_ENABLE_CMP0(eadc,\
433                          u32ModuleNum,\
434                          u32Condition,\
435                          u16CMPData,\
436                          u32MatchCount) ((eadc)->CMP[0] = (((eadc)->CMP[0] & ~(EADC_CMP_CMPSPL_Msk|EADC_CMP_CMPCOND_Msk|EADC_CMP_CMPDAT_Msk|EADC_CMP_CMPMCNT_Msk))|\
437                                                             (((u32ModuleNum) << EADC_CMP_CMPSPL_Pos)|\
438                                                             (u32Condition) |\
439                                                             ((u16CMPData) << EADC_CMP_CMPDAT_Pos)| \
440                                                             (((u32MatchCount) - 1) << EADC_CMP_CMPMCNT_Pos)|\
441                                                             EADC_CMP_ADCMPEN_Msk)))
442 
443 /**
444   * @brief Configure the comparator 1 and enable it.
445   * @param[in] eadc The pointer of the specified EADC module.
446   * @param[in] u32ModuleNum specifies the compare sample module, valid value are from 0 to 18.
447   * @param[in] u32Condition specifies the compare condition. Valid values are:
448   *                        - \ref EADC_CMP_CMPCOND_LESS_THAN            :The compare condition is "less than the compare value"
449   *                        - \ref EADC_CMP_CMPCOND_GREATER_OR_EQUAL     :The compare condition is "greater than or equal to the compare value
450   * @param[in] u16CMPData specifies the compare value, valid range are between 0~0xFFF.
451   * @param[in] u32MatchCount specifies the match count setting, valid range are between 0~0xF.
452   * @return None
453   * @details For example, ADC_ENABLE_CMP1(EADC, 5, ADC_ADCMPR_CMPCOND_GREATER_OR_EQUAL, 0x800, 10, EADC_CMP_ADCMPIE_ENABLE);
454   *         Means EADC will assert comparator 1 flag if sample module 5 conversion result is greater or
455   *         equal to 0x800 for 10 times continuously, and a compare interrupt request is generated.
456   * \hideinitializer
457   */
458 #define EADC_ENABLE_CMP1(eadc,\
459                          u32ModuleNum,\
460                          u32Condition,\
461                          u16CMPData,\
462                          u32MatchCount) ((eadc)->CMP[1] = (((eadc)->CMP[1] & ~(EADC_CMP_CMPSPL_Msk|EADC_CMP_CMPCOND_Msk|EADC_CMP_CMPDAT_Msk|EADC_CMP_CMPMCNT_Msk))|\
463                                                             (((u32ModuleNum) << EADC_CMP_CMPSPL_Pos)|\
464                                                             (u32Condition) |\
465                                                             ((u16CMPData) << EADC_CMP_CMPDAT_Pos)| \
466                                                             (((u32MatchCount) - 1) << EADC_CMP_CMPMCNT_Pos)|\
467                                                             EADC_CMP_ADCMPEN_Msk)))
468 
469 /**
470   * @brief Configure the comparator 2 and enable it.
471   * @param[in] eadc The pointer of the specified EADC module.
472   * @param[in] u32ModuleNum specifies the compare sample module, valid value are from 0 to 18.
473   * @param[in] u32Condition specifies the compare condition. Valid values are:
474   *                        - \ref EADC_CMP_CMPCOND_LESS_THAN            :The compare condition is "less than the compare value"
475   *                        - \ref EADC_CMP_CMPCOND_GREATER_OR_EQUAL     :The compare condition is "greater than or equal to the compare value
476   * @param[in] u16CMPData specifies the compare value, valid range are between 0~0xFFF.
477   * @param[in] u32MatchCount specifies the match count setting, valid range are between 0~0xF.
478   * @return None
479   * @details For example, ADC_ENABLE_CMP2(EADC, 5, ADC_ADCMPR_CMPCOND_GREATER_OR_EQUAL, 0x800, 10, EADC_CMP_CMPWEN_DISABLE, EADC_CMP_ADCMPIE_ENABLE);
480   *         Means EADC will assert comparator 2 flag if sample module 5 conversion result is greater or
481   *         equal to 0x800 for 10 times continuously, and a compare interrupt request is generated.
482   * \hideinitializer
483   */
484 #define EADC_ENABLE_CMP2(eadc,\
485                          u32ModuleNum,\
486                          u32Condition,\
487                          u16CMPData,\
488                          u32MatchCount) ((eadc)->CMP[2] = (((eadc)->CMP[2] & ~(EADC_CMP_CMPSPL_Msk|EADC_CMP_CMPCOND_Msk|EADC_CMP_CMPDAT_Msk|EADC_CMP_CMPMCNT_Msk))|\
489                                                             (((u32ModuleNum) << EADC_CMP_CMPSPL_Pos)|\
490                                                             (u32Condition) |\
491                                                             ((u16CMPData) << EADC_CMP_CMPDAT_Pos)| \
492                                                             (((u32MatchCount) - 1) << EADC_CMP_CMPMCNT_Pos)|\
493                                                             EADC_CMP_ADCMPEN_Msk)))
494 
495 /**
496   * @brief Configure the comparator 3 and enable it.
497   * @param[in] eadc The pointer of the specified EADC module.
498   * @param[in] u32ModuleNum specifies the compare sample module, valid value are from 0 to 18.
499   * @param[in] u32Condition specifies the compare condition. Valid values are:
500   *                        - \ref EADC_CMP_CMPCOND_LESS_THAN            :The compare condition is "less than the compare value"
501   *                        - \ref EADC_CMP_CMPCOND_GREATER_OR_EQUAL     :The compare condition is "greater than or equal to the compare value
502   * @param[in] u16CMPData specifies the compare value, valid range are between 0~0xFFF.
503   * @param[in] u32MatchCount specifies the match count setting, valid range are between 1~0xF.
504   * @return None
505   * @details For example, ADC_ENABLE_CMP3(EADC, 5, ADC_ADCMPR_CMPCOND_GREATER_OR_EQUAL, 0x800, 10, EADC_CMP_ADCMPIE_ENABLE);
506   *         Means EADC will assert comparator 3 flag if sample module 5 conversion result is greater or
507   *         equal to 0x800 for 10 times continuously, and a compare interrupt request is generated.
508   * \hideinitializer
509   */
510 #define EADC_ENABLE_CMP3(eadc,\
511                          u32ModuleNum,\
512                          u32Condition,\
513                          u16CMPData,\
514                          u32MatchCount) ((eadc)->CMP[3] = (((eadc)->CMP[3] & ~(EADC_CMP_CMPSPL_Msk|EADC_CMP_CMPCOND_Msk|EADC_CMP_CMPDAT_Msk|EADC_CMP_CMPMCNT_Msk))|\
515                                                             (((u32ModuleNum) << EADC_CMP_CMPSPL_Pos)|\
516                                                             (u32Condition) |\
517                                                             ((u16CMPData) << EADC_CMP_CMPDAT_Pos)| \
518                                                             (((u32MatchCount) - 1) << EADC_CMP_CMPMCNT_Pos)|\
519                                                             EADC_CMP_ADCMPEN_Msk)))
520 
521 /**
522   * @brief Enable the compare window mode.
523   * @param[in] eadc The pointer of the specified EADC module.
524   * @param[in] u32CMP Specifies the compare register, valid value are 0 and 2.
525   * @return None
526   * @details ADCMPF0 (EADC_STATUS2[4]) will be set when both EADC_CMP0 and EADC_CMP1 compared condition matched.
527   * \hideinitializer
528   */
529 #define EADC_ENABLE_CMP_WINDOW_MODE(eadc, u32CMP) ((eadc)->CMP[(u32CMP)] |= EADC_CMP_CMPWEN_Msk)
530 
531 /**
532   * @brief Disable the compare window mode.
533   * @param[in] eadc The pointer of the specified EADC module.
534   * @param[in] u32CMP Specifies the compare register, valid value are 0 and 2.
535   * @return None
536   * @details ADCMPF2 (EADC_STATUS2[6]) will be set when both EADC_CMP2 and EADC_CMP3 compared condition matched.
537   * \hideinitializer
538   */
539 #define EADC_DISABLE_CMP_WINDOW_MODE(eadc, u32CMP) ((eadc)->CMP[(u32CMP)] &= ~EADC_CMP_CMPWEN_Msk)
540 
541 /**
542   * @brief Enable the compare interrupt.
543   * @param[in] eadc The pointer of the specified EADC module.
544   * @param[in] u32CMP Specifies the compare register, valid value are from 0 to 3.
545   * @return None
546   * @details If the compare function is enabled and the compare condition matches the setting of CMPCOND (EADC_CMPn[2], n=0~3)
547   *         and CMPMCNT (EADC_CMPn[11:8], n=0~3), ADCMPFn (EADC_STATUS2[7:4], n=0~3) will be asserted, in the meanwhile,
548   *         if ADCMPIE is set to 1, a compare interrupt request is generated.
549   * \hideinitializer
550   */
551 #define EADC_ENABLE_CMP_INT(eadc, u32CMP) ((eadc)->CMP[(u32CMP)] |= EADC_CMP_ADCMPIE_Msk)
552 
553 /**
554   * @brief Disable the compare interrupt.
555   * @param[in] eadc The pointer of the specified EADC module.
556   * @param[in] u32CMP Specifies the compare register, valid value are from 0 to 3.
557   * @return None
558   * @details This macro is used to disable the compare interrupt.
559   * \hideinitializer
560   */
561 #define EADC_DISABLE_CMP_INT(eadc, u32CMP) ((eadc)->CMP[(u32CMP)] &= ~EADC_CMP_ADCMPIE_Msk)
562 
563 /**
564   * @brief Disable comparator 0.
565   * @param[in] eadc The pointer of the specified EADC module.
566   * @return None
567   * @details This macro is used to disable comparator 0.
568   * \hideinitializer
569   */
570 #define EADC_DISABLE_CMP0(eadc) ((eadc)->CMP[0] = 0UL)
571 
572 /**
573   * @brief Disable comparator 1.
574   * @param[in] eadc The pointer of the specified EADC module.
575   * @return None
576   * @details This macro is used to disable comparator 1.
577   * \hideinitializer
578   */
579 #define EADC_DISABLE_CMP1(eadc) ((eadc)->CMP[1] = 0UL)
580 
581 /**
582   * @brief Disable comparator 2.
583   * @param[in] eadc The pointer of the specified EADC module.
584   * @return None
585   * @details This macro is used to disable comparator 2.
586   * \hideinitializer
587   */
588 #define EADC_DISABLE_CMP2(eadc) ((eadc)->CMP[2] = 0UL)
589 
590 /**
591   * @brief Disable comparator 3.
592   * @param[in] eadc The pointer of the specified EADC module.
593   * @return None
594   * @details This macro is used to disable comparator 3.
595   * \hideinitializer
596   */
597 #define EADC_DISABLE_CMP3(eadc) ((eadc)->CMP[3] = 0UL)
598 
599 /**
600   * @brief Enable conversion result left alignment.
601   * @param[in] eadc The pointer of the specified EADC module.
602   * @param[in] u32ModuleNum Decides the sample module number, valid value are from 0 to 23.
603   * @return None
604   * @details The 12-bit conversion result will be left aligned and stored in EADC_DATn[15:4] (n=0~23).
605   * \hideinitializer
606   */
607 #define EADC_ENABLE_LEFT_ALIGN(eadc, u32ModuleNum) ((((eadc)->MCTL1[(u32ModuleNum)])) |= EADC_MCTL1_ALIGN_Msk)
608 
609 /**
610   * @brief Disable conversion result left alignment.
611   * @param[in] eadc The pointer of the specified EADC module.
612   * @param[in] u32ModuleNum Decides the sample module number, valid value are from 0 to 23.
613   * @return None
614   * @details The 12-bit conversion result will be right aligned and stored in EADC_DATn[11:0] (n=0~23).
615   * \hideinitializer
616   */
617 #define EADC_DISABLE_LEFT_ALIGN(eadc, u32ModuleNum) ((((eadc)->MCTL1[(u32ModuleNum)])) &= (~EADC_MCTL1_ALIGN_Msk))
618 
619 /**
620   * @brief Enable average mode.
621   * @param[in] eadc The pointer of the specified EADC module.
622   * @param[in] u32ModuleNum Decides the sample module number, valid value are from 0 to 23.
623   * @return None
624   * @details Conversion results in data register will be averaged.
625   * @note This average mode needs to work with accumulated mode that configured by ACU (EADC_MnCTL1[7:4], n=0~23) bit field.
626   * \hideinitializer
627   */
628 #define EADC_ENABLE_AVG(eadc, u32ModuleNum) ((((eadc)->MCTL1[(u32ModuleNum)])) |= EADC_MCTL1_AVG_Msk)
629 
630 /**
631   * @brief Disable average mode.
632   * @param[in] eadc The pointer of the specified EADC module.
633   * @param[in] u32ModuleNum Decides the sample module number, valid value are from 0 to 23.
634   * @return None
635   * @details Conversion results in data register will not be averaged.
636   * \hideinitializer
637   */
638 #define EADC_DISABLE_AVG(eadc, u32ModuleNum) ((((eadc)->MCTL1[(u32ModuleNum)])) &= (~EADC_MCTL1_AVG_Msk))
639 
640 /**
641   * @brief Configure the Accumulation feature and enable it.
642   * @param[in] eadc The pointer of the specified EADC module.
643   * @param[in] u32ModuleNum Decides the sample module number, valid value are from 0 to 23.
644   * @param[in] u16ACUNum specifies the number of accumulation, valid values are
645   *                        - \ref EADC_MCTL1_ACU_1   : 1 conversion result will be accumulated.
646   *                        - \ref EADC_MCTL1_ACU_2   : 2 conversion result will be accumulated.
647   *                        - \ref EADC_MCTL1_ACU_4   : 4 conversion result will be accumulated.
648   *                        - \ref EADC_MCTL1_ACU_8   : 8 conversion result will be accumulated.
649   *                        - \ref EADC_MCTL1_ACU_16  : 16 conversion result will be accumulated.
650   *                        - \ref EADC_MCTL1_ACU_32  : 32 conversion result will be accumulated. The result is right shift 1 bit to fit within the available 16-bit register size.
651   *                        - \ref EADC_MCTL1_ACU_64  : 64 conversion result will be accumulated. The result is right shift 2 bits to fit within the available 16-bit register size.
652   *                        - \ref EADC_MCTL1_ACU_128 : 128 conversion result will be accumulated. The result is right shift 3 bits to fit within the available 16-bit register size.
653   *                        - \ref EADC_MCTL1_ACU_256 : 256 conversion result will be accumulated. The result is right shift 4 bits to fit within the available 16-bit register size.
654   * @return None
655   * @details When accumulating more than 16 samples, the result will be too large to match the
656   *         16-bit RESULT register size (EADC_DATn[15:0]. To avoid overflow, the result is
657   *         right shifted automatically to fit within the available 16-bit register size.
658   *         The number of automatic right shifts is specified in parameter list above.
659   * \hideinitializer
660   */
661 #define EADC_ENABLE_ACU(eadc,\
662                         u32ModuleNum,\
663                         u16ACUNum) ((((eadc)->MCTL1[(u32ModuleNum)])) = (((((eadc)->MCTL1[(u32ModuleNum)])) & (~EADC_MCTL1_ACU_Msk)) |\
664                                                                          (u16ACUNum)))
665 
666 /**
667   * @brief Disable the Accumulation feature.
668   * @param[in] eadc The pointer of the specified EADC module.
669   * @param[in] u32ModuleNum Decides the sample module number, valid value are from 0 to 23.
670   * @return None
671   * \hideinitializer
672   */
673 #define EADC_DISABLE_ACU(eadc, u32ModuleNum) ((((eadc)->MCTL1[(u32ModuleNum)])) &= (~EADC_MCTL1_ACU_Msk))
674 
675 /**
676   * @brief Set start of conversion interrupt delay cycle.
677   * @param[in] eadc The pointer of the specified EADC module.
678   * @param[in] u32IntSel Decides which interrupt source will be used, valid value are from 0 to 3.
679   * @param[in] u32DelayCycle Decides the interrupt delay cycle, valid value are from 0 to 15.
680   * @return None
681   * @details Select EADC start of conversion interrupt ADINT0 to ADINT3 delay cycle(s).
682   * @note This function is workable only when any one of INTPOS (EADC_SCTLx[5]), x=0~15 is set.
683   * \hideinitializer
684   */
685 #define EADC_SET_INT_DELAY(eadc, u32IntSel, u32DelayCycle) ((eadc)->CTL = ((eadc)->CTL & ~(0xFUL << (EADC_CTL_INTDELAY0_Pos + ((u32IntSel) << 2)))) | \
686                                                                           ((u32DelayCycle) << (EADC_CTL_INTDELAY0_Pos + ((u32IntSel) << 2))))
687 
688 /**
689   * @brief Enable comparetor to trigger EPWM brake.
690   * @param[in] eadc The pointer of the specified EADC module.
691   * @param[in] u32CmpSel Decides which comparator will be used, valid value are from 0 to 3.
692   * @return None
693   * @details Enable EADC comparator 0 to 3 can trigger EPWM brake.
694   * \hideinitializer
695   */
696 #define EADC_ENABLE_CMP_TRIGGER_BRAKE(eadc, u32CmpSel) ((eadc)->CTL1 |= (1UL << (EADC_CTL1_CMP0TRG_Pos + (u32CmpSel))))
697 
698 /**
699   * @brief Disable comparetor to trigger EPWM brake.
700   * @param[in] eadc The pointer of the specified EADC module.
701   * @param[in] u32CmpSel Decides which comparator will be disabled, valid value are from 0 to 3.
702   * @return None
703   * @details Disable EADC comparator 0 to 3 trigger EPWM brake.
704   * \hideinitializer
705   */
706 #define EADC_DISABLE_CMP_TRIGGER_BRAKE(eadc, u32CmpSel) ((eadc)->CTL1 &= (~(1UL << (EADC_CTL1_CMP0TRG_Pos + (u32CmpSel)))))
707 
708 
709 /*---------------------------------------------------------------------------------------------------------*/
710 /* Define EADC functions prototype                                                                         */
711 /*---------------------------------------------------------------------------------------------------------*/
712 int32_t EADC_Open(EADC_T *eadc, uint32_t u32InputMode);
713 void EADC_Close(EADC_T *eadc);
714 void EADC_ConfigSampleModule(EADC_T *eadc, uint32_t u32ModuleNum, uint32_t u32TriggerSrc, uint32_t u32Channel);
715 void EADC_SetTriggerDelayTime(EADC_T *eadc, uint32_t u32ModuleNum, uint32_t u32TriggerDelayTime, uint32_t u32DelayClockDivider);
716 void EADC_SetExtendSampleTime(EADC_T *eadc, uint32_t u32ModuleNum, uint32_t u32ExtendSampleTime);
717 
718 /*@}*/ /* end of group EADC_EXPORTED_FUNCTIONS */
719 
720 /*@}*/ /* end of group EADC_Driver */
721 
722 /*@}*/ /* end of group Standard_Driver */
723 
724 #ifdef __cplusplus
725 }
726 #endif
727 
728 #endif /* __EADC_H__ */
729