mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-25 13:57:15 +00:00
score: Add and use _Per_CPU_Is_ISR_in_progress()
Add _Per_CPU_Is_ISR_in_progress() as an optimized version of _ISR_Is_in_progress().
This commit is contained in:
@@ -147,18 +147,6 @@ void _ISR_Handler_initialization ( void );
|
||||
*/
|
||||
void _ISR_Handler( void );
|
||||
|
||||
/**
|
||||
* @brief Checks if an ISR in progress.
|
||||
*
|
||||
* This function returns true if the processor is currently servicing
|
||||
* and interrupt and false otherwise. A return value of true indicates
|
||||
* that the caller is an interrupt service routine, NOT a thread.
|
||||
*
|
||||
* @retval true Returns true when called from an ISR.
|
||||
* @retval false Returns false when not called from an ISR.
|
||||
*/
|
||||
bool _ISR_Is_in_progress( void );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -144,6 +144,17 @@ typedef uint32_t ISR_Level;
|
||||
RTEMS_COMPILER_MEMORY_BARRIER(); \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* @brief Checks if an ISR in progress.
|
||||
*
|
||||
* This function returns true, if the processor is currently servicing
|
||||
* and interrupt, and false otherwise. A return value of true indicates
|
||||
* that the caller is an interrupt service routine, **not** a thread.
|
||||
*
|
||||
* @return true Returns true, if called from within an ISR, otherwise false.
|
||||
*/
|
||||
bool _ISR_Is_in_progress( void );
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -683,6 +683,16 @@ static inline struct _Thread_Control *_Per_CPU_Get_executing(
|
||||
return cpu->executing;
|
||||
}
|
||||
|
||||
static inline bool _Per_CPU_Is_ISR_in_progress( const Per_CPU_Control *cpu )
|
||||
{
|
||||
#if CPU_PROVIDES_ISR_IS_IN_PROGRESS == TRUE
|
||||
(void) cpu;
|
||||
return _ISR_Is_in_progress();
|
||||
#else
|
||||
return cpu->isr_nest_level != 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool _Per_CPU_Is_processor_online(
|
||||
const Per_CPU_Control *cpu
|
||||
)
|
||||
|
||||
@@ -538,7 +538,7 @@ Status_Control _Thread_Restart(
|
||||
|
||||
if (
|
||||
the_thread == _Per_CPU_Get_executing( cpu_self ) &&
|
||||
!_ISR_Is_in_progress()
|
||||
!_Per_CPU_Is_ISR_in_progress( cpu_self )
|
||||
) {
|
||||
ignored_life_states = THREAD_LIFE_PROTECTED | THREAD_LIFE_CHANGE_DEFERRED;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user