mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-20 22:14:29 +08:00
score: Move default _ISR_Is_in_progress()
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#define _RTEMS_SCORE_ISR_H
|
||||
|
||||
#include <rtems/score/isrlevel.h>
|
||||
#include <rtems/score/percpu.h>
|
||||
|
||||
/**
|
||||
* @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
|
||||
}
|
||||
|
||||
@@ -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@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
|
||||
Reference in New Issue
Block a user