節錄至 Undocumented PC

  

 kbc

 

8031 是KB 內部的controller , 8042 是 俗稱的 KBC

假設現在有一個"P" 從鍵盤被按下了,會產生以下的連續動作

1. 8031 解碼後以serial 傳送一個 4Dh (Kscan code )到8042

2. 8042 轉換Kscan code 為 scan code (19h) ,然後放在output buffer 上

3. 8042 發出 IRQ1

4. Int 9 (KeyBoard BIOS) 會讀取output buffer ,然後將 scan code & ASCII(70h) 放到keybouad buffer

5. AP or OS 透過Int16 讀取Oldest Key 1970h(scan code/ASCII) 

 

Released

1. Released 後 送F0h(kscan code)緊接在4Dh之後

2. 8042 會收到 2 bytes

3. 8042 會送19h 和 99h(bit 7 set high) 到output buffer

4. Int9 會 ignore 99h

 

kbkb

Port 60h : Read/Write Information from or to Keyboard

Port 64h : Read Status / Write Cmd from or to KBC

 

KBC Utility 功能

1. LED update (對Port 60h 寫EDh 後 再寫燈號)

2. Keybpard Reset (對Port 60h 寫FFh)

3. KB Self test (對Port 64h 寫AAh , 回復 : 1. port 64h 寫60h.   2. port 60h 寫45h )

4. System Reset  (對Port 64h 寫FEh)

 

Access Port 60h &64h 的方法

Write :

  Check port 64h 的 Bit 1, High : Input buffer is full.

  If High, no write should occur tp port 60h & 64h

Read :

  Port 64h : no need to check

  Port 60h : check port 64h bit 0, High : Output buffer has a byte available to read.

 

 

創作者介紹
創作者 linch0520 的頭像
linch0520

linch0520的部落格

linch0520 發表在 痞客邦 留言(0) 人氣()