summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/sh
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@oarcorp.com>2014-10-08 16:04:56 -0500
committerJoel Sherrill <joel.sherrill@oarcorp.com>2014-10-10 10:17:09 -0500
commit62791499ebf0a6161e1541eb7587c57d88407f8b (patch)
treefaaa9f51fdd6d13727c237ddc44e87a9cdd60df4 /c/src/lib/libbsp/sh
parentMove Mongoose-V specific devices into BSP. (diff)
downloadrtems-62791499ebf0a6161e1541eb7587c57d88407f8b.tar.bz2
Add console-polled.h and update all BSPs that should use it.
The file console-polled.h provides the prototypes for the three required methods when implementing a single port polled console driver. This paradigm is common on simulators and simple hardware. + Updated the BSPs Makefile.am to make console-polled.h available. + Regenerated the BSPs preinstall.sm. + Updated console support files to include <bsp/console-polled.h>. + Updated console support files to make printk() support method static.
Diffstat (limited to '')
-rw-r--r--c/src/lib/libbsp/sh/shsim/Makefile.am1
-rw-r--r--c/src/lib/libbsp/sh/shsim/console/console-io.c7
-rw-r--r--c/src/lib/libbsp/sh/shsim/preinstall.am4
-rw-r--r--c/src/lib/libbsp/shared/console-polled.c13
-rw-r--r--c/src/lib/libbsp/shared/include/console-polled.h43
5 files changed, 60 insertions, 8 deletions
diff --git a/c/src/lib/libbsp/sh/shsim/Makefile.am b/c/src/lib/libbsp/sh/shsim/Makefile.am
index eb0d4790fc..637bf686c6 100644
--- a/c/src/lib/libbsp/sh/shsim/Makefile.am
+++ b/c/src/lib/libbsp/sh/shsim/Makefile.am
@@ -12,6 +12,7 @@ include_HEADERS += ../../shared/include/tm27.h
nodist_include_HEADERS = include/bspopts.h
nodist_include_bsp_HEADERS = ../../shared/include/bootcard.h
+nodist_include_bsp_HEADERS += ../../shared/include/console-polled.h
DISTCLEANFILES = include/bspopts.h
nodist_include_HEADERS += ../../shared/include/coverhd.h
diff --git a/c/src/lib/libbsp/sh/shsim/console/console-io.c b/c/src/lib/libbsp/sh/shsim/console/console-io.c
index b327192d5d..7f5794e784 100644
--- a/c/src/lib/libbsp/sh/shsim/console/console-io.c
+++ b/c/src/lib/libbsp/sh/shsim/console/console-io.c
@@ -1,9 +1,9 @@
/*
* This file contains the hardware specific portions of the TTY driver
* for the simulators stdin/out.
- *
- * Logic based on newlib-1.8.2/newlib/libc/sys/sh/syscalls.c
- *
+ */
+
+/*
* COPYRIGHT (c) 1989-2011.
* On-Line Applications Research Corporation (OAR).
*
@@ -13,6 +13,7 @@
*/
#include <bsp.h>
+#include <bsp/console-polled.h>
#include <rtems/libio.h>
#include <stdlib.h>
#include <assert.h>
diff --git a/c/src/lib/libbsp/sh/shsim/preinstall.am b/c/src/lib/libbsp/sh/shsim/preinstall.am
index fa84c38c5e..7ada971a84 100644
--- a/c/src/lib/libbsp/sh/shsim/preinstall.am
+++ b/c/src/lib/libbsp/sh/shsim/preinstall.am
@@ -57,6 +57,10 @@ $(PROJECT_INCLUDE)/bsp/bootcard.h: ../../shared/include/bootcard.h $(PROJECT_INC
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/bootcard.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/bootcard.h
+$(PROJECT_INCLUDE)/bsp/console-polled.h: ../../shared/include/console-polled.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/console-polled.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/console-polled.h
+
$(PROJECT_INCLUDE)/coverhd.h: ../../shared/include/coverhd.h $(PROJECT_INCLUDE)/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/coverhd.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/coverhd.h
diff --git a/c/src/lib/libbsp/shared/console-polled.c b/c/src/lib/libbsp/shared/console-polled.c
index 6ae758711b..22a654f82f 100644
--- a/c/src/lib/libbsp/shared/console-polled.c
+++ b/c/src/lib/libbsp/shared/console-polled.c
@@ -2,7 +2,9 @@
* This file contains the hardware independent portion of a polled
* console device driver. If a BSP chooses to use this, then it
* only has to provide a few board dependent routines.
- *
+ */
+
+/*
* COPYRIGHT (c) 1989-1997.
* On-Line Applications Research Corporation (OAR).
*
@@ -16,10 +18,11 @@
#include <stdlib.h>
#include <assert.h>
-/* external prototypes for monitor interface routines */
-void console_outbyte_polled(int port, char ch);
-int console_inbyte_nonblocking(int port);
-void console_initialize_hardware(void);
+#include <bsp/console-polled.h>
+
+/*
+ * Prototypes
+ */
ssize_t console_write_support(int, const char *, size_t);
/*
diff --git a/c/src/lib/libbsp/shared/include/console-polled.h b/c/src/lib/libbsp/shared/include/console-polled.h
new file mode 100644
index 0000000000..09a99c30cb
--- /dev/null
+++ b/c/src/lib/libbsp/shared/include/console-polled.h
@@ -0,0 +1,43 @@
+/**
+ * @file
+ *
+ * @ingroup Console
+ *
+ * This file defines the interfaces between the single port
+ * polled console framework and the BSP.
+ */
+
+/*
+ * 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.
+ */
+
+#ifndef __BSP_CONSOLE_POLLED_h
+#define __BSP_CONSOLE_POLLED_h
+
+/**
+ * This method polls the specified character @a ch to the specified
+ * console @a port.
+ *
+ * @param[in] port is the output port
+ * @param[in] ch is the character to print
+ */
+void console_outbyte_polled(int port, char ch);
+
+/**
+ * This method polls the specified @a port for an input character.
+ * console @a port.
+ *
+ * @param[in] port is the input port
+ *
+ * @return This method returns the character read of -1 if there is no data.
+ */
+int console_inbyte_nonblocking(int port);
+
+/**
+ * This method is invoked to initialize the console hardware device(s).
+ */
+void console_initialize_hardware(void);
+
+#endif