precision-converters-firmware
Loading...
Searching...
No Matches
Macros | Enumerations | Functions | Variables
ad5710r_iio.c File Reference

Implementation of AD5710R IIO Application Interface. More...

#include <string.h>
#include "app_config.h"
#include "ad5710r.h"
#include "ad5710r_iio.h"
#include "ad5710r_user_config.h"
#include "ad5710r_regs.h"
#include "ad5710r_support.h"
#include "no_os_error.h"
#include "no_os_util.h"
#include "no_os_gpio.h"
#include "no_os_pwm.h"
#include "no_os_alloc.h"
#include "common.h"
#include "iio_trigger.h"
#include "version.h"
Include dependency graph for ad5710r_iio.c:

Macros

#define AD5710R_CHN_ATTR(_name, _priv)
 
#define AD5710R_CHN_AVAIL_ATTR(_name, _priv)
 
#define AD5710R_CH(_name, _idx, _type)
 
#define BYTES_PER_SAMPLE   sizeof(uint16_t)
 
#define BYTES_PER_SAMPLE_WITH_ADDRESS   2 * BYTES_PER_SAMPLE
 
#define CHN_STORAGE_BITS   (BYTES_PER_SAMPLE * 8)
 
#define DATA_BUFFER_SIZE   (65536)
 
#define BYTE_SIZE   (uint32_t)8
 
#define BYTE_MASK   (uint32_t)0xff
 
#define NUM_OF_IIO_DEVICES   1
 
#define AD5710R_IIO_TRIGGER_NAME   "ad5710r_iio_trigger"
 

Enumerations

enum  ad5710r_attribute_ids {
  DAC_INPUT ,
  DAC_RAW ,
  DAC_OFFSET ,
  DAC_SCALE ,
  DAC_CHN_OP_SELECT ,
  DAC_CHN_SW_LDAC_EN ,
  DAC_CHN_HW_LDAC_EN ,
  DAC_CHN_MODE_SELECT ,
  DAC_VREF_SELECT ,
  DAC_RANGE ,
  DAC_MUX_OUT ,
  DAC_SW_LDAC ,
  DAC_HW_LDAC ,
  DAC_ALL_CH_OP_MODE ,
  DAC_MULTI_INPUT_CH ,
  DAC_MULTI_DAC_CH ,
  DAC_SAMPLING_FREQUENCY ,
  DAC_STREAMING_TECHNIQUE
}
 

Functions

int32_t ad5710r_iio_initialize (void)
 Initialize the IIO interface for AD5710R IIO device.
 
void ad5710r_iio_event_handler (void)
 Run the AD5710R IIO event handler.
 

Variables

struct ad5710r_desc * ad5710r_dev_desc = NULL
 
struct iio_device * ad5710r_iio_dev
 
struct scan_type ad5710r_iio_scan_type
 
enum reg_access_mode streaming_option = SINGLE_INSTRUCTION_MODE
 
uint32_t num_of_samples
 
struct stm32_spi_init_param * spi_init_param
 
uint8_t * global_iio_buff
 

Detailed Description

Implementation of AD5710R IIO Application Interface.

This module acts as an interface for AD5710R IIO device

Copyright (c) 2024-25 Analog Devices, Inc.

This software is proprietary to Analog Devices, Inc. and its licensors. By using this software you agree to the terms of the associated Analog Devices Software License Agreement.

Macro Definition Documentation

◆ AD5710R_CH

#define AD5710R_CH (   _name,
  _idx,
  _type 
)
Value:
{\
.name = _name, \
.ch_type = _type,\
.ch_out = true,\
.indexed = true,\
.channel = _idx,\
.scan_index = _idx,\
.scan_type = &ad5710r_iio_scan_type,\
.attributes = ad5710r_iio_ch_attributes\
}
struct scan_type ad5710r_iio_scan_type
Definition ad5710r_iio.c:165

◆ AD5710R_CHN_ATTR

#define AD5710R_CHN_ATTR (   _name,
  _priv 
)
Value:
{\
.name = _name,\
.priv = _priv,\
.show = ad5710r_iio_attr_get,\
.store = ad5710r_iio_attr_set\
}

◆ AD5710R_CHN_AVAIL_ATTR

#define AD5710R_CHN_AVAIL_ATTR (   _name,
  _priv 
)
Value:
{\
.name = _name,\
.priv = _priv,\
.show = ad5710r_iio_attr_available_get,\
.store = ad5710r_iio_attr_available_set\
}

◆ AD5710R_IIO_TRIGGER_NAME

#define AD5710R_IIO_TRIGGER_NAME   "ad5710r_iio_trigger"

◆ BYTE_MASK

#define BYTE_MASK   (uint32_t)0xff

◆ BYTE_SIZE

#define BYTE_SIZE   (uint32_t)8

◆ BYTES_PER_SAMPLE

#define BYTES_PER_SAMPLE   sizeof(uint16_t)

◆ BYTES_PER_SAMPLE_WITH_ADDRESS

#define BYTES_PER_SAMPLE_WITH_ADDRESS   2 * BYTES_PER_SAMPLE

◆ CHN_STORAGE_BITS

#define CHN_STORAGE_BITS   (BYTES_PER_SAMPLE * 8)

◆ DATA_BUFFER_SIZE

#define DATA_BUFFER_SIZE   (65536)

◆ NUM_OF_IIO_DEVICES

#define NUM_OF_IIO_DEVICES   1

Enumeration Type Documentation

◆ ad5710r_attribute_ids

Enumerator
DAC_INPUT 
DAC_RAW 
DAC_OFFSET 
DAC_SCALE 
DAC_CHN_OP_SELECT 
DAC_CHN_SW_LDAC_EN 
DAC_CHN_HW_LDAC_EN 
DAC_CHN_MODE_SELECT 
DAC_VREF_SELECT 
DAC_RANGE 
DAC_MUX_OUT 
DAC_SW_LDAC 
DAC_HW_LDAC 
DAC_ALL_CH_OP_MODE 
DAC_MULTI_INPUT_CH 
DAC_MULTI_DAC_CH 
DAC_SAMPLING_FREQUENCY 
DAC_STREAMING_TECHNIQUE 

Function Documentation

◆ ad5710r_iio_event_handler()

void ad5710r_iio_event_handler ( void  )

Run the AD5710R IIO event handler.

Returns
none

This function monitors the new IIO client event

Here is the caller graph for this function:

◆ ad5710r_iio_initialize()

int32_t ad5710r_iio_initialize ( void  )

Initialize the IIO interface for AD5710R IIO device.

Returns
0 in case of success,negative error code otherwise
Here is the caller graph for this function:

Variable Documentation

◆ ad5710r_dev_desc

struct ad5710r_desc* ad5710r_dev_desc = NULL

◆ ad5710r_iio_dev

struct iio_device* ad5710r_iio_dev

◆ ad5710r_iio_scan_type

struct scan_type ad5710r_iio_scan_type
Initial value:
= {
.sign = 'u',
.realbits = DAC_RESOLUTION,
.storagebits = DAC_RESOLUTION,
.shift = 0,
.is_big_endian = false
}
#define DAC_RESOLUTION
Definition app_config.h:83

◆ global_iio_buff

uint8_t* global_iio_buff

◆ num_of_samples

uint32_t num_of_samples

◆ spi_init_param

struct stm32_spi_init_param* spi_init_param

◆ streaming_option

enum reg_access_mode streaming_option = SINGLE_INSTRUCTION_MODE