bdb22aa411879bb0eea9b74b43a71580a615a9a4
[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/mouse.h"
21 #include "hardware/ps2.h"
22
23 // HACK: For the PS/2 bypass and MOUSE.COM driver direct call
24 #include "dos/mouse32.h"
25
26 /* PRIVATE VARIABLES **********************************************************/
27
28 /* PRIVATE FUNCTIONS **********************************************************/
29
30 // Mouse IRQ 12
31 static VOID WINAPI BiosMouseIrq(LPWORD Stack)
32 {
33 PicIRQComplete(Stack);
34 }
35
36 VOID BiosMousePs2Interface(LPWORD Stack)
37 {
38 DPRINT1("INT 15h, AH = C2h must be implemented in order to support vendor mouse drivers\n");
39
40 switch (getAL())
41 {
42 /* Enable / Disable */
43 case 0x00:
44 {
45 break;
46 }
47
48 /* Reset */
49 case 0x01:
50 {
51 break;
52 }
53
54 /* Set Sampling Rate */
55 case 0x02:
56 {
57 break;
58 }
59
60 /* Set Resolution */
61 case 0x03:
62 {
63 break;
64 }
65
66 /* Get Type */
67 case 0x04:
68 {
69 break;
70 }
71
72 /* Initialize */
73 case 0x05:
74 {
75 break;
76 }
77
78 /* Extended Commands */
79 case 0x06:
80 {
81 break;
82 }
83
84 /* Set Device Handler Address */
85 case 0x07:
86 {
87 break;
88 }
89
90 /* Write to Pointer Port */
91 case 0x08:
92 {
93 break;
94 }
95
96 /* Read from Pointer Port */
97 case 0x09:
98 {
99 break;
100 }
101
102 default:
103 {
104 DPRINT1("INT 15h, AH = C2h, AL = 0x%02X NOT IMPLEMENTED\n",
105 getAL());
106 }
107 }
108 }
109
110 /* PUBLIC FUNCTIONS ***********************************************************/
111
112 BOOLEAN MouseBios32Initialize(VOID)
113 {
114 BYTE ControllerConfig;
115
116 /* Clear the mouse queue */
117 while (PS2PortQueueRead(1)) continue;
118
119 /* Enable packet reporting */
120 IOWriteB(PS2_CONTROL_PORT, 0xD4);
121 IOWriteB(PS2_DATA_PORT, 0xF4);
122
123 /* Read the mouse ACK reply */
124 PS2PortQueueRead(1);
125
126 /* Enable IRQ12 */
127 IOWriteB(PS2_CONTROL_PORT, 0x20);
128 ControllerConfig = IOReadB(PS2_DATA_PORT);
129 IOWriteB(PS2_CONTROL_PORT, 0x60);
130 IOWriteB(PS2_DATA_PORT, ControllerConfig | 0x02);
131
132 /* Set up the HW vector interrupts */
133 EnableHwIRQ(12, BiosMouseIrq);
134
135 return TRUE;
136 }
137
138 VOID MouseBios32Cleanup(VOID)
139 {
140 }