Author: hbelusca
Date: Mon Apr 22 00:28:16 2013
New Revision: 58825
URL:
http://svn.reactos.org/svn/reactos?rev=58825&view=rev
Log:
[KDCOM]
- Code reorganization: put all the port control functions together.
- Little simplifications of some functions (from CORE-7106).
Modified:
trunk/reactos/drivers/base/kddll/kdcom.c
trunk/reactos/drivers/base/kddll/kddll.c
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] Mon Apr 22 00:28:16 2013
@@ -43,6 +43,36 @@
NTSTATUS
NTAPI
+KdD0Transition(VOID)
+{
+ return STATUS_SUCCESS;
+}
+
+NTSTATUS
+NTAPI
+KdD3Transition(VOID)
+{
+ return STATUS_SUCCESS;
+}
+
+NTSTATUS
+NTAPI
+KdSave(IN BOOLEAN SleepTransition)
+{
+ /* Nothing to do on COM ports */
+ return STATUS_SUCCESS;
+}
+
+NTSTATUS
+NTAPI
+KdRestore(IN BOOLEAN SleepTransition)
+{
+ /* Nothing to do on COM ports */
+ return STATUS_SUCCESS;
+}
+
+NTSTATUS
+NTAPI
KdpPortInitialize(IN ULONG ComPortNumber,
IN ULONG ComPortBaudRate)
{
@@ -167,6 +197,20 @@
return KdpPortInitialize(ComPortNumber, ComPortBaudRate);
}
+/******************************************************************************
+ * \name KdDebuggerInitialize1
+ * \brief Phase 1 initialization.
+ * \param [opt] LoaderBlock Pointer to the Loader parameter block. Can be NULL.
+ * \return Status
+ */
+NTSTATUS
+NTAPI
+KdDebuggerInitialize1(IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)
+{
+ return STATUS_SUCCESS;
+}
+
+
VOID
NTAPI
KdpSendByte(IN UCHAR Byte)
@@ -210,20 +254,4 @@
return KDP_PACKET_TIMEOUT;
}
-NTSTATUS
-NTAPI
-KdSave(IN BOOLEAN SleepTransition)
-{
- /* Nothing to do on COM ports */
- return STATUS_SUCCESS;
-}
-
-NTSTATUS
-NTAPI
-KdRestore(IN BOOLEAN SleepTransition)
-{
- /* Nothing to do on COM ports */
- return STATUS_SUCCESS;
-}
-
/* EOF */
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] Mon Apr 22 00:28:16 2013
@@ -31,13 +31,10 @@
IN PVOID Buffer,
IN ULONG Length)
{
- ULONG i, Checksum = 0;
-
- for (i = 0; i < Length; i++)
- {
- Checksum += ((PUCHAR)Buffer)[i];
- }
-
+ PUCHAR ByteBuffer = Buffer;
+ ULONG Checksum = 0;
+
+ while (Length-- > 0) Checksum += (ULONG)*ByteBuffer++;
return Checksum;
}
@@ -60,36 +57,6 @@
/* PUBLIC FUNCTIONS ***********************************************************/
-
-NTSTATUS
-NTAPI
-KdD0Transition(VOID)
-{
- return STATUS_SUCCESS;
-}
-
-NTSTATUS
-NTAPI
-KdD3Transition(VOID)
-{
- return STATUS_SUCCESS;
-}
-
-
-/******************************************************************************
- * \name KdDebuggerInitialize1
- * \brief Phase 1 initialization.
- * \param [opt] LoaderBlock Pointer to the Loader parameter block. Can be NULL.
- * \return Status
- */
-NTSTATUS
-NTAPI
-KdDebuggerInitialize1(
- IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)
-{
- return STATUS_SUCCESS;
-}
-
/******************************************************************************
* \name KdReceivePacket
@@ -339,7 +306,6 @@
return KDP_PACKET_RECEIVED;
}
-
VOID
NTAPI
KdSendPacket(
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] Mon Apr 22 00:28:16 2013
@@ -8,7 +8,7 @@
#include "kddll.h"
-
+/* FUNCTIONS ******************************************************************/
/******************************************************************************
* \name KdpSendBuffer
@@ -22,11 +22,9 @@
IN PVOID Buffer,
IN ULONG Size)
{
- ULONG i;
- for (i = 0; i < Size; i++)
- {
- KdpSendByte(((PUCHAR)Buffer)[i]);
- }
+ PUCHAR ByteBuffer = Buffer;
+
+ while (Size-- > 0) KdpSendByte(*ByteBuffer++);
}
/******************************************************************************
@@ -43,15 +41,16 @@
OUT PVOID Buffer,
IN ULONG Size)
{
- ULONG i;
PUCHAR ByteBuffer = Buffer;
+ UCHAR Byte;
KDP_STATUS Status;
- for (i = 0; i < Size; i++)
+ while (Size-- > 0)
{
/* Try to get a byte from the port */
- Status = KdpReceiveByte(&ByteBuffer[i]);
+ Status = KdpReceiveByte(&Byte);
if (Status != KDP_PACKET_RECEIVED) return Status;
+ *ByteBuffer++ = Byte;
}
return KDP_PACKET_RECEIVED;