1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief System State Handler API |
---|
5 | */ |
---|
6 | |
---|
7 | /* |
---|
8 | * COPYRIGHT (c) 1989-2004. |
---|
9 | * On-Line Applications Research Corporation (OAR). |
---|
10 | * |
---|
11 | * The license and distribution terms for this file may be |
---|
12 | * found in the file LICENSE in this distribution or at |
---|
13 | * http://www.rtems.com/license/LICENSE. |
---|
14 | */ |
---|
15 | |
---|
16 | #ifndef _RTEMS_SCORE_SYSSTATE_H |
---|
17 | # error "Never use <rtems/score/sysstate.inl> directly; include <rtems/score/sysstate.h> instead." |
---|
18 | #endif |
---|
19 | |
---|
20 | #ifndef _RTEMS_SCORE_SYSSTATE_INL |
---|
21 | #define _RTEMS_SCORE_SYSSTATE_INL |
---|
22 | |
---|
23 | /** |
---|
24 | * @addtogroup ScoreSysState |
---|
25 | * |
---|
26 | * @{ |
---|
27 | */ |
---|
28 | |
---|
29 | RTEMS_INLINE_ROUTINE void _System_state_Set ( |
---|
30 | System_state_Codes state |
---|
31 | ) |
---|
32 | { |
---|
33 | _System_state_Current = state; |
---|
34 | } |
---|
35 | |
---|
36 | RTEMS_INLINE_ROUTINE void _System_state_Handler_initialization ( |
---|
37 | #if defined(RTEMS_MULTIPROCESSING) |
---|
38 | bool is_multiprocessing |
---|
39 | #else |
---|
40 | bool is_multiprocessing __attribute__((unused)) |
---|
41 | #endif |
---|
42 | ) |
---|
43 | { |
---|
44 | _System_state_Set( SYSTEM_STATE_BEFORE_INITIALIZATION ); |
---|
45 | #if defined(RTEMS_MULTIPROCESSING) |
---|
46 | _System_state_Is_multiprocessing = is_multiprocessing; |
---|
47 | #endif |
---|
48 | } |
---|
49 | |
---|
50 | RTEMS_INLINE_ROUTINE System_state_Codes _System_state_Get ( void ) |
---|
51 | { |
---|
52 | return _System_state_Current; |
---|
53 | } |
---|
54 | |
---|
55 | RTEMS_INLINE_ROUTINE bool _System_state_Is_before_initialization ( |
---|
56 | System_state_Codes state |
---|
57 | ) |
---|
58 | { |
---|
59 | return (state == SYSTEM_STATE_BEFORE_INITIALIZATION); |
---|
60 | } |
---|
61 | |
---|
62 | RTEMS_INLINE_ROUTINE bool _System_state_Is_before_multitasking ( |
---|
63 | System_state_Codes state |
---|
64 | ) |
---|
65 | { |
---|
66 | return (state == SYSTEM_STATE_BEFORE_MULTITASKING); |
---|
67 | } |
---|
68 | |
---|
69 | RTEMS_INLINE_ROUTINE bool _System_state_Is_begin_multitasking ( |
---|
70 | System_state_Codes state |
---|
71 | ) |
---|
72 | { |
---|
73 | return (state == SYSTEM_STATE_BEGIN_MULTITASKING); |
---|
74 | } |
---|
75 | |
---|
76 | RTEMS_INLINE_ROUTINE bool _System_state_Is_shutdown ( |
---|
77 | System_state_Codes state |
---|
78 | ) |
---|
79 | { |
---|
80 | return (state == SYSTEM_STATE_SHUTDOWN); |
---|
81 | } |
---|
82 | |
---|
83 | RTEMS_INLINE_ROUTINE bool _System_state_Is_up ( |
---|
84 | System_state_Codes state |
---|
85 | ) |
---|
86 | { |
---|
87 | return (state == SYSTEM_STATE_UP); |
---|
88 | } |
---|
89 | |
---|
90 | RTEMS_INLINE_ROUTINE bool _System_state_Is_failed ( |
---|
91 | System_state_Codes state |
---|
92 | ) |
---|
93 | { |
---|
94 | return (state == SYSTEM_STATE_FAILED); |
---|
95 | } |
---|
96 | |
---|
97 | /** @} */ |
---|
98 | |
---|
99 | #endif |
---|
100 | /* end of include file */ |
---|