libiio
|
Classes | |
struct | iio_device |
Represents a device in the IIO context. More... | |
Macros | |
#define | iio_device_attr_read(dev, attr, ptr) |
Read the content of the given device-specific attribute. More... | |
#define | iio_device_attr_write(dev, attr, val) |
Set the value of the given device-specific attribute. More... | |
#define | iio_device_buffer_attr_read(dev, buf_id, attr, ptr) |
Read the content of the given buffer-specific attribute. More... | |
#define | iio_device_buffer_attr_write(dev, buf_id, attr, val) |
Set the value of the given buffer-specific attribute. More... | |
Functions | |
__api __check_ret __pure const struct iio_context * | iio_device_get_context (const struct iio_device *dev) |
Retrieve a pointer to the iio_context structure. More... | |
__api __check_ret __pure const char * | iio_device_get_id (const struct iio_device *dev) |
Retrieve the device ID (e.g. More... | |
__api __check_ret __pure const char * | iio_device_get_name (const struct iio_device *dev) |
Retrieve the device name (e.g. More... | |
__api __check_ret __pure const char * | iio_device_get_label (const struct iio_device *dev) |
Retrieve the device label (e.g. More... | |
__api __check_ret __pure unsigned int | iio_device_get_channels_count (const struct iio_device *dev) |
Enumerate the channels of the given device. More... | |
__api __check_ret __pure unsigned int | iio_device_get_attrs_count (const struct iio_device *dev) |
Enumerate the device-specific attributes of the given device. More... | |
__api __check_ret __pure unsigned int | iio_device_get_buffer_attrs_count (const struct iio_device *dev) |
Enumerate the buffer-specific attributes of the given device. More... | |
__api __check_ret __pure struct iio_channel * | iio_device_get_channel (const struct iio_device *dev, unsigned int index) |
Get the channel present at the given index. More... | |
__api __check_ret __pure const char * | iio_device_get_attr (const struct iio_device *dev, unsigned int index) |
Get the device-specific attribute present at the given index. More... | |
__api __check_ret __pure const char * | iio_device_get_buffer_attr (const struct iio_device *dev, unsigned int index) |
Get the buffer-specific attribute present at the given index. More... | |
__api __check_ret __pure struct iio_channel * | iio_device_find_channel (const struct iio_device *dev, const char *name, bool output) |
Try to find a channel structure by its name of ID. More... | |
__api __check_ret __pure const char * | iio_device_find_attr (const struct iio_device *dev, const char *name) |
Try to find a device-specific attribute by its name. More... | |
__api __check_ret __pure const char * | iio_device_find_buffer_attr (const struct iio_device *dev, const char *name) |
Try to find a buffer-specific attribute by its name. More... | |
__api __check_ret ssize_t | iio_device_attr_read_raw (const struct iio_device *dev, const char *attr, char *dst, size_t len) |
Read the content of the given device-specific attribute. More... | |
__api __check_ret ssize_t | iio_device_attr_write_raw (const struct iio_device *dev, const char *attr, const void *src, size_t len) |
Set the value of the given device-specific attribute. More... | |
__api __check_ret ssize_t | iio_device_buffer_attr_read_raw (const struct iio_device *dev, unsigned int buf_id, const char *attr, char *dst, size_t len) |
Read the content of the given buffer-specific attribute. More... | |
__api __check_ret ssize_t | iio_device_buffer_attr_write_raw (const struct iio_device *dev, unsigned int buf_id, const char *attr, const void *src, size_t len) |
Set the value of the given buffer-specific attribute. More... | |
__api void | iio_device_set_data (struct iio_device *dev, void *data) |
Associate a pointer to an iio_device structure. More... | |
__api void * | iio_device_get_data (const struct iio_device *dev) |
Retrieve a previously associated pointer of an iio_device structure. More... | |
__api __check_ret int | iio_device_get_trigger (const struct iio_device *dev, const struct iio_device **trigger) |
Retrieve the trigger of a given device. More... | |
__api __check_ret int | iio_device_set_trigger (const struct iio_device *dev, const struct iio_device *trigger) |
Associate a trigger to a given device. More... | |
__api __check_ret __pure bool | iio_device_is_trigger (const struct iio_device *dev) |
Return True if the given device is a trigger. More... | |
#define iio_device_attr_read | ( | dev, | |
attr, | |||
ptr | |||
) |
Read the content of the given device-specific attribute.
dev | A pointer to an iio_device structure |
attr | A NULL-terminated string corresponding to the name of the attribute |
ptr | A pointer to a variable where the value should be stored |
#define iio_device_attr_write | ( | dev, | |
attr, | |||
val | |||
) |
Set the value of the given device-specific attribute.
dev | A pointer to an iio_device structure |
attr | A NULL-terminated string corresponding to the name of the attribute |
val | The value to set the attribute to |
#define iio_device_buffer_attr_read | ( | dev, | |
buf_id, | |||
attr, | |||
ptr | |||
) |
Read the content of the given buffer-specific attribute.
dev | A pointer to an iio_device structure |
buf_id | The index of the hardware buffer (generally 0) |
attr | A NULL-terminated string corresponding to the name of the attribute |
ptr | A pointer to the variable where the value should be stored |
#define iio_device_buffer_attr_write | ( | dev, | |
buf_id, | |||
attr, | |||
val | |||
) |
Set the value of the given buffer-specific attribute.
dev | A pointer to an iio_device structure |
buf_id | The index of the hardware buffer (generally 0) |
attr | A NULL-terminated string corresponding to the name of the attribute |
val | A long long value to set the attribute to |
__api __check_ret ssize_t iio_device_attr_read_raw | ( | const struct iio_device * | dev, |
const char * | attr, | ||
char * | dst, | ||
size_t | len | ||
) |
Read the content of the given device-specific attribute.
dev | A pointer to an iio_device structure |
attr | A NULL-terminated string corresponding to the name of the attribute |
dst | A pointer to the memory area where the NULL-terminated string corresponding to the value read will be stored |
len | The available length of the memory area, in bytes |
__api __check_ret ssize_t iio_device_attr_write_raw | ( | const struct iio_device * | dev, |
const char * | attr, | ||
const void * | src, | ||
size_t | len | ||
) |
Set the value of the given device-specific attribute.
dev | A pointer to an iio_device structure |
attr | A NULL-terminated string corresponding to the name of the attribute |
src | A pointer to the data to be written |
len | The number of bytes that should be written |
__api __check_ret ssize_t iio_device_buffer_attr_read_raw | ( | const struct iio_device * | dev, |
unsigned int | buf_id, | ||
const char * | attr, | ||
char * | dst, | ||
size_t | len | ||
) |
Read the content of the given buffer-specific attribute.
dev | A pointer to an iio_device structure |
buf_id | The index of the hardware buffer (generally 0) |
attr | A NULL-terminated string corresponding to the name of the attribute |
dst | A pointer to the memory area where the NULL-terminated string corresponding to the value read will be stored |
len | The available length of the memory area, in bytes |
__api __check_ret ssize_t iio_device_buffer_attr_write_raw | ( | const struct iio_device * | dev, |
unsigned int | buf_id, | ||
const char * | attr, | ||
const void * | src, | ||
size_t | len | ||
) |
Set the value of the given buffer-specific attribute.
dev | A pointer to an iio_device structure |
buf_id | The index of the hardware buffer (generally 0) |
attr | A NULL-terminated string corresponding to the name of the attribute |
src | A pointer to the data to be written |
len | The number of bytes that should be written |
__api __check_ret __pure const char* iio_device_find_attr | ( | const struct iio_device * | dev, |
const char * | name | ||
) |
Try to find a device-specific attribute by its name.
dev | A pointer to an iio_device structure |
name | A NULL-terminated string corresponding to the name of the attribute |
NOTE: This function is useful to detect the presence of an attribute. It can also be used to retrieve the name of an attribute as a pointer to a static string from a dynamically allocated string.
__api __check_ret __pure const char* iio_device_find_buffer_attr | ( | const struct iio_device * | dev, |
const char * | name | ||
) |
Try to find a buffer-specific attribute by its name.
dev | A pointer to an iio_device structure |
name | A NULL-terminated string corresponding to the name of the attribute |
NOTE: This function is useful to detect the presence of an attribute. It can also be used to retrieve the name of an attribute as a pointer to a static string from a dynamically allocated string.
__api __check_ret __pure struct iio_channel* iio_device_find_channel | ( | const struct iio_device * | dev, |
const char * | name, | ||
bool | output | ||
) |
Try to find a channel structure by its name of ID.
dev | A pointer to an iio_device structure |
name | A NULL-terminated string corresponding to the name or the ID of the channel to search for |
output | True if the searched channel is output, False otherwise |
__api __check_ret __pure const char* iio_device_get_attr | ( | const struct iio_device * | dev, |
unsigned int | index | ||
) |
Get the device-specific attribute present at the given index.
dev | A pointer to an iio_device structure |
index | The index corresponding to the attribute |
__api __check_ret __pure unsigned int iio_device_get_attrs_count | ( | const struct iio_device * | dev | ) |
Enumerate the device-specific attributes of the given device.
dev | A pointer to an iio_device structure |
__api __check_ret __pure const char* iio_device_get_buffer_attr | ( | const struct iio_device * | dev, |
unsigned int | index | ||
) |
Get the buffer-specific attribute present at the given index.
dev | A pointer to an iio_device structure |
index | The index corresponding to the attribute |
__api __check_ret __pure unsigned int iio_device_get_buffer_attrs_count | ( | const struct iio_device * | dev | ) |
Enumerate the buffer-specific attributes of the given device.
dev | A pointer to an iio_device structure |
__api __check_ret __pure struct iio_channel* iio_device_get_channel | ( | const struct iio_device * | dev, |
unsigned int | index | ||
) |
Get the channel present at the given index.
dev | A pointer to an iio_device structure |
index | The index corresponding to the channel |
__api __check_ret __pure unsigned int iio_device_get_channels_count | ( | const struct iio_device * | dev | ) |
Enumerate the channels of the given device.
dev | A pointer to an iio_device structure |
__api __check_ret __pure const struct iio_context* iio_device_get_context | ( | const struct iio_device * | dev | ) |
Retrieve a pointer to the iio_context structure.
dev | A pointer to an iio_device structure |
__api void* iio_device_get_data | ( | const struct iio_device * | dev | ) |
Retrieve a previously associated pointer of an iio_device structure.
dev | A pointer to an iio_device structure |
__api __check_ret __pure const char* iio_device_get_id | ( | const struct iio_device * | dev | ) |
Retrieve the device ID (e.g.
iio:device0)
dev | A pointer to an iio_device structure |
__api __check_ret __pure const char* iio_device_get_label | ( | const struct iio_device * | dev | ) |
Retrieve the device label (e.g.
lo_pll0_rx_adf4351)
dev | A pointer to an iio_device structure |
NOTE: if the device has no label, NULL is returned.
__api __check_ret __pure const char* iio_device_get_name | ( | const struct iio_device * | dev | ) |
Retrieve the device name (e.g.
xadc)
dev | A pointer to an iio_device structure |
NOTE: if the device has no name, NULL is returned.
__api __check_ret int iio_device_get_trigger | ( | const struct iio_device * | dev, |
const struct iio_device ** | trigger | ||
) |
Retrieve the trigger of a given device.
dev | A pointer to an iio_device structure |
trigger | a pointer to a pointer of an iio_device structure. The pointed pointer will be set to the address of the iio_device structure corresponding to the associated trigger device. |
__api __check_ret __pure bool iio_device_is_trigger | ( | const struct iio_device * | dev | ) |
Return True if the given device is a trigger.
dev | A pointer to an iio_device structure |
__api void iio_device_set_data | ( | struct iio_device * | dev, |
void * | data | ||
) |
Associate a pointer to an iio_device structure.
dev | A pointer to an iio_device structure |
data | The pointer to be associated |
__api __check_ret int iio_device_set_trigger | ( | const struct iio_device * | dev, |
const struct iio_device * | trigger | ||
) |
Associate a trigger to a given device.
dev | A pointer to an iio_device structure |
trigger | a pointer to the iio_device structure corresponding to the trigger that should be associated. |