summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/i386/pc386/console/console.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1998-07-10 15:43:18 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1998-07-10 15:43:18 +0000
commitdbfa314823105417fc3431052fbed43be24bf84a (patch)
treea1ecc5d4ea1cce8919ea6c7ee87f935011a9c7bd /c/src/lib/libbsp/i386/pc386/console/console.c
parentPatch from Ralf Corsepius <corsepiu@faw.uni-ulm.de>. Comments: (diff)
downloadrtems-dbfa314823105417fc3431052fbed43be24bf84a.tar.bz2
Patch from Quality Quorum <qqi@world.std.com>. Comments:
c/src/lib/libbsp/i386/pc386/console/console.c __assert() modified so it prints on selected console instead of PC console c/src/lib/libbsp/i386/pc386/console/inch.c inch_sleep() modified, so it does not depend upon tmacros.h c/src/lib/libbsp/i386/pc386/pc386dev/GDB.HOWTO description updated c/src/lib/libbsp/i386/pc386/startup/exit.c last output before call to exit() will be printed properly on serial console c/src/lib/libbsp/i386/pc386/startup/irq.c re-submitted bug fix for problem in irqs over 7.
Diffstat (limited to '')
-rw-r--r--c/src/lib/libbsp/i386/pc386/console/console.c79
1 files changed, 73 insertions, 6 deletions
diff --git a/c/src/lib/libbsp/i386/pc386/console/console.c b/c/src/lib/libbsp/i386/pc386/console/console.c
index 8698ea8136..29ec37ec56 100644
--- a/c/src/lib/libbsp/i386/pc386/console/console.c
+++ b/c/src/lib/libbsp/i386/pc386/console/console.c
@@ -31,7 +31,7 @@
| $Id$
+--------------------------------------------------------------------------*/
-
+#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
@@ -57,6 +57,7 @@ static int conSetAttr(int minor, const struct termios *);
extern rtems_isr _IBMPC_keyboard_isr(rtems_vector_number);
/* keyboard (IRQ 0x01) Interrupt Service Routine (defined in 'inch.c') */
+extern rtems_boolean _IBMPC_scankey(char *); /* defined in 'inch.c' */
void console_reserve_resources(rtems_configuration_table *conf)
{
@@ -69,15 +70,81 @@ void console_reserve_resources(rtems_configuration_table *conf)
void __assert(const char *file, int line, const char *msg)
{
- printk("assert failed: %s: ", file);
- printk("%d: ", line);
- printk("%s\n", msg);
+ static char buf[20];
+ static char exit_msg[] = "EXECUTIVE SHUTDOWN! Any key to reboot...";
+ static char assert_msg[] = "assert failed: ";
+ unsigned char ch;
+ const unsigned char *cp;
+
+
+ /*
+ * Note we cannot call exit or printf from here,
+ * assert can fail inside ISR too
+ */
+ if(PC386ConsolePort == PC386_CONSOLE_PORT_CONSOLE)
+ {
+ printk("\nassert failed: %s: ", file);
+ printk("%d: ", line);
+ printk("%s\n\n", msg);
+ printk(exit_msg);
+ while(!_IBMPC_scankey(&ch));
+ printk("\n\n");
+ }
+ else
+ {
+ PC386_uart_intr_ctrl(PC386ConsolePort, PC386_UART_INTR_CTRL_DISABLE);
+
+ PC386_uart_polled_write(PC386ConsolePort, '\r');
+ PC386_uart_polled_write(PC386ConsolePort, '\n');
+
+ for(cp=assert_msg; *cp!=0; cp++)
+ {
+ PC386_uart_polled_write(PC386ConsolePort, *cp);
+ }
+
+ for(cp=file; *cp!=0; cp++)
+ {
+ PC386_uart_polled_write(PC386ConsolePort, *cp);
+ }
+
+ PC386_uart_polled_write(PC386ConsolePort, ':');
+ PC386_uart_polled_write(PC386ConsolePort, ' ');
- exit(1);
+ sprintf(buf, "%d: ", line);
- return;
+ for(cp=buf; *cp!=0; cp++)
+ {
+ PC386_uart_polled_write(PC386ConsolePort, *cp);
+ }
+
+ for(cp=msg; *cp!=0; cp++)
+ {
+ PC386_uart_polled_write(PC386ConsolePort, *cp);
+ }
+
+ PC386_uart_polled_write(PC386ConsolePort, '\r');
+ PC386_uart_polled_write(PC386ConsolePort, '\n');
+ PC386_uart_polled_write(PC386ConsolePort, '\r');
+ PC386_uart_polled_write(PC386ConsolePort, '\n');
+
+ for(cp=exit_msg; *cp != 0; cp++)
+ {
+ PC386_uart_polled_write(PC386ConsolePort, *cp);
+ }
+
+ PC386_uart_polled_read(PC386ConsolePort);
+
+ PC386_uart_polled_write(PC386ConsolePort, '\r');
+ PC386_uart_polled_write(PC386ConsolePort, '\n');
+ PC386_uart_polled_write(PC386ConsolePort, '\r');
+ PC386_uart_polled_write(PC386ConsolePort, '\n');
+
+ }
+
+ rtemsReboot();
}
+
/*-------------------------------------------------------------------------+
| Console device driver INITIALIZE entry point.
+--------------------------------------------------------------------------+