Index

Documentation

LibIIO.CLibIIO.iio_device_create_bufferFunction
iio_device_create_buffer(dev, samples_count, cyclic)

Create an input or output buffer associated to the given device.

Parameters

  • dev::Ptr{iio_device} : A pointer to an iio_device structure
  • samples_count::Csize_t : 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, an error is raised
Note

Channels that have to be written to / read from must be enabled before creating the buffer.

See libiio

source
LibIIO.CLibIIO.iio_buffer_destroyFunction
iio_buffer_destroy(buf)

Destroy the given buffer.

Parameters

  • buf::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

See libiio

source
LibIIO.CLibIIO.iio_buffer_set_blocking_modeFunction
iio_buffer_set_blocking_mode(buf, 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

  • buf::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

See libiio

source
LibIIO.CLibIIO.iio_buffer_refillFunction
iio_buffer_refill(buf)

Fetch more samples from the hardware.

Parameters

  • buf::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

See libiio

source
LibIIO.CLibIIO.iio_buffer_pushFunction
iio_buffer_push(buf)

Send the samples to the hardware.

Parameters

  • buf::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

See libiio

source
LibIIO.CLibIIO.iio_buffer_push_partialFunction
iio_buffer_push_partial(buf, samples_count)

Send a given number of samples to the hardware.

Parameters

  • buf::Ptr{iio_buffer} : A pointer to an iio_buffer structure
  • samples_count::Csize_t : 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

See libiio

source
LibIIO.CLibIIO.iio_buffer_cancelFunction
iio_buffer_cancel(buf)

Cancel all buffer operations.

Parameters

  • buf::Ptr{iio_buffer} : A pointer to an iio_buffer structure

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.

See libiio

source
LibIIO.CLibIIO.iio_buffer_firstFunction
iio_buffer_first(buf, chn)

Find the first sample of a channel in a buffer.

Parameters

  • buf::Ptr{iio_buffer} : A pointer to an iio_buffer structure
  • chn::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
Note

This function, coupled with iiobufferstep and iiobufferend, can be used to iterate on all the samples of a given channel present in the buffer, doing the following:

# Note that you have to adjust the end of the range for Julia, as the last value is included
for ptr in iio_buffer_first(buf, chn):iio_buffer_step(buf):(iio_buffer_end(buf) - iio_buffer_step(buf))
    ....
end

See libiio

source
LibIIO.CLibIIO.iio_buffer_stepFunction
iio_buffer_step(buf)

Get the step size between two samples of one channel.

Parameters

  • buf::Ptr{iio_buffer} : A pointer to an iio_buffer structure

Returns

  • The difference between the addresses of two consecutive samples of one same channel

See libiio

source
LibIIO.CLibIIO.iio_buffer_endFunction
iio_buffer_end(buf)

Get the address that follows the last sample in a buffer.

Parameters

  • buf::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

See libiio

source
LibIIO.CLibIIO.iio_buffer_foreach_sampleFunction
iio_buffer_foreach_sample(buf, callback, data)

Call the supplied callback each sample found in a buffer.

Parameters

  • buf::Ptr{iio_buffer} : A pointer to an iio_buffer structure
  • callback::Ptr{Cvoid} : A pointer to a function to call for each sample found
  • data::Ptr{Cvoid} : 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.

See libiio

source