From 408609f6b9cd8e03d3886b7c150efbf7e59b5fb0 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 10 Nov 2016 15:17:28 +0100 Subject: score: Add _ISR_Is_enabled() In contrast to _ISR_Get_level() the _ISR_Is_enabled() function evaluates a level parameter and returns a boolean value. Update #2811. --- cpukit/score/cpu/nios2/nios2-isr-get-level.c | 12 ++++++++++++ cpukit/score/cpu/nios2/rtems/score/cpu.h | 2 ++ 2 files changed, 14 insertions(+) (limited to 'cpukit/score/cpu/nios2') diff --git a/cpukit/score/cpu/nios2/nios2-isr-get-level.c b/cpukit/score/cpu/nios2/nios2-isr-get-level.c index 498bc791ef..7c7f6a2b71 100644 --- a/cpukit/score/cpu/nios2/nios2-isr-get-level.c +++ b/cpukit/score/cpu/nios2/nios2-isr-get-level.c @@ -19,6 +19,18 @@ #include #include +bool _CPU_ISR_Is_enabled( uint32_t level ) +{ + switch ( _Nios2_ISR_Get_status_mask() ) { + case NIOS2_ISR_STATUS_MASK_EIC_IL: + return ((status & NIOS2_STATUS_IL_MASK) >> NIOS2_STATUS_IL_OFFSET) == 0; + case NIOS2_ISR_STATUS_MASK_EIC_RSIE: + return (status & NIOS2_STATUS_RSIE) != 0; + default: + return (status & NIOS2_STATUS_PIE) != 0; + } +} + uint32_t _CPU_ISR_Get_level( void ) { uint32_t status = _Nios2_Get_ctlreg_status(); diff --git a/cpukit/score/cpu/nios2/rtems/score/cpu.h b/cpukit/score/cpu/nios2/rtems/score/cpu.h index b1defd2ef9..1e9b7b3801 100644 --- a/cpukit/score/cpu/nios2/rtems/score/cpu.h +++ b/cpukit/score/cpu/nios2/rtems/score/cpu.h @@ -241,6 +241,8 @@ typedef struct { __builtin_wrctl( 0, _status ); \ } while ( 0 ) +bool _CPU_ISR_Is_enabled( uint32_t level ); + /** * @brief Sets the interrupt level for the executing thread. * -- cgit v1.2.3