summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/sparc/leon3/console/debugputs.c
diff options
context:
space:
mode:
Diffstat (limited to 'c/src/lib/libbsp/sparc/leon3/console/debugputs.c')
-rw-r--r--c/src/lib/libbsp/sparc/leon3/console/debugputs.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/c/src/lib/libbsp/sparc/leon3/console/debugputs.c b/c/src/lib/libbsp/sparc/leon3/console/debugputs.c
index 7058cf8c8e..080d4fad69 100644
--- a/c/src/lib/libbsp/sparc/leon3/console/debugputs.c
+++ b/c/src/lib/libbsp/sparc/leon3/console/debugputs.c
@@ -89,9 +89,12 @@ int bsp_debug_uart_init(void)
*/
void apbuart_outbyte_polled(
ambapp_apb_uart *regs,
- unsigned char ch
+ unsigned char ch,
+ int do_cr_on_newline,
+ int wait_sent
)
{
+send:
while ( (regs->status & LEON_REG_UART_STATUS_THE) == 0 ) {
/* Lower bus utilization while waiting for UART */
asm volatile ("nop"::); asm volatile ("nop"::);
@@ -100,6 +103,17 @@ void apbuart_outbyte_polled(
asm volatile ("nop"::); asm volatile ("nop"::);
}
regs->data = (unsigned int) ch;
+
+ if ((ch == '\n') && do_cr_on_newline) {
+ ch = '\r';
+ goto send;
+ }
+
+ /* Wait until the character has been sent? */
+ if (wait_sent) {
+ while ((regs->status & LEON_REG_UART_STATUS_THE) == 0)
+ ;
+ }
}
/*
@@ -129,7 +143,7 @@ static void bsp_out_char(char c)
return;
}
- apbuart_outbyte_polled(dbg_uart, c);
+ apbuart_outbyte_polled(dbg_uart, c, 1, 1);
}
/*