요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
================
The I2C Protocol
================
This document is an overview of the basic I2C transactions and the kernel
APIs to perform them.
Key to symbols
==============
=============== =============================================================
S Start condition
P Stop condition
Rd/Wr (1 bit) Read/Write bit. Rd equals 1, Wr equals 0.
A, NA (1 bit) Acknowledge (ACK) and Not Acknowledge (NACK) bit
Addr (7 bits) I2C 7 bit address. Note that this can be expanded to
get a 10 bit I2C address.
Data (8 bits) A plain data byte.
[..] Data sent by I2C device, as opposed to data sent by the
host adapter.
=============== =============================================================
Simple send transaction
=======================
Implemented by i2c_master_send()::
S Addr Wr [A] Data [A] Data [A] ... [A] Data [A] P
Simple receive transaction
==========================
Implemented by i2c_master_recv()::
S Addr Rd [A] [Data] A [Data] A ... A [Data] NA P
Combined transactions
=====================
Implemented by i2c_transfer().
They are just like the above transactions, but instead of a stop
condition P a start condition S is sent and the transaction continues.
An example of a byte read, followed by a byte write::
S Addr Rd [A] [Data] NA S Addr Wr [A] Data [A] P
Modified transactions
=====================
The following modifications to the I2C protocol can also be generated by
setting these flags for I2C messages. With the exception of I2C_M_NOSTART, they
are usually only needed to work around device issues:
I2C_M_IGNORE_NAK:
Normally message is interrupted immediately if there is [NA] from the
client. Setting this flag treats any [NA] as [A], and all of
message is sent.
These messages may still fail to SCL lo->hi timeout.
I2C_M_NO_RD_ACK:
In a read message, master A/NA bit is skipped.
I2C_M_NOSTART:
In a combined transaction, no 'S Addr Wr/Rd [A]' is generated at some
point. For example, setting I2C_M_NOSTART on the second partial message
generates something like::
S Addr Rd [A] [Data] NA Data [A] P
If you set the I2C_M_NOSTART variable for the first partial message,
we do not generate Addr, but we do generate the start condition S.
This will probably confuse all other clients on your bus, so don't
try this.
This is often used to gather transmits from multiple data buffers in
system memory into something that appears as a single transfer to the
I2C device but may also be used between direction changes by some
rare devices.
I2C_M_REV_DIR_ADDR:
This toggles the Rd/Wr flag. That is, if you want to do a write, but
need to emit an Rd instead of a Wr, or vice versa, you set this
flag. For example::
S Addr Rd [A] Data [A] Data [A] ... [A] Data [A] P
I2C_M_STOP:
Force a stop condition (P) after the message. Some I2C related protocols
like SCCB require that. Normally, you really don't want to get interrupted
between the messages of one transfer.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
I2C 프로토콜 기호
1-23이 문서는 기본 I2C 트랜잭션과 이를 수행하는 커널 API를 개괄합니다.
원문의 모든 프로토콜 기호와 비트 폭을 보존합니다.
주소와 방향 뒤에 데이터와 승인 비트가 이어집니다.
================
The I2C Protocol
================
This document is an overview of the basic I2C transactions and the kernel
APIs to perform them.
Key to symbols
==============
=============== =============================================================
S Start condition
P Stop condition
Rd/Wr (1 bit) Read/Write bit. Rd equals 1, Wr equals 0.
A, NA (1 bit) Acknowledge (ACK) and Not Acknowledge (NACK) bit
Addr (7 bits) I2C 7 bit address. Note that this can be expanded to
get a 10 bit I2C address.
Data (8 bits) A plain data byte.
[..] Data sent by I2C device, as opposed to data sent by the
host adapter.
=============== =============================================================
단순 송신과 수신 트랜잭션
24-40단순 송신은 `i2c_master_send()`로 구현합니다. 마스터가 START, 주소, 쓰기 비트를 보내고 장치 ACK를 받은 뒤 데이터 바이트와 각 ACK를 반복한 다음 STOP으로 끝냅니다.
단순 수신은 `i2c_master_recv()`로 구현합니다. 마스터가 START, 주소, 읽기 비트를 보내고 장치 ACK를 받은 뒤 장치가 보내는 데이터 바이트를 읽습니다. 마스터는 중간 바이트마다 ACK를 보내고 마지막 바이트에는 NACK를 보낸 뒤 STOP으로 끝냅니다.
대괄호는 I2C 장치가 보낸 항목을 뜻합니다.
호스트가 데이터와 함께 각 바이트 뒤의 장치 ACK를 확인합니다.
마지막 데이터에는 마스터가 NA를 보내 수신 종료를 알립니다.
Simple send transaction
=======================
Implemented by i2c_master_send()::
S Addr Wr [A] Data [A] Data [A] ... [A] Data [A] P
Simple receive transaction
==========================
Implemented by i2c_master_recv()::
S Addr Rd [A] [Data] A [Data] A ... A [Data] NA P
결합 트랜잭션
41-51결합 트랜잭션은 `i2c_transfer()`로 구현합니다. 단순 트랜잭션과 같지만 첫 메시지 뒤에 STOP 조건 `P`를 보내지 않고 반복 START 조건 `S`를 보내 트랜잭션을 계속합니다.
원문의 예는 한 바이트 읽기 뒤에 한 바이트 쓰기를 수행합니다. 읽기 주소와 ACK, 장치 데이터, 마스터 NACK 다음에 반복 START를 보내고, 쓰기 주소와 ACK, 호스트 데이터와 장치 ACK를 거쳐 STOP으로 끝냅니다.
중간 STOP 없이 반복 START로 방향을 바꿉니다.
하나의 전송 안에서 버스를 놓지 않고 읽기에서 쓰기로 바뀝니다.
Combined transactions
=====================
Implemented by i2c_transfer().
They are just like the above transactions, but instead of a stop
condition P a start condition S is sent and the transaction continues.
An example of a byte read, followed by a byte write::
S Addr Rd [A] [Data] NA S Addr Wr [A] Data [A] P
프로토콜 변형 플래그
52-96I2C 메시지에 다음 플래그를 설정하면 프로토콜을 변형할 수 있습니다. `I2C_M_NOSTART`를 제외하면 보통 장치 문제를 우회할 때만 필요합니다.
`I2C_M_IGNORE_NAK`는 클라이언트가 보낸 모든 NACK `[NA]`를 ACK `[A]`로 취급하여 메시지 전체를 계속 전송합니다. 그래도 SCL Low에서 High로 전환하는 시간 초과 때문에 실패할 수 있습니다.
`I2C_M_NO_RD_ACK`는 읽기 메시지에서 마스터가 보내는 ACK·NACK 비트를 생략합니다.
`I2C_M_NOSTART`는 결합 트랜잭션의 특정 지점에서 `S Addr Wr/Rd [A]`를 만들지 않습니다. 두 번째 부분 메시지에 설정하면 첫 읽기 뒤 별도 START와 주소 없이 바로 다음 데이터를 이어 보낼 수 있습니다.
첫 번째 부분 메시지에 `I2C_M_NOSTART`를 설정하면 주소는 만들지 않지만 START 조건 `S`는 만듭니다. 이는 버스의 다른 모든 클라이언트를 혼란스럽게 할 가능성이 크므로 사용해서는 안 됩니다.
이 플래그는 시스템 메모리의 여러 데이터 버퍼에서 나온 송신을 I2C 장치에 하나의 전송처럼 보이게 모을 때 자주 사용합니다. 드문 장치에서는 전송 방향이 바뀌는 사이에도 사용할 수 있습니다.
`I2C_M_REV_DIR_ADDR`는 주소 단계의 `Rd/Wr` 비트를 뒤집습니다. 쓰기를 수행하면서 `Wr` 대신 `Rd`를 내보내야 하거나 그 반대가 필요한 경우에 설정합니다.
`I2C_M_STOP`은 메시지 뒤에 STOP 조건 `P`를 강제로 만듭니다. SCCB 같은 일부 I2C 관련 프로토콜이 이를 요구하지만, 일반적인 하나의 전송에서는 메시지 사이가 끊기지 않는 편이 바람직합니다.
각 플래그가 바꾸는 신호와 사용상 주의입니다.
원문의 ASCII 신호열을 구조화하여 보존합니다.
표준 전송으로 해결할 수 없는 장치 요구가 있을 때만 적용합니다.
Modified transactions
=====================
The following modifications to the I2C protocol can also be generated by
setting these flags for I2C messages. With the exception of I2C_M_NOSTART, they
are usually only needed to work around device issues:
I2C_M_IGNORE_NAK:
Normally message is interrupted immediately if there is [NA] from the
client. Setting this flag treats any [NA] as [A], and all of
message is sent.
These messages may still fail to SCL lo->hi timeout.
I2C_M_NO_RD_ACK:
In a read message, master A/NA bit is skipped.
I2C_M_NOSTART:
In a combined transaction, no 'S Addr Wr/Rd [A]' is generated at some
point. For example, setting I2C_M_NOSTART on the second partial message
generates something like::
S Addr Rd [A] [Data] NA Data [A] P
If you set the I2C_M_NOSTART variable for the first partial message,
we do not generate Addr, but we do generate the start condition S.
This will probably confuse all other clients on your bus, so don't
try this.
This is often used to gather transmits from multiple data buffers in
system memory into something that appears as a single transfer to the
I2C device but may also be used between direction changes by some
rare devices.
I2C_M_REV_DIR_ADDR:
This toggles the Rd/Wr flag. That is, if you want to do a write, but
need to emit an Rd instead of a Wr, or vice versa, you set this
flag. For example::
S Addr Rd [A] Data [A] Data [A] ... [A] Data [A] P
I2C_M_STOP:
Force a stop condition (P) after the message. Some I2C related protocols
like SCCB require that. Normally, you really don't want to get interrupted
between the messages of one transfer.
요약·해설
i2c-protocol.rst:1-96I2C 전송은 START, 주소·방향, ACK·NACK, 데이터, STOP의 순서로 구성되며 결합 전송은 STOP 대신 반복 START를 사용합니다. 변형 플래그는 장치의 비표준 요구가 있을 때만 신중히 적용합니다.
원문 분량과 핵심 검토 대상을 요약합니다.
문서의 주요 판단이나 전송 순서를 압축해 보여 줍니다.