source: rtems/cpukit/sapi/src/exshutdown.c @ 92f50c3

4.115
Last change on this file since 92f50c3 was 92f50c3, checked in by Sebastian Huber <sebastian.huber@…>, on 02/17/14 at 08:47:12

score: Add SYSTEM_STATE_TERMINATED

Merge systems states SYSTEM_STATE_SHUTDOWN and SYSTEM_STATE_FAILED into
new system state SYSTEM_STATE_TERMINATED. This reflects that all system
termination paths end up in _Internal_error_Occurred().

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 *  Initialization Manager
3 *
4 *  COPYRIGHT (c) 1989-2011.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.com/license/LICENSE.
10 */
11
12#if HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#include <rtems/init.h>
17#include <rtems/score/sysstate.h>
18#include <rtems/score/threadimpl.h>
19#include <rtems/score/interr.h>
20
21#if defined(RTEMS_SMP)
22  #include <rtems/score/smp.h>
23#endif
24
25/*
26 *  rtems_shutdown_executive
27 *
28 *  This kernel routine shutdowns the executive.  It halts multitasking
29 *  and returns control to the application execution "thread" which
30 *  initialially invoked the rtems_initialize_executive directive.
31 *
32 *  Input parameters:   NONE
33 *
34 *  Output parameters:  NONE
35 */
36
37void rtems_shutdown_executive(
38   uint32_t   result
39)
40{
41  if ( _System_state_Is_up( _System_state_Get() ) ) {
42    #if defined(RTEMS_SMP)
43      _SMP_Request_other_cores_to_shutdown();
44    #endif
45
46    _Thread_Set_global_exit_status( result );
47    _Thread_Stop_multitasking();
48
49    /*******************************************************************
50     *******************************************************************
51     ******     RETURN TO RTEMS_INITIALIZE_START_MULTITASKING()   ******
52     ******                 AND THEN TO BOOT_CARD()               ******
53     *******************************************************************
54     *******************************************************************/
55  }
56  _Internal_error_Occurred(
57    INTERNAL_ERROR_CORE,
58    true,
59    INTERNAL_ERROR_SHUTDOWN_WHEN_NOT_UP
60  );
61}
Note: See TracBrowser for help on using the repository browser.