forked from Imagelibrary/rtems
2009-09-04 Sebastian Huber <Sebastian.Huber@embedded-brains.de>
* rtems/src/taskmode.c, sapi/src/exshutdown.c, score/include/rtems/score/sysstate.h, score/inline/rtems/score/sysstate.inl: Added _System_state_Is_shutdown(). Removed direct uses of _System_state_Current. Documentation.
This commit is contained in:
@@ -1,3 +1,11 @@
|
|||||||
|
2009-09-04 Sebastian Huber <Sebastian.Huber@embedded-brains.de>
|
||||||
|
|
||||||
|
* rtems/src/taskmode.c, sapi/src/exshutdown.c,
|
||||||
|
score/include/rtems/score/sysstate.h,
|
||||||
|
score/inline/rtems/score/sysstate.inl: Added
|
||||||
|
_System_state_Is_shutdown(). Removed direct uses of
|
||||||
|
_System_state_Current. Documentation.
|
||||||
|
|
||||||
2009-08-28 Joel Sherrill <joel.sherrill@OARcorp.com>
|
2009-08-28 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||||
|
|
||||||
* libcsupport/src/malloc_initialize.c, sapi/src/exinit.c,
|
* libcsupport/src/malloc_initialize.c, sapi/src/exinit.c,
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ rtems_status_code rtems_task_mode(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( _System_state_Is_up(_System_state_Current) )
|
if ( _System_state_Is_up( _System_state_Get() ) )
|
||||||
if ( _Thread_Evaluate_mode() || needs_asr_dispatching )
|
if ( _Thread_Evaluate_mode() || needs_asr_dispatching )
|
||||||
_Thread_Dispatch();
|
_Thread_Dispatch();
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ void rtems_shutdown_executive(
|
|||||||
uint32_t result
|
uint32_t result
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if ( _System_state_Current != SYSTEM_STATE_SHUTDOWN ) {
|
if ( !_System_state_Is_shutdown( _System_state_Get() ) ) {
|
||||||
_System_state_Set( SYSTEM_STATE_SHUTDOWN );
|
_System_state_Set( SYSTEM_STATE_SHUTDOWN );
|
||||||
_Thread_Stop_multitasking();
|
_Thread_Stop_multitasking();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* @file rtems/score/sysstate.h
|
* @file
|
||||||
*
|
*
|
||||||
* This include file contains information regarding the system state.
|
* @ingroup ScoreSysState
|
||||||
|
*
|
||||||
|
* @brief System State Handler API.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -18,63 +20,64 @@
|
|||||||
#ifndef _RTEMS_SCORE_SYSSTATE_H
|
#ifndef _RTEMS_SCORE_SYSSTATE_H
|
||||||
#define _RTEMS_SCORE_SYSSTATE_H
|
#define _RTEMS_SCORE_SYSSTATE_H
|
||||||
|
|
||||||
/**
|
|
||||||
* @defgroup ScoreSysState System State Handler
|
|
||||||
*
|
|
||||||
* This handler encapsulates functionality related to the management of the
|
|
||||||
* internal system state of RTEMS.
|
|
||||||
*/
|
|
||||||
/**@{*/
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* types */
|
/**
|
||||||
|
* @defgroup ScoreSysState System State Handler
|
||||||
/* enumerated constants */
|
*
|
||||||
|
* @ingroup Score
|
||||||
|
*
|
||||||
|
* @brief Management of the internal system state of RTEMS.
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The following type defines the possible system states.
|
* @brief System states.
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
/** This indicates that the system state is between the start
|
/**
|
||||||
* of rtems_initialize_executive_early and the end of the first
|
* @brief The system is before the end of the first phase of initialization.
|
||||||
* phase of initialization.
|
|
||||||
*/
|
*/
|
||||||
SYSTEM_STATE_BEFORE_INITIALIZATION,
|
SYSTEM_STATE_BEFORE_INITIALIZATION,
|
||||||
/** This indicates that the system state is between end of the first
|
|
||||||
* phase of initializatin but before multitasking is started.
|
/**
|
||||||
|
* @brief The system is between end of the first phase of initializatin but
|
||||||
|
* before multitasking is started.
|
||||||
*/
|
*/
|
||||||
SYSTEM_STATE_BEFORE_MULTITASKING,
|
SYSTEM_STATE_BEFORE_MULTITASKING,
|
||||||
/** This indicates that the system state is attempting to initiate
|
|
||||||
* multitasking.
|
/**
|
||||||
|
* @brief The system is attempting to initiate multitasking.
|
||||||
*/
|
*/
|
||||||
SYSTEM_STATE_BEGIN_MULTITASKING,
|
SYSTEM_STATE_BEGIN_MULTITASKING,
|
||||||
/** This indicates that the system is up and operating normally. */
|
|
||||||
|
/**
|
||||||
|
* @brief The system is up and operating normally.
|
||||||
|
*/
|
||||||
SYSTEM_STATE_UP,
|
SYSTEM_STATE_UP,
|
||||||
/** This indicates that the system is in the midst of a shutdown. */
|
|
||||||
|
/**
|
||||||
|
* @brief The system is in the midst of a shutdown.
|
||||||
|
*/
|
||||||
SYSTEM_STATE_SHUTDOWN,
|
SYSTEM_STATE_SHUTDOWN,
|
||||||
/** This indicates that a fatal error has occurred. */
|
|
||||||
|
/**
|
||||||
|
* @brief A fatal error has occurred.
|
||||||
|
*/
|
||||||
SYSTEM_STATE_FAILED
|
SYSTEM_STATE_FAILED
|
||||||
} System_state_Codes;
|
} System_state_Codes;
|
||||||
|
|
||||||
/** This defines the first system state. */
|
|
||||||
#define SYSTEM_STATE_CODES_FIRST SYSTEM_STATE_BEFORE_INITIALIZATION
|
#define SYSTEM_STATE_CODES_FIRST SYSTEM_STATE_BEFORE_INITIALIZATION
|
||||||
/** This defines the highest value system state. */
|
|
||||||
#define SYSTEM_STATE_CODES_LAST SYSTEM_STATE_FAILED
|
#define SYSTEM_STATE_CODES_LAST SYSTEM_STATE_FAILED
|
||||||
|
|
||||||
#if defined(RTEMS_MULTIPROCESSING)
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
/**
|
|
||||||
* The following variable indicates whether or not this is
|
|
||||||
* an multiprocessing system.
|
|
||||||
*/
|
|
||||||
SCORE_EXTERN bool _System_state_Is_multiprocessing;
|
SCORE_EXTERN bool _System_state_Is_multiprocessing;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* The following variable contains the current system state.
|
|
||||||
*/
|
|
||||||
SCORE_EXTERN System_state_Codes _System_state_Current;
|
SCORE_EXTERN System_state_Codes _System_state_Current;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -83,11 +86,11 @@ SCORE_EXTERN System_state_Codes _System_state_Current;
|
|||||||
|
|
||||||
#include <rtems/score/sysstate.inl>
|
#include <rtems/score/sysstate.inl>
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**@}*/
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
/* end of include file */
|
/* end of include file */
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* @file rtems/score/sysstate.inl
|
* @file
|
||||||
*
|
*
|
||||||
* This file contains the inline implementation of routines regarding the
|
* @ingroup ScoreSysState
|
||||||
* system state.
|
*
|
||||||
|
* @brief System State Handler API.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -25,32 +26,10 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @addtogroup ScoreSysState
|
* @addtogroup ScoreSysState
|
||||||
|
*
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* This routine initializes the system state handler.
|
|
||||||
*/
|
|
||||||
|
|
||||||
RTEMS_INLINE_ROUTINE void _System_state_Handler_initialization (
|
|
||||||
#if defined(RTEMS_MULTIPROCESSING)
|
|
||||||
bool is_multiprocessing
|
|
||||||
#else
|
|
||||||
bool is_multiprocessing __attribute__((unused))
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
|
||||||
_System_state_Current = SYSTEM_STATE_BEFORE_INITIALIZATION;
|
|
||||||
#if defined(RTEMS_MULTIPROCESSING)
|
|
||||||
_System_state_Is_multiprocessing = is_multiprocessing;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This routine sets the current system state to that specified by
|
|
||||||
* the called.
|
|
||||||
*/
|
|
||||||
|
|
||||||
RTEMS_INLINE_ROUTINE void _System_state_Set (
|
RTEMS_INLINE_ROUTINE void _System_state_Set (
|
||||||
System_state_Codes state
|
System_state_Codes state
|
||||||
)
|
)
|
||||||
@@ -58,20 +37,25 @@ RTEMS_INLINE_ROUTINE void _System_state_Set (
|
|||||||
_System_state_Current = state;
|
_System_state_Current = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
RTEMS_INLINE_ROUTINE void _System_state_Handler_initialization (
|
||||||
* This function returns the current system state.
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
*/
|
bool is_multiprocessing
|
||||||
|
#else
|
||||||
|
bool is_multiprocessing __attribute__((unused))
|
||||||
|
#endif
|
||||||
|
)
|
||||||
|
{
|
||||||
|
_System_state_Set( SYSTEM_STATE_BEFORE_INITIALIZATION );
|
||||||
|
#if defined(RTEMS_MULTIPROCESSING)
|
||||||
|
_System_state_Is_multiprocessing = is_multiprocessing;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
RTEMS_INLINE_ROUTINE System_state_Codes _System_state_Get ( void )
|
RTEMS_INLINE_ROUTINE System_state_Codes _System_state_Get ( void )
|
||||||
{
|
{
|
||||||
return _System_state_Current;
|
return _System_state_Current;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This function returns true if the state is equal to the
|
|
||||||
* "before initialization" state, and false otherwise.
|
|
||||||
*/
|
|
||||||
|
|
||||||
RTEMS_INLINE_ROUTINE bool _System_state_Is_before_initialization (
|
RTEMS_INLINE_ROUTINE bool _System_state_Is_before_initialization (
|
||||||
System_state_Codes state
|
System_state_Codes state
|
||||||
)
|
)
|
||||||
@@ -79,11 +63,6 @@ RTEMS_INLINE_ROUTINE bool _System_state_Is_before_initialization (
|
|||||||
return (state == SYSTEM_STATE_BEFORE_INITIALIZATION);
|
return (state == SYSTEM_STATE_BEFORE_INITIALIZATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This function returns true if the state is equal to the
|
|
||||||
* "before multitasking" state, and false otherwise.
|
|
||||||
*/
|
|
||||||
|
|
||||||
RTEMS_INLINE_ROUTINE bool _System_state_Is_before_multitasking (
|
RTEMS_INLINE_ROUTINE bool _System_state_Is_before_multitasking (
|
||||||
System_state_Codes state
|
System_state_Codes state
|
||||||
)
|
)
|
||||||
@@ -91,11 +70,6 @@ RTEMS_INLINE_ROUTINE bool _System_state_Is_before_multitasking (
|
|||||||
return (state == SYSTEM_STATE_BEFORE_MULTITASKING);
|
return (state == SYSTEM_STATE_BEFORE_MULTITASKING);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This function returns true if the state is equal to the
|
|
||||||
* "begin multitasking" state, and false otherwise.
|
|
||||||
*/
|
|
||||||
|
|
||||||
RTEMS_INLINE_ROUTINE bool _System_state_Is_begin_multitasking (
|
RTEMS_INLINE_ROUTINE bool _System_state_Is_begin_multitasking (
|
||||||
System_state_Codes state
|
System_state_Codes state
|
||||||
)
|
)
|
||||||
@@ -103,10 +77,12 @@ RTEMS_INLINE_ROUTINE bool _System_state_Is_begin_multitasking (
|
|||||||
return (state == SYSTEM_STATE_BEGIN_MULTITASKING);
|
return (state == SYSTEM_STATE_BEGIN_MULTITASKING);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
RTEMS_INLINE_ROUTINE bool _System_state_Is_shutdown (
|
||||||
* This function returns true if the state is equal to the
|
System_state_Codes state
|
||||||
* "up" state, and false otherwise.
|
)
|
||||||
*/
|
{
|
||||||
|
return (state == SYSTEM_STATE_SHUTDOWN);
|
||||||
|
}
|
||||||
|
|
||||||
RTEMS_INLINE_ROUTINE bool _System_state_Is_up (
|
RTEMS_INLINE_ROUTINE bool _System_state_Is_up (
|
||||||
System_state_Codes state
|
System_state_Codes state
|
||||||
@@ -115,11 +91,6 @@ RTEMS_INLINE_ROUTINE bool _System_state_Is_up (
|
|||||||
return (state == SYSTEM_STATE_UP);
|
return (state == SYSTEM_STATE_UP);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This function returns true if the state is equal to the
|
|
||||||
* "failed" state, and false otherwise.
|
|
||||||
*/
|
|
||||||
|
|
||||||
RTEMS_INLINE_ROUTINE bool _System_state_Is_failed (
|
RTEMS_INLINE_ROUTINE bool _System_state_Is_failed (
|
||||||
System_state_Codes state
|
System_state_Codes state
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user