rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
fsl_acmp.c
Go to the documentation of this file.
1/*
2 * Copyright (c) 2015, Freescale Semiconductor, Inc.
3 * Copyright 2016-2017 NXP
4 * All rights reserved.
5 *
6 * SPDX-License-Identifier: BSD-3-Clause
7 */
8
9#include "hal.h"
10#include "fsl_acmp.h"
11
12/*******************************************************************************
13 * Definitions
14 ******************************************************************************/
15
16/* Component ID definition, used by tools. */
17#ifndef FSL_COMPONENT_ID
18#define FSL_COMPONENT_ID "platform.drivers.acmp"
19#endif
20
21/*******************************************************************************
22 * Prototypes
23 ******************************************************************************/
24/*!
25 * @brief Get the ACMP instance from the peripheral base address.
26 *
27 * @param base ACMP peripheral base address.
28 * @return ACMP instance.
29 */
30static uint32_t ACMP_GetInstance(CMP_Type *base);
31
32/*******************************************************************************
33 * Variables
34 ******************************************************************************/
35/* Array of ACMP peripheral base address. */
36static CMP_Type *const s_acmpBases[] = CMP_BASE_PTRS;
37#if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)
38/* Clock name of ACMP. */
39static const clock_ip_name_t s_acmpClock[] = CMP_CLOCKS;
40#endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */
41
42/*******************************************************************************
43 * Codes
44 ******************************************************************************/
45static uint32_t ACMP_GetInstance(CMP_Type *base)
46{
47 uint32_t instance = 0U;
48 uint32_t acmpArrayCount = (sizeof(s_acmpBases) / sizeof(s_acmpBases[0]));
49
50 /* Find the instance index from base address mappings. */
51 for (instance = 0; instance < acmpArrayCount; instance++)
52 {
53 if (s_acmpBases[instance] == base)
54 {
55 break;
56 }
57 }
58
59 return instance;
60}
61
62/*!
63 * brief Initializes the ACMP.
64 *
65 * The default configuration can be got by calling ACMP_GetDefaultConfig().
66 *
67 * param base ACMP peripheral base address.
68 * param config Pointer to ACMP configuration structure.
69 */
70void ACMP_Init(CMP_Type *base, const acmp_config_t *config)
71{
72 assert(NULL != config);
73
74 uint32_t tmp32;
75
76#if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)
77 /* Open clock gate. */
79#endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */
80
81 /* Disable the module before configuring it. */
82 ACMP_Enable(base, false);
83
84 /* CMPx_C0
85 * Set control bit. Avoid clearing status flags at the same time.
86 */
87 tmp32 = (base->C0 & (~(CMP_C0_PMODE_MASK | CMP_C0_INVT_MASK | CMP_C0_COS_MASK | CMP_C0_OPE_MASK |
88 CMP_C0_HYSTCTR_MASK | CMP_C0_CFx_MASK)));
89#if defined(FSL_FEATURE_ACMP_HAS_C0_OFFSET_BIT) && (FSL_FEATURE_ACMP_HAS_C0_OFFSET_BIT == 1U)
90 tmp32 &= ~CMP_C0_OFFSET_MASK;
91#endif /* FSL_FEATURE_ACMP_HAS_C0_OFFSET_BIT */
92 if (config->enableHighSpeed)
93 {
94 tmp32 |= CMP_C0_PMODE_MASK;
95 }
96 if (config->enableInvertOutput)
97 {
98 tmp32 |= CMP_C0_INVT_MASK;
99 }
100 if (config->useUnfilteredOutput)
101 {
102 tmp32 |= CMP_C0_COS_MASK;
103 }
104 if (config->enablePinOut)
105 {
106 tmp32 |= CMP_C0_OPE_MASK;
107 }
108 tmp32 |= CMP_C0_HYSTCTR(config->hysteresisMode);
109#if defined(FSL_FEATURE_ACMP_HAS_C0_OFFSET_BIT) && (FSL_FEATURE_ACMP_HAS_C0_OFFSET_BIT == 1U)
110 tmp32 |= CMP_C0_OFFSET(config->offsetMode);
111#endif /* FSL_FEATURE_ACMP_HAS_C0_OFFSET_BIT */
112 base->C0 = tmp32;
113}
114
115/*!
116 * brief Deinitializes the ACMP.
117 *
118 * param base ACMP peripheral base address.
119 */
120void ACMP_Deinit(CMP_Type *base)
121{
122 /* Disable the module. */
123 ACMP_Enable(base, false);
124
125#if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)
126 /* Disable clock gate. */
128#endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */
129}
130
131/*!
132 * brief Gets the default configuration for ACMP.
133 *
134 * This function initializes the user configuration structure to default value. The default value are:
135 *
136 * Example:
137 code
138 config->enableHighSpeed = false;
139 config->enableInvertOutput = false;
140 config->useUnfilteredOutput = false;
141 config->enablePinOut = false;
142 config->enableHysteresisBothDirections = false;
143 config->hysteresisMode = kACMP_hysteresisMode0;
144 endcode
145 *
146 * param config Pointer to ACMP configuration structure.
147 */
149{
150 assert(NULL != config);
151
152 /* Initializes the configure structure to zero. */
153 memset(config, 0, sizeof(*config));
154
155 /* Fill default configuration */
156 config->enableHighSpeed = false;
157 config->enableInvertOutput = false;
158 config->useUnfilteredOutput = false;
159 config->enablePinOut = false;
160#if defined(FSL_FEATURE_ACMP_HAS_C0_OFFSET_BIT) && (FSL_FEATURE_ACMP_HAS_C0_OFFSET_BIT == 1U)
161 config->offsetMode = kACMP_OffsetLevel0;
162#endif /* FSL_FEATURE_ACMP_HAS_C0_OFFSET_BIT */
163 config->hysteresisMode = kACMP_HysteresisLevel0;
164}
165
166/*!
167 * brief Enables or disables the ACMP.
168 *
169 * param base ACMP peripheral base address.
170 * param enable True to enable the ACMP.
171 */
172void ACMP_Enable(CMP_Type *base, bool enable)
173{
174 /* CMPx_C0
175 * Set control bit. Avoid clearing status flags at the same time.
176 */
177 if (enable)
178 {
179 base->C0 = ((base->C0 | CMP_C0_EN_MASK) & ~CMP_C0_CFx_MASK);
180 }
181 else
182 {
183 base->C0 &= ~(CMP_C0_EN_MASK | CMP_C0_CFx_MASK);
184 }
185}
186
187#if defined(FSL_FEATURE_ACMP_HAS_C0_LINKEN_BIT) && (FSL_FEATURE_ACMP_HAS_C0_LINKEN_BIT == 1U)
188/*!
189 * brief Enables the link from CMP to DAC enable.
190 *
191 * When this bit is set, the DAC enable/disable is controlled by the bit CMP_C0[EN] instead of CMP_C1[DACEN].
192 *
193 * param base ACMP peripheral base address.
194 * param enable Enable the feature or not.
195 */
196void ACMP_EnableLinkToDAC(CMP_Type *base, bool enable)
197{
198 /* CMPx_C0_LINKEN
199 * Set control bit. Avoid clearing status flags at the same time.
200 */
201 if (enable)
202 {
203 base->C0 = ((base->C0 | CMP_C0_LINKEN_MASK) & ~CMP_C0_CFx_MASK);
204 }
205 else
206 {
207 base->C0 &= ~(CMP_C0_LINKEN_MASK | CMP_C0_CFx_MASK);
208 }
209}
210#endif /* FSL_FEATURE_ACMP_HAS_C0_LINKEN_BIT */
211
212/*!
213 * brief Sets the channel configuration.
214 *
215 * Note that the plus/minus mux's setting is only valid when the positive/negative port's input isn't from DAC but
216 * from channel mux.
217 *
218 * Example:
219 code
220 acmp_channel_config_t configStruct = {0};
221 configStruct.positivePortInput = kACMP_PortInputFromDAC;
222 configStruct.negativePortInput = kACMP_PortInputFromMux;
223 configStruct.minusMuxInput = 1U;
224 ACMP_SetChannelConfig(CMP0, &configStruct);
225 endcode
226 *
227 * param base ACMP peripheral base address.
228 * param config Pointer to channel configuration structure.
229 */
231{
232 assert(NULL != config);
233
234 uint32_t tmp32 = (base->C1 & (~(CMP_C1_PSEL_MASK | CMP_C1_MSEL_MASK)));
235
236/* CMPx_C1
237 * Set the input of CMP's positive port.
238 */
239#if (defined(FSL_FEATURE_ACMP_HAS_C1_INPSEL_BIT) && (FSL_FEATURE_ACMP_HAS_C1_INPSEL_BIT == 1U))
240 tmp32 &= ~CMP_C1_INPSEL_MASK;
241 tmp32 |= CMP_C1_INPSEL(config->positivePortInput);
242#endif /* FSL_FEATURE_ACMP_HAS_C1_INPSEL_BIT */
243
244#if (defined(FSL_FEATURE_ACMP_HAS_C1_INNSEL_BIT) && (FSL_FEATURE_ACMP_HAS_C1_INNSEL_BIT == 1U))
245 tmp32 &= ~CMP_C1_INNSEL_MASK;
246 tmp32 |= CMP_C1_INNSEL(config->negativePortInput);
247#endif /* FSL_FEATURE_ACMP_HAS_C1_INPSEL_BIT */
248
249 tmp32 |= CMP_C1_PSEL(config->plusMuxInput) | CMP_C1_MSEL(config->minusMuxInput);
250
251 base->C1 = tmp32;
252}
253
254/*!
255 * brief Enables or disables DMA.
256 *
257 * param base ACMP peripheral base address.
258 * param enable True to enable DMA.
259 */
260void ACMP_EnableDMA(CMP_Type *base, bool enable)
261{
262 /* CMPx_C0
263 * Set control bit. Avoid clearing status flags at the same time.
264 */
265 if (enable)
266 {
267 base->C0 = ((base->C0 | CMP_C0_DMAEN_MASK) & ~CMP_C0_CFx_MASK);
268 }
269 else
270 {
271 base->C0 &= ~(CMP_C0_DMAEN_MASK | CMP_C0_CFx_MASK);
272 }
273}
274
275/*!
276 * brief Enables or disables window mode.
277 *
278 * param base ACMP peripheral base address.
279 * param enable True to enable window mode.
280 */
281void ACMP_EnableWindowMode(CMP_Type *base, bool enable)
282{
283 /* CMPx_C0
284 * Set control bit. Avoid clearing status flags at the same time.
285 */
286 if (enable)
287 {
288 base->C0 = ((base->C0 | CMP_C0_WE_MASK) & ~CMP_C0_CFx_MASK);
289 }
290 else
291 {
292 base->C0 &= ~(CMP_C0_WE_MASK | CMP_C0_CFx_MASK);
293 }
294}
295
296/*!
297 * brief Configures the filter.
298 *
299 * The filter can be enabled when the filter count is bigger than 1, the filter period is greater than 0 and the sample
300 * clock is from divided bus clock or the filter is bigger than 1 and the sample clock is from external clock. Detailed
301 * usage can be got from the reference manual.
302 *
303 * Example:
304 code
305 acmp_filter_config_t configStruct = {0};
306 configStruct.filterCount = 5U;
307 configStruct.filterPeriod = 200U;
308 configStruct.enableSample = false;
309 ACMP_SetFilterConfig(CMP0, &configStruct);
310 endcode
311 *
312 * param base ACMP peripheral base address.
313 * param config Pointer to filter configuration structure.
314 */
316{
317 assert(NULL != config);
318
319 /* CMPx_C0
320 * Set control bit. Avoid clearing status flags at the same time.
321 */
322 uint32_t tmp32 = (base->C0 & (~(CMP_C0_FILTER_CNT_MASK | CMP_C0_FPR_MASK | CMP_C0_SE_MASK | CMP_C0_CFx_MASK)));
323
324 if (config->enableSample)
325 {
326 tmp32 |= CMP_C0_SE_MASK;
327 }
328 tmp32 |= (CMP_C0_FILTER_CNT(config->filterCount) | CMP_C0_FPR(config->filterPeriod));
329 base->C0 = tmp32;
330}
331
332/*!
333 * brief Configures the internal DAC.
334 *
335 * Example:
336 code
337 acmp_dac_config_t configStruct = {0};
338 configStruct.referenceVoltageSource = kACMP_VrefSourceVin1;
339 configStruct.DACValue = 20U;
340 configStruct.enableOutput = false;
341 configStruct.workMode = kACMP_DACWorkLowSpeedMode;
342 ACMP_SetDACConfig(CMP0, &configStruct);
343 endcode
344 *
345 * param base ACMP peripheral base address.
346 * param config Pointer to DAC configuration structure. "NULL" is for disabling the feature.
347 */
348void ACMP_SetDACConfig(CMP_Type *base, const acmp_dac_config_t *config)
349{
350 uint32_t tmp32;
351
352 /* CMPx_C1
353 * NULL configuration means to disable the feature.
354 */
355 if (NULL == config)
356 {
357 base->C1 &= ~CMP_C1_DACEN_MASK;
358 return;
359 }
360
361 tmp32 = (base->C1 & (~(CMP_C1_VRSEL_MASK | CMP_C1_VOSEL_MASK)));
362 /* Set configuration and enable the feature. */
363 tmp32 |= (CMP_C1_VRSEL(config->referenceVoltageSource) | CMP_C1_VOSEL(config->DACValue) | CMP_C1_DACEN_MASK);
364
365#if defined(FSL_FEATURE_ACMP_HAS_C1_DACOE_BIT) && (FSL_FEATURE_ACMP_HAS_C1_DACOE_BIT == 1U)
366 tmp32 &= ~CMP_C1_DACOE_MASK;
367 if (config->enableOutput)
368 {
369 tmp32 |= CMP_C1_DACOE_MASK;
370 }
371#endif /* FSL_FEATURE_ACMP_HAS_C1_DACOE_BIT */
372
373#if defined(FSL_FEATURE_ACMP_HAS_C1_DMODE_BIT) && (FSL_FEATURE_ACMP_HAS_C1_DMODE_BIT == 1U)
374 switch (config->workMode)
375 {
377 tmp32 &= ~CMP_C1_DMODE_MASK;
378 break;
380 tmp32 |= CMP_C1_DMODE_MASK;
381 break;
382 default:
383 break;
384 }
385#endif /* FSL_FEATURE_ACMP_HAS_C1_DMODE_BIT */
386
387 base->C1 = tmp32;
388}
389
390/*!
391 * brief Configures the round robin mode.
392 *
393 * Example:
394 code
395 acmp_round_robin_config_t configStruct = {0};
396 configStruct.fixedPort = kACMP_FixedPlusPort;
397 configStruct.fixedChannelNumber = 3U;
398 configStruct.checkerChannelMask = 0xF7U;
399 configStruct.sampleClockCount = 0U;
400 configStruct.delayModulus = 0U;
401 ACMP_SetRoundRobinConfig(CMP0, &configStruct);
402 endcode
403 * param base ACMP peripheral base address.
404 * param config Pointer to round robin mode configuration structure. "NULL" is for disabling the feature.
405 */
407{
408 uint32_t tmp32;
409
410 /* CMPx_C2
411 * Set control bit. Avoid clearing status flags at the same time.
412 * NULL configuration means to disable the feature.
413 */
414 if (NULL == config)
415 {
416 tmp32 = CMP_C2_CHnF_MASK;
417#if defined(FSL_FEATURE_ACMP_HAS_C2_RRE_BIT) && (FSL_FEATURE_ACMP_HAS_C2_RRE_BIT == 1U)
418 tmp32 |= CMP_C2_RRE_MASK;
419#endif /* FSL_FEATURE_ACMP_HAS_C2_RRE_BIT */
420 base->C2 &= ~(tmp32);
421 return;
422 }
423
424 /* CMPx_C1
425 * Set all channel's round robin checker enable mask.
426 */
427 tmp32 = (base->C1 & ~(CMP_C1_CHNn_MASK));
428 tmp32 |= ((config->checkerChannelMask) << CMP_C1_CHN0_SHIFT);
429 base->C1 = tmp32;
430
431 /* CMPx_C2
432 * Set configuration and enable the feature.
433 */
434 tmp32 = (base->C2 &
435 (~(CMP_C2_FXMP_MASK | CMP_C2_FXMXCH_MASK | CMP_C2_NSAM_MASK | CMP_C2_INITMOD_MASK | CMP_C2_CHnF_MASK)));
436 tmp32 |= (CMP_C2_FXMP(config->fixedPort) | CMP_C2_FXMXCH(config->fixedChannelNumber) |
437 CMP_C2_NSAM(config->sampleClockCount) | CMP_C2_INITMOD(config->delayModulus));
438#if defined(FSL_FEATURE_ACMP_HAS_C2_RRE_BIT) && (FSL_FEATURE_ACMP_HAS_C2_RRE_BIT == 1U)
439 tmp32 |= CMP_C2_RRE_MASK;
440#endif /* FSL_FEATURE_ACMP_HAS_C2_RRE_BIT */
441 base->C2 = tmp32;
442}
443
444/*!
445 * brief Defines the pre-set state of channels in round robin mode.
446 *
447 * Note: The pre-state has different circuit with get-round-robin-result in the SOC even though they are same bits.
448 * So get-round-robin-result can't return the same value as the value are set by pre-state.
449 *
450 * param base ACMP peripheral base address.
451 * param mask Mask of round robin channel index. Available range is channel0:0x01 to channel7:0x80.
452 */
453void ACMP_SetRoundRobinPreState(CMP_Type *base, uint32_t mask)
454{
455 /* CMPx_C2
456 * Set control bit. Avoid clearing status flags at the same time.
457 */
458 uint32_t tmp32 = (base->C2 & ~(CMP_C2_ACOn_MASK | CMP_C2_CHnF_MASK));
459
460 tmp32 |= (mask << CMP_C2_ACOn_SHIFT);
461 base->C2 = tmp32;
462}
463
464/*!
465 * brief Clears the channel input changed flags in round robin mode.
466 *
467 * param base ACMP peripheral base address.
468 * param mask Mask of channel index. Available range is channel0:0x01 to channel7:0x80.
469 */
470void ACMP_ClearRoundRobinStatusFlags(CMP_Type *base, uint32_t mask)
471{
472 /* CMPx_C2 */
473 uint32_t tmp32 = (base->C2 & (~CMP_C2_CHnF_MASK));
474
475 tmp32 |= (mask << CMP_C2_CH0F_SHIFT);
476 base->C2 = tmp32;
477}
478
479/*!
480 * brief Enables interrupts.
481 *
482 * param base ACMP peripheral base address.
483 * param mask Interrupts mask. See "_acmp_interrupt_enable".
484 */
485void ACMP_EnableInterrupts(CMP_Type *base, uint32_t mask)
486{
487 uint32_t tmp32;
488
489 /* CMPx_C0
490 * Set control bit. Avoid clearing status flags at the same time.
491 * Set CMP interrupt enable flag.
492 */
493 tmp32 = base->C0 & ~CMP_C0_CFx_MASK; /* To protect the W1C flags. */
495 {
496 tmp32 = ((tmp32 | CMP_C0_IER_MASK) & ~CMP_C0_CFx_MASK);
497 }
499 {
500 tmp32 = ((tmp32 | CMP_C0_IEF_MASK) & ~CMP_C0_CFx_MASK);
501 }
502 base->C0 = tmp32;
503
504 /* CMPx_C2
505 * Set round robin interrupt enable flag.
506 */
508 {
509 tmp32 = base->C2;
510 /* Set control bit. Avoid clearing status flags at the same time. */
511 tmp32 = ((tmp32 | CMP_C2_RRIE_MASK) & ~CMP_C2_CHnF_MASK);
512 base->C2 = tmp32;
513 }
514}
515
516/*!
517 * brief Disables interrupts.
518 *
519 * param base ACMP peripheral base address.
520 * param mask Interrupts mask. See "_acmp_interrupt_enable".
521 */
522void ACMP_DisableInterrupts(CMP_Type *base, uint32_t mask)
523{
524 uint32_t tmp32;
525
526 /* CMPx_C0
527 * Set control bit. Avoid clearing status flags at the same time.
528 * Clear CMP interrupt enable flag.
529 */
530 tmp32 = base->C0;
532 {
533 tmp32 &= ~(CMP_C0_IER_MASK | CMP_C0_CFx_MASK);
534 }
536 {
537 tmp32 &= ~(CMP_C0_IEF_MASK | CMP_C0_CFx_MASK);
538 }
539 base->C0 = tmp32;
540
541 /* CMPx_C2
542 * Clear round robin interrupt enable flag.
543 */
545 {
546 tmp32 = base->C2;
547 /* Set control bit. Avoid clearing status flags at the same time. */
548 tmp32 &= ~(CMP_C2_RRIE_MASK | CMP_C2_CHnF_MASK);
549 base->C2 = tmp32;
550 }
551}
552
553/*!
554 * brief Gets status flags.
555 *
556 * param base ACMP peripheral base address.
557 * return Status flags asserted mask. See "_acmp_status_flags".
558 */
559uint32_t ACMP_GetStatusFlags(CMP_Type *base)
560{
561 uint32_t status = 0U;
562 uint32_t tmp32 = base->C0;
563
564 /* CMPx_C0
565 * Check if each flag is set.
566 */
567 if (CMP_C0_CFR_MASK == (tmp32 & CMP_C0_CFR_MASK))
568 {
570 }
571 if (CMP_C0_CFF_MASK == (tmp32 & CMP_C0_CFF_MASK))
572 {
574 }
575 if (CMP_C0_COUT_MASK == (tmp32 & CMP_C0_COUT_MASK))
576 {
578 }
579
580 return status;
581}
582
583/*!
584 * brief Clears status flags.
585 *
586 * param base ACMP peripheral base address.
587 * param mask Status flags mask. See "_acmp_status_flags".
588 */
589void ACMP_ClearStatusFlags(CMP_Type *base, uint32_t mask)
590{
591 /* CMPx_C0 */
592 uint32_t tmp32 = (base->C0 & (~(CMP_C0_CFR_MASK | CMP_C0_CFF_MASK)));
593
594 /* Clear flag according to mask. */
596 {
597 tmp32 |= CMP_C0_CFR_MASK;
598 }
600 {
601 tmp32 |= CMP_C0_CFF_MASK;
602 }
603 base->C0 = tmp32;
604}
605
606#if defined(FSL_FEATURE_ACMP_HAS_C3_REG) && (FSL_FEATURE_ACMP_HAS_C3_REG == 1U)
607/*!
608 * brief Configure the discrete mode.
609 *
610 * Configure the discrete mode when supporting 3V domain with 1.8V core.
611 *
612 * param base ACMP peripheral base address.
613 * param config Pointer to configuration structure. See "acmp_discrete_mode_config_t".
614 */
616{
617 uint32_t tmp32 = 0U;
618
619 if (!config->enablePositiveChannelDiscreteMode)
620 {
621 tmp32 |= CMP_C3_PCHCTEN_MASK;
622 }
623 if (!config->enableNegativeChannelDiscreteMode)
624 {
625 tmp32 |= CMP_C3_NCHCTEN_MASK;
626 }
627 if (config->enableResistorDivider)
628 {
629 tmp32 |= CMP_C3_RDIVE_MASK;
630 }
631
632 tmp32 |= CMP_C3_DMCS(config->clockSource) /* Select the clock. */
633 | CMP_C3_ACSAT(config->sampleTime) /* Sample time period. */
634 | CMP_C3_ACPH1TC(config->phase1Time) /* Phase 1 sample time. */
635 | CMP_C3_ACPH2TC(config->phase2Time); /* Phase 2 sample time. */
636
637 base->C3 = tmp32;
638}
639
640/*!
641 * brief Get the default configuration for discrete mode setting.
642 *
643 * param config Pointer to configuration structure to be restored with the setting values.
644 */
646{
647 assert(NULL != config);
648
649 /* Initializes the configure structure to zero. */
650 memset(config, 0, sizeof(*config));
651
652 config->enablePositiveChannelDiscreteMode = false;
653 config->enableNegativeChannelDiscreteMode = false;
654 config->enableResistorDivider = false;
655 config->clockSource = kACMP_DiscreteClockSlow;
659}
660
661#endif /* FSL_FEATURE_ACMP_HAS_C3_REG */
static BenchController instance
static constexpr persistent_config_s * config
static uint32_t ACMP_GetInstance(CMP_Type *base)
Get the ACMP instance from the peripheral base address.
Definition fsl_acmp.c:45
static CMP_Type *const s_acmpBases[]
Definition fsl_acmp.c:36
static const clock_ip_name_t s_acmpClock[]
Definition fsl_acmp.c:39
void ACMP_SetFilterConfig(CMP_Type *base, const acmp_filter_config_t *config)
Configures the filter.
Definition fsl_acmp.c:315
void ACMP_Enable(CMP_Type *base, bool enable)
Enables or disables the ACMP.
Definition fsl_acmp.c:172
void ACMP_GetDefaultDiscreteModeConfig(acmp_discrete_mode_config_t *config)
Get the default configuration for discrete mode setting.
Definition fsl_acmp.c:645
uint32_t ACMP_GetStatusFlags(CMP_Type *base)
Gets status flags.
Definition fsl_acmp.c:559
void ACMP_SetRoundRobinPreState(CMP_Type *base, uint32_t mask)
Defines the pre-set state of channels in round robin mode.
Definition fsl_acmp.c:453
void ACMP_SetChannelConfig(CMP_Type *base, const acmp_channel_config_t *config)
Sets the channel configuration.
Definition fsl_acmp.c:230
void ACMP_Init(CMP_Type *base, const acmp_config_t *config)
Initializes the ACMP.
Definition fsl_acmp.c:70
void ACMP_EnableDMA(CMP_Type *base, bool enable)
Enables or disables DMA.
Definition fsl_acmp.c:260
void ACMP_ClearRoundRobinStatusFlags(CMP_Type *base, uint32_t mask)
Clears the channel input changed flags in round robin mode.
Definition fsl_acmp.c:470
void ACMP_DisableInterrupts(CMP_Type *base, uint32_t mask)
Disables interrupts.
Definition fsl_acmp.c:522
void ACMP_Deinit(CMP_Type *base)
Deinitializes the ACMP.
Definition fsl_acmp.c:120
void ACMP_SetDACConfig(CMP_Type *base, const acmp_dac_config_t *config)
Configures the internal DAC.
Definition fsl_acmp.c:348
void ACMP_EnableInterrupts(CMP_Type *base, uint32_t mask)
Enables interrupts.
Definition fsl_acmp.c:485
void ACMP_EnableLinkToDAC(CMP_Type *base, bool enable)
Enables the link from CMP to DAC enable.
Definition fsl_acmp.c:196
void ACMP_EnableWindowMode(CMP_Type *base, bool enable)
Enables or disables window mode.
Definition fsl_acmp.c:281
void ACMP_ClearStatusFlags(CMP_Type *base, uint32_t mask)
Clears status flags.
Definition fsl_acmp.c:589
void ACMP_SetDiscreteModeConfig(CMP_Type *base, const acmp_discrete_mode_config_t *config)
Configure the discrete mode.
Definition fsl_acmp.c:615
void ACMP_GetDefaultConfig(acmp_config_t *config)
Gets the default configuration for ACMP.
Definition fsl_acmp.c:148
void ACMP_SetRoundRobinConfig(CMP_Type *base, const acmp_round_robin_config_t *config)
Configures the round robin mode.
Definition fsl_acmp.c:406
@ kACMP_DiscreteSampleTimeAs1T
Definition fsl_acmp.h:192
@ kACMP_RoundRobinInterruptEnable
Definition fsl_acmp.h:39
@ kACMP_OutputFallingInterruptEnable
Definition fsl_acmp.h:38
@ kACMP_OutputRisingInterruptEnable
Definition fsl_acmp.h:37
@ kACMP_HysteresisLevel0
Definition fsl_acmp.h:73
@ kACMP_DiscretePhaseTimeAlt0
Definition fsl_acmp.h:208
@ kACMP_DiscreteClockSlow
Definition fsl_acmp.h:181
@ kACMP_DACWorkHighSpeedMode
Definition fsl_acmp.h:107
@ kACMP_DACWorkLowSpeedMode
Definition fsl_acmp.h:106
@ kACMP_OffsetLevel0
Definition fsl_acmp.h:61
@ kACMP_OutputAssertEventFlag
Definition fsl_acmp.h:47
@ kACMP_OutputFallingEventFlag
Definition fsl_acmp.h:46
@ kACMP_OutputRisingEventFlag
Definition fsl_acmp.h:45
enum _clock_ip_name clock_ip_name_t
Peripheral clock name difinition used for clock gate, clock source and clock divider setting....
static void CLOCK_DisableClock(clock_ip_name_t name)
Disable the clock for specific IP.
Definition fsl_clock.h:653
static void CLOCK_EnableClock(clock_ip_name_t name)
Enable the clock for specific IP.
Definition fsl_clock.h:641
static void enable(const char *param)
Definition settings.cpp:441
Configuration for channel.
Definition fsl_acmp.h:131
Configuration for ACMP.
Definition fsl_acmp.h:113
Configuration for DAC.
Definition fsl_acmp.h:152
Configuration for discrete mode.
Definition fsl_acmp.h:220
Configuration for filter.
Definition fsl_acmp.h:144
Configuration for round robin mode.
Definition fsl_acmp.h:167