Platform drivers for Mbed.

Dependents:   EVAL-CN0535-FMCZ EVAL-CN0535-FMCZ EVAL-AD568x-AD569x EVAL-AD7606 ... more

Committer:
mahphalke
Date:
Tue Jul 13 13:58:07 2021 +0530
Revision:
17:af1f2416dd26
Child:
18:5ae03a197e59
Restructured the directory- Removed inc/ and src/ folders and moved all source/header files at root

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mahphalke 17:af1f2416dd26 1 /***************************************************************************//**
mahphalke 17:af1f2416dd26 2 * @file adc_data_capture.h
mahphalke 17:af1f2416dd26 3 * @brief Header for ADC data capture interfaces
mahphalke 17:af1f2416dd26 4 ********************************************************************************
mahphalke 17:af1f2416dd26 5 * Copyright (c) 2021 Analog Devices, Inc.
mahphalke 17:af1f2416dd26 6 * All rights reserved.
mahphalke 17:af1f2416dd26 7 *
mahphalke 17:af1f2416dd26 8 * This software is proprietary to Analog Devices, Inc. and its licensors.
mahphalke 17:af1f2416dd26 9 * By using this software you agree to the terms of the associated
mahphalke 17:af1f2416dd26 10 * Analog Devices Software License Agreement.
mahphalke 17:af1f2416dd26 11 *******************************************************************************/
mahphalke 17:af1f2416dd26 12
mahphalke 17:af1f2416dd26 13 #ifndef _ADC_DATA_CAPTURE_H_
mahphalke 17:af1f2416dd26 14 #define _ADC_DATA_CAPTURE_H_
mahphalke 17:af1f2416dd26 15
mahphalke 17:af1f2416dd26 16 /******************************************************************************/
mahphalke 17:af1f2416dd26 17 /***************************** Include Files **********************************/
mahphalke 17:af1f2416dd26 18 /******************************************************************************/
mahphalke 17:af1f2416dd26 19
mahphalke 17:af1f2416dd26 20 #include <stdint.h>
mahphalke 17:af1f2416dd26 21 #include <stdbool.h>
mahphalke 17:af1f2416dd26 22 #include <stddef.h>
mahphalke 17:af1f2416dd26 23
mahphalke 17:af1f2416dd26 24 /******************************************************************************/
mahphalke 17:af1f2416dd26 25 /********************** Macros and Constants Definition ***********************/
mahphalke 17:af1f2416dd26 26 /******************************************************************************/
mahphalke 17:af1f2416dd26 27
mahphalke 17:af1f2416dd26 28 /******************************************************************************/
mahphalke 17:af1f2416dd26 29 /********************** Variables and User Defined Data Types *****************/
mahphalke 17:af1f2416dd26 30 /******************************************************************************/
mahphalke 17:af1f2416dd26 31
mahphalke 17:af1f2416dd26 32 /**
mahphalke 17:af1f2416dd26 33 * @struct data_capture_ops
mahphalke 17:af1f2416dd26 34 * @brief Structure holding function pointers that points to device specific
mahphalke 17:af1f2416dd26 35 * data capture functions
mahphalke 17:af1f2416dd26 36 */
mahphalke 17:af1f2416dd26 37 struct data_capture_ops {
mahphalke 17:af1f2416dd26 38 /* Save the previous active channels value */
mahphalke 17:af1f2416dd26 39 int32_t (*save_prev_active_chns)(void);
mahphalke 17:af1f2416dd26 40 /* Restore (enable) the previous active channels */
mahphalke 17:af1f2416dd26 41 int32_t (*restore_prev_active_chns)(void);
mahphalke 17:af1f2416dd26 42 /* Enable ADC current (user input) channel */
mahphalke 17:af1f2416dd26 43 int32_t (*enable_curr_chn)(uint32_t chn);
mahphalke 17:af1f2416dd26 44 /* Disable ADC current (user input) channel */
mahphalke 17:af1f2416dd26 45 int32_t (*disable_curr_chn)(uint32_t chn);
mahphalke 17:af1f2416dd26 46 /* Disable all ADC channels */
mahphalke 17:af1f2416dd26 47 int32_t(*disable_all_chns)(void);
mahphalke 17:af1f2416dd26 48 /* Enable conversion for single sample read */
mahphalke 17:af1f2416dd26 49 int32_t (*enable_single_read_conversion)(void);
mahphalke 17:af1f2416dd26 50 /* Enable conversion for continuous sample read */
mahphalke 17:af1f2416dd26 51 int32_t (*enable_continuous_read_conversion)(uint32_t chn_mask);
mahphalke 17:af1f2416dd26 52 /* Disable conversion */
mahphalke 17:af1f2416dd26 53 int32_t (*disable_conversion)(void);
mahphalke 17:af1f2416dd26 54 /* Wait for conversion to finish on enabled channels and read conversion data */
mahphalke 17:af1f2416dd26 55 int32_t (*wait_for_conv_and_read_data)(uint32_t *read_data, uint8_t chn);
mahphalke 17:af1f2416dd26 56 /* Read ADC raw sample/data */
mahphalke 17:af1f2416dd26 57 int32_t (*read_sampled_data)(uint32_t *read_data, uint8_t buff_chn_indx);
mahphalke 17:af1f2416dd26 58 /* Trigger next continuous conversion sample read */
mahphalke 17:af1f2416dd26 59 int32_t (*trigger_next_cont_conversion)(void);
mahphalke 17:af1f2416dd26 60 };
mahphalke 17:af1f2416dd26 61
mahphalke 17:af1f2416dd26 62 /******************************************************************************/
mahphalke 17:af1f2416dd26 63 /************************ Public Declarations *********************************/
mahphalke 17:af1f2416dd26 64 /******************************************************************************/
mahphalke 17:af1f2416dd26 65
mahphalke 17:af1f2416dd26 66 void save_data_capture_ops_instance(struct data_capture_ops *ops);
mahphalke 17:af1f2416dd26 67 void start_data_capture(uint32_t ch_mask, uint8_t num_of_chns);
mahphalke 17:af1f2416dd26 68 void data_capture_callback(void *ctx, uint32_t event, void *extra);
mahphalke 17:af1f2416dd26 69 void stop_data_capture(void);
mahphalke 17:af1f2416dd26 70 size_t buffered_data_read(char *pbuf, size_t bytes,
mahphalke 17:af1f2416dd26 71 size_t offset, uint32_t active_chns_mask, uint8_t sample_size_in_bytes);
mahphalke 17:af1f2416dd26 72 void store_requested_samples_count(size_t bytes, uint8_t sample_size_in_bytes);
mahphalke 17:af1f2416dd26 73 int32_t single_data_read(uint8_t input_chn, uint32_t *raw_data);
mahphalke 17:af1f2416dd26 74
mahphalke 17:af1f2416dd26 75 #endif /* _ADC_DATA_CAPTURE_H_ */