diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-07-09 15:53:31 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-07-09 15:56:43 +0200 |
commit | e1f446d3c1adb0e5d37b879be421fb201594235d (patch) | |
tree | f504bbb3a1b3365f0470fe8945bf8cf1dc6d37ce | |
parent | termios: Add rtems_termios_set_best_baud() (diff) | |
download | rtems-e1f446d3c1adb0e5d37b879be421fb201594235d.tar.bz2 |
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.
-rw-r--r-- | c/src/lib/libbsp/sparc/shared/uart/apbuart_termios.c | 14 |
1 files changed, 14 insertions, 0 deletions
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, |