summaryrefslogtreecommitdiffstats
path: root/cpukit/include/rtems/score/isrlock.h
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2019-01-18 13:16:29 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2019-01-18 13:33:18 +0100
commit41310c026ca3869adbbe4962474c596ab92b3e5c (patch)
tree146406a85cb55cfc725f98b22a8f772e7cc3525a /cpukit/include/rtems/score/isrlock.h
parentscore: Avoid internal API and use ISR lock (diff)
downloadrtems-41310c026ca3869adbbe4962474c596ab92b3e5c.tar.bz2
score: Improve debug support for ISR locks
Ensure that interrupts are disabled while acquiring an ISR lock.
Diffstat (limited to 'cpukit/include/rtems/score/isrlock.h')
-rw-r--r--cpukit/include/rtems/score/isrlock.h32
1 files changed, 19 insertions, 13 deletions
diff --git a/cpukit/include/rtems/score/isrlock.h b/cpukit/include/rtems/score/isrlock.h
index 7dd2f29000..0f01bc5109 100644
--- a/cpukit/include/rtems/score/isrlock.h
+++ b/cpukit/include/rtems/score/isrlock.h
@@ -7,7 +7,7 @@
*/
/*
- * Copyright (c) 2013-2015 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2013, 2019 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Dornierstr. 4
@@ -267,13 +267,16 @@ RTEMS_INLINE_ROUTINE void _ISR_lock_Context_set_level(
*/
#if defined( RTEMS_SMP )
#define _ISR_lock_Acquire( _lock, _context ) \
- _SMP_lock_Acquire( \
- &( _lock )->Lock, \
- &( _context )->Lock_context \
- )
+ do { \
+ _Assert( _ISR_Get_level() != 0 ); \
+ _SMP_lock_Acquire( \
+ &( _lock )->Lock, \
+ &( _context )->Lock_context \
+ ); \
+ } while ( 0 )
#else
#define _ISR_lock_Acquire( _lock, _context ) \
- (void) _context;
+ do { (void) _context; } while ( 0 )
#endif
/**
@@ -296,7 +299,7 @@ RTEMS_INLINE_ROUTINE void _ISR_lock_Context_set_level(
)
#else
#define _ISR_lock_Release( _lock, _context ) \
- (void) _context;
+ do { (void) _context; } while ( 0 )
#endif
/**
@@ -306,13 +309,16 @@ RTEMS_INLINE_ROUTINE void _ISR_lock_Context_set_level(
*/
#if defined( RTEMS_SMP )
#define _ISR_lock_Acquire_inline( _lock, _context ) \
- _SMP_lock_Acquire_inline( \
- &( _lock )->Lock, \
- &( _context )->Lock_context \
- )
+ do { \
+ _Assert( _ISR_Get_level() != 0 ); \
+ _SMP_lock_Acquire_inline( \
+ &( _lock )->Lock, \
+ &( _context )->Lock_context \
+ ); \
+ } while ( 0 )
#else
#define _ISR_lock_Acquire_inline( _lock, _context ) \
- (void) _context;
+ do { (void) _context; } while ( 0 )
#endif
/**
@@ -328,7 +334,7 @@ RTEMS_INLINE_ROUTINE void _ISR_lock_Context_set_level(
)
#else
#define _ISR_lock_Release_inline( _lock, _context ) \
- (void) _context;
+ do { (void) _context; } while ( 0 )
#endif
#if defined( RTEMS_DEBUG )