Thanks. I pushed it.

Am 13.02.22 um 17:36 schrieb Gedare Bloom:
ok for 5 and master

On Fri, Feb 11, 2022 at 1:07 AM Christian Mauderer
<christian.maude...@embedded-brains.de> wrote:

Put the next character into the send buffer if the buffer is empty and
not when the last character has been sent out to the line. This improves
the performance slightly.

Before that patch, the receive path was faster than the transmit path.
Therefore a simple echo could drop characters on a busy connection.
With this patch sending and receiving has about the same performance so
that no characters are lost.

Fixes #4610
---


Note: The problem exists on 5 and master. The ticket for 5 is #4611. I would
like to push this patch to both branches.



  bsps/arm/atsam/console/console.c | 9 +++++----
  1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/bsps/arm/atsam/console/console.c b/bsps/arm/atsam/console/console.c
index 5ef4327e11..0802ca2155 100644
--- a/bsps/arm/atsam/console/console.c
+++ b/bsps/arm/atsam/console/console.c
@@ -145,8 +145,9 @@ static void atsam_uart_interrupt(void *arg)
      }
    }

-  if (ctx->transmitting && (sr & UART_SR_TXEMPTY) != 0) {
+  while (ctx->transmitting && (sr & UART_SR_TXRDY) != 0) {
      rtems_termios_dequeue_characters(tty, 1);
+    sr = regs->UART_SR;
    }
  }
  #endif
@@ -408,16 +409,16 @@ static void atsam_uart_write(
    if (len > 0) {
      ctx->transmitting = true;
      regs->UART_THR = buf[0];
-    regs->UART_IER = UART_IDR_TXEMPTY;
+    regs->UART_IER = UART_IDR_TXRDY;
    } else {
      ctx->transmitting = false;
-    regs->UART_IDR = UART_IDR_TXEMPTY;
+    regs->UART_IDR = UART_IDR_TXRDY;
    }
  #else
    size_t i;

    for (i = 0; i < len; ++i) {
-    while ((regs->UART_SR & UART_SR_TXEMPTY) == 0) {
+    while ((regs->UART_SR & UART_SR_TXRDY) == 0) {
        /* Wait */
      }

--
2.31.1

_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

--
--------------------------------------------
embedded brains GmbH
Herr Christian MAUDERER
Dornierstr. 4
82178 Puchheim
Germany
email: christian.maude...@embedded-brains.de
phone: +49-89-18 94 741 - 18
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to