bsp/tms570: Optimize tms570_debug_console_out()

Reduce number of interrupt disable/enable actions.

Update #4982.
This commit is contained in:
Sebastian Huber
2023-12-21 15:16:49 +01:00
parent 5a2f64cf34
commit 65831d71ed

View File

@@ -10,6 +10,7 @@
*/ */
/* /*
* Copyright (C) 2023 embedded brains GmbH & Co. KG
* Copyright (C) 2014 Premysl Houdek <kom541000@gmail.com> * Copyright (C) 2014 Premysl Houdek <kom541000@gmail.com>
* *
* Google Summer of Code 2014 at * Google Summer of Code 2014 at
@@ -55,33 +56,33 @@
* *
* @retval Void * @retval Void
*/ */
static void tms570_debug_console_putc(char ch) static void tms570_debug_console_out(char ch)
{ {
tms570_sci_context *ctx = TMS570_CONSOLE; tms570_sci_context *ctx = TMS570_CONSOLE;
volatile tms570_sci_t *regs = ctx->regs; volatile tms570_sci_t *regs = ctx->regs;
while ( true ) {
rtems_interrupt_level level; rtems_interrupt_level level;
rtems_interrupt_disable(level);
while ( ( regs->FLR & TMS570_SCI_FLR_TXRDY ) == 0) { while ( ( regs->FLR & TMS570_SCI_FLR_TXRDY ) == 0) {
rtems_interrupt_flash(level); /* Wait */
} }
regs->TD = ch;
while ( ( regs->FLR & TMS570_SCI_FLR_TX_EMPTY ) == 0) {
rtems_interrupt_flash(level);
}
rtems_interrupt_enable(level);
}
/** rtems_interrupt_disable( level );
* @brief debug console output
* if ( ( regs->FLR & TMS570_SCI_FLR_TXRDY ) != 0) {
* debug functions always use serial dev 0 peripheral regs->TD = ch;
* rtems_interrupt_enable( level );
* @retval Void
*/ break;
static void tms570_debug_console_out(char c) }
{
tms570_debug_console_putc(c); rtems_interrupt_enable( level );
}
while ( ( regs->FLR & TMS570_SCI_FLR_TX_EMPTY ) == 0) {
/* Wait */
}
} }
static void tms570_debug_console_init(void) static void tms570_debug_console_init(void)