source: rtems/cpukit/include/rtems/score/interr.h @ 6b0a729b

5
Last change on this file since 6b0a729b was 21275b58, checked in by Sebastian Huber <sebastian.huber@…>, on 11/22/18 at 18:14:51

score: Static Objects_Information initialization

Statically allocate the objects information together with the initial
set of objects either via <rtems/confdefs.h>. Provide default object
informations with zero objects via librtemscpu.a. This greatly
simplifies the workspace size estimate. RTEMS applications which do not
use the unlimited objects option are easier to debug since all objects
reside now in statically allocated objects of the right types.

Close #3621.

  • Property mode set to 100644
File size: 7.6 KB
RevLine 
[20f02c6]1/**
[11874561]2 *  @file  rtems/score/interr.h
[3a4ae6c]3 *
[319cb20]4 *  @brief Constants and Prototypes Related to the Internal Error Handler
5 *
[3a4ae6c]6 *  This include file contains constants and prototypes related
[a0ed4ed]7 *  to the Internal Error Handler.
[baff4da]8 */
9
10/*
[4b72da4]11 *  COPYRIGHT (c) 1989-2009.
[3a4ae6c]12 *  On-Line Applications Research Corporation (OAR).
13 *
[98e4ebf5]14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
[c499856]16 *  http://www.rtems.org/license/LICENSE.
[3a4ae6c]17 */
18
[092f142a]19#ifndef _RTEMS_SCORE_INTERR_H
20#define _RTEMS_SCORE_INTERR_H
[3a4ae6c]21
[25e02d5]22#include <stdbool.h>
23#include <stdint.h>
24
25#include <rtems/system.h>
26
[baff4da]27/**
28 *  @defgroup ScoreIntErr Internal Error Handler
29 *
[d8cd045c]30 *  @ingroup Score
31 *
[6a07436]32 *  This handler encapsulates functionality which provides the foundation
[baff4da]33 *  Semaphore services used in all of the APIs supported by RTEMS.
34 */
35/**@{*/
36
[3a4ae6c]37#ifdef __cplusplus
38extern "C" {
39#endif
40
[baff4da]41/**
[156e91e]42 *  @brief This type lists the possible sources from which an error
[3a4ae6c]43 *  can be reported.
44 */
45typedef enum {
[51acbdc]46  /**
47   * @brief Errors of the core system.
48   *
49   * @see Internal_errors_Core_list.
50   */
[f6edd880]51  INTERNAL_ERROR_CORE = 0,
[51acbdc]52
53  /**
54   * @brief Errors of the RTEMS API.
55   */
[f6edd880]56  INTERNAL_ERROR_RTEMS_API = 1,
[51acbdc]57
58  /**
59   * @brief Errors of the POSIX API.
60   */
[f6edd880]61  INTERNAL_ERROR_POSIX_API = 2,
[156e91e]62
[608940f]63  /**
64   * @brief Fatal source for the block device cache.
65   *
66   * @see rtems_bdbuf_fatal_code.
67   */
[f6edd880]68  RTEMS_FATAL_SOURCE_BDBUF = 3,
[608940f]69
[038e2f4a]70  /**
71   * @brief Fatal source for application specific errors.
72   *
73   * The fatal code is application specific.
74   */
[f6edd880]75  RTEMS_FATAL_SOURCE_APPLICATION = 4,
[038e2f4a]76
[a052181]77  /**
78   * @brief Fatal source of exit().
79   *
80   * The fatal code is the exit() status code.
81   */
[f6edd880]82  RTEMS_FATAL_SOURCE_EXIT = 5,
[a052181]83
[9d10cf90]84  /**
[33cb8bf]85   * @brief Fatal source for BSP errors.
[9d10cf90]86   *
[33cb8bf]87   * The fatal codes are defined in <bsp/fatal.h>.  Examples are interrupt and
88   * exception initialization.
[9d10cf90]89   *
[33cb8bf]90   * @see bsp_fatal_code and bsp_fatal().
[9d10cf90]91   */
[f6edd880]92  RTEMS_FATAL_SOURCE_BSP = 6,
[b9bc399]93
[a0c7aa55]94  /**
95   * @brief Fatal source of assert().
96   *
[68f36d14]97   * The fatal code is the pointer value of the assert context.
98   *
99   * @see rtems_assert_context.
[a0c7aa55]100   */
[f6edd880]101  RTEMS_FATAL_SOURCE_ASSERT = 7,
[a0c7aa55]102
[a12f7e9]103  /**
104   * @brief Fatal source of the stack checker.
105   *
106   * The fatal code is the object name of the executing task.
107   */
[f6edd880]108  RTEMS_FATAL_SOURCE_STACK_CHECKER = 8,
[a12f7e9]109
[7e32b62]110  /**
[815994f]111   * @brief Fatal source of the exceptions.
[7e32b62]112   *
113   * The fatal code is the pointer value of the exception frame pointer.
114   *
[815994f]115   * @see rtems_exception_frame and rtems_exception_frame_print().
[7e32b62]116   */
[f6edd880]117  RTEMS_FATAL_SOURCE_EXCEPTION = 9,
[7e32b62]118
[9eec2f3]119  /**
120   * @brief Fatal source of SMP domain.
121   *
122   * @see SMP_Fatal_code.
123   */
[f6edd880]124  RTEMS_FATAL_SOURCE_SMP = 10,
[9eec2f3]125
[15e19273]126  /**
127   * @brief Fatal source of rtems_panic().
128   *
129   * @see rtem
130   */
131  RTEMS_FATAL_SOURCE_PANIC = 11,
132
[de9b7d7]133  /**
134   * @brief Fatal source for invalid C program heap frees via free().
135   *
136   * The fatal code is the bad pointer.
137   */
138  RTEMS_FATAL_SOURCE_INVALID_HEAP_FREE = 12,
139
[156e91e]140  /**
141   * @brief The last available fatal source.
142   *
143   * This enum value ensures that the enum type needs at least 32-bits for
144   * architectures with short enums.
145   */
146  RTEMS_FATAL_SOURCE_LAST = 0xffffffff
[3a4ae6c]147} Internal_errors_Source;
148
[6a07436]149/**
[bee0323]150 * @brief A list of errors which are generated internally by the executive
151 * core.
152 *
153 * Do not re-use numbers of obsolete error codes.  Uncomment no longer used
154 * error codes.
[3a4ae6c]155 */
156typedef enum {
[bee0323]157  /* INTERNAL_ERROR_NO_CONFIGURATION_TABLE = 0, */
158  /* INTERNAL_ERROR_NO_CPU_TABLE = 1, */
159  INTERNAL_ERROR_TOO_LITTLE_WORKSPACE = 2,
160  INTERNAL_ERROR_WORKSPACE_ALLOCATION = 3,
[56e61e24]161  /* INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL = 4, */
[bee0323]162  INTERNAL_ERROR_THREAD_EXITTED = 5,
163  INTERNAL_ERROR_INCONSISTENT_MP_INFORMATION = 6,
164  INTERNAL_ERROR_INVALID_NODE = 7,
165  INTERNAL_ERROR_NO_MPCI = 8,
166  INTERNAL_ERROR_BAD_PACKET = 9,
167  INTERNAL_ERROR_OUT_OF_PACKETS = 10,
168  INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS = 11,
169  INTERNAL_ERROR_OUT_OF_PROXIES = 12,
170  INTERNAL_ERROR_INVALID_GLOBAL_ID = 13,
171  INTERNAL_ERROR_BAD_STACK_HOOK = 14,
172  /* INTERNAL_ERROR_BAD_ATTRIBUTES = 15, */
173  /* INTERNAL_ERROR_IMPLEMENTATION_KEY_CREATE_INCONSISTENCY = 16, */
174  /* INTERNAL_ERROR_IMPLEMENTATION_BLOCKING_OPERATION_CANCEL = 17, */
175  /* INTERNAL_ERROR_THREAD_QUEUE_ENQUEUE_FROM_BAD_STATE = 18, */
[21275b58]176  /* INTERNAL_ERROR_UNLIMITED_AND_MAXIMUM_IS_0 = 19, */
[bee0323]177  /* INTERNAL_ERROR_SHUTDOWN_WHEN_NOT_UP = 20, */
178  INTERNAL_ERROR_GXX_KEY_ADD_FAILED = 21,
179  INTERNAL_ERROR_GXX_MUTEX_INIT_FAILED = 22,
180  INTERNAL_ERROR_NO_MEMORY_FOR_HEAP = 23,
181  INTERNAL_ERROR_CPU_ISR_INSTALL_VECTOR = 24,
182  INTERNAL_ERROR_RESOURCE_IN_USE = 25,
183  INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL = 26,
[cd3e220]184  /* INTERNAL_ERROR_POSIX_INIT_THREAD_ENTRY_IS_NULL = 27, */
[bee0323]185  INTERNAL_ERROR_THREAD_QUEUE_DEADLOCK = 28,
186  INTERNAL_ERROR_THREAD_QUEUE_ENQUEUE_STICKY_FROM_BAD_STATE = 29,
187  INTERNAL_ERROR_BAD_THREAD_DISPATCH_DISABLE_LEVEL = 30,
[279d5260]188  INTERNAL_ERROR_BAD_THREAD_DISPATCH_ENVIRONMENT = 31,
[0a81a58]189  INTERNAL_ERROR_RTEMS_INIT_TASK_CREATE_FAILED = 32,
[82529688]190  INTERNAL_ERROR_POSIX_INIT_THREAD_CREATE_FAILED = 33,
[9622f779]191  INTERNAL_ERROR_LIBIO_USER_ENV_KEY_CREATE_FAILED = 34,
[bc5b56a]192  /* INTERNAL_ERROR_LIBIO_SEM_CREATE_FAILED = 35, */
[e203b65e]193  INTERNAL_ERROR_LIBIO_STDOUT_FD_OPEN_FAILED = 36,
[600d88d]194  INTERNAL_ERROR_LIBIO_STDERR_FD_OPEN_FAILED = 37,
[ddc339c]195  INTERNAL_ERROR_ILLEGAL_USE_OF_FLOATING_POINT_UNIT = 38,
196  INTERNAL_ERROR_ARC4RANDOM_GETENTROPY_FAIL = 39
[3a4ae6c]197} Internal_errors_Core_list;
198
[46d3c6d8]199typedef CPU_Uint32ptr Internal_errors_t;
[25e02d5]200
[6a07436]201/**
[3a4ae6c]202 *  This type holds the fatal error information.
203 */
204typedef struct {
[6a07436]205  /** This is the source of the error. */
[3a4ae6c]206  Internal_errors_Source  the_source;
[6a07436]207  /** This is the error code. */
[25e02d5]208  Internal_errors_t       the_error;
[3a4ae6c]209} Internal_errors_Information;
210
[6a07436]211/**
[3a4ae6c]212 *  When a fatal error occurs, the error information is stored here.
213 */
[ecf9858]214extern Internal_errors_Information _Internal_errors_What_happened;
[3a4ae6c]215
[4b72da4]216/**
[1906a36]217 * @brief Initiates system termination.
[3a4ae6c]218 *
[891d0d96]219 * This routine is invoked when the application or the executive itself
[1906a36]220 * determines that a fatal error has occurred or a final system state is
221 * reached (for example after exit()).
[891d0d96]222 *
[008efaf]223 * The first action of this function is to call the fatal handler of the user
[1906a36]224 * extensions.  For the initial extensions the following conditions are
225 * required
226 * - a valid stack pointer and enough stack space,
227 * - a valid code memory, and
228 * - valid read-only data.
[f8ac52f2]229 *
[1906a36]230 * For the initial extensions the read-write data (including BSS segment) is
[8a6de83]231 * not required on single processor configurations.  On SMP configurations
232 * however the read-write data must be initialized since this function must
233 * determine the state of the other processors and request them to shut-down if
234 * necessary.
[1906a36]235 *
236 * Non-initial extensions require in addition valid read-write data.  The BSP
237 * may install an initial extension that performs a system reset.  In this case
238 * the non-initial extensions will be not called.
239 *
240 * Once all fatal handler executed the error information will be stored to
241 * _Internal_errors_What_happened and the system state is set to
[92f50c3]242 * SYSTEM_STATE_TERMINATED.
[1906a36]243 *
244 * The final step is to call the CPU specific _CPU_Fatal_halt().
245 *
[f8ac52f2]246 * @param[in] the_source The fatal source indicating the subsystem the fatal
247 * condition originated in.
248 * @param[in] the_error The fatal error code.  This value must be interpreted
249 * with respect to the source.
[bf54252]250 *
[b6606e8]251 * @see rtems_fatal() and _Internal_error().
[3a4ae6c]252 */
[83bf105]253void _Terminate(
[3a4ae6c]254  Internal_errors_Source  the_source,
[25e02d5]255  Internal_errors_t       the_error
[143696a]256) RTEMS_NO_RETURN;
[3a4ae6c]257
[3a659b04]258/**
259 * @brief Terminates the system with an INTERNAL_ERROR_CORE fatal source and
260 * the specified core error code.
261 *
262 * @param[in] core_error The core error code.
263 *
264 * @see _Terminate().
265 */
266void _Internal_error( Internal_errors_Core_list core_error ) RTEMS_NO_RETURN;
267
[3a4ae6c]268#ifdef __cplusplus
269}
270#endif
271
[baff4da]272/**@}*/
273
[3a4ae6c]274#endif
[b10825c]275/* end of include file */
Note: See TracBrowser for help on using the repository browser.