[ros-dev] [ros-diffs] [hbelusca] 57780: [CPORTLIB/FREELDR] GetByte --> Wait for data (with timeout) and get it if available. PollByte --> Check for data, get it if available, and return immediately.

Timo Kreuzer timo.kreuzer at web.de
Fri Nov 30 09:53:21 UTC 2012


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 at 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/rs232.c?rev=57780&r1=57779&r2=57780&view=diff
> ==============================================================================
> --- 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/windows/headless.c?rev=57780&r1=57779&r2=57780&view=diff
> ==============================================================================
> --- 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/cportlib/cportlib.h?rev=57780&r1=57779&r2=57780&view=diff
> ==============================================================================
> --- 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=57780&r1=57779&r2=57780&view=diff
> ==============================================================================
> --- 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);
>   
>
>
>




More information about the Ros-dev mailing list