From ade27c69eb4f520645caedd3be5af7fb9a9e691e Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 20 Jun 2013 11:44:04 +0200 Subject: bsps: Move bsp_generic_fatal_code to new file 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 60a0d49e9d..5e27b5b0e6 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 c9c94fe552..1b659f0caf 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 -#include +#include #include 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 f4f0fa4edb..07c18f17a8 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 f3de76036c..ca27832ec2 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 * @@ -50,15 +50,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(). */ 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 0000000000..4edf4675a9 --- /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 + * + * + * 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 + +#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 5cf9c91d77..b2d712a273 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 -#include +#include #include @@ -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 6ac98804dd..d0f911665d 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 #include -#include +#include #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 a047ca6766..79edc21249 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 . Examples are interrupt - * and exception initialization. + * The fatal codes are defined in . 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, -- cgit v1.2.3