xref: /reactos/ntoskrnl/kd/kdserial.c (revision ccef43f3)
1 /*
2  * PROJECT:     ReactOS KDBG Kernel Debugger Terminal Driver
3  * LICENSE:     GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4  * PURPOSE:     Serial driver
5  * COPYRIGHT:   Copyright 2004 Art Yerkes <ayerkes@speakeasy.net>
6  *              Copyright 2005 Gregor Anich <blight@blight.eu.org>
7  */
8 
9 /* INCLUDES ******************************************************************/
10 
11 #include <ntoskrnl.h>
12 #include "kd.h"
13 
14 /* FUNCTIONS *****************************************************************/
15 
16 VOID
17 KdbpSendCommandSerial(
18     _In_ PCSTR Command)
19 {
20     while (*Command)
21         KdPortPutByteEx(&SerialPortInfo, *Command++);
22 }
23 
24 CHAR
25 KdbpTryGetCharSerial(
26     _In_ ULONG Retry)
27 {
28     CHAR Result = -1;
29 
30     if (Retry == 0)
31         while (!KdPortGetByteEx(&SerialPortInfo, (PUCHAR)&Result));
32     else
33         while (!KdPortGetByteEx(&SerialPortInfo, (PUCHAR)&Result) && Retry-- > 0);
34 
35     return Result;
36 }
37 
38 /* EOF */
39