summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/or1k/or1ksim/console/console-config.c
diff options
context:
space:
mode:
authorHesham ALMatary <heshamelmatary@gmail.com>2014-08-20 12:23:20 -0500
committerJoel Sherrill <joel.sherrill@oarcorp.com>2014-08-20 14:46:15 -0500
commitfd5701587f7961259253e66e4dd8fa8c44e8ee91 (patch)
treefe7996f2f6321ce1c0515b2b82cf34aa63470117 /c/src/lib/libbsp/or1k/or1ksim/console/console-config.c
parentBSP for TMS570LS31x Hercules Development Kit from TI (TMS570LS3137) (diff)
downloadrtems-fd5701587f7961259253e66e4dd8fa8c44e8ee91.tar.bz2
Add new (first) OpenRISC BSP called or1ksim.
This BSP is intended to run on or1ksim (the main OpenRISC emulator). Fixed version according to Joel comments from the mailing list.
Diffstat (limited to 'c/src/lib/libbsp/or1k/or1ksim/console/console-config.c')
-rw-r--r--c/src/lib/libbsp/or1k/or1ksim/console/console-config.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/or1k/or1ksim/console/console-config.c b/c/src/lib/libbsp/or1k/or1ksim/console/console-config.c
new file mode 100644
index 0000000000..9853f2041d
--- /dev/null
+++ b/c/src/lib/libbsp/or1k/or1ksim/console/console-config.c
@@ -0,0 +1,58 @@
+/**
+ * @file
+ *
+ * @ingroup or1ksim_uart
+ *
+ * @brief Console Configuration.
+ */
+
+/*
+ * Copyright (c) 2014 Hesham ALMatary
+ *
+ * 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 <libchip/serial.h>
+
+#include <bspopts.h>
+#include <bsp/uart.h>
+#include <bsp/or1ksim.h>
+
+console_tbl Console_Configuration_Ports [] = {
+ {
+ .sDeviceName = "/dev/ttyS0",
+ .deviceType = SERIAL_CUSTOM,
+ .pDeviceFns = &or1ksim_uart_fns,
+ .deviceProbe = NULL,
+ .pDeviceFlow = NULL,
+ .ulCtrlPort1 = OR1KSIM_BSP_UART_BASE,
+ .ulCtrlPort2 = 0,
+ .ulClock = OR1KSIM_UART_DEFAULT_BAUD,
+ .ulIntVector = OR1KSIM_BSP_UART_IRQ
+ }
+};
+
+#define PORT_COUNT \
+ (sizeof(Console_Configuration_Ports) \
+ / sizeof(Console_Configuration_Ports [0]))
+
+unsigned long Console_Configuration_Count = PORT_COUNT;
+
+static void output_char(char c)
+{
+ const console_fns *con =
+ Console_Configuration_Ports [Console_Port_Minor].pDeviceFns;
+
+ if (c == '\n') {
+ con->deviceWritePolled((int) Console_Port_Minor, '\r');
+ }
+ con->deviceWritePolled((int) Console_Port_Minor, c);
+}
+
+BSP_output_char_function_type BSP_output_char = output_char;
+
+BSP_polling_getchar_function_type BSP_poll_char = NULL;