summaryrefslogtreecommitdiffstats
path: root/cpukit/include/rtems/rtems/modesimpl.h
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-02-16 10:27:03 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-02-20 15:18:49 +0100
commit8778a0e1188ee00932ce47d410de54c4e053f3bf (patch)
tree0b13db8c7cd801c83df772e54e21a1828329814e /cpukit/include/rtems/rtems/modesimpl.h
parentrtems: Remove _Modes_Set_interrupt_level() (diff)
downloadrtems-8778a0e1188ee00932ce47d410de54c4e053f3bf.tar.bz2
rtems: New errors for rtems_signal_catch()
Ensure that no invalid modes are set during ASR processing. Update #4244.
Diffstat (limited to '')
-rw-r--r--cpukit/include/rtems/rtems/modesimpl.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/cpukit/include/rtems/rtems/modesimpl.h b/cpukit/include/rtems/rtems/modesimpl.h
index 2b5e00f600..9a2c6e1013 100644
--- a/cpukit/include/rtems/rtems/modesimpl.h
+++ b/cpukit/include/rtems/rtems/modesimpl.h
@@ -19,6 +19,9 @@
#define _RTEMS_RTEMS_MODESIMPL_H
#include <rtems/rtems/modes.h>
+#include <rtems/score/schedulerimpl.h>
+#include <rtems/score/smpimpl.h>
+#include <rtems/score/threadimpl.h>
#ifdef __cplusplus
extern "C" {
@@ -85,6 +88,51 @@ RTEMS_INLINE_ROUTINE ISR_Level _Modes_Get_interrupt_level (
return ( mode_set & RTEMS_INTERRUPT_MASK );
}
+#if defined(RTEMS_SMP) || CPU_ENABLE_ROBUST_THREAD_DISPATCH == TRUE
+/**
+ * @brief Checks if support for the interrupt level is implemented.
+ *
+ * @param mode_set is the mode set which specifies the interrupt level to
+ * check.
+ *
+ * @return Returns true, if support for the interrupt level is implemented,
+ * otherwise returns false.
+ */
+RTEMS_INLINE_ROUTINE bool _Modes_Is_interrupt_level_supported(
+ rtems_mode mode_set
+)
+{
+ return _Modes_Get_interrupt_level( mode_set ) == 0
+#if CPU_ENABLE_ROBUST_THREAD_DISPATCH == FALSE
+ || !_SMP_Need_inter_processor_interrupts()
+#endif
+ ;
+}
+#endif
+
+#if defined(RTEMS_SMP)
+/**
+ * @brief Checks if support for the preempt mode is implemented.
+ *
+ * @param mode_set is the mode set which specifies the preempt mode to check.
+ *
+ * @param the_thread is the thread to check.
+ *
+ * @return Returns true, if support for the preempt mode is implemented,
+ * otherwise returns false.
+ */
+RTEMS_INLINE_ROUTINE bool _Modes_Is_preempt_mode_supported(
+ rtems_mode mode_set,
+ const Thread_Control *the_thread
+)
+{
+ return _Modes_Is_preempt( mode_set ) ||
+ _Scheduler_Is_non_preempt_mode_supported(
+ _Thread_Scheduler_get_home( the_thread )
+ );
+}
+#endif
+
#ifdef __cplusplus
}
#endif