요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
===========
HW consumer
===========
An IIO device can be directly connected to another device in hardware. In this
case the buffers between IIO provider and IIO consumer are handled by hardware.
The Industrial I/O HW consumer offers a way to bond these IIO devices without
software buffer for data. The implementation can be found under
:file:`drivers/iio/buffer/hw-consumer.c`
* struct iio_hw_consumer — Hardware consumer structure
* :c:func:`iio_hw_consumer_alloc` — Allocate IIO hardware consumer
* :c:func:`iio_hw_consumer_free` — Free IIO hardware consumer
* :c:func:`iio_hw_consumer_enable` — Enable IIO hardware consumer
* :c:func:`iio_hw_consumer_disable` — Disable IIO hardware consumer
HW consumer setup
=================
As standard IIO device the implementation is based on IIO provider/consumer.
A typical IIO HW consumer setup looks like this::
static struct iio_hw_consumer *hwc;
static const struct iio_info adc_info = {
.read_raw = adc_read_raw,
};
static int adc_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan, int *val,
int *val2, long mask)
{
ret = iio_hw_consumer_enable(hwc);
/* Acquire data */
ret = iio_hw_consumer_disable(hwc);
}
static int adc_probe(struct platform_device *pdev)
{
hwc = devm_iio_hw_consumer_alloc(&iio->dev);
}
More details
============
.. kernel-doc:: drivers/iio/buffer/industrialio-hw-consumer.c
:export:
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
IIO hardware consumer
1-17문서 제목은 `HW consumer`입니다. IIO device는 hardware에서 다른 device에 직접 연결될 수 있으며, 이 경우 IIO provider와 IIO consumer 사이의 buffer도 hardware가 처리합니다.
Industrial I/O HW consumer는 data용 software buffer 없이 이런 IIO device를 결합하는 방법을 제공합니다. 구현은 `drivers/iio/buffer/hw-consumer.c` 아래에 있습니다.
`struct iio_hw_consumer`는 hardware consumer structure입니다. `iio_hw_consumer_alloc`·`iio_hw_consumer_free`는 consumer를 할당·해제하고 `iio_hw_consumer_enable`·`iio_hw_consumer_disable`은 동작을 활성화·비활성화합니다.
Software buffer를 거치지 않는 provider·consumer 결합입니다.
HW consumer setup
18-45Standard IIO device와 마찬가지로 구현은 IIO provider/consumer model에 기반합니다. 예제는 managed allocation으로 consumer를 얻고 `read_raw` callback 안에서 acquisition 전후로 consumer를 enable·disable합니다.
static struct iio_hw_consumer *hwc;
static const struct iio_info adc_info = {
.read_raw = adc_read_raw,
};
static int adc_read_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan, int *val,
int *val2, long mask)
{
ret = iio_hw_consumer_enable(hwc);
/* Acquire data */
ret = iio_hw_consumer_disable(hwc);
}
static int adc_probe(struct platform_device *pdev)
{
hwc = devm_iio_hw_consumer_alloc(&iio->dev);
}
Probe allocation에서 hardware acquisition까지의 호출 순서입니다.
HW consumer kernel API source
46-50Exported hardware consumer API의 kernel-doc source는 `drivers/iio/buffer/industrialio-hw-consumer.c`입니다. 앞에서 언급한 구현 경로와 kernel-doc source 이름의 `industrialio-` prefix 차이도 원문 그대로 보존합니다.
.. kernel-doc:: drivers/iio/buffer/industrialio-hw-consumer.c
:export:
개요의 구현 경로와 kernel-doc export 경로입니다.
요약과 해설
hw-consumer.rst:1-50IIO HW consumer는 provider와 consumer 사이 data path를 hardware가 처리할 때 software buffer를 생략합니다. Consumer는 probe에서 managed allocation하고 read path에서 acquisition 전후로 enable·disable합니다.