summaryrefslogtreecommitdiffhomepage
path: root/src/rv64
diff options
context:
space:
mode:
Diffstat (limited to 'src/rv64')
-rw-r--r--src/rv64/rv64-uart.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/rv64/rv64-uart.c b/src/rv64/rv64-uart.c
index 73964ef..0bc6517 100644
--- a/src/rv64/rv64-uart.c
+++ b/src/rv64/rv64-uart.c
@@ -16,6 +16,7 @@ static uint8_t* cb_uart_ptr = (uint8_t*)CB_UART_BASE;
utf_char_t cb_get_char(void)
{
uintptr_t ptr = CB_UART_BASE;
+
while (!(*(((volatile uint8_t*)ptr) + 0x05) & 0x01))
;
@@ -27,8 +28,14 @@ static boolean cb_locked_put_char = no;
void cb_put_char(utf_char_t ch)
{
+ int32_t timeout = 0;
+
while (cb_locked_put_char)
{
+ ++timeout;
+
+ if (timeout > 1000000)
+ break;
}
cb_locked_put_char = yes;