Home | Info | Community | Development | myReactOS | Contact Us
Definition at line 75 of file kdserial.c.
Referenced by KdReceivePacket().
{ UCHAR Index = 0, Byte, Buffer[4]; KDP_STATUS KdStatus; /* Set first character to 0 */ Buffer[0] = 0; do { /* Receive a single byte */ KdStatus = KdpReceiveByte(&Byte); /* Check for timeout */ if (KdStatus == KDP_PACKET_TIMEOUT) { /* Check if we already got a breakin byte */ if (Buffer[0] == BREAKIN_PACKET_BYTE) { return KDP_PACKET_RESEND; } /* Report timeout */ return KDP_PACKET_TIMEOUT; } /* Check if we received a byte */ if (KdStatus == KDP_PACKET_RECEIVED) { /* Check if this is a valid packet leader byte */ if (Byte == PACKET_LEADER_BYTE || Byte == CONTROL_PACKET_LEADER_BYTE) { /* Check if we match the first byte */ if (Byte != Buffer[0]) { /* No, this is the new byte 0! */ Index = 0; } /* Store the byte in the buffer */ Buffer[Index] = Byte; /* Continue with next byte */ Index++; continue; } /* Check for breakin byte */ if (Byte == BREAKIN_PACKET_BYTE) { KDDBGPRINT("BREAKIN_PACKET_BYTE\n"); Index = 0; Buffer[0] = Byte; continue; } } /* Restart */ Index = 0; Buffer[0] = 0; } while (Index < 4); /* Enable the debugger */ KdDebuggerNotPresent = FALSE; SharedUserData->KdDebuggerEnabled |= 0x00000002; /* Return the received packet leader */ *PacketLeader = *(PULONG)Buffer; return KDP_PACKET_RECEIVED; }