요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
.. SPDX-License-Identifier: GPL-2.0
.. _GPIO_V2_LINE_GET_VALUES_IOCTL:
*****************************
GPIO_V2_LINE_GET_VALUES_IOCTL
*****************************
Name
====
GPIO_V2_LINE_GET_VALUES_IOCTL - Get the values of requested lines.
Synopsis
========
.. c:macro:: GPIO_V2_LINE_GET_VALUES_IOCTL
``int ioctl(int req_fd, GPIO_V2_LINE_GET_VALUES_IOCTL, struct gpio_v2_line_values *values)``
Arguments
=========
``req_fd``
The file descriptor of the GPIO character device, as returned in the
:c:type:`request.fd<gpio_v2_line_request>` by gpio-v2-get-line-ioctl.rst.
``values``
The :c:type:`line_values<gpio_v2_line_values>` to get with the ``mask`` set
to indicate the subset of requested lines to get.
Description
===========
Get the values of requested lines.
The values returned are logical, indicating if the line is active or inactive.
The ``GPIO_V2_LINE_FLAG_ACTIVE_LOW`` flag controls the mapping between physical
values (high/low) and logical values (active/inactive).
If ``GPIO_V2_LINE_FLAG_ACTIVE_LOW`` is not set then high is active and low is
inactive. If ``GPIO_V2_LINE_FLAG_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.
Return Value
============
On success 0 and the corresponding :c:type:`values.bits<gpio_v2_line_values>`
contain the value read.
On error -1 and the ``errno`` variable is set appropriately.
Common error codes are described in error-codes.rst.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
이름, 호출 형식, 인자
1-30`GPIO_V2_LINE_GET_VALUES_IOCTL`은 이미 요청한 GPIO line들의 값을 읽습니다. 호출 형식은 `int ioctl(int req_fd, GPIO_V2_LINE_GET_VALUES_IOCTL, struct gpio_v2_line_values *values)`입니다.
`req_fd`는 line 요청 파일 디스크립터입니다. `values.mask`는 요청에 포함된 line 가운데 실제로 읽을 부분집합을 지정하고, kernel은 대응하는 결과를 같은 `gpio_v2_line_values`의 `bits`에 기록합니다.
mask의 bit 위치는 line 요청 안에서의 line 순서를 가리킵니다.
.. SPDX-License-Identifier: GPL-2.0
.. _GPIO_V2_LINE_GET_VALUES_IOCTL:
*****************************
GPIO_V2_LINE_GET_VALUES_IOCTL
*****************************
Name
====
GPIO_V2_LINE_GET_VALUES_IOCTL - Get the values of requested lines.
Synopsis
========
.. c:macro:: GPIO_V2_LINE_GET_VALUES_IOCTL
``int ioctl(int req_fd, GPIO_V2_LINE_GET_VALUES_IOCTL, struct gpio_v2_line_values *values)``
Arguments
=========
``req_fd``
The file descriptor of the GPIO character device, as returned in the
:c:type:`request.fd<gpio_v2_line_request>` by gpio-v2-get-line-ioctl.rst.
``values``
The :c:type:`line_values<gpio_v2_line_values>` to get with the ``mask`` set
to indicate the subset of requested lines to get.
논리 값과 출력 line의 읽기 의미
31-49반환되는 값은 물리 high/low가 아니라 논리 active/inactive입니다. `GPIO_V2_LINE_FLAG_ACTIVE_LOW`가 물리 값과 논리 값의 대응을 제어합니다.
`ACTIVE_LOW`가 없으면 high가 active이고 low가 inactive입니다. `ACTIVE_LOW`가 있으면 low가 active이고 high가 inactive입니다.
입력 line과 출력 line 모두 읽을 수 있습니다. 다만 출력 line에서 반환하는 값은 driver와 configuration에 따라 마지막으로 설정한 출력 buffer 값일 수도 있고, line의 실제 level을 나타내는 입력 buffer 값일 수도 있습니다.
Hardware와 configuration에 따라 출력 buffer와 실제 line level이 다를 수 있으므로, 출력 line read를 반드시 물리 pin level의 확인으로 해석해서는 안 됩니다.
출력 line은 반환 값의 출처까지 driver에 의존합니다.
Description
===========
Get the values of requested lines.
The values returned are logical, indicating if the line is active or inactive.
The ``GPIO_V2_LINE_FLAG_ACTIVE_LOW`` flag controls the mapping between physical
values (high/low) and logical values (active/inactive).
If ``GPIO_V2_LINE_FLAG_ACTIVE_LOW`` is not set then high is active and low is
inactive. If ``GPIO_V2_LINE_FLAG_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.
반환값
50-58성공하면 0을 반환하고 `gpio_v2_line_values.bits`의 mask에 대응하는 bit에 읽은 값을 담습니다. 실패하면 -1을 반환하고 `errno`를 설정하며 공통 오류 코드는 `error-codes.rst`에 설명되어 있습니다.
Return Value
============
On success 0 and the corresponding :c:type:`values.bits<gpio_v2_line_values>`
contain the value read.
On error -1 and the ``errno`` variable is set appropriately.
Common error codes are described in error-codes.rst.
요약·해설
gpio-v2-line-get-values-ioctl.rst:1-58요청된 GPIO line 값의 mask 기반 조회, 논리 값 매핑과 출력 line read의 driver 의존성을 설명합니다.
원문의 호출 형식, 구조체, flag, buffer 정책, 오류 코드와 줄 좌표를 보존해 전문 번역했습니다.