The Keyboard Controller.ppt

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
The Keyboard Controller.ppt

The Keyboard Controller Essential steps for implementing an interrupt service routine for the Keyboard Controller Our near-term goal To build a ‘mini’ x86 operating system It should be able run a Linux application It needs to support: basic console input/output (keyboard, screen) handling of device-interrupts (timer, keyboard) ‘exit’ gracefully when application is finished utilize x86 privilege restrictions and 32bit code Certain building-blocks are already done Keyboard and its controller KB Controller Status A few Controller Commands 0xAD: Disable Keyboard 0xAE: Enable Keyboard 0xA7: Disable PS/2 Mouse 0xA8: Enable PS/2 Mouse 0xC0: Read input-port (to output buffer) 0XD0: Read output-port (to output buffer) Command to set LEDs 0xED: Turns on/off the keyboard’s LEDs Interrupt-Handler actions When the keyboard-controller issues an interrupt, these actions should be taken: Save values in the working CPU registers Read keyboard-controller’s status-register If the output-buffer has new data, read it If a “special” key (shift/toggle), adjust kb_flags For a normal key, translate scancode to ascii Insert the code-pair at tail-end of kb-queue Send EOI-command to Interrupt Controller Restore the saved values from CPU registers Resume the interrupted procedure (with ‘iret’) Keyboard ‘scancode’ format Keyboard Queue BIOS DATA AREA KBFLAGS is word at address 0x40:0x17 KBHEAD is word at address 0x40:0x1A KBTAIL is word at address 0x40:0x1C KBQUEUE is array of 16 words array base-address at 0x40:0x1E KBBASE is word at 0x40:0x80 KBTAIL is word at 0x40:0x82 Format of KBFLAGS LSB Demo ‘minikybd.s’ It shows a minimal implementation for the keyboard-controller’s interrupt-handler It runs in Real-Mode It ‘echos’ a user’s keystrokes IN-CLASS EXERCISE: modify this demo to run in Protected-Mode * Keyboard Controller CPU PIC bus KEYBOARD PS/2 MOUSE output port TIMER output buffer status reg control reg 0x64 0x64 0x60 0x60 input buffer input port RAM PIC IRQ0 IRQ1 IRQ2 6 PARE T

文档评论(0)

gshshxx + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档