diff options
Diffstat (limited to 'fw/fe310/bsp')
-rw-r--r-- | fw/fe310/bsp/gloss/sys_write.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fw/fe310/bsp/gloss/sys_write.c b/fw/fe310/bsp/gloss/sys_write.c index 2095940..458f9a4 100644 --- a/fw/fe310/bsp/gloss/sys_write.c +++ b/fw/fe310/bsp/gloss/sys_write.c @@ -4,6 +4,8 @@ #include "platform.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) @@ -15,8 +17,8 @@ _write(int fd, const void *ptr, size_t len) const char *current = ptr; for (size_t i = 0; i < len; i++) { - while (UART0_REG(UART_REG_TXFIFO) & 0x80000000); - UART0_REG(UART_REG_TXFIFO) = current[i]; + if (current[i] == '\n') PUTC('\r'); + PUTC(current[i]); } return len; } |