summaryrefslogtreecommitdiffstats
path: root/c/src
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
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 'c/src')
-rw-r--r--c/src/lib/libbsp/i386/pc386/console/console.c79
-rw-r--r--c/src/lib/libbsp/i386/pc386/console/inch.c15
-rw-r--r--c/src/lib/libbsp/i386/pc386/startup/exit.c6
3 files changed, 89 insertions, 11 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.
+--------------------------------------------------------------------------+
diff --git a/c/src/lib/libbsp/i386/pc386/console/inch.c b/c/src/lib/libbsp/i386/pc386/console/inch.c
index f29f6124c8..9159e62ab4 100644
--- a/c/src/lib/libbsp/i386/pc386/console/inch.c
+++ b/c/src/lib/libbsp/i386/pc386/console/inch.c
@@ -292,11 +292,10 @@ _IBMPC_inch(void)
char
_IBMPC_inch_sleep(void)
{
- char c;
- extern rtems_interval _TOD_Ticks_per_second; /* XXX should not do this */
- rtems_interval ticks_to_delay;
+ char c;
+ rtems_interval ticks_per_second;
- ticks_to_delay = (_TOD_Ticks_per_second + 24) / 25;
+ ticks_per_second = 0;
for(;;)
{
@@ -304,7 +303,13 @@ _IBMPC_inch_sleep(void)
{
return c;
}
- rtems_task_wake_after(ticks_to_delay);
+
+ if(ticks_per_second == 0)
+ {
+ rtems_clock_get(RTEMS_CLOCK_GET_TICKS_PER_SECOND,
+ &ticks_per_second);
+ }
+ rtems_task_wake_after((ticks_per_second+24)/25);
}
return c;
diff --git a/c/src/lib/libbsp/i386/pc386/startup/exit.c b/c/src/lib/libbsp/i386/pc386/startup/exit.c
index 328a0afa76..5166049d34 100644
--- a/c/src/lib/libbsp/i386/pc386/startup/exit.c
+++ b/c/src/lib/libbsp/i386/pc386/startup/exit.c
@@ -34,6 +34,7 @@
#include <stdio.h>
#include <bsp.h>
+#include <rtems/libio.h>
#include <pc386uart.h>
/*-------------------------------------------------------------------------+
@@ -70,6 +71,11 @@ void _exit(int status)
}
else
{
+ /* Close console */
+ __rtems_close(2);
+ __rtems_close(1);
+ __rtems_close(0);
+
PC386_uart_intr_ctrl(PC386ConsolePort, PC386_UART_INTR_CTRL_DISABLE);
PC386_uart_polled_write(PC386ConsolePort, '\r');