[PATCH 09/17] bsp/leon3: Add and use fatal codes

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


---
 c/src/lib/libbsp/shared/include/fatal.h        |    2 ++
 c/src/lib/libbsp/sparc/leon3/amba/amba.c       |    3 ++-
 c/src/lib/libbsp/sparc/leon3/console/console.c |    5 +++--
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/c/src/lib/libbsp/shared/include/fatal.h b/c/src/lib/libbsp/shared/include/fatal.h
index 16d20b8..0bf0608 100644
--- a/c/src/lib/libbsp/shared/include/fatal.h
+++ b/c/src/lib/libbsp/shared/include/fatal.h
@@ -48,6 +48,8 @@ typedef enum {
 
   /* LEON3 fatal codes */
   LEON3_FATAL_CPU_COUNTER_INIT = BSP_FATAL_CODE_BLOCK(2),
+  LEON3_FATAL_NO_IRQMP_CONTROLLER,
+  LEON3_FATAL_CONSOLE_REGISTER_DEV,
 
   /* LPC24XX fatal codes */
   LPC24XX_FATAL_PL111_SET_UP = BSP_FATAL_CODE_BLOCK(3),
diff --git a/c/src/lib/libbsp/sparc/leon3/amba/amba.c b/c/src/lib/libbsp/sparc/leon3/amba/amba.c
index eb7b0f2..a4745d4 100644
--- a/c/src/lib/libbsp/sparc/leon3/amba/amba.c
+++ b/c/src/lib/libbsp/sparc/leon3/amba/amba.c
@@ -12,6 +12,7 @@
  */
 
 #include <bsp.h>
+#include <bsp/fatal.h>
 #include <ambapp.h>
 
 /* AMBA Plug&Play information description.
@@ -58,7 +59,7 @@ void amba_initialize(void)
      *
      *  What else can we do but stop ...
      */
-    asm volatile( "mov 1, %g1; ta 0x0" );
+    bsp_fatal(LEON3_FATAL_NO_IRQMP_CONTROLLER);
   }
 
   LEON3_IrqCtrl_Regs = (volatile struct irqmp_regs *)DEV_TO_APB(adev)->start;
diff --git a/c/src/lib/libbsp/sparc/leon3/console/console.c b/c/src/lib/libbsp/sparc/leon3/console/console.c
index 7e72633..368c274 100644
--- a/c/src/lib/libbsp/sparc/leon3/console/console.c
+++ b/c/src/lib/libbsp/sparc/leon3/console/console.c
@@ -27,6 +27,7 @@
  */
 
 #include <bsp.h>
+#include <bsp/fatal.h>
 #include <rtems/libio.h>
 #include <stdlib.h>
 #include <assert.h>
@@ -297,14 +298,14 @@ rtems_device_driver console_initialize(
   if (syscon_uart_index < uarts) {
     status = rtems_io_register_name("/dev/console", major, 0);
     if (status != RTEMS_SUCCESSFUL)
-      rtems_fatal_error_occurred(status);
+      bsp_fatal(LEON3_FATAL_CONSOLE_REGISTER_DEV);
   }
   strcpy(console_name,"/dev/console_a");
   for (i = 0; i < uarts; i++) {
     if (i == syscon_uart_index)
       continue; /* skip UART that is registered as /dev/console */
     console_name[13] = 'a' + i;
-    status = rtems_io_register_name( console_name, major, i+1);
+    rtems_io_register_name( console_name, major, i+1);
   }
 
   return RTEMS_SUCCESSFUL;
-- 
1.7.7




More information about the devel mailing list