================================== これは、 linux-2.6.13/Documentation/i2c/i2c-protocol の和訳(ドラフト) です。 翻訳団体: JF プロジェクト < http://www.linux.or.jp/JF/ > 更新日 : 2005/9/2 翻訳者 : Hiroshi.Suzuki < setter at reset dot jp > 校正者 : ================================== This document describes the i2c protocol. Or will, when it is finished :-) このドキュメントは、i2c プロトコルについて書かれています。たぶん...書き終わるころには :-) Key to symbols シンボルの説明: ============== S (1 bit) : Start bit P (1 bit) : Stop bit Rd/Wr (1 bit) : Read/Write bit. Rd equals 1, Wr equals 0. A, NA (1 bit) : Accept and reverse accept bit. Addr (7 bits): I2C 7 bit address. Note that this can be expanded as usual to get a 10 bit I2C address. Comm (8 bits): Command byte, a data byte which often selects a register on the device. Data (8 bits): A plain data byte. Sometimes, I write DataLow, DataHigh for 16 bit data. Count (8 bits): A data byte containing the length of a block operation. [..]: Data sent by I2C device, as opposed to data sent by the host adapter. S (1 ビット) : 開始ビット P (1 ビット) : 終了ビット Rd/Wr (1 ビット) : 読み込み/書き込みビット。Rd = 1, Wr = 0 A, NA (1 ビット) : 受理と、非受理 ビット。 Addr (7 ビット) : I2C 7ビットアドレス。 注) 通常、10ビットの I2C アドレスを得るために拡張できます。 Comm (8 ビット) : コマンドバイト。多くの場合、デバイス上のレジスタを選択するデータバイト。 Data (8 ビット) : データ専用バイト。私は時々、16ビットデータ用に、DataLow, DataHigh を書き込みます。 Count (8 ビット) : ブロック処理の長さを含むデータバイト。 [..]: I2C デバイスが送信したデータ。ホストアダプタで送られたデータに対する応答です。 Simple send transaction 単純な送信処理 ====================== This corresponds to i2c_master_send. 次に示すものは、i2c_master_send に相当します S Addr Wr [A] Data [A] Data [A] ... [A] Data [A] P Simple receive transaction 単純な受信処理 =========================== This corresponds to i2c_master_recv 次に示すものは、i2c_master_recv に相当します S Addr Rd [A] [Data] A [Data] A ... A [Data] NA P Combined transactions 連結処理 ==================== This corresponds to i2c_transfer i2c_transfer に相当します They are just like the above transactions, but instead of a stop bit P a start bit S is sent and the transaction continues. An example of a byte read, followed by a byte write: 上で述べた処理と同等ですが、停止ビット P の代わりに、開始ビット S を送り、処理 を継続します。読み込みに続けて、書き込みを行う場合: S Addr Rd [A] [Data] NA S Addr Wr [A] Data [A] P Modified transactions 変更済みの処理 ===================== We have found some I2C devices that needs the following modifications: 次に示す変更が必要な、いくつかの I2C デバイス がありました: Flag 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 startbit S. This will probably confuse all other clients on your bus, so don't try this. I2C_M_NOSTART フラグ: 連続処理で、'S Addr Wr/Rd [A]' が生成されない時がある。例えば、2番目の部分 的メッセージで、I2C_M_NOSTART を設定すると、次のようになります: S Addr Rd [A] [Data] NA Data [A] P 最初の部分的メッセージで、I2C_M_NOSTART を設定するなら、Addr を生成しません が、開始ビット S は生成します。 おそらく、バス上のすべての他のクライアントを混乱させることになるので、試し てはいけません。 Flags 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_REV_DIR_ADDR フラグ Rd/Wr フラグを切り替えます。書き込みを実行したいが、Wr の代わりに、Rd を出す必要がある、 またはその逆の場合、このフラグを設定します。例: S Addr Rd [A] Data [A] Data [A] ... [A] Data [A] P Flags 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_IGNORE_NAK フラグ 通常、メッセージは、クライアントから [NA] がきたら、ただちに中断されます。 このフラグを設定すると、どんな [NA] も [A] として扱い、すべてのメッセージを 送信します。 これらメッセージは、まだ、SCL lo->hi タイムアウトに失敗するかもしれません。 Flags I2C_M_NO_RD_ACK In a read message, master A/NA bit is skipped. I2C_M_NO_RD_ACK フラグ 読み込みメッセージで、主たる A/NA ビットを、省略します。