buffer.jl

AdalmPluto.libIIO_jl.C_iio_buffer_cancelMethod
C_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.

libIIO documentation

source
AdalmPluto.libIIO_jl.C_iio_buffer_endMethod
C_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

libIIO documentation

source
AdalmPluto.libIIO_jl.C_iio_buffer_firstMethod
C_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 structure
  • channel::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

libIIO documentation

source
AdalmPluto.libIIO_jl.C_iio_buffer_foreach_sampleMethod
C_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.

libIIO documentation

source
AdalmPluto.libIIO_jl.C_iio_buffer_get_poll_fdMethod
C_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

libIIO documentation

source
AdalmPluto.libIIO_jl.C_iio_buffer_pushMethod
C_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

libIIO documentation

source
AdalmPluto.libIIO_jl.C_iio_buffer_push_partialMethod
C_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 structure
  • samples_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

libIIO documentation

source
AdalmPluto.libIIO_jl.C_iio_buffer_refillMethod
C_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

libIIO documentation

source
AdalmPluto.libIIO_jl.C_iio_buffer_set_blocking_modeMethod
C_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 structure
  • blocking::Bool : true if the buffer API should be blocking, else false

Returns

  • On success, 0
  • On error, a negative errno code is returned

libIIO documentation

source
AdalmPluto.libIIO_jl.C_iio_device_create_bufferMethod
C_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 structure
  • samples_count::UInt : The number of samples that the buffer should contain
  • cyclic::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.

libIIO documentation

source