ReactOS  0.4.14-dev-52-g6116262
kdbg.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Kernel
3  * LICENSE: BSD - See COPYING.ARM in the top level directory
4  * FILE: ntoskrnl/kd/arm/kdbg.c
5  * PURPOSE: Serial Port Kernel Debugging Transport Library
6  * PROGRAMMERS: ReactOS Portable Systems Group
7  */
8 
9 /* INCLUDES *******************************************************************/
10 
11 #include <ntoskrnl.h>
12 #include <arm/peripherals/pl011.h>
13 #define NDEBUG
14 #include <debug.h>
15 
16 /* GLOBALS ********************************************************************/
17 
18 CPPORT DefaultPort = {0, 0, 0};
19 
20 //
21 // We need to build this in the configuration root and use KeFindConfigurationEntry
22 // to recover it later.
23 //
24 #define HACK 24000000
25 
26 /* REACTOS FUNCTIONS **********************************************************/
27 
29 NTAPI
31 {
33 }
34 
35 BOOLEAN
36 NTAPI
38  IN ULONG ComPortNumber)
39 {
40  ULONG Divider, Remainder, Fraction;
41  ULONG Baudrate = PortInformation->BaudRate;
42 
43  //
44  // Calculate baudrate clock divider and remainder
45  //
46  Divider = HACK / (16 * Baudrate);
47  Remainder = HACK % (16 * Baudrate);
48 
49  //
50  // Calculate the fractional part
51  //
52  Fraction = (8 * Remainder / Baudrate) >> 1;
53  Fraction += (8 * Remainder / Baudrate) & 1;
54 
55  //
56  // Disable interrupts
57  //
59 
60  //
61  // Set the baud rate
62  //
65 
66  //
67  // Set 8 bits for data, 1 stop bit, no parity, FIFO enabled
68  //
71 
72  //
73  // Clear and enable FIFO
74  //
79 
80  //
81  // Done
82  //
83  return TRUE;
84 }
85 
86 BOOLEAN
87 NTAPI
89  OUT PUCHAR ByteReceived)
90 {
92  while (TRUE);
93  return FALSE;
94 }
95 
96 VOID
97 NTAPI
99  IN UCHAR ByteToSend)
100 {
101  //
102  // Wait for ready
103  //
105 
106  //
107  // Send the character
108  //
110 }
111 
112 /* EOF */
#define IN
Definition: typedefs.h:38
NTKERNELAPI VOID NTAPI WRITE_REGISTER_ULONG(IN PULONG Register, IN ULONG Value)
#define TRUE
Definition: types.h:120
#define UART_PL01x_DR
Definition: hwuart.c:14
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
unsigned char * PUCHAR
Definition: retypes.h:3
#define UART_PL011_LCRH_WLEN_8
Definition: hwuart.c:27
#define UART_PL011_CR_UARTEN
Definition: hwuart.c:33
LONG NTSTATUS
Definition: precomp.h:26
IN CINT OUT PVOID PortInformation
Definition: dumpinfo.c:39
#define UART_PL011_CR
Definition: hwuart.c:21
NTKERNELAPI ULONG NTAPI READ_REGISTER_ULONG(IN PULONG Register)
#define UART_PL011_CR_TXE
Definition: hwuart.c:34
#define HACK
Definition: kdbg.c:24
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
BOOLEAN NTAPI KdPortInitializeEx(IN PCPPORT PortInformation, IN ULONG ComPortNumber)
Definition: kdbg.c:37
#define UART_PL011_LCRH_FEN
Definition: hwuart.c:28
#define UART_PL011_IBRD
Definition: hwuart.c:18
unsigned char BOOLEAN
NTSTATUS NTAPI KdDebuggerInitialize1(IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL)
Definition: kdbg.c:30
VOID NTAPI KdPortPutByteEx(IN PCPPORT PortInformation, IN UCHAR ByteToSend)
Definition: kdbg.c:98
#define UART_PL01x_FR
Definition: hwuart.c:17
BOOLEAN NTAPI KdPortGetByteEx(IN PCPPORT PortInformation, OUT PUCHAR ByteReceived)
Definition: kdbg.c:88
unsigned char UCHAR
Definition: xmlstorage.h:181
unsigned int * PULONG
Definition: retypes.h:1
#define OUT
Definition: typedefs.h:39
#define UART_PL011_FBRD
Definition: hwuart.c:19
#define UART_PL011_LCRH
Definition: hwuart.c:20
unsigned int ULONG
Definition: retypes.h:1
#define UNIMPLEMENTED
Definition: debug.h:114
#define UART_PL01x_FR_TXFF
Definition: hwuart.c:41
CPPORT DefaultPort
Definition: kdbg.c:18
#define UART_PL011_CR_RXE
Definition: hwuart.c:35
_In_ LARGE_INTEGER _Out_opt_ PLARGE_INTEGER Remainder
Definition: rtlfuncs.h:3046
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68