mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 02:25:17 +00:00
[KDCOM]
- Directly use CpGetByte and Co. functions from the CPortLib since they are working ok. - Remove unusued variables. svn path=/trunk/; revision=58822
This commit is contained in:
parent
bc461d6fa9
commit
8aa27c3f4e
4 changed files with 16 additions and 46 deletions
|
@ -176,52 +176,33 @@ KDP_STATUS
|
|||
NTAPI
|
||||
KdpPollByte(OUT PBYTE OutByte)
|
||||
{
|
||||
/* Get the byte */
|
||||
if (CpGetByte(&KdDebugComPort, OutByte, FALSE) == CP_GET_SUCCESS)
|
||||
{
|
||||
/* Yes, return the byte */
|
||||
return KDP_PACKET_RECEIVED;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Timed out */
|
||||
return KDP_PACKET_TIMEOUT;
|
||||
}
|
||||
/* Poll the byte */
|
||||
return (CpGetByte(&KdDebugComPort, OutByte, FALSE) == CP_GET_SUCCESS
|
||||
? KDP_PACKET_RECEIVED
|
||||
: 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;
|
||||
/* Get 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;
|
||||
if (KdpPollByte(&Byte) == KDP_PACKET_RECEIVED)
|
||||
|
||||
KdStatus = KdpPollByte(&Byte);
|
||||
if ((KdStatus == KDP_PACKET_RECEIVED) && (Byte == BREAKIN_PACKET_BYTE))
|
||||
{
|
||||
if (Byte == BREAKIN_PACKET_BYTE)
|
||||
{
|
||||
return KDP_PACKET_RECEIVED;
|
||||
}
|
||||
return KDP_PACKET_RECEIVED;
|
||||
}
|
||||
return KDP_PACKET_TIMEOUT;
|
||||
}
|
||||
|
|
|
@ -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 @@ NTAPI
|
|||
KdDebuggerInitialize1(
|
||||
IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)
|
||||
{
|
||||
KdpStallScaleFactor = KeGetPcr()->StallScaleFactor * 100;
|
||||
KdpPhase1Complete = TRUE;
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,8 +28,6 @@ typedef UCHAR BYTE, *PBYTE;
|
|||
|
||||
typedef ULONG (*PFNDBGPRNT)(const char *Format, ...);
|
||||
extern PFNDBGPRNT KdpDbgPrint;
|
||||
extern BOOLEAN KdpPhase1Complete;
|
||||
extern ULONG KdpStallScaleFactor;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
|
|
@ -22,7 +22,7 @@ KdpSendBuffer(
|
|||
IN PVOID Buffer,
|
||||
IN ULONG Size)
|
||||
{
|
||||
INT i;
|
||||
ULONG i;
|
||||
for (i = 0; i < Size; i++)
|
||||
{
|
||||
KdpSendByte(((PUCHAR)Buffer)[i]);
|
||||
|
@ -51,11 +51,7 @@ KdpReceiveBuffer(
|
|||
{
|
||||
/* 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;
|
||||
|
|
Loading…
Reference in a new issue