a17c410acd1e0603a222c8713de7fb128b400fbc
[reactos.git] / reactos / subsystems / mvdm / ntvdm / bios / bios32 / moubios32.c
1 /*
2 * COPYRIGHT: GPL - See COPYING in the top level directory
3 * PROJECT: ReactOS Virtual DOS Machine
4 * FILE: moubios32.c
5 * PURPOSE: VDM Mouse 32-bit BIOS
6 * PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
7 */
8
9 /* INCLUDES *******************************************************************/
10
11 #define NDEBUG
12
13 #include "ntvdm.h"
14 #include "emulator.h"
15
16 #include "moubios32.h"
17 #include "bios32p.h"
18
19 #include "io.h"
20 #include "hardware/ps2.h"
21
22 /* PRIVATE VARIABLES **********************************************************/
23
24 /* PRIVATE FUNCTIONS **********************************************************/
25
26 // Mouse IRQ 12
27 static VOID WINAPI BiosMouseIrq(LPWORD Stack)
28 {
29 PicIRQComplete(LOBYTE(Stack[STACK_INT_NUM]));
30 }
31
32 VOID BiosMousePs2Interface(LPWORD Stack)
33 {
34 DPRINT1("INT 15h, AH = C2h must be implemented in order to support vendor mouse drivers\n");
35
36 switch (getAL())
37 {
38 /* Enable / Disable */
39 case 0x00:
40 {
41 break;
42 }
43
44 /* Reset */
45 case 0x01:
46 {
47 break;
48 }
49
50 /* Set Sampling Rate */
51 case 0x02:
52 {
53 break;
54 }
55
56 /* Set Resolution */
57 case 0x03:
58 {
59 break;
60 }
61
62 /* Get Type */
63 case 0x04:
64 {
65 break;
66 }
67
68 /* Initialize */
69 case 0x05:
70 {
71 break;
72 }
73
74 /* Extended Commands */
75 case 0x06:
76 {
77 break;
78 }
79
80 /* Set Device Handler Address */
81 case 0x07:
82 {
83 break;
84 }
85
86 /* Write to Pointer Port */
87 case 0x08:
88 {
89 break;
90 }
91
92 /* Read from Pointer Port */
93 case 0x09:
94 {
95 break;
96 }
97
98 default:
99 {
100 DPRINT1("INT 15h, AH = C2h, AL = 0x%02X NOT IMPLEMENTED\n",
101 getAL());
102 }
103 }
104 }
105
106 /* PUBLIC FUNCTIONS ***********************************************************/
107
108 BOOLEAN MouseBios32Initialize(VOID)
109 {
110 BYTE ControllerConfig;
111
112 /* Clear the mouse queue */
113 while (PS2PortQueueRead(1)) continue;
114
115 /* Enable packet reporting */
116 IOWriteB(PS2_CONTROL_PORT, 0xD4);
117 IOWriteB(PS2_DATA_PORT, 0xF4);
118
119 /* Read the mouse ACK reply */
120 PS2PortQueueRead(1);
121
122 /* Enable IRQ12 */
123 IOWriteB(PS2_CONTROL_PORT, 0x20);
124 ControllerConfig = IOReadB(PS2_DATA_PORT);
125 IOWriteB(PS2_CONTROL_PORT, 0x60);
126 IOWriteB(PS2_DATA_PORT, ControllerConfig | 0x02);
127
128 /* Set up the HW vector interrupts */
129 EnableHwIRQ(12, BiosMouseIrq);
130
131 return TRUE;
132 }
133
134 VOID MouseBios32Cleanup(VOID)
135 {
136 }