2 * PROJECT: ReactOS Kernel
3 * LICENSE: BSD - See COPYING.ARM in the top level directory
4 * FILE: ntoskrnl/ke/arm/arm_kprintf.c
5 * PURPOSE: Early serial printf-style kernel debugging (ARM bringup)
6 * PROGRAMMERS: ReactOS Portable Systems Group
9 /* INCLUDES *******************************************************************/
15 /* GLOBALS ********************************************************************/
20 #define UART_BASE (void*)0xe00f1000 /* HACK: freeldr mapped it here */
22 #define UART_PL01x_DR (UART_BASE + 0x00)
23 #define UART_PL01x_RSR (UART_BASE + 0x04)
24 #define UART_PL01x_ECR (UART_BASE + 0x04)
25 #define UART_PL01x_FR (UART_BASE + 0x18)
26 #define UART_PL011_IBRD (UART_BASE + 0x24)
27 #define UART_PL011_FBRD (UART_BASE + 0x28)
28 #define UART_PL011_LCRH (UART_BASE + 0x2C)
29 #define UART_PL011_CR (UART_BASE + 0x30)
30 #define UART_PL011_IMSC (UART_BASE + 0x38)
35 #define UART_PL011_LCRH_WLEN_8 0x60
36 #define UART_PL011_LCRH_FEN 0x10
41 #define UART_PL011_CR_UARTEN 0x01
42 #define UART_PL011_CR_TXE 0x100
43 #define UART_PL011_CR_RXE 0x200
48 #define UART_PL01x_FR_RXFE 0x10
49 #define UART_PL01x_FR_TXFF 0x20
51 #define READ_REGISTER_ULONG(r) (*(volatile ULONG * const)(r))
52 #define WRITE_REGISTER_ULONG(r, v) (*(volatile ULONG *)(r) = (v))
54 /* FUNCTIONS ******************************************************************/
57 ArmVersaPutChar(IN INT Char
)
60 // Properly support new-lines
62 if (Char
== '\n') ArmVersaPutChar('\r');
67 while ((READ_REGISTER_ULONG(UART_PL01x_FR
) & UART_PL01x_FR_TXFF
) != 0);
72 WRITE_REGISTER_ULONG(UART_PL01x_DR
, Char
);
75 void arm_kprintf(const char *fmt
, ...) {
80 _vsnprintf(buf
,sizeof(buf
),fmt
,args
);
82 for (s
= buf
; *s
; s
++)