Forked repo of Platform Drivers- Analog Devices
Diff: adc_data_capture.h
- Revision:
- 17:af1f2416dd26
- Child:
- 18:5ae03a197e59
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/adc_data_capture.h Tue Jul 13 13:58:07 2021 +0530 @@ -0,0 +1,75 @@ +/***************************************************************************//** + * @file adc_data_capture.h + * @brief Header for ADC data capture interfaces +******************************************************************************** + * 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. +*******************************************************************************/ + +#ifndef _ADC_DATA_CAPTURE_H_ +#define _ADC_DATA_CAPTURE_H_ + +/******************************************************************************/ +/***************************** Include Files **********************************/ +/******************************************************************************/ + +#include <stdint.h> +#include <stdbool.h> +#include <stddef.h> + +/******************************************************************************/ +/********************** Macros and Constants Definition ***********************/ +/******************************************************************************/ + +/******************************************************************************/ +/********************** Variables and User Defined Data Types *****************/ +/******************************************************************************/ + +/** + * @struct data_capture_ops + * @brief Structure holding function pointers that points to device specific + * data capture functions + */ +struct data_capture_ops { + /* Save the previous active channels value */ + int32_t (*save_prev_active_chns)(void); + /* Restore (enable) the previous active channels */ + int32_t (*restore_prev_active_chns)(void); + /* Enable ADC current (user input) channel */ + int32_t (*enable_curr_chn)(uint32_t chn); + /* Disable ADC current (user input) channel */ + int32_t (*disable_curr_chn)(uint32_t chn); + /* Disable all ADC channels */ + int32_t(*disable_all_chns)(void); + /* Enable conversion for single sample read */ + int32_t (*enable_single_read_conversion)(void); + /* Enable conversion for continuous sample read */ + int32_t (*enable_continuous_read_conversion)(uint32_t chn_mask); + /* Disable conversion */ + int32_t (*disable_conversion)(void); + /* Wait for conversion to finish on enabled channels and read conversion data */ + int32_t (*wait_for_conv_and_read_data)(uint32_t *read_data, uint8_t chn); + /* Read ADC raw sample/data */ + int32_t (*read_sampled_data)(uint32_t *read_data, uint8_t buff_chn_indx); + /* Trigger next continuous conversion sample read */ + int32_t (*trigger_next_cont_conversion)(void); +}; + +/******************************************************************************/ +/************************ Public Declarations *********************************/ +/******************************************************************************/ + +void save_data_capture_ops_instance(struct data_capture_ops *ops); +void start_data_capture(uint32_t ch_mask, uint8_t num_of_chns); +void data_capture_callback(void *ctx, uint32_t event, void *extra); +void stop_data_capture(void); +size_t buffered_data_read(char *pbuf, size_t bytes, + size_t offset, uint32_t active_chns_mask, uint8_t sample_size_in_bytes); +void store_requested_samples_count(size_t bytes, uint8_t sample_size_in_bytes); +int32_t single_data_read(uint8_t input_chn, uint32_t *raw_data); + +#endif /* _ADC_DATA_CAPTURE_H_ */