[PATCH 3/3] bsps/microblaze: Fix UART transmit interrupt
Alex White
alex.white at oarcorp.com
Wed Mar 29 19:22:59 UTC 2023
From: "Maldonado, Sergio E. (GSFC-580.0)" <sergio.e.maldonado at nasa.gov>
---
bsps/microblaze/include/dev/serial/uartlite.h | 2 +-
bsps/microblaze/shared/dev/serial/uartlite.c | 10 +++-------
2 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/bsps/microblaze/include/dev/serial/uartlite.h b/bsps/microblaze/include/dev/serial/uartlite.h
index 009f416508..c281310d56 100644
--- a/bsps/microblaze/include/dev/serial/uartlite.h
+++ b/bsps/microblaze/include/dev/serial/uartlite.h
@@ -51,7 +51,7 @@ typedef struct {
uint32_t initial_baud;
uint32_t enabled;
#ifdef BSP_MICROBLAZE_FPGA_CONSOLE_INTERRUPTS
- bool transmitting;
+ struct rtems_termios_tty *tty;
uint32_t irq;
#endif
} uart_lite_context;
diff --git a/bsps/microblaze/shared/dev/serial/uartlite.c b/bsps/microblaze/shared/dev/serial/uartlite.c
index e2007ee24a..f1b3c013a0 100644
--- a/bsps/microblaze/shared/dev/serial/uartlite.c
+++ b/bsps/microblaze/shared/dev/serial/uartlite.c
@@ -47,10 +47,6 @@ static void microblaze_uart_interrupt( void *arg )
char c = (char) XUartLite_ReadReg( ctx->address, XUL_RX_FIFO_OFFSET );
rtems_termios_enqueue_raw_characters( tty, &c, 1 );
}
-
- while ( ctx->transmitting && !XUartLite_IsTransmitEmpty( ctx->address ) ) {
- rtems_termios_dequeue_characters( tty, 1 );
- }
}
#endif
@@ -81,6 +77,8 @@ static bool uart_first_open(
if ( sc != RTEMS_SUCCESSFUL ) {
return false;
}
+
+ ctx->tty = tty;
#endif
return true;
@@ -120,10 +118,8 @@ static void uart_write(
#ifdef BSP_MICROBLAZE_FPGA_CONSOLE_INTERRUPTS
if ( n > 0 ) {
- ctx->transmitting = true;
XUartLite_SendByte( ctx->address, s[0] );
- } else {
- ctx->transmitting = false;
+ rtems_termios_dequeue_characters( ctx->tty, 1 );
}
#else
size_t i = 0;
--
2.34.1
More information about the devel
mailing list