Author: tkreuzer
Date: Thu Oct 22 13:49:52 2009
New Revision: 43683
URL:
http://svn.reactos.org/svn/reactos?rev=43683&view=rev
Log:
[KDCOM]
Better handling for breakin packets
Modified:
branches/ros-amd64-bringup/reactos/drivers/base/kddll/kddll.c
branches/ros-amd64-bringup/reactos/drivers/base/kddll/kdserial.c
Modified: branches/ros-amd64-bringup/reactos/drivers/base/kddll/kddll.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/drive…
==============================================================================
--- branches/ros-amd64-bringup/reactos/drivers/base/kddll/kddll.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/drivers/base/kddll/kddll.c [iso-8859-1] Thu Oct 22
13:49:52 2009
@@ -125,7 +125,7 @@
OUT PSTRING MessageHeader,
OUT PSTRING MessageData,
OUT PULONG DataLength,
- IN OUT PKD_CONTEXT Context)
+ IN OUT PKD_CONTEXT KdContext)
{
UCHAR Byte = 0;
KDP_STATUS KdStatus;
@@ -144,7 +144,11 @@
KdStatus = KdpReceivePacketLeader(&Packet.PacketLeader);
if (KdStatus != KDP_PACKET_RECEIVED)
{
- /* Couldn't read a correct packet leader. */
+ /* Check if we got a breakin */
+ if (KdStatus == KDP_PACKET_RESEND)
+ {
+ KdContext->BreakInRequested = TRUE;
+ }
return KdStatus;
}
Modified: branches/ros-amd64-bringup/reactos/drivers/base/kddll/kdserial.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/drive…
==============================================================================
--- branches/ros-amd64-bringup/reactos/drivers/base/kddll/kdserial.c [iso-8859-1]
(original)
+++ branches/ros-amd64-bringup/reactos/drivers/base/kddll/kdserial.c [iso-8859-1] Thu Oct
22 13:49:52 2009
@@ -67,7 +67,8 @@
* \brief Recieves a packet leadr from the KD port.
* \param PacketLeader Pointer to an ULONG that receives the packet leader.
* \return KDP_PACKET_RECEIVED if successful.
- * KDP_PACKET_TIMEOUT if the receice timed out.
+ * KDP_PACKET_TIMEOUT if the receive timed out.
+ * KDP_PACKET_RESEND if a breakin byte was detected.
*/
KDP_STATUS
NTAPI
@@ -82,26 +83,25 @@
do
{
- /* Receive a single Byte */
+ /* 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 */
- KdpDbgPrint("KDP_PACKET_TIMEOUT\n");
return KDP_PACKET_TIMEOUT;
}
/* Check if we received a byte */
if (KdStatus == KDP_PACKET_RECEIVED)
{
- /* Check for breakin byte */
- if (Byte == BREAKIN_PACKET_BYTE)
- {
- KdpDbgPrint("BREAKIN_PACKET_BYTE\n");
- }
-
/* Check if this is a valid packet leader byte */
if (Byte == PACKET_LEADER_BYTE ||
Byte == CONTROL_PACKET_LEADER_BYTE)
@@ -118,6 +118,15 @@
/* Continue with next byte */
Index++;
+ continue;
+ }
+
+ /* Check for breakin byte */
+ if (Byte == BREAKIN_PACKET_BYTE)
+ {
+ KdpDbgPrint("BREAKIN_PACKET_BYTE\n");
+ Index = 0;
+ Buffer[0] = Byte;
continue;
}
}