KBC : Keyboard Controller (Intel 8042)
目次
2つのモード
AT互換モード
PS/2互換モード
まだよくわかりません。。
I/Oポート、レジスタ
ATAのI/Oポートマップ
データ・レジスタ (Port:0x0060)
さまざまな用途に使用します。
コマンド(データレジスタ)
ステータス・レジスタ (Port:0x0064)
DR : Data Ready (bit:0)
- 0:データの準備ができていない
- 1:データの準備が整った(データ・レジスタからデータを読み取ることができる)
BSY : Busy (bit:1)
SYS : System flag (bit:2)
SYS (System flag) - Post reads this to determine if power-on reset, or software reset.
Post : Power-on system/self test (起動時システムテスト)
(リセットすると?)コマンド・バイト・レジスタのSystem flagが反映されるらしい。
- 0:??単にコマンド・バイト・レジスタのSystem flagの状態??電源ONのままリセットされた??
- 1:??単にコマンド・バイト・レジスタのSystem flagの状態??すでに初期化済みである??
A2 : Address line A2 (bit:3)
最後にアクセスされたレジスタを表す
INH : Inhibit flag (bit:4)
キーボードが抑制(Inhibit)状態であるかどうかを表す。
コマンドで抑制、非抑制を制御できる。
- 0:入力不可能(抑制)状態
- 1:入力可能(非抑制)状態
TxTO : Transmit Timeout (bit:5)
MOBF : Mouse Output Buffer Full (bit:5)
RxTO : Receive Timeout (bit:6)
TO : General Timeout (bit:6)
PERR : Parity Error (bit:7)
コマンド・レジスタ (Port:0x0064)
KBCの制御を行うコマンドを発行します。
コマンド一覧
コマンド
データ・レジスタを用いたコマンド
キーボードの一般的な?制御をするためのコマンドです。
データ・レジスタを使用します。
発行手順
0xED : LED制御(Scroll Lock, Num Lock, Caps Lock)
コマンド・レジスタを用いたコマンド
キーボードのシステム的な?制御をするためのコマンドです。
コマンド・レジスタを使用します。
0x20/0x60 : コマンド・バイト・レジスタ リード/ライト
- 0x20:コマンド・バイト・レジスタからデータを読み取る。
- 0x60:コマンド・バイト・レジスタにデータを書き込む。
詳しくはコマンド・バイト・レジスタを参照
0xD4 : マウスへ書き込み
その他
他には、以下のものがあるようです。誰か訳してください。。。
- ?0x90-0x9F (Write to output port) - Writes command's lower nibble to lower nibble of output port (see Output Port definition.)
- ?0xA1 (Get version number) - Returns firmware version number.
- ?0xA4 (Get password) - Returns 0xFA if password exists; otherwise, 0xF1.
- ?0xA5 (Set password) - Set the new password by sending a null-terminated string of scan codes as this command's parameter.
- ?0xA6 (Check password) - Compares keyboard input with current password.
- 0xA7 (Disable mouse interface) - PS/2 mode only. Similar to "Disable keyboard interface" (0xAD) command.
- 0xA8 (Enable mouse interface) - PS/2 mode only. Similar to "Enable keyboard interface" (0xAE) command.
- 0xA9 (Mouse interface test) - Returns 0x00 if okay, 0x01 if Clock line stuck low, 0x02 if clock line stuck high, 0x03 if data line stuck low, and 0x04 if data line stuck high.
- 0xAA (Controller self-test) - Returns 0x55 if okay.
- 0xAB (Keyboard interface test) - Returns 0x00 if okay, 0x01 if Clock line stuck low, 0x02 if clock line stuck high, 0x03 if data line stuck low, and 0x04 if data line stuck high.
- 0xAD (Disable keyboard interface) - Sets bit 4 of command byte and disables all communication with keyboard.
- 0xAE (Enable keyboard interface) - Clears bit 4 of command byte and re-enables communication with keyboard.
- 0xAF (Get version)
- 0xC0 (Read input port) - Returns values on input port (see Input Port definition.)
- 0xC1 (Copy input port LSn) - PS/2 mode only. Copy input port's low nibble to Status register (see Input Port definition)
- 0xC2 (Copy input port MSn) - PS/2 mode only. Copy input port's high nibble to Status register (see Input Port definition.)
- 0xD0 (Read output port) - Returns values on output port (see Output Port definition.)
- 0xD1 (Write output port) - Write parameter to output port (see Output Port definition.)
- 0xD2 (Write keyboard buffer) - Parameter written to input buffer as if received from keyboard.
- 0xD3 (Write mouse buffer) - Parameter written to input buffer as if received from mouse.
- 0xE0 (Read test port) - Returns values on test port (see Test Port definition.)
- 0xF0-0xFF (Pulse output port) - Pulses command's lower nibble onto lower nibble of output port (see Output Port definition.)
コマンド・バイト・レジスタ
コマンド・レジスタに0x20(Read)か0x60(Write)を出力すると、データ・レジスタを介してアクセスできるレジスタ。
| bit | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|
| 内容 | AT互換モード | - | XLAT | PC | _EN | OVR | SYS | - | INT |
|---|
| PS/2互換モード | - | _EN2 | - | INT2 |
|---|
INT : Input Buffer Full Interrupt (bit:0)
- 0:IRQ1割り込み無効化(ステータス・レジスタのDRをポーリングしてデータの有無を調べる)
- 1:IRQ1割り込み有効化
INT2 : Mouse Input Buffer Full Interrupt (bit:1)
- 0:IRQ12割り込み無効化
- 1:IRQ12割り込み有効化
SYS : System Flag (bit:2)
(リセットすると?)ステータス・レジスタのSystem flagに反映されるらしい。
- 0:??リセット時、電源ONのまま?テスト/初期化するように教えるらしい??
- 1:??リセット時、再起動して?テスト/初期化するように教えるらしい??
OVR : Inhibit Override (bit:3)
古いマザーボードのキーボードスイッチ?を抑制するか否か
_EN : Disable keyboard (bit:4)
PC : ??PC Mode?? (bit:5)
EN2 : Disable Mouse (bit:5)
XLAT : Translate Scan Codes (bit:6)
キーコード(スキャンコード)を変換するか否かを決める。
キーコードはコマンドセットのF0で変更可能
- 0:キーコードをそのままバッファに入れる
- 1:キーコードを01に変換してバッファに入れる
参考・関連