Author: tkreuzer
Date: Thu Oct 22 15:37:01 2009
New Revision: 43685
URL:
http://svn.reactos.org/svn/reactos?rev=43685&view=rev
Log:
[KDCOM]
- replace KdpDbgPrint with a macro
- remove COM port hack
Modified:
branches/ros-amd64-bringup/reactos/drivers/base/kddll/kdcom.c
branches/ros-amd64-bringup/reactos/drivers/base/kddll/kdcom.h
branches/ros-amd64-bringup/reactos/drivers/base/kddll/kddll.c
branches/ros-amd64-bringup/reactos/drivers/base/kddll/kddll.h
Modified: branches/ros-amd64-bringup/reactos/drivers/base/kddll/kdcom.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/drive…
==============================================================================
--- branches/ros-amd64-bringup/reactos/drivers/base/kddll/kdcom.c [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/drivers/base/kddll/kdcom.c [iso-8859-1] Thu Oct 22
15:37:01 2009
@@ -47,7 +47,7 @@
{
ULONG Mode;
-KdpDbgPrint("KdpPortInitialize\n");
+ KDDBGPRINT("KdpPortInitialize\n");
/* Enable loop mode (set Bit 4 of the MCR) */
WRITE_PORT_UCHAR(ComPortBase + COM_MCR, MCR_LOOP);
@@ -202,9 +202,6 @@
}
}
- // HACK use com1 for FrLdrDbg, com2 for WinDbg
- ComPortNumber = 2;
-
/* Get base address */
ComPortBase = UlongToPtr(BaseArray[ComPortNumber]);
Modified: branches/ros-amd64-bringup/reactos/drivers/base/kddll/kdcom.h
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/drive…
==============================================================================
--- branches/ros-amd64-bringup/reactos/drivers/base/kddll/kdcom.h [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/drivers/base/kddll/kdcom.h [iso-8859-1] Thu Oct 22
15:37:01 2009
@@ -6,16 +6,19 @@
* PROGRAMMER: Timo Kreuzer (timo.kreuzer(a)ewactos.org)
*/
+#ifndef _KDCOM_H_
+#define _KDCOM_H_
+
#define COM_DAT 0x00
-#define COM_IEN 0x01 // interrupt enable register
-#define COM_FCR 0x02 // FIFO Control Register
-#define COM_LCR 0x03 // line control registers
-#define COM_MCR 0x04 // modem control reg
-#define COM_LSR 0x05 // line status register
-#define COM_MSR 0x06 // modem status register
-#define COM_SCR 0x07 // scratch register
-#define COM_DLL 0x00 // divisor latch least sig
-#define COM_DLM 0x01 // divisor latch most sig
+#define COM_IEN 0x01 /* interrupt enable register */
+#define COM_FCR 0x02 /* FIFO Control Register */
+#define COM_LCR 0x03 /* line control registers */
+#define COM_MCR 0x04 /* modem control reg */
+#define COM_LSR 0x05 /* line status register */
+#define COM_MSR 0x06 /* modem status register */
+#define COM_SCR 0x07 /* scratch register */
+#define COM_DLL 0x00 /* divisor latch least sig */
+#define COM_DLM 0x01 /* divisor latch most sig */
#define IEN_ERDA 0x01
#define IEN_ETHRE 0x02
@@ -40,14 +43,15 @@
#define LCR_DLAB 0x80
#define MCR_DTR 0x01
#define MCR_RTS 0x02
-#define MCR_OUT1 0x04 // general purpose output.
+#define MCR_OUT1 0x04 /* general purpose output */
#define MCR_OUT2 0x08
-#define MCR_LOOP 0x10 // enables loopback testing mode
+#define MCR_LOOP 0x10 /* loopback testing mode */
#define MCR_ALL (MCR_DTR | MCR_RTS | MCR_OUT1 | MCR_OUT2 | MCR_LOOP)
-#define LSR_DR 0x01
-#define LSR_TBE 0x20
-#define MSR_CTS 0x10 // (complemented) state of clear to send (CTS).
-#define MSR_DSR 0x20 // (complemented) state of data set ready (DSR).
-#define MSR_RI 0x40 // (complemented) state of ring indicator (RI).
-#define MSR_DCD 0x80 // (complemented) state of data carrier detect (DCD).
+#define LSR_DR 0x01
+#define LSR_TBE 0x20
+#define MSR_CTS 0x10 /* (complemented) state of clear to send (CTS). */
+#define MSR_DSR 0x20 /* (complemented) state of data set ready (DSR). */
+#define MSR_RI 0x40 /* (complemented) state of ring indicator (RI). */
+#define MSR_DCD 0x80 /* (complemented) state of data carrier detect (DCD). */
+#endif /* !_KDCOM_H_ */
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
15:37:01 2009
@@ -6,15 +6,16 @@
* PROGRAMMER: Timo Kreuzer (timo.kreuzer(a)ewactos.org)
*/
+//#define KDDEBUG /* uncomment to enable debugging this dll */
#include "kddll.h"
/* GLOBALS ********************************************************************/
+PFNDBGPRNT KdpDbgPrint = NULL;
ULONG CurrentPacketId = INITIAL_PACKET_ID | SYNC_PACKET_ID;
-// HACK!!!
-DBGRNT KdpDbgPrint = 0;
-
+
+/* PRIVATE FUNCTIONS **********************************************************/
/******************************************************************************
* \name KdpCalculateChecksum
@@ -97,7 +98,7 @@
{
// HACK: misuse this function to get a pointer to FrLdrDbgPrint
KdpDbgPrint = (PVOID)LoaderBlock;
- KdpDbgPrint("KdDebuggerInitialize1\n");
+ KDDBGPRINT("KdDebuggerInitialize1\n");
return STATUS_NOT_IMPLEMENTED;
}
@@ -210,18 +211,18 @@
continue;
case PACKET_TYPE_KD_RESET:
- KdpDbgPrint("KdReceivePacket - got a reset packet\n");
+ KDDBGPRINT("KdReceivePacket - got a reset packet\n");
KdpSendControlPacket(PACKET_TYPE_KD_RESET, 0);
CurrentPacketId = INITIAL_PACKET_ID;
/* Fall through */
case PACKET_TYPE_KD_RESEND:
- KdpDbgPrint("KdReceivePacket - got
PACKET_TYPE_KD_RESEND\n");
+ KDDBGPRINT("KdReceivePacket - got
PACKET_TYPE_KD_RESEND\n");
/* Remote wants us to resend the last packet */
return KDP_PACKET_RESEND;
default:
- KdpDbgPrint("KdReceivePacket - got unknown control
packet\n");
+ KDDBGPRINT("KdReceivePacket - got unknown control
packet\n");
return KDP_PACKET_RESEND;
}
}
@@ -229,8 +230,7 @@
/* Did we wait for an ack packet? */
if (PacketType == PACKET_TYPE_KD_ACKNOWLEDGE)
{
- /* We received something different, start over */
-// continue;
+ /* We received something different */
KdpSendControlPacket(PACKET_TYPE_KD_RESEND, 0);
CurrentPacketId ^= 1;
return KDP_PACKET_RECEIVED;
@@ -240,7 +240,7 @@
if (PacketType != Packet.PacketType)
{
/* We received something different, start over */
- KdpDbgPrint("KdReceivePacket - wrong PacketType\n");
+ KDDBGPRINT("KdReceivePacket - wrong PacketType\n");
KdpSendControlPacket(PACKET_TYPE_KD_RESEND, 0);
continue;
}
@@ -261,21 +261,21 @@
break;
default:
- KdpDbgPrint("KdReceivePacket - unknown PacketType\n");
+ KDDBGPRINT("KdReceivePacket - unknown PacketType\n");
return KDP_PACKET_RESEND;
}
-//KdpDbgPrint("KdReceivePacket - got normal PacketType\n");
+ //KDDBGPRINT("KdReceivePacket - got normal PacketType\n");
/* Packet smaller than expected? */
if (MessageHeader->Length > Packet.ByteCount)
{
- KdpDbgPrint("KdReceivePacket - too few data (%d) for type %d\n",
+ KDDBGPRINT("KdReceivePacket - too few data (%d) for type %d\n",
Packet.ByteCount, MessageHeader->Length);
MessageHeader->Length = Packet.ByteCount;
}
-//KdpDbgPrint("KdReceivePacket - got normal PacketType, Buffer = %p\n",
MessageHeader->Buffer);
+ //KDDBGPRINT("KdReceivePacket - got normal PacketType, Buffer = %p\n",
MessageHeader->Buffer);
/* Receive the message header data */
KdStatus = KdpReceiveBuffer(MessageHeader->Buffer,
@@ -283,12 +283,12 @@
if (KdStatus != KDP_PACKET_RECEIVED)
{
/* Didn't receive data. Packet needs to be resent. */
- KdpDbgPrint("KdReceivePacket - Didn't receive message header
data.\n");
+ KDDBGPRINT("KdReceivePacket - Didn't receive message header
data.\n");
KdpSendControlPacket(PACKET_TYPE_KD_RESEND, 0);
continue;
}
-//KdpDbgPrint("KdReceivePacket - got normal PacketType 3\n");
+ //KDDBGPRINT("KdReceivePacket - got normal PacketType 3\n");
/* Calculate checksum for the header data */
Checksum = KdpCalculateChecksum(MessageHeader->Buffer,
@@ -306,7 +306,7 @@
/* Do we have data? */
if (MessageData->Length)
{
- KdpDbgPrint("KdReceivePacket - got data\n");
+ KDDBGPRINT("KdReceivePacket - got data\n");
/* Receive the message data */
KdStatus = KdpReceiveBuffer(MessageData->Buffer,
@@ -314,7 +314,7 @@
if (KdStatus != KDP_PACKET_RECEIVED)
{
/* Didn't receive data. Start over. */
- KdpDbgPrint("KdReceivePacket - Didn't receive message
data.\n");
+ KDDBGPRINT("KdReceivePacket - Didn't receive message
data.\n");
KdpSendControlPacket(PACKET_TYPE_KD_RESEND, 0);
continue;
}
@@ -328,7 +328,7 @@
/* Compare checksum */
if (Packet.Checksum != Checksum)
{
- KdpDbgPrint("KdReceivePacket - wrong cheksum, got %x, calculated
%x\n",
+ KDDBGPRINT("KdReceivePacket - wrong cheksum, got %x, calculated
%x\n",
Packet.Checksum, Checksum);
KdpSendControlPacket(PACKET_TYPE_KD_RESEND, 0);
continue;
@@ -338,7 +338,7 @@
KdStatus = KdpReceiveBuffer(&Byte, sizeof(UCHAR));
if (KdStatus != KDP_PACKET_RECEIVED || Byte != PACKET_TRAILING_BYTE)
{
- KdpDbgPrint("KdReceivePacket - wrong trailing byte (0x%x), status
0x%x\n", Byte, KdStatus);
+ KDDBGPRINT("KdReceivePacket - wrong trailing byte (0x%x), status
0x%x\n", Byte, KdStatus);
KdpSendControlPacket(PACKET_TYPE_KD_RESEND, 0);
continue;
}
@@ -346,7 +346,7 @@
/* Acknowledge the received packet */
KdpSendControlPacket(PACKET_TYPE_KD_ACKNOWLEDGE, Packet.PacketId);
-//KdpDbgPrint("KdReceivePacket - all ok\n");
+ //KDDBGPRINT("KdReceivePacket - all ok\n");
return KDP_PACKET_RECEIVED;
}
Modified: branches/ros-amd64-bringup/reactos/drivers/base/kddll/kddll.h
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/drive…
==============================================================================
--- branches/ros-amd64-bringup/reactos/drivers/base/kddll/kddll.h [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/drivers/base/kddll/kddll.h [iso-8859-1] Thu Oct 22
15:37:01 2009
@@ -5,6 +5,9 @@
* PURPOSE: Base definitions for the kernel debugger.
* PROGRAMMER: Timo Kreuzer (timo.kreuzer(a)ewactos.org)
*/
+
+#ifndef _KDDLL_H_
+#define _KDDLL_H_
#define NOEXTAPI
#include <ntddk.h>
@@ -21,8 +24,8 @@
typedef UCHAR BYTE, *PBYTE;
-typedef ULONG (*DBGRNT)(const char *Format, ...);
-extern DBGRNT KdpDbgPrint;
+typedef ULONG (*PFNDBGPRNT)(const char *Format, ...);
+extern PFNDBGPRNT KdpDbgPrint;
typedef enum
{
@@ -31,3 +34,10 @@
KDP_PACKET_RESEND = 2
} KDP_STATUS;
+#ifndef KDDEBUG
+#define KDDBGPRINT(...)
+#else
+#define KDDBGPRINT KdpDbgPrint
+#endif
+
+#endif /* !_KDDLL_H_ */