요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GPL-2.0
.. _GPIOHANDLE_GET_LINE_VALUES_IOCTL:
********************************
GPIOHANDLE_GET_LINE_VALUES_IOCTL
********************************
.. warning::
This ioctl is part of chardev_v1.rst and is obsoleted by
gpio-v2-line-get-values-ioctl.rst.
Name
====
GPIOHANDLE_GET_LINE_VALUES_IOCTL - Get the values of all requested lines.
Synopsis
========
.. c:macro:: GPIOHANDLE_GET_LINE_VALUES_IOCTL
``int ioctl(int handle_fd, GPIOHANDLE_GET_LINE_VALUES_IOCTL, struct gpiohandle_data *values)``
Arguments
=========
``handle_fd``
The file descriptor of the GPIO character device, as returned in the
:c:type:`request.fd<gpiohandle_request>` by gpio-get-linehandle-ioctl.rst.
``values``
The :c:type:`line_values<gpiohandle_data>` to be populated.
Description
===========
Get the values of all requested lines.
The values returned are logical, indicating if the line is active or inactive.
The ``GPIOHANDLE_REQUEST_ACTIVE_LOW`` flag controls the mapping between physical
values (high/low) and logical values (active/inactive).
If ``GPIOHANDLE_REQUEST_ACTIVE_LOW`` is not set then high is active and
low is inactive. If ``GPIOHANDLE_REQUEST_ACTIVE_LOW`` is set then low is active
and high is inactive.
The values of both input and output lines may be read.
For output lines, the value returned is driver and configuration dependent and
may be either the output buffer (the last requested value set) or the input
buffer (the actual level of the line), and depending on the hardware and
configuration these may differ.
This ioctl can also be used to read the line value for line events,
substituting the ``event_fd`` for the ``handle_fd``. As there is only
one line requested in that case, only the one value is returned in ``values``.
Return Value
============
On success 0 and ``values`` populated with the values read.
On error -1 and the ``errno`` variable is set appropriately.
Common error codes are described in error-codes.rst.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
상태, 이름, 호출 형식
1-33`GPIOHANDLE_GET_LINE_VALUES_IOCTL`은 요청한 모든 GPIO line의 값을 가져옵니다. ABI v1 ioctl이며 `gpio-v2-line-get-values-ioctl.rst`로 대체되었습니다.
호출 형식은 `int ioctl(int handle_fd, GPIOHANDLE_GET_LINE_VALUES_IOCTL, struct gpiohandle_data *values)`입니다. `handle_fd`는 `gpio-get-linehandle-ioctl.rst`가 `gpiohandle_request`의 `request.fd`에 반환한 descriptor이고, `values`는 읽은 값을 저장할 `gpiohandle_data` 구조체입니다.
Handle에 포함된 모든 line의 logical value를 한 번에 읽습니다.
.. SPDX-License-Identifier: GPL-2.0
.. _GPIOHANDLE_GET_LINE_VALUES_IOCTL:
********************************
GPIOHANDLE_GET_LINE_VALUES_IOCTL
********************************
.. warning::
This ioctl is part of chardev_v1.rst and is obsoleted by
gpio-v2-line-get-values-ioctl.rst.
Name
====
GPIOHANDLE_GET_LINE_VALUES_IOCTL - Get the values of all requested lines.
Synopsis
========
.. c:macro:: GPIOHANDLE_GET_LINE_VALUES_IOCTL
``int ioctl(int handle_fd, GPIOHANDLE_GET_LINE_VALUES_IOCTL, struct gpiohandle_data *values)``
Arguments
=========
``handle_fd``
The file descriptor of the GPIO character device, as returned in the
:c:type:`request.fd<gpiohandle_request>` by gpio-get-linehandle-ioctl.rst.
``values``
The :c:type:`line_values<gpiohandle_data>` to be populated.
Logical value와 physical level
34-56반환되는 값은 logical value이며 line이 active인지 inactive인지를 나타냅니다. `GPIOHANDLE_REQUEST_ACTIVE_LOW` flag가 physical high/low와 logical active/inactive 사이의 대응을 결정합니다.
`GPIOHANDLE_REQUEST_ACTIVE_LOW`가 없으면 high가 active이고 low가 inactive입니다. Flag가 있으면 반대로 low가 active이고 high가 inactive입니다. Input과 output line의 값 모두 읽을 수 있습니다.
Output line에서 읽히는 값은 driver와 configuration에 따라 output buffer의 마지막 설정값일 수도 있고 input buffer에서 읽은 실제 line level일 수도 있습니다. Hardware와 구성에 따라 두 값은 다를 수 있습니다.
이 ioctl은 `handle_fd` 대신 `event_fd`를 전달하여 line event의 값도 읽을 수 있습니다. Line event에는 line이 하나뿐이므로 `values`에는 값 하나만 반환됩니다.
ioctl은 physical level이 아니라 logical state를 반환합니다.
Descriptor 종류와 polarity 설정을 반영해 logical value를 반환합니다.
Description
===========
Get the values of all requested lines.
The values returned are logical, indicating if the line is active or inactive.
The ``GPIOHANDLE_REQUEST_ACTIVE_LOW`` flag controls the mapping between physical
values (high/low) and logical values (active/inactive).
If ``GPIOHANDLE_REQUEST_ACTIVE_LOW`` is not set then high is active and
low is inactive. If ``GPIOHANDLE_REQUEST_ACTIVE_LOW`` is set then low is active
and high is inactive.
The values of both input and output lines may be read.
For output lines, the value returned is driver and configuration dependent and
may be either the output buffer (the last requested value set) or the input
buffer (the actual level of the line), and depending on the hardware and
configuration these may differ.
This ioctl can also be used to read the line value for line events,
substituting the ``event_fd`` for the ``handle_fd``. As there is only
one line requested in that case, only the one value is returned in ``values``.
반환값
57-63성공하면 0을 반환하고 `values`를 읽은 값으로 채웁니다. 실패하면 -1을 반환하고 `errno`를 알맞게 설정합니다. 공통 오류 코드는 `error-codes.rst`를 따릅니다.
Return Value
============
On success 0 and ``values`` populated with the values read.
On error -1 and the ``errno`` variable is set appropriately.
Common error codes are described in error-codes.rst.
요약·해설
gpio-handle-get-line-values-ioctl.rst:1-63Line handle 또는 event descriptor에서 logical value를 읽고 ACTIVE_LOW polarity를 적용하는 규칙을 설명합니다.
원문의 read/ioctl prototype, struct, flag, errno, clock, buffer 규칙과 줄 좌표를 보존해 전문 번역했습니다.