Delete platform directory from sun4i target
[AROS.git] / arch / arm-sun4i / boot / serialdebug.c
blob824ad65ad879d8dce9264e12c4a766d12bee4d59
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 // }
32 void putBytes(const char *str) {
33 while(*str) {
34 waitBusy();
35 putByte(*str++);
39 void kprintf(const char *format, ...) {
40 char tmpbuf[512];
41 char *out = tmpbuf;
43 va_list vp;
45 va_start(vp, format);
46 vsnprintf(tmpbuf, 511, format, vp);
47 va_end(vp);
49 putBytes(out);