precision-converters-firmware
Macros | Functions | Variables
ad7134_iio.c File Reference

Implementation of AD7134 IIO apllication interfaces. More...

#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "ad7134_iio.h"
#include "app_config.h"
#include "ad7134_support.h"
#include "ad7134_user_config.h"
#include "common.h"
#include "no_os_error.h"
#include "iio_trigger.h"
Include dependency graph for ad7134_iio.c:

Macros

#define ADC_DEFAULT_REF_VOLTAGE   (4.096)
 
#define ADC_DEFAULT_SCALE   ((ADC_DEFAULT_REF_VOLTAGE / (ADC_MAX_COUNT_BIPOLAR)) * 1000)
 
#define AD7134_IIO_TRIGGER_NAME   "ad4134_iio_trigger"
 
#define NUM_OF_IIO_DEVICES   1
 
#define DATA_BUFFER_SIZE   (128000)
 

Functions

int32_t debug_reg_read (void *dev, uint32_t reg, uint32_t *readval)
 Read the debug register value. More...
 
int32_t debug_reg_write (void *dev, uint32_t reg, uint32_t writeval)
 Write into the debug register. More...
 
int32_t ad7134_trigger_handler (struct iio_device_data *iio_dev_data)
 
int32_t ad7134_iio_initialize (void)
 Initialize the AD7134 device for iio interface. More...
 
void ad7134_iio_event_handler (void)
 Run the AD7134 IIO event handler. More...
 

Variables

struct ad713x_dev * p_ad7134_dev_inst = NULL
 
struct iio_device_data * ad7134_iio_dev_data
 
bool data_capture_operation = false
 
struct iio_attribute channel_input_attributes []
 
struct scan_type chn_scan
 

Detailed Description

Implementation of AD7134 IIO apllication interfaces.

Copyright (c) 2020-21, 2023-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

◆ AD7134_IIO_TRIGGER_NAME

#define AD7134_IIO_TRIGGER_NAME   "ad4134_iio_trigger"

◆ ADC_DEFAULT_REF_VOLTAGE

#define ADC_DEFAULT_REF_VOLTAGE   (4.096)

◆ ADC_DEFAULT_SCALE

#define ADC_DEFAULT_SCALE   ((ADC_DEFAULT_REF_VOLTAGE / (ADC_MAX_COUNT_BIPOLAR)) * 1000)

◆ DATA_BUFFER_SIZE

#define DATA_BUFFER_SIZE   (128000)

◆ NUM_OF_IIO_DEVICES

#define NUM_OF_IIO_DEVICES   1

Function Documentation

◆ ad7134_iio_event_handler()

void ad7134_iio_event_handler ( void  )

Run the AD7134 IIO event handler.

Returns
none

This function monitors the new IIO client event

Here is the caller graph for this function:

◆ ad7134_iio_initialize()

int32_t ad7134_iio_initialize ( void  )

Initialize the AD7134 device for iio interface.

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

◆ ad7134_trigger_handler()

int32_t ad7134_trigger_handler ( struct iio_device_data *  iio_dev_data)

◆ debug_reg_read()

int32_t debug_reg_read ( void *  dev,
uint32_t  reg,
uint32_t *  readval 
)

Read the debug register value.

Parameters
dev-Pointer to IIO device instance
reg-Register address to read from
readval-Pointer to variable to read data into
Returns
0 in case of success, negative value otherwise

◆ debug_reg_write()

int32_t debug_reg_write ( void *  dev,
uint32_t  reg,
uint32_t  writeval 
)

Write into the debug register.

Parameters
dev-Pointer to IIO device instance
reg-Register address to write into
writeval-Register value to write
Returns
0 in case of success, negative value otherwise

Variable Documentation

◆ ad7134_iio_dev_data

struct iio_device_data* ad7134_iio_dev_data

◆ channel_input_attributes

struct iio_attribute channel_input_attributes[]
Initial value:
= {
{
.name = "raw",
.show = get_raw,
.store = set_raw,
},
{
.name = "scale",
.show = get_scale,
.store = set_scale,
},
{
.name = "offset",
.show = get_offset,
.store = set_offset,
},
END_ATTRIBUTES_ARRAY
}
int set_raw(void *device, char *buf, uint32_t len, const struct iio_ch_info *channel, intptr_t id)
Definition: ad77681_iio.c:185
int get_raw(void *device, char *buf, uint32_t len, const struct iio_ch_info *channel, intptr_t id)
Getter/Setter for the raw attribute value.
Definition: ad77681_iio.c:169
int set_scale(void *device, char *buf, uint32_t len, const struct iio_ch_info *channel, intptr_t id)
Definition: ad77681_iio.c:213
int get_scale(void *device, char *buf, uint32_t len, const struct iio_ch_info *channel, intptr_t id)
Getter/Setter for the scale attribute value.
Definition: ad77681_iio.c:204

◆ chn_scan

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

◆ data_capture_operation

bool data_capture_operation = false

◆ p_ad7134_dev_inst

struct ad713x_dev* p_ad7134_dev_inst = NULL