|
__api __pure const struct iio_device * | iio_buffer_get_device (const struct iio_buffer *buf) |
| Retrieve a pointer to the iio_device structure. More...
|
|
__api struct iio_buffer * | iio_device_create_buffer (const struct iio_device *dev, size_t samples_count, bool cyclic) |
| Create an input or output buffer associated to the given device. More...
|
|
__api void | iio_buffer_destroy (struct iio_buffer *buf) |
| Destroy the given buffer. More...
|
|
__api int | iio_buffer_get_poll_fd (struct iio_buffer *buf) |
| Get a pollable file descriptor. More...
|
|
__api int | iio_buffer_set_blocking_mode (struct iio_buffer *buf, bool blocking) |
| Make iio_buffer_refill() and iio_buffer_push() blocking or not. More...
|
|
__api ssize_t | iio_buffer_refill (struct iio_buffer *buf) |
| Fetch more samples from the hardware. More...
|
|
__api ssize_t | iio_buffer_push (struct iio_buffer *buf) |
| Send the samples to the hardware. More...
|
|
__api ssize_t | iio_buffer_push_partial (struct iio_buffer *buf, size_t samples_count) |
| Send a given number of samples to the hardware. More...
|
|
__api void | iio_buffer_cancel (struct iio_buffer *buf) |
| Cancel all buffer operations. More...
|
|
__api void * | iio_buffer_start (const struct iio_buffer *buf) |
| Get the start address of the buffer. More...
|
|
__api void * | iio_buffer_first (const struct iio_buffer *buf, const struct iio_channel *chn) |
| Find the first sample of a channel in a buffer. More...
|
|
__api ptrdiff_t | iio_buffer_step (const struct iio_buffer *buf) |
| Get the step size between two samples of one channel. More...
|
|
__api void * | iio_buffer_end (const struct iio_buffer *buf) |
| Get the address that follows the last sample in a buffer. More...
|
|
__api ssize_t | iio_buffer_foreach_sample (struct iio_buffer *buf, ssize_t(*callback)(const struct iio_channel *chn, void *src, size_t bytes, void *d), void *data) |
| Call the supplied callback for each sample found in a buffer. 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_cancel |
( |
struct iio_buffer * |
buf | ) |
|
Cancel all buffer operations.
- Parameters
-
buf | The buffer for which operations should be canceled |
This function cancels all outstanding buffer operations previously scheduled. This means any pending iio_buffer_push() or iio_buffer_refill() operation will abort and return immediately, any further invocations of these functions on the same buffer will return immediately with an error.
Usually iio_buffer_push() and iio_buffer_refill() will block until either 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 capture 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.
Find the first sample of a channel in a buffer.
- Parameters
-
- Returns
- A pointer to the first sample found, or to the end of the buffer if no sample for the given channel is present in the buffer
NOTE: This function, coupled with iio_buffer_step and iio_buffer_end, can be used to iterate on all the samples of a given channel present in the buffer, doing the following:
for (void *ptr = iio_buffer_first(buffer, chn); ptr < iio_buffer_end(buffer); ptr += iio_buffer_step(buffer)) {
....
}