diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-03-10 08:25:32 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-03-11 10:58:09 +0100 |
commit | d50acdbb6c8213114ce887a56daea02697c9e1a1 (patch) | |
tree | e48fb252786992308fa2dd6337c8a02db35bd10b /cpukit/rtems/include/rtems/rtems/intr.h | |
parent | sapi: Use one SMP lock for all chains (diff) | |
download | rtems-d50acdbb6c8213114ce887a56daea02697c9e1a1.tar.bz2 |
score: Add local context to SMP lock API
Add a local context structure to the SMP lock API for acquire and
release pairs. This context can be used to store the ISR level and
profiling information. It may be later used to enable more
sophisticated lock algorithms, e.g. MCS locks.
There is only one lock that cannot be used with a local context. This
is the per-CPU lock since here we would have to transfer the local
context through a context switch which is very complicated.
Diffstat (limited to '')
-rw-r--r-- | cpukit/rtems/include/rtems/rtems/intr.h | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/cpukit/rtems/include/rtems/rtems/intr.h b/cpukit/rtems/include/rtems/rtems/intr.h index a98d0bef0e..62d2dad25a 100644 --- a/cpukit/rtems/include/rtems/rtems/intr.h +++ b/cpukit/rtems/include/rtems/rtems/intr.h @@ -160,6 +160,11 @@ rtems_status_code rtems_interrupt_catch( typedef ISR_lock_Control rtems_interrupt_lock; /** + * @brief Local interrupt lock context for acquire and release pairs. + */ +typedef ISR_lock_Context rtems_interrupt_lock_context; + +/** * @brief Initializer for static initialization of interrupt locks. */ #define RTEMS_INTERRUPT_LOCK_INITIALIZER ISR_LOCK_INITIALIZER @@ -183,12 +188,13 @@ typedef ISR_lock_Control rtems_interrupt_lock; * This function can be used in thread and interrupt context. * * @param[in,out] _lock The interrupt lock. - * @param[out] _isr_cookie The interrupt status to restore will be returned. + * @param[in,out] _lock_context The local interrupt lock context for an acquire + * and release pair. * * @see rtems_interrupt_lock_release(). */ -#define rtems_interrupt_lock_acquire( _lock, _isr_cookie ) \ - _ISR_lock_ISR_disable_and_acquire( _lock, _isr_cookie ) +#define rtems_interrupt_lock_acquire( _lock, _lock_context ) \ + _ISR_lock_ISR_disable_and_acquire( _lock, _lock_context ) /** * @brief Releases an interrupt lock. @@ -199,12 +205,13 @@ typedef ISR_lock_Control rtems_interrupt_lock; * This function can be used in thread and interrupt context. * * @param[in,out] _lock The interrupt lock. - * @param[in] _isr_cookie The interrupt status to restore. + * @param[in,out] _lock_context The local interrupt lock context for an acquire + * and release pair. * * @see rtems_interrupt_lock_acquire(). */ -#define rtems_interrupt_lock_release( _lock, _isr_cookie ) \ - _ISR_lock_Release_and_ISR_enable( _lock, _isr_cookie ) +#define rtems_interrupt_lock_release( _lock, _lock_context ) \ + _ISR_lock_Release_and_ISR_enable( _lock, _lock_context ) /** * @brief Acquires an interrupt lock in the corresponding interrupt service @@ -218,11 +225,13 @@ typedef ISR_lock_Control rtems_interrupt_lock; * protected by this lock, then the result is unpredictable. * * @param[in,out] _lock The interrupt lock. + * @param[in,out] _lock_context The local interrupt lock context for an acquire + * and release pair. * * @see rtems_interrupt_lock_release_isr(). */ -#define rtems_interrupt_lock_acquire_isr( _lock ) \ - _ISR_lock_Acquire( _lock ) +#define rtems_interrupt_lock_acquire_isr( _lock, _lock_context ) \ + _ISR_lock_Acquire( _lock, _lock_context ) /** * @brief Releases an interrupt lock in the corresponding interrupt service @@ -232,11 +241,13 @@ typedef ISR_lock_Control rtems_interrupt_lock; * function releases an SMP lock. * * @param[in,out] _lock The interrupt lock. + * @param[in,out] _lock_context The local interrupt lock context for an acquire + * and release pair. * * @see rtems_interrupt_lock_acquire_isr(). */ -#define rtems_interrupt_lock_release_isr( _lock ) \ - _ISR_lock_Release( _lock ) +#define rtems_interrupt_lock_release_isr( _lock, _lock_context ) \ + _ISR_lock_Release( _lock, _lock_context ) /** @} */ |