Author: hbelusca
Date: Sun Apr 21 23:23:30 2013
New Revision: 58822
URL:
http://svn.reactos.org/svn/reactos?rev=58822&view=rev
Log:
[KDCOM]
- Directly use CpGetByte and Co. functions from the CPortLib since they are working ok.
- Remove unusued variables.
Modified:
trunk/reactos/drivers/base/kddll/kdcom.c
trunk/reactos/drivers/base/kddll/kddll.c
trunk/reactos/drivers/base/kddll/kddll.h
trunk/reactos/drivers/base/kddll/kdserial.c
Modified: trunk/reactos/drivers/base/kddll/kdcom.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/base/kddll/kdcom.c…
==============================================================================
--- trunk/reactos/drivers/base/kddll/kdcom.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/base/kddll/kdcom.c [iso-8859-1] Sun Apr 21 23:23:30 2013
@@ -176,52 +176,33 @@
NTAPI
KdpPollByte(OUT PBYTE OutByte)
{
+ /* Poll the byte */
+ return (CpGetByte(&KdDebugComPort, OutByte, FALSE) == CP_GET_SUCCESS
+ ? KDP_PACKET_RECEIVED
+ : KDP_PACKET_TIMEOUT);
+}
+
+KDP_STATUS
+NTAPI
+KdpReceiveByte(OUT PBYTE OutByte)
+{
/* Get the byte */
- if (CpGetByte(&KdDebugComPort, OutByte, FALSE) == CP_GET_SUCCESS)
- {
- /* Yes, return the byte */
+ return (CpGetByte(&KdDebugComPort, OutByte, TRUE) == CP_GET_SUCCESS
+ ? KDP_PACKET_RECEIVED
+ : KDP_PACKET_TIMEOUT);
+}
+
+KDP_STATUS
+NTAPI
+KdpPollBreakIn(VOID)
+{
+ KDP_STATUS KdStatus;
+ UCHAR Byte;
+
+ KdStatus = KdpPollByte(&Byte);
+ if ((KdStatus == KDP_PACKET_RECEIVED) && (Byte == BREAKIN_PACKET_BYTE))
+ {
return KDP_PACKET_RECEIVED;
- }
- else
- {
- /* Timed out */
- return KDP_PACKET_TIMEOUT;
- }
-}
-
-KDP_STATUS
-NTAPI
-KdpReceiveByte(OUT PBYTE OutByte)
-{
- // TODO: Use CpGetByte(&KdDebugComPort, OutByte, TRUE);
-
- ULONG Repeats = KdpStallScaleFactor * 100;
-
- while (Repeats--)
- {
- /* Check if data is available */
- if (KdpPollByte(OutByte) == KDP_PACKET_RECEIVED)
- {
- /* We successfully got a byte */
- return KDP_PACKET_RECEIVED;
- }
- }
-
- /* Timed out */
- return KDP_PACKET_TIMEOUT;
-}
-
-KDP_STATUS
-NTAPI
-KdpPollBreakIn(VOID)
-{
- UCHAR Byte;
- if (KdpPollByte(&Byte) == KDP_PACKET_RECEIVED)
- {
- if (Byte == BREAKIN_PACKET_BYTE)
- {
- return KDP_PACKET_RECEIVED;
- }
}
return KDP_PACKET_TIMEOUT;
}
Modified: trunk/reactos/drivers/base/kddll/kddll.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/base/kddll/kddll.c…
==============================================================================
--- trunk/reactos/drivers/base/kddll/kddll.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/base/kddll/kddll.c [iso-8859-1] Sun Apr 21 23:23:30 2013
@@ -12,9 +12,7 @@
PFNDBGPRNT KdpDbgPrint = NULL;
ULONG CurrentPacketId = INITIAL_PACKET_ID | SYNC_PACKET_ID;
-ULONG RemotePacketId = 0;
-BOOLEAN KdpPhase1Complete = FALSE;
-ULONG KdpStallScaleFactor = 10000;
+ULONG RemotePacketId = INITIAL_PACKET_ID;
/* PRIVATE FUNCTIONS **********************************************************/
@@ -89,9 +87,6 @@
KdDebuggerInitialize1(
IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)
{
- KdpStallScaleFactor = KeGetPcr()->StallScaleFactor * 100;
- KdpPhase1Complete = TRUE;
-
return STATUS_SUCCESS;
}
Modified: trunk/reactos/drivers/base/kddll/kddll.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/base/kddll/kddll.h…
==============================================================================
--- trunk/reactos/drivers/base/kddll/kddll.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/base/kddll/kddll.h [iso-8859-1] Sun Apr 21 23:23:30 2013
@@ -28,8 +28,6 @@
typedef ULONG (*PFNDBGPRNT)(const char *Format, ...);
extern PFNDBGPRNT KdpDbgPrint;
-extern BOOLEAN KdpPhase1Complete;
-extern ULONG KdpStallScaleFactor;
typedef enum
{
Modified: trunk/reactos/drivers/base/kddll/kdserial.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/base/kddll/kdseria…
==============================================================================
--- trunk/reactos/drivers/base/kddll/kdserial.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/base/kddll/kdserial.c [iso-8859-1] Sun Apr 21 23:23:30 2013
@@ -22,7 +22,7 @@
IN PVOID Buffer,
IN ULONG Size)
{
- INT i;
+ ULONG i;
for (i = 0; i < Size; i++)
{
KdpSendByte(((PUCHAR)Buffer)[i]);
@@ -51,11 +51,7 @@
{
/* Try to get a byte from the port */
Status = KdpReceiveByte(&ByteBuffer[i]);
-
- if (Status != KDP_PACKET_RECEIVED)
- {
- return Status;
- }
+ if (Status != KDP_PACKET_RECEIVED) return Status;
}
return KDP_PACKET_RECEIVED;