diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-09 06:49:53 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-12 13:20:34 +0200 |
commit | 1a9d36b921306eaef671127f281500945f287822 (patch) | |
tree | 136a5da705ae644025823f77e724c7c02c58624f /cpukit/score/src/smplock.c | |
parent | score: Fix CORE mutex initialization (diff) | |
download | rtems-1a9d36b921306eaef671127f281500945f287822.tar.bz2 |
score: Add _ISR_lock_Is_owner()
Diffstat (limited to 'cpukit/score/src/smplock.c')
-rw-r--r-- | cpukit/score/src/smplock.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/cpukit/score/src/smplock.c b/cpukit/score/src/smplock.c index 14400917ef..35b1930a1a 100644 --- a/cpukit/score/src/smplock.c +++ b/cpukit/score/src/smplock.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 embedded brains GmbH. All rights reserved. + * Copyright (c) 2015, 2016 embedded brains GmbH. All rights reserved. * * embedded brains GmbH * Dornierstr. 4 @@ -17,6 +17,8 @@ #endif #include <rtems/score/smplock.h> +#include <rtems/score/assert.h> +#include <rtems/score/smp.h> #if defined(RTEMS_SMP_LOCK_DO_NOT_INLINE) @@ -39,6 +41,9 @@ void _SMP_lock_Acquire( ) { _SMP_lock_Acquire_body( lock, context ); +#if defined(RTEMS_DEBUG) + lock->owner = _SMP_Get_current_processor(); +#endif } void _SMP_lock_Release( @@ -46,6 +51,10 @@ void _SMP_lock_Release( SMP_lock_Context *context ) { +#if defined(RTEMS_DEBUG) + _Assert( lock->owner == _SMP_Get_current_processor() ); + lock->owner = SMP_LOCK_NO_OWNER; +#endif _SMP_lock_Release_body( lock, context ); } @@ -55,6 +64,9 @@ void _SMP_lock_ISR_disable_and_acquire( ) { _SMP_lock_ISR_disable_and_acquire_body( lock, context ); +#if defined(RTEMS_DEBUG) + lock->owner = _SMP_Get_current_processor(); +#endif } void _SMP_lock_Release_and_ISR_enable( @@ -62,7 +74,18 @@ void _SMP_lock_Release_and_ISR_enable( SMP_lock_Context *context ) { +#if defined(RTEMS_DEBUG) + _Assert( lock->owner == _SMP_Get_current_processor() ); + lock->owner = SMP_LOCK_NO_OWNER; +#endif _SMP_lock_Release_and_ISR_enable_body( lock, context ); } +#if defined(RTEMS_DEBUG) +bool _SMP_lock_Is_owner( const SMP_lock_Control *lock ) +{ + return lock->owner == _SMP_Get_current_processor(); +} +#endif + #endif /* defined(RTEMS_SMP_LOCK_DO_NOT_INLINE) */ |