[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 | /** |
---|
[3a4ae6c] | 40 | * This type lists the possible sources from which an error |
---|
| 41 | * can be reported. |
---|
| 42 | */ |
---|
| 43 | typedef enum { |
---|
| 44 | INTERNAL_ERROR_CORE, |
---|
[7640525] | 45 | INTERNAL_ERROR_RTEMS_API, |
---|
[226d66d5] | 46 | INTERNAL_ERROR_POSIX_API |
---|
[3a4ae6c] | 47 | } Internal_errors_Source; |
---|
| 48 | |
---|
[6a07436] | 49 | /** |
---|
[3a4ae6c] | 50 | * A list of errors which are generated internally by the executive core. |
---|
| 51 | */ |
---|
| 52 | typedef enum { |
---|
| 53 | INTERNAL_ERROR_NO_CONFIGURATION_TABLE, |
---|
| 54 | INTERNAL_ERROR_NO_CPU_TABLE, |
---|
| 55 | INTERNAL_ERROR_TOO_LITTLE_WORKSPACE, |
---|
| 56 | INTERNAL_ERROR_WORKSPACE_ALLOCATION, |
---|
| 57 | INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL, |
---|
| 58 | INTERNAL_ERROR_THREAD_EXITTED, |
---|
| 59 | INTERNAL_ERROR_INCONSISTENT_MP_INFORMATION, |
---|
| 60 | INTERNAL_ERROR_INVALID_NODE, |
---|
| 61 | INTERNAL_ERROR_NO_MPCI, |
---|
| 62 | INTERNAL_ERROR_BAD_PACKET, |
---|
| 63 | INTERNAL_ERROR_OUT_OF_PACKETS, |
---|
| 64 | INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS, |
---|
| 65 | INTERNAL_ERROR_OUT_OF_PROXIES, |
---|
[a155b3c] | 66 | INTERNAL_ERROR_INVALID_GLOBAL_ID, |
---|
[5870ac55] | 67 | INTERNAL_ERROR_BAD_STACK_HOOK, |
---|
[bbbe9413] | 68 | INTERNAL_ERROR_BAD_ATTRIBUTES, |
---|
[3168deaa] | 69 | INTERNAL_ERROR_IMPLEMENTATION_KEY_CREATE_INCONSISTENCY, |
---|
[81f5957] | 70 | INTERNAL_ERROR_IMPLEMENTATION_BLOCKING_OPERATION_CANCEL, |
---|
[eabaf58] | 71 | INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE, |
---|
[7299818] | 72 | INTERNAL_ERROR_UNLIMITED_AND_MAXIMUM_IS_0, |
---|
[4b9ddca4] | 73 | INTERNAL_ERROR_SHUTDOWN_WHEN_NOT_UP, |
---|
| 74 | INTERNAL_ERROR_GXX_KEY_ADD_FAILED, |
---|
[47a3cd8] | 75 | INTERNAL_ERROR_GXX_MUTEX_INIT_FAILED, |
---|
[b31a960] | 76 | INTERNAL_ERROR_NO_MEMORY_FOR_HEAP, |
---|
| 77 | INTERNAL_ERROR_CPU_ISR_INSTALL_VECTOR |
---|
[3a4ae6c] | 78 | } Internal_errors_Core_list; |
---|
| 79 | |
---|
[25e02d5] | 80 | typedef uint32_t Internal_errors_t; |
---|
| 81 | |
---|
[6a07436] | 82 | /** |
---|
[3a4ae6c] | 83 | * This type holds the fatal error information. |
---|
| 84 | */ |
---|
| 85 | typedef struct { |
---|
[6a07436] | 86 | /** This is the source of the error. */ |
---|
[3a4ae6c] | 87 | Internal_errors_Source the_source; |
---|
[6a07436] | 88 | /** This indicates if the error is internal of external. */ |
---|
[484a769] | 89 | bool is_internal; |
---|
[6a07436] | 90 | /** This is the error code. */ |
---|
[25e02d5] | 91 | Internal_errors_t the_error; |
---|
[7d0bdca] | 92 | |
---|
| 93 | /** |
---|
| 94 | * @brief The internal error nest level. |
---|
| 95 | * |
---|
| 96 | * This helps to detect recursive calls to _Internal_error_Occurred(). |
---|
| 97 | */ |
---|
| 98 | uint32_t nest_level; |
---|
[3a4ae6c] | 99 | } Internal_errors_Information; |
---|
| 100 | |
---|
[6a07436] | 101 | /** |
---|
[3a4ae6c] | 102 | * When a fatal error occurs, the error information is stored here. |
---|
| 103 | */ |
---|
[ecf9858] | 104 | extern Internal_errors_Information _Internal_errors_What_happened; |
---|
[3a4ae6c] | 105 | |
---|
[4b72da4] | 106 | /** |
---|
[891d0d96] | 107 | * @brief An internal or fatal error occurred. |
---|
[3a4ae6c] | 108 | * |
---|
[891d0d96] | 109 | * This routine is invoked when the application or the executive itself |
---|
| 110 | * determines that a fatal error has occurred. |
---|
| 111 | * |
---|
| 112 | * This function can be called in every system state provided the following |
---|
| 113 | * conditions are true |
---|
| 114 | * - the stack pointer is valid, |
---|
| 115 | * - the code memory is valid, |
---|
| 116 | * - the read-only data is valid, and |
---|
| 117 | * - the read-write data is accessible. |
---|
[3a4ae6c] | 118 | */ |
---|
[ee081506] | 119 | void _Internal_error_Occurred( |
---|
[3a4ae6c] | 120 | Internal_errors_Source the_source, |
---|
[484a769] | 121 | bool is_internal, |
---|
[25e02d5] | 122 | Internal_errors_t the_error |
---|
[7d12442c] | 123 | ) RTEMS_COMPILER_NO_RETURN_ATTRIBUTE; |
---|
[3a4ae6c] | 124 | |
---|
| 125 | #ifdef __cplusplus |
---|
| 126 | } |
---|
| 127 | #endif |
---|
| 128 | |
---|
[baff4da] | 129 | /**@}*/ |
---|
| 130 | |
---|
[3a4ae6c] | 131 | #endif |
---|
| 132 | /* end of include file */ |
---|