no-OS
dac_demo.h
Go to the documentation of this file.
1 /***************************************************************************/
34 #ifndef IIO_DEMO_DAC_
35 #define IIO_DEMO_DAC_
36 
37 /******************************************************************************/
38 /***************************** Include Files **********************************/
39 /******************************************************************************/
40 
41 #include <stdint.h>
42 #include "iio_types.h"
43 
44 /******************************************************************************/
45 /*************************** Types Declarations *******************************/
46 /******************************************************************************/
47 
48 #define MAX_DAC_ADDR 16
49 /* For testing a maximum of 16 channels can be enabled */
50 #ifndef TOTAL_DAC_CHANNELS
51 #define TOTAL_DAC_CHANNELS 2
52 #endif
53 
58 struct dac_demo_desc {
60  uint8_t reg[MAX_DAC_ADDR];
62  uint32_t dac_global_attr;
66  uint32_t active_ch;
70  uint16_t **loopback_buffers;
71 };
72 
79  uint32_t dev_global_attr;
85  uint16_t **loopback_buffers;
86 };
87 
91 };
92 
93 /******************************************************************************/
94 /************************ Functions Declarations ******************************/
95 /******************************************************************************/
96 
97 int32_t dac_demo_init(struct dac_demo_desc **desc,
98  struct dac_demo_init_param *param);
99 
100 int32_t dac_demo_remove(struct dac_demo_desc *desc);
101 
102 int32_t update_dac_channels(void *dev, int32_t mask);
103 
104 int32_t close_dac_channels(void* dev);
105 
106 int32_t dac_submit_samples(struct iio_device_data *dev_data);
107 
108 int get_dac_demo_attr(void *device, char *buf, uint32_t len,
109  const struct iio_ch_info *channel, intptr_t priv);
110 
111 int set_dac_demo_attr(void *device, char *buf, uint32_t len,
112  const struct iio_ch_info *channel, intptr_t priv);
113 
114 int32_t dac_demo_reg_read(struct dac_demo_desc *desc, uint8_t reg_index,
115  uint8_t *readval);
116 
117 int32_t dac_demo_reg_write(struct dac_demo_desc *desc, uint8_t reg_index,
118  uint8_t writeval);
119 
120 int32_t dac_demo_trigger_handler(struct iio_device_data *dev_data);
121 
122 #endif /*IIO_DEMO_DAC_*/
iio_dac_demo_attributes
iio_dac_demo_attributes
Definition: dac_demo.h:88
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:151
dac_demo_desc::loopback_buffer_len
uint32_t loopback_buffer_len
Definition: dac_demo.h:68
no_os_alloc.h
close_dac_channels
int32_t close_dac_channels(void *dev)
close all channels
Definition: dac_demo.c:113
MAX_DAC_ADDR
#define MAX_DAC_ADDR
Definition: dac_demo.h:48
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:133
dac_demo_desc::dac_global_attr
uint32_t dac_global_attr
Definition: dac_demo.h:62
update_dac_channels
int32_t update_dac_channels(void *dev, int32_t mask)
update number of active channels
Definition: dac_demo.c:95
iio_ch_info
Structure holding channel attributess.
Definition: iio_types.h:103
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:193
dac_demo_desc
Definition: dac_demo.h:58
update_dac_channels
int32_t update_dac_channels(void *dev, int32_t mask)
update number of active channels
Definition: dac_demo.c:95
dac_demo_remove
int32_t dac_demo_remove(struct dac_demo_desc *desc)
free allocated resources
Definition: dac_demo.c:79
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:76
device
Definition: ad9361_util.h:69
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:147
dac_demo_remove
int32_t dac_demo_remove(struct dac_demo_desc *desc)
free allocated resources
Definition: dac_demo.c:79
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
NO_OS_ARRAY_SIZE
#define NO_OS_ARRAY_SIZE(x)
Definition: no_os_util.h:49
DAC_GLOBAL_ATTR
@ DAC_GLOBAL_ATTR
Definition: dac_demo.h:90
dac_demo_init_param::loopback_buffer_len
uint32_t loopback_buffer_len
Definition: dac_demo.h:83
no_os_error.h
Error codes definition.
dac_demo_desc::loopback_buffers
uint16_t ** loopback_buffers
Definition: dac_demo.h:70
dac_demo_desc::dac_ch_attr
uint32_t dac_ch_attr[MAX_DAC_ADDR]
Definition: dac_demo.h:64
close_dac_channels
int32_t close_dac_channels(void *dev)
close all channels
Definition: dac_demo.c:113
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:55
dac_demo_init_param::dev_global_attr
uint32_t dev_global_attr
Definition: dac_demo.h:79
dac_demo_desc::active_ch
uint32_t active_ch
Definition: dac_demo.h:66
dac_demo_init_param::dev_ch_attr
uint32_t dev_ch_attr[MAX_DAC_ADDR]
Definition: dac_demo.h:81
dac_demo_init_param::loopback_buffers
uint16_t ** loopback_buffers
Definition: dac_demo.h:85
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:133
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:55
iio_types.h
Header file for iio_types.
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
DAC_CHANNEL_ATTR
@ DAC_CHANNEL_ATTR
Definition: dac_demo.h:89
TOTAL_DAC_CHANNELS
#define TOTAL_DAC_CHANNELS
Definition: dac_demo.h:51
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:151
no_os_util.h
Header file of utility functions.
iio_device_data
Definition: iio_types.h:226
dac_demo_desc::reg
uint8_t reg[MAX_DAC_ADDR]
Definition: dac_demo.h:60
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:104
dac_demo_init_param
Definition: dac_demo.h:77
dac_demo.h
Header file of DAC Demo Driver.