20 #ifndef _RTEMS_SCORE_SMPLOCK_H 21 #define _RTEMS_SCORE_SMPLOCK_H 23 #include <rtems/score/cpuopts.h> 43 #if defined(RTEMS_SMP) 49 #if defined(RTEMS_DEBUG) 58 #if defined(RTEMS_DEBUG) || defined(RTEMS_PROFILING) 59 #define RTEMS_SMP_LOCK_DO_NOT_INLINE 67 #if defined(RTEMS_DEBUG) 82 #if defined(RTEMS_PROFILING) 92 #if defined(RTEMS_DEBUG) 95 #if defined(RTEMS_PROFILING) 96 SMP_lock_Stats_context Stats_context;
100 #if defined(RTEMS_DEBUG) 101 #define SMP_LOCK_NO_OWNER 0 107 #if defined(RTEMS_DEBUG) && defined(RTEMS_PROFILING) 108 #define SMP_LOCK_INITIALIZER( name ) \ 110 SMP_TICKET_LOCK_INITIALIZER, \ 112 SMP_LOCK_STATS_INITIALIZER( name ) \ 114 #elif defined(RTEMS_DEBUG) 115 #define SMP_LOCK_INITIALIZER( name ) \ 116 { SMP_TICKET_LOCK_INITIALIZER, SMP_LOCK_NO_OWNER } 117 #elif defined(RTEMS_PROFILING) 118 #define SMP_LOCK_INITIALIZER( name ) \ 119 { SMP_TICKET_LOCK_INITIALIZER, SMP_LOCK_STATS_INITIALIZER( name ) } 121 #define SMP_LOCK_INITIALIZER( name ) { SMP_TICKET_LOCK_INITIALIZER } 135 #if defined(RTEMS_DEBUG) 136 lock->owner = SMP_LOCK_NO_OWNER;
138 #if defined(RTEMS_PROFILING) 139 _SMP_lock_Stats_initialize( &lock->Stats, name );
154 #if defined(RTEMS_SMP_LOCK_DO_NOT_INLINE) 160 #define _SMP_lock_Initialize( lock, name ) \ 161 _SMP_lock_Initialize_inline( lock, name ) 172 _SMP_lock_Stats_destroy( &lock->Stats );
182 #if defined(RTEMS_SMP_LOCK_DO_NOT_INLINE) 185 #define _SMP_lock_Destroy( lock ) \ 186 _SMP_lock_Destroy_inline( lock ) 201 #if defined(RTEMS_PROFILING) 202 lock->Stats.name = name;
213 #if defined(RTEMS_DEBUG) 214 static inline uint32_t _SMP_lock_Who_am_I(
void )
220 return _SMP_Get_current_processor() + 1;
235 #if defined(RTEMS_DEBUG) 236 context->lock_used_for_acquire = lock;
243 &context->Stats_context
245 #if defined(RTEMS_DEBUG) 246 lock->owner = _SMP_lock_Who_am_I();
277 #if defined(RTEMS_DEBUG) 278 _Assert( context->lock_used_for_acquire == lock );
279 context->lock_used_for_acquire = NULL;
280 _Assert( lock->owner == _SMP_lock_Who_am_I() );
281 lock->owner = SMP_LOCK_NO_OWNER;
287 &context->Stats_context
298 #if defined(RTEMS_SMP_LOCK_DO_NOT_INLINE) 304 #define _SMP_lock_Release( lock, context ) \ 305 _SMP_lock_Release_inline( lock, context ) 357 #if defined(RTEMS_SMP_LOCK_DO_NOT_INLINE) 363 #define _SMP_lock_Release_and_ISR_enable( lock, context ) \ 364 _SMP_lock_Release_and_ISR_enable_inline( lock, context ) 367 #if defined(RTEMS_DEBUG) #define _SMP_ticket_lock_Acquire(lock, stats, stats_context)
Acquires an SMP ticket lock.
#define _ISR_Local_disable(_level)
Disables interrupts on this processor.
Local SMP lock context for acquire and release pairs.
static void _SMP_lock_Initialize_inline(SMP_lock_Control *lock, const char *name)
Initializes the SMP lock with the given name.
static void _SMP_ticket_lock_Initialize(SMP_ticket_lock_Control *lock)
Initializes the SMP ticket lock.
static void _SMP_lock_Release_and_ISR_enable_inline(SMP_lock_Control *lock, SMP_lock_Context *context)
Releases the SMP lock and enables interrupts.
static void _SMP_lock_Destroy_inline(SMP_lock_Control *lock)
Destroys the SMP lock.
SuperCore SMP Support API.
void _SMP_lock_Acquire(SMP_lock_Control *lock, SMP_lock_Context *context)
Acquires an SMP lock.
Information for the Assert Handler.
#define _SMP_lock_Release_and_ISR_enable(lock, context)
Releases the SMP lock and enables interrupts.
#define _SMP_ticket_lock_Release(lock, stats_context)
Releases an SMP ticket lock.
static void _SMP_lock_Release_inline(SMP_lock_Control *lock, SMP_lock_Context *context)
Releases an SMP lock.
#define _ISR_Local_enable(_level)
Enables interrupts on this processor.
static void _SMP_lock_ISR_disable_and_acquire_inline(SMP_lock_Control *lock, SMP_lock_Context *context)
Disables interrupts and acquires the SMP lock.
void _SMP_lock_ISR_disable_and_acquire(SMP_lock_Control *lock, SMP_lock_Context *context)
Disables interrupts and acquires the SMP lock.
static void _SMP_ticket_lock_Destroy(SMP_ticket_lock_Control *lock)
Destroys the SMP ticket lock.
#define _SMP_lock_Release(lock, context)
Releases an SMP lock.
#define _SMP_lock_Destroy(lock)
Destroys an SMP lock.
#define _SMP_lock_Initialize(lock, name)
Initializes an SMP lock.
static void _SMP_lock_Acquire_inline(SMP_lock_Control *lock, SMP_lock_Context *context)
Gets my index.
#define _Assert(_e)
Assertion similar to assert() controlled via RTEMS_DEBUG instead of NDEBUG.
static void _SMP_lock_Set_name(SMP_lock_Control *lock, const char *name)
Sets the name of an SMP lock.