Platform drivers for Mbed.
Dependents: EVAL-CN0535-FMCZ EVAL-CN0535-FMCZ EVAL-AD568x-AD569x EVAL-AD7606 ... more
adc_data_capture.c File Reference
ADC common data capture interface for IIO based applications. More...
Go to the source code of this file.
Functions | |
int32_t | read_single_sample (uint8_t input_chn, uint32_t *raw_data) |
Function to read the single ADC sample (raw data) for input channel. | |
void | store_requested_samples_count (size_t bytes, uint8_t sample_size_in_bytes) |
Function to store the number of actul requested ADC samples from IIO client. | |
static void | read_acquired_samples (char *output_buffer, size_t samples_to_read, uint8_t sample_size_in_bytes) |
Function to read acquired samples into buffer without IIO request timeout. | |
size_t | read_buffered_data (char *pbuf, size_t bytes, size_t offset, uint32_t active_chns_mask, uint8_t sample_size_in_bytes) |
Function to read and align the ADC buffered raw data. | |
void | data_capture_callback (void *ctx, uint32_t event, void *extra) |
This is an ISR (Interrupt Service Routine) to monitor end of conversion event. | |
static void | reset_data_capture (void) |
Reset the data capture specific variables. | |
void | start_data_capture (uint32_t ch_mask, uint8_t num_of_chns) |
Function to trigger ADC conversion for new READBUFF request from IIO client (for active channels) | |
void | stop_data_capture (void) |
Function to stop ADC data capture. |
Detailed Description
ADC common data capture interface for IIO based applications.
This module handles the ADC data capturing for IIO client
Copyright (c) 2021 Analog Devices, Inc. All rights reserved.
This software is proprietary to Analog Devices, Inc. and its licensors. By using this software you agree to the terms of the associated Analog Devices Software License Agreement.
Definition in file adc_data_capture.c.
Function Documentation
void data_capture_callback | ( | void * | ctx, |
uint32_t | event, | ||
void * | extra | ||
) |
This is an ISR (Interrupt Service Routine) to monitor end of conversion event.
- Parameters:
-
*ctx[in] - Callback context (unused) event[in] - Callback event (unused) extra[in] - Callback extra (unused)
- Returns:
- none
This is an Interrupt callback function/ISR invoked in synchronous/asynchronous manner depending upon the application implementation. The conversion results are read into acquisition buffer and control continue to sample next channel. This continues until conversion is stopped (through IIO client command)
- Note:
- This function also handles the logic to align the first channel data after every 'n' sample transmission. This is required to visualize data properly on IIO client application.
Definition at line 268 of file adc_data_capture.c.
static void read_acquired_samples | ( | char * | output_buffer, |
size_t | samples_to_read, | ||
uint8_t | sample_size_in_bytes | ||
) | [static] |
Function to read acquired samples into buffer without IIO request timeout.
- Parameters:
-
input_buffer[in] - Input data acquisition buffer output_buffer[in,out] - Output data buffer samples_to_read[in] - Number of samples to read sample_size_in_bytes[in] - Size of each sample in bytes (eqv to ADC resolution)
- Returns:
- none
Definition at line 180 of file adc_data_capture.c.
size_t read_buffered_data | ( | char * | pbuf, |
size_t | bytes, | ||
size_t | offset, | ||
uint32_t | active_chns_mask, | ||
uint8_t | sample_size_in_bytes | ||
) |
Function to read and align the ADC buffered raw data.
- Parameters:
-
device[in]- Device instance pbuf[out] - Buffer to load ADC raw data bytes[in] - Number of bytes to be read active_chns_mask[in] - Active channels mask
- Returns:
- Number of bytes read
Definition at line 218 of file adc_data_capture.c.
int32_t read_single_sample | ( | uint8_t | input_chn, |
uint32_t * | raw_data | ||
) |
Function to read the single ADC sample (raw data) for input channel.
- Parameters:
-
input_chn[in] - Input channel to sample and read data for raw_data[in,out]- ADC raw data
- Returns:
- SUCCESS in case of success, FAILURE otherwise
Definition at line 111 of file adc_data_capture.c.
static void reset_data_capture | ( | void | ) | [static] |
Reset the data capture specific variables.
- Returns:
- none
Definition at line 321 of file adc_data_capture.c.
void start_data_capture | ( | uint32_t | ch_mask, |
uint8_t | num_of_chns | ||
) |
Function to trigger ADC conversion for new READBUFF request from IIO client (for active channels)
- Parameters:
-
ch_mask[in] - Channels to enable for data capturing num_of_chns[in] - ADC channel count
- Returns:
- none
Definition at line 345 of file adc_data_capture.c.
void stop_data_capture | ( | void | ) |
void store_requested_samples_count | ( | size_t | bytes, |
uint8_t | sample_size_in_bytes | ||
) |
Function to store the number of actul requested ADC samples from IIO client.
- Parameters:
-
bytes[in] - Number of bytes corresponding to requested samples sample_size_in_bytes[in] - Size of each sample in bytes (eqv to ADC resolution)
- Returns:
- none
- Note:
- The information about sample and buffer size is required for continuous data acquisition
Definition at line 153 of file adc_data_capture.c.
Generated on Wed Jul 13 2022 14:37:51 by 1.7.2