[PATCH] sp37: Check ISR level of system init
Sebastian Huber
sebastian.huber at embedded-brains.de
Tue Sep 12 06:54:55 UTC 2023
---
testsuites/sptests/sp37/init.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/testsuites/sptests/sp37/init.c b/testsuites/sptests/sp37/init.c
index 2ee21b592e..e8af725a75 100644
--- a/testsuites/sptests/sp37/init.c
+++ b/testsuites/sptests/sp37/init.c
@@ -40,6 +40,8 @@
#define CONFIGURE_INIT
#include "system.h"
+#include <rtems/sysinit.h>
+
const char rtems_test_name[] = "SP 37";
/* prototypes */
@@ -67,6 +69,19 @@ rtems_timer_service_routine test_isr_in_progress(
#define TEST_ISR_EVENT RTEMS_EVENT_0
+static uint32_t boot_isr_level;
+
+static void set_boot_isr_level( void )
+{
+ boot_isr_level = _ISR_Get_level();
+}
+
+RTEMS_SYSINIT_ITEM(
+ set_boot_isr_level,
+ RTEMS_SYSINIT_DEVICE_DRIVERS,
+ RTEMS_SYSINIT_ORDER_MIDDLE
+);
+
typedef struct {
ISR_Level actual_level;
rtems_id master_task_id;
@@ -154,6 +169,9 @@ static void test_isr_level( void )
ISR_Level current = 0;
ISR_Level last_proper_level;
+ /* Interrupts shall be disabled during system initialization */
+ rtems_test_assert( boot_isr_level != 0 );
+
_ISR_Set_level( current );
rtems_test_assert( _ISR_Get_level() == current );
--
2.35.3
More information about the devel
mailing list