summaryrefslogtreecommitdiffstats
path: root/bsps
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-04-13 09:15:05 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-04-16 14:56:10 +0200
commit223e22f1ed0b8b65de8c7083d8f22e02e9079fc1 (patch)
treebf256a3a0678e73abae21fbf445c2e4ed4b225e2 /bsps
parentbsps: Move stackalloc.c to bsps (diff)
downloadrtems-223e22f1ed0b8b65de8c7083d8f22e02e9079fc1.tar.bz2
bsps: Move uart-output-char.c to bsps
This patch is a part of the BSP source reorganization. Update #3285.
Diffstat (limited to 'bsps')
-rw-r--r--bsps/shared/dev/serial/uart-output-char.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/bsps/shared/dev/serial/uart-output-char.c b/bsps/shared/dev/serial/uart-output-char.c
new file mode 100644
index 0000000000..0831b8d3ed
--- /dev/null
+++ b/bsps/shared/dev/serial/uart-output-char.c
@@ -0,0 +1,52 @@
+/**
+ * @file
+ *
+ * @ingroup bsp_kit
+ *
+ * @brief Output character implementation for standard UARTs.
+ */
+
+/*
+ * Copyright (c) 2010-2011 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 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.org/license/LICENSE.
+ */
+
+#include <rtems/bspIo.h>
+
+#include <bsp/uart-output-char.h>
+
+static void uart_output_raw(char c)
+{
+ while ((CONSOLE_LSR & CONSOLE_LSR_THRE) == 0) {
+ /* Wait */
+ }
+
+ CONSOLE_THR = c;
+}
+
+static void uart_output(char c)
+{
+ uart_output_raw(c);
+}
+
+static int uart_input(void)
+{
+ if ((CONSOLE_LSR & CONSOLE_LSR_RDR) != 0) {
+ return CONSOLE_RBR;
+ } else {
+ return -1;
+ }
+}
+
+BSP_output_char_function_type BSP_output_char = uart_output;
+
+BSP_polling_getchar_function_type BSP_poll_char = uart_input;