forked from Imagelibrary/rtems
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.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
exit(1);
|
||||
for(cp=file; *cp!=0; cp++)
|
||||
{
|
||||
PC386_uart_polled_write(PC386ConsolePort, *cp);
|
||||
}
|
||||
|
||||
PC386_uart_polled_write(PC386ConsolePort, ':');
|
||||
PC386_uart_polled_write(PC386ConsolePort, ' ');
|
||||
|
||||
return;
|
||||
sprintf(buf, "%d: ", line);
|
||||
|
||||
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.
|
||||
+--------------------------------------------------------------------------+
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user