요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
===============================
Industrial IIO configfs support
===============================
1. Overview
===========
Configfs is a filesystem-based manager of kernel objects. IIO uses some
objects that could be easily configured using configfs (e.g.: devices,
triggers).
See Documentation/filesystems/configfs.rst for more information
about how configfs works.
2. Usage
========
In order to use configfs support in IIO we need to select it at compile
time via CONFIG_IIO_CONFIGFS config option.
Then, mount the configfs filesystem (usually under /config directory)::
$ mkdir /config
$ mount -t configfs none /config
At this point, all default IIO groups will be created and can be accessed
under /config/iio. Next chapters will describe available IIO configuration
objects.
3. Software triggers
====================
One of the IIO default configfs groups is the "triggers" group. It is
automagically accessible when the configfs is mounted and can be found
under /config/iio/triggers.
IIO software triggers implementation offers support for creating multiple
trigger types. A new trigger type is usually implemented as a separate
kernel module following the interface in include/linux/iio/sw_trigger.h::
/*
* drivers/iio/trigger/iio-trig-sample.c
* sample kernel module implementing a new trigger type
*/
#include <linux/iio/sw_trigger.h>
static struct iio_sw_trigger *iio_trig_sample_probe(const char *name)
{
/*
* This allocates and registers an IIO trigger plus other
* trigger type specific initialization.
*/
}
static int iio_trig_sample_remove(struct iio_sw_trigger *swt)
{
/*
* This undoes the actions in iio_trig_sample_probe
*/
}
static const struct iio_sw_trigger_ops iio_trig_sample_ops = {
.probe = iio_trig_sample_probe,
.remove = iio_trig_sample_remove,
};
static struct iio_sw_trigger_type iio_trig_sample = {
.name = "trig-sample",
.owner = THIS_MODULE,
.ops = &iio_trig_sample_ops,
};
module_iio_sw_trigger_driver(iio_trig_sample);
Each trigger type has its own directory under /config/iio/triggers. Loading
iio-trig-sample module will create 'trig-sample' trigger type directory
/config/iio/triggers/trig-sample.
We support the following interrupt sources (trigger types):
* hrtimer, uses high resolution timers as interrupt source
3.1 Hrtimer triggers creation and destruction
---------------------------------------------
Loading iio-trig-hrtimer module will register hrtimer trigger types allowing
users to create hrtimer triggers under /config/iio/triggers/hrtimer.
e.g::
$ mkdir /config/iio/triggers/hrtimer/instance1
$ rmdir /config/iio/triggers/hrtimer/instance1
Each trigger can have one or more attributes specific to the trigger type.
3.2 "hrtimer" trigger types attributes
--------------------------------------
"hrtimer" trigger type doesn't have any configurable attribute from /config dir.
It does introduce the sampling_frequency attribute to trigger directory.
That attribute sets the polling frequency in Hz, with mHz precision.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
IIO configfs 개요와 마운트
1-29Configfs는 파일시스템 기반의 커널 객체 관리자입니다. IIO가 사용하는 장치나 trigger 같은 객체는 configfs를 이용해 쉽게 구성할 수 있습니다.
Configfs의 동작 방식에 대한 자세한 내용은 `Documentation/filesystems/configfs.rst`를 참고합니다.
IIO에서 configfs 지원을 사용하려면 컴파일 시 `CONFIG_IIO_CONFIGFS` 구성 옵션을 선택해야 합니다.
그다음 보통 `/config` 디렉터리에 configfs 파일시스템을 마운트합니다.
$ mkdir /config
$ mount -t configfs none /config
마운트가 끝나면 모든 기본 IIO 그룹이 생성되어 `/config/iio` 아래에서 접근할 수 있습니다. 이어지는 절에서 사용 가능한 IIO 구성 객체를 설명합니다.
커널 설정부터 기본 IIO 그룹 접근까지의 순서입니다.
설정 단계와 생성되는 경로를 정리했습니다.
===============================
Industrial IIO configfs support
===============================
1. Overview
===========
Configfs is a filesystem-based manager of kernel objects. IIO uses some
objects that could be easily configured using configfs (e.g.: devices,
triggers).
See Documentation/filesystems/configfs.rst for more information
about how configfs works.
2. Usage
========
In order to use configfs support in IIO we need to select it at compile
time via CONFIG_IIO_CONFIGFS config option.
Then, mount the configfs filesystem (usually under /config directory)::
$ mkdir /config
$ mount -t configfs none /config
At this point, all default IIO groups will be created and can be accessed
under /config/iio. Next chapters will describe available IIO configuration
objects.
Software trigger 유형 구현
30-79IIO의 기본 configfs 그룹 가운데 하나는 `triggers` 그룹입니다. Configfs를 마운트하면 자동으로 접근할 수 있으며 경로는 `/config/iio/triggers`입니다.
IIO software trigger 구현은 여러 trigger 유형을 만들 수 있도록 지원합니다. 새 trigger 유형은 보통 `include/linux/iio/sw_trigger.h`의 인터페이스를 따르는 별도 커널 모듈로 구현합니다.
원문 예제의 `drivers/iio/trigger/iio-trig-sample.c` 모듈은 `probe`에서 IIO trigger를 할당·등록하고 유형별 초기화를 수행하며, `remove`에서 해당 동작을 되돌립니다.
static struct iio_sw_trigger *iio_trig_sample_probe(const char *name)
{
/* Allocate and register an IIO trigger, then initialize it. */
}
static int iio_trig_sample_remove(struct iio_sw_trigger *swt)
{
/* Undo iio_trig_sample_probe(). */
}
두 함수는 `struct iio_sw_trigger_ops`의 `.probe`와 `.remove`에 연결됩니다. Trigger 유형 객체에는 이름 `trig-sample`, 소유자 `THIS_MODULE`, 연산 집합을 넣고 `module_iio_sw_trigger_driver(iio_trig_sample)`로 등록합니다.
static const struct iio_sw_trigger_ops iio_trig_sample_ops = {
.probe = iio_trig_sample_probe,
.remove = iio_trig_sample_remove,
};
static struct iio_sw_trigger_type iio_trig_sample = {
.name = "trig-sample",
.owner = THIS_MODULE,
.ops = &iio_trig_sample_ops,
};
module_iio_sw_trigger_driver(iio_trig_sample);
각 trigger 유형은 `/config/iio/triggers` 아래에 자체 디렉터리를 가집니다. `iio-trig-sample` 모듈을 로드하면 `trig-sample` 유형 디렉터리 `/config/iio/triggers/trig-sample`이 생성됩니다.
샘플 모듈의 객체와 역할을 구조화했습니다.
커널 모듈에서 configfs 디렉터리가 생기는 과정입니다.
3. Software triggers
====================
One of the IIO default configfs groups is the "triggers" group. It is
automagically accessible when the configfs is mounted and can be found
under /config/iio/triggers.
IIO software triggers implementation offers support for creating multiple
trigger types. A new trigger type is usually implemented as a separate
kernel module following the interface in include/linux/iio/sw_trigger.h::
/*
* drivers/iio/trigger/iio-trig-sample.c
* sample kernel module implementing a new trigger type
*/
#include <linux/iio/sw_trigger.h>
static struct iio_sw_trigger *iio_trig_sample_probe(const char *name)
{
/*
* This allocates and registers an IIO trigger plus other
* trigger type specific initialization.
*/
}
static int iio_trig_sample_remove(struct iio_sw_trigger *swt)
{
/*
* This undoes the actions in iio_trig_sample_probe
*/
}
static const struct iio_sw_trigger_ops iio_trig_sample_ops = {
.probe = iio_trig_sample_probe,
.remove = iio_trig_sample_remove,
};
static struct iio_sw_trigger_type iio_trig_sample = {
.name = "trig-sample",
.owner = THIS_MODULE,
.ops = &iio_trig_sample_ops,
};
module_iio_sw_trigger_driver(iio_trig_sample);
Each trigger type has its own directory under /config/iio/triggers. Loading
iio-trig-sample module will create 'trig-sample' trigger type directory
/config/iio/triggers/trig-sample.
Hrtimer trigger 생성·삭제와 속성
80-102지원하는 interrupt source, 즉 trigger 유형에는 고해상도 timer를 interrupt source로 사용하는 `hrtimer`가 있습니다.
`iio-trig-hrtimer` 모듈을 로드하면 hrtimer trigger 유형이 등록되어 사용자가 `/config/iio/triggers/hrtimer` 아래에서 hrtimer trigger를 만들 수 있습니다.
예제는 `instance1` 디렉터리를 만들어 trigger 인스턴스를 생성하고 디렉터리를 제거해 인스턴스를 삭제합니다.
$ mkdir /config/iio/triggers/hrtimer/instance1
$ rmdir /config/iio/triggers/hrtimer/instance1
각 trigger에는 유형에 따라 하나 이상의 전용 속성이 있을 수 있습니다.
`hrtimer` trigger 유형은 `/config` 디렉터리에서 설정할 수 있는 속성을 제공하지 않습니다. 대신 trigger 디렉터리에 `sampling_frequency` 속성을 추가합니다. 이 속성은 mHz 정밀도로 polling frequency를 Hz 단위로 설정합니다.
인스턴스 수명 주기와 주파수 속성을 정리했습니다.
모듈 로드부터 인스턴스 제거까지의 흐름입니다.
We support the following interrupt sources (trigger types):
* hrtimer, uses high resolution timers as interrupt source
3.1 Hrtimer triggers creation and destruction
---------------------------------------------
Loading iio-trig-hrtimer module will register hrtimer trigger types allowing
users to create hrtimer triggers under /config/iio/triggers/hrtimer.
e.g::
$ mkdir /config/iio/triggers/hrtimer/instance1
$ rmdir /config/iio/triggers/hrtimer/instance1
Each trigger can have one or more attributes specific to the trigger type.
3.2 "hrtimer" trigger types attributes
--------------------------------------
"hrtimer" trigger type doesn't have any configurable attribute from /config dir.
It does introduce the sampling_frequency attribute to trigger directory.
That attribute sets the polling frequency in Hz, with mHz precision.
요약·해설
iio_configfs.rst:1-102IIO configfs는 `/config/iio` 아래에서 trigger 같은 커널 객체를 구성합니다. Software trigger 모듈은 probe·remove 연산과 유형 객체를 등록하며, hrtimer 인스턴스는 디렉터리 생성·삭제로 수명 주기를 제어합니다.
원문 분량과 핵심 인터페이스를 요약합니다.
구성과 데이터 처리 순서를 압축합니다.