RTEMS 6.1-rc2
|
Data Structures | |
struct | _acmp_config |
Configuration for ACMP. More... | |
struct | _acmp_channel_config |
Configuration for channel. More... | |
struct | _acmp_filter_config |
Configuration for filter. More... | |
struct | _acmp_dac_config |
Configuration for DAC. More... | |
struct | _acmp_round_robin_config |
Configuration for round robin mode. More... | |
Driver version | |
enum | _acmp_interrupt_enable { kACMP_OutputRisingInterruptEnable = (1U << 0U) , kACMP_OutputFallingInterruptEnable = (1U << 1U) , kACMP_RoundRobinInterruptEnable = (1U << 2U) } |
Interrupt enable/disable mask. More... | |
enum | _acmp_status_flags { kACMP_OutputRisingEventFlag = CMP_C0_CFR_MASK , kACMP_OutputFallingEventFlag = CMP_C0_CFF_MASK , kACMP_OutputAssertEventFlag = CMP_C0_COUT_MASK } |
Status flag mask. More... | |
enum | _acmp_hysteresis_mode { kACMP_HysteresisLevel0 = 0U , kACMP_HysteresisLevel1 = 1U , kACMP_HysteresisLevel2 = 2U , kACMP_HysteresisLevel3 = 3U } |
Comparator hard block hysteresis control. More... | |
enum | _acmp_reference_voltage_source { kACMP_VrefSourceVin1 = 0U , kACMP_VrefSourceVin2 = 1U } |
CMP Voltage Reference source. More... | |
enum | _acmp_fixed_port { kACMP_FixedPlusPort = 0U , kACMP_FixedMinusPort = 1U } |
Fixed mux port. More... | |
typedef enum _acmp_hysteresis_mode | acmp_hysteresis_mode_t |
Comparator hard block hysteresis control. | |
typedef enum _acmp_reference_voltage_source | acmp_reference_voltage_source_t |
CMP Voltage Reference source. | |
typedef enum _acmp_fixed_port | acmp_fixed_port_t |
Fixed mux port. | |
typedef struct _acmp_config | acmp_config_t |
Configuration for ACMP. | |
typedef struct _acmp_channel_config | acmp_channel_config_t |
Configuration for channel. | |
typedef struct _acmp_filter_config | acmp_filter_config_t |
Configuration for filter. | |
typedef struct _acmp_dac_config | acmp_dac_config_t |
Configuration for DAC. | |
typedef struct _acmp_round_robin_config | acmp_round_robin_config_t |
Configuration for round robin mode. | |
#define | FSL_ACMP_DRIVER_VERSION (MAKE_VERSION(2U, 0U, 6U)) |
ACMP driver version 2.0.6. | |
#define | CMP_C0_CFx_MASK (CMP_C0_CFR_MASK | CMP_C0_CFF_MASK) |
The mask of status flags cleared by writing 1. | |
#define | CMP_C1_CHNn_MASK 0xFF0000U /* C1_CHN0 - C1_CHN7. */ |
#define | CMP_C2_CHnF_MASK 0xFF0000U /* C2_CH0F - C2_CH7F. */ |
Initialization and deinitialization | |
void | ACMP_Init (CMP_Type *base, const acmp_config_t *config) |
Initializes the ACMP. | |
void | ACMP_Deinit (CMP_Type *base) |
Deinitializes the ACMP. | |
void | ACMP_GetDefaultConfig (acmp_config_t *config) |
Gets the default configuration for ACMP. | |
Basic Operations | |
void | ACMP_Enable (CMP_Type *base, bool enable) |
Enables or disables the ACMP. | |
void | ACMP_SetChannelConfig (CMP_Type *base, const acmp_channel_config_t *config) |
Sets the channel configuration. | |
Advanced Operations | |
void | ACMP_EnableDMA (CMP_Type *base, bool enable) |
Enables or disables DMA. | |
void | ACMP_EnableWindowMode (CMP_Type *base, bool enable) |
Enables or disables window mode. | |
void | ACMP_SetFilterConfig (CMP_Type *base, const acmp_filter_config_t *config) |
Configures the filter. | |
void | ACMP_SetDACConfig (CMP_Type *base, const acmp_dac_config_t *config) |
Configures the internal DAC. | |
void | ACMP_SetRoundRobinConfig (CMP_Type *base, const acmp_round_robin_config_t *config) |
Configures the round robin mode. | |
void | ACMP_SetRoundRobinPreState (CMP_Type *base, uint32_t mask) |
Defines the pre-set state of channels in round robin mode. | |
void | ACMP_ClearRoundRobinStatusFlags (CMP_Type *base, uint32_t mask) |
Clears the channel input changed flags in round robin mode. | |
Interrupts | |
void | ACMP_EnableInterrupts (CMP_Type *base, uint32_t mask) |
Enables interrupts. | |
void | ACMP_DisableInterrupts (CMP_Type *base, uint32_t mask) |
Disables interrupts. | |
Status | |
uint32_t | ACMP_GetStatusFlags (CMP_Type *base) |
Gets status flags. | |
void | ACMP_ClearStatusFlags (CMP_Type *base, uint32_t mask) |
Clears status flags. | |
typedef struct _acmp_channel_config acmp_channel_config_t |
Configuration for channel.
The comparator's port can be input from channel mux or DAC. If port input is from channel mux, detailed channel number for the mux should be configured.
typedef enum _acmp_hysteresis_mode acmp_hysteresis_mode_t |
Comparator hard block hysteresis control.
See chip data sheet to get the actual hysteresis value with each level.
enum _acmp_fixed_port |
Comparator hard block hysteresis control.
See chip data sheet to get the actual hysteresis value with each level.
enum _acmp_status_flags |
void ACMP_ClearRoundRobinStatusFlags | ( | CMP_Type * | base, |
uint32_t | mask | ||
) |
Clears the channel input changed flags in round robin mode.
base | ACMP peripheral base address. |
mask | Mask of channel index. Available range is channel0:0x01 to channel7:0x80. |
brief Clears the channel input changed flags in round robin mode.
param base ACMP peripheral base address. param mask Mask of channel index. Available range is channel0:0x01 to channel7:0x80.
void ACMP_ClearStatusFlags | ( | CMP_Type * | base, |
uint32_t | mask | ||
) |
Clears status flags.
base | ACMP peripheral base address. |
mask | Status flags mask. See "_acmp_status_flags". |
brief Clears status flags.
param base ACMP peripheral base address. param mask Status flags mask. See "_acmp_status_flags".
void ACMP_Deinit | ( | CMP_Type * | base | ) |
Deinitializes the ACMP.
base | ACMP peripheral base address. |
brief Deinitializes the ACMP.
param base ACMP peripheral base address.
void ACMP_DisableInterrupts | ( | CMP_Type * | base, |
uint32_t | mask | ||
) |
Disables interrupts.
base | ACMP peripheral base address. |
mask | Interrupts mask. See "_acmp_interrupt_enable". |
brief Disables interrupts.
param base ACMP peripheral base address. param mask Interrupts mask. See "_acmp_interrupt_enable".
void ACMP_Enable | ( | CMP_Type * | base, |
bool | enable | ||
) |
Enables or disables the ACMP.
base | ACMP peripheral base address. |
enable | True to enable the ACMP. |
brief Enables or disables the ACMP.
param base ACMP peripheral base address. param enable True to enable the ACMP.
void ACMP_EnableDMA | ( | CMP_Type * | base, |
bool | enable | ||
) |
Enables or disables DMA.
base | ACMP peripheral base address. |
enable | True to enable DMA. |
brief Enables or disables DMA.
param base ACMP peripheral base address. param enable True to enable DMA.
void ACMP_EnableInterrupts | ( | CMP_Type * | base, |
uint32_t | mask | ||
) |
Enables interrupts.
base | ACMP peripheral base address. |
mask | Interrupts mask. See "_acmp_interrupt_enable". |
brief Enables interrupts.
param base ACMP peripheral base address. param mask Interrupts mask. See "_acmp_interrupt_enable".
void ACMP_EnableWindowMode | ( | CMP_Type * | base, |
bool | enable | ||
) |
Enables or disables window mode.
base | ACMP peripheral base address. |
enable | True to enable window mode. |
brief Enables or disables window mode.
param base ACMP peripheral base address. param enable True to enable window mode.
void ACMP_GetDefaultConfig | ( | acmp_config_t * | config | ) |
Gets the default configuration for ACMP.
This function initializes the user configuration structure to default value. The default value are:
Example:
config | Pointer to ACMP configuration structure. |
brief Gets the default configuration for ACMP.
This function initializes the user configuration structure to default value. The default value are:
Example: code config->enableHighSpeed = false; config->enableInvertOutput = false; config->useUnfilteredOutput = false; config->enablePinOut = false; config->enableHysteresisBothDirections = false; config->hysteresisMode = kACMP_hysteresisMode0; endcode
param config Pointer to ACMP configuration structure.
uint32_t ACMP_GetStatusFlags | ( | CMP_Type * | base | ) |
Gets status flags.
base | ACMP peripheral base address. |
brief Gets status flags.
param base ACMP peripheral base address. return Status flags asserted mask. See "_acmp_status_flags".
void ACMP_Init | ( | CMP_Type * | base, |
const acmp_config_t * | config | ||
) |
Initializes the ACMP.
The default configuration can be got by calling ACMP_GetDefaultConfig().
base | ACMP peripheral base address. |
config | Pointer to ACMP configuration structure. |
brief Initializes the ACMP.
The default configuration can be got by calling ACMP_GetDefaultConfig().
param base ACMP peripheral base address. param config Pointer to ACMP configuration structure.
void ACMP_SetChannelConfig | ( | CMP_Type * | base, |
const acmp_channel_config_t * | config | ||
) |
Sets the channel configuration.
Note that the plus/minus mux's setting is only valid when the positive/negative port's input isn't from DAC but from channel mux.
Example:
base | ACMP peripheral base address. |
config | Pointer to channel configuration structure. |
brief Sets the channel configuration.
Note that the plus/minus mux's setting is only valid when the positive/negative port's input isn't from DAC but from channel mux.
Example: code acmp_channel_config_t configStruct = {0}; configStruct.positivePortInput = kACMP_PortInputFromDAC; configStruct.negativePortInput = kACMP_PortInputFromMux; configStruct.minusMuxInput = 1U; ACMP_SetChannelConfig(CMP0, &configStruct); endcode
param base ACMP peripheral base address. param config Pointer to channel configuration structure.
void ACMP_SetDACConfig | ( | CMP_Type * | base, |
const acmp_dac_config_t * | config | ||
) |
Configures the internal DAC.
Example:
base | ACMP peripheral base address. |
config | Pointer to DAC configuration structure. "NULL" is for disabling the feature. |
brief Configures the internal DAC.
Example: code acmp_dac_config_t configStruct = {0}; configStruct.referenceVoltageSource = kACMP_VrefSourceVin1; configStruct.DACValue = 20U; configStruct.enableOutput = false; configStruct.workMode = kACMP_DACWorkLowSpeedMode; ACMP_SetDACConfig(CMP0, &configStruct); endcode
param base ACMP peripheral base address. param config Pointer to DAC configuration structure. "NULL" is for disabling the feature.
void ACMP_SetFilterConfig | ( | CMP_Type * | base, |
const acmp_filter_config_t * | config | ||
) |
Configures the filter.
The filter can be enabled when the filter count is bigger than 1, the filter period is greater than 0 and the sample clock is from divided bus clock or the filter is bigger than 1 and the sample clock is from external clock. Detailed usage can be got from the reference manual.
Example:
base | ACMP peripheral base address. |
config | Pointer to filter configuration structure. |
brief Configures the filter.
The filter can be enabled when the filter count is bigger than 1, the filter period is greater than 0 and the sample clock is from divided bus clock or the filter is bigger than 1 and the sample clock is from external clock. Detailed usage can be got from the reference manual.
Example: code acmp_filter_config_t configStruct = {0}; configStruct.filterCount = 5U; configStruct.filterPeriod = 200U; configStruct.enableSample = false; ACMP_SetFilterConfig(CMP0, &configStruct); endcode
param base ACMP peripheral base address. param config Pointer to filter configuration structure.
void ACMP_SetRoundRobinConfig | ( | CMP_Type * | base, |
const acmp_round_robin_config_t * | config | ||
) |
Configures the round robin mode.
Example:
base | ACMP peripheral base address. |
config | Pointer to round robin mode configuration structure. "NULL" is for disabling the feature. |
brief Configures the round robin mode.
Example: code acmp_round_robin_config_t configStruct = {0}; configStruct.fixedPort = kACMP_FixedPlusPort; configStruct.fixedChannelNumber = 3U; configStruct.checkerChannelMask = 0xF7U; configStruct.sampleClockCount = 0U; configStruct.delayModulus = 0U; ACMP_SetRoundRobinConfig(CMP0, &configStruct); endcode param base ACMP peripheral base address. param config Pointer to round robin mode configuration structure. "NULL" is for disabling the feature.
void ACMP_SetRoundRobinPreState | ( | CMP_Type * | base, |
uint32_t | mask | ||
) |
Defines the pre-set state of channels in round robin mode.
Note: The pre-state has different circuit with get-round-robin-result in the SOC even though they are same bits. So get-round-robin-result can't return the same value as the value are set by pre-state.
base | ACMP peripheral base address. |
mask | Mask of round robin channel index. Available range is channel0:0x01 to channel7:0x80. |
brief Defines the pre-set state of channels in round robin mode.
Note: The pre-state has different circuit with get-round-robin-result in the SOC even though they are same bits. So get-round-robin-result can't return the same value as the value are set by pre-state.
param base ACMP peripheral base address. param mask Mask of round robin channel index. Available range is channel0:0x01 to channel7:0x80.
uint32_t _acmp_round_robin_config::checkerChannelMask |
Mask of checker channel index. Available range is channel0:0x01 to channel7:0x80 for round-robin checker.
uint32_t _acmp_dac_config::DACValue |
Value for DAC Output Voltage. Available range is 0-255.
uint32_t _acmp_round_robin_config::delayModulus |
Comparator and DAC initialization delay modulus.
bool _acmp_config::enableHighSpeed |
Enable High Speed (HS) comparison mode.
bool _acmp_config::enableInvertOutput |
Enable inverted comparator output.
bool _acmp_config::enablePinOut |
The comparator output is available on the associated pin.
bool _acmp_filter_config::enableSample |
Using external SAMPLE as sampling clock input, or using divided bus clock.
uint32_t _acmp_filter_config::filterCount |
Filter Sample Count. Available range is 1-7, 0 would cause the filter disabled.
uint32_t _acmp_filter_config::filterPeriod |
Filter Sample Period. The divider to bus clock. Available range is 0-255.
uint32_t _acmp_round_robin_config::fixedChannelNumber |
Indicates which channel is fixed in the fixed mux port.
acmp_fixed_port_t _acmp_round_robin_config::fixedPort |
Fixed mux port.
acmp_hysteresis_mode_t _acmp_config::hysteresisMode |
Hysteresis mode.
uint32_t _acmp_channel_config::minusMuxInput |
Minus mux input channel(0~7).
uint32_t _acmp_channel_config::plusMuxInput |
Plus mux input channel(0~7).
acmp_reference_voltage_source_t _acmp_dac_config::referenceVoltageSource |
Supply voltage reference source.
uint32_t _acmp_round_robin_config::sampleClockCount |
Specifies how many round-robin clock cycles(0~3) later the sample takes place.
bool _acmp_config::useUnfilteredOutput |
Set compare output(COUT) to equal COUTA(true) or COUT(false).