cl-libiio package provides complete bindings via CFFI for Analog Devices'
should be present on your system for succesfully using this library.
In case of error, some of the libiio functions return the actual negative error-code, but others have pointers as return values. In the later case, those functions set errno in case of error and return a NULL pointer.
I've taken the liberty to implement
cl-libiio in a more consistent
way. In case of error, all functions return NIL together with the error
code and the error code description as a string. That is,
(multiple-value-bind (ret errno err-string) (iio-create-context-from-uri "ip:192.168.2.12") (list ret errno err-string))
API (exported functions)
Some extra functionality not provided by the libiio is exported and mentioned as such in the documentation.
Get the type of the given channel.
Read the content of all buffer-specific attributes. libiio function available, but we don't use that.
Return all channel attributes as strings. [EXTRA]
Retrieve the channel ID.
Get the channel present at the given index.
Get the channel-specific attribute present at the given index.
Configure the number of kernel buffers for a device.
Return t if the channel is enabled.
Read the content of the given channel-specific attribute.
Send a given number of samples to the hardware.
Get all the avaliable backends, as strings.
Obtain a XML representation of the given context.
Read the content of the given device-specific attribute.
Return t if the given channel is a scan element.
Create a context besed on the backend (ip, usb or xml). Use empty string for backend to search all of them.
Return the device attributes as strings. [EXTRA]
Get the number of context-specific attributes.
Create a context from a URI description.
Get the number of available backends
Get the current sample size. On success, the sample size in bytes is returned. Warning! The sample size is not constant and will change when channels get enabled or disabled, for example: If one channel is enabled and the returned sample size is two (bytes); and if then another channel is enabled and the returned sample size is four (bytes), and you create a buffer with 10 samples count, then the buffer will be filled with 40 bytes, where the first two bytes are the first channel sample, the next two bytes are the second channel sample, and so on.
Enumerate the device-specific attributes of the given device
Try to find a device structure by its name of ID.
Enumerate available contexts.
[Not implemented] Call the supplied callback for each sample found
in a buffer.
Enumerate the buffer-specific attributes of the given device.
Return t if the given channel is an output channel.
Return all channels for the given device, as pointers to channels [EXTRA].
Return the number of samples currently in the buffer. [EXTRA]
Retrieve the device name.
Retrieve the name and value of a context-specific attribute.
Return all the context's attributes and values [EXTRA].
Fetch more samples from the hardware.
Try to find a device-specific attribute by its name
Enumerate the devices found in the given context.
Retrieve the value of a context-specific attribute.
Get a pointer to a channel's data format structure
Read all device attributes. [EXTRA]
[Not implemented] Convert and multiplex the samples of a given
Create a context from a XML file
Return the number of enabled channels for the device. [EXTRA]
Get a description of the given context.
Get the device-specific attribute present at the given index.
Enable the given channel.
Enumerate the channel-specific attributes of the given channel.
Duplicate a pre-existing IIO context.
Try to find a channel-specific attribute by its name.
Associate a trigger to a given device.
Create a context from local or remote IIO devices.
Get a string description of the error code.
Retrieve the filename of an attribute.
Try to find a buffer-specific attribute by its name.
Get the address that follows the last sample in a buffer.
Returns a list of enabled channels, as pointers. [EXTRA]
Return all devices for the given context, as strings [EXTRA].
Destroy the given context.
Create a context from the network
Return the buffer values for a single channel.
Create a context from local IIO devices (Linux only).
Get the modifier type of the given channel.
Return t if return-code is non-negative [EXTRA]. Useful for libiio functions which signal an error by returning a negative error code.
Read the content of all channel-specific attributes. libiio function available, but we don't use that.
Return all channels for the given device, as strings [EXTRA].
Set a timeout for I/O operations.
Check if the specified backend is available.
Create a context from XML data in memory
Get the name of the given context.
Create an input or output buffer associated to the given device.
Destroy the given scan context.
Return all the context's attributes, as strings [EXTRA].
Return t if the given device is a trigger.
Set the value of the given device-specific attribute.
Get the version of the backend in use.
Retrieve a pointer to the iio_context structure.
Send the samples to the hardware.
Set the value of the given channel-specific attribute.
Retrieve the device ID.
Retrieve a pointer to the iio_device structure.
Enumerate the channels of the given device.
Disable the given channel.
Get the version of the libiio library.
Read the content of all device-specific attributes. libiio function available, but we don't use that.
Get the step size between two samples of one channel.
Get the index of the given channel
Get the device present at the given index.
Return the buffer values for all the enabled channels. [EXTRA] The return values are lists where the first element is the channel id and the second element is the samples read from the buffer.
Destroy the given buffer.
Get the start address of the buffer
Find the first sample of a channel in a buffer.
Retrieve a pointer to the iio_device structure.
[Not implemented] Demultiplex and convert the samples of a given channel.
Retrieve the channel name.
Try to find a channel structure by its name of ID.