Documentation/iio/iio_devbuf.rst

Source file repositories/reference/linux-study-clean/Documentation/iio/iio_devbuf.rst

File Facts

System
Linux kernel
Corpus path
Documentation/iio/iio_devbuf.rst
Extension
.rst
Size
5835 bytes
Lines
153
Domain
Support Tooling And Documentation
Bucket
Documentation
Inferred role
Support Tooling And Documentation: documentation
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

.. SPDX-License-Identifier: GPL-2.0

=============================
Industrial IIO device buffers
=============================

1. Overview
===========

The Industrial I/O core offers a way for continuous data capture based on a
trigger source. Multiple data channels can be read at once from
``/dev/iio:deviceX`` character device node, thus reducing the CPU load.

Devices with buffer support feature an additional sub-directory in the
``/sys/bus/iio/devices/iio:deviceX/`` directory hierarchy, called bufferY, where
Y defaults to 0, for devices with a single buffer.

2. Buffer attributes
====================

An IIO buffer has an associated attributes directory under
``/sys/bus/iio/iio:deviceX/bufferY/``. The attributes are described below.

``length``
----------

Read / Write attribute which states the total number of data samples (capacity)
that can be stored by the buffer.

``enable``
----------

Read / Write attribute which starts / stops the buffer capture. This file should
be written last, after length and selection of scan elements. Writing a non-zero
value may result in an error, such as EINVAL, if, for example, an unsupported
combination of channels is given.

``watermark``
-------------

Read / Write positive integer attribute specifying the maximum number of scan
elements to wait for.

Poll will block until the watermark is reached.

Blocking read will wait until the minimum between the requested read amount or
the low watermark is available.

Non-blocking read will retrieve the available samples from the buffer even if
there are less samples than the watermark level. This allows the application to
block on poll with a timeout and read the available samples after the timeout
expires and thus have a maximum delay guarantee.

Data available
--------------

Read-only attribute indicating the bytes of data available in the buffer. In the
case of an output buffer, this indicates the amount of empty space available to
write data to. In the case of an input buffer, this indicates the amount of data
available for reading.

Scan elements
-------------

The meta information associated with a channel data placed in a buffer is called
a scan element. The scan elements attributes are presented below.

**_en**

Read / Write attribute used for enabling a channel. If and only if its value

Annotation

Implementation Notes