Cleanup i8042prt.h
Remove $Id$ tags
Replace Win32 types by their kernel counterparts (DWORD -> ULONG, ...)
Modified: trunk/reactos/drivers/input/i8042prt/i8042prt.c
Modified: trunk/reactos/drivers/input/i8042prt/i8042prt.h
Modified: trunk/reactos/drivers/input/i8042prt/keyboard.c
Modified: trunk/reactos/drivers/input/i8042prt/mouse.c
Modified: trunk/reactos/drivers/input/i8042prt/ps2pp.c
Modified: trunk/reactos/drivers/input/i8042prt/registry.c
Property changes on: trunk/reactos/drivers/input/i8042prt/README.txt
___________________________________________________________________
Name: svn:keywords
- author date id revision
+ author date revision
_____
Modified: trunk/reactos/drivers/input/i8042prt/i8042prt.c
--- trunk/reactos/drivers/input/i8042prt/i8042prt.c 2005-08-24
20:06:54 UTC (rev 17518)
+++ trunk/reactos/drivers/input/i8042prt/i8042prt.c 2005-08-24
20:34:50 UTC (rev 17519)
@@ -10,11 +10,9 @@
/* INCLUDES
****************************************************************/
-#include <ddk/ntddk.h>
-#include <ddk/ntddkbd.h>
-#include <ddk/ntdd8042.h>
-
+#ifndef NDEBUG
#define NDEBUG
+#endif
#include <debug.h>
#include "i8042prt.h"
@@ -34,18 +32,18 @@
/*
* 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;
- while ((KBD_IBF & READ_PORT_UCHAR((PUCHAR)I8042_CTRL_PORT)) &&
+ while ((KBD_IBF & READ_PORT_UCHAR(I8042_CTRL_PORT)) &&
(ResendIterations--))
{
KeStallExecutionProcessor(50);
}
if (ResendIterations) {
- WRITE_PORT_UCHAR((PUCHAR)addr,data);
+ WRITE_PORT_UCHAR(addr,data);
DPRINT("Sent %x to %x\n", data, addr);
return TRUE;
}
@@ -56,7 +54,7 @@
/*
* 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);
DPRINT("Sent %x to %x\n", data, addr);
@@ -67,10 +65,10 @@
/*
* FUNCTION: Read data from port 0x60
*/
-NTSTATUS I8042ReadData(BYTE *Data)
+NTSTATUS I8042ReadData(UCHAR *Data)
{
- BYTE Status;
- Status=READ_PORT_UCHAR((PUCHAR)I8042_CTRL_PORT);
+ UCHAR Status;
+ Status=READ_PORT_UCHAR(I8042_CTRL_PORT);
// If data is available
if ((Status & KBD_OBF)) {
@@ -84,16 +82,16 @@
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;
}
/*
* 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;
NTSTATUS Status;
@@ -112,7 +110,7 @@
VOID I8042Flush()
{
- BYTE Ignore;
+ UCHAR Ignore;
while (STATUS_SUCCESS == I8042ReadData(&Ignore)) {
; /* drop */
@@ -141,7 +139,7 @@
{
NTSTATUS Status;
UCHAR Ack;
- UINT ResendIterations = DevExt->Settings.ResendIterations + 1;
+ ULONG ResendIterations = DevExt->Settings.ResendIterations + 1;
do {
if (Port)
@@ -311,7 +309,7 @@
VOID I8042PacketDpc(PDEVICE_EXTENSION DevExt)
{
- BOOL FinishIrp = FALSE;
+ BOOLEAN FinishIrp = FALSE;
NTSTATUS Result = STATUS_INTERNAL_ERROR; /* Shouldn't happen */
KIRQL Irql;
@@ -512,7 +510,7 @@
{
NTSTATUS Status;
UCHAR Value = 0;
- UINT Counter;
+ ULONG Counter;
DevExt->MouseExists = FALSE;
DevExt->KeyboardExists = FALSE;
Property changes on: trunk/reactos/drivers/input/i8042prt/i8042prt.c
___________________________________________________________________
Name: svn:keywords
- author date id revision
+ author date revision
_____
Modified: trunk/reactos/drivers/input/i8042prt/i8042prt.h
--- trunk/reactos/drivers/input/i8042prt/i8042prt.h 2005-08-24
20:06:54 UTC (rev 17518)
+++ trunk/reactos/drivers/input/i8042prt/i8042prt.h 2005-08-24
20:34:50 UTC (rev 17519)
@@ -1,51 +1,19 @@
#ifndef _I8042DRV_H
#define _I8042DRV_H
-#include <ddk/ntddk.h>
-#include <ddk/ntddkbd.h>
-#include <ddk/ntdd8042.h>
+#include <ntddk.h>
+#include <kbdmou.h>
+#include <ntdd8042.h>
+
+#ifdef _MSC_VER
+ #define STDCALL
+ #define DDKAPI
+#endif
+
#define KEYBOARD_IRQ 1
#define MOUSE_IRQ 12
#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
/*-----------------------------------------------------
@@ -77,21 +45,21 @@
/* TODO: part of this should be in the _ATTRIBUTES structs instead */
typedef struct _I8042_SETTINGS
{
- DWORD Headless; /* done */
- DWORD CrashScroll;
- DWORD CrashSysRq; /* done */
- DWORD ReportResetErrors;
- DWORD PollStatusIterations; /* done */
- DWORD ResendIterations; /* done */
- DWORD PollingIterations;
- DWORD PollingIterationsMaximum;
- DWORD OverrideKeyboardType;
- DWORD OverrideKeyboardSubtype;
- DWORD MouseResendStallTime;
- DWORD MouseSynchIn100ns; /* done */
- DWORD MouseResolution; /* done */
- DWORD NumberOfButtons;
- DWORD EnableWheelDetection;
+ ULONG Headless; /* done */
+ ULONG CrashScroll;
+ ULONG CrashSysRq; /* done */
+ ULONG ReportResetErrors;
+ ULONG PollStatusIterations; /* done */
+ ULONG ResendIterations; /* done */
+ ULONG PollingIterations;
+ ULONG PollingIterationsMaximum;
+ ULONG OverrideKeyboardType;
+ ULONG OverrideKeyboardSubtype;
+ ULONG MouseResendStallTime;
+ ULONG MouseSynchIn100ns; /* done */
+ ULONG MouseResolution; /* done */
+ ULONG NumberOfButtons;
+ ULONG EnableWheelDetection;
} I8042_SETTINGS, *PI8042_SETTINGS;
typedef enum _I8042_MOUSE_TYPE
@@ -178,7 +146,7 @@
I8042_MOUSE_TYPE MouseType;
OUTPUT_PACKET Packet;
- UINT PacketResends;
+ ULONG PacketResends;
BOOLEAN PacketComplete;
NTSTATUS PacketResult;
UCHAR PacketBuffer[16];
@@ -228,8 +196,8 @@
* Keyboard controller ports
*/
-#define I8042_DATA_PORT 0x60
-#define I8042_CTRL_PORT 0x64
+#define I8042_DATA_PORT ((PUCHAR)0x60)
+#define I8042_CTRL_PORT ((PUCHAR)0x64)
/*
@@ -295,11 +263,11 @@
#define MOUSE_NACK 0xFE
/* 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();
@@ -326,7 +294,7 @@
VOID STDCALL I8042SendHookWorkItem(PDEVICE_OBJECT DeviceObject,
PVOID Context);
-BOOLEAN I8042Write(PDEVICE_EXTENSION DevExt, int addr, BYTE data);
+BOOLEAN I8042Write(PDEVICE_EXTENSION DevExt, PUCHAR addr, UCHAR data);
/* keyboard.c */
VOID STDCALL I8042IsrWritePortKbd(PVOID Context,
@@ -382,12 +350,12 @@
USHORT Mask);
VOID STDCALL I8042MouseHandle(PDEVICE_EXTENSION DevExt,
- BYTE Output);
+ UCHAR Output);
BOOLEAN STDCALL I8042MouseEnable(PDEVICE_EXTENSION DevExt);
BOOLEAN STDCALL I8042MouseDisable(PDEVICE_EXTENSION DevExt);
/* ps2pp.c */
-VOID I8042MouseHandlePs2pp(PDEVICE_EXTENSION DevExt, BYTE Input);
+VOID I8042MouseHandlePs2pp(PDEVICE_EXTENSION DevExt, UCHAR Input);
#endif // _KEYBOARD_H_
Property changes on: trunk/reactos/drivers/input/i8042prt/i8042prt.h
___________________________________________________________________
Name: svn:keywords
- author date id revision
+ author date revision
Property changes on: trunk/reactos/drivers/input/i8042prt/i8042prt.rc
___________________________________________________________________
Name: svn:keywords
- author date id revision
+ author date revision
_____
Modified: trunk/reactos/drivers/input/i8042prt/keyboard.c
--- trunk/reactos/drivers/input/i8042prt/keyboard.c 2005-08-24
20:06:54 UTC (rev 17518)
+++ trunk/reactos/drivers/input/i8042prt/keyboard.c 2005-08-24
20:34:50 UTC (rev 17519)
@@ -11,18 +11,16 @@
/* INCLUDES
****************************************************************/
-#include <ddk/ntddk.h>
-#include <ddk/ntddkbd.h>
-#include <ddk/ntdd8042.h>
-
+#ifndef NDEBUG
#define NDEBUG
+#endif
#include <debug.h>
#include "i8042prt.h"
/* GLOBALS
*******************************************************************/
-static BYTE TypematicTable[] = {
+static UCHAR TypematicTable[] = {
0x00, 0x00, 0x00, 0x05, 0x08, 0x0B, 0x0D, 0x0F, 0x10, 0x12, /*
0-9 */
0x13, 0x14, 0x15, 0x16, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1A, /*
10-19 */
0x1B, 0x1C, 0x1C, 0x1C, 0x1D, 0x1D, 0x1E };
@@ -87,12 +85,12 @@
BOOLEAN STDCALL I8042InterruptServiceKbd(struct _KINTERRUPT *Interrupt,
VOID * Context)
{
- BYTE Output;
- BYTE PortStatus;
+ UCHAR Output;
+ UCHAR PortStatus;
NTSTATUS Status;
PDEVICE_EXTENSION DevExt = (PDEVICE_EXTENSION) Context;
BOOLEAN HookContinue = FALSE, HookReturn;
- UINT Iterations = 0;
+ ULONG Iterations = 0;
KEYBOARD_INPUT_DATA *InputData =
DevExt->KeyboardBuffer +
DevExt->KeysInBuffer;
@@ -228,7 +226,7 @@
if (!DevExt->KeyboardData.ClassService)
return;
- ((KEYBOARD_CLASS_SERVICE_CALLBACK)
DevExt->KeyboardData.ClassService)(
+ ((PSERVICE_CALLBACK_ROUTINE) DevExt->KeyboardData.ClassService)(
DevExt->KeyboardData.ClassDeviceObject,
DevExt->KeyboardBuffer,
DevExt->KeyboardBuffer +
KeysInBufferCopy,
@@ -240,9 +238,9 @@
}
/* 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) {
ret = 0x0;
@@ -630,7 +628,7 @@
{
NTSTATUS Status;
UCHAR Value;
- UINT RetryCount = 10;
+ ULONG RetryCount = 10;
DPRINT("Detecting keyboard\n");
@@ -713,6 +711,7 @@
/* debug stuff */
VOID STDCALL
KdpServiceDispatcher(ULONG Code, PVOID Context1, PVOID Context2);
+#define EnterDebugger ((PVOID)0x25)
static VOID STDCALL I8042DebugWorkItem(PDEVICE_OBJECT DeviceObject,
PVOID Context)
@@ -727,5 +726,10 @@
if (!Key)
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__ */
}
Property changes on: trunk/reactos/drivers/input/i8042prt/keyboard.c
___________________________________________________________________
Name: svn:keywords
- author date id revision
+ author date revision
_____
Modified: trunk/reactos/drivers/input/i8042prt/mouse.c
--- trunk/reactos/drivers/input/i8042prt/mouse.c 2005-08-24
20:06:54 UTC (rev 17518)
+++ trunk/reactos/drivers/input/i8042prt/mouse.c 2005-08-24
20:34:50 UTC (rev 17519)
@@ -11,11 +11,9 @@
/* INCLUDES
****************************************************************/
-#include <ddk/ntddk.h>
-#include <ddk/ntddkbd.h>
-#include <ddk/ntdd8042.h>
-
+#ifndef NDEBUG
#define NDEBUG
+#endif
#include <debug.h>
#include "i8042prt.h"
@@ -147,7 +145,7 @@
DevExt->MouseExists = FALSE;
DevExt->MouseState = MouseIdle;
DPRINT1("Mouse returned bad reset reply part
two: "
- "%x (expected 0)\n", Value);
+ "%x (expected 0)\n", *Value);
}
return TRUE;
case ExpectingGetDeviceIdACK:
@@ -312,7 +310,7 @@
return TRUE;
case ExpectingSetSamplingRateACK:
I8042IsrWritePortMouse(DevExt,
-
DevExt->MouseAttributes.SampleRate);
+
(UCHAR)DevExt->MouseAttributes.SampleRate);
DevExt->MouseResetState++;
return TRUE;
case ExpectingSetSamplingRateValueACK:
@@ -328,7 +326,7 @@
return TRUE;
case ExpectingFinalResolutionACK:
I8042IsrWritePortMouse(DevExt,
- DevExt->Settings.MouseResolution
& 0xff);
+
(UCHAR)(DevExt->Settings.MouseResolution & 0xff));
DPRINT("%x\n", DevExt->Settings.MouseResolution);
DevExt->MouseResetState =
ExpectingFinalResolutionValueACK;
return TRUE;
@@ -383,7 +381,7 @@
{
PMOUSE_INPUT_DATA MouseInput = DevExt->MouseBuffer +
DevExt->MouseInBuffer;
- USHORT NewButtonData = MouseInput->RawButtons & Mask;
+ USHORT NewButtonData = (USHORT)(MouseInput->RawButtons & Mask);
USHORT ButtonDiff = (NewButtonData ^ DevExt->MouseButtonState) &
Mask;
/* Note that the defines are such:
@@ -404,7 +402,7 @@
}
VOID STDCALL I8042MouseHandle(PDEVICE_EXTENSION DevExt,
- BYTE Output)
+ UCHAR Output)
{
PMOUSE_INPUT_DATA MouseInput = DevExt->MouseBuffer +
DevExt->MouseInBuffer;
@@ -515,10 +513,10 @@
BOOLEAN STDCALL I8042InterruptServiceMouse(struct _KINTERRUPT
*Interrupt,
VOID *Context)
{
- BYTE Output, PortStatus;
+ UCHAR Output, PortStatus;
NTSTATUS Status;
PDEVICE_EXTENSION DevExt = (PDEVICE_EXTENSION) Context;
- UINT Iterations = 0;
+ ULONG Iterations = 0;
do {
Status = I8042ReadStatus(&PortStatus);
@@ -616,7 +614,7 @@
if (!DevExt->MouseData.ClassService)
return;
- ((MOUSE_CLASS_SERVICE_CALLBACK) DevExt->MouseData.ClassService)(
+ ((PSERVICE_CALLBACK_ROUTINE) DevExt->MouseData.ClassService)(
DevExt->MouseData.ClassDeviceObject,
DevExt->MouseBuffer,
DevExt->MouseBuffer +
MouseInBufferCopy,
Property changes on: trunk/reactos/drivers/input/i8042prt/mouse.c
___________________________________________________________________
Name: svn:keywords
- author date id revision
+ author date revision
_____
Modified: trunk/reactos/drivers/input/i8042prt/ps2pp.c
--- trunk/reactos/drivers/input/i8042prt/ps2pp.c 2005-08-24
20:06:54 UTC (rev 17518)
+++ trunk/reactos/drivers/input/i8042prt/ps2pp.c 2005-08-24
20:34:50 UTC (rev 17519)
@@ -9,17 +9,15 @@
/* INCLUDES
****************************************************************/
-#include <ddk/ntddk.h>
-#include <ddk/ntddkbd.h>
-#include <ddk/ntdd8042.h>
-
+#ifndef NDEBUG
#define NDEBUG
+#endif
#include <debug.h>
#include "i8042prt.h"
-VOID I8042MouseHandlePs2pp(PDEVICE_EXTENSION DevExt, BYTE Input)
+VOID I8042MouseHandlePs2pp(PDEVICE_EXTENSION DevExt, UCHAR Input)
{
UCHAR PktType;
PMOUSE_INPUT_DATA MouseInput = DevExt->MouseBuffer +
Property changes on: trunk/reactos/drivers/input/i8042prt/ps2pp.c
___________________________________________________________________
Name: svn:keywords
- author date id revision
+ author date revision
_____
Modified: trunk/reactos/drivers/input/i8042prt/registry.c
--- trunk/reactos/drivers/input/i8042prt/registry.c 2005-08-24
20:06:54 UTC (rev 17518)
+++ trunk/reactos/drivers/input/i8042prt/registry.c 2005-08-24
20:34:50 UTC (rev 17519)
@@ -11,11 +11,9 @@
/* INCLUDES
****************************************************************/
-#include <ddk/ntddk.h>
-#include <ddk/ntddkbd.h>
-#include <ddk/ntdd8042.h>
-
+#ifndef NDEBUG
#define NDEBUG
+#endif
#include <debug.h>
#include "i8042prt.h"
@@ -38,24 +36,24 @@
NTSTATUS Status;
- DWORD DefaultHeadless = 0;
- DWORD DefaultCrashScroll = 0;
- DWORD DefaultCrashSysRq = 0;
- DWORD DefaultReportResetErrors = 0;
- DWORD DefaultPollStatusIterations = 1;
- DWORD DefaultResendIterations = 3;
- DWORD DefaultPollingIterations = 12000;
- DWORD DefaultPollingIterationsMaximum = 12000;
- DWORD DefaultKeyboardDataQueueSize = 100;
- DWORD DefaultOverrideKeyboardType = 0;
- DWORD DefaultOverrideKeyboardSubtype = 0;
- DWORD DefaultMouseDataQueueSize = 100;
- DWORD DefaultMouseResendStallTime = 1000;
- DWORD DefaultMouseSynchIn100ns = 20000000;
- DWORD DefaultMouseResolution = 3;
- DWORD DefaultSampleRate = 60;
- DWORD DefaultNumberOfButtons = 2;
- DWORD DefaultEnableWheelDetection = 1;
+ ULONG DefaultHeadless = 0;
+ ULONG DefaultCrashScroll = 0;
+ ULONG DefaultCrashSysRq = 0;
+ ULONG DefaultReportResetErrors = 0;
+ ULONG DefaultPollStatusIterations = 1;
+ ULONG DefaultResendIterations = 3;
+ ULONG DefaultPollingIterations = 12000;
+ ULONG DefaultPollingIterationsMaximum = 12000;
+ ULONG DefaultKeyboardDataQueueSize = 100;
+ ULONG DefaultOverrideKeyboardType = 0;
+ ULONG DefaultOverrideKeyboardSubtype = 0;
+ ULONG DefaultMouseDataQueueSize = 100;
+ ULONG DefaultMouseResendStallTime = 1000;
+ ULONG DefaultMouseSynchIn100ns = 20000000;
+ ULONG DefaultMouseResolution = 3;
+ ULONG DefaultSampleRate = 60;
+ ULONG DefaultNumberOfButtons = 2;
+ ULONG DefaultEnableWheelDetection = 1;
RtlInitUnicodeString(&ParametersPath, NULL);
ParametersPath.MaximumLength = (wcslen(RegistryPath) *
@@ -212,15 +210,15 @@
NULL);
if (!NT_SUCCESS(Status)) {
- DPRINT1 ("Can't read registry: %x\n", Status);
/* Actually, the defaults are not set when the function
* fails, as would happen during setup, so you have to
* set them manually anyway...
*/
RTL_QUERY_REGISTRY_TABLE *Current = Parameters;
+ DPRINT1 ("Can't read registry: %x\n", Status);
while (Current->Name) {
- *((DWORD *)Current->EntryContext) =
- *((DWORD
*)Current->DefaultData);
+ *((PULONG)Current->EntryContext) =
+
*((PULONG)Current->DefaultData);
Current++;
}
DPRINT1 ("Manually set defaults\n");
Property changes on: trunk/reactos/drivers/input/i8042prt/registry.c
___________________________________________________________________
Name: svn:keywords
- author date id revision
+ author date revision