Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Infineon AutAnalog SAR ADC

Infineon AutAnalog SAR ADC extended API. More...

Typedefs

typedef void(* adc_ifx_autanalog_sar_fifo_callback_t) (const struct device *dev, uint32_t fifo_status, void *user_data)
 FIFO watermark interrupt callback type.

Functions

int adc_ifx_autanalog_sar_fir_read_result (const struct device *dev, uint8_t fir_idx, int32_t *result)
 Read the FIR filter output result.
int adc_ifx_autanalog_sar_fir_get_limit_status (const struct device *dev, uint8_t fir_idx, uint8_t *status)
 Get the FIR range-detection (limit) status bitmap.
int adc_ifx_autanalog_sar_fir_clear_limit_status (const struct device *dev, uint8_t fir_idx)
 Clear FIR range-detection (limit) status bits.
int adc_ifx_autanalog_sar_fir_load_coefficients (const struct device *dev, uint8_t fir_idx, const int16_t *coefficients, uint8_t num_coefficients)
 Load FIR filter coefficients at runtime.
int adc_ifx_autanalog_sar_fifo_read (const struct device *dev, uint8_t buf_idx, int32_t *data_out, uint16_t max_words)
 Read data from a FIFO buffer.
int adc_ifx_autanalog_sar_fifo_read_all (const struct device *dev, uint8_t buf_idx, int32_t *data_out)
 Read all data from a FIFO buffer.
int adc_ifx_autanalog_sar_fifo_read_chan_id (const struct device *dev, uint8_t buf_idx, uint8_t input, int32_t *data_out, uint8_t *chan_id_out)
 Read data and channel IDs from a FIFO buffer.
int adc_ifx_autanalog_sar_fifo_get_size (const struct device *dev, uint8_t buf_idx, uint16_t *size)
 Get the current fill level of a FIFO buffer.
int adc_ifx_autanalog_sar_fifo_set_callback (const struct device *dev, adc_ifx_autanalog_sar_fifo_callback_t callback, void *user_data)
 Register a callback for FIFO watermark interrupts.

Detailed Description

Infineon AutAnalog SAR ADC extended API.

Since
4.5
Version
1.0.0
Note
These vendor functions are not serialized against adc_read() and must not be called concurrently with an ADC conversion on the same device. They access the single shared SAR, and a call that overlaps an in-flight read (including an asynchronous adc_read_async()) can corrupt the conversion or the FIR configuration. Callers are responsible for ensuring no conversion is in progress, e.g. by invoking them from the same thread that performs the reads.

Typedef Documentation

◆ adc_ifx_autanalog_sar_fifo_callback_t

typedef void(* adc_ifx_autanalog_sar_fifo_callback_t) (const struct device *dev, uint32_t fifo_status, void *user_data)

#include <zephyr/drivers/adc/infineon_autanalog_sar.h>

FIFO watermark interrupt callback type.

Called from ISR context when a FIFO watermark interrupt fires.

Parameters
devADC device.
fifo_statusFIFO interrupt status bitmask (CY_AUTANALOG_INT_FIFO_*).
user_dataUser data passed to adc_ifx_autanalog_sar_fifo_set_callback().

Function Documentation

◆ adc_ifx_autanalog_sar_fifo_get_size()

int adc_ifx_autanalog_sar_fifo_get_size ( const struct device * dev,
uint8_t buf_idx,
uint16_t * size )

#include <zephyr/drivers/adc/infineon_autanalog_sar.h>

Get the current fill level of a FIFO buffer.

Returns the number of data words currently stored in the specified FIFO buffer.

Parameters
devADC device (infineon,autanalog-sar-adc instance).
buf_idxFIFO buffer index (0 to 7, depending on split config).
sizePointer to store the number of words in the buffer.
Return values
0on success.
-EINVALif parameters are invalid.

◆ adc_ifx_autanalog_sar_fifo_read()

int adc_ifx_autanalog_sar_fifo_read ( const struct device * dev,
uint8_t buf_idx,
int32_t * data_out,
uint16_t max_words )

#include <zephyr/drivers/adc/infineon_autanalog_sar.h>

Read data from a FIFO buffer.

Reads up to max_words conversion results from the specified FIFO buffer.

Parameters
devADC device (infineon,autanalog-sar-adc instance).
buf_idxFIFO buffer index (0 to 7, depending on split config).
data_outPointer to the output buffer for 32-bit signed results.
max_wordsMaximum number of words to read.
Return values
>=0Number of words actually read.
-EINVALif parameters are invalid.

◆ adc_ifx_autanalog_sar_fifo_read_all()

int adc_ifx_autanalog_sar_fifo_read_all ( const struct device * dev,
uint8_t buf_idx,
int32_t * data_out )

#include <zephyr/drivers/adc/infineon_autanalog_sar.h>

Read all data from a FIFO buffer.

Drains the entire contents of the specified FIFO buffer into the output array. The caller must ensure that data_out is large enough to hold the maximum buffer size (determined by the FIFO split configuration).

Parameters
devADC device (infineon,autanalog-sar-adc instance).
buf_idxFIFO buffer index (0 to 7, depending on split config).
data_outPointer to the output buffer for 32-bit signed results.
Return values
>=0Number of words actually read.
-EINVALif parameters are invalid.

◆ adc_ifx_autanalog_sar_fifo_read_chan_id()

int adc_ifx_autanalog_sar_fifo_read_chan_id ( const struct device * dev,
uint8_t buf_idx,
uint8_t input,
int32_t * data_out,
uint8_t * chan_id_out )

#include <zephyr/drivers/adc/infineon_autanalog_sar.h>

Read data and channel IDs from a FIFO buffer.

Reads all data from the specified FIFO buffer together with the associated channel identifiers. The fifo-chan-id property must be enabled on the parent SAR ADC node for channel IDs to be present in the FIFO data.

Parameters
devADC device (infineon,autanalog-sar-adc instance).
buf_idxFIFO buffer index (0 to 7, depending on split config).
inputADC input type (0 = GPIO, 1 = MUX) for channel ID decoding.
data_outPointer to the output buffer for 32-bit signed results.
chan_id_outPointer to the output buffer for channel ID values.
Return values
>=0Number of words actually read.
-EINVALif parameters are invalid.

◆ adc_ifx_autanalog_sar_fifo_set_callback()

int adc_ifx_autanalog_sar_fifo_set_callback ( const struct device * dev,
adc_ifx_autanalog_sar_fifo_callback_t callback,
void * user_data )

#include <zephyr/drivers/adc/infineon_autanalog_sar.h>

Register a callback for FIFO watermark interrupts.

When a FIFO buffer fill level reaches its configured threshold, the registered callback is invoked from ISR context with the FIFO interrupt status bitmask.

Parameters
devADC device (infineon,autanalog-sar-adc instance).
callbackCallback function, or NULL to unregister.
user_dataOpaque pointer passed to the callback.
Return values
0on success.

◆ adc_ifx_autanalog_sar_fir_clear_limit_status()

int adc_ifx_autanalog_sar_fir_clear_limit_status ( const struct device * dev,
uint8_t fir_idx )

#include <zephyr/drivers/adc/infineon_autanalog_sar.h>

Clear FIR range-detection (limit) status bits.

Parameters
devADC device (infineon,autanalog-sar-adc instance).
fir_idxFIR filter index (0 or 1).
Return values
0on success.
-EINVALif fir_idx is invalid.

◆ adc_ifx_autanalog_sar_fir_get_limit_status()

int adc_ifx_autanalog_sar_fir_get_limit_status ( const struct device * dev,
uint8_t fir_idx,
uint8_t * status )

#include <zephyr/drivers/adc/infineon_autanalog_sar.h>

Get the FIR range-detection (limit) status bitmap.

Returns a bitmask indicating which FIR filters have triggered their range-detection condition. Bit 0 corresponds to FIR 0, bit 1 to FIR 1.

Parameters
devADC device (infineon,autanalog-sar-adc instance).
fir_idxFIR filter index (0 or 1).
statusPointer to the returned status bitmask.
Return values
0on success.
-EINVALif parameters are invalid.

◆ adc_ifx_autanalog_sar_fir_load_coefficients()

int adc_ifx_autanalog_sar_fir_load_coefficients ( const struct device * dev,
uint8_t fir_idx,
const int16_t * coefficients,
uint8_t num_coefficients )

#include <zephyr/drivers/adc/infineon_autanalog_sar.h>

Load FIR filter coefficients at runtime.

Replaces the coefficient set for the specified FIR filter. The FIR filter must have been configured during initialization via the devicetree binding.

Warning
This rewrites the FIR hardware configuration that the read path shares. Do not call it while an ADC conversion is in progress on this device, or the conversion's FIR configuration may be torn.
Parameters
devADC device (infineon,autanalog-sar-adc instance).
fir_idxFIR filter index (0 or 1).
coefficientsPointer to the coefficient array (Q1.15 format).
num_coefficientsNumber of coefficients (1 to 64).
Return values
0on success.
-EINVALif parameters are invalid.
-EIOif the PDL operation failed.

◆ adc_ifx_autanalog_sar_fir_read_result()

int adc_ifx_autanalog_sar_fir_read_result ( const struct device * dev,
uint8_t fir_idx,
int32_t * result )

#include <zephyr/drivers/adc/infineon_autanalog_sar.h>

Read the FIR filter output result.

Parameters
devADC device (infineon,autanalog-sar-adc instance).
fir_idxFIR filter index (0 or 1).
resultPointer to store the 32-bit signed FIR output value.
Return values
0on success.
-EINVALif parameters are invalid.
-EBUSYif no FIR result is available yet.