ps2base.h
资源名称:tizos.rar [点击查看]
上传用户:qddsws
上传日期:2022-06-22
资源大小:723k
文件大小:2k
源码类别:
操作系统开发
开发平台:
C/C++
- #ifndef PS2BASE_H
- #define PS2BASE_H
- #include<init.h>
- #include<devices.h>
- #include<list.h>
- #include<lib/string.h>
- #include <i386/io_low_HLL.h>
- #define KEYB_PORT 0x60 /* keyboard port */
- #define KEYB_CTRL 0x64 /* keyboard controller port */
- #define KCTRL_ENABLE_AUX 0xA8 /* enable aux port (PS/2 mouse) */
- #define KCTRL_WRITE_CMD_BYTE 0x60 /* write to command register */
- #define KCTRL_WRITE_AUX 0xD4 /* write next byte at port 60 to aux port */
- /* flags for KCTRL_WRITE_CMD_BYTE */
- #define KCTRL_IRQ1 0x01
- #define KCTRL_IRQ12 0x02
- #define KCTRL_SYS 0x04
- #define KCTRL_OVERRIDE_INHIBIT 0x08
- #define KCTRL_DISABLE_KEYB 0x10
- #define KCTRL_DISABLE_AUX 0x20
- #define KCTRL_TRANSLATE_XT 0x40
- /* commands to keyboard */
- #define KEYB_SET_LEDS 0xED
- #define KEYB_SET_SCANCODE_SET 0xF0
- #define KEYB_IDENTIFY 0xF2
- #define KEYB_SET_TYPEMATIC 0xF3
- #define KEYB_ENABLE 0xF4
- #define KEYB_RESET_DISABLE 0xF5
- #define KEYB_ALL_TYPM_MAKE_BRK 0xFA
- /* default ACK from keyboard following command */
- #define KEYB_ACK "xFA"
- /* commands to aux device (PS/2 mouse) */
- #define AUX_INFORMATION 0xE9
- #define AUX_ENABLE 0xF4
- #define AUX_IDENTIFY 0xF2
- #define AUX_RESET 0xFF
- #ifndef min
- #define min(a, b) ((a) < (b) ? (a) : (b))
- #endif
- #ifndef max
- #define max(a, b) ((a) > (b) ? (a) : (b))
- #endif
- void kbdWrite(word port, byte data);
- byte kbdRead();
- byte kbdWriteRead(word port, byte data, const char* expect);
- #endif