![]() |
|
|||
File indexing completed on 2025-05-11 08:24:13
0001 /* SPDX-License-Identifier: BSD-2-Clause */ 0002 0003 /** 0004 * @file 0005 * 0006 * @ingroup RTEMSScoreIntErr 0007 * 0008 * @brief This header file provides the interfaces of the 0009 * @ref RTEMSScoreIntErr. 0010 */ 0011 0012 /* 0013 * COPYRIGHT (c) 1989-2009. 0014 * On-Line Applications Research Corporation (OAR). 0015 * 0016 * Redistribution and use in source and binary forms, with or without 0017 * modification, are permitted provided that the following conditions 0018 * are met: 0019 * 1. Redistributions of source code must retain the above copyright 0020 * notice, this list of conditions and the following disclaimer. 0021 * 2. Redistributions in binary form must reproduce the above copyright 0022 * notice, this list of conditions and the following disclaimer in the 0023 * documentation and/or other materials provided with the distribution. 0024 * 0025 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 0026 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 0027 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 0028 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 0029 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 0030 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 0031 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 0032 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 0033 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 0034 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 0035 * POSSIBILITY OF SUCH DAMAGE. 0036 */ 0037 0038 #ifndef _RTEMS_SCORE_INTERR_H 0039 #define _RTEMS_SCORE_INTERR_H 0040 0041 #include <rtems/score/cpu.h> 0042 0043 /** 0044 * @defgroup RTEMSScoreIntErr Internal Error Handler 0045 * 0046 * @ingroup RTEMSScore 0047 * 0048 * @brief This group contains the Internal Error Handler implementation. 0049 * 0050 * This handler encapsulates functionality to terminate the system. 0051 * 0052 * @{ 0053 */ 0054 0055 #ifdef __cplusplus 0056 extern "C" { 0057 #endif 0058 0059 /** 0060 * @brief This type lists the possible sources from which an error 0061 * can be reported. 0062 */ 0063 typedef enum { 0064 /** 0065 * @brief Errors of the core system. 0066 * 0067 * @see Internal_errors_Core_list. 0068 */ 0069 INTERNAL_ERROR_CORE = 0, 0070 0071 /** 0072 * @brief Errors of the RTEMS API. 0073 */ 0074 INTERNAL_ERROR_RTEMS_API = 1, 0075 0076 /** 0077 * @brief Errors of the POSIX API. 0078 */ 0079 INTERNAL_ERROR_POSIX_API = 2, 0080 0081 /** 0082 * @brief Fatal source for the block device cache. 0083 * 0084 * @see rtems_bdbuf_fatal_code. 0085 */ 0086 RTEMS_FATAL_SOURCE_BDBUF = 3, 0087 0088 /** 0089 * @brief Fatal source for application specific errors. 0090 * 0091 * The fatal code is application specific. 0092 */ 0093 RTEMS_FATAL_SOURCE_APPLICATION = 4, 0094 0095 /** 0096 * @brief Fatal source of exit(). 0097 * 0098 * The fatal code is the exit() status code. 0099 */ 0100 RTEMS_FATAL_SOURCE_EXIT = 5, 0101 0102 /** 0103 * @brief Fatal source for BSP errors. 0104 * 0105 * The fatal codes are defined in <bsp/fatal.h>. Examples are interrupt and 0106 * exception initialization. 0107 * 0108 * @see bsp_fatal_code and bsp_fatal(). 0109 */ 0110 RTEMS_FATAL_SOURCE_BSP = 6, 0111 0112 /** 0113 * @brief Fatal source of assert(). 0114 * 0115 * The fatal code is the pointer value of the assert context. 0116 * 0117 * @see rtems_assert_context. 0118 */ 0119 RTEMS_FATAL_SOURCE_ASSERT = 7, 0120 0121 /** 0122 * @brief Fatal source of the stack checker. 0123 * 0124 * The fatal code is the object name of the executing task. 0125 */ 0126 RTEMS_FATAL_SOURCE_STACK_CHECKER = 8, 0127 0128 /** 0129 * @brief Fatal source of the exceptions. 0130 * 0131 * The fatal code is the pointer value of the exception frame pointer. 0132 * 0133 * @see rtems_exception_frame and rtems_exception_frame_print(). 0134 */ 0135 RTEMS_FATAL_SOURCE_EXCEPTION = 9, 0136 0137 /** 0138 * @brief Fatal source of SMP domain. 0139 * 0140 * @see SMP_Fatal_code. 0141 */ 0142 RTEMS_FATAL_SOURCE_SMP = 10, 0143 0144 /** 0145 * @brief Fatal source of rtems_panic(). 0146 * 0147 * @see rtem 0148 */ 0149 RTEMS_FATAL_SOURCE_PANIC = 11, 0150 0151 /** 0152 * @brief Fatal source for invalid C program heap frees via free(). 0153 * 0154 * The fatal code is the bad pointer. 0155 */ 0156 RTEMS_FATAL_SOURCE_INVALID_HEAP_FREE = 12, 0157 0158 /** 0159 * @brief Fatal source for heap errors. 0160 * 0161 * The fatal code is the address to a heap error context (Heap_Error_context). 0162 */ 0163 RTEMS_FATAL_SOURCE_HEAP = 13, 0164 0165 /** 0166 * @brief Fatal source for spurious interrupts. 0167 * 0168 * The fatal code is the interrupt vector number of the spurious interrupt. 0169 */ 0170 RTEMS_FATAL_SOURCE_SPURIOUS_INTERRUPT = 14, 0171 0172 /** 0173 * @brief The last available fatal source. 0174 * 0175 * This enum value ensures that the enum type needs at least 32-bits for 0176 * architectures with short enums. 0177 */ 0178 RTEMS_FATAL_SOURCE_LAST = 0x7fffffff 0179 } Internal_errors_Source; 0180 0181 /** 0182 * @brief A list of errors which are generated internally by the executive 0183 * core. 0184 * 0185 * Do not re-use numbers of obsolete error codes. Comment no longer used 0186 * error codes and do not uncomment commented or obsolete error codes. 0187 */ 0188 typedef enum { 0189 /* INTERNAL_ERROR_NO_CONFIGURATION_TABLE = 0, */ 0190 /* INTERNAL_ERROR_NO_CPU_TABLE = 1, */ 0191 INTERNAL_ERROR_TOO_LITTLE_WORKSPACE = 2, 0192 /* INTERNAL_ERROR_WORKSPACE_ALLOCATION = 3, */ 0193 /* INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL = 4, */ 0194 INTERNAL_ERROR_THREAD_EXITTED = 5, 0195 INTERNAL_ERROR_INCONSISTENT_MP_INFORMATION = 6, 0196 INTERNAL_ERROR_INVALID_NODE = 7, 0197 INTERNAL_ERROR_NO_MPCI = 8, 0198 INTERNAL_ERROR_BAD_PACKET = 9, 0199 INTERNAL_ERROR_OUT_OF_PACKETS = 10, 0200 INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS = 11, 0201 INTERNAL_ERROR_OUT_OF_PROXIES = 12, 0202 INTERNAL_ERROR_INVALID_GLOBAL_ID = 13, 0203 /* INTERNAL_ERROR_BAD_STACK_HOOK = 14, */ 0204 /* INTERNAL_ERROR_BAD_ATTRIBUTES = 15, */ 0205 /* INTERNAL_ERROR_IMPLEMENTATION_KEY_CREATE_INCONSISTENCY = 16, */ 0206 /* INTERNAL_ERROR_IMPLEMENTATION_BLOCKING_OPERATION_CANCEL = 17, */ 0207 /* INTERNAL_ERROR_THREAD_QUEUE_ENQUEUE_FROM_BAD_STATE = 18, */ 0208 /* INTERNAL_ERROR_UNLIMITED_AND_MAXIMUM_IS_0 = 19, */ 0209 /* INTERNAL_ERROR_SHUTDOWN_WHEN_NOT_UP = 20, */ 0210 /* INTERNAL_ERROR_GXX_KEY_ADD_FAILED = 21, */ 0211 /* INTERNAL_ERROR_GXX_MUTEX_INIT_FAILED = 22, */ 0212 INTERNAL_ERROR_NO_MEMORY_FOR_HEAP = 23, 0213 INTERNAL_ERROR_CPU_ISR_INSTALL_VECTOR = 24, 0214 INTERNAL_ERROR_RESOURCE_IN_USE = 25, 0215 /* INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL = 26, */ 0216 /* INTERNAL_ERROR_POSIX_INIT_THREAD_ENTRY_IS_NULL = 27, */ 0217 INTERNAL_ERROR_THREAD_QUEUE_DEADLOCK = 28, 0218 INTERNAL_ERROR_THREAD_QUEUE_ENQUEUE_STICKY_FROM_BAD_STATE = 29, 0219 INTERNAL_ERROR_BAD_THREAD_DISPATCH_DISABLE_LEVEL = 30, 0220 INTERNAL_ERROR_BAD_THREAD_DISPATCH_ENVIRONMENT = 31, 0221 INTERNAL_ERROR_RTEMS_INIT_TASK_CREATE_FAILED = 32, 0222 INTERNAL_ERROR_POSIX_INIT_THREAD_CREATE_FAILED = 33, 0223 /* INTERNAL_ERROR_LIBIO_USER_ENV_KEY_CREATE_FAILED = 34, */ 0224 /* INTERNAL_ERROR_LIBIO_SEM_CREATE_FAILED = 35, */ 0225 INTERNAL_ERROR_LIBIO_STDOUT_FD_OPEN_FAILED = 36, 0226 INTERNAL_ERROR_LIBIO_STDERR_FD_OPEN_FAILED = 37, 0227 INTERNAL_ERROR_ILLEGAL_USE_OF_FLOATING_POINT_UNIT = 38, 0228 INTERNAL_ERROR_ARC4RANDOM_GETENTROPY_FAIL = 39, 0229 INTERNAL_ERROR_NO_MEMORY_FOR_PER_CPU_DATA = 40, 0230 INTERNAL_ERROR_TOO_LARGE_TLS_SIZE = 41, 0231 INTERNAL_ERROR_RTEMS_INIT_TASK_CONSTRUCT_FAILED = 42, 0232 INTERNAL_ERROR_IDLE_THREAD_CREATE_FAILED = 43, 0233 INTERNAL_ERROR_NO_MEMORY_FOR_IDLE_TASK_STORAGE = 44, 0234 INTERNAL_ERROR_IDLE_THREAD_STACK_TOO_SMALL = 45, 0235 INTERNAL_ERROR_CANNOT_DISABLE_DATA_CACHE = 46 0236 } Internal_errors_Core_list; 0237 0238 typedef CPU_Uint32ptr Internal_errors_t; 0239 0240 /** 0241 * @brief Initiates the system termination. 0242 * 0243 * This handler is invoked to terminate the system. It is called by all 0244 * services which determine that a system termination is required. For 0245 * example, it is called by all higher level directives which announce a fatal 0246 * error like rtems_fatal() and exit(). 0247 * 0248 * The first action of the system termination handler is to disable maskable 0249 * interrupts. This ensures that interrupts on this processor do not interfere 0250 * with the system termination procedure. This reduces the likelihood to end 0251 * up in a recursive system termination procedure. 0252 * 0253 * The second action of the system termination handler is to call the fatal 0254 * extensions of the user extensions. 0255 * 0256 * The fatal extensions are called with three parameters: 0257 * 0258 * - the fatal source, 0259 * 0260 * - a legacy parameter which is always set to false, and 0261 * 0262 * - an error code with a fatal source dependent content. 0263 * 0264 * The fatal extensions of the initial extension sets are invoked first. For 0265 * them, the following execution environment is required 0266 * 0267 * - a valid stack pointer and enough stack space, 0268 * 0269 * - a valid code memory, and 0270 * 0271 * - valid read-only data. 0272 * 0273 * In uniprocessor configurations, the read-write data (including ``.bss`` 0274 * segment) is not required. In SMP configurations, however, the read-write 0275 * data must have been initialized to determine the state of the other 0276 * processors and request them to shut-down if necessary. The board support 0277 * package (BSP) may install an initial extension that performs a system reset. 0278 * See the BSP documentation in the *RTEMS User Manual* for more information 0279 * how the system reset is done. The BSP provided fatal extension can be 0280 * disabled by the #CONFIGURE_DISABLE_BSP_SETTINGS application configuration 0281 * option. It is recommended to provide an application-specific fatal 0282 * extension using the #CONFIGURE_INITIAL_EXTENSIONS application configuration 0283 * option. 0284 * 0285 * In certain error conditions, it may be unreliable to carry out the 0286 * following steps of the termination procedure since the read-write data may 0287 * be corrupt. One of the fatal extensions of the initial extension set should 0288 * reset the system to stop the system termination procedure. 0289 * 0290 * After invoking the fatal extensions of the initial extension sets, the fatal 0291 * extensions of the dynamic extension sets are invoked. For this procedure 0292 * valid read-write data is required. 0293 * 0294 * The last action of the system termination handler is to execute the CPU port 0295 * provided idle loop _CPU_Thread_Idle_body() with maskable interrupts 0296 * disabled. Please note, that properly configured applications should not 0297 * reach this point. 0298 * 0299 * @param the_source is the fatal source indicating the subsystem the fatal 0300 * condition originated in. 0301 * 0302 * @param the_error is the fatal error code. This value must be interpreted 0303 * with respect to the source. 0304 * 0305 * @see rtems_fatal() and _Internal_error(). 0306 */ 0307 RTEMS_NO_RETURN void _Terminate( 0308 Internal_errors_Source the_source, 0309 Internal_errors_t the_error 0310 ); 0311 0312 /** 0313 * @brief Terminates the system with an INTERNAL_ERROR_CORE fatal source and 0314 * the specified core error code. 0315 * 0316 * @param core_error The core error code. 0317 * 0318 * @see _Terminate(). 0319 */ 0320 RTEMS_NO_RETURN void _Internal_error( Internal_errors_Core_list core_error ); 0321 0322 #ifdef __cplusplus 0323 } 0324 #endif 0325 0326 /** @} */ 0327 0328 #endif 0329 /* end of include file */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |