Software APIs
Data Structures | Macros | Typedefs | Enumerations | Functions
dif_adc_ctrl.h File Reference

(8a1a5fe)

ADC Controller Device Interface Functions More...

#include "adc_ctrl_regs.h"
#include "sw/device/lib/dif/autogen/dif_adc_ctrl_autogen.h"

Go to the source code of this file.

Data Structures

struct  dif_adc_ctrl_config
 Runtime configuration for an ADC Controller. More...
 
struct  dif_adc_ctrl_filter_config
 Runtime configuration for an ADC Controller filter. More...
 

Macros

#define DIF_ADC_CTRL_CHANNEL_LIST(X)
 Helper X macro for defining enums and case statements related to ADC Controller channels. More...
 
#define DIF_ADC_CTRL_FILTER_LIST(X)
 Helper X macro for defining enums and case statements related to ADC Controller filters. More...
 
#define DIF_ADC_CTRL_CHANNEL_ENUM_INIT_(channel_)   kDifAdcCtrlChannel##channel_ = channel_,
 Helper macro for defining a dif_adc_ctrl_channel_t enumeration constant. More...
 
#define DIF_ADC_CTRL_FILTER_ENUM_INIT_(filter_)   kDifAdcCtrlFilter##filter_ = filter_,
 Helper macro for defining a dif_adc_ctrl_filter_t enumeration constant. More...
 
#define DIF_ADC_CTRL_IRQ_CAUSE_ENUM_INIT_(filter_cause_)   kDifAdcCtrlIrqCauseFilter##filter_cause_ = 1U << filter_cause_,
 Helper macro for defining a dif_adc_ctrl_irq_cause_t enumeration constant. More...
 

Typedefs

typedef enum dif_adc_ctrl_channel dif_adc_ctrl_channel_t
 An ADC Controller Channel.
 
typedef enum dif_adc_ctrl_filter dif_adc_ctrl_filter_t
 An ADC Controller filter. More...
 
typedef enum dif_adc_ctrl_irq_cause dif_adc_ctrl_irq_cause_t
 An ADC Controller IRQ cause. More...
 
typedef enum dif_adc_ctrl_mode dif_adc_ctrl_mode_t
 Operation mode of the ADC Controller.
 
typedef struct dif_adc_ctrl_config dif_adc_ctrl_config_t
 Runtime configuration for an ADC Controller.
 
typedef struct dif_adc_ctrl_filter_config dif_adc_ctrl_filter_config_t
 Runtime configuration for an ADC Controller filter.
 

Enumerations

enum  dif_adc_ctrl_channel
 An ADC Controller Channel.
 
enum  dif_adc_ctrl_filter { kDifAdcCtrlTrans }
 An ADC Controller filter. More...
 
enum  dif_adc_ctrl_irq_cause {
  kDifAdcCtrlIrqCauseTrans = 1U << ADC_CTRL_ADC_INTR_STATUS_TRANS_BIT,
  kDifAdcCtrlIrqCauseOneshot = 1U << ADC_CTRL_ADC_INTR_STATUS_ONESHOT_BIT,
  kDifAdcCtrlIrqCauseAll
}
 An ADC Controller IRQ cause. More...
 
enum  dif_adc_ctrl_mode {
  kDifAdcCtrlLowPowerScanMode = 0,
  kDifAdcCtrlNormalPowerScanMode = 1,
  kDifAdcCtrlOneshotMode = 2
}
 Operation mode of the ADC Controller. More...
 

Functions

OT_WARN_UNUSED_RESULT dif_result_t dif_adc_ctrl_configure (const dif_adc_ctrl_t *adc_ctrl, dif_adc_ctrl_config_t config)
 Configures an ADC Controller. More...
 
OT_WARN_UNUSED_RESULT dif_result_t dif_adc_ctrl_configure_filter (const dif_adc_ctrl_t *adc_ctrl, dif_adc_ctrl_channel_t channel, dif_adc_ctrl_filter_config_t config, dif_toggle_t enabled)
 Configures a channel filter. More...
 
OT_WARN_UNUSED_RESULT dif_result_t dif_adc_ctrl_set_enabled (const dif_adc_ctrl_t *adc_ctrl, dif_toggle_t enabled)
 Sets the enablement state of the ADC Controller. More...
 
OT_WARN_UNUSED_RESULT dif_result_t dif_adc_ctrl_get_enabled (const dif_adc_ctrl_t *adc_ctrl, dif_toggle_t *is_enabled)
 Gets the enablement state of the ADC Controller. More...
 
OT_WARN_UNUSED_RESULT dif_result_t dif_adc_ctrl_filter_set_enabled (const dif_adc_ctrl_t *adc_ctrl, dif_adc_ctrl_channel_t channel, dif_adc_ctrl_filter_t filter, dif_toggle_t enabled)
 Sets the enablement state of the specified filter for the specified channel. More...
 
OT_WARN_UNUSED_RESULT dif_result_t dif_adc_ctrl_filter_get_enabled (const dif_adc_ctrl_t *adc_ctrl, dif_adc_ctrl_channel_t channel, dif_adc_ctrl_filter_t filter, dif_toggle_t *enabled)
 Gets the enablement state of the specified filter for the specified channel. More...
 
OT_WARN_UNUSED_RESULT dif_result_t dif_adc_ctrl_get_triggered_value (const dif_adc_ctrl_t *adc_ctrl, dif_adc_ctrl_channel_t channel, uint16_t *value)
 Get the sampled value from the specified channel that triggered the IRQ. More...
 
OT_WARN_UNUSED_RESULT dif_result_t dif_adc_ctrl_get_latest_value (const dif_adc_ctrl_t *adc_ctrl, dif_adc_ctrl_channel_t channel, uint16_t *value)
 Get the latest sampled value from the specified channel. More...
 
OT_WARN_UNUSED_RESULT dif_result_t dif_adc_ctrl_reset (const dif_adc_ctrl_t *adc_ctrl)
 Reset all ADC Controller FSMs and counters, and if enabled, begin sampling sequence. More...
 
OT_WARN_UNUSED_RESULT dif_result_t dif_adc_ctrl_irq_get_causes (const dif_adc_ctrl_t *adc_ctrl, uint32_t *causes)
 Gets the cause(s) of a debug_cable IRQ. More...
 
OT_WARN_UNUSED_RESULT dif_result_t dif_adc_ctrl_get_filter_status (const dif_adc_ctrl_t *adc_ctrl, uint32_t *status)
 Gets the filter status. More...
 
OT_WARN_UNUSED_RESULT dif_result_t dif_adc_ctrl_irq_clear_causes (const dif_adc_ctrl_t *adc_ctrl, uint32_t causes)
 Clears the cause(s) of a debug_cable IRQ. More...
 
OT_WARN_UNUSED_RESULT dif_result_t dif_adc_ctrl_filter_match_wakeup_set_enabled (const dif_adc_ctrl_t *adc_ctrl, dif_adc_ctrl_filter_t filter, dif_toggle_t enabled)
 Sets the enablement of generating system wakeups on a filter match. More...
 
OT_WARN_UNUSED_RESULT dif_result_t dif_adc_ctrl_filter_match_wakeup_get_enabled (const dif_adc_ctrl_t *adc_ctrl, dif_adc_ctrl_filter_t filter, dif_toggle_t *is_enabled)
 Gets the enablement of generating system wakeups on a filter match. More...
 
OT_WARN_UNUSED_RESULT dif_result_t dif_adc_ctrl_irq_cause_set_enabled (const dif_adc_ctrl_t *adc_ctrl, uint32_t causes, dif_toggle_t enabled)
 Sets the enablement of generating a debug_cable IRQ for given cause(s). More...
 
OT_WARN_UNUSED_RESULT dif_result_t dif_adc_ctrl_irq_cause_get_enabled (const dif_adc_ctrl_t *adc_ctrl, uint32_t *enabled_causes)
 Gets the causes that will generate a debug_cable IRQ. More...
 
dif_result_t dif_adc_ctrl_wait_cdc_sync (const dif_adc_ctrl_t *adc_ctrl, uint32_t aon_freq_hz)
 Wait enough time for CDC synchronization between block and CSRs. More...
 

Detailed Description

ADC Controller Device Interface Functions

Definition in file dif_adc_ctrl.h.


Data Structure Documentation

◆ dif_adc_ctrl_config

struct dif_adc_ctrl_config

Runtime configuration for an ADC Controller.

Definition at line 162 of file dif_adc_ctrl.h.

Data Fields
dif_adc_ctrl_mode_t mode The sampling mode to configure the ADC Controller in.
uint8_t num_low_power_samples The number of filter-matching samples to count in Low Power Scan mode before switching to Normal Power Scan mode.

Only relevant in Low Power Scan mode.

uint16_t num_normal_power_samples The number of filter-matching samples to count in Normal Power Scan mode before triggering a system wakeup and/or interrupt.
uint8_t power_up_time_aon_cycles The time to allow the ADC to power up.

Units: always-on clock cycles

uint32_t wake_up_time_aon_cycles The sampling period when in Low Power Scan mode, i.e., how often the ADC Controller wakes up the ADC to take a sample.

Units: always-on clock cycles

Only relevant in Low Power Scan mode.

◆ dif_adc_ctrl_filter_config

struct dif_adc_ctrl_filter_config

Runtime configuration for an ADC Controller filter.

Definition at line 199 of file dif_adc_ctrl.h.

Data Fields
dif_adc_ctrl_filter_t filter The ADC Controller filter this configuration applies to.
bool generate_irq_on_match Whether to generate a debug_cable interrupt on a filter match after saturating the num_normal_power_samples threshold in Normal Power Scan mode.
bool generate_wakeup_on_match Whether to generate a system wakeup on a filter match after saturating the num_normal_power_samples threshold in Normal Power Scan mode.
bool in_range Where a filter hit is classfied as an (inclusive) in-range hit, or (exclusive) out-of-range hit.
uint16_t max_voltage The maximum voltage (inclusive) of the range defined by this filter.

Valid range: [0, 1024) Units: 2.148 mV (i.e., range / 2 ^ 10)

uint16_t min_voltage The minimum voltage (inclusive) of the range defined by this filter.

Valid range: [0, 1024) Units: 2.148 mV (i.e., range / 2 ^ 10)

Macro Definition Documentation

◆ DIF_ADC_CTRL_CHANNEL_ENUM_INIT_

#define DIF_ADC_CTRL_CHANNEL_ENUM_INIT_ (   channel_)    kDifAdcCtrlChannel##channel_ = channel_,

Helper macro for defining a dif_adc_ctrl_channel_t enumeration constant.

@channel_ ADC Controller channel of the enumeration constant.

Definition at line 49 of file dif_adc_ctrl.h.

◆ DIF_ADC_CTRL_CHANNEL_LIST

#define DIF_ADC_CTRL_CHANNEL_LIST (   X)
Value:
X(0) \
X(1)

Helper X macro for defining enums and case statements related to ADC Controller channels.

If an additional channel is ever added to the hardware, this list can be updated.

Definition at line 26 of file dif_adc_ctrl.h.

◆ DIF_ADC_CTRL_FILTER_ENUM_INIT_

#define DIF_ADC_CTRL_FILTER_ENUM_INIT_ (   filter_)    kDifAdcCtrlFilter##filter_ = filter_,

Helper macro for defining a dif_adc_ctrl_filter_t enumeration constant.

@filter_ ADC Controller filter of the enumeration constant.

Definition at line 65 of file dif_adc_ctrl.h.

◆ DIF_ADC_CTRL_FILTER_LIST

#define DIF_ADC_CTRL_FILTER_LIST (   X)
Value:
X(0) \
X(1) \
X(2) \
X(3) \
X(4) \
X(5) \
X(6) \
X(7)

Helper X macro for defining enums and case statements related to ADC Controller filters.

If an additional filter is ever added to the hardware, this list can be updated.

Definition at line 35 of file dif_adc_ctrl.h.

◆ DIF_ADC_CTRL_IRQ_CAUSE_ENUM_INIT_

#define DIF_ADC_CTRL_IRQ_CAUSE_ENUM_INIT_ (   filter_cause_)    kDifAdcCtrlIrqCauseFilter##filter_cause_ = 1U << filter_cause_,

Helper macro for defining a dif_adc_ctrl_irq_cause_t enumeration constant.

@filter_cause_ ADC Controller IRQ filter cause of the enumeration constant.

Definition at line 87 of file dif_adc_ctrl.h.

Typedef Documentation

◆ dif_adc_ctrl_filter_t

An ADC Controller filter.

Each channel has a separate instance of each filter. For example, if there are two channels and eight filters, there would be a total of 16 filter instances that may be configured.

◆ dif_adc_ctrl_irq_cause_t

An ADC Controller IRQ cause.

The ADC Controller can only generate a single interrupt (the debug_cable interrupt). However, depending on how the ADC Controller is configured, there are several causes that could trigger this interrupt. These include filter matches (when in Normal Power Scan mode), or sample completion (when in Oneshot mode).

Enumeration Type Documentation

◆ dif_adc_ctrl_filter

An ADC Controller filter.

Each channel has a separate instance of each filter. For example, if there are two channels and eight filters, there would be a total of 16 filter instances that may be configured.

Definition at line 75 of file dif_adc_ctrl.h.

◆ dif_adc_ctrl_irq_cause

An ADC Controller IRQ cause.

The ADC Controller can only generate a single interrupt (the debug_cable interrupt). However, depending on how the ADC Controller is configured, there are several causes that could trigger this interrupt. These include filter matches (when in Normal Power Scan mode), or sample completion (when in Oneshot mode).

Enumerator
kDifAdcCtrlIrqCauseTrans 

Sample ready cause in Oneshot mode.

kDifAdcCtrlIrqCauseOneshot 

Sample ready cause in Oneshot mode.

kDifAdcCtrlIrqCauseAll 

All IRQ causes ORed together.

This is useful when clearing all IRQ causes at once, to initialize the ADC Controller.

Definition at line 99 of file dif_adc_ctrl.h.

◆ dif_adc_ctrl_mode

Operation mode of the ADC Controller.

Enumerator
kDifAdcCtrlLowPowerScanMode 

Low Power (Continuous) Scan mode.

In Low Power Scan mode, the ADC periodically samples enabled channels, and upon matching a set of enabled filters, a set number of times, will transition to Normal Power Scan mode. If no filters are enabled, then the ADC controller will never transition to Normal Power Scan mode.

kDifAdcCtrlNormalPowerScanMode 

Normal Power (Continuous) Scan mode.

In Normal Power Scan mode, the ADC samples enabled channels as fast as possible, and upon matching a set of enabled filters, a set number of consecutive times, may trigger a system wakeup and/or IRQ. Similar to Low Power Scan mode, if no filters are enabled, then a system wakeup and/or IRQ will never be triggered.

kDifAdcCtrlOneshotMode 

Oneshot mode.

In Oneshot mode, an ADC channel is triggered to take a single sample, upon being enabled, and optionally, raises an interrupt upon completion. Unlike the Scan modes, in Oneshot mode, the ADC Controller does not attempt to filter samples. Rather, an IRQ may be raised immediately upon the sample being ready, regardless of what the sample is. After the sample is completed the ADC is powered down, until another sample is triggered, either by toggling the channel's enable bit on and off, or by resetting the sampling FSM.

Definition at line 124 of file dif_adc_ctrl.h.

Function Documentation

◆ dif_adc_ctrl_configure()

OT_WARN_UNUSED_RESULT dif_result_t dif_adc_ctrl_configure ( const dif_adc_ctrl_t adc_ctrl,
dif_adc_ctrl_config_t  config 
)

Configures an ADC Controller.

Parameters
adc_ctrlAn adc_ctrl handle.
configRuntime configuration parameters.
Returns
The result of the operation.

Definition at line 29 of file dif_adc_ctrl.c.

◆ dif_adc_ctrl_configure_filter()

OT_WARN_UNUSED_RESULT dif_result_t dif_adc_ctrl_configure_filter ( const dif_adc_ctrl_t adc_ctrl,
dif_adc_ctrl_channel_t  channel,
dif_adc_ctrl_filter_config_t  config,
dif_toggle_t  enabled 
)

Configures a channel filter.

This should be invoked for each desired filter before the sampling sequence is enabled via dif_adc_ctrl_set_enabled().

This only applies in Low / Normal Power Scan sampling modes.

Parameters
adc_ctrlAn adc_ctrl handle.
channelThe channel of the filter to configure.
configRuntime configuration parameters for the filter.
enabledThe enablement state to configure the filter in.
Returns
The result of the operation.

Definition at line 86 of file dif_adc_ctrl.c.

◆ dif_adc_ctrl_filter_get_enabled()

OT_WARN_UNUSED_RESULT dif_result_t dif_adc_ctrl_filter_get_enabled ( const dif_adc_ctrl_t adc_ctrl,
dif_adc_ctrl_channel_t  channel,
dif_adc_ctrl_filter_t  filter,
dif_toggle_t enabled 
)

Gets the enablement state of the specified filter for the specified channel.

Parameters
adc_ctrlAn adc_ctrl handle.
channelThe channel the filter resides in.
filterThe filter to get the enablement state of.
[out]is_enabledThe enablement state of the filter.
Returns
The result of the operation.

Definition at line 316 of file dif_adc_ctrl.c.

◆ dif_adc_ctrl_filter_match_wakeup_get_enabled()

OT_WARN_UNUSED_RESULT dif_result_t dif_adc_ctrl_filter_match_wakeup_get_enabled ( const dif_adc_ctrl_t adc_ctrl,
dif_adc_ctrl_filter_t  filter,
dif_toggle_t is_enabled 
)

Gets the enablement of generating system wakeups on a filter match.

Parameters
adc_ctrlAn adc_ctrl handle.
filterA filter to enable wakeup triggering for.
[out]is_enabledThe enablement state retrieved.
Returns
The result of the operation.

Definition at line 469 of file dif_adc_ctrl.c.

◆ dif_adc_ctrl_filter_match_wakeup_set_enabled()

OT_WARN_UNUSED_RESULT dif_result_t dif_adc_ctrl_filter_match_wakeup_set_enabled ( const dif_adc_ctrl_t adc_ctrl,
dif_adc_ctrl_filter_t  filter,
dif_toggle_t  enabled 
)

Sets the enablement of generating system wakeups on a filter match.

Only relevant in Normal Power Scan mode (and Low Power Scan mode, which can transition to Normal Power Scan mode).

Parameters
adc_ctrlAn adc_ctrl handle.
filterA filter to enable wakeup triggering for.
enabledThe enablement state to set.
Returns
The result of the operation.

Definition at line 451 of file dif_adc_ctrl.c.

◆ dif_adc_ctrl_filter_set_enabled()

OT_WARN_UNUSED_RESULT dif_result_t dif_adc_ctrl_filter_set_enabled ( const dif_adc_ctrl_t adc_ctrl,
dif_adc_ctrl_channel_t  channel,
dif_adc_ctrl_filter_t  filter,
dif_toggle_t  enabled 
)

Sets the enablement state of the specified filter for the specified channel.

Parameters
adc_ctrlAn adc_ctrl handle.
channelThe channel the filter resides in.
filterThe filter to set the enablement state of.
enabledThe enablement state to configure the filter in.
Returns
The result of the operation.

Definition at line 289 of file dif_adc_ctrl.c.

◆ dif_adc_ctrl_get_enabled()

OT_WARN_UNUSED_RESULT dif_result_t dif_adc_ctrl_get_enabled ( const dif_adc_ctrl_t adc_ctrl,
dif_toggle_t is_enabled 
)

Gets the enablement state of the ADC Controller.

If the ADC Controller is enabled, it is powered up, or being powered up.

Parameters
adc_ctrlAn adc_ctrl handle.
[out]is_enabledThe enablement state of the ADC Controller.
Returns
The result of the operation.

Definition at line 197 of file dif_adc_ctrl.c.

◆ dif_adc_ctrl_get_filter_status()

OT_WARN_UNUSED_RESULT dif_result_t dif_adc_ctrl_get_filter_status ( const dif_adc_ctrl_t adc_ctrl,
uint32_t *  status 
)

Gets the filter status.

Parameters
adc_ctrlAn adc_ctrl handle.
[out]statusThe current filter status.
Returns
The result of the operation.

Definition at line 422 of file dif_adc_ctrl.c.

◆ dif_adc_ctrl_get_latest_value()

OT_WARN_UNUSED_RESULT dif_result_t dif_adc_ctrl_get_latest_value ( const dif_adc_ctrl_t adc_ctrl,
dif_adc_ctrl_channel_t  channel,
uint16_t *  value 
)

Get the latest sampled value from the specified channel.

Since in Normal Power Scan mode, sampling continues even after an IRQ has been raised, the value returned by this function may be different than the value returned by dif_adc_ctrl_get_irq_value().

Values are 10-bits in the range from 0V to 2.2V. Based on this, the resolution (and units) of the sample are in increments of 2.148mV.

Parameters
adc_ctrlAn adc_ctrl handle.
channelThe channel to read the sample from.
[out]valueThe value of the sample.
Returns
The result of the operation.

Definition at line 370 of file dif_adc_ctrl.c.

◆ dif_adc_ctrl_get_triggered_value()

OT_WARN_UNUSED_RESULT dif_result_t dif_adc_ctrl_get_triggered_value ( const dif_adc_ctrl_t adc_ctrl,
dif_adc_ctrl_channel_t  channel,
uint16_t *  value 
)

Get the sampled value from the specified channel that triggered the IRQ.

Values are 10-bits in the range from 0V to 2.2V. Based on this, the resolution (and units) of the sample are in increments of 2.148mV.

Parameters
adc_ctrlAn adc_ctrl handle.
channelThe channel to read the sample from.
[out]valueThe value of the sample.
Returns
The result of the operation.

Definition at line 341 of file dif_adc_ctrl.c.

◆ dif_adc_ctrl_irq_cause_get_enabled()

OT_WARN_UNUSED_RESULT dif_result_t dif_adc_ctrl_irq_cause_get_enabled ( const dif_adc_ctrl_t adc_ctrl,
uint32_t *  enabled_causes 
)

Gets the causes that will generate a debug_cable IRQ.

Parameters
adc_ctrlAn adc_ctrl handle.
[out]enabled_causesCauses (one or more dif_adc_ctrl_irq_cause_ts ORed together) that will generate the debug_cable IRQ.
Returns
The result of the operation.

Definition at line 506 of file dif_adc_ctrl.c.

◆ dif_adc_ctrl_irq_cause_set_enabled()

OT_WARN_UNUSED_RESULT dif_result_t dif_adc_ctrl_irq_cause_set_enabled ( const dif_adc_ctrl_t adc_ctrl,
uint32_t  causes,
dif_toggle_t  enabled 
)

Sets the enablement of generating a debug_cable IRQ for given cause(s).

Causes can be filter matches (in Normal Power Scan mode), or when a sample is complete (in Oneshot mode).

Parameters
adc_ctrlAn adc_ctrl handle.
causesCauses (one or more dif_adc_ctrl_irq_cause_ts ORed together) to generate the debug_cable IRQ for.
enabledThe enablement state to set.
Returns
The result of the operation.

Definition at line 485 of file dif_adc_ctrl.c.

◆ dif_adc_ctrl_irq_clear_causes()

OT_WARN_UNUSED_RESULT dif_result_t dif_adc_ctrl_irq_clear_causes ( const dif_adc_ctrl_t adc_ctrl,
uint32_t  causes 
)

Clears the cause(s) of a debug_cable IRQ.

TODO(lowRISC/opentitan:#11354): future releases of the HW should hide the filter and interrupt status registers behind the standardized IRQ registers. For now, the autogenerated dif_adc_ctrl_irq_acknowledge[_all]() DIF may be used to clear the main IRQ status register, while this DIF may be used to clear the local cause / filter status registers.

Parameters
adc_ctrlAn adc_ctrl handle.
causesThe causes of the IRQ (one or more dif_adc_ctrl_irq_cause_ts ORed together).
Returns
The result of the operation.

Definition at line 433 of file dif_adc_ctrl.c.

◆ dif_adc_ctrl_irq_get_causes()

OT_WARN_UNUSED_RESULT dif_result_t dif_adc_ctrl_irq_get_causes ( const dif_adc_ctrl_t adc_ctrl,
uint32_t *  causes 
)

Gets the cause(s) of a debug_cable IRQ.

IRQs can be triggered by filter matches in Normal Power Scan mode (after saturating the num_normal_power_samples threshold), or after a single sample capture in Oneshot mode.

Parameters
adc_ctrlAn adc_ctrl handle.
[out]causesThe causes of the IRQ (one or more dif_adc_ctrl_irq_cause_ts ORed together).
Returns
The result of the operation.

Definition at line 410 of file dif_adc_ctrl.c.

◆ dif_adc_ctrl_reset()

OT_WARN_UNUSED_RESULT dif_result_t dif_adc_ctrl_reset ( const dif_adc_ctrl_t adc_ctrl)

Reset all ADC Controller FSMs and counters, and if enabled, begin sampling sequence.

Parameters
adc_ctrlAn adc_ctrl handle.
Returns
The result of the operation.

Definition at line 399 of file dif_adc_ctrl.c.

◆ dif_adc_ctrl_set_enabled()

OT_WARN_UNUSED_RESULT dif_result_t dif_adc_ctrl_set_enabled ( const dif_adc_ctrl_t adc_ctrl,
dif_toggle_t  enabled 
)

Sets the enablement state of the ADC Controller.

Enabling the ADC Controller powers it up, while disabling the ADC Controller powers it down and resets the sampling FSM. After powering up, sampling begins, regardless of the operation mode.

Parameters
adc_ctrlAn adc_ctrl handle.
enabledThe enablement state to configure the ADC Controller in.
Returns
The result of the operation.

Definition at line 180 of file dif_adc_ctrl.c.

◆ dif_adc_ctrl_wait_cdc_sync()

dif_result_t dif_adc_ctrl_wait_cdc_sync ( const dif_adc_ctrl_t adc_ctrl,
uint32_t  aon_freq_hz 
)

Wait enough time for CDC synchronization between block and CSRs.

Wait long enough for any CDC synchronization between the AON part of the block and the CSRs to be complete. This is particularly important for the FILTER_STATUS register: this register can be updated by the HW and any update may take a while to become visible by the SW.

Parameters
adc_ctrlAn adc_ctrl handle.
aon_freq_hzFrequency of the AON clock in Hz.
Returns
The result of the operation.

Definition at line 518 of file dif_adc_ctrl.c.