You are aware that this changes the behavior?
Polling previously only checked, if data is available, but didn't read
it from the port.
But afaics it's only relvenat for WinLdrPortPollOnly, which seems to be
unused anyway.
Am 29.11.2012 00:16, schrieb hbelusca(a)svn.reactos.org:
Author: hbelusca
Date: Wed Nov 28 23:16:01 2012
New Revision: 57780
URL:
http://svn.reactos.org/svn/reactos?rev=57780&view=rev
Log:
[CPORTLIB/FREELDR]
GetByte --> Wait for data (with timeout) and get it if available.
PollByte --> Check for data, get it if available, and return immediately.
Modified:
trunk/reactos/boot/freeldr/freeldr/comm/rs232.c
trunk/reactos/boot/freeldr/freeldr/windows/headless.c
trunk/reactos/include/reactos/libs/cportlib/cportlib.h
trunk/reactos/lib/cportlib/cport.c
Modified: trunk/reactos/boot/freeldr/freeldr/comm/rs232.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/comm/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/comm/rs232.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/comm/rs232.c [iso-8859-1] Wed Nov 28 23:16:01
2012
@@ -100,7 +100,7 @@
if (PortInitialized == FALSE)
return FALSE;
- return (CpGetByte(&Rs232ComPort, ByteReceived, FALSE, FALSE) ==
CP_GET_SUCCESS);
+ return (CpGetByte(&Rs232ComPort, ByteReceived, TRUE) == CP_GET_SUCCESS);
}
/*
@@ -109,12 +109,7 @@
if (PortInitialized == FALSE)
return FALSE;
- while ((READ_PORT_UCHAR (SER_LSR(Rs232PortBase)) & SR_LSR_DR) == 0)
- ;
-
- *ByteReceived = READ_PORT_UCHAR (SER_RBR(Rs232PortBase));
-
- return TRUE;
+ return (CpGetByte(&Rs232ComPort, ByteReceived, FALSE) == CP_GET_SUCCESS);
}
*/
Modified: trunk/reactos/boot/freeldr/freeldr/windows/headless.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/windo…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/windows/headless.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/windows/headless.c [iso-8859-1] Wed Nov 28
23:16:01 2012
@@ -143,7 +143,7 @@
WinLdrPortGetByte(IN ULONG PortId,
OUT PUCHAR Data)
{
- return CpGetByte(&Port[PortId], Data, TRUE, FALSE) == CP_GET_SUCCESS;
+ return CpGetByte(&Port[PortId], Data, TRUE) == CP_GET_SUCCESS;
}
BOOLEAN
@@ -151,7 +151,7 @@
{
UCHAR Dummy;
- return CpGetByte(&Port[PortId], &Dummy, FALSE, TRUE) == CP_GET_SUCCESS;
+ return CpGetByte(&Port[PortId], &Dummy, FALSE) == CP_GET_SUCCESS;
}
VOID
Modified: trunk/reactos/include/reactos/libs/cportlib/cportlib.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/libs/cport…
==============================================================================
--- trunk/reactos/include/reactos/libs/cportlib/cportlib.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/libs/cportlib/cportlib.h [iso-8859-1] Wed Nov 28
23:16:01 2012
@@ -69,8 +69,7 @@
CpGetByte(
IN PCPPORT Port,
OUT PUCHAR Byte,
- IN BOOLEAN Wait,
- IN BOOLEAN Poll
+ IN BOOLEAN Wait
);
VOID
Modified: trunk/reactos/lib/cportlib/cport.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/cportlib/cport.c?rev=5…
==============================================================================
--- trunk/reactos/lib/cportlib/cport.c [iso-8859-1] (original)
+++ trunk/reactos/lib/cportlib/cport.c [iso-8859-1] Wed Nov 28 23:16:01 2012
@@ -255,8 +255,7 @@
NTAPI
CpGetByte(IN PCPPORT Port,
OUT PUCHAR Byte,
- IN BOOLEAN Wait,
- IN BOOLEAN Poll)
+ IN BOOLEAN Wait)
{
UCHAR Lsr;
ULONG LimitCount = Wait ? TIMEOUT_COUNT : 1;
@@ -278,9 +277,6 @@
return CP_GET_ERROR;
}
- /* If only polling was requested by caller, return now */
- if (Poll) return CP_GET_SUCCESS;
-
/* Otherwise read the byte and return it */
*Byte = READ_PORT_UCHAR(Port->Address + RECEIVE_BUFFER_REGISTER);