ReactOS 0.4.16-dev-2491-g3dc6630
cport.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS ComPort Library
3 * LICENSE: BSD - See COPYING.ARM in the top level directory
4 * PURPOSE: Provides a serial port library for KDCOM, INIT, and FREELDR
5 * COPYRIGHT: Copyright 2010 ReactOS Portable Systems Group
6 * Copyright 2012-2026 Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
7 *
8 * NOTE: This code is used by Headless Support (Ntoskrnl.exe and Osloader.exe)
9 * and Kdcom.dll in Windows. It may be that WinDBG depends on some of these quirks.
10 *
11 * FIXMEs:
12 * - Get x64 KDCOM, KDBG, FREELDR, and other current code to use this.
13 */
14
15/* INCLUDES *******************************************************************/
16
17#include <ntstatus.h>
18#include <cportlib/cportlib.h>
19
20#include "ns16550.c"
21
22/* GLOBALS ********************************************************************/
23
24// /* Wait timeout value */
25// #define TIMEOUT_COUNT (1024 * 200)
26
27// UCHAR RingIndicator;
28
29/* FUNCTIONS ******************************************************************/
30
35{
37}
38
39VOID
44{
46}
47
48VOID
52 _In_ ULONG BaudRate)
53{
54 Uart16550SetBaud(Port, BaudRate);
55}
56
62 _In_ ULONG BaudRate)
63{
64 /* Validity checks */
65 if (Port == NULL || Address == NULL || BaudRate == 0)
67
68#if 0
70 return STATUS_NOT_FOUND;
71
72 /* Initialize port data */
74 Port->BaudRate = 0;
75 Port->Flags = 0;
76#endif
77 return Uart16550Initialize(Port, Address, BaudRate);
78}
79
86 _In_ BOOLEAN Poll)
87{
88 return Uart16550GetByte(Port, Byte, Wait, Poll);
89}
90
91VOID
96{
98}
99
100/* EOF */
unsigned char BOOLEAN
Definition: actypes.h:127
LONG NTSTATUS
Definition: precomp.h:26
USHORT NTAPI CpGetByte(_Inout_ PCPPORT Port, _Out_ PUCHAR Byte, _In_ BOOLEAN Wait, _In_ BOOLEAN Poll)
Definition: cport.c:82
VOID NTAPI CpPutByte(_Inout_ PCPPORT Port, _In_ UCHAR Byte)
Definition: cport.c:93
NTSTATUS NTAPI CpInitialize(_Inout_ PCPPORT Port, _In_ PUCHAR Address, _In_ ULONG BaudRate)
Definition: cport.c:59
BOOLEAN NTAPI CpDoesPortExist(_In_ PUCHAR Address)
Definition: cport.c:33
VOID NTAPI CpSetBaud(_Inout_ PCPPORT Port, _In_ ULONG BaudRate)
Definition: cport.c:50
VOID NTAPI CpEnableFifo(_In_ PUCHAR Address, _In_ BOOLEAN Enable)
Definition: cport.c:41
#define NULL
Definition: types.h:112
unsigned char Byte
Definition: zlib.h:37
CPPORT Port[4]
Definition: headless.c:38
#define _Inout_
Definition: no_sal2.h:162
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
VOID NTAPI Uart16550SetBaud(_Inout_ PCPPORT Port, _In_ ULONG BaudRate)
Definition: ns16550.c:158
USHORT NTAPI Uart16550GetByte(_Inout_ PCPPORT Port, _Out_ PUCHAR Byte, _In_ BOOLEAN Wait, _In_ BOOLEAN Poll)
Definition: ns16550.c:250
NTSTATUS NTAPI Uart16550Initialize(_Inout_ PCPPORT Port, _In_ PUCHAR Address, _In_ ULONG BaudRate)
Definition: ns16550.c:182
VOID NTAPI Uart16550PutByte(_Inout_ PCPPORT Port, _In_ UCHAR Byte)
Definition: ns16550.c:303
VOID NTAPI Uart16550EnableFifo(_In_ PUCHAR Address, _In_ BOOLEAN Enable)
Definition: ns16550.c:146
BOOLEAN NTAPI Uart16550DoesPortExist(_In_ PUCHAR Address)
Definition: ns16550.c:138
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:142
unsigned short USHORT
Definition: pedump.c:61
static WCHAR Address[46]
Definition: ping.c:68
#define STATUS_NOT_FOUND
Definition: shellext.h:72
PUCHAR Address
Definition: cportlib.h:28
ULONG BaudRate
Definition: cportlib.h:29
USHORT Flags
Definition: cportlib.h:30
#define NTAPI
Definition: typedefs.h:36
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_In_ WDFDPC _In_ BOOLEAN Wait
Definition: wdfdpc.h:170
unsigned char UCHAR
Definition: xmlstorage.h:181