bsps: Move bsp_generic_fatal_code to new file

Add bsp_generic_fatal().
This commit is contained in:
Sebastian Huber
2013-06-20 11:44:04 +02:00
parent 5f91272e9b
commit ade27c69eb
8 changed files with 58 additions and 29 deletions

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -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@embedded-brains.de>
@@ -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().
*/

View File

@@ -0,0 +1,42 @@
/*
* Copyright (c) 2012-2013 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Dornierstr. 4
* 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
* 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 */

View File

@@ -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();

View File

@@ -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(

View File

@@ -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,