diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2010-05-20 13:06:48 +0000 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2010-05-20 13:06:48 +0000 |
commit | eec7aaab9321dc576d1d8f08a4688bc5d47c7dbb (patch) | |
tree | 989205a3414190d5bb21d0861da574a019aaf206 /c/src/lib/libbsp/shared/src/uart-output-char.c | |
parent | 2010-05-20 Sebastian Huber <sebastian.huber@embedded-brains.de> (diff) | |
download | rtems-eec7aaab9321dc576d1d8f08a4688bc5d47c7dbb.tar.bz2 |
2010-05-20 Sebastian Huber <sebastian.huber@embedded-brains.de>
* include/uart-output-char.h, src/uart-output-char.c: New files.
Diffstat (limited to 'c/src/lib/libbsp/shared/src/uart-output-char.c')
-rw-r--r-- | c/src/lib/libbsp/shared/src/uart-output-char.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/shared/src/uart-output-char.c b/c/src/lib/libbsp/shared/src/uart-output-char.c new file mode 100644 index 0000000000..8619db038f --- /dev/null +++ b/c/src/lib/libbsp/shared/src/uart-output-char.c @@ -0,0 +1,44 @@ +/** + * @file + * + * @ingroup bsp_kit + * + * @brief Output character implementation for standard UARTs. + */ + +/* + * Copyright (c) 2010 + * embedded brains GmbH + * Obere Lagerstr. 30 + * D-82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#include <rtems/bspIo.h> + +#include <bsp/uart-output-char.h> + +static void uart_output(char c) +{ + while ((CONSOLE_LSR & CONSOLE_LSR_THRE) == 0) { + /* Wait */ + } + + CONSOLE_THR = c; +} + +static void output(char c) +{ + if (c == '\n') { + uart_output('\r'); + } + + uart_output(c); +} + +BSP_output_char_function_type BSP_output_char = output; |