source: rtems/cpukit/score/include/rtems/score/sysstate.h @ f97536d

5
Last change on this file since f97536d was f97536d, checked in by Sebastian Huber <sebastian.huber@…>, on 10/16/15 at 06:21:48

basdefs.h: Add and use RTEMS_UNUSED

  • Property mode set to 100644
File size: 2.6 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup ScoreSysState
5 *
6 * @brief System State Handler API
7 */
8
9/*
10 *  COPYRIGHT (c) 1989-2011.
11 *  On-Line Applications Research Corporation (OAR).
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.rtems.org/license/LICENSE.
16 */
17
18#ifndef _RTEMS_SCORE_SYSSTATE_H
19#define _RTEMS_SCORE_SYSSTATE_H
20
21#include <rtems/score/basedefs.h>
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27/**
28 * @defgroup ScoreSysState System State Handler
29 *
30 * @ingroup Score
31 *
32 * @brief Management of the internal system state of RTEMS.
33 */
34/**@{**/
35
36/**
37 * @brief System states.
38 */
39typedef enum {
40  /**
41   * @brief The system is before the end of the first phase of initialization.
42   */
43  SYSTEM_STATE_BEFORE_INITIALIZATION,
44
45  /**
46   * @brief The system is between end of the first phase of initialization but
47   * before  multitasking is started.
48   */
49  SYSTEM_STATE_BEFORE_MULTITASKING,
50
51  /**
52   * @brief The system is up and operating normally.
53   */
54  SYSTEM_STATE_UP,
55
56  /**
57   * @brief The system reached its terminal state.
58   */
59  SYSTEM_STATE_TERMINATED
60} System_state_Codes;
61
62#define SYSTEM_STATE_CODES_FIRST SYSTEM_STATE_BEFORE_INITIALIZATION
63
64#define SYSTEM_STATE_CODES_LAST SYSTEM_STATE_TERMINATED
65
66#if defined(RTEMS_MULTIPROCESSING)
67SCORE_EXTERN bool _System_state_Is_multiprocessing;
68#endif
69
70extern System_state_Codes _System_state_Current;
71
72RTEMS_INLINE_ROUTINE void _System_state_Set (
73  System_state_Codes state
74)
75{
76  _System_state_Current = state;
77}
78
79RTEMS_INLINE_ROUTINE void _System_state_Handler_initialization (
80#if defined(RTEMS_MULTIPROCESSING)
81  bool  is_multiprocessing
82#else
83  bool  is_multiprocessing RTEMS_UNUSED
84#endif
85)
86{
87  _System_state_Set( SYSTEM_STATE_BEFORE_INITIALIZATION );
88#if defined(RTEMS_MULTIPROCESSING)
89    _System_state_Is_multiprocessing = is_multiprocessing;
90#endif
91}
92
93RTEMS_INLINE_ROUTINE System_state_Codes _System_state_Get ( void )
94{
95  return _System_state_Current;
96}
97
98RTEMS_INLINE_ROUTINE bool _System_state_Is_before_initialization (
99  System_state_Codes state
100)
101{
102  return (state == SYSTEM_STATE_BEFORE_INITIALIZATION);
103}
104
105RTEMS_INLINE_ROUTINE bool _System_state_Is_before_multitasking (
106  System_state_Codes state
107)
108{
109  return (state == SYSTEM_STATE_BEFORE_MULTITASKING);
110}
111
112RTEMS_INLINE_ROUTINE bool _System_state_Is_up (
113  System_state_Codes state
114)
115{
116  return (state == SYSTEM_STATE_UP);
117}
118
119RTEMS_INLINE_ROUTINE bool _System_state_Is_terminated (
120  System_state_Codes state
121)
122{
123  return (state == SYSTEM_STATE_TERMINATED);
124}
125
126/** @} */
127
128#ifdef __cplusplus
129}
130#endif
131
132#endif
133/* end of include file */
Note: See TracBrowser for help on using the repository browser.