summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2015-04-16 11:23:29 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2015-04-16 11:36:48 +0200
commite98df4d8d03299ded58427ec6b22b2e409af5865 (patch)
tree2b5672956b25ce6f0c97b216c1141ab3395f06b9
parentscore: Add const qualifier (diff)
downloadrtems-e98df4d8d03299ded58427ec6b22b2e409af5865.tar.bz2
score: Add _ISR_lock_Flash()
-rw-r--r--cpukit/score/include/rtems/score/isrlock.h31
-rw-r--r--testsuites/sptests/sp37/init.c2
2 files changed, 33 insertions, 0 deletions
diff --git a/cpukit/score/include/rtems/score/isrlock.h b/cpukit/score/include/rtems/score/isrlock.h
index d716b3898e..8449d5d64f 100644
--- a/cpukit/score/include/rtems/score/isrlock.h
+++ b/cpukit/score/include/rtems/score/isrlock.h
@@ -273,6 +273,37 @@ typedef struct {
#define _ISR_lock_Release( _lock, _context )
#endif
+/**
+ * @brief Flashes an ISR lock.
+ *
+ * On uni-processor configurations this a simple _ISR_Flash(). On SMP
+ * configurations this function releases an SMP lock, restores the interrupt
+ * status, then disables interrupts and acquires the SMP lock again.
+ *
+ * This function can be used in thread and interrupt context.
+ *
+ * @param[in] _lock The ISR lock control.
+ * @param[in] _context The local ISR lock context for an acquire and release
+ * pair.
+ *
+ * @see _ISR_lock_ISR_disable_and_acquire() and
+ * _ISR_lock_Release_and_ISR_enable().
+ */
+#if defined( RTEMS_SMP )
+ #define _ISR_lock_Flash( _lock, _context ) \
+ _SMP_lock_Release_and_ISR_enable( \
+ &( _lock )->Lock, \
+ &( _context )->Lock_context \
+ ); \
+ _SMP_lock_ISR_disable_and_acquire( \
+ &( _lock )->Lock, \
+ &( _context )->Lock_context \
+ )
+#else
+ #define _ISR_lock_Flash( _lock, _context ) \
+ _ISR_Flash( ( _context )->isr_level )
+#endif
+
/** @} */
#ifdef __cplusplus
diff --git a/testsuites/sptests/sp37/init.c b/testsuites/sptests/sp37/init.c
index f838f310a2..e8c415d5a7 100644
--- a/testsuites/sptests/sp37/init.c
+++ b/testsuites/sptests/sp37/init.c
@@ -179,6 +179,8 @@ static void test_isr_locks( void )
_ISR_lock_ISR_disable_and_acquire( &lock, &lock_context );
rtems_test_assert( normal_interrupt_level != _ISR_Get_level() );
+ _ISR_lock_Flash( &lock, &lock_context );
+ rtems_test_assert( normal_interrupt_level != _ISR_Get_level() );
_ISR_lock_Release_and_ISR_enable( &lock, &lock_context );
rtems_test_assert( normal_interrupt_level == _ISR_Get_level() );