- Code reorganization: put all the port control functions together.
- Little simplifications of some functions (from CORE-7106).

svn path=/trunk/; revision=58825
This commit is contained in:
Hermès Bélusca-Maïto 2013-04-22 00:28:16 +00:00
parent 5159da237d
commit b56283a15f
3 changed files with 55 additions and 62 deletions

View file

@ -41,6 +41,36 @@ ULONG KdDebugComPortIrq = 0; // Not used at the moment.
/* FUNCTIONS ******************************************************************/
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,
@ -167,6 +197,20 @@ KdDebuggerInitialize0(IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)
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 @@ KdpPollBreakIn(VOID)
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 */

View file

@ -31,13 +31,10 @@ KdpCalculateChecksum(
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;
}
@ -61,36 +58,6 @@ KdpSendControlPacket(
/* 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
* \brief Receive a packet from the KD port.
@ -339,7 +306,6 @@ KdReceivePacket(
return KDP_PACKET_RECEIVED;
}
VOID
NTAPI
KdSendPacket(

View file

@ -8,7 +8,7 @@
#include "kddll.h"
/* FUNCTIONS ******************************************************************/
/******************************************************************************
* \name KdpSendBuffer
@ -22,11 +22,9 @@ KdpSendBuffer(
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 @@ KdpReceiveBuffer(
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;