source: rtems/c/src/lib/libbsp/i386/pc386/startup/exit.c @ dbfa3148

4.104.114.84.95
Last change on this file since dbfa3148 was dbfa3148, checked in by Joel Sherrill <joel.sherrill@…>, on 07/10/98 at 15:43:18

Patch from Quality Quorum <qqi@…>. 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.

  • Property mode set to 100644
File size: 3.3 KB
Line 
1/*-------------------------------------------------------------------------+
2| exit.c v1.1 - PC386 BSP - 1997/08/07
3+--------------------------------------------------------------------------+
4| Routines to shutdown and reboot the PC.
5+--------------------------------------------------------------------------+
6| (C) Copyright 1997 -
7| - NavIST Group - Real-Time Distributed Systems and Industrial Automation
8|
9| http://pandora.ist.utl.pt
10|
11| Instituto Superior Tecnico * Lisboa * PORTUGAL
12+--------------------------------------------------------------------------+
13| Disclaimer:
14|
15| This file is provided "AS IS" without warranty of any kind, either
16| expressed or implied.
17+--------------------------------------------------------------------------+
18| This code is based on:
19|   exit.c,v 1.2 1995/12/19 20:07:36 joel Exp -  go32 BSP
20| With the following copyright notice:
21| **************************************************************************
22| *  COPYRIGHT (c) 1989-1998.
23| *  On-Line Applications Research Corporation (OAR).
24| *  Copyright assigned to U.S. Government, 1994.
25| *
26| *  The license and distribution terms for this file may be
27| *  found in found in the file LICENSE in this distribution or at
28| *  http://www.OARcorp.com/rtems/license.html.
29| **************************************************************************
30|
31|  $Id$
32+--------------------------------------------------------------------------*/
33
34
35#include <stdio.h>
36#include <bsp.h>
37#include <rtems/libio.h>
38#include <pc386uart.h>
39
40/*-------------------------------------------------------------------------+
41 | Which console is in use: either (-1) which means normal console or
42 | uart id if uart was used
43 +-------------------------------------------------------------------------*/
44extern int PC386ConsolePort;
45
46/*-------------------------------------------------------------------------+
47| External Prototypes
48+--------------------------------------------------------------------------*/
49extern rtems_boolean _IBMPC_scankey(char *);  /* defined in 'inch.c' */
50
51/*-------------------------------------------------------------------------+
52|         Function: _exit
53|      Description: Shutdown the PC. Called from libc's 'exit'.
54| Global Variables: None.
55|        Arguments: status - exit status (ignored).
56|          Returns: Nothing.
57+--------------------------------------------------------------------------*/
58void _exit(int status)
59{
60  unsigned char ch, *cp;
61  static   char line[]="EXECUTIVE SHUTDOWN! Any key to reboot...";
62
63  if(PC386ConsolePort == PC386_CONSOLE_PORT_CONSOLE)
64    {
65
66      printk("\n");
67      printk(line);
68      while(!_IBMPC_scankey(&ch))
69        ;
70      printk("\n\n");
71    }
72  else
73    {
74      /* Close console */
75      __rtems_close(2);
76      __rtems_close(1);
77      __rtems_close(0);
78
79      PC386_uart_intr_ctrl(PC386ConsolePort, PC386_UART_INTR_CTRL_DISABLE);
80     
81      PC386_uart_polled_write(PC386ConsolePort, '\r');
82      PC386_uart_polled_write(PC386ConsolePort, '\n');
83     
84      for(cp=line; *cp != 0; cp++)
85        {
86          PC386_uart_polled_write(PC386ConsolePort, *cp);
87        }
88
89      PC386_uart_polled_read(PC386ConsolePort);
90
91      PC386_uart_polled_write(PC386ConsolePort, '\r');
92      PC386_uart_polled_write(PC386ConsolePort, '\n');
93      PC386_uart_polled_write(PC386ConsolePort, '\r');
94      PC386_uart_polled_write(PC386ConsolePort, '\n');
95    }
96
97  rtemsReboot();
98} /* _exit */
99
100
101
102
103
104
105
Note: See TracBrowser for help on using the repository browser.