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

4.104.114.84.95
Last change on this file since 7150f00f was 7150f00f, checked in by Joel Sherrill <joel.sherrill@…>, on 12/01/97 at 22:06:48

Inclusion of PC386 BSP submitted by Pedro Miguel Da Cruz Neto Romano
<pmcnr@…> and Jose Rufino <ruf@…>
of NavIST (http://pandora.ist.utl.pt/).

  • Property mode set to 100644
File size: 2.9 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, 1990, 1991, 1992, 1993, 1994.                      *
23| * On-Line Applications Research Corporation (OAR).                       *
24| * All rights assigned to U.S. Government, 1994.                          *
25| *                                                                        *
26| * This material may be reproduced by or for the U.S. Government pursuant *
27| * to the copyright license under the clause at DFARS 252.227-7013.  This *
28| * notice must appear in all copies of this file and its derivatives.     *
29| **************************************************************************
30+--------------------------------------------------------------------------*/
31
32
33#include <stdio.h>
34
35#include <bsp.h>
36
37/*-------------------------------------------------------------------------+
38| External Prototypes
39+--------------------------------------------------------------------------*/
40extern rtems_boolean _IBMPC_scankey(char *);  /* define in 'inch.c' */
41
42
43/*-------------------------------------------------------------------------+
44|         Function: rtemsReboot
45|      Description: Reboot the PC.
46| Global Variables: None.
47|        Arguments: None.
48|          Returns: Nothing.
49+--------------------------------------------------------------------------*/
50inline void rtemsReboot(void)
51{
52  /* shutdown and reboot */
53  outport_byte(0x64, 0xFE);        /* use keyboard controler to do the job... */
54} /* rtemsReboot */
55
56
57/*-------------------------------------------------------------------------+
58|         Function: _exit
59|      Description: Shutdown the PC. Called from libc's 'exit'.
60| Global Variables: None.
61|        Arguments: status - exit status (ignored).
62|          Returns: Nothing.
63+--------------------------------------------------------------------------*/
64void _exit(int status)
65{
66  unsigned char ch;
67  puts("\nEXECUTIVE SHUTDOWN! Any key to reboot...");
68
69  while(!_IBMPC_scankey(&ch))
70    ;
71
72  rtemsReboot();
73} /* _exit */
Note: See TracBrowser for help on using the repository browser.