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

Implementation of AD552XR IIO Application Interface. More...

#include <string.h>
#include <stdint.h>
#include <stdio.h>
#include "common.h"
#include "app_config.h"
#include "ad552xr.h"
#include "ad552xr_user_config.h"
#include "ad552xr_regs.h"
#include "ad552xr_support.h"
#include "no_os_error.h"
#include "no_os_delay.h"
#include "no_os_alloc.h"
#include "no_os_util.h"
#include "no_os_pwm.h"
#include "iio_trigger.h"
#include "version.h"
Include dependency graph for ad552xr_iio.c:

Macros

#define BYTES_PER_SAMPLE   (AD552XR_DAC_RESOLUTION / 8)
 
#define CHN_STORAGE_BITS   (BYTES_PER_SAMPLE * 8)
 
#define AD552XR_CHN_ATTR(_name, _priv)
 
#define AD552XR_CHN_AVAIL_ATTR(_name, _priv)
 
#define AD552XR_DAC_CH(_name, _dev, _idx)
 
#define AD552XR_DEFAULT_CHN_SCAN
 
#define AD552XR_NUM_BYTES_TRANSFER   (sizeof(uint16_t) + BYTES_PER_SAMPLE)
 
#define DATA_BUFFER_SIZE   32768
 
#define BUF_READ_TIMEOUT   0xffffffff
 
#define AD552XR_MAX_SPI_FREQUENCY   45E6
 
#define AD552XR_IIO_TRIGGER_NAME   "ad552xr_iio_trigger"
 

Enumerations

enum  ad552xr_attribute_ids {
  DEV_ADDR_ATTR_ID ,
  SAMPLE_RATE_ATTR_ID ,
  SCK_FREQ_ATTR_ID ,
  REF_SEL_ATTR_ID ,
  STATUS_ATTR_ID ,
  SINGLE_INSTR_ATTR_ID ,
  RAW_ATTR_ID ,
  SCALE_ATTR_ID ,
  OFFSET_ATTR_ID ,
  INPUT_A_ATTR_ID ,
  INPUT_B_ATTR_ID ,
  OUTPUT_STATE_ATTR_ID ,
  RANGE_SEL_ATTR_ID ,
  HW_SW_SEL_ATTR_ID ,
  FUNC_SEL_ATTR_ID ,
  LDAC_HW_PIN_SEL_ATTR_ID ,
  LDAC_HW_ACTIVE_EDGE_ATTR_ID ,
  DITHER_PERIOD_FACTOR_ATTR_ID ,
  DITHER_PHASE_ATTR_ID ,
  RAMP_STEP_ATTR_ID ,
  NUM_OF_DEV_ATTR = 6 ,
  NUM_OF_DEV_AVAIL_ATTR = 2 ,
  NUM_OF_CH_ATTR = 14 ,
  NUM_OF_CH_AVAIL_ATTR = 8
}
 

Functions

uint32_t debug_reg_search (uint32_t addr)
 Search for the base address for multi byte register.
 
void iio_app_remove (void)
 Remove the IIO resources for AD552XR IIO application.
 
int32_t iio_app_initialize (void)
 Initialize the IIO interface for AD552XR IIO device.
 
void iio_app_event_handler (void)
 Run the AD552XR IIO event handler.
 

Variables

struct scan_type iio_ad552xr_scan_type [AD552XR_IIO_NUM_DEVICES][AD552XR_MAX_NUM_CH]
 

Detailed Description

Implementation of AD552XR IIO Application Interface.

This module acts as an interface for AD552XR IIO device

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

◆ AD552XR_CHN_ATTR

#define AD552XR_CHN_ATTR (   _name,
  _priv 
)
Value:
{\
.name = _name,\
.priv = _priv,\
.show = iio_ad552xr_attr_get,\
.store = iio_ad552xr_attr_set\
}

◆ AD552XR_CHN_AVAIL_ATTR

#define AD552XR_CHN_AVAIL_ATTR (   _name,
  _priv 
)
Value:
{\
.name = _name,\
.priv = _priv,\
.show = iio_ad552xr_attr_available_get,\
.store = iio_ad552xr_attr_available_set\
}

◆ AD552XR_DAC_CH

#define AD552XR_DAC_CH (   _name,
  _dev,
  _idx 
)
Value:
{\
.name = strdup(_name),\
.ch_type = IIO_VOLTAGE,\
.channel = _idx,\
.ch_out = true,\
.scan_index = _idx,\
.indexed = true,\
.scan_type = &iio_ad552xr_scan_type[_dev][_idx],\
.attributes = iio_ad552xr_channel_attributes[_dev],\
}
struct scan_type iio_ad552xr_scan_type[AD552XR_IIO_NUM_DEVICES][AD552XR_MAX_NUM_CH]
Definition ad552xr_iio.c:152

◆ AD552XR_DEFAULT_CHN_SCAN

#define AD552XR_DEFAULT_CHN_SCAN
Value:
{\
.sign = 'u',\
.realbits = AD552XR_DAC_RESOLUTION,\
.storagebits = CHN_STORAGE_BITS,\
.shift = 0,\
.is_big_endian = false\
}
#define AD552XR_DAC_RESOLUTION
Definition app_config.h:34
#define CHN_STORAGE_BITS
Definition ad552xr_iio.c:68

◆ AD552XR_IIO_TRIGGER_NAME

#define AD552XR_IIO_TRIGGER_NAME   "ad552xr_iio_trigger"

◆ AD552XR_MAX_SPI_FREQUENCY

#define AD552XR_MAX_SPI_FREQUENCY   45E6

◆ AD552XR_NUM_BYTES_TRANSFER

#define AD552XR_NUM_BYTES_TRANSFER   (sizeof(uint16_t) + BYTES_PER_SAMPLE)

◆ BUF_READ_TIMEOUT

#define BUF_READ_TIMEOUT   0xffffffff

◆ BYTES_PER_SAMPLE

#define BYTES_PER_SAMPLE   (AD552XR_DAC_RESOLUTION / 8)

◆ CHN_STORAGE_BITS

#define CHN_STORAGE_BITS   (BYTES_PER_SAMPLE * 8)

◆ DATA_BUFFER_SIZE

#define DATA_BUFFER_SIZE   32768

Enumeration Type Documentation

◆ ad552xr_attribute_ids

Enumerator
DEV_ADDR_ATTR_ID 
SAMPLE_RATE_ATTR_ID 
SCK_FREQ_ATTR_ID 
REF_SEL_ATTR_ID 
STATUS_ATTR_ID 
SINGLE_INSTR_ATTR_ID 
RAW_ATTR_ID 
SCALE_ATTR_ID 
OFFSET_ATTR_ID 
INPUT_A_ATTR_ID 
INPUT_B_ATTR_ID 
OUTPUT_STATE_ATTR_ID 
RANGE_SEL_ATTR_ID 
HW_SW_SEL_ATTR_ID 
FUNC_SEL_ATTR_ID 
LDAC_HW_PIN_SEL_ATTR_ID 
LDAC_HW_ACTIVE_EDGE_ATTR_ID 
DITHER_PERIOD_FACTOR_ATTR_ID 
DITHER_PHASE_ATTR_ID 
RAMP_STEP_ATTR_ID 
NUM_OF_DEV_ATTR 
NUM_OF_DEV_AVAIL_ATTR 
NUM_OF_CH_ATTR 
NUM_OF_CH_AVAIL_ATTR 

Function Documentation

◆ debug_reg_search()

uint32_t debug_reg_search ( uint32_t  addr)

Search for the base address for multi byte register.

Parameters
addr[in]- Address as requested by the IIO client
Returns
Register address

◆ iio_app_event_handler()

void iio_app_event_handler ( void  )

Run the AD552XR IIO event handler.

Run the AD3530R IIO event handler.

Returns
none

This function monitors the new IIO client event

◆ iio_app_initialize()

int32_t iio_app_initialize ( void  )

Initialize the IIO interface for AD552XR IIO device.

Initialize the IIO interface for AD3530R IIO device.

Returns
0 in case of success,negative error code otherwise

◆ iio_app_remove()

void iio_app_remove ( void  )

Remove the IIO resources for AD552XR IIO application.

Returns
none
Here is the caller graph for this function:

Variable Documentation

◆ iio_ad552xr_scan_type

struct scan_type iio_ad552xr_scan_type[AD552XR_IIO_NUM_DEVICES][AD552XR_MAX_NUM_CH]
Initial value:
= {
[0 ... AD552XR_IIO_NUM_DEVICES - 1] = {
[0 ... AD552XR_MAX_NUM_CH - 1] = AD552XR_DEFAULT_CHN_SCAN
}
}
#define AD552XR_IIO_NUM_DEVICES
Definition app_config.h:107
#define AD552XR_DEFAULT_CHN_SCAN
Definition ad552xr_iio.c:99