|
libiio
0.4
Library for interfacing with IIO devices
|
Data Structures | |
| struct | iio_buffer |
| An input or output buffer, used to read or write samples. More... | |
Functions | |
| __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 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 __pure 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_destroy | ( | struct iio_buffer * | buf | ) |
Destroy the given buffer.
| buf | A pointer to an iio_buffer structure |
NOTE: After that function, the iio_buffer pointer shall be invalid.
| __api void* iio_buffer_end | ( | const struct iio_buffer * | buf | ) |
Get the address that follows the last sample in a buffer.
| buf | A pointer to an iio_buffer structure |
| __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.
| buf | A pointer to an iio_buffer structure |
| chn | A pointer to an iio_channel structure |
NOTE: This fonction, 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)) {
....
}
| __api ssize_t iio_buffer_foreach_sample | ( | struct iio_buffer * | buf, |
| ssize_t(*)(const struct iio_channel *chn, void *src, size_t bytes, void *d) | callback, | ||
| void * | data | ||
| ) |
Call the supplied callback for each sample found in a buffer.
| buf | A pointer to an iio_buffer structure |
| callback | A pointer to a function to call for each sample found |
| data | A user-specified pointer that will be passed to the callback |
NOTE: The callback receives four arguments:
| __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 ssize_t iio_buffer_push | ( | struct iio_buffer * | buf | ) |
Send the samples to the hardware.
| buf | A pointer to an iio_buffer structure |
NOTE: Only valid for output buffers
| __api ssize_t iio_buffer_refill | ( | struct iio_buffer * | buf | ) |
Fetch more samples from the hardware.
| buf | A pointer to an iio_buffer structure |
NOTE: Only valid for input buffers
| __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 __pure void* iio_buffer_start | ( | const struct iio_buffer * | buf | ) |
Get the start address of the buffer.
| buf | A pointer to an iio_buffer structure |
| __api ptrdiff_t iio_buffer_step | ( | const struct iio_buffer * | buf | ) |
Get the step size between two samples of one channel.
| buf | A pointer to an iio_buffer structure |
| __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.
| dev | A pointer to an iio_device structure |
| samples_count | The number of samples that the buffer should contain |
| cyclic | If True, enable cyclic mode |
NOTE: Channels that have to be written to / read from must be enabled before creating the buffer.
1.8.13