no-OS
Macros | Functions | Variables
iio_pqm.c File Reference
#include "iio_pqm.h"
Include dependency graph for iio_pqm.c:

Macros

#define PQM_VOLTAGE_CHANNEL(_idx, _scan_idx, _name)
 
#define PQM_CURRENT_CHANNEL(_idx, _scan_idx, _name)
 

Functions

int read_pqm_attr (void *device, char *buf, uint32_t len, const struct iio_ch_info *channel, intptr_t attr_id)
 Read a pqm device attribute. More...
 
int write_pqm_attr (void *device, char *buf, uint32_t len, const struct iio_ch_info *channel, intptr_t attr_id)
 Write a pqm device attribute. More...
 
int read_ch_attr (void *device, char *buf, uint32_t len, const struct iio_ch_info *channel, intptr_t attr_id)
 Read a channel attribute. More...
 
int32_t read_samples (struct iio_device_data *dev_data)
 function for reading samples from the device. More...
 
int32_t pqm_trigger_handler (struct iio_device_data *dev_data)
 Handles trigger: reads one data-set and writes it to the buffer. More...
 

Variables

volatile bool configChanged = false
 
volatile bool processData = true
 
struct iio_attribute voltage_pqm_attributes []
 
struct iio_attribute current_pqm_attributes []
 
struct iio_attribute global_pqm_attributes []
 
struct scan_type pqm_scan_type
 
struct iio_device pqm_iio_descriptor
 

Macro Definition Documentation

◆ PQM_CURRENT_CHANNEL

#define PQM_CURRENT_CHANNEL (   _idx,
  _scan_idx,
  _name 
)
Value:
{ \
.name = _name, .ch_type = IIO_CURRENT, .channel = _idx, \
.scan_index = _scan_idx, .indexed = true, .scan_type = &pqm_scan_type, \
.attributes = current_pqm_attributes, .ch_out = false \
}

◆ PQM_VOLTAGE_CHANNEL

#define PQM_VOLTAGE_CHANNEL (   _idx,
  _scan_idx,
  _name 
)
Value:
{ \
.name = _name, .ch_type = IIO_VOLTAGE, .channel = _idx, \
.scan_index = _scan_idx, .indexed = true, .scan_type = &pqm_scan_type, \
.attributes = voltage_pqm_attributes, .ch_out = false \
}

Function Documentation

◆ pqm_trigger_handler()

int32_t pqm_trigger_handler ( struct iio_device_data dev_data)

Handles trigger: reads one data-set and writes it to the buffer.

Parameters
dev_data- The iio device data structure.
Returns
ret - Result of the handling procedure. In case of success, the size of the written data is returned.

◆ read_ch_attr()

int read_ch_attr ( void *  device,
char *  buf,
uint32_t  len,
const struct iio_ch_info channel,
intptr_t  attr_id 
)

Read a channel attribute.

Parameters
device- The iio device structure
buf- Buffer to be filled with requested data
len- Length of the received command buffer in bytes
channel- Command channel info
attr_id- attribute descriptor
Returns
- The length of the buffer in case of success, negative value otherwise

◆ read_pqm_attr()

int read_pqm_attr ( void *  device,
char *  buf,
uint32_t  len,
const struct iio_ch_info channel,
intptr_t  attr_id 
)

Read a pqm device attribute.

Parameters
device- The iio device structure
buf- Buffer to be filled with requested data
len- Length of the received command buffer in bytes
channel- Command channel info
attr_id- attribute descriptor
Returns
- The length of the buffer in case of success, negative value otherwise

◆ read_samples()

int32_t read_samples ( struct iio_device_data dev_data)

function for reading samples from the device.

Parameters
dev_data- The iio device data structure.
Returns
the number of read samples.

◆ write_pqm_attr()

int write_pqm_attr ( void *  device,
char *  buf,
uint32_t  len,
const struct iio_ch_info channel,
intptr_t  attr_id 
)

Write a pqm device attribute.

Parameters
device- The iio device structure
buf- Buffer to be filled with requested data
len- Length of the received command buffer in bytes
channel- Command channel info
attr_id- attribute descriptor
Returns
- The length of the buffer in case of success, negative value otherwise

Variable Documentation

◆ configChanged

volatile bool configChanged = false

◆ current_pqm_attributes

struct iio_attribute current_pqm_attributes[]

◆ global_pqm_attributes

struct iio_attribute global_pqm_attributes[]

◆ pqm_iio_descriptor

struct iio_device pqm_iio_descriptor
Initial value:
= {
.num_ch = TOTAL_PQM_CHANNELS,
.channels = iio_pqm_channels,
.debug_attributes = NULL,
.buffer_attributes = NULL,
.pre_enable = update_pqm_channels,
.post_disable = close_pqm_channels,
.trigger_handler = (int32_t(*)())pqm_trigger_handler,
.submit = (int32_t(*)())read_samples,
}

◆ pqm_scan_type

struct scan_type pqm_scan_type
Initial value:
= {.sign = 'd',
.realbits = 16,
.storagebits = 16,
.shift = 0,
.is_big_endian =
true
}

◆ processData

volatile bool processData = true

◆ voltage_pqm_attributes

struct iio_attribute voltage_pqm_attributes[]
current_pqm_attributes
struct iio_attribute current_pqm_attributes[]
Definition: iio_pqm.c:649
TOTAL_PQM_CHANNELS
#define TOTAL_PQM_CHANNELS
Definition: common_data.h:66
read_samples
int32_t read_samples(struct iio_device_data *dev_data)
function for reading samples from the device.
Definition: iio_pqm.c:529
pqm_trigger_handler
int32_t pqm_trigger_handler(struct iio_device_data *dev_data)
Handles trigger: reads one data-set and writes it to the buffer.
Definition: iio_pqm.c:548
global_pqm_attributes
struct iio_attribute global_pqm_attributes[]
Definition: iio_pqm.c:695
pqm_scan_type
struct scan_type pqm_scan_type
Definition: iio_pqm.c:889
IIO_CURRENT
@ IIO_CURRENT
Definition: iio_types.h:66
IIO_VOLTAGE
@ IIO_VOLTAGE
Definition: iio_types.h:65
voltage_pqm_attributes
struct iio_attribute voltage_pqm_attributes[]
Definition: iio_pqm.c:578
iio_channel::attributes
struct iio_attribute * attributes
Definition: iio_types.h:186
update_pqm_channels
int32_t update_pqm_channels(void *dev, uint32_t mask)
active pqm channels
Definition: basic_example.c:78
NULL
#define NULL
Definition: wrapper.h:64
close_pqm_channels
int32_t close_pqm_channels(void *dev)
close all channels
Definition: basic_example.c:91