libiio
|
Classes | |
struct | iio_block |
A block of memory containing data samples. More... | |
Functions | |
__api __check_ret struct iio_block * | iio_buffer_create_block (struct iio_buffer *buffer, size_t size) |
Create a data block for the given buffer. More... | |
__api void | iio_block_destroy (struct iio_block *block) |
Destroy the given block. More... | |
__api void * | iio_block_start (const struct iio_block *block) |
Get the start address of the block. More... | |
__api void * | iio_block_first (const struct iio_block *block, const struct iio_channel *chn) |
Find the first sample of a channel in a block. More... | |
__api void * | iio_block_end (const struct iio_block *block) |
Get the address after the last sample in a block. More... | |
__api __check_ret ssize_t | iio_block_foreach_sample (const struct iio_block *block, const struct iio_channels_mask *mask, 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 block. More... | |
__api int | iio_block_enqueue (struct iio_block *block, size_t bytes_used, bool cyclic) |
Enqueue the given iio_block to the buffer's queue. More... | |
__api int | iio_block_dequeue (struct iio_block *block, bool nonblock) |
Dequeue the given iio_block from the buffer's queue. More... | |
__api struct iio_buffer * | iio_block_get_buffer (const struct iio_block *block) |
Retrieve a pointer to the iio_buffer structure. More... | |
__api int iio_block_dequeue | ( | struct iio_block * | block, |
bool | nonblock | ||
) |
__api void iio_block_destroy | ( | struct iio_block * | block | ) |
Destroy the given block.
block | A pointer to an iio_block structure |
__api void* iio_block_end | ( | const struct iio_block * | block | ) |
Get the address after the last sample in a block.
block | A pointer to an iio_block structure |
__api int iio_block_enqueue | ( | struct iio_block * | block, |
size_t | bytes_used, | ||
bool | cyclic | ||
) |
Enqueue the given iio_block to the buffer's queue.
block | A pointer to an iio_block structure |
bytes_used | The size of the data from the iio_block to be written, in bytes |
cyclic | If True, enable cyclic mode. The block's content will be repeated on the hardware's output until the buffer is cancelled or destroyed. |
NOTE: After iio_block_enqueue is called, the block's data must not be accessed until iio_block_dequeue successfully returns.
__api void* iio_block_first | ( | const struct iio_block * | block, |
const struct iio_channel * | chn | ||
) |
Find the first sample of a channel in a block.
buf | A pointer to an iio_block structure |
chn | A pointer to an iio_channel structure |
NOTE: This function, coupled with iio_block_end, can be used to iterate on all the samples of a given channel present in the block, doing the following:
for (void *ptr = iio_block_first(block, chn); ptr < iio_block_end(block); ptr += iio_device_get_sample_size(dev, mask)) { .... }
The iio_channel passed as argument must be from the iio_device that was used to create the iio_buffer and then the iio_block, otherwise the result is undefined.
__api __check_ret ssize_t iio_block_foreach_sample | ( | const struct iio_block * | block, |
const struct iio_channels_mask * | mask, | ||
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 block.
block | A pointer to an iio_block 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 struct iio_buffer* iio_block_get_buffer | ( | const struct iio_block * | block | ) |
Retrieve a pointer to the iio_buffer structure.
block | A pointer to an iio_block structure |
__api void* iio_block_start | ( | const struct iio_block * | block | ) |
Get the start address of the block.
buf | A pointer to an iio_block structure |
__api __check_ret struct iio_block* iio_buffer_create_block | ( | struct iio_buffer * | buffer, |
size_t | size | ||
) |
Create a data block for the given buffer.
buf | A pointer to an iio_buffer structure |
size | The size of the block to create, in bytes |