source: rtems/cpukit/score/include/rtems/score/interr.h @ b9bc399

4.115
Last change on this file since b9bc399 was b9bc399, checked in by Sebastian Huber <sebastian.huber@…>, on 11/14/12 at 12:50:11

score: Add RTEMS_FATAL_SOURCE_BSP_SPECIFIC

  • Property mode set to 100644
File size: 4.4 KB
Line 
1/**
2 *  @file  rtems/score/interr.h
3 *
4 *  This include file contains constants and prototypes related
5 *  to the Internal Error Handler.
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2009.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.com/license/LICENSE.
15 */
16
17#ifndef _RTEMS_SCORE_INTERR_H
18#define _RTEMS_SCORE_INTERR_H
19
20#include <stdbool.h>
21#include <stdint.h>
22
23#include <rtems/system.h>
24
25/**
26 *  @defgroup ScoreIntErr Internal Error Handler
27 *
28 *  @ingroup Score
29 *
30 *  This handler encapsulates functionality which provides the foundation
31 *  Semaphore services used in all of the APIs supported by RTEMS.
32 */
33/**@{*/
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39/**
40 *  @brief This type lists the possible sources from which an error
41 *  can be reported.
42 */
43typedef enum {
44  INTERNAL_ERROR_CORE,
45  INTERNAL_ERROR_RTEMS_API,
46  INTERNAL_ERROR_POSIX_API,
47
48  /**
49   * @brief Fatal source for the block device cache.
50   *
51   * @see rtems_bdbuf_fatal_code.
52   */
53  RTEMS_FATAL_SOURCE_BDBUF,
54
55  /**
56   * @brief Fatal source for application specific errors.
57   *
58   * The fatal code is application specific.
59   */
60  RTEMS_FATAL_SOURCE_APPLICATION,
61
62  /**
63   * @brief Fatal source of exit().
64   *
65   * The fatal code is the exit() status code.
66   */
67  RTEMS_FATAL_SOURCE_EXIT,
68
69  /**
70   * @brief Fatal source for generic BSP errors.
71   *
72   * The fatal codes are defined in <bsp/bootcard.h>.  Examples are interrupt
73   * and exception initialization.
74   *
75   * @see bsp_generic_fatal_code.
76   */
77  RTEMS_FATAL_SOURCE_BSP_GENERIC,
78
79  /**
80   * @brief Fatal source for BSP specific errors.
81   *
82   * The fatal code is BSP specific.
83   */
84  RTEMS_FATAL_SOURCE_BSP_SPECIFIC,
85
86  /**
87   * @brief The last available fatal source.
88   *
89   * This enum value ensures that the enum type needs at least 32-bits for
90   * architectures with short enums.
91   */
92  RTEMS_FATAL_SOURCE_LAST = 0xffffffff
93} Internal_errors_Source;
94
95/**
96 *  A list of errors which are generated internally by the executive core.
97 */
98typedef enum {
99  INTERNAL_ERROR_NO_CONFIGURATION_TABLE,
100  INTERNAL_ERROR_NO_CPU_TABLE,
101  INTERNAL_ERROR_TOO_LITTLE_WORKSPACE,
102  INTERNAL_ERROR_WORKSPACE_ALLOCATION,
103  INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL,
104  INTERNAL_ERROR_THREAD_EXITTED,
105  INTERNAL_ERROR_INCONSISTENT_MP_INFORMATION,
106  INTERNAL_ERROR_INVALID_NODE,
107  INTERNAL_ERROR_NO_MPCI,
108  INTERNAL_ERROR_BAD_PACKET,
109  INTERNAL_ERROR_OUT_OF_PACKETS,
110  INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS,
111  INTERNAL_ERROR_OUT_OF_PROXIES,
112  INTERNAL_ERROR_INVALID_GLOBAL_ID,
113  INTERNAL_ERROR_BAD_STACK_HOOK,
114  INTERNAL_ERROR_BAD_ATTRIBUTES,
115  INTERNAL_ERROR_IMPLEMENTATION_KEY_CREATE_INCONSISTENCY,
116  INTERNAL_ERROR_IMPLEMENTATION_BLOCKING_OPERATION_CANCEL,
117  INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE,
118  INTERNAL_ERROR_UNLIMITED_AND_MAXIMUM_IS_0,
119  INTERNAL_ERROR_SHUTDOWN_WHEN_NOT_UP,
120  INTERNAL_ERROR_GXX_KEY_ADD_FAILED,
121  INTERNAL_ERROR_GXX_MUTEX_INIT_FAILED,
122  INTERNAL_ERROR_NO_MEMORY_FOR_HEAP,
123  INTERNAL_ERROR_CPU_ISR_INSTALL_VECTOR
124} Internal_errors_Core_list;
125
126typedef uint32_t Internal_errors_t;
127
128/**
129 *  This type holds the fatal error information.
130 */
131typedef struct {
132  /** This is the source of the error. */
133  Internal_errors_Source  the_source;
134  /** This indicates if the error is internal of external. */
135  bool                    is_internal;
136  /** This is the error code. */
137  Internal_errors_t       the_error;
138
139  /**
140   * @brief The internal error nest level.
141   *
142   * This helps to detect recursive calls to _Internal_error_Occurred().
143   */
144  uint32_t                nest_level;
145} Internal_errors_Information;
146
147/**
148 *  When a fatal error occurs, the error information is stored here.
149 */
150extern Internal_errors_Information _Internal_errors_What_happened;
151
152/**
153 * @brief An internal or fatal error occurred.
154 *
155 * This routine is invoked when the application or the executive itself
156 * determines that a fatal error has occurred.
157 *
158 * This function can be called in every system state provided the following
159 * conditions are true
160 * - the stack pointer is valid,
161 * - the code memory is valid,
162 * - the read-only data is valid, and
163 * - the read-write data is accessible.
164 */
165void _Internal_error_Occurred(
166  Internal_errors_Source  the_source,
167  bool                    is_internal,
168  Internal_errors_t       the_error
169) RTEMS_COMPILER_NO_RETURN_ATTRIBUTE;
170
171#ifdef __cplusplus
172}
173#endif
174
175/**@}*/
176
177#endif
178/* end of include file */
Note: See TracBrowser for help on using the repository browser.