no-OS
Loading...
Searching...
No Matches
dac_demo.h File Reference

Header file of DAC Demo Driver. More...

#include <stdint.h>
#include "iio_types.h"
Include dependency graph for dac_demo.h:

Classes

struct  dac_demo_desc
 
struct  dac_demo_init_param
 

Macros

#define MAX_DAC_ADDR   16
 
#define TOTAL_DAC_CHANNELS   2
 

Enumerations

enum  iio_dac_demo_attributes {
  DAC_CHANNEL_ATTR ,
  DAC_GLOBAL_ATTR
}
 

Functions

int32_t dac_demo_init (struct dac_demo_desc **desc, struct dac_demo_init_param *param)
 init function for the dac demo driver
 
int32_t dac_demo_remove (struct dac_demo_desc *desc)
 free allocated resources
 
int update_dac_channels (void *dev, int32_t mask)
 update number of active channels
 
int close_dac_channels (void *dev)
 close all channels
 
int dac_submit_samples (struct iio_device_data *dev_data)
 function for writing samples to the device.
 
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.
 
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.
 
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
 
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
 
int 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.
 

Detailed Description

Header file of DAC Demo Driver.

Author
RNechita (ramon.nosp@m.a.ne.nosp@m.chita.nosp@m.@ana.nosp@m.log.c.nosp@m.om)

Copyright 2021(c) Analog Devices, Inc.

SPDX-License-Identifier: BSD-3-Clause

Macro Definition Documentation

◆ MAX_DAC_ADDR

#define MAX_DAC_ADDR   16

◆ TOTAL_DAC_CHANNELS

#define TOTAL_DAC_CHANNELS   2

Enumeration Type Documentation

◆ iio_dac_demo_attributes

Enumerator
DAC_CHANNEL_ATTR 
DAC_GLOBAL_ATTR 

Function Documentation

◆ close_dac_channels()

int close_dac_channels ( void * dev)

close all channels

Parameters
dev- physical instance of an adc device
Returns
0 in case of success.

◆ 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

Parameters
desc- descriptor for the dac
param- initialization param for dac
Returns
0 in case of success, negative error code otherwise.

◆ 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

Parameters
desc- descriptor for the dac
reg_index- the address at which we want to read
readval-the value read from register
Returns
0 in case of success, negative error code otherwise.

◆ 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

Parameters
desc- descriptor for the dac
reg_index- the address at which we want to write
writeval- the value to be written
Returns
0 in case of success, negative error code otherwise.

◆ dac_demo_remove()

int32_t dac_demo_remove ( struct dac_demo_desc * desc)

free allocated resources

Parameters
desc- descriptor for the dac to be removed
Returns
0 in case of success, -1 otherwise.

◆ dac_demo_trigger_handler()

int 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.

Parameters
dev_data- The iio device data structure.
Returns
ret - Result of the handling procedure. Returns 0 in case of success and a negative code otherwise.

◆ dac_submit_samples()

int dac_submit_samples ( struct iio_device_data * dev_data)

function for writing samples to the device.

Parameters
dev_data- The iio device data structure.
Returns
ret - Result of the writing procedure. Returns 0 in case of success and a negative code otherwise.

◆ get_dac_demo_attr()

int get_dac_demo_attr ( void * device,
char * buf,
uint32_t len,
const struct iio_ch_info * channel,
intptr_t attr_id )

get attributes for dac.

Parameters
device-Physical instance of a iio_demo_device.
buf- Where value is stored.
len- Maximum length of value to be stored in buf.
channel- Channel properties.
attr_id- Attribute ID
Returns
Length of chars written in buf, or negative value on failure.

◆ set_dac_demo_attr()

int set_dac_demo_attr ( void * device,
char * buf,
uint32_t len,
const struct iio_ch_info * channel,
intptr_t attr_id )

set attributes for dac.

Parameters
device- Physical instance of a iio_demo_device.
buf- Value to be written to attribute.
len- Length of the data in "buf".
channel- Channel properties.
attr_id- Attribute ID
Returns
: Number of bytes written to device, or negative value on failure.

◆ update_dac_channels()

int update_dac_channels ( void * dev,
int32_t mask )

update number of active channels

Parameters
dev- physical instance of a dac device
mask- the new number of active channels
Returns
0 in case of success.