Program files for Example program for EVAL-AD7768-1

Dependencies:   platform_drivers

Embed: (wiki syntax)

« Back to documentation index

ad77681_iio.c File Reference

ad77681_iio.c File Reference

Implementation of AD7768-1 IIO application interfaces. More...

Go to the source code of this file.

Functions

static ssize_t get_sampling_frequency (void *device, char *buf, size_t len, const struct iio_ch_info *channel, intptr_t id)
 Getter/Setter for the sampling frequency attribute value.
ssize_t get_raw (void *device, char *buf, size_t len, const struct iio_ch_info *channel, intptr_t id)
 Getter/Setter for the raw attribute value.
ssize_t get_scale (void *device, char *buf, size_t len, const struct iio_ch_info *channel, intptr_t id)
 Getter/Setter for the scale attribute value.
static ssize_t get_power_mode_available (void *device, char *buf, size_t len, const struct iio_ch_info *channel, intptr_t id)
 Getter for the power mode available values.
static ssize_t set_power_mode_available (void *device, char *buf, size_t len, const struct iio_ch_info *channel, intptr_t id)
 Setter for the power mode available values.
ssize_t get_power_mode (void *device, char *buf, size_t len, const struct iio_ch_info *channel, intptr_t id)
 Getter/Setter for the power mode attribute value.
static ssize_t get_conv_mode_available (void *device, char *buf, size_t len, const struct iio_ch_info *channel, intptr_t id)
 Getter for the conv mode available values.
static ssize_t set_conv_mode_available (void *device, char *buf, size_t len, const struct iio_ch_info *channel, intptr_t id)
 Setter for the conv mode available values.
ssize_t get_conv_mode (void *device, char *buf, size_t len, const struct iio_ch_info *channel, intptr_t id)
 Getter/Setter for the conversion mode attribute value.
static ssize_t get_mclk_division_available (void *device, char *buf, size_t len, const struct iio_ch_info *channel, intptr_t id)
 Getter for the mclk division available values.
static ssize_t set_mclk_division_available (void *device, char *buf, size_t len, const struct iio_ch_info *channel, intptr_t id)
 Setter for the mclk division available values.
ssize_t get_mclk_division (void *device, char *buf, size_t len, const struct iio_ch_info *channel, intptr_t id)
 Getter/Setter for the MCLK division attribute value.
bool debug_get_reg_value (uint8_t reg, uint8_t *Reg_add)
 Get the actual register address value from the list.
int32_t debug_reg_read (void *dev, uint32_t reg, uint32_t *readval)
 Read the debug register value.
int32_t debug_reg_write (void *dev, uint32_t reg, uint32_t writeval)
 Write into the debug register.
static ssize_t iio_ad77681_read_data (void *dev_instance, char *pbuf, size_t offset, size_t bytes_count, uint32_t ch_mask)
 Read buffer data corresponding to AD4170 IIO device.
static ssize_t iio_ad77681_transfer_dev_data (void *dev_instance, size_t bytes_count, uint32_t ch_mask)
 Transfer the device data into memory (optional)
static int32_t iio_ad77681_start_transfer (void *dev_instance, uint32_t ch_mask)
 Perform tasks before new data transfer.
static int32_t iio_ad77681_stop_transfer (void *dev)
 Perform tasks before end of current data transfer.
static int32_t iio_ad77681_init (struct iio_device **desc)
 Init for reading/writing and parameterization of a ad77681 IIO device.
static int32_t iio_ad77681_remove (struct iio_desc *desc)
 Release resources allocated for AD77681 IIO device.
int32_t ad77681_iio_initialize (void)
 Initialize the IIO interface for AD77681 IIO device.
void ad77681_iio_event_handler (void)
 Run the AD77681 IIO event handler.

Detailed Description

Implementation of AD7768-1 IIO application interfaces.

This module acts as an interface for AD7768-1 IIO application

Copyright (c) 2021 Analog Devices, Inc. All rights reserved.

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.

Definition in file ad77681_iio.c.


Function Documentation

void ad77681_iio_event_handler ( void   )

Run the AD77681 IIO event handler.

Returns:
none

This function monitors the new IIO client event

Definition at line 864 of file ad77681_iio.c.

int32_t ad77681_iio_initialize ( void   )

Initialize the IIO interface for AD77681 IIO device.

Returns:
none
SUCCESS in case of success, FAILURE otherwise

IIO interface init parameters

Definition at line 802 of file ad77681_iio.c.

bool debug_get_reg_value ( uint8_t  reg,
uint8_t *  Reg_add 
)

Get the actual register address value from the list.

Parameters:
reg-Register address to read from
Reg_add- actual value of Register address
Returns:
true in case of success, false value otherwise

Definition at line 497 of file ad77681_iio.c.

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:
SUCCESS in case of success, negative value otherwise

Definition at line 522 of file ad77681_iio.c.

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:
SUCCESS in case of success, negative value otherwise

Definition at line 551 of file ad77681_iio.c.

ssize_t get_conv_mode ( void *  device,
char *  buf,
size_t  len,
const struct iio_ch_info *  channel,
intptr_t  id 
)

Getter/Setter for the conversion mode attribute value.

Parameters:
device-pointer to IIO device structure
buf-pointer to buffer holding attribute value
len-length of buffer string data
channel-pointer to IIO channel structure
Returns:
Number of characters read/written

Definition at line 346 of file ad77681_iio.c.

static ssize_t get_conv_mode_available ( void *  device,
char *  buf,
size_t  len,
const struct iio_ch_info *  channel,
intptr_t  id 
) [static]

Getter for the conv mode available values.

Parameters:
device-pointer to IIO device structure
buf-pointer to buffer holding attribute value
len-length of buffer string data
channel-pointer to IIO channel structure
id-Attribute ID (optional)
Returns:
Number of characters read/written

Definition at line 309 of file ad77681_iio.c.

ssize_t get_mclk_division ( void *  device,
char *  buf,
size_t  len,
const struct iio_ch_info *  channel,
intptr_t  id 
)

Getter/Setter for the MCLK division attribute value.

Parameters:
device-pointer to IIO device structure
buf-pointer to buffer holding attribute value
len-length of buffer string data
channel-pointer to IIO channel structure
channel-pointer to IIO channel structure
Returns:
Number of characters read/written

Definition at line 444 of file ad77681_iio.c.

static ssize_t get_mclk_division_available ( void *  device,
char *  buf,
size_t  len,
const struct iio_ch_info *  channel,
intptr_t  id 
) [static]

Getter for the mclk division available values.

Parameters:
device-pointer to IIO device structure
buf-pointer to buffer holding attribute value
len-length of buffer string data
channel-pointer to IIO channel structure
id-Attribute ID (optional)
Returns:
Number of characters read/written

Definition at line 406 of file ad77681_iio.c.

ssize_t get_power_mode ( void *  device,
char *  buf,
size_t  len,
const struct iio_ch_info *  channel,
intptr_t  id 
)

Getter/Setter for the power mode attribute value.

Parameters:
device-pointer to IIO device structure
buf-pointer to buffer holding attribute value
len-length of buffer string data
channel-pointer to IIO channel structure
Returns:
Number of characters read/written

Definition at line 257 of file ad77681_iio.c.

static ssize_t get_power_mode_available ( void *  device,
char *  buf,
size_t  len,
const struct iio_ch_info *  channel,
intptr_t  id 
) [static]

Getter for the power mode available values.

Parameters:
device-pointer to IIO device structure
buf-pointer to buffer holding attribute value
len-length of buffer string data
channel-pointer to IIO channel structure
id-Attribute ID (optional)
Returns:
Number of characters read/written

Definition at line 221 of file ad77681_iio.c.

ssize_t get_raw ( void *  device,
char *  buf,
size_t  len,
const struct iio_ch_info *  channel,
intptr_t  id 
)

Getter/Setter for the raw attribute value.

Parameters:
device-pointer to IIO device structure
buf-pointer to buffer holding attribute value
len-length of buffer string data
channel-pointer to IIO channel structure
Returns:
Number of characters read/written

Definition at line 151 of file ad77681_iio.c.

static ssize_t get_sampling_frequency ( void *  device,
char *  buf,
size_t  len,
const struct iio_ch_info *  channel,
intptr_t  id 
) [static]

Getter/Setter for the sampling frequency attribute value.

Parameters:
device-pointer to IIO device structure
buf-pointer to buffer holding attribute value
len-length of buffer string data
channel-pointer to IIO channel structure
id-Attribute ID (optional)
Returns:
Number of characters read/written This attribute is used to define the timeout period in IIO client during data capture. Timeout = (number of requested samples * (1/sampling frequency)) + 1sec e.g. if sampling frequency = 64KSPS and requested samples = 400 Timeout = (400 * (1/64000)) + 1 = 1.00625sec = ~1sec

Definition at line 124 of file ad77681_iio.c.

ssize_t get_scale ( void *  device,
char *  buf,
size_t  len,
const struct iio_ch_info *  channel,
intptr_t  id 
)

Getter/Setter for the scale attribute value.

Parameters:
device-pointer to IIO device structure
buf-pointer to buffer holding attribute value
len-length of buffer string data
channel-pointer to IIO channel structure
Returns:
Number of characters read/written

Definition at line 185 of file ad77681_iio.c.

static int32_t iio_ad77681_init ( struct iio_device **  desc ) [static]

Init for reading/writing and parameterization of a ad77681 IIO device.

Parameters:
desc[in,out]- IIO device descriptor
Returns:
SUCCESS in case of success, FAILURE otherwise

Definition at line 747 of file ad77681_iio.c.

static ssize_t iio_ad77681_read_data ( void *  dev_instance,
char *  pbuf,
size_t  offset,
size_t  bytes_count,
uint32_t  ch_mask 
) [static]

Read buffer data corresponding to AD4170 IIO device.

Parameters:
dev_instance[in]- IIO device instance
pbuf[out]- Pointer to output data buffer
offset[in]- Data buffer offset
bytes_count[in]- Number of bytes to read
ch_mask[in]- Channels select mask
Returns:
SUCCESS in case of success or negative value otherwise

Definition at line 579 of file ad77681_iio.c.

static int32_t iio_ad77681_remove ( struct iio_desc *  desc ) [static]

Release resources allocated for AD77681 IIO device.

Parameters:
desc[in]- IIO device descriptor
Returns:
SUCCESS in case of success, FAILURE otherwise

Definition at line 781 of file ad77681_iio.c.

static int32_t iio_ad77681_start_transfer ( void *  dev_instance,
uint32_t  ch_mask 
) [static]

Perform tasks before new data transfer.

Parameters:
dev_instance[in]- IIO device instance
ch_mask[in]- Channels select mask
Returns:
SUCCESS in case of success or negative value otherwise

Definition at line 626 of file ad77681_iio.c.

static int32_t iio_ad77681_stop_transfer ( void *  dev ) [static]

Perform tasks before end of current data transfer.

Parameters:
dev_instance[in]- IIO device instance
Returns:
SUCCESS in case of success or negative value otherwise

Definition at line 637 of file ad77681_iio.c.

static ssize_t iio_ad77681_transfer_dev_data ( void *  dev_instance,
size_t  bytes_count,
uint32_t  ch_mask 
) [static]

Transfer the device data into memory (optional)

Parameters:
dev_instance[in]- IIO device instance
bytes_count[in]- Number of bytes to read
ch_mask[in]- Channels select mask
Returns:
SUCCESS in case of success or negative value otherwise

Definition at line 605 of file ad77681_iio.c.

static ssize_t set_conv_mode_available ( void *  device,
char *  buf,
size_t  len,
const struct iio_ch_info *  channel,
intptr_t  id 
) [static]

Setter for the conv mode available values.

Parameters:
device-pointer to IIO device structure
buf-pointer to buffer holding attribute value
len-length of buffer string data
channel-pointer to IIO channel structure
id-Attribute ID (optional)
Returns:
Number of characters read/written

Definition at line 328 of file ad77681_iio.c.

static ssize_t set_mclk_division_available ( void *  device,
char *  buf,
size_t  len,
const struct iio_ch_info *  channel,
intptr_t  id 
) [static]

Setter for the mclk division available values.

Parameters:
device-pointer to IIO device structure
buf-pointer to buffer holding attribute value
len-length of buffer string data
channel-pointer to IIO channel structure
id-Attribute ID (optional)
Returns:
Number of characters read/written

Definition at line 425 of file ad77681_iio.c.

static ssize_t set_power_mode_available ( void *  device,
char *  buf,
size_t  len,
const struct iio_ch_info *  channel,
intptr_t  id 
) [static]

Setter for the power mode available values.

Parameters:
device-pointer to IIO device structure
buf-pointer to buffer holding attribute value
len-length of buffer string data
channel-pointer to IIO channel structure
id-Attribute ID (optional)
Returns:
Number of characters read/written

Definition at line 239 of file ad77681_iio.c.