summaryrefslogtreecommitdiffstats
path: root/c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1999-05-27 16:08:40 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1999-05-27 16:08:40 +0000
commit1d1b1507a6cc49166ab60b2e0963aa5f077bb1b0 (patch)
tree5e9d810e75cf6b30515efd848de3b2029c5da341 /c
parentDisabled running size_rtems until all file splitting is finished. (diff)
downloadrtems-1d1b1507a6cc49166ab60b2e0963aa5f077bb1b0.tar.bz2
Split out polled io, debug puts, and console reserve resources to
reduce dependencies and shrink minimum executable size.
Diffstat (limited to 'c')
-rw-r--r--c/src/lib/libbsp/sparc/erc32/console/Makefile.in2
-rw-r--r--c/src/lib/libbsp/sparc/erc32/console/console.c86
-rw-r--r--c/src/lib/libbsp/sparc/erc32/console/consolereserveresources.c27
-rw-r--r--c/src/lib/libbsp/sparc/erc32/console/debugputs.c114
4 files changed, 146 insertions, 83 deletions
diff --git a/c/src/lib/libbsp/sparc/erc32/console/Makefile.in b/c/src/lib/libbsp/sparc/erc32/console/Makefile.in
index fdb9d44abf..44e9ca15fd 100644
--- a/c/src/lib/libbsp/sparc/erc32/console/Makefile.in
+++ b/c/src/lib/libbsp/sparc/erc32/console/Makefile.in
@@ -18,7 +18,7 @@ VPATH = @srcdir@
PGM=${ARCH}/console.rel
# C source names, if any, go here -- minus the .c
-C_PIECES=console
+C_PIECES=console consolereserveresources debugputs
C_FILES=$(C_PIECES:%=%.c)
C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
diff --git a/c/src/lib/libbsp/sparc/erc32/console/console.c b/c/src/lib/libbsp/sparc/erc32/console/console.c
index 296df3092f..cc19262da6 100644
--- a/c/src/lib/libbsp/sparc/erc32/console/console.c
+++ b/c/src/lib/libbsp/sparc/erc32/console/console.c
@@ -45,17 +45,9 @@
void console_outbyte_polled(
int port,
char ch
-)
-{
- if ( port == 0 ) {
- while ( (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_THEA) == 0 );
- ERC32_MEC.UART_Channel_A = (int) ch;
- return;
- }
+);
- while ( (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_THEB) == 0 );
- ERC32_MEC.UART_Channel_B = (int) ch;
-}
+/* body is in debugputs.c */
/*
* console_inbyte_nonblocking
@@ -63,41 +55,9 @@ void console_outbyte_polled(
* This routine polls for a character.
*/
-int console_inbyte_nonblocking( int port )
-{
- int UStat;
-
- UStat = ERC32_MEC.UART_Status;
-
- switch (port) {
+int console_inbyte_nonblocking( int port );
- case 0:
- if (UStat & ERC32_MEC_UART_STATUS_ERRA) {
- ERC32_MEC.UART_Status = ERC32_MEC_UART_STATUS_CLRA;
- ERC32_MEC.Control = ERC32_MEC.Control;
- }
-
- if ((UStat & ERC32_MEC_UART_STATUS_DRA) == 0)
- return -1;
- return (int) ERC32_MEC.UART_Channel_A;
- return 1;
-
- case 1:
- if (UStat & ERC32_MEC_UART_STATUS_ERRB) {
- ERC32_MEC.UART_Status = ERC32_MEC_UART_STATUS_CLRB;
- ERC32_MEC.Control = ERC32_MEC.Control;
- }
-
- if ((UStat & ERC32_MEC_UART_STATUS_DRB) == 0)
- return -1;
- return (int) ERC32_MEC.UART_Channel_B;
-
- default:
- assert( 0 );
- }
-
- return -1;
-}
+/* body is in debugputs.c */
/*
* Interrupt driven console IO
@@ -318,37 +278,6 @@ void console_outbyte_interrupt(
#endif /* CONSOLE_USE_INTERRUPTS */
/*
- * DEBUG_puts
- *
- * This should be safe in the event of an error. It attempts to insure
- * that no TX empty interrupts occur while it is doing polled IO. Then
- * it restores the state of that external interrupt.
- *
- * Input parameters:
- * string - pointer to debug output string
- *
- * Output parameters: NONE
- *
- * Return values: NONE
- */
-
-void DEBUG_puts(
- char *string
-)
-{
- char *s;
- unsigned32 old_level;
-
- ERC32_Disable_interrupt( ERC32_INTERRUPT_UART_A_RX_TX, old_level );
- for ( s = string ; *s ; s++ )
- console_outbyte_polled( 0, *s );
-
- console_outbyte_polled( 0, '\r' );
- console_outbyte_polled( 0, '\n' );
- ERC32_Restore_interrupt( ERC32_INTERRUPT_UART_A_RX_TX, old_level );
-}
-
-/*
* Console Termios Support Entry Points
*
*/
@@ -368,13 +297,6 @@ int console_write_support (int minor, const char *buf, int len)
return nwrite;
}
-void console_reserve_resources(
- rtems_configuration_table *configuration
-)
-{
- rtems_termios_reserve_resources( configuration, 2 );
-}
-
/*
* Console Device Driver Entry Points
*
diff --git a/c/src/lib/libbsp/sparc/erc32/console/consolereserveresources.c b/c/src/lib/libbsp/sparc/erc32/console/consolereserveresources.c
new file mode 100644
index 0000000000..6452142c07
--- /dev/null
+++ b/c/src/lib/libbsp/sparc/erc32/console/consolereserveresources.c
@@ -0,0 +1,27 @@
+/*
+ * This file contains the TTY driver for the serial ports on the erc32.
+ *
+ * This driver uses the termios pseudo driver.
+ *
+ * COPYRIGHT (c) 1989-1998.
+ * On-Line Applications Research Corporation (OAR).
+ * Copyright assigned to U.S. Government, 1994.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.OARcorp.com/rtems/license.html.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+#include <rtems/libio.h>
+#include <stdlib.h>
+#include <assert.h>
+
+void console_reserve_resources(
+ rtems_configuration_table *configuration
+)
+{
+ rtems_termios_reserve_resources( configuration, 2 );
+}
diff --git a/c/src/lib/libbsp/sparc/erc32/console/debugputs.c b/c/src/lib/libbsp/sparc/erc32/console/debugputs.c
new file mode 100644
index 0000000000..35917747d1
--- /dev/null
+++ b/c/src/lib/libbsp/sparc/erc32/console/debugputs.c
@@ -0,0 +1,114 @@
+/*
+ * This file contains the TTY driver for the serial ports on the erc32.
+ *
+ * This driver uses the termios pseudo driver.
+ *
+ * COPYRIGHT (c) 1989-1998.
+ * On-Line Applications Research Corporation (OAR).
+ * Copyright assigned to U.S. Government, 1994.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.OARcorp.com/rtems/license.html.
+ *
+ * $Id$
+ */
+
+#include <bsp.h>
+#include <rtems/libio.h>
+#include <stdlib.h>
+#include <assert.h>
+
+/*
+ * console_outbyte_polled
+ *
+ * This routine transmits a character using polling.
+ */
+
+void console_outbyte_polled(
+ int port,
+ char ch
+)
+{
+ if ( port == 0 ) {
+ while ( (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_THEA) == 0 );
+ ERC32_MEC.UART_Channel_A = (int) ch;
+ return;
+ }
+
+ while ( (ERC32_MEC.UART_Status & ERC32_MEC_UART_STATUS_THEB) == 0 );
+ ERC32_MEC.UART_Channel_B = (int) ch;
+}
+
+/*
+ * console_inbyte_nonblocking
+ *
+ * This routine polls for a character.
+ */
+
+int console_inbyte_nonblocking( int port )
+{
+ int UStat;
+
+ UStat = ERC32_MEC.UART_Status;
+
+ switch (port) {
+
+ case 0:
+ if (UStat & ERC32_MEC_UART_STATUS_ERRA) {
+ ERC32_MEC.UART_Status = ERC32_MEC_UART_STATUS_CLRA;
+ ERC32_MEC.Control = ERC32_MEC.Control;
+ }
+
+ if ((UStat & ERC32_MEC_UART_STATUS_DRA) == 0)
+ return -1;
+ return (int) ERC32_MEC.UART_Channel_A;
+ return 1;
+
+ case 1:
+ if (UStat & ERC32_MEC_UART_STATUS_ERRB) {
+ ERC32_MEC.UART_Status = ERC32_MEC_UART_STATUS_CLRB;
+ ERC32_MEC.Control = ERC32_MEC.Control;
+ }
+
+ if ((UStat & ERC32_MEC_UART_STATUS_DRB) == 0)
+ return -1;
+ return (int) ERC32_MEC.UART_Channel_B;
+
+ default:
+ assert( 0 );
+ }
+
+ return -1;
+}
+
+/*
+ * DEBUG_puts
+ *
+ * This should be safe in the event of an error. It attempts to insure
+ * that no TX empty interrupts occur while it is doing polled IO. Then
+ * it restores the state of that external interrupt.
+ *
+ * Input parameters:
+ * string - pointer to debug output string
+ *
+ * Output parameters: NONE
+ *
+ * Return values: NONE
+ */
+
+void DEBUG_puts(
+ char *string
+)
+{
+ char *s;
+ unsigned32 old_level;
+
+ ERC32_Disable_interrupt( ERC32_INTERRUPT_UART_A_RX_TX, old_level );
+ for ( s = string ; *s ; s++ )
+ console_outbyte_polled( 0, *s );
+
+ console_outbyte_polled( 0, '\r' );
+ console_outbyte_polled( 0, '\n' );
+ ERC32_Restore_interrupt( ERC32_INTERRUPT_UART_A_RX_TX, old_level );
+}