no-OS
Loading...
Searching...
No Matches
iio_ad4080.c File Reference

Implementation of iio_ad4080.c. More...

#include <errno.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include <assert.h>
#include "no_os_alloc.h"
#include "iio_ad4080.h"
Include dependency graph for iio_ad4080.c:

Macros

#define IIO_AD4080_CH_ATTR(_name, _priv)
 
#define IIO_AD4080_GLOB_ATTR(_name, _priv)
 
#define IIO_AD4080_GLOB_ATTR_AVAIL(_name, _priv)
 

Typedefs

typedef int(* attr_fn) (struct iio_ad4080_desc *iio_ad4080, char *buf, uint32_t len, const struct iio_ch_info *ch_info, bool show)
 

Enumerations

enum  {
  RAW_ATTR_ID ,
  SCALE_ATTR_ID ,
  OFFSET_ATTR_ID ,
  GP0_IO_GLOB_ATTR_ID ,
  GP0_FUNC_GLOB_ATTR_ID ,
  GP1_IO_GLOB_ATTR_ID ,
  GP1_FUNC_GLOB_ATTR_ID ,
  GP2_IO_GLOB_ATTR_ID ,
  GP2_FUNC_GLOB_ATTR_ID ,
  GP3_IO_GLOB_ATTR_ID ,
  GP3_FUNC_GLOB_ATTR_ID ,
  FIFO_MODE_GLOB_ATTR_ID ,
  FIFO_FULL_GLOB_ATTR_ID ,
  FIFO_READ_DONE_GLOB_ATTR_ID ,
  FIFO_WATERMARK_GLOB_ATTR_ID ,
  THRESHOLD_EVENT_DETECTED_ATTR_ID ,
  EVT_DETECTION_HYSTERESIS_GLOB_ATTR_ID ,
  EVT_DETECTION_HI_GLOB_ATTR_ID ,
  EVT_DETECTION_LO_GLOB_ATTR_ID ,
  FILTER_SEL_GLOB_ATTR_ID ,
  FILTER_SINC_DEC_RATE_GLOB_ATTR_ID ,
  DEVICE_MODE_GLOB_ATTR_ID ,
  AFE_CTRL_GLOB_ATTR_ID ,
  SELECT_SAMPLING_FREQ_GLOB_ATTR_ID ,
  MAX_ATTR_ID
}
 

Functions

void iio_ad4080_fifo_unset_watermark (struct iio_ad4080_fifo_struct *fifo)
 Unset the watermark configuration and data structure fors ad4080 driver.
 
int iio_ad4080_fifo_set_watermark (struct iio_ad4080_fifo_struct *fifo, const size_t watermark)
 Sets the FIFO watermark for the AD4080 device.
 
int ad4080_device (struct iio_ad4080_desc *iio_ad4080, struct ad4080_dev **ad4080)
 Gets the AD4080 device from the IIO AD4080 descriptor.
 
int ad4080_iio_device (struct iio_ad4080_desc *iio_ad4080, struct iio_device *iio_device)
 Initializes the IIO device structure for the AD4080 device.
 
int iio_ad4080_init (struct iio_ad4080_desc **iio_ad4080, struct iio_ad4080_init_param *iio_ad4080_init_param)
 Initializes the IIO AD4080 descriptor.
 
void iio_ad4080_fini (struct iio_ad4080_desc *iio_ad4080)
 teardown the ad4080 IIO driver
 

Detailed Description

Implementation of iio_ad4080.c.

Author
Niel Acuna (niel..nosp@m.acun.nosp@m.a@ana.nosp@m.log..nosp@m.com)
Marc Paolo Sosa (MarcP.nosp@m.aolo.nosp@m..Sosa.nosp@m.@ana.nosp@m.log.c.nosp@m.om)

Copyright 2025(c) Analog Devices, Inc.

SPDX-License-Identifier: BSD-3-Clause

Macro Definition Documentation

◆ IIO_AD4080_CH_ATTR

#define IIO_AD4080_CH_ATTR ( _name,
_priv )
Value:
{ \
.name = _name, \
.priv = _priv, \
.show = ad4080_attr_show, \
.store = ad4080_attr_store, \
}

◆ IIO_AD4080_GLOB_ATTR

#define IIO_AD4080_GLOB_ATTR ( _name,
_priv )
Value:
{ \
.name = _name, \
.priv = _priv, \
.show = ad4080_attr_show, \
.store = ad4080_attr_store, \
}

◆ IIO_AD4080_GLOB_ATTR_AVAIL

#define IIO_AD4080_GLOB_ATTR_AVAIL ( _name,
_priv )
Value:
{ \
.name = _name, \
.priv = _priv, \
.show = ad4080_attr_avail_show, \
.store = NULL, \
}
#define NULL
Definition wrapper.h:67

Typedef Documentation

◆ attr_fn

typedef int(* attr_fn) (struct iio_ad4080_desc *iio_ad4080, char *buf, uint32_t len, const struct iio_ch_info *ch_info, bool show)

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
RAW_ATTR_ID 
SCALE_ATTR_ID 
OFFSET_ATTR_ID 
GP0_IO_GLOB_ATTR_ID 
GP0_FUNC_GLOB_ATTR_ID 
GP1_IO_GLOB_ATTR_ID 
GP1_FUNC_GLOB_ATTR_ID 
GP2_IO_GLOB_ATTR_ID 
GP2_FUNC_GLOB_ATTR_ID 
GP3_IO_GLOB_ATTR_ID 
GP3_FUNC_GLOB_ATTR_ID 
FIFO_MODE_GLOB_ATTR_ID 
FIFO_FULL_GLOB_ATTR_ID 
FIFO_READ_DONE_GLOB_ATTR_ID 
FIFO_WATERMARK_GLOB_ATTR_ID 
THRESHOLD_EVENT_DETECTED_ATTR_ID 
EVT_DETECTION_HYSTERESIS_GLOB_ATTR_ID 
EVT_DETECTION_HI_GLOB_ATTR_ID 
EVT_DETECTION_LO_GLOB_ATTR_ID 
FILTER_SEL_GLOB_ATTR_ID 
FILTER_SINC_DEC_RATE_GLOB_ATTR_ID 
DEVICE_MODE_GLOB_ATTR_ID 
AFE_CTRL_GLOB_ATTR_ID 
SELECT_SAMPLING_FREQ_GLOB_ATTR_ID 
MAX_ATTR_ID 

Function Documentation

◆ ad4080_device()

int ad4080_device ( struct iio_ad4080_desc * iio_ad4080,
struct ad4080_dev ** ad4080 )

Gets the AD4080 device from the IIO AD4080 descriptor.

Checks if the given pointer is a valid AD4080 IIO descriptor.

Parameters
iio_ad4080- The IIO AD4080 descriptor.
ad4080- Pointer to store the AD4080 device pointer.
Returns
0 on success, or an error code on failure.

◆ ad4080_iio_device()

int ad4080_iio_device ( struct iio_ad4080_desc * iio_ad4080,
struct iio_device * iio_device )

Initializes the IIO device structure for the AD4080 device.

Parameters
iio_ad4080- The IIO AD4080 descriptor.
iio_device- The IIO device structure to be initialized.
Returns
0 on success, or an error code on failure.

◆ iio_ad4080_fifo_set_watermark()

int iio_ad4080_fifo_set_watermark ( struct iio_ad4080_fifo_struct * fifo,
const size_t watermark )

Sets the FIFO watermark for the AD4080 device.

Parameters
fifo- Pointer to the IIO AD4080 FIFO structure.
watermark- The desired watermark value (number of samples).
Returns
0 on success, or an error code on failure.

◆ iio_ad4080_fifo_unset_watermark()

void iio_ad4080_fifo_unset_watermark ( struct iio_ad4080_fifo_struct * fifo)

Unset the watermark configuration and data structure fors ad4080 driver.

Parameters
fifo- Pointer to the IIO AD4080 FIFO to unset.

◆ iio_ad4080_fini()

void iio_ad4080_fini ( struct iio_ad4080_desc * iio_ad4080)

teardown the ad4080 IIO driver

◆ iio_ad4080_init()

int iio_ad4080_init ( struct iio_ad4080_desc ** iio_ad4080,
struct iio_ad4080_init_param * iio_ad4080_init_param )

Initializes the IIO AD4080 descriptor.

Parameters
iio_ad4080- Pointer to store the initialized IIO AD4080 descriptor.
iio_ad4080_init_param- Initialization parameters for the IIO AD4080 descriptor.
Returns
0 on success, or an error code on failure.