precision-converters-firmware
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Macros | Enumerations | Functions | Variables
ad3530r_iio.c File Reference

Implementation of AD3530R IIO Application Interface. More...

#include <string.h>
#include "app_config.h"
#include "ad3530r.h"
#include "ad3530r_iio.h"
#include "ad3530r_user_config.h"
#include "ad3530r_regs.h"
#include "ad3530r_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 dependency graph for ad3530r_iio.c:

Macros

#define AD3530R_CHN_ATTR(_name, _priv)
 
#define AD3530R_CHN_AVAIL_ATTR(_name, _priv)
 
#define AD3530R_CH(_name, _idx, _type)
 
#define BYTES_PER_SAMPLE   sizeof(uint16_t)
 
#define BYTES_PER_SAMPLE_WITH_ADDRESS   2 * sizeof(uint16_t)
 
#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 AD3530R_IIO_TRIGGER_NAME   "ad3530r_iio_trigger"
 

Enumerations

enum  ad3530r_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_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 ad3530r_iio_initialize (void)
 Initialize the IIO interface for AD3530R IIO device.
 
void ad3530r_iio_event_handler (void)
 Run the AD3530R IIO event handler.
 

Variables

struct ad3530r_desc * ad3530r_dev_desc = NULL
 
struct iio_device * ad3530r_iio_dev
 
struct scan_type ad3530r_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 AD3530R IIO Application Interface.

This module acts as an interface for AD3530R IIO device

Copyright (c) 2022-24 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

◆ AD3530R_CH

#define AD3530R_CH (   _name,
  _idx,
  _type 
)
Value:
{\
.name = _name, \
.ch_type = _type,\
.ch_out = true,\
.indexed = true,\
.channel = _idx,\
.scan_index = _idx,\
.scan_type = &ad3530r_iio_scan_type,\
.attributes = ad3530r_iio_ch_attributes\
}
struct scan_type ad3530r_iio_scan_type
Definition ad3530r_iio.c:163

◆ AD3530R_CHN_ATTR

#define AD3530R_CHN_ATTR (   _name,
  _priv 
)
Value:
{\
.name = _name,\
.priv = _priv,\
.show = ad3530r_iio_attr_get,\
.store = ad3530r_iio_attr_set\
}

◆ AD3530R_CHN_AVAIL_ATTR

#define AD3530R_CHN_AVAIL_ATTR (   _name,
  _priv 
)
Value:
{\
.name = _name,\
.priv = _priv,\
.show = ad3530r_iio_attr_available_get,\
.store = ad3530r_iio_attr_available_set\
}

◆ AD3530R_IIO_TRIGGER_NAME

#define AD3530R_IIO_TRIGGER_NAME   "ad3530r_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 * sizeof(uint16_t)

◆ 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

◆ ad3530r_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_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

◆ ad3530r_iio_event_handler()

void ad3530r_iio_event_handler ( void  )

Run the AD3530R IIO event handler.

Returns
none

This function monitors the new IIO client event

Here is the caller graph for this function:

◆ ad3530r_iio_initialize()

int32_t ad3530r_iio_initialize ( void  )

Initialize the IIO interface for AD3530R IIO device.

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

Variable Documentation

◆ ad3530r_dev_desc

struct ad3530r_desc* ad3530r_dev_desc = NULL

◆ ad3530r_iio_dev

struct iio_device* ad3530r_iio_dev

◆ ad3530r_iio_scan_type

struct scan_type ad3530r_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:84

◆ 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