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