From e1f446d3c1adb0e5d37b879be421fb201594235d Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 9 Jul 2014 15:53:31 +0200 Subject: bsps/sparc: Set best baud in APBUART driver This prevents failures of all tests using rtems_shell_wait_for_input(), e.g. capture, termios, pppd, etc. --- c/src/lib/libbsp/sparc/shared/uart/apbuart_termios.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/c/src/lib/libbsp/sparc/shared/uart/apbuart_termios.c b/c/src/lib/libbsp/sparc/shared/uart/apbuart_termios.c index 58822c522b..dd3ca5db3d 100644 --- a/c/src/lib/libbsp/sparc/shared/uart/apbuart_termios.c +++ b/c/src/lib/libbsp/sparc/shared/uart/apbuart_termios.c @@ -160,6 +160,16 @@ static bool apbuart_set_attributes( return true; } +static void apbuart_set_best_baud( + rtems_termios_tty *tty, + const struct apbuart_context *uart +) +{ + uint32_t baud = (uart->freq_hz * 10) / ((uart->regs->scaler * 10 + 5) * 8); + + rtems_termios_set_best_baud(tty, baud); +} + static bool apbuart_first_open_polled( rtems_termios_tty *tty, rtems_libio_open_close_args_t *args @@ -167,6 +177,8 @@ static bool apbuart_first_open_polled( { struct apbuart_context *uart = rtems_termios_get_device_context(tty); + apbuart_set_best_baud(tty, uart); + /* Initialize UART on opening */ uart->regs->ctrl |= APBUART_CTRL_RE | APBUART_CTRL_TE; uart->regs->status = 0; @@ -182,6 +194,8 @@ static bool apbuart_first_open_interrupt( struct apbuart_context *uart = rtems_termios_get_device_context(tty); rtems_status_code sc; + apbuart_set_best_baud(tty, uart); + /* Register Interrupt handler */ sc = rtems_interrupt_handler_install(uart->irq, "console", RTEMS_INTERRUPT_SHARED, -- cgit v1.2.3