summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2013-07-18 09:02:53 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2013-07-22 16:46:01 +0200
commit0bbd8fdce2106ecb63953444fc3da38aa348fb34 (patch)
treea66d2765223857b1565f8caeade5127225433e53 /cpukit/score/include
parentscore: Move ISR catch support functions (diff)
downloadrtems-0bbd8fdce2106ecb63953444fc3da38aa348fb34.tar.bz2
score: Add and use _ISR_Get_nest_level()
Diffstat (limited to 'cpukit/score/include')
-rw-r--r--cpukit/score/include/rtems/score/isr.h32
1 files changed, 30 insertions, 2 deletions
diff --git a/cpukit/score/include/rtems/score/isr.h b/cpukit/score/include/rtems/score/isr.h
index d17491261c..0c2abe65bc 100644
--- a/cpukit/score/include/rtems/score/isr.h
+++ b/cpukit/score/include/rtems/score/isr.h
@@ -21,8 +21,8 @@
#ifndef _RTEMS_SCORE_ISR_H
#define _RTEMS_SCORE_ISR_H
-#include <rtems/score/cpu.h>
#include <rtems/score/isrlevel.h>
+#include <rtems/score/percpu.h>
/**
* @defgroup ScoreISR ISR Handler
@@ -178,6 +178,34 @@ void _ISR_Handler( void );
void _ISR_Dispatch( void );
/**
+ * @brief Returns the current ISR nest level
+ *
+ * This function can be called in any context. On SMP configurations
+ * interrupts are disabled to ensure that the processor index is used
+ * consistently.
+ *
+ * @return The current ISR nest level.
+ */
+RTEMS_INLINE_ROUTINE uint32_t _ISR_Get_nest_level( void )
+{
+ uint32_t isr_nest_level;
+
+ #if defined( RTEMS_SMP )
+ ISR_Level level;
+
+ _ISR_Disable( level );
+ #endif
+
+ isr_nest_level = _ISR_Nest_level;
+
+ #if defined( RTEMS_SMP )
+ _ISR_Enable( level );
+ #endif
+
+ return isr_nest_level;
+}
+
+/**
* @brief Checks if an ISR in progress.
*
* This function returns true if the processor is currently servicing
@@ -190,7 +218,7 @@ void _ISR_Dispatch( void );
bool _ISR_Is_in_progress( void );
#else
#define _ISR_Is_in_progress() \
- (_ISR_Nest_level != 0)
+ (_ISR_Get_nest_level() != 0)
#endif
#ifdef __cplusplus