no-OS
Classes | Macros | Enumerations | Functions
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:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

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

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.

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

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()

int32_t 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()

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.

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()

int32_t 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()

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