From 4db0527c16502103e04c4091dbd803c55538b52f Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Sun, 4 Sep 2022 18:08:36 +0200 Subject: read/write doeas not block when uart is disabled --- fw/fe310/bsp/gloss/sys_write.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'fw/fe310/bsp/gloss/sys_write.c') diff --git a/fw/fe310/bsp/gloss/sys_write.c b/fw/fe310/bsp/gloss/sys_write.c index 458f9a4..e2bb832 100644 --- a/fw/fe310/bsp/gloss/sys_write.c +++ b/fw/fe310/bsp/gloss/sys_write.c @@ -4,13 +4,15 @@ #include "platform.h" +#include "soc/uart.h" + #define PUTC(c) { while (UART0_REG(UART_REG_TXFIFO) & 0x80000000); UART0_REG(UART_REG_TXFIFO) = (c); } /* Write to a file. */ ssize_t _write(int fd, const void *ptr, size_t len) { - if ((fd != STDOUT_FILENO) && (fd != STDERR_FILENO)) { + if ((fd != STDOUT_FILENO) && (fd != STDERR_FILENO) || !eos_uart_enabled()) { errno = ENOSYS; return -1; } -- cgit v1.2.3