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/system.h> |
---|
17 | #include <rtems/init.h> |
---|
18 | #include <rtems/score/sysstate.h> |
---|
19 | #include <rtems/score/thread.h> |
---|
20 | #include <rtems/score/interr.h> |
---|
21 | |
---|
22 | #if defined(RTEMS_SMP) |
---|
23 | #include <rtems/score/smp.h> |
---|
24 | #endif |
---|
25 | |
---|
26 | /* |
---|
27 | * rtems_shutdown_executive |
---|
28 | * |
---|
29 | * This kernel routine shutdowns the executive. It halts multitasking |
---|
30 | * and returns control to the application execution "thread" which |
---|
31 | * initialially invoked the rtems_initialize_executive directive. |
---|
32 | * |
---|
33 | * Input parameters: NONE |
---|
34 | * |
---|
35 | * Output parameters: NONE |
---|
36 | */ |
---|
37 | |
---|
38 | void rtems_shutdown_executive( |
---|
39 | uint32_t result |
---|
40 | ) |
---|
41 | { |
---|
42 | if ( _System_state_Is_up( _System_state_Get() ) ) { |
---|
43 | #if defined(RTEMS_SMP) |
---|
44 | _SMP_Request_other_cores_to_shutdown(); |
---|
45 | #endif |
---|
46 | |
---|
47 | _Thread_Set_global_exit_status( result ); |
---|
48 | _System_state_Set( SYSTEM_STATE_SHUTDOWN ); |
---|
49 | _Thread_Stop_multitasking(); |
---|
50 | |
---|
51 | /******************************************************************* |
---|
52 | ******************************************************************* |
---|
53 | ****** RETURN TO RTEMS_INITIALIZE_START_MULTITASKING() ****** |
---|
54 | ****** AND THEN TO BOOT_CARD() ****** |
---|
55 | ******************************************************************* |
---|
56 | *******************************************************************/ |
---|
57 | } |
---|
58 | _Internal_error_Occurred( |
---|
59 | INTERNAL_ERROR_CORE, |
---|
60 | true, |
---|
61 | INTERNAL_ERROR_SHUTDOWN_WHEN_NOT_UP |
---|
62 | ); |
---|
63 | } |
---|