Skip to content

Commit 452f81e

Browse files
Yanteng SiJonathan Corbet
authored andcommitted
docs/zh_CN: add iio iio_configfs.rst translation
This patch translates Documentation/iio/iio_configfs.rst into Chinese. Signed-off-by: Yanteng Si <siyanteng@loongson.cn> Reviewed-by: Alex Shi <alex.shi@linux.alibaba.com> Reviewed-by: Huacai Chen <chenhuacai@kernel.org> Link: https://lore.kernel.org/r/20210121033302.558935-1-siyanteng@loongson.cn Signed-off-by: Jonathan Corbet <corbet@lwn.net>
1 parent 56c6092 commit 452f81e

1 file changed

Lines changed: 102 additions & 0 deletions

File tree

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
.. include:: ../disclaimer-zh_CN.rst
2+
3+
:Original: :doc:`../../../iio/iio_configfs`
4+
:Translator: Yanteng Si <siyanteng@loongson.cn>
5+
6+
.. _cn_iio_configfs:
7+
8+
9+
=====================
10+
工业 IIO configfs支持
11+
=====================
12+
13+
1. 概述
14+
=======
15+
16+
Configfs是一种内核对象的基于文件系统的管理系统,IIO使用一些可以通过
17+
configfs轻松配置的对象(例如:设备,触发器)。
18+
19+
关于configfs是如何运行的,请查阅Documentation/filesystems/configfs.rst
20+
了解更多信息。
21+
22+
2. 用法
23+
=======
24+
为了使configfs支持IIO,我们需要在编译时选中config的CONFIG_IIO_CONFIGFS
25+
选项。
26+
27+
然后,挂载configfs文件系统(通常在 /config directory目录下)::
28+
29+
$ mkdir/config
30+
$ mount -t configfs none/config
31+
32+
此时,将创建所有默认IIO组,并可以在/ config / iio下对其进行访问。 下一章
33+
将介绍可用的IIO配置对象。
34+
35+
3. 软件触发器
36+
=============
37+
38+
IIO默认configfs组之一是“触发器”组。 挂载configfs后可以自动访问它,并且可
39+
以在/config/iio/triggers下找到。
40+
41+
IIO软件触发器为创建多种触发器类型提供了支持。 通常在include/linux/iio
42+
/sw_trigger.h:中的接口下将新的触发器类型实现为单独的内核模块:
43+
::
44+
45+
/*
46+
* drivers/iio/trigger/iio-trig-sample.c
47+
* 一种新触发器类型的内核模块实例
48+
*/
49+
#include <linux/iio/sw_trigger.h>
50+
51+
52+
static struct iio_sw_trigger *iio_trig_sample_probe(const char *name)
53+
{
54+
/*
55+
* 这将分配并注册一个IIO触发器以及其他触发器类型特性的初始化。
56+
*/
57+
}
58+
59+
static int iio_trig_sample_remove(struct iio_sw_trigger *swt)
60+
{
61+
/*
62+
* 这会废弃iio_trig_sample_probe中的操作
63+
*/
64+
}
65+
66+
static const struct iio_sw_trigger_ops iio_trig_sample_ops = {
67+
.probe = iio_trig_sample_probe,
68+
.remove = iio_trig_sample_remove,
69+
};
70+
71+
static struct iio_sw_trigger_type iio_trig_sample = {
72+
.name = "trig-sample",
73+
.owner = THIS_MODULE,
74+
.ops = &iio_trig_sample_ops,
75+
};
76+
77+
module_iio_sw_trigger_driver(iio_trig_sample);
78+
79+
每种触发器类型在/config/iio/triggers下都有其自己的目录。 加载iio-trig-sample
80+
模块将创建“ trig-sample”触发器类型目录/config/iio/triggers/trig-sample.
81+
82+
我们支持以下中断源(触发器类型)
83+
84+
* hrtimer,使用高分辨率定时器作为中断源
85+
86+
3.1 Hrtimer触发器创建与销毁
87+
---------------------------
88+
89+
加载iio-trig-hrtimer模块将注册hrtimer触发器类型,从而允许用户在
90+
/config/iio/triggers/hrtimer下创建hrtimer触发器。
91+
92+
例如::
93+
94+
$ mkdir /config/iio/triggers/hrtimer/instance1
95+
$ rmdir /config/iio/triggers/hrtimer/instance1
96+
97+
每个触发器可以具有一个或多个独特的触发器类型的属性。
98+
99+
3.2 "hrtimer" 触发器类型属性
100+
----------------------------
101+
102+
"hrtimer”触发器类型没有来自/config dir的任何可配置属性。

0 commit comments

Comments
 (0)