[rtems commit] rtems: Add RTEMS_FATAL_SOURCE_SPURIOUS_INTERRUPT

Sebastian Huber sebh at rtems.org
Tue Jul 27 05:42:40 UTC 2021


Module:    rtems
Branch:    master
Commit:    4969af41028ff7861753efe451826c2c42fc45b2
Changeset: http://git.rtems.org/rtems/commit/?id=4969af41028ff7861753efe451826c2c42fc45b2

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Jul  6 14:03:41 2021 +0200

rtems: Add RTEMS_FATAL_SOURCE_SPURIOUS_INTERRUPT

Add RTEMS_FATAL_SOURCE_SPURIOUS_INTERRUPT as the fatal source for
spurious interrupts.  Use the interrupt vector number of the spurious
interrupt for the fatal code.

Update #3269.

---

 bsps/shared/irq/irq-default-handler.c       | 12 +++++-------
 cpukit/include/rtems/score/interr.h         |  7 +++++++
 cpukit/sapi/src/fatalsrctext.c              |  3 ++-
 testsuites/sptests/spinternalerror02/init.c |  2 +-
 4 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/bsps/shared/irq/irq-default-handler.c b/bsps/shared/irq/irq-default-handler.c
index cfe91f4..666d48a 100644
--- a/bsps/shared/irq/irq-default-handler.c
+++ b/bsps/shared/irq/irq-default-handler.c
@@ -10,7 +10,7 @@
  */
 
 /*
- * Copyright (C) 2008, 2012 embedded brains GmbH (http://www.embedded-brains.de)
+ * Copyright (C) 2008, 2021 embedded brains GmbH (http://www.embedded-brains.de)
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -34,13 +34,11 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include <inttypes.h>
-
-#include <rtems/bspIo.h>
-
 #include <bsp/irq-generic.h>
 
-void bsp_interrupt_handler_default(rtems_vector_number vector)
+#include <rtems/score/interr.h>
+
+void bsp_interrupt_handler_default( rtems_vector_number vector )
 {
-  printk("spurious interrupt: %" PRIu32 "\n", vector);
+  _Terminate( RTEMS_FATAL_SOURCE_SPURIOUS_INTERRUPT, vector );
 }
diff --git a/cpukit/include/rtems/score/interr.h b/cpukit/include/rtems/score/interr.h
index 33e9524..e5a0a62 100644
--- a/cpukit/include/rtems/score/interr.h
+++ b/cpukit/include/rtems/score/interr.h
@@ -144,6 +144,13 @@ typedef enum {
   RTEMS_FATAL_SOURCE_HEAP = 13,
 
   /**
+   * @brief Fatal source for spurious interrupts.
+   *
+   * The fatal code is the interrupt vector number of the spurious interrupt.
+   */
+  RTEMS_FATAL_SOURCE_SPURIOUS_INTERRUPT = 14,
+
+  /**
    * @brief The last available fatal source.
    *
    * This enum value ensures that the enum type needs at least 32-bits for
diff --git a/cpukit/sapi/src/fatalsrctext.c b/cpukit/sapi/src/fatalsrctext.c
index 6510725..636878d 100644
--- a/cpukit/sapi/src/fatalsrctext.c
+++ b/cpukit/sapi/src/fatalsrctext.c
@@ -41,7 +41,8 @@ static const char *const fatal_source_text[] = {
   "RTEMS_FATAL_SOURCE_SMP",
   "RTEMS_FATAL_SOURCE_PANIC",
   "RTEMS_FATAL_SOURCE_INVALID_HEAP_FREE",
-  "RTEMS_FATAL_SOURCE_HEAP"
+  "RTEMS_FATAL_SOURCE_HEAP",
+  "RTEMS_FATAL_SOURCE_SPURIOUS_INTERRUPT"
 };
 
 const char *rtems_fatal_source_text( rtems_fatal_source source )
diff --git a/testsuites/sptests/spinternalerror02/init.c b/testsuites/sptests/spinternalerror02/init.c
index 1564061..30f09de 100644
--- a/testsuites/sptests/spinternalerror02/init.c
+++ b/testsuites/sptests/spinternalerror02/init.c
@@ -53,7 +53,7 @@ static void test_fatal_source_text(void)
     puts( text );
   } while ( text != text_last );
 
-  rtems_test_assert( source - 3 == RTEMS_FATAL_SOURCE_HEAP );
+  rtems_test_assert( source - 3 == RTEMS_FATAL_SOURCE_SPURIOUS_INTERRUPT );
 }
 
 static void test_status_text(void)



More information about the vc mailing list