#include "mouse.h"
#include "ps2.h"
+// #include "pic.h"
// HACK: For the PS/2 bypass and MOUSE.COM driver direct call
#include "dos/mouse32.h"
static VOID MouseGetPacket(PMOUSE_PACKET Packet)
{
/* Clear the packet */
- ZeroMemory(Packet, sizeof(MOUSE_PACKET));
+ RtlZeroMemory(Packet, sizeof(*Packet));
Packet->Flags |= MOUSE_ALWAYS_SET;
ButtonState = NewButtonState;
}
-/* PUBLIC FUNCTIONS ***********************************************************/
-
-VOID MouseEventHandler(PMOUSE_EVENT_RECORD MouseEvent)
-{
- // FIXME: Sync our private data
-
- // HACK: Bypass PS/2 and instead, notify the MOUSE.COM driver directly
- MouseBiosUpdatePosition(&MouseEvent->dwMousePosition);
- MouseBiosUpdateButtons(LOWORD(MouseEvent->dwButtonState));
-
- // PS2QueuePush(PS2Port, Data);
- // PicInterruptRequest(12);
-}
-
-VOID MouseScroll(LONG Direction)
+/*static*/ VOID MouseScroll(LONG Direction)
{
ScrollCounter += Direction;
}
-COORD MouseGetPosition(VOID)
+/*static*/ COORD MouseGetPosition(VOID)
{
return Position;
}
-VOID MouseCommand(BYTE Command)
+static VOID WINAPI MouseCommand(LPVOID Param, BYTE Command)
{
switch (Command)
{
}
}
+/* PUBLIC FUNCTIONS ***********************************************************/
+
+VOID MouseEventHandler(PMOUSE_EVENT_RECORD MouseEvent)
+{
+ // FIXME: Sync our private data
+
+ // HACK: Bypass PS/2 and instead, notify the MOUSE.COM driver directly
+ MouseBiosUpdatePosition(&MouseEvent->dwMousePosition);
+ MouseBiosUpdateButtons(LOWORD(MouseEvent->dwButtonState));
+
+ // PS2QueuePush(PS2Port, Data);
+}
+
BOOLEAN MouseInit(BYTE PS2Connector)
{
HWND hWnd;
/* Release the device context */
ReleaseDC(hWnd, hDC);
+ /* Finish to plug the mouse to the specified PS/2 port */
PS2Port = PS2Connector;
+ PS2SetDeviceCmdProc(PS2Port, NULL, MouseCommand);
MouseReset();
return TRUE;