1 // See LICENSE for license details.
2 #ifndef _SDBOOT_KPRINTF_H
3 #define _SDBOOT_KPRINTF_H
8 #define REG32(p, i) ((p)[(i) >> 2])
10 #ifndef UART_CTRL_ADDR
15 #define _CONCAT3(A, B, C) A ## B ## C
16 #define _UART_CTRL_ADDR(UART_NUM) _CONCAT3(UART, UART_NUM, _CTRL_ADDR)
17 #define UART_CTRL_ADDR _UART_CTRL_ADDR(UART_NUM)
19 static volatile uint32_t * const uart
= (void *)(UART_CTRL_ADDR
);
21 static inline void kputc(char c
)
23 volatile uint32_t *tx
= ®32(uart
, UART_REG_TXFIFO
);
27 __asm__
__volatile__ (
28 "amoor.w %0, %2, %1\n"
29 : "=r" (r
), "+A" (*tx
)
33 while ((int32_t)(*tx
) < 0);
38 extern void kputs(const char *);
39 extern void kprintf(const char *, ...);
42 #define dprintf(s, ...) kprintf((s), ##__VA_ARGS__)
43 #define dputs(s) kputs((s))
45 #define dprintf(s, ...) do { } while (0)
46 #define dputs(s) do { } while (0)
49 #endif /* _SDBOOT_KPRINTF_H */