mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 00:03:22 +00:00
[KDCOM]
- 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:
parent
5159da237d
commit
b56283a15f
3 changed files with 55 additions and 62 deletions
|
@ -41,6 +41,36 @@ ULONG KdDebugComPortIrq = 0; // Not used at the moment.
|
||||||
|
|
||||||
/* FUNCTIONS ******************************************************************/
|
/* 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
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
KdpPortInitialize(IN ULONG ComPortNumber,
|
KdpPortInitialize(IN ULONG ComPortNumber,
|
||||||
|
@ -167,6 +197,20 @@ KdDebuggerInitialize0(IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)
|
||||||
return KdpPortInitialize(ComPortNumber, ComPortBaudRate);
|
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
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
KdpSendByte(IN UCHAR Byte)
|
KdpSendByte(IN UCHAR Byte)
|
||||||
|
@ -210,20 +254,4 @@ KdpPollBreakIn(VOID)
|
||||||
return KDP_PACKET_TIMEOUT;
|
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 */
|
/* EOF */
|
||||||
|
|
|
@ -31,13 +31,10 @@ KdpCalculateChecksum(
|
||||||
IN PVOID Buffer,
|
IN PVOID Buffer,
|
||||||
IN ULONG Length)
|
IN ULONG Length)
|
||||||
{
|
{
|
||||||
ULONG i, Checksum = 0;
|
PUCHAR ByteBuffer = Buffer;
|
||||||
|
ULONG Checksum = 0;
|
||||||
for (i = 0; i < Length; i++)
|
|
||||||
{
|
|
||||||
Checksum += ((PUCHAR)Buffer)[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
while (Length-- > 0) Checksum += (ULONG)*ByteBuffer++;
|
||||||
return Checksum;
|
return Checksum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,36 +58,6 @@ KdpSendControlPacket(
|
||||||
|
|
||||||
/* PUBLIC FUNCTIONS ***********************************************************/
|
/* 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
|
* \name KdReceivePacket
|
||||||
* \brief Receive a packet from the KD port.
|
* \brief Receive a packet from the KD port.
|
||||||
|
@ -339,7 +306,6 @@ KdReceivePacket(
|
||||||
return KDP_PACKET_RECEIVED;
|
return KDP_PACKET_RECEIVED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
KdSendPacket(
|
KdSendPacket(
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#include "kddll.h"
|
#include "kddll.h"
|
||||||
|
|
||||||
|
/* FUNCTIONS ******************************************************************/
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* \name KdpSendBuffer
|
* \name KdpSendBuffer
|
||||||
|
@ -22,11 +22,9 @@ KdpSendBuffer(
|
||||||
IN PVOID Buffer,
|
IN PVOID Buffer,
|
||||||
IN ULONG Size)
|
IN ULONG Size)
|
||||||
{
|
{
|
||||||
ULONG i;
|
PUCHAR ByteBuffer = Buffer;
|
||||||
for (i = 0; i < Size; i++)
|
|
||||||
{
|
while (Size-- > 0) KdpSendByte(*ByteBuffer++);
|
||||||
KdpSendByte(((PUCHAR)Buffer)[i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
|
@ -43,15 +41,16 @@ KdpReceiveBuffer(
|
||||||
OUT PVOID Buffer,
|
OUT PVOID Buffer,
|
||||||
IN ULONG Size)
|
IN ULONG Size)
|
||||||
{
|
{
|
||||||
ULONG i;
|
|
||||||
PUCHAR ByteBuffer = Buffer;
|
PUCHAR ByteBuffer = Buffer;
|
||||||
|
UCHAR Byte;
|
||||||
KDP_STATUS Status;
|
KDP_STATUS Status;
|
||||||
|
|
||||||
for (i = 0; i < Size; i++)
|
while (Size-- > 0)
|
||||||
{
|
{
|
||||||
/* Try to get a byte from the port */
|
/* Try to get a byte from the port */
|
||||||
Status = KdpReceiveByte(&ByteBuffer[i]);
|
Status = KdpReceiveByte(&Byte);
|
||||||
if (Status != KDP_PACKET_RECEIVED) return Status;
|
if (Status != KDP_PACKET_RECEIVED) return Status;
|
||||||
|
*ByteBuffer++ = Byte;
|
||||||
}
|
}
|
||||||
|
|
||||||
return KDP_PACKET_RECEIVED;
|
return KDP_PACKET_RECEIVED;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue