buffer.jl
AdalmPluto.libIIO_jl.C_iio_buffer_cancel
AdalmPluto.libIIO_jl.C_iio_buffer_destroy
AdalmPluto.libIIO_jl.C_iio_buffer_end
AdalmPluto.libIIO_jl.C_iio_buffer_first
AdalmPluto.libIIO_jl.C_iio_buffer_foreach_sample
AdalmPluto.libIIO_jl.C_iio_buffer_get_device
AdalmPluto.libIIO_jl.C_iio_buffer_get_poll_fd
AdalmPluto.libIIO_jl.C_iio_buffer_push
AdalmPluto.libIIO_jl.C_iio_buffer_push_partial
AdalmPluto.libIIO_jl.C_iio_buffer_refill
AdalmPluto.libIIO_jl.C_iio_buffer_set_blocking_mode
AdalmPluto.libIIO_jl.C_iio_buffer_start
AdalmPluto.libIIO_jl.C_iio_buffer_step
AdalmPluto.libIIO_jl.C_iio_device_create_buffer
AdalmPluto.libIIO_jl.C_iio_buffer_cancel
— MethodC_iio_buffer_cancel(buffer)
Cancel all buffer operations.
Parameters
buffer::Ptr{iio_buffer}
: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.
AdalmPluto.libIIO_jl.C_iio_buffer_destroy
— MethodC_iio_buffer_destroy(buffer)
Destroy the given buffer.
Parameters
buffer::Ptr{iio_buffer}
: A pointer to an iio_buffer structure
NOTE
After that function, the iio_buffer pointer shall be invalid.
AdalmPluto.libIIO_jl.C_iio_buffer_end
— MethodC_iio_buffer_end(buffer)
Get the address that follows the last sample in a buffer.
Parameters
buffer::Ptr{iio_buffer}
: A pointer to an iio_buffer structure
Returns
- A pointer corresponding to the address that follows the last sample present in the buffer
AdalmPluto.libIIO_jl.C_iio_buffer_first
— MethodC_iio_buffer_first(buffer, channel)
Find the first sample of a channel in a buffer.
Parameters
buffer::Ptr{iio_buffer}
: A pointer to an iio_buffer structurechannel::Ptr{iio_channel}
: A pointer to an iio_channel structure
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
AdalmPluto.libIIO_jl.C_iio_buffer_foreach_sample
— MethodC_iio_buffer_foreach_sample()
THIS IS A PLACEHOLDER. THE DOCUMENTATION BELOW IS ONLY A COPY/PASTE OF THE C DOCUMENTATION.
Call the supplied callback for each sample found in a buffer.
Parameters
- 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
Returns
- number of bytes processed.
NOTE
The callback receives four arguments:
- A pointer to the iio_channel structure corresponding to the sample,
- A pointer to the sample itself,
- The length of the sample in bytes,
- The user-specified pointer passed to
iio_buffer_foreach_sample
.
AdalmPluto.libIIO_jl.C_iio_buffer_get_device
— MethodC_iio_buffer_get_device(buffer)
Retrieve a pointer to the iio_device structure.
Parameters
buffer::Ptr{iio_buffer}
: A pointer to an iio_buffer structure
Returns
- A pointer to an iio_device structure
AdalmPluto.libIIO_jl.C_iio_buffer_get_poll_fd
— MethodC_iio_buffer_get_poll_fd(buffer)
Get a pollable file descriptor.
Can be used to know when iio_buffer_refill()
or iio_buffer_push()
can be called
Parameters
buffer::Ptr{iio_buffer}
: A pointer to an iio_buffer structure
Returns
- On success, valid file descriptor
- On error, a negative errno code is returned
AdalmPluto.libIIO_jl.C_iio_buffer_push
— MethodC_iio_buffer_push(buffer)
Send the samples to the hardware.
Parameters
buffer::Ptr{iio_buffer}
: A pointer to an iio_buffer structure
Returns
- On success, the number of bytes written is returned
- On error, a negative errno code is returned
NOTE
Only valid for output buffers
AdalmPluto.libIIO_jl.C_iio_buffer_push_partial
— MethodC_iio_buffer_push_partial(buffer, sample_count)
Send a given number of samples to the hardware.
Parameters
buffer::Ptr{iio_buffer}
: A pointer to an iio_buffer structuresamples_count::UInt
: The number of samples to submit
Returns
- On success, the number of bytes written is returned
- On error, a negative errno code is returned
NOTE
Only valid for output buffers
AdalmPluto.libIIO_jl.C_iio_buffer_refill
— MethodC_iio_buffer_refill(buffer)
Fetch more samples from the hardware.
Parameters
buffer::Ptr{iio_buffer}
: A pointer to an iio_buffer structure
Returns
- On success, the number of bytes read is returned
- On error, a negative errno code is returned
NOTE
Only valid for input buffers
AdalmPluto.libIIO_jl.C_iio_buffer_set_blocking_mode
— MethodC_iio_buffer_set_blocking_mode(buffer, blocking)
Make iio_buffer_refill()
and iio_buffer_push()
blocking or not.
After this function has been called with blocking == false, iio_buffer_refill()
and iio_buffer_push()
will return -EAGAIN if no data is ready. A device is blocking by default.
Parameters
buffer::Ptr{iio_buffer}
: A pointer to an iio_buffer structureblocking::Bool
: true if the buffer API should be blocking, else false
Returns
- On success, 0
- On error, a negative errno code is returned
AdalmPluto.libIIO_jl.C_iio_buffer_start
— MethodC_iio_buffer_start(buffer)
Get the start address of the buffer.
Parameters
buffer::Ptr{iio_buffer}
: A pointer to an iio_buffer structure
Returns
- A pointer corresponding to the start address of the buffer
AdalmPluto.libIIO_jl.C_iio_buffer_step
— MethodC_iio_buffer_step(buffer)
Get the step size between two samples of one channel.
Parameters
buffer::Ptr{iio_buffer}
: A pointer to an iio_buffer structure
Returns
- the difference between the addresses of two consecutive samples of one same channel
AdalmPluto.libIIO_jl.C_iio_device_create_buffer
— MethodC_iio_device_create_buffer(device, samples_count, cyclic)
Create an input or output buffer associated to the given device.
Parameters
device::Ptr{iio_device}
: A pointer to an iio_device structuresamples_count::UInt
: The number of samples that the buffer should containcyclic::Bool
: If True, enable cyclic mode
Returns
- On success, a pointer to an iio_buffer structure
- On error, if the assertions are enabled, throws an error.
- On error, if the assertions are disabled, returns NULL.
NOTE
Channels that have to be written to / read from must be enabled before creating the buffer.