[NTOS/CM]
[reactos.git] / reactos / subsystems / ntvdm / hardware / keyboard.c
1 /*
2 * COPYRIGHT: GPL - See COPYING in the top level directory
3 * PROJECT: ReactOS Virtual DOS Machine
4 * FILE: keyboard.c
5 * PURPOSE: Keyboard emulation
6 * PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
7 */
8
9 /* INCLUDES *******************************************************************/
10
11 #define NDEBUG
12
13 #include "keyboard.h"
14 #include "ps2.h"
15
16 /* PRIVATE VARIABLES **********************************************************/
17
18 static BYTE PS2Port = 0;
19
20 /* PRIVATE FUNCTIONS **********************************************************/
21
22 static VOID WINAPI KeyboardCommand(LPVOID Param, BYTE Command)
23 {
24 UNIMPLEMENTED;
25 }
26
27 /* PUBLIC FUNCTIONS ***********************************************************/
28
29 VOID KeyboardEventHandler(PKEY_EVENT_RECORD KeyEvent)
30 {
31 WORD i;
32 BYTE ScanCode = (BYTE)KeyEvent->wVirtualScanCode;
33
34 /* If this is a key release, set the highest bit in the scan code */
35 if (!KeyEvent->bKeyDown) ScanCode |= 0x80;
36
37 /* Push the scan code into the PS/2 queue */
38 for (i = 0; i < KeyEvent->wRepeatCount; i++)
39 {
40 PS2QueuePush(PS2Port, ScanCode);
41 }
42
43 // PicInterruptRequest(1);
44 }
45
46 BOOLEAN KeyboardInit(BYTE PS2Connector)
47 {
48 /* Finish to plug the mouse to the specified PS/2 port */
49 PS2Port = PS2Connector;
50 PS2SetDeviceCmdProc(PS2Port, NULL, KeyboardCommand);
51
52 return TRUE;
53 }