[rtems commit] bsps/sparc: Set best baud in APBUART driver
Sebastian Huber
sebh at rtems.org
Wed Jul 9 13:57:21 UTC 2014
Module: rtems
Branch: master
Commit: e1f446d3c1adb0e5d37b879be421fb201594235d
Changeset: http://git.rtems.org/rtems/commit/?id=e1f446d3c1adb0e5d37b879be421fb201594235d
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Wed Jul 9 15:53:31 2014 +0200
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.
---
.../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 58822c5..dd3ca5d 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,
More information about the vc
mailing list