no-OS
adc_demo.h
Go to the documentation of this file.
1 /***************************************************************************/
40 #ifndef IIO_DEMO_ADC_
41 #define IIO_DEMO_ADC_
42 
43 /******************************************************************************/
44 /***************************** Include Files **********************************/
45 /******************************************************************************/
46 
47 #include <stdint.h>
48 #include "iio_types.h"
49 #include "no_os_irq.h"
50 
51 /******************************************************************************/
52 /*************************** Types Declarations *******************************/
53 /******************************************************************************/
54 
55 #define MAX_ADC_ADDR 16
56 /* For testing a maximum of 16 channels can be enabled */
57 #ifndef TOTAL_ADC_CHANNELS
58 #define TOTAL_ADC_CHANNELS 2
59 #endif
60 
65 struct adc_demo_desc {
67  uint8_t reg[MAX_ADC_ADDR];
69  uint32_t adc_global_attr;
73  uint32_t active_ch;
75  uint32_t ext_buff_len;
77  uint16_t **ext_buff;
78 };
79 
86  uint32_t dev_global_attr;
90  uint32_t ext_buff_len;
92  uint16_t **ext_buff;
93 };
94 
98 };
99 
100 extern const uint16_t sine_lut[128];
101 
102 /******************************************************************************/
103 /************************ Functions Declarations ******************************/
104 /******************************************************************************/
105 
106 int32_t adc_demo_init(struct adc_demo_desc **desc,
107  struct adc_demo_init_param *param);
108 
109 int32_t adc_demo_remove(struct adc_demo_desc *desc);
110 
111 int32_t update_adc_channels(void *dev, uint32_t mask);
112 
113 int32_t close_adc_channels(void* dev);
114 
115 int32_t adc_submit_samples(struct iio_device_data *dev_data);
116 
117 int32_t adc_demo_reg_read(struct adc_demo_desc *desc, uint8_t reg_index,
118  uint8_t *readval);
119 
120 int32_t adc_demo_reg_write(struct adc_demo_desc *desc, uint8_t reg_index,
121  uint8_t writeval);
122 
123 int32_t adc_demo_trigger_handler(struct iio_device_data *dev_data);
124 
125 #endif /*IIO_DEMO_ADC_*/
ADC_CHANNEL_ATTR
@ ADC_CHANNEL_ATTR
Definition: adc_demo.h:96
adc_demo_remove
int32_t adc_demo_remove(struct adc_demo_desc *desc)
free allocated resources
Definition: adc_demo.c:105
adc_demo_init
int32_t adc_demo_init(struct adc_demo_desc **desc, struct adc_demo_init_param *param)
init function for the adc demo driver
Definition: adc_demo.c:81
adc_demo_init_param::ext_buff_len
uint32_t ext_buff_len
Definition: adc_demo.h:90
no_os_irq.h
Header file of IRQ interface.
update_adc_channels
int32_t update_adc_channels(void *dev, uint32_t mask)
active adc channels
Definition: adc_demo.c:121
adc_demo_init_param::ext_buff
uint16_t ** ext_buff
Definition: adc_demo.h:92
adc_demo_desc::ext_buff
uint16_t ** ext_buff
Definition: adc_demo.h:77
NO_OS_ARRAY_SIZE
#define NO_OS_ARRAY_SIZE(x)
Definition: no_os_util.h:53
TOTAL_ADC_CHANNELS
#define TOTAL_ADC_CHANNELS
Definition: adc_demo.h:58
adc_demo_desc::adc_global_attr
uint32_t adc_global_attr
Definition: adc_demo.h:69
no_os_error.h
Error codes definition.
adc_demo_trigger_handler
int32_t adc_demo_trigger_handler(struct iio_device_data *dev_data)
Handles trigger: reads one data-set and writes it to the buffer.
Definition: iio_adc_demo.c:186
close_adc_channels
int32_t close_adc_channels(void *dev)
close all channels
Definition: adc_demo.c:141
ADC_GLOBAL_ATTR
@ ADC_GLOBAL_ATTR
Definition: adc_demo.h:97
adc_demo.h
Header file of ADC Demo Driver.
adc_demo_desc::adc_ch_attr
uint32_t adc_ch_attr[MAX_ADC_ADDR]
Definition: adc_demo.h:71
adc_demo_desc::active_ch
uint32_t active_ch
Definition: adc_demo.h:73
close_adc_channels
int32_t close_adc_channels(void *dev)
close all channels
Definition: adc_demo.c:141
adc_demo_desc::ext_buff_len
uint32_t ext_buff_len
Definition: adc_demo.h:75
adc_demo_reg_read
int32_t adc_demo_reg_read(struct adc_demo_desc *desc, uint8_t reg_index, uint8_t *readval)
read function for the adc demo driver
Definition: adc_demo.c:162
iio_adc_demo_attributes
iio_adc_demo_attributes
Definition: adc_demo.h:95
adc_demo_reg_read
int32_t adc_demo_reg_read(struct adc_demo_desc *desc, uint8_t reg_index, uint8_t *readval)
read function for the adc demo driver
Definition: adc_demo.c:162
iio_types.h
Header file for iio_types.
adc_demo_init_param::dev_global_attr
uint32_t dev_global_attr
Definition: adc_demo.h:86
update_adc_channels
int32_t update_adc_channels(void *dev, uint32_t mask)
active adc channels
Definition: adc_demo.c:121
adc_demo_desc
Definition: adc_demo.h:65
adc_submit_samples
int32_t adc_submit_samples(struct iio_device_data *dev_data)
function for reading samples from the device.
Definition: iio_adc_demo.c:143
adc_demo_desc::reg
uint8_t reg[MAX_ADC_ADDR]
Definition: adc_demo.h:67
adc_demo_reg_write
int32_t adc_demo_reg_write(struct adc_demo_desc *desc, uint8_t reg_index, uint8_t writeval)
write function for the adc demo driver
Definition: adc_demo.c:180
adc_demo_init_param::dev_ch_attr
uint32_t dev_ch_attr[MAX_ADC_ADDR]
Definition: adc_demo.h:88
sine_lut
const uint16_t sine_lut[128]
Definition: adc_demo.c:52
adc_demo_reg_write
int32_t adc_demo_reg_write(struct adc_demo_desc *desc, uint8_t reg_index, uint8_t writeval)
write function for the adc demo driver
Definition: adc_demo.c:180
MAX_ADC_ADDR
#define MAX_ADC_ADDR
Definition: adc_demo.h:55
adc_demo_init
int32_t adc_demo_init(struct adc_demo_desc **desc, struct adc_demo_init_param *param)
init function for the adc demo driver
Definition: adc_demo.c:81
adc_demo_remove
int32_t adc_demo_remove(struct adc_demo_desc *desc)
free allocated resources
Definition: adc_demo.c:105
no_os_util.h
Header file of utility functions.
iio_device_data
Definition: iio_types.h:221
adc_demo_init_param
Definition: adc_demo.h:84
sine_lut
const uint16_t sine_lut[128]
Definition: adc_demo.c:52