mirror of
https://github.com/reactos/reactos.git
synced 2024-11-19 21:48:10 +00:00
Latest version of serial mouse driver with fixes by Logan_V8_TT.
svn path=/trunk/; revision=7968
This commit is contained in:
parent
8443a77631
commit
c9e333fafc
1 changed files with 11 additions and 19 deletions
|
@ -377,33 +377,23 @@ VOID SerialMouseIsrDpc(PKDPC Dpc, PDEVICE_OBJECT DeviceObject, PIRP Irp, PVOID C
|
||||||
|
|
||||||
void InitializeSerialPort(ULONG Port)
|
void InitializeSerialPort(ULONG Port)
|
||||||
{
|
{
|
||||||
ULONG LineControl;
|
/* DLAB off */
|
||||||
|
WRITE_PORT_UCHAR((PUCHAR)Port + 3, 0);
|
||||||
/* Read old value from line control register */
|
WRITE_PORT_UCHAR((PUCHAR)Port + 2, 0); /* FCR: disable FIFO */
|
||||||
LineControl = READ_PORT_UCHAR((PUCHAR)Port + 3);
|
WRITE_PORT_UCHAR((PUCHAR)Port + 1, 0); /* IER: disable ints */
|
||||||
/* NOT SURE WHAT IS THIS SUPPOSED TO DO! */
|
|
||||||
WRITE_PORT_UCHAR((PUCHAR)Port + 1, 0);
|
|
||||||
WRITE_PORT_UCHAR((PUCHAR)Port + 2, 0);
|
|
||||||
/* Set DLAB on */
|
/* Set DLAB on */
|
||||||
WRITE_PORT_UCHAR((PUCHAR)Port + 3, 0x80);
|
WRITE_PORT_UCHAR((PUCHAR)Port + 3, 0x80);
|
||||||
/* Set serial port speed */
|
/* Set serial port speed */
|
||||||
WRITE_PORT_UCHAR((PUCHAR)Port, 0x60);
|
WRITE_PORT_UCHAR((PUCHAR)Port, 0x60);
|
||||||
WRITE_PORT_UCHAR((PUCHAR)Port + 1, 0);
|
WRITE_PORT_UCHAR((PUCHAR)Port + 1, 0);
|
||||||
/* Set DLAB off and restore the old value of line control reg. */
|
/* Set DLAB off and set LCR */
|
||||||
WRITE_PORT_UCHAR((PUCHAR)Port + 3, LineControl & ~0x80);
|
WRITE_PORT_UCHAR((PUCHAR)Port + 3, 2);
|
||||||
|
|
||||||
WRITE_PORT_UCHAR((PUCHAR)Port + 4, 0x09); /* DR int enable */
|
WRITE_PORT_UCHAR((PUCHAR)Port + 4, 0x09); /* DR int enable */
|
||||||
(void) READ_PORT_UCHAR((PUCHAR)Port + 5); /* clear error bits */
|
|
||||||
KeStallExecutionProcessor(150000); /* Wait > 100 ms */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG DetectMicrosoftMouse(ULONG Port)
|
ULONG DetectMicrosoftMouse(ULONG Port)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
* Detection method number two. CuteMouse (GPL DOS Mouse driver
|
|
||||||
* cutemouse.sourceforge.net) assembler port to C by Logan_V8_TT
|
|
||||||
*/
|
|
||||||
|
|
||||||
CHAR Buffer[4];
|
CHAR Buffer[4];
|
||||||
ULONG i;
|
ULONG i;
|
||||||
UCHAR LCR, MCR;
|
UCHAR LCR, MCR;
|
||||||
|
@ -414,19 +404,21 @@ ULONG DetectMicrosoftMouse(ULONG Port)
|
||||||
|
|
||||||
/* Reset UART */
|
/* Reset UART */
|
||||||
WRITE_PORT_UCHAR((PUCHAR)Port + 4, 0); /* MCR: DTR/RTS/OUT2 off */
|
WRITE_PORT_UCHAR((PUCHAR)Port + 4, 0); /* MCR: DTR/RTS/OUT2 off */
|
||||||
WRITE_PORT_UCHAR((PUCHAR)Port + 2, 0); /* FCR: disable FIFO */
|
|
||||||
KeStallExecutionProcessor(150000); /* Wait > 100 ms */
|
|
||||||
|
|
||||||
/* Set communications parameters */
|
/* Set communications parameters */
|
||||||
InitializeSerialPort(Port);
|
InitializeSerialPort(Port);
|
||||||
|
|
||||||
|
/* Flush receive buffer */
|
||||||
|
(void) READ_PORT_UCHAR((PUCHAR)Port);
|
||||||
|
KeStallExecutionProcessor(150000); /* Wait > 100 ms */
|
||||||
|
|
||||||
/* Enable DTR/RTS (OUT2 disabled) */
|
/* Enable DTR/RTS (OUT2 disabled) */
|
||||||
WRITE_PORT_UCHAR((PUCHAR)Port + 4, 3);
|
WRITE_PORT_UCHAR((PUCHAR)Port + 4, 3);
|
||||||
|
|
||||||
/* Discard serial buffer data */
|
/* Discard serial buffer data */
|
||||||
while (READ_PORT_UCHAR((PUCHAR)Port + 5) & 0x01)
|
while (READ_PORT_UCHAR((PUCHAR)Port + 5) & 0x01)
|
||||||
(void)READ_PORT_UCHAR((PUCHAR)Port);
|
(void)READ_PORT_UCHAR((PUCHAR)Port);
|
||||||
KeStallExecutionProcessor(100000); /* Wait */
|
KeStallExecutionProcessor(200000); /* Wait */
|
||||||
|
|
||||||
/* Read the data */
|
/* Read the data */
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
|
|
Loading…
Reference in a new issue