aboutsummaryrefslogtreecommitdiff
path: root/machine/uart.h
diff options
context:
space:
mode:
authorWesley W. Terpstra <wesley@sifive.com>2017-03-27 12:13:53 -0700
committerWesley W. Terpstra <wesley@sifive.com>2017-03-27 15:50:22 -0700
commit9fa7b30887301f149f2497469a442d0887b21149 (patch)
tree33b67126a0fb86de8603aa8cae2496f2342f45d0 /machine/uart.h
parent3473915b3a3fd925a68fc3260c64824cab2846d2 (diff)
downloadpk-9fa7b30887301f149f2497469a442d0887b21149.zip
pk-9fa7b30887301f149f2497469a442d0887b21149.tar.gz
pk-9fa7b30887301f149f2497469a442d0887b21149.tar.bz2
uart: add physical device driver
Diffstat (limited to 'machine/uart.h')
-rw-r--r--machine/uart.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/machine/uart.h b/machine/uart.h
new file mode 100644
index 0000000..51e951f
--- /dev/null
+++ b/machine/uart.h
@@ -0,0 +1,21 @@
+#ifndef _RISCV_UART_H
+#define _RISCV_UART_H
+
+#include <stdint.h>
+
+extern volatile uint32_t* uart;
+
+#define UART_REG_TXFIFO 0
+#define UART_REG_RXFIFO 1
+#define UART_REG_TXCTRL 2
+#define UART_REG_RXCTRL 3
+#define UART_REG_DIV 4
+
+#define UART_TXEN 0x1
+#define UART_RXEN 0x1
+
+void uart_putchar(uint8_t ch);
+int uart_getchar();
+void query_uart(uintptr_t dtb);
+
+#endif