From af69a8693b4f4a7f1ea41d2948c3550a46ae6e17 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 10 Jun 2021 15:01:49 +0200 Subject: grlib: Add apbuart_outbyte_wait() --- bsps/shared/grlib/uart/apbuart_cons.c | 2 +- bsps/shared/grlib/uart/apbuart_polled.c | 30 +++++++++++++++--------------- bsps/shared/grlib/uart/apbuart_termios.c | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) (limited to 'bsps/shared/grlib') diff --git a/bsps/shared/grlib/uart/apbuart_cons.c b/bsps/shared/grlib/uart/apbuart_cons.c index e7dda50565..a0a265ab31 100644 --- a/bsps/shared/grlib/uart/apbuart_cons.c +++ b/bsps/shared/grlib/uart/apbuart_cons.c @@ -641,7 +641,7 @@ static void write_polled( int nwrite = 0; while (nwrite < len) { - apbuart_outbyte_polled(uart->regs, *buf++, 0); + apbuart_outbyte_polled(uart->regs, *buf++); nwrite++; } } diff --git a/bsps/shared/grlib/uart/apbuart_polled.c b/bsps/shared/grlib/uart/apbuart_polled.c index 948e0966b8..8a596808b2 100644 --- a/bsps/shared/grlib/uart/apbuart_polled.c +++ b/bsps/shared/grlib/uart/apbuart_polled.c @@ -9,27 +9,27 @@ #include -void apbuart_outbyte_polled( - struct apbuart_regs *regs, - unsigned char ch, - int wait_sent -) +#include + +void apbuart_outbyte_wait(const struct apbuart_regs *regs) { while ( (regs->status & APBUART_STATUS_TE) == 0 ) { /* Lower bus utilization while waiting for UART */ - __asm__ volatile ("nop"::); __asm__ volatile ("nop"::); - __asm__ volatile ("nop"::); __asm__ volatile ("nop"::); - __asm__ volatile ("nop"::); __asm__ volatile ("nop"::); - __asm__ volatile ("nop"::); __asm__ volatile ("nop"::); + _CPU_Instruction_no_operation(); + _CPU_Instruction_no_operation(); + _CPU_Instruction_no_operation(); + _CPU_Instruction_no_operation(); + _CPU_Instruction_no_operation(); + _CPU_Instruction_no_operation(); + _CPU_Instruction_no_operation(); + _CPU_Instruction_no_operation(); } +} +void apbuart_outbyte_polled(struct apbuart_regs *regs, char ch) +{ + apbuart_outbyte_wait(regs); regs->data = (unsigned int) ch; - - /* Wait until the character has been sent? */ - if (wait_sent) { - while ((regs->status & APBUART_STATUS_TE) == 0) - ; - } } int apbuart_inbyte_nonblocking(struct apbuart_regs *regs) diff --git a/bsps/shared/grlib/uart/apbuart_termios.c b/bsps/shared/grlib/uart/apbuart_termios.c index 5fb69902fe..9014a1c735 100644 --- a/bsps/shared/grlib/uart/apbuart_termios.c +++ b/bsps/shared/grlib/uart/apbuart_termios.c @@ -78,7 +78,7 @@ static void apbuart_write_polled( size_t nwrite = 0; while (nwrite < len) { - apbuart_outbyte_polled(uart->regs, *buf++, 0); + apbuart_outbyte_polled(uart->regs, *buf++); nwrite++; } } -- cgit v1.2.3