diff options
Diffstat (limited to 'cpukit/score/include')
-rw-r--r-- | cpukit/score/include/rtems/score/apimutex.h | 65 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/assert.h | 8 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/objectimpl.h | 5 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/onceimpl.h | 4 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/todimpl.h | 16 |
5 files changed, 23 insertions, 75 deletions
diff --git a/cpukit/score/include/rtems/score/apimutex.h b/cpukit/score/include/rtems/score/apimutex.h index aa08481c83..f43edf23f4 100644 --- a/cpukit/score/include/rtems/score/apimutex.h +++ b/cpukit/score/include/rtems/score/apimutex.h @@ -18,8 +18,9 @@ #ifndef _RTEMS_SCORE_APIMUTEX_H #define _RTEMS_SCORE_APIMUTEX_H -#include <rtems/score/coremutex.h> -#include <rtems/score/object.h> +#include <rtems/score/thread.h> + +#include <sys/lock.h> /** * @defgroup ScoreAPIMutex API Mutex Handler @@ -39,14 +40,9 @@ extern "C" { */ typedef struct { /** - * @brief Allows each API Mutex to be a full-fledged RTEMS object. - */ - Objects_Control Object; - - /** - * Contains the SuperCore mutex information. + * A recursive mutex. */ - CORE_recursive_mutex_Control Mutex; + struct _Mutex_recursive_Control Mutex; /** * @brief The thread life protection state before the outer-most mutex @@ -56,20 +52,10 @@ typedef struct { } API_Mutex_Control; /** - * @brief Initialization for the API Mutexe Handler. - * - * The value @a maximum_mutexes is the maximum number of API mutexes that may - * exist at any time. - * - * @param[in] maximum_mutexes is the maximum number of API mutexes. + * @brief Statically initialize an API mutex. */ -void _API_Mutex_Initialization( uint32_t maximum_mutexes ); - -/** - * @brief Allocates an API mutex from the inactive set and returns it in - * @a mutex. - */ -void _API_Mutex_Allocate( API_Mutex_Control **mutex ); +#define API_MUTEX_INITIALIZER( name ) \ + { _MUTEX_RECURSIVE_NAMED_INITIALIZER( name ), 0 } /** * @brief Acquires the specified API mutex. @@ -107,40 +93,11 @@ bool _API_Mutex_Is_owner( const API_Mutex_Control *mutex ); */ /**@{**/ -/** - * @brief Memory allocation mutex. - * - * This points to the API Mutex instance used to ensure that only - * one thread at a time is allocating or freeing memory. - */ -extern API_Mutex_Control *_RTEMS_Allocator_Mutex; - -static inline void _RTEMS_Lock_allocator( void ) -{ - _API_Mutex_Lock( _RTEMS_Allocator_Mutex ); -} - -static inline void _RTEMS_Unlock_allocator( void ) -{ - _API_Mutex_Unlock( _RTEMS_Allocator_Mutex ); -} +void _RTEMS_Lock_allocator( void ); -static inline bool _RTEMS_Allocator_is_owner( void ) -{ - return _API_Mutex_Is_owner( _RTEMS_Allocator_Mutex ); -} - -extern API_Mutex_Control *_Once_Mutex; +void _RTEMS_Unlock_allocator( void ); -static inline void _Once_Lock( void ) -{ - _API_Mutex_Lock( _Once_Mutex ); -} - -static inline void _Once_Unlock( void ) -{ - _API_Mutex_Unlock( _Once_Mutex ); -} +bool _RTEMS_Allocator_is_owner( void ); /** @} */ diff --git a/cpukit/score/include/rtems/score/assert.h b/cpukit/score/include/rtems/score/assert.h index c61c0a0399..d4432838ce 100644 --- a/cpukit/score/include/rtems/score/assert.h +++ b/cpukit/score/include/rtems/score/assert.h @@ -101,14 +101,6 @@ extern "C" { bool _Debug_Is_thread_dispatching_allowed( void ); #endif -/** - * @brief Returns true if the current thread of execution owns the allocator - * mutex. - */ -#if defined( RTEMS_DEBUG ) - bool _Debug_Is_owner_of_allocator( void ); -#endif - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/cpukit/score/include/rtems/score/objectimpl.h b/cpukit/score/include/rtems/score/objectimpl.h index 0338a481ea..cc5820785c 100644 --- a/cpukit/score/include/rtems/score/objectimpl.h +++ b/cpukit/score/include/rtems/score/objectimpl.h @@ -49,12 +49,11 @@ typedef bool (*Objects_Name_comparators)( */ typedef enum { OBJECTS_INTERNAL_NO_CLASS = 0, - OBJECTS_INTERNAL_THREADS = 1, - OBJECTS_INTERNAL_MUTEXES = 2 + OBJECTS_INTERNAL_THREADS = 1 } Objects_Internal_API; /** This macro is used to generically specify the last API index. */ -#define OBJECTS_INTERNAL_CLASSES_LAST OBJECTS_INTERNAL_MUTEXES +#define OBJECTS_INTERNAL_CLASSES_LAST OBJECTS_INTERNAL_THREADS /** * This enumerated type is used in the class field of the object ID diff --git a/cpukit/score/include/rtems/score/onceimpl.h b/cpukit/score/include/rtems/score/onceimpl.h index 21e9edade5..60f1378506 100644 --- a/cpukit/score/include/rtems/score/onceimpl.h +++ b/cpukit/score/include/rtems/score/onceimpl.h @@ -39,6 +39,10 @@ extern "C" { int _Once( unsigned char *once_state, void (*init_routine)(void) ); +void _Once_Lock( void ); + +void _Once_Unlock( void ); + /** @} */ #ifdef __cplusplus diff --git a/cpukit/score/include/rtems/score/todimpl.h b/cpukit/score/include/rtems/score/todimpl.h index e3a1a8f58c..b00ab6cca2 100644 --- a/cpukit/score/include/rtems/score/todimpl.h +++ b/cpukit/score/include/rtems/score/todimpl.h @@ -19,7 +19,6 @@ #define _RTEMS_SCORE_TODIMPL_H #include <rtems/score/tod.h> -#include <rtems/score/apimutex.h> #include <rtems/score/timestamp.h> #include <rtems/score/timecounterimpl.h> #include <rtems/score/watchdog.h> @@ -143,16 +142,13 @@ typedef struct { extern TOD_Control _TOD; -static inline void _TOD_Lock( void ) -{ - /* FIXME: https://devel.rtems.org/ticket/2630 */ - _API_Mutex_Lock( _Once_Mutex ); -} +void _TOD_Lock( void ); -static inline void _TOD_Unlock( void ) -{ - _API_Mutex_Unlock( _Once_Mutex ); -} +void _TOD_Unlock( void ); + +#if defined(RTEMS_DEBUG) +bool _TOD_Is_owner( void ); +#endif static inline void _TOD_Acquire( ISR_lock_Context *lock_context ) { |