blob: ea231d93c8c2a4d484859b491c66de1fddaf3deb [file] [log] [blame]
swissChili56cf8172022-07-30 18:47:48 -07001#include "kint.h"
2#include "serial.h"
3
4/* Base address for QEMU */
5/* TODO: Abstract for ESP32C3 */
6#define UART_BASE (void *)0x10000000
7#define UART_LSR_EMPTY_MASK 0x40
8
9/* UART transmitter holding register */
10uchar *uart_thr = UART_BASE;
11
12/* UART line status register */
13uchar *uart_lsr = UART_BASE + 5;
14
15void init_serial()
16{
17}
18
19void serial_put(char byte)
20{
21 while (*uart_lsr ^ UART_LSR_EMPTY_MASK)
22 {
23 /* block until UART clear */
24 }
25
26 *uart_thr = byte;
27}
28
29void serial_write(char *string)
30{
31 while (*string)
32 {
33 serial_put(*string++);
34 }
35}