no-OS
Functions
dac_demo.c File Reference

Implementation of DAC Demo Driver. More...

#include <stdio.h>
#include <string.h>
#include "dac_demo.h"
#include "no_os_error.h"
#include "no_os_util.h"
#include "no_os_alloc.h"
Include dependency graph for dac_demo.c:

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

Detailed Description

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

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.

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