[PATCH 08/17] score: Add RTEMS_FATAL_SOURCE_BSP

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Feb 17 15:51:33 UTC 2014


Merge RTEMS_FATAL_SOURCE_BSP_GENERIC and RTEMS_FATAL_SOURCE_BSP_SPECIFIC
into new fatal source RTEMS_FATAL_SOURCE_BSP.  This makes it easier to
figure out the code position given a fatal source and code.
---
 c/src/lib/libbsp/Makefile.am                       |    2 +-
 c/src/lib/libbsp/arm/lpc24xx/include/bsp.h         |   10 --
 c/src/lib/libbsp/arm/lpc24xx/startup/fb-config.c   |   18 +---
 c/src/lib/libbsp/arm/realview-pbx-a9/include/bsp.h |   10 --
 .../libbsp/arm/realview-pbx-a9/startup/bspstart.c  |    5 -
 .../libbsp/arm/shared/arm-a9mpcore-clock-config.c  |   11 +--
 c/src/lib/libbsp/arm/shared/arm-pl111-fb.c         |   16 +--
 c/src/lib/libbsp/arm/xilinx-zynq/include/bsp.h     |    7 --
 .../lib/libbsp/arm/xilinx-zynq/startup/bspstart.c  |    5 -
 c/src/lib/libbsp/m68k/mrm332/spurious/spinit.c     |    4 +-
 c/src/lib/libbsp/powerpc/gen5200/include/bsp.h     |   18 ---
 .../lib/libbsp/powerpc/gen5200/startup/bspstart.c  |    5 -
 c/src/lib/libbsp/powerpc/mpc55xxevb/include/bsp.h  |   26 -----
 .../libbsp/powerpc/mpc55xxevb/startup/bspstart.c   |    5 -
 c/src/lib/libbsp/preinstall.am                     |    6 +-
 c/src/lib/libbsp/shared/console.c                  |   16 ++--
 c/src/lib/libbsp/shared/console_select.c           |    4 +-
 c/src/lib/libbsp/shared/include/fatal.h            |  113 ++++++++++++++++++++
 c/src/lib/libbsp/shared/include/generic-fatal.h    |   51 ---------
 c/src/lib/libbsp/shared/include/irq-generic.h      |    4 +-
 c/src/lib/libbsp/shared/src/irq-generic.c          |    4 +-
 c/src/lib/libbsp/sparc/leon3/include/bsp.h         |    4 -
 c/src/lib/libbsp/sparc/leon3/startup/cpucounter.c  |    3 +-
 .../new-exceptions/bspsupport/ppc_exc_initialize.c |    4 +-
 .../powerpc/new-exceptions/bspsupport/vectors.h    |    4 +-
 cpukit/score/include/rtems/score/interr.h          |   17 +--
 26 files changed, 156 insertions(+), 216 deletions(-)
 create mode 100644 c/src/lib/libbsp/shared/include/fatal.h
 delete 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 5e27b5b..b6e43ea 100644
--- a/c/src/lib/libbsp/Makefile.am
+++ b/c/src/lib/libbsp/Makefile.am
@@ -33,7 +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_bsp_HEADERS += shared/include/fatal.h
 
 include $(srcdir)/preinstall.am
 include $(top_srcdir)/automake/subdirs.am
diff --git a/c/src/lib/libbsp/arm/lpc24xx/include/bsp.h b/c/src/lib/libbsp/arm/lpc24xx/include/bsp.h
index d4a2065..15dc110 100644
--- a/c/src/lib/libbsp/arm/lpc24xx/include/bsp.h
+++ b/c/src/lib/libbsp/arm/lpc24xx/include/bsp.h
@@ -117,16 +117,6 @@ bool lpc24xx_uart_probe_2(int minor);
 
 bool lpc24xx_uart_probe_3(int minor);
 
-typedef enum {
-  BSP_ARM_PL111_FATAL_REGISTER_DEV,
-  BSP_ARM_PL111_FATAL_SEM_CREATE,
-  BSP_ARM_PL111_FATAL_SEM_RELEASE,
-  LPC24XX_FATAL_PL111_SET_UP,
-  LPC24XX_FATAL_PL111_PINS_SET_UP,
-  LPC24XX_FATAL_PL111_PINS_TEAR_DOWN,
-  LPC24XX_FATAL_PL111_TEAR_DOWN
-} lpc24xx_fatal_code;
-
 /** @} */
 
 #ifdef __cplusplus
diff --git a/c/src/lib/libbsp/arm/lpc24xx/startup/fb-config.c b/c/src/lib/libbsp/arm/lpc24xx/startup/fb-config.c
index 3208001..5ac870e 100644
--- a/c/src/lib/libbsp/arm/lpc24xx/startup/fb-config.c
+++ b/c/src/lib/libbsp/arm/lpc24xx/startup/fb-config.c
@@ -15,6 +15,7 @@
 #include <bsp/arm-pl111-fb.h>
 
 #include <bsp.h>
+#include <bsp/fatal.h>
 #include <bsp/io.h>
 #include <bsp/lcd.h>
 #include <bsp/lpc24xx.h>
@@ -48,7 +49,7 @@ static void fb_set_up(const pl111_fb_config *cfg)
 
   sc = lpc24xx_module_enable(LPC24XX_MODULE_LCD, LPC24XX_MODULE_PCLK_DEFAULT);
   if (sc != RTEMS_SUCCESSFUL) {
-    rtems_fatal(RTEMS_FATAL_SOURCE_BSP_SPECIFIC, LPC24XX_FATAL_PL111_SET_UP);
+    bsp_fatal(LPC24XX_FATAL_PL111_SET_UP);
   }
 
   #ifdef ARM_MULTILIB_ARCH_V4
@@ -68,10 +69,7 @@ static void fb_pins_set_up(const pl111_fb_config *cfg)
 
   sc = lpc24xx_pin_config(tft_16_bit_5_6_5_pins, LPC24XX_PIN_SET_FUNCTION);
   if (sc != RTEMS_SUCCESSFUL) {
-    rtems_fatal(
-      RTEMS_FATAL_SOURCE_BSP_SPECIFIC,
-      LPC24XX_FATAL_PL111_PINS_SET_UP
-    );
+    bsp_fatal(LPC24XX_FATAL_PL111_PINS_SET_UP);
   }
 }
 
@@ -81,10 +79,7 @@ static void fb_pins_tear_down(const pl111_fb_config *cfg)
 
   sc = lpc24xx_pin_config(tft_16_bit_5_6_5_pins, LPC24XX_PIN_SET_INPUT);
   if (sc != RTEMS_SUCCESSFUL) {
-    rtems_fatal(
-      RTEMS_FATAL_SOURCE_BSP_SPECIFIC,
-      LPC24XX_FATAL_PL111_PINS_TEAR_DOWN
-    );
+    bsp_fatal(LPC24XX_FATAL_PL111_PINS_TEAR_DOWN);
   }
 }
 
@@ -98,10 +93,7 @@ static void fb_tear_down(const pl111_fb_config *cfg)
 
   sc = lpc24xx_module_disable(LPC24XX_MODULE_LCD);
   if (sc != RTEMS_SUCCESSFUL) {
-    rtems_fatal(
-      RTEMS_FATAL_SOURCE_BSP_SPECIFIC,
-      LPC24XX_FATAL_PL111_TEAR_DOWN
-    );
+    bsp_fatal(LPC24XX_FATAL_PL111_TEAR_DOWN);
   }
 }
 
diff --git a/c/src/lib/libbsp/arm/realview-pbx-a9/include/bsp.h b/c/src/lib/libbsp/arm/realview-pbx-a9/include/bsp.h
index 959ff92..9e7c407 100644
--- a/c/src/lib/libbsp/arm/realview-pbx-a9/include/bsp.h
+++ b/c/src/lib/libbsp/arm/realview-pbx-a9/include/bsp.h
@@ -51,16 +51,6 @@ extern "C" {
 
 #define BSP_ARM_GIC_DIST_BASE 0x1f001000
 
-typedef enum {
-  BSP_ARM_A9MPCORE_FATAL_CLOCK_IRQ_INSTALL,
-  BSP_ARM_A9MPCORE_FATAL_CLOCK_IRQ_REMOVE,
-  BSP_ARM_PL111_FATAL_REGISTER_DEV,
-  BSP_ARM_PL111_FATAL_SEM_CREATE,
-  BSP_ARM_PL111_FATAL_SEM_RELEASE
-} rvpbxa9_fatal_code;
-
-void rvpbxa9_fatal(rvpbxa9_fatal_code code) RTEMS_COMPILER_NO_RETURN_ATTRIBUTE;
-
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
diff --git a/c/src/lib/libbsp/arm/realview-pbx-a9/startup/bspstart.c b/c/src/lib/libbsp/arm/realview-pbx-a9/startup/bspstart.c
index d744fbc..8715e1d 100644
--- a/c/src/lib/libbsp/arm/realview-pbx-a9/startup/bspstart.c
+++ b/c/src/lib/libbsp/arm/realview-pbx-a9/startup/bspstart.c
@@ -16,11 +16,6 @@
 #include <bsp/bootcard.h>
 #include <bsp/irq-generic.h>
 
-void rvpbxa9_fatal(rvpbxa9_fatal_code code)
-{
-  rtems_fatal(RTEMS_FATAL_SOURCE_BSP_SPECIFIC, code);
-}
-
 void bsp_start(void)
 {
   bsp_interrupt_initialize();
diff --git a/c/src/lib/libbsp/arm/shared/arm-a9mpcore-clock-config.c b/c/src/lib/libbsp/arm/shared/arm-a9mpcore-clock-config.c
index 54f09fa..e32657d 100644
--- a/c/src/lib/libbsp/arm/shared/arm-a9mpcore-clock-config.c
+++ b/c/src/lib/libbsp/arm/shared/arm-a9mpcore-clock-config.c
@@ -15,6 +15,7 @@
 #include <rtems/counter.h>
 
 #include <bsp.h>
+#include <bsp/fatal.h>
 #include <bsp/irq.h>
 #include <bsp/arm-a9mpcore-regs.h>
 #include <bsp/arm-a9mpcore-clock.h>
@@ -51,10 +52,7 @@ static void a9mpcore_clock_handler_install(void)
     NULL
   );
   if (sc != RTEMS_SUCCESSFUL) {
-    rtems_fatal(
-      RTEMS_FATAL_SOURCE_BSP_SPECIFIC,
-      BSP_ARM_A9MPCORE_FATAL_CLOCK_IRQ_INSTALL
-    );
+    bsp_fatal(BSP_ARM_A9MPCORE_FATAL_CLOCK_IRQ_INSTALL);
   }
 }
 
@@ -121,10 +119,7 @@ static void a9mpcore_clock_cleanup(void)
     NULL
   );
   if (sc != RTEMS_SUCCESSFUL) {
-    rtems_fatal(
-      RTEMS_FATAL_SOURCE_BSP_SPECIFIC,
-      BSP_ARM_A9MPCORE_FATAL_CLOCK_IRQ_REMOVE
-    );
+    bsp_fatal(BSP_ARM_A9MPCORE_FATAL_CLOCK_IRQ_REMOVE);
   }
 }
 
diff --git a/c/src/lib/libbsp/arm/shared/arm-pl111-fb.c b/c/src/lib/libbsp/arm/shared/arm-pl111-fb.c
index fd9967d..408047d 100644
--- a/c/src/lib/libbsp/arm/shared/arm-pl111-fb.c
+++ b/c/src/lib/libbsp/arm/shared/arm-pl111-fb.c
@@ -22,6 +22,7 @@
 
 #include <bsp.h>
 #include <bsp/arm-pl111-fb.h>
+#include <bsp/fatal.h>
 
 typedef struct {
   rtems_id semaphore;
@@ -154,10 +155,7 @@ static void pl111_fb_release(const pl111_fb_context *ctx)
 {
   rtems_status_code sc = rtems_semaphore_release(ctx->semaphore);
   if (sc != RTEMS_SUCCESSFUL) {
-    rtems_fatal(
-      RTEMS_FATAL_SOURCE_BSP_SPECIFIC,
-      BSP_ARM_PL111_FATAL_SEM_RELEASE
-    );
+    bsp_fatal(BSP_ARM_PL111_FATAL_SEM_RELEASE);
   }
 }
 
@@ -172,10 +170,7 @@ rtems_device_driver frame_buffer_initialize(
 
   sc = rtems_io_register_name(FRAMEBUFFER_DEVICE_0_NAME, major, 0);
   if (sc != RTEMS_SUCCESSFUL) {
-    rtems_fatal(
-      RTEMS_FATAL_SOURCE_BSP_SPECIFIC,
-      BSP_ARM_PL111_FATAL_REGISTER_DEV
-    );
+    bsp_fatal(BSP_ARM_PL111_FATAL_REGISTER_DEV);
   }
 
   sc = rtems_semaphore_create(
@@ -186,10 +181,7 @@ rtems_device_driver frame_buffer_initialize(
     &ctx->semaphore
   );
   if (sc != RTEMS_SUCCESSFUL) {
-    rtems_fatal(
-      RTEMS_FATAL_SOURCE_BSP_SPECIFIC,
-      BSP_ARM_PL111_FATAL_SEM_CREATE
-    );
+    bsp_fatal(BSP_ARM_PL111_FATAL_SEM_CREATE);
   }
 
   return sc;
diff --git a/c/src/lib/libbsp/arm/xilinx-zynq/include/bsp.h b/c/src/lib/libbsp/arm/xilinx-zynq/include/bsp.h
index 56e62a5..c837d0d 100644
--- a/c/src/lib/libbsp/arm/xilinx-zynq/include/bsp.h
+++ b/c/src/lib/libbsp/arm/xilinx-zynq/include/bsp.h
@@ -55,13 +55,6 @@ extern "C" {
 
 #define BSP_ARM_GIC_DIST_BASE 0xf8f01000
 
-typedef enum {
-  BSP_ARM_A9MPCORE_FATAL_CLOCK_IRQ_INSTALL,
-  BSP_ARM_A9MPCORE_FATAL_CLOCK_IRQ_REMOVE
-} zynq_fatal_code;
-
-void zynq_fatal(zynq_fatal_code code) RTEMS_COMPILER_NO_RETURN_ATTRIBUTE;
-
 /**
  * @brief Zynq specific set up of the MMU.
  *
diff --git a/c/src/lib/libbsp/arm/xilinx-zynq/startup/bspstart.c b/c/src/lib/libbsp/arm/xilinx-zynq/startup/bspstart.c
index e312c9a..8715e1d 100644
--- a/c/src/lib/libbsp/arm/xilinx-zynq/startup/bspstart.c
+++ b/c/src/lib/libbsp/arm/xilinx-zynq/startup/bspstart.c
@@ -16,11 +16,6 @@
 #include <bsp/bootcard.h>
 #include <bsp/irq-generic.h>
 
-void zynq_fatal(zynq_fatal_code code)
-{
-  rtems_fatal(RTEMS_FATAL_SOURCE_BSP_SPECIFIC, code);
-}
-
 void bsp_start(void)
 {
   bsp_interrupt_initialize();
diff --git a/c/src/lib/libbsp/m68k/mrm332/spurious/spinit.c b/c/src/lib/libbsp/m68k/mrm332/spurious/spinit.c
index 1b659f0..031ded9 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/generic-fatal.h>
+#include <bsp/fatal.h>
 #include <stdio.h>
 
 const char * const _Spurious_Error_[] = {"Reset","Bus Error","Address Error",
@@ -72,7 +72,7 @@ rtems_isr Spurious_Isr(
   RAW_PUTI(sp);
   RAW_PUTS("\n\r");
 #endif
-  bsp_generic_fatal( BSP_GENERIC_FATAL_SPURIOUS_INTERRUPT );
+  bsp_fatal( MRM332_FATAL_SPURIOUS_INTERRUPT );
 }
 
 void Spurious_Initialize(void)
diff --git a/c/src/lib/libbsp/powerpc/gen5200/include/bsp.h b/c/src/lib/libbsp/powerpc/gen5200/include/bsp.h
index b8c46dc..463417a 100644
--- a/c/src/lib/libbsp/powerpc/gen5200/include/bsp.h
+++ b/c/src/lib/libbsp/powerpc/gen5200/include/bsp.h
@@ -254,24 +254,6 @@ void BSP_IRQ_Benchmarking_Report(void);
 
 void cpu_init(void);
 
-typedef enum {
-  MPC5200_FATAL_PCF8563_INVALID_YEAR,
-  MPC5200_FATAL_SLICETIMER_0_IRQ_INSTALL,
-  MPC5200_FATAL_SLICETIMER_1_IRQ_INSTALL,
-  MPC5200_FATAL_TM27_IRQ_INSTALL,
-  MPC5200_FATAL_MSCAN_A_INIT,
-  MPC5200_FATAL_MSCAN_B_INIT,
-  MPC5200_FATAL_MSCAN_A_SET_MODE,
-  MPC5200_FATAL_MSCAN_B_SET_MODE,
-  MPC5200_FATAL_ATA_DISK_IO_INIT,
-  MPC5200_FATAL_ATA_DISK_CREATE,
-  MPC5200_FATAL_ATA_DMA_SINGLE_IRQ_INSTALL,
-  MPC5200_FATAL_ATA_LOCK_CREATE,
-  MPC5200_FATAL_ATA_LOCK_DESTROY
-} mpc5200_fatal_code;
-
-void mpc5200_fatal(mpc5200_fatal_code code) RTEMS_COMPILER_NO_RETURN_ATTRIBUTE;
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/c/src/lib/libbsp/powerpc/gen5200/startup/bspstart.c b/c/src/lib/libbsp/powerpc/gen5200/startup/bspstart.c
index 8324b44..bea8180 100644
--- a/c/src/lib/libbsp/powerpc/gen5200/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/gen5200/startup/bspstart.c
@@ -124,11 +124,6 @@ void _BSP_Fatal_error(unsigned int v)
   __asm__ __volatile ("sc");
 }
 
-void mpc5200_fatal(mpc5200_fatal_code code)
-{
-  rtems_fatal(RTEMS_FATAL_SOURCE_BSP_SPECIFIC, code);
-}
-
 void bsp_start(void)
 {
   ppc_cpu_id_t myCpu;
diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/include/bsp.h b/c/src/lib/libbsp/powerpc/mpc55xxevb/include/bsp.h
index 70dbea7..596a9bd 100644
--- a/c/src/lib/libbsp/powerpc/mpc55xxevb/include/bsp.h
+++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/include/bsp.h
@@ -99,32 +99,6 @@ LINKER_SYMBOL(bsp_section_sysram_load_end)
 
 #define BSP_SYSRAM_SECTION __attribute__((section(".bsp_sysram")))
 
-typedef enum {
-  MPC55XX_FATAL_FMPLL_LOCK,
-  MPC55XX_FATAL_CLOCK_EMIOS_IRQ_INSTALL,
-  MPC55XX_FATAL_CLOCK_EMIOS_PRESCALER,
-  MPC55XX_FATAL_CLOCK_EMIOS_INTERVAL,
-  MPC55XX_FATAL_CLOCK_PIT_IRQ_INSTALL,
-  MPC55XX_FATAL_CONSOLE_GENERIC_COUNT,
-  MPC55XX_FATAL_CONSOLE_GENERIC_REGISTER,
-  MPC55XX_FATAL_CONSOLE_GENERIC_REGISTER_CONSOLE,
-  MPC55XX_FATAL_CONSOLE_ESCI_BAUD,
-  MPC55XX_FATAL_CONSOLE_ESCI_ATTRIBUTES,
-  MPC55XX_FATAL_CONSOLE_ESCI_IRQ_INSTALL,
-  MPC55XX_FATAL_CONSOLE_LINFLEX_BAUD,
-  MPC55XX_FATAL_CONSOLE_LINFLEX_ATTRIBUTES,
-  MPC55XX_FATAL_CONSOLE_LINFLEX_RX_IRQ_INSTALL,
-  MPC55XX_FATAL_CONSOLE_LINFLEX_TX_IRQ_INSTALL,
-  MPC55XX_FATAL_CONSOLE_LINFLEX_ERR_IRQ_INSTALL,
-  MPC55XX_FATAL_CONSOLE_LINFLEX_RX_IRQ_REMOVE,
-  MPC55XX_FATAL_CONSOLE_LINFLEX_TX_IRQ_REMOVE,
-  MPC55XX_FATAL_CONSOLE_LINFLEX_ERR_IRQ_REMOVE,
-  MPC55XX_FATAL_EDMA_IRQ_INSTALL,
-  MPC55XX_FATAL_EDMA_IRQ_REMOVE
-} mpc55xx_fatal_code;
-
-void mpc55xx_fatal(mpc55xx_fatal_code code) RTEMS_COMPILER_NO_RETURN_ATTRIBUTE;
-
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/bspstart.c b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/bspstart.c
index ed3ef53..2c8ceed 100644
--- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/bspstart.c
+++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/bspstart.c
@@ -61,11 +61,6 @@ void _BSP_Fatal_error(unsigned n)
 	}
 }
 
-void mpc55xx_fatal(mpc55xx_fatal_code code)
-{
-  rtems_fatal(RTEMS_FATAL_SOURCE_BSP_SPECIFIC, code);
-}
-
 static void null_pointer_protection(void)
 {
 #ifdef MPC55XX_NULL_POINTER_PROTECTION
diff --git a/c/src/lib/libbsp/preinstall.am b/c/src/lib/libbsp/preinstall.am
index 07c18f1..abaf028 100644
--- a/c/src/lib/libbsp/preinstall.am
+++ b/c/src/lib/libbsp/preinstall.am
@@ -22,7 +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
+$(PROJECT_INCLUDE)/bsp/fatal.h: shared/include/fatal.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/fatal.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/fatal.h
 
diff --git a/c/src/lib/libbsp/shared/console.c b/c/src/lib/libbsp/shared/console.c
index 0017495..7d2a30a 100644
--- a/c/src/lib/libbsp/shared/console.c
+++ b/c/src/lib/libbsp/shared/console.c
@@ -16,7 +16,7 @@
  */
 
 #include <bsp.h>
-#include <bsp/generic-fatal.h>
+#include <bsp/fatal.h>
 #include <rtems/libio.h>
 #include <rtems/console.h>
 #include <stdlib.h>
@@ -49,7 +49,7 @@ static void console_initialize_pointers(void)
   Console_Port_Count = Console_Configuration_Count;
   Console_Port_Tbl   = malloc( Console_Port_Count * sizeof( console_tbl * ) );
   if (Console_Port_Tbl == NULL)
-    bsp_generic_fatal( BSP_GENERIC_FATAL_CONSOLE_NO_MEMORY_0 );
+    bsp_fatal( BSP_FATAL_CONSOLE_NO_MEMORY_0 );
 
   for (i=0 ; i < Console_Port_Count ; i++)
     Console_Port_Tbl[i] = &Console_Configuration_Ports[i];
@@ -76,7 +76,7 @@ void console_register_devices(
    *  register devices.
    */
   if ( console_initialized ) {
-    bsp_generic_fatal( BSP_GENERIC_FATAL_CONSOLE_MULTI_INIT );
+    bsp_fatal( BSP_FATAL_CONSOLE_MULTI_INIT );
   }
 
   /*
@@ -89,12 +89,12 @@ void console_register_devices(
     Console_Port_Count * sizeof( console_tbl * )
   );
   if ( Console_Port_Tbl == NULL ) {
-    bsp_generic_fatal( BSP_GENERIC_FATAL_CONSOLE_NO_MEMORY_1 );
+    bsp_fatal( BSP_FATAL_CONSOLE_NO_MEMORY_1 );
   }
 
   Console_Port_Data  = calloc( Console_Port_Count, sizeof( console_data ) );
   if ( Console_Port_Data == NULL ) {
-    bsp_generic_fatal( BSP_GENERIC_FATAL_CONSOLE_NO_MEMORY_2 );
+    bsp_fatal( BSP_FATAL_CONSOLE_NO_MEMORY_2 );
   }
 
   /*
@@ -255,7 +255,7 @@ rtems_device_driver console_initialize(
     console_initialize_pointers();
     Console_Port_Data  = calloc( Console_Port_Count, sizeof( console_data ) );
     if ( Console_Port_Data == NULL ) {
-      bsp_generic_fatal( BSP_GENERIC_FATAL_CONSOLE_NO_MEMORY_3 );
+      bsp_fatal( BSP_FATAL_CONSOLE_NO_MEMORY_3 );
     }
   }
 
@@ -290,14 +290,14 @@ rtems_device_driver console_initialize(
       if (port->sDeviceName != NULL) {
         status = rtems_io_register_name( port->sDeviceName, major, minor );
         if (status != RTEMS_SUCCESSFUL) {
-          bsp_generic_fatal( BSP_GENERIC_FATAL_CONSOLE_REGISTER_DEV_0 );
+          bsp_fatal( BSP_FATAL_CONSOLE_REGISTER_DEV_0 );
         }
       }
 
       if (minor == Console_Port_Minor) {
         status = rtems_io_register_name( CONSOLE_DEVICE_NAME, major, minor );
         if (status != RTEMS_SUCCESSFUL) {
-          bsp_generic_fatal( BSP_GENERIC_FATAL_CONSOLE_REGISTER_DEV_1 );
+          bsp_fatal( BSP_FATAL_CONSOLE_REGISTER_DEV_1 );
         }
       }
 
diff --git a/c/src/lib/libbsp/shared/console_select.c b/c/src/lib/libbsp/shared/console_select.c
index 3927487..7c91112 100644
--- a/c/src/lib/libbsp/shared/console_select.c
+++ b/c/src/lib/libbsp/shared/console_select.c
@@ -19,7 +19,7 @@
  */
 
 #include <bsp.h>
-#include <bsp/generic-fatal.h>
+#include <bsp/fatal.h>
 #include <rtems/libio.h>
 #include <stdlib.h>
 #include <assert.h>
@@ -72,7 +72,7 @@ static rtems_device_minor_number bsp_First_Available_Device( void )
   /*
    *  Error No devices were found.  We will want to bail here.
    */
-  bsp_generic_fatal(BSP_GENERIC_FATAL_CONSOLE_NO_DEV);
+  bsp_fatal(BSP_FATAL_CONSOLE_NO_DEV);
 }
 
 void bsp_console_select(void)
diff --git a/c/src/lib/libbsp/shared/include/fatal.h b/c/src/lib/libbsp/shared/include/fatal.h
new file mode 100644
index 0000000..16d20b8
--- /dev/null
+++ b/c/src/lib/libbsp/shared/include/fatal.h
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2012-2014 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_FATAL_H
+#define LIBBSP_SHARED_BSP_FATAL_H
+
+#include <rtems.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define BSP_FATAL_CODE_BLOCK(idx) ((unsigned long) (idx) * 256UL)
+
+/**
+ * @brief BSP fatal error codes.
+ */
+typedef enum {
+  /* Generic BSP fatal codes */
+  BSP_FATAL_INTERRUPT_INITIALIZATION = BSP_FATAL_CODE_BLOCK(0),
+  BSP_FATAL_SPURIOUS_INTERRUPT,
+  BSP_FATAL_CONSOLE_MULTI_INIT,
+  BSP_FATAL_CONSOLE_NO_MEMORY_0,
+  BSP_FATAL_CONSOLE_NO_MEMORY_1,
+  BSP_FATAL_CONSOLE_NO_MEMORY_2,
+  BSP_FATAL_CONSOLE_NO_MEMORY_3,
+  BSP_FATAL_CONSOLE_REGISTER_DEV_0,
+  BSP_FATAL_CONSOLE_REGISTER_DEV_1,
+  BSP_FATAL_CONSOLE_NO_DEV,
+
+  /* ARM fatal codes */
+  BSP_ARM_A9MPCORE_FATAL_CLOCK_IRQ_INSTALL = BSP_FATAL_CODE_BLOCK(1),
+  BSP_ARM_A9MPCORE_FATAL_CLOCK_IRQ_REMOVE,
+  BSP_ARM_PL111_FATAL_REGISTER_DEV,
+  BSP_ARM_PL111_FATAL_SEM_CREATE,
+  BSP_ARM_PL111_FATAL_SEM_RELEASE,
+
+  /* LEON3 fatal codes */
+  LEON3_FATAL_CPU_COUNTER_INIT = BSP_FATAL_CODE_BLOCK(2),
+
+  /* LPC24XX fatal codes */
+  LPC24XX_FATAL_PL111_SET_UP = BSP_FATAL_CODE_BLOCK(3),
+  LPC24XX_FATAL_PL111_PINS_SET_UP,
+  LPC24XX_FATAL_PL111_PINS_TEAR_DOWN,
+  LPC24XX_FATAL_PL111_TEAR_DOWN,
+
+  /* MPC5200 fatal codes */
+  MPC5200_FATAL_PCF8563_INVALID_YEAR = BSP_FATAL_CODE_BLOCK(4),
+  MPC5200_FATAL_SLICETIMER_0_IRQ_INSTALL,
+  MPC5200_FATAL_SLICETIMER_1_IRQ_INSTALL,
+  MPC5200_FATAL_TM27_IRQ_INSTALL,
+  MPC5200_FATAL_MSCAN_A_INIT,
+  MPC5200_FATAL_MSCAN_B_INIT,
+  MPC5200_FATAL_MSCAN_A_SET_MODE,
+  MPC5200_FATAL_MSCAN_B_SET_MODE,
+  MPC5200_FATAL_ATA_DISK_IO_INIT,
+  MPC5200_FATAL_ATA_DISK_CREATE,
+  MPC5200_FATAL_ATA_DMA_SINGLE_IRQ_INSTALL,
+  MPC5200_FATAL_ATA_LOCK_CREATE,
+  MPC5200_FATAL_ATA_LOCK_DESTROY,
+
+  /* MPC55XX fatal codes */
+  MPC55XX_FATAL_FMPLL_LOCK = BSP_FATAL_CODE_BLOCK(5),
+  MPC55XX_FATAL_CLOCK_EMIOS_IRQ_INSTALL,
+  MPC55XX_FATAL_CLOCK_EMIOS_PRESCALER,
+  MPC55XX_FATAL_CLOCK_EMIOS_INTERVAL,
+  MPC55XX_FATAL_CLOCK_PIT_IRQ_INSTALL,
+  MPC55XX_FATAL_CONSOLE_GENERIC_COUNT,
+  MPC55XX_FATAL_CONSOLE_GENERIC_REGISTER,
+  MPC55XX_FATAL_CONSOLE_GENERIC_REGISTER_CONSOLE,
+  MPC55XX_FATAL_CONSOLE_ESCI_BAUD,
+  MPC55XX_FATAL_CONSOLE_ESCI_ATTRIBUTES,
+  MPC55XX_FATAL_CONSOLE_ESCI_IRQ_INSTALL,
+  MPC55XX_FATAL_CONSOLE_LINFLEX_BAUD,
+  MPC55XX_FATAL_CONSOLE_LINFLEX_ATTRIBUTES,
+  MPC55XX_FATAL_CONSOLE_LINFLEX_RX_IRQ_INSTALL,
+  MPC55XX_FATAL_CONSOLE_LINFLEX_TX_IRQ_INSTALL,
+  MPC55XX_FATAL_CONSOLE_LINFLEX_ERR_IRQ_INSTALL,
+  MPC55XX_FATAL_CONSOLE_LINFLEX_RX_IRQ_REMOVE,
+  MPC55XX_FATAL_CONSOLE_LINFLEX_TX_IRQ_REMOVE,
+  MPC55XX_FATAL_CONSOLE_LINFLEX_ERR_IRQ_REMOVE,
+  MPC55XX_FATAL_EDMA_IRQ_INSTALL,
+  MPC55XX_FATAL_EDMA_IRQ_REMOVE,
+
+  /* MRM332 fatal codes */
+  MRM332_FATAL_SPURIOUS_INTERRUPT = BSP_FATAL_CODE_BLOCK(6),
+
+  /* PowerPC fatal codes */
+  PPC_FATAL_EXCEPTION_INITIALIZATION = BSP_FATAL_CODE_BLOCK(7)
+} bsp_fatal_code;
+
+RTEMS_COMPILER_NO_RETURN_ATTRIBUTE static inline void
+bsp_fatal( bsp_fatal_code code )
+{
+  rtems_fatal( RTEMS_FATAL_SOURCE_BSP, (rtems_fatal_code) code );
+}
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* LIBBSP_SHARED_BSP_FATAL_H */
diff --git a/c/src/lib/libbsp/shared/include/generic-fatal.h b/c/src/lib/libbsp/shared/include/generic-fatal.h
deleted file mode 100644
index 4565271..0000000
--- a/c/src/lib/libbsp/shared/include/generic-fatal.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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_CONSOLE_MULTI_INIT,
-  BSP_GENERIC_FATAL_CONSOLE_NO_MEMORY_0,
-  BSP_GENERIC_FATAL_CONSOLE_NO_MEMORY_1,
-  BSP_GENERIC_FATAL_CONSOLE_NO_MEMORY_2,
-  BSP_GENERIC_FATAL_CONSOLE_NO_MEMORY_3,
-  BSP_GENERIC_FATAL_CONSOLE_REGISTER_DEV_0,
-  BSP_GENERIC_FATAL_CONSOLE_REGISTER_DEV_1,
-  BSP_GENERIC_FATAL_CONSOLE_NO_DEV
-} bsp_generic_fatal_code;
-
-RTEMS_COMPILER_NO_RETURN_ATTRIBUTE 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/include/irq-generic.h b/c/src/lib/libbsp/shared/include/irq-generic.h
index 329b120..82267f4 100644
--- a/c/src/lib/libbsp/shared/include/irq-generic.h
+++ b/c/src/lib/libbsp/shared/include/irq-generic.h
@@ -171,8 +171,8 @@ void bsp_interrupt_handler_default(rtems_vector_number vector);
  * specific bsp_interrupt_facility_initialize() function will be called after
  * all internals are initialized.  If the BSP specific initialization fails,
  * then this is a fatal error.  The fatal error source is
- * RTEMS_FATAL_SOURCE_BSP_GENERIC and the fatal error code is
- * BSP_GENERIC_FATAL_INTERRUPT_INITIALIZATION.
+ * RTEMS_FATAL_SOURCE_BSP and the fatal error code is
+ * BSP_FATAL_INTERRUPT_INITIALIZATION.
  */
 void bsp_interrupt_initialize(void);
 
diff --git a/c/src/lib/libbsp/shared/src/irq-generic.c b/c/src/lib/libbsp/shared/src/irq-generic.c
index 69ed55a..f31b397 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/generic-fatal.h>
+#include <bsp/fatal.h>
 
 #include <stdlib.h>
 
@@ -171,7 +171,7 @@ void bsp_interrupt_initialize(void)
 
   sc = bsp_interrupt_facility_initialize();
   if (sc != RTEMS_SUCCESSFUL) {
-    bsp_generic_fatal(BSP_GENERIC_FATAL_INTERRUPT_INITIALIZATION);
+    bsp_fatal(BSP_FATAL_INTERRUPT_INITIALIZATION);
   }
 
   bsp_interrupt_set_initialized();
diff --git a/c/src/lib/libbsp/sparc/leon3/include/bsp.h b/c/src/lib/libbsp/sparc/leon3/include/bsp.h
index 18ae87f..b0a1730 100644
--- a/c/src/lib/libbsp/sparc/leon3/include/bsp.h
+++ b/c/src/lib/libbsp/sparc/leon3/include/bsp.h
@@ -209,10 +209,6 @@ extern void BSP_shared_interrupt_unmask(int irq);
  */
 extern void BSP_shared_interrupt_mask(int irq);
 
-typedef enum {
-  LEON3_FATAL_CPU_COUNTER_INIT
-} leon3_fatal_code;
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/c/src/lib/libbsp/sparc/leon3/startup/cpucounter.c b/c/src/lib/libbsp/sparc/leon3/startup/cpucounter.c
index 2863f35..e773d4d 100644
--- a/c/src/lib/libbsp/sparc/leon3/startup/cpucounter.c
+++ b/c/src/lib/libbsp/sparc/leon3/startup/cpucounter.c
@@ -13,6 +13,7 @@
  */
 
 #include <bsp.h>
+#include <bsp/fatal.h>
 #include <leon.h>
 
 #include <rtems/counter.h>
@@ -37,7 +38,7 @@ void leon3_cpu_counter_initialize(void)
     &idx
   );
   if (adev == NULL) {
-    rtems_fatal(RTEMS_FATAL_SOURCE_BSP_SPECIFIC, LEON3_FATAL_CPU_COUNTER_INIT);
+    bsp_fatal(LEON3_FATAL_CPU_COUNTER_INIT);
   }
 
   gpt = (volatile struct gptimer_regs *) DEV_TO_APB(adev)->start;
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 07dfbea..8a685d7 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/generic-fatal.h>
+#include <bsp/fatal.h>
 
 #define PPC_EXC_ASSERT_OFFSET(field, off) \
   RTEMS_STATIC_ASSERT( \
@@ -145,7 +145,7 @@ static void ppc_exc_initialize_booke(void *vector_base)
 
 static void ppc_exc_fatal_error(void)
 {
-  bsp_generic_fatal(BSP_GENERIC_FATAL_EXCEPTION_INITIALIZATION);
+  bsp_fatal(PPC_FATAL_EXCEPTION_INITIALIZATION);
 }
 
 void ppc_exc_initialize_with_vector_base(
diff --git a/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/vectors.h b/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/vectors.h
index d928d70..dc2487c 100644
--- a/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/vectors.h
+++ b/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/vectors.h
@@ -370,8 +370,8 @@ void ppc_exc_initialize_with_vector_base(
  * @brief Initializes the exception handling.
  *
  * If the initialization fails, then this is a fatal error.  The fatal error
- * source is RTEMS_FATAL_SOURCE_BSP_GENERIC and the fatal error code is
- * BSP_GENERIC_FATAL_EXCEPTION_INITIALIZATION.
+ * source is RTEMS_FATAL_SOURCE_BSP and the fatal error code is
+ * PPC_FATAL_EXCEPTION_INITIALIZATION.
  *
  * Possible error reasons are
  * - no category set available for the current CPU,
diff --git a/cpukit/score/include/rtems/score/interr.h b/cpukit/score/include/rtems/score/interr.h
index 0e9a9cc..6b495d2 100644
--- a/cpukit/score/include/rtems/score/interr.h
+++ b/cpukit/score/include/rtems/score/interr.h
@@ -69,21 +69,14 @@ typedef enum {
   RTEMS_FATAL_SOURCE_EXIT,
 
   /**
-   * @brief Fatal source for generic BSP errors.
+   * @brief Fatal source for BSP errors.
    *
-   * The fatal codes are defined in <bsp/generic-fatal.h>.  Examples are
-   * interrupt and exception initialization.
+   * The fatal codes are defined in <bsp/fatal.h>.  Examples are interrupt and
+   * exception initialization.
    *
-   * @see bsp_generic_fatal_code and bsp_generic_fatal().
+   * @see bsp_fatal_code and bsp_fatal().
    */
-  RTEMS_FATAL_SOURCE_BSP_GENERIC,
-
-  /**
-   * @brief Fatal source for BSP specific errors.
-   *
-   * The fatal code is BSP specific.
-   */
-  RTEMS_FATAL_SOURCE_BSP_SPECIFIC,
+  RTEMS_FATAL_SOURCE_BSP,
 
   /**
    * @brief Fatal source of assert().
-- 
1.7.7




More information about the devel mailing list