- More sunifigations and hardware definitions
[AROS.git] / arch / arm-sun4i / boot / serialdebug.c
blob1caccea6497db91812647fd84b4c8a5c84329b31
1 /*
2 Copyright © 2014, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
9 #include <stdio.h>
10 #include <inttypes.h>
12 #include <hardware/sun4i/platform.h>
13 #include <hardware/sun4i/uart.h>
15 static inline void waitBusy() {
16 volatile struct UART *UARTDEBUG;
17 UARTDEBUG = SUN4I_UARTDEBUG_BASE;
19 while ((UARTDEBUG->LSR & LSR_THRE) == 0);
22 static inline void putByte(uint8_t chr) {
23 volatile struct UART *UARTDEBUG;
24 UARTDEBUG = SUN4I_UARTDEBUG_BASE;
26 UARTDEBUG->THR = (uint32_t) chr;
27 // if (chr == '\n') {
28 // UARTDEBUG->THR = (uint32_t) '\r';
29 // }
31 void putBytes(const char *str) {
32 while(*str) {
33 waitBusy();
34 putByte(*str++);
38 static char tmpbuf[512];
39 void kprintf(const char *format, ...) {
40 char *out = tmpbuf;
41 va_list vp;
43 va_start(vp, format);
44 vsnprintf(tmpbuf, 511, format, vp);
45 va_end(vp);
47 putBytes(out);