summaryrefslogtreecommitdiff
path: root/fw
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2021-05-10 16:23:02 +0200
committerUros Majstorovic <majstor@majstor.org>2021-05-10 16:23:02 +0200
commit3d5500b437c706819075c0f91cbcd981bd5a153a (patch)
tree7bf6727f232dc71be8695dc9f4d3e6a0ececfd0e /fw
parent35ba25214fcac43a3ef6faacbb9d6b1fbe49fd96 (diff)
LF -> CRLF on stdout
Diffstat (limited to 'fw')
-rw-r--r--fw/fe310/bsp/gloss/sys_write.c6
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;
}