- More sunifigations and hardware definitions
[AROS.git] / arch / arm-sun4i / kernel / kernel_debug.c
blobde2a6706110b085bdbf708c8a082d020dd5f4ff3
1 /*
2 Copyright © 2014, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
9 #include <exec/types.h>
10 #include <aros/kernel.h>
11 #include <inttypes.h>
13 #include <kernel_base.h>
14 #include <kernel_debug.h>
16 #include <hardware/sun4i/platform.h>
17 #include <hardware/sun4i/uart.h>
19 static inline void waitBusy() {
20 volatile struct UART *UARTDEBUG;
21 UARTDEBUG = SUN4I_UARTDEBUG_BASE;
23 while ((UARTDEBUG->LSR & LSR_THRE) == 0);
26 static inline void putByte(uint8_t chr) {
27 volatile struct UART *UARTDEBUG;
28 UARTDEBUG = SUN4I_UARTDEBUG_BASE;
30 UARTDEBUG->THR = (uint32_t) chr;
31 // if (chr == '\n') {
32 // UARTDEBUG->THR = (uint32_t) '\r';
33 // }
36 void (*_KrnPutC)(char) = NULL;
38 void krnSerPutC(int chr) {
39 waitBusy();
40 putByte(chr);
43 int krnPutC(int chr, struct KernelBase *KernelBase) {
44 if (chr == 0x03) {
45 _KrnPutC = NULL;
46 } else {
47 if (_KrnPutC) {
48 _KrnPutC(chr);
50 krnSerPutC(chr);
53 return 0;