[rtems commit] score: Add SYSTEM_STATE_TERMINATED

Sebastian Huber sebh at rtems.org
Wed Feb 19 08:52:42 UTC 2014


Module:    rtems
Branch:    master
Commit:    92f50c3b2916d52c26d74fe1d61354d342e148af
Changeset: http://git.rtems.org/rtems/commit/?id=92f50c3b2916d52c26d74fe1d61354d342e148af

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Feb 17 09:47:12 2014 +0100

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().

---

 cpukit/sapi/src/exshutdown.c                |    1 -
 cpukit/score/include/rtems/score/interr.h   |    2 +-
 cpukit/score/include/rtems/score/sysstate.h |   22 +++++-----------------
 cpukit/score/src/interr.c                   |    2 +-
 testsuites/libtests/heapwalk/init.c         |    2 +-
 testsuites/sptests/spfatal23/testcase.h     |    2 +-
 6 files changed, 9 insertions(+), 22 deletions(-)

diff --git a/cpukit/sapi/src/exshutdown.c b/cpukit/sapi/src/exshutdown.c
index 7a96869..44c5a09 100644
--- a/cpukit/sapi/src/exshutdown.c
+++ b/cpukit/sapi/src/exshutdown.c
@@ -44,7 +44,6 @@ void rtems_shutdown_executive(
     #endif
 
     _Thread_Set_global_exit_status( result );
-    _System_state_Set( SYSTEM_STATE_SHUTDOWN );
     _Thread_Stop_multitasking();
 
     /*******************************************************************
diff --git a/cpukit/score/include/rtems/score/interr.h b/cpukit/score/include/rtems/score/interr.h
index 79edc21..b774edc 100644
--- a/cpukit/score/include/rtems/score/interr.h
+++ b/cpukit/score/include/rtems/score/interr.h
@@ -192,7 +192,7 @@ extern Internal_errors_Information _Internal_errors_What_happened;
  *
  * Once all fatal handler executed the error information will be stored to
  * _Internal_errors_What_happened and the system state is set to
- * SYSTEM_STATE_FAILED.
+ * SYSTEM_STATE_TERMINATED.
  *
  * The final step is to call the CPU specific _CPU_Fatal_halt().
  *
diff --git a/cpukit/score/include/rtems/score/sysstate.h b/cpukit/score/include/rtems/score/sysstate.h
index 304b952..4a50e16 100644
--- a/cpukit/score/include/rtems/score/sysstate.h
+++ b/cpukit/score/include/rtems/score/sysstate.h
@@ -54,19 +54,14 @@ typedef enum {
   SYSTEM_STATE_UP,
 
   /**
-   * @brief The system is in the midst of a shutdown.
+   * @brief The system reached its terminal state.
    */
-  SYSTEM_STATE_SHUTDOWN,
-
-  /**
-   * @brief A fatal error has occurred.
-   */
-  SYSTEM_STATE_FAILED
+  SYSTEM_STATE_TERMINATED
 } System_state_Codes;
 
 #define SYSTEM_STATE_CODES_FIRST SYSTEM_STATE_BEFORE_INITIALIZATION
 
-#define SYSTEM_STATE_CODES_LAST SYSTEM_STATE_FAILED
+#define SYSTEM_STATE_CODES_LAST SYSTEM_STATE_TERMINATED
 
 #if defined(RTEMS_MULTIPROCESSING)
 SCORE_EXTERN bool _System_state_Is_multiprocessing;
@@ -114,13 +109,6 @@ RTEMS_INLINE_ROUTINE bool _System_state_Is_before_multitasking (
   return (state == SYSTEM_STATE_BEFORE_MULTITASKING);
 }
 
-RTEMS_INLINE_ROUTINE bool _System_state_Is_shutdown (
-  System_state_Codes state
-)
-{
-  return (state == SYSTEM_STATE_SHUTDOWN);
-}
-
 RTEMS_INLINE_ROUTINE bool _System_state_Is_up (
   System_state_Codes state
 )
@@ -128,11 +116,11 @@ RTEMS_INLINE_ROUTINE bool _System_state_Is_up (
   return (state == SYSTEM_STATE_UP);
 }
 
-RTEMS_INLINE_ROUTINE bool _System_state_Is_failed (
+RTEMS_INLINE_ROUTINE bool _System_state_Is_terminated (
   System_state_Codes state
 )
 {
-  return (state == SYSTEM_STATE_FAILED);
+  return (state == SYSTEM_STATE_TERMINATED);
 }
 
 /** @} */
diff --git a/cpukit/score/src/interr.c b/cpukit/score/src/interr.c
index 1b895d6..f3a3127 100644
--- a/cpukit/score/src/interr.c
+++ b/cpukit/score/src/interr.c
@@ -38,7 +38,7 @@ void _Internal_error_Occurred(
   _Internal_errors_What_happened.is_internal = is_internal;
   _Internal_errors_What_happened.the_error   = the_error;
 
-  _System_state_Set( SYSTEM_STATE_FAILED );
+  _System_state_Set( SYSTEM_STATE_TERMINATED );
 
   _CPU_Fatal_halt( the_error );
 
diff --git a/testsuites/libtests/heapwalk/init.c b/testsuites/libtests/heapwalk/init.c
index f00b9b8..af79d1c 100644
--- a/testsuites/libtests/heapwalk/init.c
+++ b/testsuites/libtests/heapwalk/init.c
@@ -94,7 +94,7 @@ static void test_system_not_up(void)
 
   rtems_interrupt_disable( level );
   System_state_Codes state = _System_state_Get();
-  _System_state_Set( SYSTEM_STATE_FAILED );
+  _System_state_Set( SYSTEM_STATE_TERMINATED );
   test_call_heap_walk( true );
   _System_state_Set( state );
   rtems_interrupt_enable( level );
diff --git a/testsuites/sptests/spfatal23/testcase.h b/testsuites/sptests/spfatal23/testcase.h
index 28010e1..6be7d3a 100644
--- a/testsuites/sptests/spfatal23/testcase.h
+++ b/testsuites/sptests/spfatal23/testcase.h
@@ -17,7 +17,7 @@
 
 void force_error()
 {
-  _System_state_Set( SYSTEM_STATE_SHUTDOWN );
+  _System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING );
   rtems_shutdown_executive( 0 );
   /* we will not run this far */
 }




More information about the vc mailing list