ReactOS  0.4.15-dev-2155-g06f57e1
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 
28 BOOLEAN
29 NTAPI
31  IN ULONG ComPortNumber)
32 {
33  ULONG Divider, Remainder, Fraction;
34  ULONG Baudrate = PortInformation->BaudRate;
35 
36  //
37  // Calculate baudrate clock divider and remainder
38  //
39  Divider = HACK / (16 * Baudrate);
40  Remainder = HACK % (16 * Baudrate);
41 
42  //
43  // Calculate the fractional part
44  //
45  Fraction = (8 * Remainder / Baudrate) >> 1;
46  Fraction += (8 * Remainder / Baudrate) & 1;
47 
48  //
49  // Disable interrupts
50  //
52 
53  //
54  // Set the baud rate
55  //
58 
59  //
60  // Set 8 bits for data, 1 stop bit, no parity, FIFO enabled
61  //
64 
65  //
66  // Clear and enable FIFO
67  //
72 
73  //
74  // Done
75  //
76  return TRUE;
77 }
78 
79 BOOLEAN
80 NTAPI
82  OUT PUCHAR ByteReceived)
83 {
85  while (TRUE);
86  return FALSE;
87 }
88 
89 VOID
90 NTAPI
92  IN UCHAR ByteToSend)
93 {
94  //
95  // Wait for ready
96  //
98 
99  //
100  // Send the character
101  //
103 }
104 
105 /* EOF */
#define IN
Definition: typedefs.h:39
NTKERNELAPI VOID NTAPI WRITE_REGISTER_ULONG(IN PULONG Register, IN ULONG Value)
#define UART_PL01x_DR
Definition: hwuart.c:14
#define TRUE
Definition: types.h:120
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
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
#define FALSE
Definition: types.h:117
BOOLEAN NTAPI KdPortInitializeEx(IN PCPPORT PortInformation, IN ULONG ComPortNumber)
Definition: kdbg.c:30
#define UART_PL011_LCRH_FEN
Definition: hwuart.c:28
#define UART_PL011_IBRD
Definition: hwuart.c:18
unsigned char BOOLEAN
VOID NTAPI KdPortPutByteEx(IN PCPPORT PortInformation, IN UCHAR ByteToSend)
Definition: kdbg.c:91
#define UART_PL01x_FR
Definition: hwuart.c:17
BOOLEAN NTAPI KdPortGetByteEx(IN PCPPORT PortInformation, OUT PUCHAR ByteReceived)
Definition: kdbg.c:81
unsigned char UCHAR
Definition: xmlstorage.h:181
unsigned int * PULONG
Definition: retypes.h:1
#define OUT
Definition: typedefs.h:40
#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:115
#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