[PATCH 1/5] bsps: Move bsp_generic_fatal_code to new file

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Jun 20 10:06:08 UTC 2013


Add bsp_generic_fatal().
---
 c/src/lib/libbsp/Makefile.am                       |    1 +
 c/src/lib/libbsp/m68k/mrm332/spurious/spinit.c     |    7 +--
 c/src/lib/libbsp/preinstall.am                     |    4 ++
 c/src/lib/libbsp/shared/include/bootcard.h         |   13 +-----
 c/src/lib/libbsp/shared/include/generic-fatal.h    |   42 ++++++++++++++++++++
 c/src/lib/libbsp/shared/src/irq-generic.c          |    7 +--
 .../new-exceptions/bspsupport/ppc_exc_initialize.c |    7 +--
 cpukit/score/include/rtems/score/interr.h          |    6 +-
 8 files changed, 58 insertions(+), 29 deletions(-)
 create mode 100644 c/src/lib/libbsp/shared/include/generic-fatal.h

diff --git a/c/src/lib/libbsp/Makefile.am b/c/src/lib/libbsp/Makefile.am
index 60a0d49..5e27b5b 100644
--- a/c/src/lib/libbsp/Makefile.am
+++ b/c/src/lib/libbsp/Makefile.am
@@ -33,6 +33,7 @@ include_bspdir = $(includedir)/bsp
 
 include_bsp_HEADERS =
 include_bsp_HEADERS += shared/include/default-initial-extension.h
+include_bsp_HEADERS += shared/include/generic-fatal.h
 
 include $(srcdir)/preinstall.am
 include $(top_srcdir)/automake/subdirs.am
diff --git a/c/src/lib/libbsp/m68k/mrm332/spurious/spinit.c b/c/src/lib/libbsp/m68k/mrm332/spurious/spinit.c
index c9c94fe..1b659f0 100644
--- a/c/src/lib/libbsp/m68k/mrm332/spurious/spinit.c
+++ b/c/src/lib/libbsp/m68k/mrm332/spurious/spinit.c
@@ -15,7 +15,7 @@
  */
 
 #include <bsp.h>
-#include <bsp/bootcard.h>
+#include <bsp/generic-fatal.h>
 #include <stdio.h>
 
 const char * const _Spurious_Error_[] = {"Reset","Bus Error","Address Error",
@@ -72,10 +72,7 @@ rtems_isr Spurious_Isr(
   RAW_PUTI(sp);
   RAW_PUTS("\n\r");
 #endif
-  rtems_fatal(
-    RTEMS_FATAL_SOURCE_BSP_GENERIC,
-    BSP_GENERIC_FATAL_SPURIOUS_INTERRUPT
-  );
+  bsp_generic_fatal( BSP_GENERIC_FATAL_SPURIOUS_INTERRUPT );
 }
 
 void Spurious_Initialize(void)
diff --git a/c/src/lib/libbsp/preinstall.am b/c/src/lib/libbsp/preinstall.am
index f4f0fa4..07c18f1 100644
--- a/c/src/lib/libbsp/preinstall.am
+++ b/c/src/lib/libbsp/preinstall.am
@@ -22,3 +22,7 @@ $(PROJECT_INCLUDE)/bsp/default-initial-extension.h: shared/include/default-initi
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/default-initial-extension.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/default-initial-extension.h
 
+$(PROJECT_INCLUDE)/bsp/generic-fatal.h: shared/include/generic-fatal.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/generic-fatal.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/generic-fatal.h
+
diff --git a/c/src/lib/libbsp/shared/include/bootcard.h b/c/src/lib/libbsp/shared/include/bootcard.h
index f3de760..ca27832 100644
--- a/c/src/lib/libbsp/shared/include/bootcard.h
+++ b/c/src/lib/libbsp/shared/include/bootcard.h
@@ -7,10 +7,10 @@
  */
 
 /*
- * Copyright (c) 2008-2012 embedded brains GmbH.  All rights reserved.
+ * Copyright (c) 2008-2013 embedded brains GmbH.  All rights reserved.
  *
  *  embedded brains GmbH
- *  Obere Lagerstr. 30
+ *  Dornierstr. 4
  *  82178 Puchheim
  *  Germany
  *  <rtems at embedded-brains.de>
@@ -51,15 +51,6 @@ extern "C" {
  */
 
 /**
- * @brief Generic BSP fatal error codes.
- */
-typedef enum {
-  BSP_GENERIC_FATAL_EXCEPTION_INITIALIZATION,
-  BSP_GENERIC_FATAL_INTERRUPT_INITIALIZATION,
-  BSP_GENERIC_FATAL_SPURIOUS_INTERRUPT
-} bsp_generic_fatal_code;
-
-/**
  * @brief Global pointer to the command line of boot_card().
  */
 extern const char *bsp_boot_cmdline;
diff --git a/c/src/lib/libbsp/shared/include/generic-fatal.h b/c/src/lib/libbsp/shared/include/generic-fatal.h
new file mode 100644
index 0000000..4edf467
--- /dev/null
+++ b/c/src/lib/libbsp/shared/include/generic-fatal.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2012-2013 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Dornierstr. 4
+ *  82178 Puchheim
+ *  Germany
+ *  <rtems at embedded-brains.de>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ */
+
+#ifndef LIBBSP_SHARED_BSP_GENERIC_FATAL_H
+#define LIBBSP_SHARED_BSP_GENERIC_FATAL_H
+
+#include <rtems.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * @brief Generic BSP fatal error codes.
+ */
+typedef enum {
+  BSP_GENERIC_FATAL_EXCEPTION_INITIALIZATION,
+  BSP_GENERIC_FATAL_INTERRUPT_INITIALIZATION,
+  BSP_GENERIC_FATAL_SPURIOUS_INTERRUPT
+} bsp_generic_fatal_code;
+
+static inline void bsp_generic_fatal( bsp_generic_fatal_code code )
+{
+  rtems_fatal( RTEMS_FATAL_SOURCE_BSP_GENERIC, (rtems_fatal_code) code );
+}
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* LIBBSP_SHARED_BSP_GENERIC_FATAL_H */
diff --git a/c/src/lib/libbsp/shared/src/irq-generic.c b/c/src/lib/libbsp/shared/src/irq-generic.c
index 5cf9c91..b2d712a 100644
--- a/c/src/lib/libbsp/shared/src/irq-generic.c
+++ b/c/src/lib/libbsp/shared/src/irq-generic.c
@@ -23,7 +23,7 @@
  */
 
 #include <bsp/irq-generic.h>
-#include <bsp/bootcard.h>
+#include <bsp/generic-fatal.h>
 
 #include <stdlib.h>
 
@@ -170,10 +170,7 @@ void bsp_interrupt_initialize(void)
 
   sc = bsp_interrupt_facility_initialize();
   if (sc != RTEMS_SUCCESSFUL) {
-    rtems_fatal(
-      RTEMS_FATAL_SOURCE_BSP_GENERIC,
-      BSP_GENERIC_FATAL_INTERRUPT_INITIALIZATION
-    );
+    bsp_generic_fatal(BSP_GENERIC_FATAL_INTERRUPT_INITIALIZATION);
   }
 
   bsp_interrupt_set_initialized();
diff --git a/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_initialize.c b/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_initialize.c
index 6ac9880..d0f9116 100644
--- a/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_initialize.c
+++ b/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_initialize.c
@@ -25,7 +25,7 @@
 #include <rtems.h>
 
 #include <bsp/vectors.h>
-#include <bsp/bootcard.h>
+#include <bsp/generic-fatal.h>
 
 #define PPC_EXC_ASSERT_OFFSET(field, off) \
   RTEMS_STATIC_ASSERT( \
@@ -145,10 +145,7 @@ static void ppc_exc_initialize_booke(void *vector_base)
 
 static void ppc_exc_fatal_error(void)
 {
-  rtems_fatal(
-    RTEMS_FATAL_SOURCE_BSP_GENERIC,
-    BSP_GENERIC_FATAL_EXCEPTION_INITIALIZATION
-  );
+  bsp_generic_fatal(BSP_GENERIC_FATAL_EXCEPTION_INITIALIZATION);
 }
 
 void ppc_exc_initialize_with_vector_base(
diff --git a/cpukit/score/include/rtems/score/interr.h b/cpukit/score/include/rtems/score/interr.h
index a047ca6..79edc21 100644
--- a/cpukit/score/include/rtems/score/interr.h
+++ b/cpukit/score/include/rtems/score/interr.h
@@ -71,10 +71,10 @@ typedef enum {
   /**
    * @brief Fatal source for generic BSP errors.
    *
-   * The fatal codes are defined in <bsp/bootcard.h>.  Examples are interrupt
-   * and exception initialization.
+   * The fatal codes are defined in <bsp/generic-fatal.h>.  Examples are
+   * interrupt and exception initialization.
    *
-   * @see bsp_generic_fatal_code.
+   * @see bsp_generic_fatal_code and bsp_generic_fatal().
    */
   RTEMS_FATAL_SOURCE_BSP_GENERIC,
 
-- 
1.7.7




More information about the devel mailing list