“IIO libiio”的版本间的差异

来自百问网嵌入式Linux wiki
(已保护“IIO libiio”([编辑=仅允许管理员](无限期)[移动=仅允许管理员](无限期)))
 
第1行: 第1行:
[[Category:Linux_Operating_System]][[Category:Analog]][[Category:IIO]]
+
''Libiio'' is a complete library which offers tools and an interface to develop an application using [[IIO overview|IIO subsystem]].
 +
 
 +
== Article purpose ==
 +
The purpose of this article is to:
 +
* briefly introduce the ''libiio'' main features and API
 +
* provide few examples, using ''libiio'' tools
 +
 
 +
== Introduction ==
 +
* ''Libiio'' is a [[IIO_overview#User_space_interface|user space]] library that provides an '''interface''' for user space applications. It is basically a wrapper that resides above the following interfaces:
 +
# '''/sys/bus/iio/devices''' sysfs interface (for configuration/setting)
 +
# '''/dev/iio/deviceX''' device interface (for data)
 +
* ''Libiio'' also provides '''tools''' that can be used for testing
 +
* ''Libiio'' design goals:
 +
# Interface with the kernel, to access IIO<ref name="IIO overview">[[IIO overview]], IIO subsystem overview</ref> devices
 +
# Provide proper data structures and functions to the user application
 +
# Support for local and remote backends allowing applications to access the devices when running on a local or a remote machine
 +
 
 +
The full description of the IIO library is provided by the author of the library, see below references:
 +
* What is libiio<ref>[https://wiki.analog.com/resources/tools-software/linux-software/libiio https://wiki.analog.com/resources/tools-software/linux-software/libiio], What is libiio</ref>.
 +
* About libiio<ref>[https://wiki.analog.com/resources/tools-software/linux-software/libiio_internals https://wiki.analog.com/resources/tools-software/linux-software/libiio_internals], About libiio</ref>.
 +
 
 +
== API description ==
 +
The API description can be found here: https://analogdevicesinc.github.io/libiio
 +
 
 +
== Tools ==
 +
''Libiio'' offers tools such as:
 +
* ''iiod'' server daemon
 +
* ''iio_info'' to dump attributes
 +
root@stm32mp1:~# iio_info
 +
Library version: 0.8 (git tag: v0.8)
 +
IIO context created with local backend.
 +
Backend version: 0.8 (git tag: v0.8)
 +
Backend description string: Linux stm32mp1 4.14.0-00004-gafe4a31 #778 SMP PREEMPT Tue Aug 28 14:02:25 CEST 2018 armv7l
 +
IIO context has 3 devices:
 +
        {{highlight|trigger1}}: tim6_trgo
 +
                0 channels found:
 +
                3 device-specific attributes found:
 +
                                attr 0: sampling_frequency value: 100
 +
                                attr 1: master_mode value: reset
 +
                                attr 2: master_mode_available value: reset enable update compare_pulse OC1REF OC2REF OC3REF OC4REF
 +
        {{highlight|iio:device0}}: 48003000.adc:adc@0 (buffer capable)
 +
                2 channels found:
 +
                        {{highlight|voltage0}}:  (input, index: 0, format: le:U16/16>>0)
 +
                        3 channel-specific attributes found:
 +
                                attr 0: raw value: 72
 +
                                attr 1: offset value: 0
 +
                                attr 2: scale value: 0.044250488
 +
                        {{highlight|voltage1}}:  (input, index: 1, format: le:U16/16>>0)
 +
                        3 channel-specific attributes found:
 +
                                attr 0: raw value: 1746
 +
                                attr 1: offset value: 0
 +
                                attr 2: scale value: 0.044250488
 +
...
 +
* ''iio_readdev''<ref>[https://wiki.analog.com/resources/tools-software/linux-software/libiio/iio_readdev https://wiki.analog.com/resources/tools-software/linux-software/libiio/iio_readdev], iio_readdev</ref> (to read or scan from a device)
 +
STM32AP [rc=0]# iio_readdev -t {{highlight|trigger1}} -s 8 -b 8 {{highlight|iio:device0}} {{highlight|voltage0 voltage1}} | hexdump
 +
0000000 0068 055a 0058 0520 00b4 03df 0070 055f
 +
0000010 0096 03d6 0089 038f 0077 05c8 0096 03b3
 +
See also: [[How to use the IIO user space interface]]
 +
 
 +
== Source code ==
 +
''Libiio'' can be downloaded on a public github<ref>[https://github.com/analogdevicesinc/libiio https://github.com/analogdevicesinc/libiio], libiio download link </ref>. It can be cloned using git command:
 +
<pre>git clone https://github.com/analogdevicesinc/libiio.git</pre>
 +
Tools source code can be found under libiio "[https://github.com/analogdevicesinc/libiio/tree/master/tests tests]" directory.
 +
 
 +
== Installation on your target ==
 +
''Libiio'' and the tools it provides are embedded by default in [[OpenSTLinux distribution]].
 +
 
 +
==References==
 +
<references />
 +
 
 +
<noinclude>
 +
[[Category:IIO|1]]
 +
{{PublicationRequestId | 9165 | 2018-10-18 | BrunoB}}
 +
</noinclude>

2020年5月6日 (三) 23:21的最新版本

Libiio is a complete library which offers tools and an interface to develop an application using IIO subsystem.

Article purpose

The purpose of this article is to:

  • briefly introduce the libiio main features and API
  • provide few examples, using libiio tools

Introduction

  • Libiio is a user space library that provides an interface for user space applications. It is basically a wrapper that resides above the following interfaces:
  1. /sys/bus/iio/devices sysfs interface (for configuration/setting)
  2. /dev/iio/deviceX device interface (for data)
  • Libiio also provides tools that can be used for testing
  • Libiio design goals:
  1. Interface with the kernel, to access IIO[1] devices
  2. Provide proper data structures and functions to the user application
  3. Support for local and remote backends allowing applications to access the devices when running on a local or a remote machine

The full description of the IIO library is provided by the author of the library, see below references:

  • What is libiio[2].
  • About libiio[3].

API description

The API description can be found here: https://analogdevicesinc.github.io/libiio

Tools

Libiio offers tools such as:

  • iiod server daemon
  • iio_info to dump attributes
root@stm32mp1:~# iio_info 
Library version: 0.8 (git tag: v0.8)
IIO context created with local backend.
Backend version: 0.8 (git tag: v0.8)
Backend description string: Linux stm32mp1 4.14.0-00004-gafe4a31 #778 SMP PREEMPT Tue Aug 28 14:02:25 CEST 2018 armv7l
IIO context has 3 devices:
        trigger1: tim6_trgo
                0 channels found:
                3 device-specific attributes found:
                                attr 0: sampling_frequency value: 100
                                attr 1: master_mode value: reset
                                attr 2: master_mode_available value: reset enable update compare_pulse OC1REF OC2REF OC3REF OC4REF
        iio:device0: 48003000.adc:adc@0 (buffer capable)
                2 channels found:
                        voltage0:  (input, index: 0, format: le:U16/16>>0)
                        3 channel-specific attributes found:
                                attr 0: raw value: 72
                                attr 1: offset value: 0
                                attr 2: scale value: 0.044250488
                        voltage1:  (input, index: 1, format: le:U16/16>>0)
                        3 channel-specific attributes found:
                                attr 0: raw value: 1746
                                attr 1: offset value: 0
                                attr 2: scale value: 0.044250488
...
  • iio_readdev[4] (to read or scan from a device)
STM32AP [rc=0]# iio_readdev -t trigger1 -s 8 -b 8 iio:device0 voltage0 voltage1 | hexdump
0000000 0068 055a 0058 0520 00b4 03df 0070 055f
0000010 0096 03d6 0089 038f 0077 05c8 0096 03b3

See also: How to use the IIO user space interface

Source code

Libiio can be downloaded on a public github[5]. It can be cloned using git command:

git clone https://github.com/analogdevicesinc/libiio.git

Tools source code can be found under libiio "tests" directory.

Installation on your target

Libiio and the tools it provides are embedded by default in OpenSTLinux distribution.

References

<securetransclude src="ProtectedTemplate:PublicationRequestId" params="9165 | 2018-10-18 | BrunoB"></securetransclude>