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