libiio 1.0
Library for interfacing with IIO devices
Loading...
Searching...
No Matches
Device

Data Structures

struct  iio_device
 Represents a device in the IIO context. More...
 

Functions

__api __check_ret __pure const struct iio_contextiio_device_get_context (const struct iio_device *dev)
 Retrieve a pointer to the iio_context structure.
 
__api __check_ret __pure const char * iio_device_get_id (const struct iio_device *dev)
 Retrieve the device ID (e.g. iio:device0)
 
__api __check_ret __pure const char * iio_device_get_name (const struct iio_device *dev)
 Retrieve the device name (e.g. xadc)
 
__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)
 
__api __check_ret __pure unsigned int iio_device_get_channels_count (const struct iio_device *dev)
 Enumerate the channels of the given device.
 
__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.
 
__api __check_ret __pure unsigned int iio_device_get_buffers_count (const struct iio_device *dev)
 Enumerate the buffers of the given device.
 
__api __check_ret __pure struct iio_channeliio_device_get_channel (const struct iio_device *dev, unsigned int index)
 Get the channel present at the given index.
 
__api __check_ret __pure const struct iio_attriio_device_get_attr (const struct iio_device *dev, unsigned int index)
 Get the device-specific attribute present at the given index.
 
__api __check_ret __pure struct iio_bufferiio_device_get_buffer (const struct iio_device *dev, unsigned int index)
 Get the buffer present at the given index.
 
__api __check_ret __pure struct iio_channeliio_device_find_channel (const struct iio_device *dev, const char *name, bool output)
 Try to find a channel structure by its ID, label or name.
 
__api __check_ret __pure const struct iio_attriio_device_find_attr (const struct iio_device *dev, const char *name)
 Try to find a device-specific attribute by its name.
 
__api void iio_device_set_data (struct iio_device *dev, void *data)
 Associate 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.
 
__api __check_ret const struct iio_deviceiio_device_get_trigger (const struct iio_device *dev)
 Retrieve the trigger of a given device.
 
__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.
 
__api __check_ret __pure bool iio_device_is_trigger (const struct iio_device *dev)
 Return True if the given device is a trigger.
 

Detailed Description

Function Documentation

◆ iio_device_find_attr()

__api __check_ret __pure const struct iio_attr * iio_device_find_attr ( const struct iio_device dev,
const char *  name 
)

Try to find a device-specific attribute by its name.

Parameters
devA pointer to an iio_device structure
nameA NULL-terminated string corresponding to the name of the attribute
Returns
On success, a pointer to an iio_attr structure
If the name does not correspond to any known attribute of the given device, NULL is returned

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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ iio_device_find_channel()

__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 ID, label or name.

Parameters
devA pointer to an iio_device structure
nameA NULL-terminated string corresponding to ID, label or name of the channel to search for
outputTrue if the searched channel is output, False otherwise
Returns
On success, a pointer to an iio_channel structure
If the ID, label or name does not correspond to any known channel of the given device, NULL is returned
Here is the call graph for this function:
Here is the caller graph for this function:

◆ iio_device_get_attr()

__api __check_ret __pure const struct iio_attr * iio_device_get_attr ( const struct iio_device dev,
unsigned int  index 
)

Get the device-specific attribute present at the given index.

Parameters
devA pointer to an iio_device structure
indexThe index corresponding to the attribute
Returns
On success, a pointer to an iio_attr structure
If the index is invalid, NULL is returned
Here is the call graph for this function:
Here is the caller graph for this function:

◆ iio_device_get_attrs_count()

__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.

Parameters
devA pointer to an iio_device structure
Returns
The number of device-specific attributes found
Here is the call graph for this function:
Here is the caller graph for this function:

◆ iio_device_get_buffer()

__api __check_ret __pure struct iio_buffer * iio_device_get_buffer ( const struct iio_device dev,
unsigned int  index 
)

Get the buffer present at the given index.

Parameters
devA pointer to an iio_device structure
indexThe index corresponding to the buffer
Returns
On success, a pointer to an iio_buffer structure
If the index is invalid, NULL is returned

◆ iio_device_get_buffers_count()

__api __check_ret __pure unsigned int iio_device_get_buffers_count ( const struct iio_device dev)

Enumerate the buffers of the given device.

Parameters
devA pointer to an iio_device structure
Returns
The number of buffers found

◆ iio_device_get_channel()

__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.

Parameters
devA pointer to an iio_device structure
indexThe index corresponding to the channel
Returns
On success, a pointer to an iio_channel structure
If the index is invalid, NULL is returned
Here is the call graph for this function:
Here is the caller graph for this function:

◆ iio_device_get_channels_count()

__api __check_ret __pure unsigned int iio_device_get_channels_count ( const struct iio_device dev)

Enumerate the channels of the given device.

Parameters
devA pointer to an iio_device structure
Returns
The number of channels found
Here is the call graph for this function:
Here is the caller graph for this function:

◆ iio_device_get_context()

__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.

Parameters
devA pointer to an iio_device structure
Returns
A pointer to an iio_context structure
Here is the call graph for this function:
Here is the caller graph for this function:

◆ iio_device_get_data()

__api void * iio_device_get_data ( const struct iio_device dev)

Retrieve a previously associated pointer of an iio_device structure.

Parameters
devA pointer to an iio_device structure
Returns
The pointer previously associated if present, or NULL
Here is the call graph for this function:
Here is the caller graph for this function:

◆ iio_device_get_id()

__api __check_ret __pure const char * iio_device_get_id ( const struct iio_device dev)

Retrieve the device ID (e.g. iio:device0)

Parameters
devA pointer to an iio_device structure
Returns
A pointer to a static NULL-terminated string
Here is the call graph for this function:
Here is the caller graph for this function:

◆ iio_device_get_label()

__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)

Parameters
devA pointer to an iio_device structure
Returns
A pointer to a static NULL-terminated string

NOTE: if the device has no label, NULL is returned.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ iio_device_get_name()

__api __check_ret __pure const char * iio_device_get_name ( const struct iio_device dev)

Retrieve the device name (e.g. xadc)

Parameters
devA pointer to an iio_device structure
Returns
A pointer to a static NULL-terminated string

NOTE: if the device has no name, NULL is returned.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ iio_device_get_trigger()

__api __check_ret const struct iio_device * iio_device_get_trigger ( const struct iio_device dev)

Retrieve the trigger of a given device.

Parameters
devA pointer to an iio_device structure
Returns
On success, a pointer to the trigger's iio_device structure is returned.
On failure, a pointer-encoded error is returned. If no trigger has been associated with the given device, the error code will be -ENODEV.

◆ iio_device_is_trigger()

__api __check_ret __pure bool iio_device_is_trigger ( const struct iio_device dev)

Return True if the given device is a trigger.

Parameters
devA pointer to an iio_device structure
Returns
True if the device is a trigger, False otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ iio_device_set_data()

__api void iio_device_set_data ( struct iio_device dev,
void *  data 
)

Associate a pointer to an iio_device structure.

Parameters
devA pointer to an iio_device structure
dataThe pointer to be associated
Here is the call graph for this function:

◆ iio_device_set_trigger()

__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.

Parameters
devA pointer to an iio_device structure
triggera pointer to the iio_device structure corresponding to the trigger that should be associated.
Returns
On success, 0 is returned
On error, a negative errno code is returned
Here is the call graph for this function:
Here is the caller graph for this function: