no-OS
iio_axi_adc.h
Go to the documentation of this file.
1 /***************************************************************************/
34 #ifndef IIO_AXI_ADC_H_
35 #define IIO_AXI_ADC_H_
36 
37 /******************************************************************************/
38 /***************************** Include Files **********************************/
39 /******************************************************************************/
40 
41 #include "iio_types.h"
42 #include "axi_adc_core.h"
43 #include "axi_dmac.h"
44 
45 /******************************************************************************/
46 /*************************** Types Declarations *******************************/
47 /******************************************************************************/
48 
55  struct axi_adc *adc;
57  uint32_t mask;
59  struct axi_dmac *dmac;
61  void (*dcache_invalidate_range)(uint32_t address, uint32_t bytes_count);
63  int (*get_sampling_frequency)(struct axi_adc *dev, uint32_t chan,
64  uint64_t *sampling_freq_hz);
68  char (*ch_names)[20];
71 };
72 
79  struct axi_adc *rx_adc;
81  struct axi_dmac *rx_dmac;
83  void (*dcache_invalidate_range)(uint32_t address, uint32_t bytes_count);
85  int (*get_sampling_frequency)(struct axi_adc *dev, uint32_t chan,
86  uint64_t *sampling_freq_hz);
90 };
91 
92 /******************************************************************************/
93 /************************ Functions Declarations ******************************/
94 /******************************************************************************/
95 
96 /* Init iio. */
97 int32_t iio_axi_adc_init(struct iio_axi_adc_desc **desc,
98  struct iio_axi_adc_init_param *param);
99 
102  struct iio_device **dev_descriptor);
103 
104 /* Free the resources allocated by iio_axi_adc_init(). */
105 int32_t iio_axi_adc_remove(struct iio_axi_adc_desc *desc);
106 
107 #endif // IIO_AXI_ADC_H_
axi_adc_core.h
Driver for the Analog Devices AXI-ADC-CORE module.
iio_device::read_dev
int32_t(* read_dev)(void *dev, void *buff, uint32_t nb_samples)
Definition: iio_types.h:265
no_os_alloc.h
END_ATTRIBUTES_ARRAY
#define END_ATTRIBUTES_ARRAY
Definition: iio_types.h:116
iio_channel
Struct describing the scan type.
Definition: iio_types.h:168
scan_type::sign
char sign
Definition: iio_types.h:153
iio_device::channels
struct iio_channel * channels
Definition: iio_types.h:254
iio_axi_adc_desc::dev_descriptor
struct iio_device dev_descriptor
Definition: iio_axi_adc.h:66
iio_ch_info
Structure holding channel attributess.
Definition: iio_types.h:103
iio_axi_adc_init_param::rx_dmac
struct axi_dmac * rx_dmac
Definition: iio_axi_adc.h:81
axi_dmac_transfer_wait_completion
int32_t axi_dmac_transfer_wait_completion(struct axi_dmac *dmac, uint32_t timeout_ms)
Definition: axi_dmac.c:525
scan_type::storagebits
uint8_t storagebits
Definition: iio_types.h:157
NO_OS_IS_ERR_VALUE
#define NO_OS_IS_ERR_VALUE(x)
Definition: no_os_error.h:50
axi_adc
AXI ADC Device Descriptor.
Definition: axi_adc_core.h:122
iio_axi_adc_init_param::dcache_invalidate_range
void(* dcache_invalidate_range)(uint32_t address, uint32_t bytes_count)
Definition: iio_axi_adc.h:83
device
Definition: ad9361_util.h:69
iio_axi_adc_desc::dmac
struct axi_dmac * dmac
Definition: iio_axi_adc.h:59
iio_channel::ch_type
enum iio_chan_type ch_type
Definition: iio_types.h:172
iio_axi_adc_init_param
iio configuration.
Definition: iio_axi_adc.h:77
iio_axi_adc_desc::scan_type_common
struct scan_type * scan_type_common
Definition: iio_axi_adc.h:70
no_os_calloc
void * no_os_calloc(size_t nitems, size_t size)
Allocate memory and return a pointer to it, set memory to 0.
Definition: chibios_alloc.c:54
iio_axi_adc_remove
int32_t iio_axi_adc_remove(struct iio_axi_adc_desc *desc)
Release resources.
Definition: iio_axi_adc.c:530
iio_axi_adc_desc
iio_axi_adc_descriptor
Definition: iio_axi_adc.h:53
axi_adc_set_calib_phase
int32_t axi_adc_set_calib_phase(struct axi_adc *adc, uint32_t chan, int32_t val, int32_t val2)
Calibrate phase for specific AXI ADC channel.
Definition: axi_adc_core.c:433
axi_dma_transfer
Definition: axi_dmac.h:102
iio_channel::channel
int channel
Definition: iio_types.h:174
axi_adc::num_channels
uint8_t num_channels
Definition: axi_adc_core.h:130
iio_device::pre_enable
int32_t(* pre_enable)(void *dev, uint32_t mask)
Definition: iio_types.h:274
iio.h
Header file of iio.
iio_axi_adc_init
int32_t iio_axi_adc_init(struct iio_axi_adc_desc **desc, struct iio_axi_adc_init_param *init)
Registers a iio_axi_adc_desc for reading/writing and parameterization of axi_adc device.
Definition: iio_axi_adc.c:476
no_os_error.h
Error codes definition.
iio_attribute::name
const char * name
Definition: iio_types.h:131
iio_axi_adc_desc::get_sampling_frequency
int(* get_sampling_frequency)(struct axi_adc *dev, uint32_t chan, uint64_t *sampling_freq_hz)
Definition: iio_axi_adc.h:63
iio_channel::name
const char * name
Definition: iio_types.h:170
iio_axi_adc_prepare_transfer
int32_t iio_axi_adc_prepare_transfer(void *dev, uint32_t mask)
Update active channels.
Definition: iio_axi_adc.c:328
axi_adc_get_calib_bias
int32_t axi_adc_get_calib_bias(struct axi_adc *adc, uint32_t chan, int32_t *val, int32_t *val2)
Get the scale calibration values for AXI ADC channel.
Definition: axi_adc_core.c:521
axi_dmac.h
Driver for the Analog Devices AXI-DMAC core.
iio_attribute
Structure holding pointers to show and store functions.
Definition: iio_types.h:129
iio_axi_adc.h
Header file of iio_axi_adc.
iio_axi_adc_remove
int32_t iio_axi_adc_remove(struct iio_axi_adc_desc *desc)
Release resources.
Definition: iio_axi_adc.c:530
no_os_str_to_int32
int32_t no_os_str_to_int32(const char *str)
axi_adc_get_calib_phase
int32_t axi_adc_get_calib_phase(struct axi_adc *adc, uint32_t chan, int32_t *val, int32_t *val2)
Get the phase calibration values for AXI ADC channel.
Definition: axi_adc_core.c:449
IIO_VOLTAGE
@ IIO_VOLTAGE
Definition: iio_types.h:65
iio_axi_adc_desc::dcache_invalidate_range
void(* dcache_invalidate_range)(uint32_t address, uint32_t bytes_count)
Definition: iio_axi_adc.h:61
iio_axi_adc_init_param::scan_type_common
struct scan_type * scan_type_common
Definition: iio_axi_adc.h:89
iio_axi_adc_desc::mask
uint32_t mask
Definition: iio_axi_adc.h:57
axi_adc_get_calib_scale
int32_t axi_adc_get_calib_scale(struct axi_adc *adc, uint32_t chan, int32_t *val, int32_t *val2)
Get the scale calibration values for AXI ADC channel.
Definition: axi_adc_core.c:481
axi_adc_update_active_channels
int32_t axi_adc_update_active_channels(struct axi_adc *adc, uint32_t mask)
Update active AXI ADC channels.
Definition: axi_adc_core.c:539
iio_axi_adc_init
int32_t iio_axi_adc_init(struct iio_axi_adc_desc **desc, struct iio_axi_adc_init_param *param)
Registers a iio_axi_adc_desc for reading/writing and parameterization of axi_adc device.
Definition: iio_axi_adc.c:476
iio_types.h
Header file for iio_types.
iio_device::num_ch
uint16_t num_ch
Definition: iio_types.h:252
iio_channel::scan_type
struct scan_type * scan_type
Definition: iio_types.h:184
NO
@ NO
Definition: axi_dmac.h:98
no_os_free
void no_os_free(void *ptr)
Deallocate memory previously allocated by a call to no_os_calloc or no_os_malloc.
Definition: chibios_alloc.c:69
iio_axi_adc_init_param::rx_adc
struct axi_adc * rx_adc
Definition: iio_axi_adc.h:79
NULL
#define NULL
Definition: wrapper.h:64
iio_axi_adc_desc::ch_names
char(* ch_names)[20]
Definition: iio_axi_adc.h:68
iio_channel::scan_index
int scan_index
Definition: iio_types.h:182
iio_ch_info::ch_num
int16_t ch_num
Definition: iio_types.h:105
iio_device
Structure holding channels and attributes of a device.
Definition: iio_types.h:247
iio_axi_adc_desc::adc
struct axi_adc * adc
Definition: iio_axi_adc.h:55
get_sampling_frequency
int get_sampling_frequency(struct axi_adc *dev, uint32_t chan, uint64_t *sampling_freq_hz)
Definition: headless.c:75
scan_type
Definition: iio_types.h:151
STORAGE_BITS
#define STORAGE_BITS
Definition: iio_axi_adc.c:52
axi_dmac_transfer_start
int32_t axi_dmac_transfer_start(struct axi_dmac *dmac, struct axi_dma_transfer *dma_transfer)
Definition: axi_dmac.c:385
iio_axi_adc_get_dev_descriptor
void iio_axi_adc_get_dev_descriptor(struct iio_axi_adc_desc *desc, struct iio_device **dev_descriptor)
Get device descriptor.
Definition: iio_axi_adc.c:463
no_os_hweight32
unsigned int no_os_hweight32(uint32_t word)
axi_adc_set_calib_bias
int32_t axi_adc_set_calib_bias(struct axi_adc *adc, uint32_t chan, int32_t val, int32_t val2)
Calibrate bias for specific AXI ADC channel.
Definition: axi_adc_core.c:497
iio_axi_adc_init_param::get_sampling_frequency
int(* get_sampling_frequency)(struct axi_adc *dev, uint32_t chan, uint64_t *sampling_freq_hz)
Definition: iio_axi_adc.h:85
axi_adc_set_calib_scale
int32_t axi_adc_set_calib_scale(struct axi_adc *adc, uint32_t chan, int32_t val, int32_t val2)
Calibrate scale for specific AXI ADC channel.
Definition: axi_adc_core.c:465
iio_axi_adc_get_dev_descriptor
void iio_axi_adc_get_dev_descriptor(struct iio_axi_adc_desc *desc, struct iio_device **dev_descriptor)
Get device descriptor.
Definition: iio_axi_adc.c:463
axi_dma_transfer::size
uint32_t size
Definition: axi_dmac.h:103
axi_adc_get_sampling_freq
int32_t axi_adc_get_sampling_freq(struct axi_adc *adc, uint32_t chan, uint64_t *sampling_freq)
Get the AXI ADC Sampling Frequency.
Definition: axi_adc_core.c:171
axi_dmac
Definition: axi_dmac.h:110
iio_device::attributes
struct iio_attribute * attributes
Definition: iio_types.h:256
iio_axi_adc_read_dev
int32_t iio_axi_adc_read_dev(void *dev, void *buff, uint32_t nb_samples)
Update active channels.
Definition: iio_axi_adc.c:344