mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 02:25:17 +00:00
Cleanup i8042prt.h
Remove $Id$ tags Replace Win32 types by their kernel counterparts (DWORD -> ULONG, ...) svn path=/trunk/; revision=17519
This commit is contained in:
parent
a2e91278b6
commit
de881e611a
6 changed files with 102 additions and 138 deletions
|
@ -10,11 +10,9 @@
|
||||||
|
|
||||||
/* INCLUDES ****************************************************************/
|
/* INCLUDES ****************************************************************/
|
||||||
|
|
||||||
#include <ddk/ntddk.h>
|
#ifndef NDEBUG
|
||||||
#include <ddk/ntddkbd.h>
|
|
||||||
#include <ddk/ntdd8042.h>
|
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
|
#endif
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
#include "i8042prt.h"
|
#include "i8042prt.h"
|
||||||
|
@ -34,18 +32,18 @@
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Write data to a port, waiting first for it to become ready
|
* FUNCTION: Write data to a port, waiting first for it to become ready
|
||||||
*/
|
*/
|
||||||
BOOLEAN I8042Write(PDEVICE_EXTENSION DevExt, int addr, BYTE data)
|
BOOLEAN I8042Write(PDEVICE_EXTENSION DevExt, PUCHAR addr, UCHAR data)
|
||||||
{
|
{
|
||||||
ULONG ResendIterations = DevExt->Settings.PollingIterations;
|
ULONG ResendIterations = DevExt->Settings.PollingIterations;
|
||||||
|
|
||||||
while ((KBD_IBF & READ_PORT_UCHAR((PUCHAR)I8042_CTRL_PORT)) &&
|
while ((KBD_IBF & READ_PORT_UCHAR(I8042_CTRL_PORT)) &&
|
||||||
(ResendIterations--))
|
(ResendIterations--))
|
||||||
{
|
{
|
||||||
KeStallExecutionProcessor(50);
|
KeStallExecutionProcessor(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ResendIterations) {
|
if (ResendIterations) {
|
||||||
WRITE_PORT_UCHAR((PUCHAR)addr,data);
|
WRITE_PORT_UCHAR(addr,data);
|
||||||
DPRINT("Sent %x to %x\n", data, addr);
|
DPRINT("Sent %x to %x\n", data, addr);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -56,7 +54,7 @@ BOOLEAN I8042Write(PDEVICE_EXTENSION DevExt, int addr, BYTE data)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Write data to a port, without waiting first
|
* FUNCTION: Write data to a port, without waiting first
|
||||||
*/
|
*/
|
||||||
static BOOLEAN I8042WriteNoWait(PDEVICE_EXTENSION DevExt, int addr, BYTE data)
|
static BOOLEAN I8042WriteNoWait(PDEVICE_EXTENSION DevExt, int addr, UCHAR data)
|
||||||
{
|
{
|
||||||
WRITE_PORT_UCHAR((PUCHAR)addr,data);
|
WRITE_PORT_UCHAR((PUCHAR)addr,data);
|
||||||
DPRINT("Sent %x to %x\n", data, addr);
|
DPRINT("Sent %x to %x\n", data, addr);
|
||||||
|
@ -67,10 +65,10 @@ static BOOLEAN I8042WriteNoWait(PDEVICE_EXTENSION DevExt, int addr, BYTE data)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Read data from port 0x60
|
* FUNCTION: Read data from port 0x60
|
||||||
*/
|
*/
|
||||||
NTSTATUS I8042ReadData(BYTE *Data)
|
NTSTATUS I8042ReadData(UCHAR *Data)
|
||||||
{
|
{
|
||||||
BYTE Status;
|
UCHAR Status;
|
||||||
Status=READ_PORT_UCHAR((PUCHAR)I8042_CTRL_PORT);
|
Status=READ_PORT_UCHAR(I8042_CTRL_PORT);
|
||||||
|
|
||||||
// If data is available
|
// If data is available
|
||||||
if ((Status & KBD_OBF)) {
|
if ((Status & KBD_OBF)) {
|
||||||
|
@ -84,16 +82,16 @@ NTSTATUS I8042ReadData(BYTE *Data)
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS I8042ReadStatus(BYTE *Status)
|
NTSTATUS I8042ReadStatus(UCHAR *Status)
|
||||||
{
|
{
|
||||||
Status[0]=READ_PORT_UCHAR((PUCHAR)I8042_CTRL_PORT);
|
Status[0]=READ_PORT_UCHAR(I8042_CTRL_PORT);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Read data from port 0x60
|
* FUNCTION: Read data from port 0x60
|
||||||
*/
|
*/
|
||||||
NTSTATUS I8042ReadDataWait(PDEVICE_EXTENSION DevExt, BYTE *Data)
|
NTSTATUS I8042ReadDataWait(PDEVICE_EXTENSION DevExt, UCHAR *Data)
|
||||||
{
|
{
|
||||||
ULONG Counter = DevExt->Settings.PollingIterations;
|
ULONG Counter = DevExt->Settings.PollingIterations;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
@ -112,7 +110,7 @@ NTSTATUS I8042ReadDataWait(PDEVICE_EXTENSION DevExt, BYTE *Data)
|
||||||
|
|
||||||
VOID I8042Flush()
|
VOID I8042Flush()
|
||||||
{
|
{
|
||||||
BYTE Ignore;
|
UCHAR Ignore;
|
||||||
|
|
||||||
while (STATUS_SUCCESS == I8042ReadData(&Ignore)) {
|
while (STATUS_SUCCESS == I8042ReadData(&Ignore)) {
|
||||||
; /* drop */
|
; /* drop */
|
||||||
|
@ -141,7 +139,7 @@ NTSTATUS STDCALL I8042SynchWritePort(PDEVICE_EXTENSION DevExt,
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
UCHAR Ack;
|
UCHAR Ack;
|
||||||
UINT ResendIterations = DevExt->Settings.ResendIterations + 1;
|
ULONG ResendIterations = DevExt->Settings.ResendIterations + 1;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (Port)
|
if (Port)
|
||||||
|
@ -311,7 +309,7 @@ BOOLEAN STDCALL I8042PacketIsr(PDEVICE_EXTENSION DevExt,
|
||||||
|
|
||||||
VOID I8042PacketDpc(PDEVICE_EXTENSION DevExt)
|
VOID I8042PacketDpc(PDEVICE_EXTENSION DevExt)
|
||||||
{
|
{
|
||||||
BOOL FinishIrp = FALSE;
|
BOOLEAN FinishIrp = FALSE;
|
||||||
NTSTATUS Result = STATUS_INTERNAL_ERROR; /* Shouldn't happen */
|
NTSTATUS Result = STATUS_INTERNAL_ERROR; /* Shouldn't happen */
|
||||||
KIRQL Irql;
|
KIRQL Irql;
|
||||||
|
|
||||||
|
@ -512,7 +510,7 @@ static NTSTATUS STDCALL I8042BasicDetect(PDEVICE_EXTENSION DevExt)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
UCHAR Value = 0;
|
UCHAR Value = 0;
|
||||||
UINT Counter;
|
ULONG Counter;
|
||||||
|
|
||||||
DevExt->MouseExists = FALSE;
|
DevExt->MouseExists = FALSE;
|
||||||
DevExt->KeyboardExists = FALSE;
|
DevExt->KeyboardExists = FALSE;
|
||||||
|
|
|
@ -1,51 +1,19 @@
|
||||||
#ifndef _I8042DRV_H
|
#ifndef _I8042DRV_H
|
||||||
#define _I8042DRV_H
|
#define _I8042DRV_H
|
||||||
#include <ddk/ntddk.h>
|
|
||||||
#include <ddk/ntddkbd.h>
|
#include <ntddk.h>
|
||||||
#include <ddk/ntdd8042.h>
|
#include <kbdmou.h>
|
||||||
|
#include <ntdd8042.h>
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#define STDCALL
|
||||||
|
#define DDKAPI
|
||||||
|
#endif
|
||||||
|
|
||||||
#define KEYBOARD_IRQ 1
|
#define KEYBOARD_IRQ 1
|
||||||
#define MOUSE_IRQ 12
|
#define MOUSE_IRQ 12
|
||||||
#define KBD_BUFFER_SIZE 32
|
#define KBD_BUFFER_SIZE 32
|
||||||
|
|
||||||
// should be in ntdd8042.h
|
|
||||||
|
|
||||||
typedef VOID DDKAPI
|
|
||||||
(*KEYBOARD_CLASS_SERVICE_CALLBACK) (
|
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
|
||||||
IN PKEYBOARD_INPUT_DATA InputDataStart,
|
|
||||||
IN PKEYBOARD_INPUT_DATA InputDataEnd,
|
|
||||||
IN OUT PULONG InputDataConsumed
|
|
||||||
);
|
|
||||||
|
|
||||||
/* I'm not actually sure if this is in the ddk, would seem logical */
|
|
||||||
typedef VOID DDKAPI
|
|
||||||
(*MOUSE_CLASS_SERVICE_CALLBACK) (
|
|
||||||
IN PDEVICE_OBJECT DeviceObject,
|
|
||||||
IN PMOUSE_INPUT_DATA InputDataStart,
|
|
||||||
IN PMOUSE_INPUT_DATA InputDataEnd,
|
|
||||||
IN OUT PULONG InputDataConsumed
|
|
||||||
);
|
|
||||||
|
|
||||||
typedef struct _CONNECT_DATA {
|
|
||||||
PDEVICE_OBJECT ClassDeviceObject;
|
|
||||||
PVOID ClassService;
|
|
||||||
} CONNECT_DATA, *PCONNECT_DATA;
|
|
||||||
|
|
||||||
#define IOCTL_INTERNAL_KEYBOARD_CONNECT \
|
|
||||||
CTL_CODE(FILE_DEVICE_KEYBOARD, 0x0080, METHOD_NEITHER, FILE_ANY_ACCESS)
|
|
||||||
|
|
||||||
#define IOCTL_INTERNAL_MOUSE_CONNECT \
|
|
||||||
CTL_CODE(FILE_DEVICE_MOUSE, 0x0080, METHOD_NEITHER, FILE_ANY_ACCESS)
|
|
||||||
|
|
||||||
/* For some bizarre reason, these are different from the defines in
|
|
||||||
* w32api. I'm quite sure these are correct though, needs to be checked
|
|
||||||
* against the ddk
|
|
||||||
*/
|
|
||||||
#define KEYBOARD_SCROLL_LOCK_ON 0x01
|
|
||||||
#define KEYBOARD_NUM_LOCK_ON 0x02
|
|
||||||
#define KEYBOARD_CAPS_LOCK_ON 0x04
|
|
||||||
|
|
||||||
#define WHEEL_DELTA 120
|
#define WHEEL_DELTA 120
|
||||||
|
|
||||||
/*-----------------------------------------------------
|
/*-----------------------------------------------------
|
||||||
|
@ -77,21 +45,21 @@ typedef enum _MOUSE_TIMEOUT_STATE
|
||||||
/* TODO: part of this should be in the _ATTRIBUTES structs instead */
|
/* TODO: part of this should be in the _ATTRIBUTES structs instead */
|
||||||
typedef struct _I8042_SETTINGS
|
typedef struct _I8042_SETTINGS
|
||||||
{
|
{
|
||||||
DWORD Headless; /* done */
|
ULONG Headless; /* done */
|
||||||
DWORD CrashScroll;
|
ULONG CrashScroll;
|
||||||
DWORD CrashSysRq; /* done */
|
ULONG CrashSysRq; /* done */
|
||||||
DWORD ReportResetErrors;
|
ULONG ReportResetErrors;
|
||||||
DWORD PollStatusIterations; /* done */
|
ULONG PollStatusIterations; /* done */
|
||||||
DWORD ResendIterations; /* done */
|
ULONG ResendIterations; /* done */
|
||||||
DWORD PollingIterations;
|
ULONG PollingIterations;
|
||||||
DWORD PollingIterationsMaximum;
|
ULONG PollingIterationsMaximum;
|
||||||
DWORD OverrideKeyboardType;
|
ULONG OverrideKeyboardType;
|
||||||
DWORD OverrideKeyboardSubtype;
|
ULONG OverrideKeyboardSubtype;
|
||||||
DWORD MouseResendStallTime;
|
ULONG MouseResendStallTime;
|
||||||
DWORD MouseSynchIn100ns; /* done */
|
ULONG MouseSynchIn100ns; /* done */
|
||||||
DWORD MouseResolution; /* done */
|
ULONG MouseResolution; /* done */
|
||||||
DWORD NumberOfButtons;
|
ULONG NumberOfButtons;
|
||||||
DWORD EnableWheelDetection;
|
ULONG EnableWheelDetection;
|
||||||
} I8042_SETTINGS, *PI8042_SETTINGS;
|
} I8042_SETTINGS, *PI8042_SETTINGS;
|
||||||
|
|
||||||
typedef enum _I8042_MOUSE_TYPE
|
typedef enum _I8042_MOUSE_TYPE
|
||||||
|
@ -178,7 +146,7 @@ typedef struct _DEVICE_EXTENSION
|
||||||
I8042_MOUSE_TYPE MouseType;
|
I8042_MOUSE_TYPE MouseType;
|
||||||
|
|
||||||
OUTPUT_PACKET Packet;
|
OUTPUT_PACKET Packet;
|
||||||
UINT PacketResends;
|
ULONG PacketResends;
|
||||||
BOOLEAN PacketComplete;
|
BOOLEAN PacketComplete;
|
||||||
NTSTATUS PacketResult;
|
NTSTATUS PacketResult;
|
||||||
UCHAR PacketBuffer[16];
|
UCHAR PacketBuffer[16];
|
||||||
|
@ -228,8 +196,8 @@ typedef struct _I8042_HOOK_WORKITEM
|
||||||
* Keyboard controller ports
|
* Keyboard controller ports
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define I8042_DATA_PORT 0x60
|
#define I8042_DATA_PORT ((PUCHAR)0x60)
|
||||||
#define I8042_CTRL_PORT 0x64
|
#define I8042_CTRL_PORT ((PUCHAR)0x64)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -295,11 +263,11 @@ typedef struct _I8042_HOOK_WORKITEM
|
||||||
#define MOUSE_NACK 0xFE
|
#define MOUSE_NACK 0xFE
|
||||||
|
|
||||||
/* i8042prt.c */
|
/* i8042prt.c */
|
||||||
NTSTATUS I8042ReadData(BYTE *Data);
|
NTSTATUS I8042ReadData(UCHAR *Data);
|
||||||
|
|
||||||
NTSTATUS I8042ReadStatus(BYTE *Status);
|
NTSTATUS I8042ReadStatus(UCHAR *Status);
|
||||||
|
|
||||||
NTSTATUS I8042ReadDataWait(PDEVICE_EXTENSION DevExt, BYTE *Data);
|
NTSTATUS I8042ReadDataWait(PDEVICE_EXTENSION DevExt, UCHAR *Data);
|
||||||
|
|
||||||
VOID I8042Flush();
|
VOID I8042Flush();
|
||||||
|
|
||||||
|
@ -326,7 +294,7 @@ VOID I8042PacketDpc(PDEVICE_EXTENSION DevExt);
|
||||||
VOID STDCALL I8042SendHookWorkItem(PDEVICE_OBJECT DeviceObject,
|
VOID STDCALL I8042SendHookWorkItem(PDEVICE_OBJECT DeviceObject,
|
||||||
PVOID Context);
|
PVOID Context);
|
||||||
|
|
||||||
BOOLEAN I8042Write(PDEVICE_EXTENSION DevExt, int addr, BYTE data);
|
BOOLEAN I8042Write(PDEVICE_EXTENSION DevExt, PUCHAR addr, UCHAR data);
|
||||||
|
|
||||||
/* keyboard.c */
|
/* keyboard.c */
|
||||||
VOID STDCALL I8042IsrWritePortKbd(PVOID Context,
|
VOID STDCALL I8042IsrWritePortKbd(PVOID Context,
|
||||||
|
@ -382,12 +350,12 @@ VOID STDCALL I8042MouseHandleButtons(PDEVICE_EXTENSION DevExt,
|
||||||
USHORT Mask);
|
USHORT Mask);
|
||||||
|
|
||||||
VOID STDCALL I8042MouseHandle(PDEVICE_EXTENSION DevExt,
|
VOID STDCALL I8042MouseHandle(PDEVICE_EXTENSION DevExt,
|
||||||
BYTE Output);
|
UCHAR Output);
|
||||||
|
|
||||||
BOOLEAN STDCALL I8042MouseEnable(PDEVICE_EXTENSION DevExt);
|
BOOLEAN STDCALL I8042MouseEnable(PDEVICE_EXTENSION DevExt);
|
||||||
BOOLEAN STDCALL I8042MouseDisable(PDEVICE_EXTENSION DevExt);
|
BOOLEAN STDCALL I8042MouseDisable(PDEVICE_EXTENSION DevExt);
|
||||||
|
|
||||||
/* ps2pp.c */
|
/* ps2pp.c */
|
||||||
VOID I8042MouseHandlePs2pp(PDEVICE_EXTENSION DevExt, BYTE Input);
|
VOID I8042MouseHandlePs2pp(PDEVICE_EXTENSION DevExt, UCHAR Input);
|
||||||
|
|
||||||
#endif // _KEYBOARD_H_
|
#endif // _KEYBOARD_H_
|
||||||
|
|
|
@ -11,18 +11,16 @@
|
||||||
|
|
||||||
/* INCLUDES ****************************************************************/
|
/* INCLUDES ****************************************************************/
|
||||||
|
|
||||||
#include <ddk/ntddk.h>
|
#ifndef NDEBUG
|
||||||
#include <ddk/ntddkbd.h>
|
|
||||||
#include <ddk/ntdd8042.h>
|
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
|
#endif
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
#include "i8042prt.h"
|
#include "i8042prt.h"
|
||||||
|
|
||||||
/* GLOBALS *******************************************************************/
|
/* GLOBALS *******************************************************************/
|
||||||
|
|
||||||
static BYTE TypematicTable[] = {
|
static UCHAR TypematicTable[] = {
|
||||||
0x00, 0x00, 0x00, 0x05, 0x08, 0x0B, 0x0D, 0x0F, 0x10, 0x12, /* 0-9 */
|
0x00, 0x00, 0x00, 0x05, 0x08, 0x0B, 0x0D, 0x0F, 0x10, 0x12, /* 0-9 */
|
||||||
0x13, 0x14, 0x15, 0x16, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1A, /* 10-19 */
|
0x13, 0x14, 0x15, 0x16, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1A, /* 10-19 */
|
||||||
0x1B, 0x1C, 0x1C, 0x1C, 0x1D, 0x1D, 0x1E };
|
0x1B, 0x1C, 0x1C, 0x1C, 0x1D, 0x1D, 0x1E };
|
||||||
|
@ -87,12 +85,12 @@ NTSTATUS STDCALL I8042SynchWritePortKbd(PVOID Context,
|
||||||
BOOLEAN STDCALL I8042InterruptServiceKbd(struct _KINTERRUPT *Interrupt,
|
BOOLEAN STDCALL I8042InterruptServiceKbd(struct _KINTERRUPT *Interrupt,
|
||||||
VOID * Context)
|
VOID * Context)
|
||||||
{
|
{
|
||||||
BYTE Output;
|
UCHAR Output;
|
||||||
BYTE PortStatus;
|
UCHAR PortStatus;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PDEVICE_EXTENSION DevExt = (PDEVICE_EXTENSION) Context;
|
PDEVICE_EXTENSION DevExt = (PDEVICE_EXTENSION) Context;
|
||||||
BOOLEAN HookContinue = FALSE, HookReturn;
|
BOOLEAN HookContinue = FALSE, HookReturn;
|
||||||
UINT Iterations = 0;
|
ULONG Iterations = 0;
|
||||||
|
|
||||||
KEYBOARD_INPUT_DATA *InputData =
|
KEYBOARD_INPUT_DATA *InputData =
|
||||||
DevExt->KeyboardBuffer + DevExt->KeysInBuffer;
|
DevExt->KeyboardBuffer + DevExt->KeysInBuffer;
|
||||||
|
@ -228,7 +226,7 @@ VOID STDCALL I8042DpcRoutineKbd(PKDPC Dpc,
|
||||||
if (!DevExt->KeyboardData.ClassService)
|
if (!DevExt->KeyboardData.ClassService)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
((KEYBOARD_CLASS_SERVICE_CALLBACK) DevExt->KeyboardData.ClassService)(
|
((PSERVICE_CALLBACK_ROUTINE) DevExt->KeyboardData.ClassService)(
|
||||||
DevExt->KeyboardData.ClassDeviceObject,
|
DevExt->KeyboardData.ClassDeviceObject,
|
||||||
DevExt->KeyboardBuffer,
|
DevExt->KeyboardBuffer,
|
||||||
DevExt->KeyboardBuffer + KeysInBufferCopy,
|
DevExt->KeyboardBuffer + KeysInBufferCopy,
|
||||||
|
@ -240,9 +238,9 @@ VOID STDCALL I8042DpcRoutineKbd(PKDPC Dpc,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* You have to send the rate/delay in a somewhat awkward format */
|
/* You have to send the rate/delay in a somewhat awkward format */
|
||||||
static USHORT I8042GetTypematicByte(USHORT Rate, USHORT Delay)
|
static UCHAR I8042GetTypematicByte(USHORT Rate, USHORT Delay)
|
||||||
{
|
{
|
||||||
USHORT ret;
|
UCHAR ret;
|
||||||
|
|
||||||
if (Rate < 3) {
|
if (Rate < 3) {
|
||||||
ret = 0x0;
|
ret = 0x0;
|
||||||
|
@ -630,7 +628,7 @@ BOOLEAN STDCALL I8042DetectKeyboard(PDEVICE_EXTENSION DevExt)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
UCHAR Value;
|
UCHAR Value;
|
||||||
UINT RetryCount = 10;
|
ULONG RetryCount = 10;
|
||||||
|
|
||||||
DPRINT("Detecting keyboard\n");
|
DPRINT("Detecting keyboard\n");
|
||||||
|
|
||||||
|
@ -713,6 +711,7 @@ detectsetleds:
|
||||||
/* debug stuff */
|
/* debug stuff */
|
||||||
VOID STDCALL
|
VOID STDCALL
|
||||||
KdpServiceDispatcher(ULONG Code, PVOID Context1, PVOID Context2);
|
KdpServiceDispatcher(ULONG Code, PVOID Context1, PVOID Context2);
|
||||||
|
#define EnterDebugger ((PVOID)0x25)
|
||||||
|
|
||||||
static VOID STDCALL I8042DebugWorkItem(PDEVICE_OBJECT DeviceObject,
|
static VOID STDCALL I8042DebugWorkItem(PDEVICE_OBJECT DeviceObject,
|
||||||
PVOID Context)
|
PVOID Context)
|
||||||
|
@ -727,5 +726,10 @@ static VOID STDCALL I8042DebugWorkItem(PDEVICE_OBJECT DeviceObject,
|
||||||
if (!Key)
|
if (!Key)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
KdpServiceDispatcher(TAG('R', 'o', 's', ' '), (PVOID)Key, NULL);
|
#ifdef __REACTOS__
|
||||||
|
/* We hope kernel would understand this. If
|
||||||
|
* that's not the case, nothing would happen.
|
||||||
|
*/
|
||||||
|
KdpServiceDispatcher(TAG('R', 'o', 's', ' '), EnterDebugger, NULL);
|
||||||
|
#endif /* __REACTOS__ */
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,11 +11,9 @@
|
||||||
|
|
||||||
/* INCLUDES ****************************************************************/
|
/* INCLUDES ****************************************************************/
|
||||||
|
|
||||||
#include <ddk/ntddk.h>
|
#ifndef NDEBUG
|
||||||
#include <ddk/ntddkbd.h>
|
|
||||||
#include <ddk/ntdd8042.h>
|
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
|
#endif
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
#include "i8042prt.h"
|
#include "i8042prt.h"
|
||||||
|
@ -147,7 +145,7 @@ BOOLEAN STDCALL I8042MouseResetIsr(PDEVICE_EXTENSION DevExt,
|
||||||
DevExt->MouseExists = FALSE;
|
DevExt->MouseExists = FALSE;
|
||||||
DevExt->MouseState = MouseIdle;
|
DevExt->MouseState = MouseIdle;
|
||||||
DPRINT1("Mouse returned bad reset reply part two: "
|
DPRINT1("Mouse returned bad reset reply part two: "
|
||||||
"%x (expected 0)\n", Value);
|
"%x (expected 0)\n", *Value);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case ExpectingGetDeviceIdACK:
|
case ExpectingGetDeviceIdACK:
|
||||||
|
@ -312,7 +310,7 @@ BOOLEAN STDCALL I8042MouseResetIsr(PDEVICE_EXTENSION DevExt,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case ExpectingSetSamplingRateACK:
|
case ExpectingSetSamplingRateACK:
|
||||||
I8042IsrWritePortMouse(DevExt,
|
I8042IsrWritePortMouse(DevExt,
|
||||||
DevExt->MouseAttributes.SampleRate);
|
(UCHAR)DevExt->MouseAttributes.SampleRate);
|
||||||
DevExt->MouseResetState++;
|
DevExt->MouseResetState++;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case ExpectingSetSamplingRateValueACK:
|
case ExpectingSetSamplingRateValueACK:
|
||||||
|
@ -328,7 +326,7 @@ BOOLEAN STDCALL I8042MouseResetIsr(PDEVICE_EXTENSION DevExt,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case ExpectingFinalResolutionACK:
|
case ExpectingFinalResolutionACK:
|
||||||
I8042IsrWritePortMouse(DevExt,
|
I8042IsrWritePortMouse(DevExt,
|
||||||
DevExt->Settings.MouseResolution & 0xff);
|
(UCHAR)(DevExt->Settings.MouseResolution & 0xff));
|
||||||
DPRINT("%x\n", DevExt->Settings.MouseResolution);
|
DPRINT("%x\n", DevExt->Settings.MouseResolution);
|
||||||
DevExt->MouseResetState = ExpectingFinalResolutionValueACK;
|
DevExt->MouseResetState = ExpectingFinalResolutionValueACK;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -383,7 +381,7 @@ VOID STDCALL I8042MouseHandleButtons(PDEVICE_EXTENSION DevExt,
|
||||||
{
|
{
|
||||||
PMOUSE_INPUT_DATA MouseInput = DevExt->MouseBuffer +
|
PMOUSE_INPUT_DATA MouseInput = DevExt->MouseBuffer +
|
||||||
DevExt->MouseInBuffer;
|
DevExt->MouseInBuffer;
|
||||||
USHORT NewButtonData = MouseInput->RawButtons & Mask;
|
USHORT NewButtonData = (USHORT)(MouseInput->RawButtons & Mask);
|
||||||
USHORT ButtonDiff = (NewButtonData ^ DevExt->MouseButtonState) & Mask;
|
USHORT ButtonDiff = (NewButtonData ^ DevExt->MouseButtonState) & Mask;
|
||||||
|
|
||||||
/* Note that the defines are such:
|
/* Note that the defines are such:
|
||||||
|
@ -404,7 +402,7 @@ VOID STDCALL I8042MouseHandleButtons(PDEVICE_EXTENSION DevExt,
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID STDCALL I8042MouseHandle(PDEVICE_EXTENSION DevExt,
|
VOID STDCALL I8042MouseHandle(PDEVICE_EXTENSION DevExt,
|
||||||
BYTE Output)
|
UCHAR Output)
|
||||||
{
|
{
|
||||||
PMOUSE_INPUT_DATA MouseInput = DevExt->MouseBuffer +
|
PMOUSE_INPUT_DATA MouseInput = DevExt->MouseBuffer +
|
||||||
DevExt->MouseInBuffer;
|
DevExt->MouseInBuffer;
|
||||||
|
@ -515,10 +513,10 @@ VOID STDCALL I8042MouseHandle(PDEVICE_EXTENSION DevExt,
|
||||||
BOOLEAN STDCALL I8042InterruptServiceMouse(struct _KINTERRUPT *Interrupt,
|
BOOLEAN STDCALL I8042InterruptServiceMouse(struct _KINTERRUPT *Interrupt,
|
||||||
VOID *Context)
|
VOID *Context)
|
||||||
{
|
{
|
||||||
BYTE Output, PortStatus;
|
UCHAR Output, PortStatus;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PDEVICE_EXTENSION DevExt = (PDEVICE_EXTENSION) Context;
|
PDEVICE_EXTENSION DevExt = (PDEVICE_EXTENSION) Context;
|
||||||
UINT Iterations = 0;
|
ULONG Iterations = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
Status = I8042ReadStatus(&PortStatus);
|
Status = I8042ReadStatus(&PortStatus);
|
||||||
|
@ -616,7 +614,7 @@ VOID STDCALL I8042DpcRoutineMouse(PKDPC Dpc,
|
||||||
if (!DevExt->MouseData.ClassService)
|
if (!DevExt->MouseData.ClassService)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
((MOUSE_CLASS_SERVICE_CALLBACK) DevExt->MouseData.ClassService)(
|
((PSERVICE_CALLBACK_ROUTINE) DevExt->MouseData.ClassService)(
|
||||||
DevExt->MouseData.ClassDeviceObject,
|
DevExt->MouseData.ClassDeviceObject,
|
||||||
DevExt->MouseBuffer,
|
DevExt->MouseBuffer,
|
||||||
DevExt->MouseBuffer + MouseInBufferCopy,
|
DevExt->MouseBuffer + MouseInBufferCopy,
|
||||||
|
|
|
@ -9,17 +9,15 @@
|
||||||
|
|
||||||
/* INCLUDES ****************************************************************/
|
/* INCLUDES ****************************************************************/
|
||||||
|
|
||||||
#include <ddk/ntddk.h>
|
#ifndef NDEBUG
|
||||||
#include <ddk/ntddkbd.h>
|
|
||||||
#include <ddk/ntdd8042.h>
|
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
|
#endif
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
#include "i8042prt.h"
|
#include "i8042prt.h"
|
||||||
|
|
||||||
|
|
||||||
VOID I8042MouseHandlePs2pp(PDEVICE_EXTENSION DevExt, BYTE Input)
|
VOID I8042MouseHandlePs2pp(PDEVICE_EXTENSION DevExt, UCHAR Input)
|
||||||
{
|
{
|
||||||
UCHAR PktType;
|
UCHAR PktType;
|
||||||
PMOUSE_INPUT_DATA MouseInput = DevExt->MouseBuffer +
|
PMOUSE_INPUT_DATA MouseInput = DevExt->MouseBuffer +
|
||||||
|
|
|
@ -11,11 +11,9 @@
|
||||||
|
|
||||||
/* INCLUDES ****************************************************************/
|
/* INCLUDES ****************************************************************/
|
||||||
|
|
||||||
#include <ddk/ntddk.h>
|
#ifndef NDEBUG
|
||||||
#include <ddk/ntddkbd.h>
|
|
||||||
#include <ddk/ntdd8042.h>
|
|
||||||
|
|
||||||
#define NDEBUG
|
#define NDEBUG
|
||||||
|
#endif
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
#include "i8042prt.h"
|
#include "i8042prt.h"
|
||||||
|
@ -38,24 +36,24 @@ VOID STDCALL I8042ReadRegistry(PDRIVER_OBJECT DriverObject,
|
||||||
|
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
DWORD DefaultHeadless = 0;
|
ULONG DefaultHeadless = 0;
|
||||||
DWORD DefaultCrashScroll = 0;
|
ULONG DefaultCrashScroll = 0;
|
||||||
DWORD DefaultCrashSysRq = 0;
|
ULONG DefaultCrashSysRq = 0;
|
||||||
DWORD DefaultReportResetErrors = 0;
|
ULONG DefaultReportResetErrors = 0;
|
||||||
DWORD DefaultPollStatusIterations = 1;
|
ULONG DefaultPollStatusIterations = 1;
|
||||||
DWORD DefaultResendIterations = 3;
|
ULONG DefaultResendIterations = 3;
|
||||||
DWORD DefaultPollingIterations = 12000;
|
ULONG DefaultPollingIterations = 12000;
|
||||||
DWORD DefaultPollingIterationsMaximum = 12000;
|
ULONG DefaultPollingIterationsMaximum = 12000;
|
||||||
DWORD DefaultKeyboardDataQueueSize = 100;
|
ULONG DefaultKeyboardDataQueueSize = 100;
|
||||||
DWORD DefaultOverrideKeyboardType = 0;
|
ULONG DefaultOverrideKeyboardType = 0;
|
||||||
DWORD DefaultOverrideKeyboardSubtype = 0;
|
ULONG DefaultOverrideKeyboardSubtype = 0;
|
||||||
DWORD DefaultMouseDataQueueSize = 100;
|
ULONG DefaultMouseDataQueueSize = 100;
|
||||||
DWORD DefaultMouseResendStallTime = 1000;
|
ULONG DefaultMouseResendStallTime = 1000;
|
||||||
DWORD DefaultMouseSynchIn100ns = 20000000;
|
ULONG DefaultMouseSynchIn100ns = 20000000;
|
||||||
DWORD DefaultMouseResolution = 3;
|
ULONG DefaultMouseResolution = 3;
|
||||||
DWORD DefaultSampleRate = 60;
|
ULONG DefaultSampleRate = 60;
|
||||||
DWORD DefaultNumberOfButtons = 2;
|
ULONG DefaultNumberOfButtons = 2;
|
||||||
DWORD DefaultEnableWheelDetection = 1;
|
ULONG DefaultEnableWheelDetection = 1;
|
||||||
|
|
||||||
RtlInitUnicodeString(&ParametersPath, NULL);
|
RtlInitUnicodeString(&ParametersPath, NULL);
|
||||||
ParametersPath.MaximumLength = (wcslen(RegistryPath) *
|
ParametersPath.MaximumLength = (wcslen(RegistryPath) *
|
||||||
|
@ -212,15 +210,15 @@ VOID STDCALL I8042ReadRegistry(PDRIVER_OBJECT DriverObject,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status)) {
|
if (!NT_SUCCESS(Status)) {
|
||||||
DPRINT1 ("Can't read registry: %x\n", Status);
|
|
||||||
/* Actually, the defaults are not set when the function
|
/* Actually, the defaults are not set when the function
|
||||||
* fails, as would happen during setup, so you have to
|
* fails, as would happen during setup, so you have to
|
||||||
* set them manually anyway...
|
* set them manually anyway...
|
||||||
*/
|
*/
|
||||||
RTL_QUERY_REGISTRY_TABLE *Current = Parameters;
|
RTL_QUERY_REGISTRY_TABLE *Current = Parameters;
|
||||||
|
DPRINT1 ("Can't read registry: %x\n", Status);
|
||||||
while (Current->Name) {
|
while (Current->Name) {
|
||||||
*((DWORD *)Current->EntryContext) =
|
*((PULONG)Current->EntryContext) =
|
||||||
*((DWORD *)Current->DefaultData);
|
*((PULONG)Current->DefaultData);
|
||||||
Current++;
|
Current++;
|
||||||
}
|
}
|
||||||
DPRINT1 ("Manually set defaults\n");
|
DPRINT1 ("Manually set defaults\n");
|
||||||
|
|
Loading…
Reference in a new issue