[20f02c6] | 1 | /** |
---|
[11874561] | 2 | * @file rtems/score/interr.h |
---|
[3a4ae6c] | 3 | * |
---|
| 4 | * This include file contains constants and prototypes related |
---|
[a0ed4ed] | 5 | * to the Internal Error Handler. |
---|
[baff4da] | 6 | */ |
---|
| 7 | |
---|
| 8 | /* |
---|
[4b72da4] | 9 | * COPYRIGHT (c) 1989-2009. |
---|
[3a4ae6c] | 10 | * On-Line Applications Research Corporation (OAR). |
---|
| 11 | * |
---|
[98e4ebf5] | 12 | * The license and distribution terms for this file may be |
---|
| 13 | * found in the file LICENSE in this distribution or at |
---|
[dd687d97] | 14 | * http://www.rtems.com/license/LICENSE. |
---|
[3a4ae6c] | 15 | */ |
---|
| 16 | |
---|
[092f142a] | 17 | #ifndef _RTEMS_SCORE_INTERR_H |
---|
| 18 | #define _RTEMS_SCORE_INTERR_H |
---|
[3a4ae6c] | 19 | |
---|
[25e02d5] | 20 | #include <stdbool.h> |
---|
| 21 | #include <stdint.h> |
---|
| 22 | |
---|
| 23 | #include <rtems/system.h> |
---|
| 24 | |
---|
[baff4da] | 25 | /** |
---|
| 26 | * @defgroup ScoreIntErr Internal Error Handler |
---|
| 27 | * |
---|
[d8cd045c] | 28 | * @ingroup Score |
---|
| 29 | * |
---|
[6a07436] | 30 | * This handler encapsulates functionality which provides the foundation |
---|
[baff4da] | 31 | * Semaphore services used in all of the APIs supported by RTEMS. |
---|
| 32 | */ |
---|
| 33 | /**@{*/ |
---|
| 34 | |
---|
[3a4ae6c] | 35 | #ifdef __cplusplus |
---|
| 36 | extern "C" { |
---|
| 37 | #endif |
---|
| 38 | |
---|
[baff4da] | 39 | /** |
---|
[156e91e] | 40 | * @brief This type lists the possible sources from which an error |
---|
[3a4ae6c] | 41 | * can be reported. |
---|
| 42 | */ |
---|
| 43 | typedef enum { |
---|
| 44 | INTERNAL_ERROR_CORE, |
---|
[7640525] | 45 | INTERNAL_ERROR_RTEMS_API, |
---|
[156e91e] | 46 | INTERNAL_ERROR_POSIX_API, |
---|
| 47 | |
---|
[608940f] | 48 | /** |
---|
| 49 | * @brief Fatal source for the block device cache. |
---|
| 50 | * |
---|
| 51 | * @see rtems_bdbuf_fatal_code. |
---|
| 52 | */ |
---|
| 53 | RTEMS_FATAL_SOURCE_BDBUF, |
---|
| 54 | |
---|
[038e2f4a] | 55 | /** |
---|
| 56 | * @brief Fatal source for application specific errors. |
---|
| 57 | * |
---|
| 58 | * The fatal code is application specific. |
---|
| 59 | */ |
---|
| 60 | RTEMS_FATAL_SOURCE_APPLICATION, |
---|
| 61 | |
---|
[a052181] | 62 | /** |
---|
| 63 | * @brief Fatal source of exit(). |
---|
| 64 | * |
---|
| 65 | * The fatal code is the exit() status code. |
---|
| 66 | */ |
---|
| 67 | RTEMS_FATAL_SOURCE_EXIT, |
---|
| 68 | |
---|
[9d10cf90] | 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 | |
---|
[b9bc399] | 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 | |
---|
[a0c7aa55] | 86 | /** |
---|
| 87 | * @brief Fatal source of assert(). |
---|
| 88 | * |
---|
| 89 | * The fatal code is the pointer value of the function string. |
---|
| 90 | */ |
---|
| 91 | RTEMS_FATAL_SOURCE_ASSERT, |
---|
| 92 | |
---|
[156e91e] | 93 | /** |
---|
| 94 | * @brief The last available fatal source. |
---|
| 95 | * |
---|
| 96 | * This enum value ensures that the enum type needs at least 32-bits for |
---|
| 97 | * architectures with short enums. |
---|
| 98 | */ |
---|
| 99 | RTEMS_FATAL_SOURCE_LAST = 0xffffffff |
---|
[3a4ae6c] | 100 | } Internal_errors_Source; |
---|
| 101 | |
---|
[6a07436] | 102 | /** |
---|
[3a4ae6c] | 103 | * A list of errors which are generated internally by the executive core. |
---|
| 104 | */ |
---|
| 105 | typedef enum { |
---|
| 106 | INTERNAL_ERROR_NO_CONFIGURATION_TABLE, |
---|
| 107 | INTERNAL_ERROR_NO_CPU_TABLE, |
---|
| 108 | INTERNAL_ERROR_TOO_LITTLE_WORKSPACE, |
---|
| 109 | INTERNAL_ERROR_WORKSPACE_ALLOCATION, |
---|
| 110 | INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL, |
---|
| 111 | INTERNAL_ERROR_THREAD_EXITTED, |
---|
| 112 | INTERNAL_ERROR_INCONSISTENT_MP_INFORMATION, |
---|
| 113 | INTERNAL_ERROR_INVALID_NODE, |
---|
| 114 | INTERNAL_ERROR_NO_MPCI, |
---|
| 115 | INTERNAL_ERROR_BAD_PACKET, |
---|
| 116 | INTERNAL_ERROR_OUT_OF_PACKETS, |
---|
| 117 | INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS, |
---|
| 118 | INTERNAL_ERROR_OUT_OF_PROXIES, |
---|
[a155b3c] | 119 | INTERNAL_ERROR_INVALID_GLOBAL_ID, |
---|
[5870ac55] | 120 | INTERNAL_ERROR_BAD_STACK_HOOK, |
---|
[bbbe9413] | 121 | INTERNAL_ERROR_BAD_ATTRIBUTES, |
---|
[3168deaa] | 122 | INTERNAL_ERROR_IMPLEMENTATION_KEY_CREATE_INCONSISTENCY, |
---|
[81f5957] | 123 | INTERNAL_ERROR_IMPLEMENTATION_BLOCKING_OPERATION_CANCEL, |
---|
[eabaf58] | 124 | INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE, |
---|
[7299818] | 125 | INTERNAL_ERROR_UNLIMITED_AND_MAXIMUM_IS_0, |
---|
[4b9ddca4] | 126 | INTERNAL_ERROR_SHUTDOWN_WHEN_NOT_UP, |
---|
| 127 | INTERNAL_ERROR_GXX_KEY_ADD_FAILED, |
---|
[47a3cd8] | 128 | INTERNAL_ERROR_GXX_MUTEX_INIT_FAILED, |
---|
[b31a960] | 129 | INTERNAL_ERROR_NO_MEMORY_FOR_HEAP, |
---|
| 130 | INTERNAL_ERROR_CPU_ISR_INSTALL_VECTOR |
---|
[3a4ae6c] | 131 | } Internal_errors_Core_list; |
---|
| 132 | |
---|
[25e02d5] | 133 | typedef uint32_t Internal_errors_t; |
---|
| 134 | |
---|
[6a07436] | 135 | /** |
---|
[3a4ae6c] | 136 | * This type holds the fatal error information. |
---|
| 137 | */ |
---|
| 138 | typedef struct { |
---|
[6a07436] | 139 | /** This is the source of the error. */ |
---|
[3a4ae6c] | 140 | Internal_errors_Source the_source; |
---|
[6a07436] | 141 | /** This indicates if the error is internal of external. */ |
---|
[484a769] | 142 | bool is_internal; |
---|
[6a07436] | 143 | /** This is the error code. */ |
---|
[25e02d5] | 144 | Internal_errors_t the_error; |
---|
[7d0bdca] | 145 | |
---|
| 146 | /** |
---|
| 147 | * @brief The internal error nest level. |
---|
| 148 | * |
---|
| 149 | * This helps to detect recursive calls to _Internal_error_Occurred(). |
---|
| 150 | */ |
---|
| 151 | uint32_t nest_level; |
---|
[3a4ae6c] | 152 | } Internal_errors_Information; |
---|
| 153 | |
---|
[6a07436] | 154 | /** |
---|
[3a4ae6c] | 155 | * When a fatal error occurs, the error information is stored here. |
---|
| 156 | */ |
---|
[ecf9858] | 157 | extern Internal_errors_Information _Internal_errors_What_happened; |
---|
[3a4ae6c] | 158 | |
---|
[4b72da4] | 159 | /** |
---|
[891d0d96] | 160 | * @brief An internal or fatal error occurred. |
---|
[3a4ae6c] | 161 | * |
---|
[891d0d96] | 162 | * This routine is invoked when the application or the executive itself |
---|
| 163 | * determines that a fatal error has occurred. |
---|
| 164 | * |
---|
| 165 | * This function can be called in every system state provided the following |
---|
| 166 | * conditions are true |
---|
| 167 | * - the stack pointer is valid, |
---|
| 168 | * - the code memory is valid, |
---|
| 169 | * - the read-only data is valid, and |
---|
| 170 | * - the read-write data is accessible. |
---|
[3a4ae6c] | 171 | */ |
---|
[ee081506] | 172 | void _Internal_error_Occurred( |
---|
[3a4ae6c] | 173 | Internal_errors_Source the_source, |
---|
[484a769] | 174 | bool is_internal, |
---|
[25e02d5] | 175 | Internal_errors_t the_error |
---|
[7d12442c] | 176 | ) RTEMS_COMPILER_NO_RETURN_ATTRIBUTE; |
---|
[3a4ae6c] | 177 | |
---|
| 178 | #ifdef __cplusplus |
---|
| 179 | } |
---|
| 180 | #endif |
---|
| 181 | |
---|
[baff4da] | 182 | /**@}*/ |
---|
| 183 | |
---|
[3a4ae6c] | 184 | #endif |
---|
| 185 | /* end of include file */ |
---|