summaryrefslogtreecommitdiffstats
path: root/c
diff options
context:
space:
mode:
Diffstat (limited to 'c')
-rw-r--r--c/src/lib/libbsp/powerpc/mbx8xx/ChangeLog11
-rw-r--r--c/src/lib/libbsp/powerpc/mbx8xx/README148
-rw-r--r--c/src/lib/libbsp/powerpc/mbx8xx/console/console.c307
-rw-r--r--c/src/lib/libbsp/powerpc/mbx8xx/include/bsp.h8
-rw-r--r--c/src/lib/libbsp/powerpc/mbx8xx/network/network.c2
5 files changed, 355 insertions, 121 deletions
diff --git a/c/src/lib/libbsp/powerpc/mbx8xx/ChangeLog b/c/src/lib/libbsp/powerpc/mbx8xx/ChangeLog
index 101734ce64..a8b09a6a6a 100644
--- a/c/src/lib/libbsp/powerpc/mbx8xx/ChangeLog
+++ b/c/src/lib/libbsp/powerpc/mbx8xx/ChangeLog
@@ -1,3 +1,14 @@
+2000-08-10 Charles-Antoine Gauthier <charles.gauthier@nrc.ca>
+
+ * README: Updated.
+ * console/console.c: Addition of support for shared printk and
+ no termios.
+ * include/bsp.h: Addition of second parameter to
+ rtems_enet_driver_attach. Removed prototypes for printk and
+ BSP_output_string.
+ * network/network.c(rtems_enet_driver_attach): Addition of second
+ parameter to function.
+
2000-08-10 Joel Sherrill <joel@OARcorp.com>
* ChangeLog: New file.
diff --git a/c/src/lib/libbsp/powerpc/mbx8xx/README b/c/src/lib/libbsp/powerpc/mbx8xx/README
index 7a1c9fe5b2..58e1690075 100644
--- a/c/src/lib/libbsp/powerpc/mbx8xx/README
+++ b/c/src/lib/libbsp/powerpc/mbx8xx/README
@@ -126,8 +126,8 @@ Board description
-----------------
Clock rate: 50MHz Entry level boards, 40 MHz others.
Bus width: 8/32 bit Flash, 32 bit DRAM
-FLASH: 2-4MB, 120ns
-RAM: 4-16MB EDO, 60ns DRAM DIMM
+FLASH: 2-4MB, 120ns
+RAM: 4-16MB EDO, 60ns DRAM DIMM
Installation
@@ -146,10 +146,10 @@ will build for a MBX860-002. Look at rtems/make/custom/mbx8xx.cfg for the
specific list of boards supported and their corresponding names. An
example build command is:
- make RTEMS_BSP=mbx821_001 all debug
+ make RTEMS_BSP=mbx821_001 VARIANT=DEBUG
-This will build the optimized and debug versions of all RTEMS libraries,
-samples and tests (if the latter are enabled).
+This will build the debug version of all RTEMS libraries, samples and tests
+(if the latter are enabled).
The Software Engineering Group of the Institute for Information Technology
only owns an MBX821-001 and MBX86-002. The only provided config files are
@@ -157,7 +157,7 @@ mbx821_001.cfg and mbx860_002.cfg. A SPECIFIC CONFIG FILE IS REQUIRED. Use
one of the provided files as a template to create a specific config file for
another model.
-We rely on EPPC-BUG to download to the targets. We use the 'PLH" command.
+We rely on EPPC-BUG to download to the targets. We use the "PLH" command.
We enabled a TFTP deamon on our development host.
@@ -165,38 +165,108 @@ Port Description
Console driver
---------------
-This BSP includes an termios-capable console driver that supports SMC1,
-SMC2, SCC2, and SCC3 and SCC4 if present. The RTEMS console is selected
-in rtems/make/custom/mbx8xx.cfg with the CONSOLE_MINOR variable. We
-normally run with the RTEMS application console on SMC1.
+This BSP includes an termios-capable asynchronous serial line driver
+that supports SMC1, SMC2, SCC2, and SCC3 and SCC4 if present. The RTEMS
+console is selected in rtems/make/custom/mbx8xx.cfg with the
+CONSOLE_MINOR variable. We normally run with the RTEMS application
+console on SMC2. SMC1 is used by the debugger.
+
+Support is provided for five different modes of operation:
+
+ 1. polled I/O done by EPPC-Bug with termios support,
+ 2. polled I/O done by EPPC-Bug without termios support,
+ 3. polled I/O done by the supplied device driver with termios support,
+ 4. polled I/O done by the supplied device driver without termios support,
+ 5. interrupt-driven I/O done by the supplied device driver with termios
+ support.
+
+The mode of operation of the serial driver is determined at build time
+by the value of the UARTS_IO_MODE constant in rtems/make/custom/mbx8xx.cfg.
+Edit the file to select the type of I/O desired before building RTEMS.
+The choices are:
+
+ 0 - polled I/O done by the supplied device driver,
+ 1 - interrupt-driven I/O done by the supplied device driver,
+ 2 - polled I/O done by EPPC-Bug.
+
+Also set the value of UARTS_USE_TERMIOS to select whether termios should
+be used to perform buffering and input/output processing. Without termios
+support, input processing is limited to the substitution of LF for a
+received CR, and output processing is limited to the transmission of a
+CR following the transmission of a LF. The choices for UARTS_USE_TERMIOS are:
+
+ 0 - do not use termios
+ 1 - use termios
-Support is provided for polled and interrupt-driven terminal I/O. Interrupt-
-driven I/O is selected by setting the UARTS_USE_INTERRUPTS variable in
-rtems/make/custom/mbx8xx.cfg. If the variable is not set, or if it is set
-to zero, polled I/O is used. If the EPPCBUG_SMC1 variable is set in
-rtems/make/custom/mbx8xx.cfg, SMC1 will be used in polled mode with all
-I/O done by EPPC-Bug rather than the supplied device driver. This mode
-should be used if the application console is shared with EPPC-Bug.
+In most real-time applications, the driver should be configured to use
+termios and interrupt-driven I/O. Special requirements may dictate otherwise.
Polled I/O must be used when running the timing tests. It must also be used
-to run some other tests and some samples, such as the cdtest. Applications
-would normally use interrupt-driven I/O.
+to run some other tests and some samples, such as the cdtest. Some tests
+change the interrupt mask and will hang interrupt-driven I/O indefinitely.
+Others, such as cdtest, perform console output from the static constructors
+before the console is opened, causing the test to hang. Still other tests
+produce output that is supposed to be in some specific order. For these
+tests, termios should not be used, as termios buffers output and the
+transmission of the buffers occur at somewhat unpredictable times.
+
+The real solution is to fix the tests so that they work with interrupt-driven
+I/O and termios.
+
+
+printk() and debug output
+-----------------------
+
+The implementation of printk() in RTEMS is mostly independent of most system
+services. The printk() function can therefore be used to print messages to a
+debug console, particularly when debugging startup code or device drivers,
+i.e. code that runs before the console driver is opened or that runs with
+interrupts disabled.
+
+Support is provided to send printk output to any port. Specify the desired
+port at build time in rtems/make/custom/mbx8xx.cfg by setting the value
+of PRINTK_MINOR to one of SMC1_MINOR, SMC2_MINOR, SCC2_MINOR, SCC3_MINOR,
+or SCC4_MINOR.
+
+Select the type of output desired for printk() by setting the value of
+PRINTK_IO_MODE in rtems/make/custom/mbx8xx.cfg. The choices are:
+
+ 0 - polled I/O done by the supplied device driver,
+ 1 - interrupt-driven I/O done by the supplied device driver,
+ 2 - polled I/O done by EPPC-Bug.
+
+printk() does not use termios.
+
+If the printk() port is opened by RTEMS, then PRINK_IO_MODE mode must have
+the same value as UARTS_IO_MODE, otherwise the I/O functions will be in
+conflict. Interrupt-driven printk() output is only possible if the port is
+opened before hand by an RTEMS application, and is of dubious value...
EPPC-Bug and I/O
----------------
+IMPORTANT: When using EPPC-Bug 1.1 for polled I/O, only the SMC1 port is
+usable. This is a deficiency of the firmware which may be fixed in later
+revision. When using this monitor with UARTS_IO_MODE set to 2, CONSOLE_MINOR
+must be set to SMC1_MINOR. Similarly, if PRINTK_IO_MODE set to 2,
+PRINTK_MINOR must be set to SMC1_MINOR. When UARTS_IO_MODE is set to 2,
+only SMC1 is usable.
+
Be warned that when EPPC-Bug does I/O through a serial port, all interrupts
get turned off in the SIMASK register! This is a definite bug in release 1.1
-of the firmware. It may have been fixed in later releases.
+of the firmware. It may have been fixed in later releases. EPPB-Bug does
+I/O through its debug port whenever it is given control, e.g. after a
+breakpoint is hit, not just when it is used to perform polled I/O on behalf
+of RTEMS applications. In particular, in our configuration, we have gdb
+communication with EPPC-Bug through SMC1.
-To solve this problem that occurs when GDB communicates with EPPC-Bug,
-whenever the BSP manipulates the SIMASK, it makes copy of the written
-in a global variable called 'simask_copy'. That value must be restored by
-GDB before execution resumes. The following commands placed in the .gdbinit
-file takes care of this:
+To solve this problem, whenever the BSP manipulates the SIMASK, it makes a
+copy of the written value in a global variable called 'simask_copy'. That
+value must be restored by GDB before execution resumes. The following commands
+placed in the .gdbinit file takes care of this:
-# GDB Initialization file for EPPCBug.
+# GDB Initialization file for EPPC-Bug.
define hook-stepi
set language c
@@ -234,6 +304,12 @@ set *(int *)0xFA200014=simask_copy
set language auto
end
+IMPORTANT: When using EPPC-Bug on SMC1, either for debugging or for polled I/O,
+EPPCBUG_SMC1 must be defined in rtems/make/custom/mbx8xx.cfg. Defining this
+constant prevents the device driver from re-initializing SMC1. It also causes
+the network driver, the clock driver, and the asynchronous serial line driver
+to maintain simask_copy for use by gdb.
+
Floating-point
--------------
@@ -252,12 +328,11 @@ All development was based on the eth_comm port.
Host System
-----------
-12345678901234567890123456789012345678901234567890123456789012345678901234567890
The port was developed on Pentiums II and III running RedHat Linux 6.0 and
6.1. The following tools were used:
- - GNU gcc snapshot dated 19991208 configured for powerpc-rtems;
- - GNU binutils 2.9.1 configured for powerpc-rtems;
+ - GNU gcc snapshot dated 20000214 configured for powerpc-rtems;
+ - GNU binutils 2.10 configured for powerpc-rtems;
Gcc 2.95.2 also worked. Gcc 2.95.1 will not compile the console driver with
-O4 or -O3. Compile it manually with -O2.
@@ -299,11 +374,6 @@ blown. This is one case were overwritting the first or last 16 bytes of the
stack does cause problems (but hey, an exception occurred, which is better
than propagating the error).
-In the stackchk test, an access fault exception is raised after the stack is
-blown. This is one case were overwritting the first or last 16 bytes of the
-stack does cause problems (but hey, an exception occurred, which is better
-than propagating the error).
-
When using interrupt-driven I/O, psx08 produces all the expected output, but
it does not return control to 167Bug. Is this test supposed to work with
interrupt-driven console I/O?
@@ -346,10 +416,6 @@ Test Results
------------
Single processor tests: All tests passed, except the following ones:
-
- - paranoia required the FPSP and the default variants of libm (and libc and
- libgcc) for us. It may work with the msoft-float variants for you, but it
- does require the FPSP.
- cpuuse and malloctest did not work.
@@ -357,16 +423,16 @@ Single processor tests: All tests passed, except the following ones:
checker had had a chance to detect the corrupted stack.
-Multi-processort tests: not applicable -- No MPCI layer yet.
+Multi-processort tests: not applicable.
Timing tests:
- See the times-mbx821 and times-860 files for the results of the
+ See the times-mbx821 and times-mbx860 files for the results of the
timing tests.
Network tests:
- Network driver is being implemented.
+ Worked.
diff --git a/c/src/lib/libbsp/powerpc/mbx8xx/console/console.c b/c/src/lib/libbsp/powerpc/mbx8xx/console/console.c
index c152d17321..5e581b94cd 100644
--- a/c/src/lib/libbsp/powerpc/mbx8xx/console/console.c
+++ b/c/src/lib/libbsp/powerpc/mbx8xx/console/console.c
@@ -14,21 +14,51 @@
* SCC3 /dev/tty3 4
* SCC4 /dev/tty4 5
*
- * All ports support termios. All I/O is interrupt-driven, unless EPPCBug
- * is used to do the I/O. To use EPPCBug, define the EPPCBUG_SMC1
- * manifest constant in the configuration file (mbx8xx.cfg). EPPCBug I/O
- * is currently limited to the EPPCBug debug console. This is a limitation
- * of firmware revision 1.1. Later firmware should be able to do I/O
- * through any port.This code assumes that the EPPCBug console is the
- * default: SMC1.
+ * All ports support termios. The use of termios is recommended for real-time
+ * applications. Termios provides buffering and input processing. When not
+ * using termios, processing is limited to the substitution of LF for CR on
+ * input, and the output of a CR following the output of a LF character.
+ * Note that the terminal should not send CR/LF pairs when the return key
+ * is pressed, and that output lines are terminated with LF/CR, not CR/LF
+ * (although that would be easy to change).
+ *
+ * I/O may be interrupt-driven (recommended for real-time applications) or
+ * polled. Polled I/O may be performed by this device driver entirely, or
+ * in part by EPPCBug. With EPPCBug 1.1, polled I/O is limited to the
+ * EPPCBug debug console. This is a limitation of the firmware. Later
+ * firmware may be able to do I/O through any port. This code assumes
+ * that the EPPCBug console is the default: SMC1. If the console and
+ * printk ports are set to anything else with EPPCBug polled I/O, the
+ * system will hang. Only port SMC1 is usable with EPPCBug polled I/O.
+ *
+ * LIMITATIONS:
+ *
+ * It is not possible to use different I/O modes on the different ports. The
+ * exception is with printk. The printk port can use a different mode from
+ * the other ports. If this is done, it is important not to open the printk
+ * port from an RTEMS application.
+ *
+ * Currently, the I/O modes are determined at build time. It would be much
+ * better to have the mode selected at boot time based on parameters in
+ * NVRAM.
+ *
+ * Interrupt-driven I/O requires termios.
+ *
+ * TESTS:
*
- * TO RUN THE TESTS, USE POLLED I/O THROUGH EPPCBUG. Some tests play with
- * the interrupt masks and turn off I/O. Those tests will hang with when
- * interrupt-driven I/O is used.
+ * TO RUN THE TESTS, USE POLLED I/O WITHOUT TERMIOS SUPPORT. Some tests
+ * play with the interrupt masks and turn off I/O. Those tests will hang
+ * when interrupt-driven I/O is used. Other tests, such as cdtest, do I/O
+ * from the static constructors before the console is open. This test
+ * will not work with interrupt-driven I/O. Because of the buffering
+ * performed in termios, test output may not be in sequence.The tests
+ * should all be fixed to work with interrupt-driven I/O and to
+ * produce output in the expected sequence. Obviously, the termios test
+ * requires termios support in the driver.
*
* Set CONSOLE_MINOR to the appropriate device minor number in the
* config file. This allows the RTEMS application console to be different
- * from the EPPBug debug console or the GDB stup I/O port.
+ * from the EPPBug debug console or the GDB port.
*
* This driver handles all five available serial ports: it distinguishes
* the sub-devices using minor device numbers. It is not possible to have
@@ -41,17 +71,31 @@
*
* Modifications by Darlene Stewart <Darlene.Stewart@iit.nrc.ca>
* and Charles-Antoine Gauthier <charles.gauthier@iit.nrc.ca>.
- * Copyright (c) 1999, National Research Council of Canada
+ * Copyright (c) 2000, National Research Council of Canada
*
*/
#include <stdarg.h>
#include <stdio.h>
#include <bsp.h> /* Must be before libio.h */
+#include <bspIo.h>
#include <rtems/libio.h>
#include <termios.h>
+#if UARTS_IO_MODE == 0
+#define BSP_WRITE m8xx_uart_pollWrite
+#define BSP_READ m8xx_uart_pollRead
+#elif UARTS_IO_MODE == 1
+#define BSP_WRITE m8xx_uart_write
+#elif UARTS_IO_MODE == 2
+#define BSP_WRITE _EPPCBug_pollWrite
+#define BSP_READ _EPPCBug_pollRead
+#endif
+
static int _EPPCBug_pollRead( int minor );
static int _EPPCBug_pollWrite( int minor, const char *buf, int len );
+static void _BSP_output_char( char c );
+
+BSP_output_char_function_type BSP_output_char = _BSP_output_char;
/*
@@ -104,10 +148,31 @@ int _EPPCBug_pollRead(
retval = -1;
- /* Input through EPPCBug console */
input_params.clun = 0;
input_params.dlun = 0;
- input_params.reserved = 0;
+
+ switch( minor ) {
+ case SMC1_MINOR:
+ input_params.dlun = 0; /* Should be 4, but doesn't work with EPPCBug 1.1 */
+ break;
+ case SMC2_MINOR:
+ input_params.dlun = 5;
+ break;
+ case SCC2_MINOR:
+ input_params.dlun = 1;
+ break;
+#ifdef mpc860
+ case SCC3_MINOR:
+ input_params.dlun = 2;
+ break;
+ case SCC4_MINOR:
+ input_params.dlun = 3;
+ break;
+#endif
+ default:
+ input_params.dlun = 0;
+ break;
+ }
_ISR_Disable( level );
simask = m8xx.simask;
@@ -193,10 +258,31 @@ int _EPPCBug_pollWrite(
retval = -1;
- /* Output through EPPCBug console */
input_params.clun = 0;
- input_params.dlun = 0;
input_params.reserved = 0;
+
+ switch( minor ) {
+ case SMC1_MINOR:
+ input_params.dlun = 0; /* Should be 4, but doesn't work with EPPCBug 1.1 */
+ break;
+ case SMC2_MINOR:
+ input_params.dlun = 5;
+ break;
+ case SCC2_MINOR:
+ input_params.dlun = 1;
+ break;
+#ifdef mpc860
+ case SCC3_MINOR:
+ input_params.dlun = 2;
+ break;
+ case SCC4_MINOR:
+ input_params.dlun = 3;
+ break;
+#endif
+ default:
+ input_params.dlun = 0;
+ break;
+ }
i = 0;
@@ -224,7 +310,7 @@ int _EPPCBug_pollWrite(
asm volatile( "li 10,0x201 /* Code for .CIO_WRITE */
mr 3, %0 /* Address of input_params */
mr 4, %1 /* Address of output_params */
- sc" /* Call EPPCBUG */
+ sc" /* Call EPPCBUG */
:: "g" (&input_params), "g" (&output_params) : "3", "4", "10" );
if (output_params.status)
@@ -246,37 +332,16 @@ error:
/*
- * Print functions: prototyped in bsp.h
- * Debug printing on Channel 1
+ * Print functions prototyped in bspIo.h
*/
-
-void printk( char *fmt, ... )
-{
- va_list ap; /* points to each unnamed argument in turn */
- static char buf[256];
- unsigned int level;
-
- _CPU_ISR_Disable(level);
-
- va_start(ap, fmt); /* make ap point to 1st unnamed arg */
- vsprintf(buf, fmt, ap); /* send output to buffer */
-
- BSP_output_string(buf); /* print buffer -- Channel 1 */
-
- va_end(ap); /* clean up and re-enable interrupts */
- _CPU_ISR_Enable(level);
-}
-
-void BSP_output_string( char * buf )
+void _BSP_output_char( char c )
{
- int len = strlen(buf);
- int minor; /* will be ignored */
- rtems_status_code sc;
-
- sc = _EPPCBug_pollWrite(minor, buf, len);
- if (sc != RTEMS_SUCCESSFUL)
- rtems_fatal_error_occurred (sc);
+ char cr = '\r';
+
+ BSP_WRITE( PRINTK_MINOR, &c, 1 );
+ if( c == '\n' )
+ BSP_WRITE( PRINTK_MINOR, &cr, 1 );
}
@@ -302,8 +367,9 @@ rtems_device_driver console_initialize(
/*
* Set up TERMIOS
*/
+#if UARTS_USE_TERMIOS == 1
rtems_termios_initialize();
-
+#endif
/*
* Do common initialization.
*/
@@ -312,16 +378,28 @@ rtems_device_driver console_initialize(
/*
* Do device-specific initialization
*/
-#ifndef EPPCBUG_SMC1
+#if !defined(EPPCBUG_SMC1) && ( PRINTK_IO_MODE != 2 || PRINTK_MINOR != SMC1_MINOR )
m8xx_uart_smc_initialize(SMC1_MINOR); /* /dev/tty0 */
-#endif /* EPPCBUG_SMC1 */
+#endif
+#if PRINTK_IO_MODE != 2 || PRINTK_MINOR != SMC2_MINOR
m8xx_uart_smc_initialize(SMC2_MINOR); /* /dev/tty1 */
+#endif
+
+ #if PRINTK_IO_MODE != 2 || PRINTK_MINOR != SCC2_MINOR
m8xx_uart_scc_initialize(SCC2_MINOR); /* /dev/tty2 */
-
+ #endif
+
#ifdef mpc860
+
+#if PRINTK_IO_MODE != 2 || PRINTK_MINOR != SCC3_MINOR
m8xx_uart_scc_initialize(SCC3_MINOR); /* /dev/tty3 */
+#endif
+
+#if PRINTK_IO_MODE != 2 || PRINTK_MINOR != SCC4_MINOR
m8xx_uart_scc_initialize(SCC4_MINOR); /* /dev/tty4 */
+#endif
+
#endif /* mpc860 */
/*
@@ -371,13 +449,14 @@ rtems_device_driver console_open(
)
{
/* Used to track termios private data for callbacks */
+#if UARTS_IO_MODE == 1
extern struct rtems_termios_tty *ttyp[];
+ rtems_libio_open_close_args_t *args = arg;
+#endif
- volatile m8xxSCCRegisters_t *sccregs;
rtems_status_code sc;
- rtems_libio_open_close_args_t *args = arg;
-
-#ifdef EPPCBUG_SMC1
+
+#if UARTS_USE_TERMIOS == 1
static const rtems_termios_callbacks sccEPPCBugCallbacks = {
NULL, /* firstOpen */
NULL, /* lastClose */
@@ -386,47 +465,55 @@ rtems_device_driver console_open(
NULL, /* stopRemoteTx */
NULL, /* startRemoteTx */
0 /* outputUsesInterrupts */
- };
-#endif
-
-#ifdef UARTS_USE_INTERRUPTS
+ };
static const rtems_termios_callbacks intrCallbacks = {
NULL, /* firstOpen */
NULL, /* lastClose */
- NULL, /* pollRead */
- m8xx_uart_write, /* write */
+ NULL, /* pollRead */
+ m8xx_uart_write, /* write */
m8xx_uart_setAttributes, /* setAttributes */
NULL, /* stopRemoteTx */
NULL, /* startRemoteTx */
1 /* outputUsesInterrupts */
};
-#else
static const rtems_termios_callbacks pollCallbacks = {
NULL, /* firstOpen */
NULL, /* lastClose */
- m8xx_uart_pollRead, /* pollRead */
- m8xx_uart_pollWrite, /* write */
- m8xx_uart_setAttributes, /* setAttributes */
+ m8xx_uart_pollRead, /* pollRead */
+ m8xx_uart_pollWrite, /* write */
+ m8xx_uart_setAttributes, /* setAttributes */
NULL, /* stopRemoteTx */
NULL, /* startRemoteTx */
0 /* outputUsesInterrupts */
};
#endif
-
- if ( (minor < SMC1_MINOR) || (minor > NUM_PORTS-1) )
+
+ if ( minor > NUM_PORTS-1 )
return RTEMS_INVALID_NUMBER;
-
-#ifdef EPPCBUG_SMC1
- if (minor == SMC1_MINOR)
- return rtems_termios_open (major, minor, arg, &sccEPPCBugCallbacks);
-#endif /* EPPCBUG_SMC1 */
-#ifdef UARTS_USE_INTERRUPTS
+#if UARTS_USE_TERMIOS == 1
+
+#if UARTS_IO_MODE == 2 /* EPPCBug polled I/O with termios */
+
+ sc = rtems_termios_open (major, minor, arg, &sccEPPCBugCallbacks);
+
+#elif UARTS_IO_MODE == 1 /* RTEMS interrupt-driven I/O with termios */
+
sc = rtems_termios_open (major, minor, arg, &intrCallbacks);
ttyp[minor] = args->iop->data1; /* Keep cookie returned by termios_open */
-#else
+
+#else /* RTEMS polled I/O with termios */
+
sc = rtems_termios_open (major, minor, arg, &pollCallbacks);
+
+#endif
+
+#else /* Nothing to do if termios is not used */
+
+ sc = RTEMS_SUCCESSFUL;
+
#endif
+
return sc;
}
@@ -440,7 +527,14 @@ rtems_device_driver console_close(
void *arg
)
{
+ if ( minor > NUM_PORTS-1 )
+ return RTEMS_INVALID_NUMBER;
+
+#if UARTS_USE_TERMIOS == 1
return rtems_termios_close (arg);
+#else
+ return RTEMS_SUCCESSFUL;
+#endif
}
@@ -453,7 +547,37 @@ rtems_device_driver console_read(
void *arg
)
{
+#if UARTS_USE_TERMIOS != 1
+ rtems_libio_rw_args_t *rw_args = arg;
+ int i;
+#endif
+
+ if ( minor > NUM_PORTS-1 )
+ return RTEMS_INVALID_NUMBER;
+
+#if UARTS_USE_TERMIOS == 1
+
return rtems_termios_read(arg);
+
+#else
+
+#if UARTS_IO_MODE != 1 /* Polled I/O without termios */
+
+ for( i = 0; i < rw_args->count; i++ ) {
+ rw_args->buffer[i] = BSP_READ( minor );
+ if( rw_args->buffer[i] == '\r' )
+ rw_args->buffer[i] = '\n';
+ }
+ rw_args->bytes_moved = i;
+ return RTEMS_SUCCESSFUL;
+
+#else /* RTEMS interrupt-driven I/O without termios */
+
+ #error "Interrupt-driven input without termios is not yet supported"
+
+#endif
+
+#endif
}
@@ -466,7 +590,39 @@ rtems_device_driver console_write(
void *arg
)
{
+#if UARTS_USE_TERMIOS != 1
+ rtems_libio_rw_args_t *rw_args = arg;
+ int i;
+ char cr = '\r';
+#endif
+
+ if ( minor > NUM_PORTS-1 )
+ return RTEMS_INVALID_NUMBER;
+
+#if UARTS_USE_TERMIOS == 1
+
return rtems_termios_write(arg);
+
+#else
+
+#if UARTS_IO_MODE != 1 /* Polled I/O without termios*/
+
+ /* Must add carriage return to line feeds */
+ for( i = 0; i < rw_args->count; i++ ) {
+ BSP_WRITE( minor, &(rw_args->buffer[i]), 1 );
+ if( rw_args->buffer[i] == '\n' )
+ BSP_WRITE( minor, &cr, 1 );
+ }
+ rw_args->bytes_moved = rw_args->count;
+ return RTEMS_SUCCESSFUL;
+
+#else /* RTEMS interrupt-driven I/O without termios */
+
+ #error "Interrupt-driven output without termios is not yet supported"
+
+#endif
+
+#endif
}
@@ -479,6 +635,13 @@ rtems_device_driver console_control(
void *arg
)
{
+ if ( minor > NUM_PORTS-1 )
+ return RTEMS_INVALID_NUMBER;
+
+#if UARTS_USE_TERMIOS == 1
return rtems_termios_ioctl (arg);
+#else
+ return RTEMS_SUCCESSFUL;
+#endif
}
diff --git a/c/src/lib/libbsp/powerpc/mbx8xx/include/bsp.h b/c/src/lib/libbsp/powerpc/mbx8xx/include/bsp.h
index df5d911fb0..0f0b805a1e 100644
--- a/c/src/lib/libbsp/powerpc/mbx8xx/include/bsp.h
+++ b/c/src/lib/libbsp/powerpc/mbx8xx/include/bsp.h
@@ -34,7 +34,7 @@ extern "C" {
* Network driver configuration
*/
struct rtems_bsdnet_ifconfig;
-extern int rtems_enet_driver_attach (struct rtems_bsdnet_ifconfig *config);
+extern int rtems_enet_driver_attach (struct rtems_bsdnet_ifconfig *config, int attaching);
#define RTEMS_BSP_NETWORK_DRIVER_NAME "scc1"
#define RTEMS_BSP_NETWORK_DRIVER_ATTACH rtems_enet_driver_attach
@@ -107,12 +107,6 @@ rtems_isr_entry set_vector( /* returns old vector */
int type /* RTEMS or RAW intr */
);
-/*
- * Debug print functions: implemented in console.c
- */
-void printk( char *fmt, ... );
-void BSP_output_string( char * buf );
-
#ifdef __cplusplus
}
#endif
diff --git a/c/src/lib/libbsp/powerpc/mbx8xx/network/network.c b/c/src/lib/libbsp/powerpc/mbx8xx/network/network.c
index 431737639b..7538c7f46d 100644
--- a/c/src/lib/libbsp/powerpc/mbx8xx/network/network.c
+++ b/c/src/lib/libbsp/powerpc/mbx8xx/network/network.c
@@ -1685,7 +1685,7 @@ rtems_fec_driver_attach (struct rtems_bsdnet_ifconfig *config)
int
-rtems_enet_driver_attach (struct rtems_bsdnet_ifconfig *config)
+rtems_enet_driver_attach(struct rtems_bsdnet_ifconfig *config, int attaching)
{
#ifdef MPC860T