Original URL: http://blog.csdn.net/tsy20100200/article/details/47101661
Recently, due to the need for work, the Linux IIO subsystem has been contacted, and the Linux IIO subsystem has been analyzed for this directory, which was rarely contacted before.
1, first IIO subsystem in the kernel tree location: drivers/staging/iio
Detailed IIO Subsystem Description document location: Drivers/staging/iio/documentation (document is a good thing, read the document in detail, facilitate a deeper understanding of the IIO subsystem)
2, Introduction:
The IIO subsystem full name is the Industrial I/O subsystem (industrial I/O subsystem), the purpose of which is to fill the type of device that is in the Hwmon (Hardware monitor) and input subsystem for those classifications. In some cases, there is considerable overlap between iio and Hwmon, and input.
3.Iio Directory Architecture:
[Plain]View PlainCopy
- Iio
- ├──accel
- ├──adc
- ├──addac
- ├──cdc
- ├──dac
- ├──dds
- ├──documentation
- │└──dac
- ├──gyro
- ├──impedance-analyzer
- ├──imu
- │└──mpu
- │└──inv_test
- ├──light
- ├──magnetometer
- ├──meter
- ├──pressure
- ├──resolver
- └──trigger
4,IIO directory structure Description:
Enter the corresponding directory, there are relevant IC driver, online access to information, the IIO subsystem to do the following brief description:
Accel:
Under this folder are some accelerometer sensors, for example: adis16201, KXSD9, LIS3L02DQ, sca3000, etc.
Adc:
This folder is a number of analog-to-digital converters that convert analog signals, such as: ad7192, adt7310 (digital temperature sensor), etc.
ADDAC:
Temperature sensor temperature sensors, for example: adt7316
Cdc:
Capacitance-to-digital conversion, for example: ad7150
Dac:
A number-to-analog converter that converts digital signals into analogue signals such as ad5064, ad5791 (single-channel, 20-bit, unbuffered voltage output DAC), etc.
Dds:
Frequency scanners, frequency synthesizers, for example: ad5930, ad9951, etc.
Documentation:
IIO subsystem related document description, related instructions More detailed, the document is a good thing ...
Gyro
Gyroscopes, for example: adis16060 (angular velocity gyroscope), adis16260 (digital gyroscope), adxrs450 (angular rate gyroscope), etc.
Impedance-analyzer:
Impedance measurement chip, only one chip ad5933
Imu:
Inertial gyroscope, magnetometer, accelerometer, for example: adis16400, where the MPU sub-directory has some important sensors (currently working in use)
Imu
└──mpu: MPU3050 (three axes), MPU6050 (six axes), MPU9150 (integrated MPU6050 and AK8975 electronic compass), MPU6515, etc.
Light:
Optical sensors such as: isl29018, tsl2563, etc.
Magnetometer:
Geomagnetic sensors, magnetometer sensors, for example: hmc5843, ak8975
Meter:
Active power and energy metering, e.g. ade7759 (Energy metering data converters), ade7753, etc.
Pressure:
pressure sensors, e.g. bmp182
Resolver:
Resolver/digital converters, e.g. ad2s1200 (conversion of analog signals from rotary transformer outputs to digital signals), etc.
Trigger
Trigger
5.iio Subsystem Architecture diagram:
6,iio subsystem function:
(1), equipment registration and processing
(2), access the device via virtual file system (VFS) rotation
(3), Chrdevs events
Chrdevs events include threshold detectors, free fall detectors, and more complex motion detection. The input of the Chrdevs event, IIO provides a channel for the underlying hardware trigger and user space traffic, the Chrdevs event itself is not just an event code and a timestamp, any data associated with the Chrdevs event must be accessed by polling.
(4), Hardware ring buffer support
Now many sensor chips themselves include fifo/ring buffering, with the sensor to bring the fifo/ring buffer, can greatly reduce the burden of the main chip processor.
(6), Trigger and software buffer (KFIFO) support
In many data analyses, triggering and software buffer (KFIFO) support can be useful for capturing external signal data more efficiently. These triggers include (data preparation signals, GPIO lines connected to external systems, processor cycle interrupts, specific files in user space access Sysfs, and so on).
7. Kernel Interface of IIO subsystem
Provides a core interface for various sensor types
8.IIO subsystem ring buffer (e.g.)
The IIO subsystem uses a ring buffer, and the ring buffer is essentially a data structure (single, fixed size, adjustable and end-to-end), which is ideal for buffered data streams. These buffers are often used to solve the problem of producer consumers, and in some applications it is designed to overwrite outdated data that a consumer (such as a user-space application) cannot temporarily handle for a producer, such as an ADC. But usually this buffer is set to the appropriate size so that this does not happen.
For more detailed instructions, refer to: instructions in the WIKI
"Go" Linux IIO subsystem