[PATCH 1/7] score: Move default _ISR_Is_in_progress()

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Jun 25 13:17:11 UTC 2015


---
 cpukit/score/Makefile.am               |  1 +
 cpukit/score/include/rtems/score/isr.h | 36 +-----------------------
 cpukit/score/src/isrisinprogress.c     | 51 ++++++++++++++++++++++++++++++++++
 3 files changed, 53 insertions(+), 35 deletions(-)
 create mode 100644 cpukit/score/src/isrisinprogress.c

diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
index 3b2c5bc..3e612d4 100644
--- a/cpukit/score/Makefile.am
+++ b/cpukit/score/Makefile.am
@@ -342,6 +342,7 @@ libscore_a_SOURCES += src/apiext.c src/chain.c src/chainappend.c \
     src/chainnodecount.c \
     src/debugisthreaddispatchingallowed.c \
     src/interr.c src/isr.c src/wkspace.c src/wkstringduplicate.c
+libscore_a_SOURCES += src/isrisinprogress.c
 libscore_a_SOURCES += src/debugisownerofallocator.c
 libscore_a_SOURCES += src/profilingisrentryexit.c
 libscore_a_SOURCES += src/once.c
diff --git a/cpukit/score/include/rtems/score/isr.h b/cpukit/score/include/rtems/score/isr.h
index dcb25e1..f76cbcb 100644
--- a/cpukit/score/include/rtems/score/isr.h
+++ b/cpukit/score/include/rtems/score/isr.h
@@ -22,7 +22,6 @@
 #define _RTEMS_SCORE_ISR_H
 
 #include <rtems/score/isrlevel.h>
-#include <rtems/score/percpu.h>
 
 /**
  *  @defgroup ScoreISR ISR Handler
@@ -136,34 +135,6 @@ 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_without_giant( level );
-  #endif
-
-  isr_nest_level = _ISR_Nest_level;
-
-  #if defined( RTEMS_SMP )
-    _ISR_Enable_without_giant( level );
-  #endif
-
-  return isr_nest_level;
-}
-
-/**
  *  @brief Checks if an ISR in progress.
  *
  *  This function returns true if the processor is currently servicing
@@ -172,12 +143,7 @@ RTEMS_INLINE_ROUTINE uint32_t _ISR_Get_nest_level( void )
  *
  *  @retval This methods returns true when called from an ISR.
  */
-#if (CPU_PROVIDES_ISR_IS_IN_PROGRESS == TRUE)
-  bool _ISR_Is_in_progress( void );
-#else
-  #define _ISR_Is_in_progress() \
-          (_ISR_Get_nest_level() != 0)
-#endif
+bool _ISR_Is_in_progress( void );
 
 #ifdef __cplusplus
 }
diff --git a/cpukit/score/src/isrisinprogress.c b/cpukit/score/src/isrisinprogress.c
new file mode 100644
index 0000000..7607cfe
--- /dev/null
+++ b/cpukit/score/src/isrisinprogress.c
@@ -0,0 +1,51 @@
+/**
+ * @file
+ *
+ * @ingroup ScoreISR
+ *
+ * @brief ISR Is In Progress Default Implementation
+ */
+
+/*
+ * Copyright (c) 2013-2015 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Dornierstr. 4
+ *  82178 Puchheim
+ *  Germany
+ *  <rtems at embedded-brains.de>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#if HAVE_CONFIG_H
+  #include "config.h"
+#endif
+
+#include <rtems/score/isr.h>
+#include <rtems/score/percpu.h>
+
+#if CPU_PROVIDES_ISR_IS_IN_PROGRESS == FALSE
+
+bool _ISR_Is_in_progress( void )
+{
+  uint32_t isr_nest_level;
+
+  #if defined( RTEMS_SMP )
+    ISR_Level level;
+
+    _ISR_Disable_without_giant( level );
+  #endif
+
+  isr_nest_level = _ISR_Nest_level;
+
+  #if defined( RTEMS_SMP )
+    _ISR_Enable_without_giant( level );
+  #endif
+
+  return isr_nest_level != 0;
+}
+
+#endif
-- 
1.8.4.5



More information about the devel mailing list