1 /* 2 * COPYRIGHT: GPL - See COPYING in the top level directory 3 * PROJECT: ReactOS Virtual DOS Machine 4 * FILE: subsystems/mvdm/ntvdm/hardware/ps2.h 5 * PURPOSE: PS/2 controller emulation 6 * PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org> 7 * Hermes Belusca-Maito (hermes.belusca@sfr.fr) 8 */ 9 10 #ifndef _PS2_H_ 11 #define _PS2_H_ 12 13 /* DEFINES ********************************************************************/ 14 15 /* I/O Ports */ 16 #define PS2_DATA_PORT 0x60 17 #define PS2_CONTROL_PORT 0x64 18 19 /* Controller Status Register flags */ 20 #define PS2_STAT_OUT_BUF_FULL (1 << 0) 21 // #define PS2_STAT_IN_BUF_FULL (1 << 1) 22 #define PS2_STAT_SYSTEM (1 << 2) 23 #define PS2_STAT_COMMAND (1 << 3) 24 #define PS2_STAT_KBD_ENABLE (1 << 4) // 0: Locked; 1: Not locked 25 #define PS2_STAT_AUX_OUT_BUF_FULL (1 << 5) 26 #define PS2_STAT_GEN_TIMEOUT (1 << 6) 27 #define PS2_STAT_PARITY_ERROR (1 << 7) 28 29 /* Controller Configuration Byte flags */ 30 #define PS2_CONFIG_KBD_INT (1 << 0) 31 #define PS2_CONFIG_AUX_INT (1 << 1) 32 #define PS2_CONFIG_SYSTEM (1 << 2) 33 #define PS2_CONFIG_NO_KEYLOCK (1 << 3) 34 #define PS2_CONFIG_KBD_DISABLE (1 << 4) 35 #define PS2_CONFIG_AUX_DISABLE (1 << 5) 36 // #define PS2_CONFIG_KBD_XLAT (1 << 6) 37 38 /* Output Port flags */ 39 #define PS2_OUT_CPU_NO_RESET (1 << 0) 40 #define PS2_OUT_A20_SET (1 << 1) 41 #define PS2_OUT_AUX_DATA (1 << 2) 42 // #define PS2_OUT_AUX_CLOCK (1 << 3) 43 #define PS2_OUT_IRQ01 (1 << 4) 44 #define PS2_OUT_IRQ12 (1 << 5) 45 // #define PS2_OUT_KBD_CLOCK (1 << 6) 46 #define PS2_OUT_KBD_DATA (1 << 7) 47 48 typedef VOID (WINAPI *PS2_DEVICE_CMDPROC)(LPVOID Param, BYTE Command); 49 50 /* FUNCTIONS ******************************************************************/ 51 52 VOID PS2SetDeviceCmdProc(BYTE PS2Port, LPVOID Param, PS2_DEVICE_CMDPROC DeviceCommand); 53 54 BOOLEAN PS2QueuePush(BYTE PS2Port, BYTE Data); 55 BOOLEAN PS2PortQueueRead(BYTE PS2Port); 56 57 BOOLEAN PS2Initialize(VOID); 58 VOID PS2Cleanup(VOID); 59 60 #endif /* _PS2_H_ */ 61