summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/shared
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2012-11-14 13:59:27 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2012-11-15 15:33:13 +0100
commitdd8df5941321b1bcd7c5b40f7442983b7a3cdc28 (patch)
tree8bfed6bb34fa010e6842b2cf9ad817b12dec43bc /c/src/lib/libbsp/shared
parentscore: Add RTEMS_FATAL_SOURCE_BSP_SPECIFIC (diff)
downloadrtems-dd8df5941321b1bcd7c5b40f7442983b7a3cdc28.tar.bz2
bsps: Interrupt initialization error is fatal
Diffstat (limited to 'c/src/lib/libbsp/shared')
-rw-r--r--c/src/lib/libbsp/shared/include/bootcard.h7
-rw-r--r--c/src/lib/libbsp/shared/include/irq-generic.h25
-rw-r--r--c/src/lib/libbsp/shared/src/irq-generic.c33
3 files changed, 35 insertions, 30 deletions
diff --git a/c/src/lib/libbsp/shared/include/bootcard.h b/c/src/lib/libbsp/shared/include/bootcard.h
index 1350bb6138..610f175964 100644
--- a/c/src/lib/libbsp/shared/include/bootcard.h
+++ b/c/src/lib/libbsp/shared/include/bootcard.h
@@ -51,6 +51,13 @@ extern "C" {
*/
/**
+ * @brief Generic BSP fatal error codes.
+ */
+typedef enum {
+ BSP_GENERIC_FATAL_INTERRUPT_INITIALIZATION
+} 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/irq-generic.h b/c/src/lib/libbsp/shared/include/irq-generic.h
index d7d5cd095a..d365c0c851 100644
--- a/c/src/lib/libbsp/shared/include/irq-generic.h
+++ b/c/src/lib/libbsp/shared/include/irq-generic.h
@@ -9,12 +9,13 @@
/*
* Based on concepts of Pavel Pisa, Till Straumann and Eric Valette.
*
- * Copyright (c) 2008, 2009, 2010
- * embedded brains GmbH
- * Obere Lagerstr. 30
- * D-82178 Puchheim
- * Germany
- * <rtems@embedded-brains.de>
+ * Copyright (c) 2008-2012 embedded brains GmbH.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
@@ -163,11 +164,15 @@ void bsp_interrupt_handler_default(rtems_vector_number vector);
* @brief Initialize BSP interrupt support.
*
* You must call this function before you can install, remove and dispatch
- * interrupt handlers. The BSP specific bsp_interrupt_facility_initialize()
- * function will be called after all internals are initialized. Initialization
- * is complete if everything was successful.
+ * interrupt handlers. There is no protection against concurrent
+ * initialization. This function must be called at most once. The BSP
+ * 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_status_code bsp_interrupt_initialize(void);
+void bsp_interrupt_initialize(void);
/**
* @brief BSP specific initialization.
diff --git a/c/src/lib/libbsp/shared/src/irq-generic.c b/c/src/lib/libbsp/shared/src/irq-generic.c
index d0d593281b..5cf9c91d77 100644
--- a/c/src/lib/libbsp/shared/src/irq-generic.c
+++ b/c/src/lib/libbsp/shared/src/irq-generic.c
@@ -9,12 +9,13 @@
/*
* Based on concepts of Pavel Pisa, Till Straumann and Eric Valette.
*
- * Copyright (c) 2008, 2009
- * embedded brains GmbH
- * Obere Lagerstr. 30
- * D-82178 Puchheim
- * Germany
- * <rtems@embedded-brains.de>
+ * Copyright (c) 2008-2012 embedded brains GmbH.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
@@ -22,6 +23,7 @@
*/
#include <bsp/irq-generic.h>
+#include <bsp/bootcard.h>
#include <stdlib.h>
@@ -155,18 +157,11 @@ static void bsp_interrupt_unlock(void)
}
}
-rtems_status_code bsp_interrupt_initialize(void)
+void bsp_interrupt_initialize(void)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
size_t i = 0;
- bsp_interrupt_lock();
-
- if (bsp_interrupt_is_initialized()) {
- bsp_interrupt_unlock();
- return RTEMS_INTERNAL_ERROR;
- }
-
/* Initialize handler table */
for (i = 0; i < BSP_INTERRUPT_HANDLER_TABLE_SIZE; ++i) {
bsp_interrupt_handler_table [i].handler = bsp_interrupt_handler_empty;
@@ -175,15 +170,13 @@ rtems_status_code bsp_interrupt_initialize(void)
sc = bsp_interrupt_facility_initialize();
if (sc != RTEMS_SUCCESSFUL) {
- bsp_interrupt_unlock();
- return sc;
+ rtems_fatal(
+ RTEMS_FATAL_SOURCE_BSP_GENERIC,
+ BSP_GENERIC_FATAL_INTERRUPT_INITIALIZATION
+ );
}
bsp_interrupt_set_initialized();
-
- bsp_interrupt_unlock();
-
- return RTEMS_SUCCESSFUL;
}
/**