libiio
|
Classes | |
struct | iio_buffer |
An input or output buffer, used to read or write samples. More... | |
Functions | |
__api __check_ret __pure const struct iio_device * | iio_buffer_get_device (const struct iio_buffer *buf) |
Retrieve a pointer to the iio_device structure. More... | |
__api __check_ret struct iio_buffer * | iio_device_create_buffer (const struct iio_device *dev, unsigned int idx, const struct iio_channels_mask *mask) |
Create an input or output buffer associated to the given device. More... | |
__api void | iio_buffer_set_data (struct iio_buffer *buf, void *data) |
Associate a pointer to an iio_buffer structure. More... | |
__api void * | iio_buffer_get_data (const struct iio_buffer *buf) |
Retrieve a previously associated pointer of an iio_buffer structure. More... | |
__api void | iio_buffer_destroy (struct iio_buffer *buf) |
Destroy the given buffer. More... | |
__api void | iio_buffer_cancel (struct iio_buffer *buf) |
Cancel all buffer operations. More... | |
__api __check_ret int | iio_buffer_enable (struct iio_buffer *buf) |
Enable the buffer. More... | |
__api int | iio_buffer_disable (struct iio_buffer *buf) |
Disable the buffer. More... | |
__api const struct iio_channels_mask * | iio_buffer_get_channels_mask (const struct iio_buffer *buf) |
Retrieve a mask of the channels enabled for the given buffer. More... | |
__api void iio_buffer_cancel | ( | struct iio_buffer * | buf | ) |
Cancel all buffer operations.
buf | The buffer for which operations should be canceled |
This function cancels all outstanding buffer operations previously scheduled. This means that any pending iio_block_enqueue() or iio_block_dequeue() operation will abort and return immediately, any further invocation of these functions on the same buffer will return immediately with an error.
Usually iio_block_dequeue() will block until all data has been transferred or a timeout occurs. This can depending on the configuration take a significant amount of time. iio_buffer_cancel() is useful to bypass these conditions if the buffer operation is supposed to be stopped in response to an external event (e.g. user input).
To be able to transfer additional data after calling this function the buffer should be destroyed and then re-created.
This function can be called multiple times for the same buffer, but all but the first invocation will be without additional effect.
This function is thread-safe, but not signal-safe, i.e. it must not be called from a signal handler.
__api void iio_buffer_destroy | ( | struct iio_buffer * | buf | ) |
Destroy the given buffer.
buf | A pointer to an iio_buffer structure |
__api int iio_buffer_disable | ( | struct iio_buffer * | buf | ) |
Disable the buffer.
buf | A pointer to an iio_buffer structure |
__api __check_ret int iio_buffer_enable | ( | struct iio_buffer * | buf | ) |
Enable the buffer.
buf | A pointer to an iio_buffer structure |
__api const struct iio_channels_mask* iio_buffer_get_channels_mask | ( | const struct iio_buffer * | buf | ) |
Retrieve a mask of the channels enabled for the given buffer.
buf | A pointer to an iio_buffer structure |
NOTE: The mask returned may contain more enabled channels than the mask used for creating the buffer.
__api void* iio_buffer_get_data | ( | const struct iio_buffer * | buf | ) |
Retrieve a previously associated pointer of an iio_buffer structure.
buf | A pointer to an iio_buffer structure |
__api __check_ret __pure const struct iio_device* iio_buffer_get_device | ( | const struct iio_buffer * | buf | ) |
Retrieve a pointer to the iio_device structure.
buf | A pointer to an iio_buffer structure |
__api void iio_buffer_set_data | ( | struct iio_buffer * | buf, |
void * | data | ||
) |
Associate a pointer to an iio_buffer structure.
buf | A pointer to an iio_buffer structure |
data | The pointer to be associated |
__api __check_ret struct iio_buffer* iio_device_create_buffer | ( | const struct iio_device * | dev, |
unsigned int | idx, | ||
const struct iio_channels_mask * | mask | ||
) |
Create an input or output buffer associated to the given device.
dev | A pointer to an iio_device structure |
idx | The index of the hardware buffer. Should be 0 in most cases. |
mask | A pointer to an iio_channels_mask structure |