From 0b268b8bdb6c14bc6020b6f0450446fdafc4ae06 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 25 Jun 2015 13:37:40 +0200 Subject: score: Move default _ISR_Is_in_progress() --- 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 3b2c5bce15..3e612d4cf8 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 dcb25e1dff..f76cbcbda8 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 -#include /** * @defgroup ScoreISR ISR Handler @@ -135,34 +134,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. * @@ -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 0000000000..7607cfe436 --- /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 + * + * + * 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 +#include + +#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 -- cgit v1.2.3