summaryrefslogtreecommitdiffstats
path: root/cpukit/score/cpu/nios2
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-11-10 15:17:28 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-11-18 07:30:35 +0100
commit408609f6b9cd8e03d3886b7c150efbf7e59b5fb0 (patch)
tree0c4ec2f82334c0efb93f1222e4ee80a6ada166ce /cpukit/score/cpu/nios2
parentscore: Restrict task interrupt level to 0 on SMP (diff)
downloadrtems-408609f6b9cd8e03d3886b7c150efbf7e59b5fb0.tar.bz2
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.
Diffstat (limited to 'cpukit/score/cpu/nios2')
-rw-r--r--cpukit/score/cpu/nios2/nios2-isr-get-level.c12
-rw-r--r--cpukit/score/cpu/nios2/rtems/score/cpu.h2
2 files changed, 14 insertions, 0 deletions
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 <rtems/score/interr.h>
#include <rtems/score/nios2-utility.h>
+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.
*