no-OS
dac_demo.h
Go to the documentation of this file.
1 /***************************************************************************/
40 #ifndef IIO_DEMO_DAC_
41 #define IIO_DEMO_DAC_
42 
43 /******************************************************************************/
44 /***************************** Include Files **********************************/
45 /******************************************************************************/
46 
47 #include <stdint.h>
48 #include "iio_types.h"
49 
50 /******************************************************************************/
51 /*************************** Types Declarations *******************************/
52 /******************************************************************************/
53 
54 #define MAX_DAC_ADDR 16
55 /* For testing a maximum of 16 channels can be enabled */
56 #ifndef TOTAL_DAC_CHANNELS
57 #define TOTAL_DAC_CHANNELS 2
58 #endif
59 
64 struct dac_demo_desc {
66  uint8_t reg[MAX_DAC_ADDR];
68  uint32_t dac_global_attr;
72  uint32_t active_ch;
76  uint16_t **loopback_buffers;
77 };
78 
85  uint32_t dev_global_attr;
91  uint16_t **loopback_buffers;
92 };
93 
97 };
98 
99 /******************************************************************************/
100 /************************ Functions Declarations ******************************/
101 /******************************************************************************/
102 
103 int32_t dac_demo_init(struct dac_demo_desc **desc,
104  struct dac_demo_init_param *param);
105 
106 int32_t dac_demo_remove(struct dac_demo_desc *desc);
107 
108 int32_t update_dac_channels(void *dev, int32_t mask);
109 
110 int32_t close_dac_channels(void* dev);
111 
112 int32_t dac_submit_samples(struct iio_device_data *dev_data);
113 
114 int get_dac_demo_attr(void *device, char *buf, uint32_t len,
115  const struct iio_ch_info *channel, intptr_t priv);
116 
117 int set_dac_demo_attr(void *device, char *buf, uint32_t len,
118  const struct iio_ch_info *channel, intptr_t priv);
119 
120 int32_t dac_demo_reg_read(struct dac_demo_desc *desc, uint8_t reg_index,
121  uint8_t *readval);
122 
123 int32_t dac_demo_reg_write(struct dac_demo_desc *desc, uint8_t reg_index,
124  uint8_t writeval);
125 
126 int32_t dac_demo_trigger_handler(struct iio_device_data *dev_data);
127 
128 #endif /*IIO_DEMO_DAC_*/
iio_dac_demo_attributes
iio_dac_demo_attributes
Definition: dac_demo.h:94
dac_demo_reg_write
int32_t dac_demo_reg_write(struct dac_demo_desc *desc, uint8_t reg_index, uint8_t writeval)
write function for the dac demo driver
Definition: dac_demo.c:156
dac_demo_desc::loopback_buffer_len
uint32_t loopback_buffer_len
Definition: dac_demo.h:74
close_dac_channels
int32_t close_dac_channels(void *dev)
close all channels
Definition: dac_demo.c:118
MAX_DAC_ADDR
#define MAX_DAC_ADDR
Definition: dac_demo.h:54
dac_demo_reg_read
int32_t dac_demo_reg_read(struct dac_demo_desc *desc, uint8_t reg_index, uint8_t *readval)
read function for the dac demo driver
Definition: dac_demo.c:138
dac_demo_desc::dac_global_attr
uint32_t dac_global_attr
Definition: dac_demo.h:68
update_dac_channels
int32_t update_dac_channels(void *dev, int32_t mask)
update number of active channels
Definition: dac_demo.c:100
iio_ch_info
Structure holding channel attributess.
Definition: iio_types.h:101
set_dac_demo_attr
int set_dac_demo_attr(void *device, char *buf, uint32_t len, const struct iio_ch_info *channel, intptr_t priv)
set attributes for dac.
Definition: iio_dac_demo.c:199
dac_demo_desc
Definition: dac_demo.h:64
update_dac_channels
int32_t update_dac_channels(void *dev, int32_t mask)
update number of active channels
Definition: dac_demo.c:100
dac_demo_remove
int32_t dac_demo_remove(struct dac_demo_desc *desc)
free allocated resources
Definition: dac_demo.c:84
get_dac_demo_attr
int get_dac_demo_attr(void *device, char *buf, uint32_t len, const struct iio_ch_info *channel, intptr_t priv)
get attributes for dac.
Definition: iio_dac_demo.c:82
device
Definition: ad9361_util.h:75
dac_demo_trigger_handler
int32_t dac_demo_trigger_handler(struct iio_device_data *dev_data)
Handles trigger: reads one data-set from iio buffer and writes it to the dac buffer.
Definition: iio_dac_demo.c:153
dac_demo_remove
int32_t dac_demo_remove(struct dac_demo_desc *desc)
free allocated resources
Definition: dac_demo.c:84
NO_OS_ARRAY_SIZE
#define NO_OS_ARRAY_SIZE(x)
Definition: no_os_util.h:53
DAC_GLOBAL_ATTR
@ DAC_GLOBAL_ATTR
Definition: dac_demo.h:96
dac_demo_init_param::loopback_buffer_len
uint32_t loopback_buffer_len
Definition: dac_demo.h:89
no_os_error.h
Error codes definition.
dac_demo_desc::loopback_buffers
uint16_t ** loopback_buffers
Definition: dac_demo.h:76
dac_demo_desc::dac_ch_attr
uint32_t dac_ch_attr[MAX_DAC_ADDR]
Definition: dac_demo.h:70
close_dac_channels
int32_t close_dac_channels(void *dev)
close all channels
Definition: dac_demo.c:118
dac_demo_init
int32_t dac_demo_init(struct dac_demo_desc **desc, struct dac_demo_init_param *param)
init function for the dac demo driver
Definition: dac_demo.c:60
dac_demo_init_param::dev_global_attr
uint32_t dev_global_attr
Definition: dac_demo.h:85
dac_demo_desc::active_ch
uint32_t active_ch
Definition: dac_demo.h:72
dac_demo_init_param::dev_ch_attr
uint32_t dev_ch_attr[MAX_DAC_ADDR]
Definition: dac_demo.h:87
dac_demo_init_param::loopback_buffers
uint16_t ** loopback_buffers
Definition: dac_demo.h:91
dac_demo_reg_read
int32_t dac_demo_reg_read(struct dac_demo_desc *desc, uint8_t reg_index, uint8_t *readval)
read function for the dac demo driver
Definition: dac_demo.c:138
dac_demo_init
int32_t dac_demo_init(struct dac_demo_desc **desc, struct dac_demo_init_param *param)
init function for the dac demo driver
Definition: dac_demo.c:60
iio_types.h
Header file for iio_types.
DAC_CHANNEL_ATTR
@ DAC_CHANNEL_ATTR
Definition: dac_demo.h:95
TOTAL_DAC_CHANNELS
#define TOTAL_DAC_CHANNELS
Definition: dac_demo.h:57
dac_demo_reg_write
int32_t dac_demo_reg_write(struct dac_demo_desc *desc, uint8_t reg_index, uint8_t writeval)
write function for the dac demo driver
Definition: dac_demo.c:156
no_os_util.h
Header file of utility functions.
iio_device_data
Definition: iio_types.h:233
dac_demo_desc::reg
uint8_t reg[MAX_DAC_ADDR]
Definition: dac_demo.h:66
dac_submit_samples
int32_t dac_submit_samples(struct iio_device_data *dev_data)
function for writing samples to the device.
Definition: iio_dac_demo.c:110
dac_demo_init_param
Definition: dac_demo.h:83
dac_demo.h
Header file of DAC Demo Driver.