RTC auf true
platform/mbed_error.h@0:38ceb79fef03, 2018-11-28 (annotated)
- Committer:
- kevman
- Date:
- Wed Nov 28 15:10:15 2018 +0000
- Revision:
- 0:38ceb79fef03
RTC modified
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kevman | 0:38ceb79fef03 | 1 | /** \addtogroup platform */ |
kevman | 0:38ceb79fef03 | 2 | /** @{*/ |
kevman | 0:38ceb79fef03 | 3 | /** |
kevman | 0:38ceb79fef03 | 4 | * \defgroup platform_error Error functions |
kevman | 0:38ceb79fef03 | 5 | * @{ |
kevman | 0:38ceb79fef03 | 6 | */ |
kevman | 0:38ceb79fef03 | 7 | /* mbed Microcontroller Library |
kevman | 0:38ceb79fef03 | 8 | * Copyright (c) 2006-2013 ARM Limited |
kevman | 0:38ceb79fef03 | 9 | * |
kevman | 0:38ceb79fef03 | 10 | * Licensed under the Apache License, Version 2.0 (the "License"); |
kevman | 0:38ceb79fef03 | 11 | * you may not use this file except in compliance with the License. |
kevman | 0:38ceb79fef03 | 12 | * You may obtain a copy of the License at |
kevman | 0:38ceb79fef03 | 13 | * |
kevman | 0:38ceb79fef03 | 14 | * http://www.apache.org/licenses/LICENSE-2.0 |
kevman | 0:38ceb79fef03 | 15 | * |
kevman | 0:38ceb79fef03 | 16 | * Unless required by applicable law or agreed to in writing, software |
kevman | 0:38ceb79fef03 | 17 | * distributed under the License is distributed on an "AS IS" BASIS, |
kevman | 0:38ceb79fef03 | 18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
kevman | 0:38ceb79fef03 | 19 | * See the License for the specific language governing permissions and |
kevman | 0:38ceb79fef03 | 20 | * limitations under the License. |
kevman | 0:38ceb79fef03 | 21 | */ |
kevman | 0:38ceb79fef03 | 22 | #ifndef MBED_ERROR_H |
kevman | 0:38ceb79fef03 | 23 | #define MBED_ERROR_H |
kevman | 0:38ceb79fef03 | 24 | |
kevman | 0:38ceb79fef03 | 25 | #include "platform/mbed_retarget.h" |
kevman | 0:38ceb79fef03 | 26 | #include "platform/mbed_toolchain.h" |
kevman | 0:38ceb79fef03 | 27 | |
kevman | 0:38ceb79fef03 | 28 | #ifdef __cplusplus |
kevman | 0:38ceb79fef03 | 29 | extern "C" { |
kevman | 0:38ceb79fef03 | 30 | #endif |
kevman | 0:38ceb79fef03 | 31 | |
kevman | 0:38ceb79fef03 | 32 | /** Define this macro to include filenames in error context. For release builds, do not include filename to save memory. |
kevman | 0:38ceb79fef03 | 33 | * MBED_PLATFORM_CONF_ERROR_FILENAME_CAPTURE_ENABLED |
kevman | 0:38ceb79fef03 | 34 | */ |
kevman | 0:38ceb79fef03 | 35 | |
kevman | 0:38ceb79fef03 | 36 | /** Define this macro to enable error history |
kevman | 0:38ceb79fef03 | 37 | * MBED_PLATFORM_CONF_ERROR_HIST_ENABLED |
kevman | 0:38ceb79fef03 | 38 | */ |
kevman | 0:38ceb79fef03 | 39 | |
kevman | 0:38ceb79fef03 | 40 | #ifndef MBED_CONF_PLATFORM_MAX_ERROR_FILENAME_LEN |
kevman | 0:38ceb79fef03 | 41 | #define MBED_CONF_PLATFORM_MAX_ERROR_FILENAME_LEN 16 |
kevman | 0:38ceb79fef03 | 42 | #else //MBED_CONF_PLATFORM_MAX_ERROR_FILENAME_LEN |
kevman | 0:38ceb79fef03 | 43 | #if MBED_CONF_PLATFORM_MAX_ERROR_FILENAME_LEN > 64 |
kevman | 0:38ceb79fef03 | 44 | //We have to limit this to 64 bytes since we use mbed_error_printf for error reporting |
kevman | 0:38ceb79fef03 | 45 | //and mbed_error_vfprintf uses 128bytes internal buffer which may not be sufficient for anything |
kevman | 0:38ceb79fef03 | 46 | //longer that 64 bytes with the current implementation. |
kevman | 0:38ceb79fef03 | 47 | #error "Unsupported error filename buffer length detected, max supported length is 64 chars. Please change MBED_CONF_PLATFORM_MAX_ERROR_FILENAME_LEN or max-error-filename-len in configuration." |
kevman | 0:38ceb79fef03 | 48 | #endif |
kevman | 0:38ceb79fef03 | 49 | #endif |
kevman | 0:38ceb79fef03 | 50 | |
kevman | 0:38ceb79fef03 | 51 | #define MBED_ERROR_STATUS_CODE_MASK (0x0000FFFF) |
kevman | 0:38ceb79fef03 | 52 | #define MBED_ERROR_STATUS_CODE_POS (0) |
kevman | 0:38ceb79fef03 | 53 | #define MBED_ERROR_STATUS_CODE_FIELD_SIZE (16) |
kevman | 0:38ceb79fef03 | 54 | |
kevman | 0:38ceb79fef03 | 55 | #define MBED_ERROR_STATUS_MODULE_MASK (0x00FF0000) |
kevman | 0:38ceb79fef03 | 56 | #define MBED_ERROR_STATUS_MODULE_POS (16) |
kevman | 0:38ceb79fef03 | 57 | #define MBED_ERROR_STATUS_MODULE_FIELD_SIZE (8) |
kevman | 0:38ceb79fef03 | 58 | |
kevman | 0:38ceb79fef03 | 59 | #define MBED_ERROR_STATUS_TYPE_MASK (0x60000000) |
kevman | 0:38ceb79fef03 | 60 | #define MBED_ERROR_STATUS_TYPE_POS (29) |
kevman | 0:38ceb79fef03 | 61 | #define MBED_ERROR_STATUS_TYPE_FIELD_SIZE (2) |
kevman | 0:38ceb79fef03 | 62 | |
kevman | 0:38ceb79fef03 | 63 | /* mbed_error_status_t Status Encoding */ |
kevman | 0:38ceb79fef03 | 64 | //|31(1 bit) Always Negative|30-29(2 bits) |28-24 | 23-16(8 bits) | 15-0(16 bits) | |
kevman | 0:38ceb79fef03 | 65 | //|-1 |TYPE |(unused/reserved) | MODULE TYPE | ERROR CODE | |
kevman | 0:38ceb79fef03 | 66 | |
kevman | 0:38ceb79fef03 | 67 | #define MAKE_MBED_ERROR(type, module, error_code) (mbed_error_status_t) \ |
kevman | 0:38ceb79fef03 | 68 | ((0x80000000) | \ |
kevman | 0:38ceb79fef03 | 69 | (MBED_ERROR_STATUS_CODE_MASK & (error_code << MBED_ERROR_STATUS_CODE_POS)) | \ |
kevman | 0:38ceb79fef03 | 70 | (MBED_ERROR_STATUS_MODULE_MASK & (module << MBED_ERROR_STATUS_MODULE_POS)) | \ |
kevman | 0:38ceb79fef03 | 71 | (MBED_ERROR_STATUS_TYPE_MASK & (type << MBED_ERROR_STATUS_TYPE_POS))) |
kevman | 0:38ceb79fef03 | 72 | |
kevman | 0:38ceb79fef03 | 73 | #define MBED_GET_ERROR_TYPE( error_status ) ((error_status & MBED_ERROR_STATUS_TYPE_MASK) >> MBED_ERROR_STATUS_TYPE_POS) |
kevman | 0:38ceb79fef03 | 74 | #define MBED_GET_ERROR_MODULE( error_status ) ((error_status & MBED_ERROR_STATUS_MODULE_MASK) >> MBED_ERROR_STATUS_MODULE_POS) |
kevman | 0:38ceb79fef03 | 75 | #define MBED_GET_ERROR_CODE( error_status ) (int)((MBED_GET_ERROR_TYPE( error_status ) == MBED_ERROR_TYPE_POSIX)?(-error_status):((error_status & MBED_ERROR_STATUS_CODE_MASK) >> MBED_ERROR_STATUS_CODE_POS)) |
kevman | 0:38ceb79fef03 | 76 | |
kevman | 0:38ceb79fef03 | 77 | /** mbed_error_status_t description |
kevman | 0:38ceb79fef03 | 78 | * |
kevman | 0:38ceb79fef03 | 79 | * mbed_error_status_t type represents the error status values under MbedOS. mbed_error_status_t values are signed integers and always be negative.\n |
kevman | 0:38ceb79fef03 | 80 | * Internally its encoded as below with bit-fields representing error type, module and error code:\n\n |
kevman | 0:38ceb79fef03 | 81 | * mbed_error_status_t Status Encoding:\n |
kevman | 0:38ceb79fef03 | 82 | * |
kevman | 0:38ceb79fef03 | 83 | \verbatim |
kevman | 0:38ceb79fef03 | 84 | | 31 Always Negative | 30-29(2 bits) | 28-24 | 23-16(8 bits) | 15-0(16 bits) | |
kevman | 0:38ceb79fef03 | 85 | | -1 | TYPE | (unused/reserved) | MODULE TYPE | ERROR CODE | |
kevman | 0:38ceb79fef03 | 86 | \endverbatim |
kevman | 0:38ceb79fef03 | 87 | * |
kevman | 0:38ceb79fef03 | 88 | * The error status value range for each error type is as follows:\n |
kevman | 0:38ceb79fef03 | 89 | * Posix Error Status-es - 0xFFFFFFFF to 0xFFFFFF01(-1 -255) - This corresponds to Posix error codes represented as negative.\n |
kevman | 0:38ceb79fef03 | 90 | * System Error Status-es - 0x80XX0100 to 0x80XX0FFF - This corresponds to System error codes range(all values are negative). Bits 23-16 will be module type(marked with XX)\n |
kevman | 0:38ceb79fef03 | 91 | * Custom Error Status-es - 0xA0XX1000 to 0xA0XXFFFF - This corresponds to Custom error codes range(all values are negative). Bits 23-16 will be module type(marked with XX)\n\n |
kevman | 0:38ceb79fef03 | 92 | * |
kevman | 0:38ceb79fef03 | 93 | * The ERROR CODE(values encoded into ERROR CODE bit-field in mbed_error_status_t) value range for each error type is also separated as below:\n |
kevman | 0:38ceb79fef03 | 94 | * Posix Error Codes - 1 to 255.\n |
kevman | 0:38ceb79fef03 | 95 | * System Error Codes - 256 to 4095.\n |
kevman | 0:38ceb79fef03 | 96 | * Custom Error Codes - 4096 to 65535.\n |
kevman | 0:38ceb79fef03 | 97 | * |
kevman | 0:38ceb79fef03 | 98 | * @note Posix error codes are always encoded as negative of their actual value. For example, EPERM is encoded as -EPERM. |
kevman | 0:38ceb79fef03 | 99 | * And, the MODULE TYPE for Posix error codes are always encoded as MBED_MODULE_UNKNOWN.\n |
kevman | 0:38ceb79fef03 | 100 | * This is to enable easy injection of Posix error codes into MbedOS error handling system without altering the actual Posix error values.\n |
kevman | 0:38ceb79fef03 | 101 | * Accordingly, Posix error codes are represented as -1 to -255 under MbedOS error status representation. |
kevman | 0:38ceb79fef03 | 102 | */ |
kevman | 0:38ceb79fef03 | 103 | typedef int mbed_error_status_t; |
kevman | 0:38ceb79fef03 | 104 | |
kevman | 0:38ceb79fef03 | 105 | /** |
kevman | 0:38ceb79fef03 | 106 | * Macro for defining a Posix error status. This macro is mainly used to define Posix error values in mbed_error_code_t enumeration. |
kevman | 0:38ceb79fef03 | 107 | * @param error_name Name of the error without the ERROR_ prefix |
kevman | 0:38ceb79fef03 | 108 | * @param error_code Error code value to be used, must be between 1 and 255(inclusive). |
kevman | 0:38ceb79fef03 | 109 | * |
kevman | 0:38ceb79fef03 | 110 | */ |
kevman | 0:38ceb79fef03 | 111 | #define MBED_DEFINE_POSIX_ERROR( error_name, error_code ) \ |
kevman | 0:38ceb79fef03 | 112 | MBED_ERROR_CODE_##error_name = error_code, \ |
kevman | 0:38ceb79fef03 | 113 | MBED_ERROR_##error_name = -(MBED_POSIX_ERROR_BASE + error_code) |
kevman | 0:38ceb79fef03 | 114 | |
kevman | 0:38ceb79fef03 | 115 | /** |
kevman | 0:38ceb79fef03 | 116 | * Macro for defining a System error status. This macro is used to define System error values in mbed_error_code_t enumeration. |
kevman | 0:38ceb79fef03 | 117 | * @param error_name Name of the error without the ERROR_ prefix |
kevman | 0:38ceb79fef03 | 118 | * @param error_code Error code value to be used, must be between 256 and 4096(inclusive). |
kevman | 0:38ceb79fef03 | 119 | * |
kevman | 0:38ceb79fef03 | 120 | */ |
kevman | 0:38ceb79fef03 | 121 | #define MBED_DEFINE_SYSTEM_ERROR( error_name, error_code ) \ |
kevman | 0:38ceb79fef03 | 122 | MBED_ERROR_CODE_##error_name = MBED_SYSTEM_ERROR_BASE + error_code, \ |
kevman | 0:38ceb79fef03 | 123 | MBED_ERROR_##error_name = MAKE_MBED_ERROR(MBED_ERROR_TYPE_SYSTEM, MBED_MODULE_UNKNOWN, MBED_ERROR_CODE_##error_name) |
kevman | 0:38ceb79fef03 | 124 | |
kevman | 0:38ceb79fef03 | 125 | /** |
kevman | 0:38ceb79fef03 | 126 | * Macro for defining a Custom error status. This macro is used to define custom error values in mbed_error_code_t enumeration. |
kevman | 0:38ceb79fef03 | 127 | * @param error_name Name of the error without the ERROR_ prefix |
kevman | 0:38ceb79fef03 | 128 | * @param error_code Error code value to be used, must be between 4097 and 65535(inclusive). |
kevman | 0:38ceb79fef03 | 129 | * |
kevman | 0:38ceb79fef03 | 130 | */ |
kevman | 0:38ceb79fef03 | 131 | #define MBED_DEFINE_CUSTOM_ERROR( error_name, error_code ) \ |
kevman | 0:38ceb79fef03 | 132 | MBED_ERROR_CODE_##error_name = MBED_CUSTOM_ERROR_BASE + error_code, \ |
kevman | 0:38ceb79fef03 | 133 | MBED_ERROR_##error_name = MAKE_MBED_ERROR(MBED_ERROR_TYPE_CUSTOM, MBED_MODULE_UNKNOWN, MBED_ERROR_CODE_##error_name) |
kevman | 0:38ceb79fef03 | 134 | |
kevman | 0:38ceb79fef03 | 135 | |
kevman | 0:38ceb79fef03 | 136 | /** |
kevman | 0:38ceb79fef03 | 137 | * Macros for setting a system warning. These macros will log the error, Its a wrapper for calling mbed_warning API. |
kevman | 0:38ceb79fef03 | 138 | * There are 2 versions of this macro. MBED_WARNING takes status and message. MBED_WARNING1 takes an additional context specific argument |
kevman | 0:38ceb79fef03 | 139 | * @param error_status mbed_error_status_t status to be set(See mbed_error_status_t enum above for available error status values). |
kevman | 0:38ceb79fef03 | 140 | * @param error_msg The error message to be printed out to STDIO/Serial. |
kevman | 0:38ceb79fef03 | 141 | * @param error_value Value associated with the error status. This would depend on error code/error scenario. |
kevman | 0:38ceb79fef03 | 142 | * |
kevman | 0:38ceb79fef03 | 143 | * @code |
kevman | 0:38ceb79fef03 | 144 | * |
kevman | 0:38ceb79fef03 | 145 | * MBED_WARNING( ERROR_INVALID_SIZE, "MyDriver: Invalid size in read" ) |
kevman | 0:38ceb79fef03 | 146 | * MBED_WARNING1( ERROR_INVALID_SIZE, "MyDriver: Invalid size in read", size_val ) |
kevman | 0:38ceb79fef03 | 147 | * |
kevman | 0:38ceb79fef03 | 148 | * @endcode |
kevman | 0:38ceb79fef03 | 149 | * @note The macro calls mbed_warning API with filename and line number info without caller explicitly passing them. |
kevman | 0:38ceb79fef03 | 150 | * Since this macro is a wrapper for mbed_warning API callers should process the return value from this macro which is the return value from calling mbed_error API. |
kevman | 0:38ceb79fef03 | 151 | * |
kevman | 0:38ceb79fef03 | 152 | */ |
kevman | 0:38ceb79fef03 | 153 | #ifdef NDEBUG |
kevman | 0:38ceb79fef03 | 154 | #define MBED_WARNING1( error_status, error_msg, error_value ) mbed_warning( error_status, (const char *)NULL, (uint32_t)error_value, NULL, 0 ) |
kevman | 0:38ceb79fef03 | 155 | #define MBED_WARNING( error_status, error_msg ) mbed_warning( error_status, (const char *)NULL, (uint32_t)0, NULL, 0 ) |
kevman | 0:38ceb79fef03 | 156 | #else //NDEBUG |
kevman | 0:38ceb79fef03 | 157 | #if MBED_CONF_PLATFORM_ERROR_FILENAME_CAPTURE_ENABLED |
kevman | 0:38ceb79fef03 | 158 | #define MBED_WARNING1( error_status, error_msg, error_value ) mbed_warning( error_status, (const char *)error_msg, (uint32_t)error_value, (const char *)MBED_FILENAME, __LINE__ ) |
kevman | 0:38ceb79fef03 | 159 | #define MBED_WARNING( error_status, error_msg ) mbed_warning( error_status, (const char *)error_msg, (uint32_t)0 , (const char *)MBED_FILENAME, __LINE__ ) |
kevman | 0:38ceb79fef03 | 160 | #else //MBED_CONF_PLATFORM_ERROR_FILENAME_CAPTURE_ENABLED |
kevman | 0:38ceb79fef03 | 161 | #define MBED_WARNING1( error_status, error_msg, error_value ) mbed_warning( error_status, (const char *)error_msg, (uint32_t)error_value, NULL, 0 ) |
kevman | 0:38ceb79fef03 | 162 | #define MBED_WARNING( error_status, error_msg ) mbed_warning( error_status, (const char *)error_msg, (uint32_t)0, NULL, 0 ) |
kevman | 0:38ceb79fef03 | 163 | #endif |
kevman | 0:38ceb79fef03 | 164 | #endif |
kevman | 0:38ceb79fef03 | 165 | |
kevman | 0:38ceb79fef03 | 166 | /** |
kevman | 0:38ceb79fef03 | 167 | * Macros for setting a fatal system error. These macros will log the error, prints the error report and halts the system. Its a wrapper for calling mbed_error API. |
kevman | 0:38ceb79fef03 | 168 | * There are 2 versions of this macro. MBED_ERROR takes status and message. MBED_ERROR1 takes an additional context specific argument |
kevman | 0:38ceb79fef03 | 169 | * @param error_status mbed_error_status_t status to be set(See mbed_error_status_t enum above for available error status values). |
kevman | 0:38ceb79fef03 | 170 | * @param error_msg The error message to be printed out to STDIO/Serial. |
kevman | 0:38ceb79fef03 | 171 | * @param error_value Value associated with the error status. This would depend on error code/error scenario. Only available with MBED_ERROR1 |
kevman | 0:38ceb79fef03 | 172 | * @return 0 or MBED_SUCCESS. |
kevman | 0:38ceb79fef03 | 173 | * MBED_ERROR_INVALID_ARGUMENT if called with invalid error status/codes |
kevman | 0:38ceb79fef03 | 174 | * |
kevman | 0:38ceb79fef03 | 175 | * @code |
kevman | 0:38ceb79fef03 | 176 | * |
kevman | 0:38ceb79fef03 | 177 | * MBED_ERROR( MBED_ERROR_MUTEX_LOCK_FAILED, "MyDriver: Can't lock driver Mutex" ) |
kevman | 0:38ceb79fef03 | 178 | * MBED_ERROR1( MBED_ERROR_MUTEX_LOCK_FAILED, "MyDriver: Can't lock driver Mutex", &my_mutex ) |
kevman | 0:38ceb79fef03 | 179 | * |
kevman | 0:38ceb79fef03 | 180 | * @endcode |
kevman | 0:38ceb79fef03 | 181 | * @note The macro calls mbed_error API with filename and line number info without caller explicitly passing them. |
kevman | 0:38ceb79fef03 | 182 | * Since this macro is a wrapper for mbed_error API callers should process the return value from this macro which is the return value from calling mbed_error API. |
kevman | 0:38ceb79fef03 | 183 | * |
kevman | 0:38ceb79fef03 | 184 | */ |
kevman | 0:38ceb79fef03 | 185 | #ifdef NDEBUG |
kevman | 0:38ceb79fef03 | 186 | #define MBED_ERROR1( error_status, error_msg, error_value ) mbed_error( error_status, (const char *)NULL, (uint32_t)error_value, NULL, 0 ) |
kevman | 0:38ceb79fef03 | 187 | #define MBED_ERROR( error_status, error_msg ) mbed_error( error_status, (const char *)NULL, (uint32_t)0 , NULL, 0 ) |
kevman | 0:38ceb79fef03 | 188 | #else //NDEBUG |
kevman | 0:38ceb79fef03 | 189 | #if MBED_CONF_PLATFORM_ERROR_FILENAME_CAPTURE_ENABLED |
kevman | 0:38ceb79fef03 | 190 | #define MBED_ERROR1( error_status, error_msg, error_value ) mbed_error( error_status, (const char *)error_msg, (uint32_t)error_value, (const char *)MBED_FILENAME, __LINE__ ) |
kevman | 0:38ceb79fef03 | 191 | #define MBED_ERROR( error_status, error_msg ) mbed_error( error_status, (const char *)error_msg, (uint32_t)0 , (const char *)MBED_FILENAME, __LINE__ ) |
kevman | 0:38ceb79fef03 | 192 | #else //MBED_CONF_PLATFORM_ERROR_FILENAME_CAPTURE_ENABLED |
kevman | 0:38ceb79fef03 | 193 | #define MBED_ERROR1( error_status, error_msg, error_value ) mbed_error( error_status, (const char *)error_msg, (uint32_t)error_value, NULL, 0 ) |
kevman | 0:38ceb79fef03 | 194 | #define MBED_ERROR( error_status, error_msg ) mbed_error( error_status, (const char *)error_msg, (uint32_t)0 , NULL, 0 ) |
kevman | 0:38ceb79fef03 | 195 | #endif |
kevman | 0:38ceb79fef03 | 196 | #endif |
kevman | 0:38ceb79fef03 | 197 | |
kevman | 0:38ceb79fef03 | 198 | //Error Type definition |
kevman | 0:38ceb79fef03 | 199 | /** mbed_error_type_t definition |
kevman | 0:38ceb79fef03 | 200 | * @note |
kevman | 0:38ceb79fef03 | 201 | * This enumeration defines the Error types supported. The value of these enum values will be encoded into mbed_error_status_t TYPE field.\n |
kevman | 0:38ceb79fef03 | 202 | * See mbed_error_status_t description for more info.\n |
kevman | 0:38ceb79fef03 | 203 | * MBED_ERROR_TYPE_SYSTEM - Used to indicate that the error status is of System defined Error type.\n |
kevman | 0:38ceb79fef03 | 204 | * MBED_ERROR_TYPE_CUSTOM - Used to indicate that the error status is of Custom defined Error type.\n |
kevman | 0:38ceb79fef03 | 205 | * MBED_ERROR_TYPE_POSIX - Used to indicate that the error status is of Posix error type.\n |
kevman | 0:38ceb79fef03 | 206 | * |
kevman | 0:38ceb79fef03 | 207 | */ |
kevman | 0:38ceb79fef03 | 208 | typedef enum _mbed_error_type_t { |
kevman | 0:38ceb79fef03 | 209 | MBED_ERROR_TYPE_SYSTEM = 0, |
kevman | 0:38ceb79fef03 | 210 | MBED_ERROR_TYPE_CUSTOM = 1, |
kevman | 0:38ceb79fef03 | 211 | //2 is reserved |
kevman | 0:38ceb79fef03 | 212 | //Use 3 for POSIX because we are mapping -1 to -255 to POSIX error codes |
kevman | 0:38ceb79fef03 | 213 | //and thus we must use 3 to match the type bits in error status representation which are from 0xFFFFFFFF to 0xFFFFFF00 |
kevman | 0:38ceb79fef03 | 214 | MBED_ERROR_TYPE_POSIX = 3 |
kevman | 0:38ceb79fef03 | 215 | } mbed_error_type_t; |
kevman | 0:38ceb79fef03 | 216 | |
kevman | 0:38ceb79fef03 | 217 | //Module type/id definitions |
kevman | 0:38ceb79fef03 | 218 | /** mbed_module_type_t definition |
kevman | 0:38ceb79fef03 | 219 | * @note |
kevman | 0:38ceb79fef03 | 220 | * This enumeration defines the module types. The value of these enum values will be encoded into mbed_error_status_t MODULE field.\n\n |
kevman | 0:38ceb79fef03 | 221 | * See mbed_error_status_t description for more info.\n |
kevman | 0:38ceb79fef03 | 222 | * MBED_MODULE_UNKNOWN - This module type can be used if caller of the mbed_error/mbed_warning doesn't know who is the actual originator of the error.\n |
kevman | 0:38ceb79fef03 | 223 | * Other module values can be used to provide more info on who/where the error originated from.\n\n |
kevman | 0:38ceb79fef03 | 224 | * For example, if I2C driver is the component originating the error you can use MBED_MODULE_DRIVER_I2C to provide more info.\n |
kevman | 0:38ceb79fef03 | 225 | * Its used in call to MBED_MAKE_ERROR/MBED_MAKE_SYSTEM_ERROR/MBED_MAKE_CUSTOM_ERROR macros.\n |
kevman | 0:38ceb79fef03 | 226 | * |
kevman | 0:38ceb79fef03 | 227 | * @code |
kevman | 0:38ceb79fef03 | 228 | * Example: mbed_error_status_t i2c_driver_error = MBED_MAKE_ERROR( MBED_MODULE_DRIVER_I2C, MBED_ERROR_CONFIG_UNSUPPORTED ); |
kevman | 0:38ceb79fef03 | 229 | * @endcode |
kevman | 0:38ceb79fef03 | 230 | * |
kevman | 0:38ceb79fef03 | 231 | * @note |
kevman | 0:38ceb79fef03 | 232 | * \n Below are the module code mappings:\n |
kevman | 0:38ceb79fef03 | 233 | \verbatim |
kevman | 0:38ceb79fef03 | 234 | MBED_MODULE_APPLICATION 0 Application |
kevman | 0:38ceb79fef03 | 235 | MBED_MODULE_PLATFORM 1 Platform |
kevman | 0:38ceb79fef03 | 236 | MBED_MODULE_KERNEL 2 RTX Kernel |
kevman | 0:38ceb79fef03 | 237 | MBED_MODULE_NETWORK_STACK 3 Network stack |
kevman | 0:38ceb79fef03 | 238 | MBED_MODULE_HAL 4 HAL - Hardware Abstraction Layer |
kevman | 0:38ceb79fef03 | 239 | MBED_MODULE_MEMORY_SUBSYSTEM 5 Memory Subsystem |
kevman | 0:38ceb79fef03 | 240 | MBED_MODULE_FILESYSTEM 6 Filesystem |
kevman | 0:38ceb79fef03 | 241 | MBED_MODULE_BLOCK_DEVICE 7 Block device |
kevman | 0:38ceb79fef03 | 242 | MBED_MODULE_DRIVER 8 Driver |
kevman | 0:38ceb79fef03 | 243 | MBED_MODULE_DRIVER_SERIAL 9 Serial Driver |
kevman | 0:38ceb79fef03 | 244 | MBED_MODULE_DRIVER_RTC 10 RTC Driver |
kevman | 0:38ceb79fef03 | 245 | MBED_MODULE_DRIVER_I2C 11 I2C Driver |
kevman | 0:38ceb79fef03 | 246 | MBED_MODULE_DRIVER_SPI 12 SPI Driver |
kevman | 0:38ceb79fef03 | 247 | MBED_MODULE_DRIVER_GPIO 13 GPIO Driver |
kevman | 0:38ceb79fef03 | 248 | MBED_MODULE_DRIVER_ANALOG 14 Analog Driver |
kevman | 0:38ceb79fef03 | 249 | MBED_MODULE_DRIVER_DIGITAL 15 DigitalIO Driver |
kevman | 0:38ceb79fef03 | 250 | MBED_MODULE_DRIVER_CAN 16 CAN Driver |
kevman | 0:38ceb79fef03 | 251 | MBED_MODULE_DRIVER_ETHERNET 17 Ethernet Driver |
kevman | 0:38ceb79fef03 | 252 | MBED_MODULE_DRIVER_CRC 18 CRC Module |
kevman | 0:38ceb79fef03 | 253 | MBED_MODULE_DRIVER_PWM 19 PWM Driver |
kevman | 0:38ceb79fef03 | 254 | MBED_MODULE_DRIVER_QSPI 20 QSPI Driver |
kevman | 0:38ceb79fef03 | 255 | MBED_MODULE_DRIVER_USB 21 USB Driver |
kevman | 0:38ceb79fef03 | 256 | MBED_MODULE_TARGET_SDK 22 SDK |
kevman | 0:38ceb79fef03 | 257 | MBED_MODULE_BLE 23 BLE |
kevman | 0:38ceb79fef03 | 258 | |
kevman | 0:38ceb79fef03 | 259 | MBED_MODULE_UNKNOWN 255 Unknown module |
kevman | 0:38ceb79fef03 | 260 | \endverbatim |
kevman | 0:38ceb79fef03 | 261 | * |
kevman | 0:38ceb79fef03 | 262 | */ |
kevman | 0:38ceb79fef03 | 263 | typedef enum _mbed_module_type { |
kevman | 0:38ceb79fef03 | 264 | MBED_MODULE_APPLICATION = 0, |
kevman | 0:38ceb79fef03 | 265 | MBED_MODULE_PLATFORM, |
kevman | 0:38ceb79fef03 | 266 | MBED_MODULE_KERNEL, |
kevman | 0:38ceb79fef03 | 267 | MBED_MODULE_NETWORK_STACK, |
kevman | 0:38ceb79fef03 | 268 | MBED_MODULE_HAL, |
kevman | 0:38ceb79fef03 | 269 | MBED_MODULE_MEMORY_SUBSYSTEM, |
kevman | 0:38ceb79fef03 | 270 | MBED_MODULE_FILESYSTEM, |
kevman | 0:38ceb79fef03 | 271 | MBED_MODULE_BLOCK_DEVICE, |
kevman | 0:38ceb79fef03 | 272 | MBED_MODULE_DRIVER, |
kevman | 0:38ceb79fef03 | 273 | MBED_MODULE_DRIVER_SERIAL, |
kevman | 0:38ceb79fef03 | 274 | MBED_MODULE_DRIVER_RTC, |
kevman | 0:38ceb79fef03 | 275 | MBED_MODULE_DRIVER_I2C, |
kevman | 0:38ceb79fef03 | 276 | MBED_MODULE_DRIVER_SPI, |
kevman | 0:38ceb79fef03 | 277 | MBED_MODULE_DRIVER_GPIO, |
kevman | 0:38ceb79fef03 | 278 | MBED_MODULE_DRIVER_ANALOG, |
kevman | 0:38ceb79fef03 | 279 | MBED_MODULE_DRIVER_DIGITAL, |
kevman | 0:38ceb79fef03 | 280 | MBED_MODULE_DRIVER_CAN, |
kevman | 0:38ceb79fef03 | 281 | MBED_MODULE_DRIVER_ETHERNET, |
kevman | 0:38ceb79fef03 | 282 | MBED_MODULE_DRIVER_CRC, |
kevman | 0:38ceb79fef03 | 283 | MBED_MODULE_DRIVER_PWM, |
kevman | 0:38ceb79fef03 | 284 | MBED_MODULE_DRIVER_QSPI, |
kevman | 0:38ceb79fef03 | 285 | MBED_MODULE_DRIVER_USB, |
kevman | 0:38ceb79fef03 | 286 | MBED_MODULE_TARGET_SDK, |
kevman | 0:38ceb79fef03 | 287 | MBED_MODULE_BLE, |
kevman | 0:38ceb79fef03 | 288 | /* Add More entities here as required */ |
kevman | 0:38ceb79fef03 | 289 | |
kevman | 0:38ceb79fef03 | 290 | MBED_MODULE_UNKNOWN = 255, |
kevman | 0:38ceb79fef03 | 291 | MBED_MODULE_MAX = MBED_MODULE_UNKNOWN |
kevman | 0:38ceb79fef03 | 292 | } mbed_module_type_t; |
kevman | 0:38ceb79fef03 | 293 | |
kevman | 0:38ceb79fef03 | 294 | //Use MBED_SUCCESS(=0) or any positive number for successful returns |
kevman | 0:38ceb79fef03 | 295 | #define MBED_SUCCESS 0 |
kevman | 0:38ceb79fef03 | 296 | |
kevman | 0:38ceb79fef03 | 297 | #define MBED_POSIX_ERROR_BASE 0 |
kevman | 0:38ceb79fef03 | 298 | #define MBED_SYSTEM_ERROR_BASE 256 |
kevman | 0:38ceb79fef03 | 299 | #define MBED_CUSTOM_ERROR_BASE 4096 |
kevman | 0:38ceb79fef03 | 300 | |
kevman | 0:38ceb79fef03 | 301 | //Error Code definitions |
kevman | 0:38ceb79fef03 | 302 | /** mbed_error_code_t definition |
kevman | 0:38ceb79fef03 | 303 | * |
kevman | 0:38ceb79fef03 | 304 | * mbed_error_code_t enumeration defines the Error codes and Error status values for MBED_MODULE_UNKNOWN.\n |
kevman | 0:38ceb79fef03 | 305 | * It defines all of Posix Error Codes/Statuses and Mbed System Error Codes/Statuses.\n\n |
kevman | 0:38ceb79fef03 | 306 | * |
kevman | 0:38ceb79fef03 | 307 | * @note |
kevman | 0:38ceb79fef03 | 308 | * Posix Error codes are defined using the macro MBED_DEFINE_POSIX_ERROR\n |
kevman | 0:38ceb79fef03 | 309 | * For example MBED_DEFINE_POSIX_ERROR( EPERM, EPERM ). This effectively defines the following values:\n |
kevman | 0:38ceb79fef03 | 310 | * ERROR_CODE_EPERM = EPERM\n |
kevman | 0:38ceb79fef03 | 311 | * ERROR_EPERM = -EPERM\n |
kevman | 0:38ceb79fef03 | 312 | * |
kevman | 0:38ceb79fef03 | 313 | * Posix Error codes are defined using the macro MBED_DEFINE_POSIX_ERROR\n |
kevman | 0:38ceb79fef03 | 314 | * For example MBED_DEFINE_POSIX_ERROR( EPERM, EPERM ). This macro defines the following values:\n |
kevman | 0:38ceb79fef03 | 315 | * ERROR_CODE_EPERM = MBED_POSIX_ERROR_BASE+EPERM\n |
kevman | 0:38ceb79fef03 | 316 | * ERROR_EPERM = -(MBED_POSIX_ERROR_BASE+EPERM)\n |
kevman | 0:38ceb79fef03 | 317 | * Its effectively equivalent to:\n |
kevman | 0:38ceb79fef03 | 318 | * ERROR_CODE_EPERM = 1\n |
kevman | 0:38ceb79fef03 | 319 | * ERROR_EPERM = -1\n |
kevman | 0:38ceb79fef03 | 320 | * All Posix error codes currently supported by MbedOS(defined in mbed_retarget.h) are defined using the MBED_DEFINE_POSIX_ERROR macro.\n\n |
kevman | 0:38ceb79fef03 | 321 | * Below are the Posic error codes and the description:\n |
kevman | 0:38ceb79fef03 | 322 | * \verbatim |
kevman | 0:38ceb79fef03 | 323 | EPERM 1 Operation not permitted |
kevman | 0:38ceb79fef03 | 324 | ENOENT 2 No such file or directory |
kevman | 0:38ceb79fef03 | 325 | ESRCH 3 No such process |
kevman | 0:38ceb79fef03 | 326 | EINTR 4 Interrupted system call |
kevman | 0:38ceb79fef03 | 327 | EIO 5 I/O error |
kevman | 0:38ceb79fef03 | 328 | ENXIO 6 No such device or address |
kevman | 0:38ceb79fef03 | 329 | E2BIG 7 Argument list too long |
kevman | 0:38ceb79fef03 | 330 | ENOEXEC 8 Exec format error |
kevman | 0:38ceb79fef03 | 331 | EBADF 9 Bad file number |
kevman | 0:38ceb79fef03 | 332 | ECHILD 10 No child processes |
kevman | 0:38ceb79fef03 | 333 | EAGAIN 11 Try again |
kevman | 0:38ceb79fef03 | 334 | ENOMEM 12 Out of memory |
kevman | 0:38ceb79fef03 | 335 | EACCES 13 Permission denied |
kevman | 0:38ceb79fef03 | 336 | EFAULT 14 Bad address |
kevman | 0:38ceb79fef03 | 337 | ENOTBLK 15 Block device required |
kevman | 0:38ceb79fef03 | 338 | EBUSY 16 Device or resource busy |
kevman | 0:38ceb79fef03 | 339 | EEXIST 17 File exists |
kevman | 0:38ceb79fef03 | 340 | EXDEV 18 Cross-device link |
kevman | 0:38ceb79fef03 | 341 | ENODEV 19 No such device |
kevman | 0:38ceb79fef03 | 342 | ENOTDIR 20 Not a directory |
kevman | 0:38ceb79fef03 | 343 | EISDIR 21 Is a directory |
kevman | 0:38ceb79fef03 | 344 | EINVAL 22 Invalid argument |
kevman | 0:38ceb79fef03 | 345 | ENFILE 23 File table overflow |
kevman | 0:38ceb79fef03 | 346 | EMFILE 24 Too many open files |
kevman | 0:38ceb79fef03 | 347 | ENOTTY 25 Not a typewriter |
kevman | 0:38ceb79fef03 | 348 | ETXTBSY 26 Text file busy |
kevman | 0:38ceb79fef03 | 349 | EFBIG 27 File too large |
kevman | 0:38ceb79fef03 | 350 | ENOSPC 28 No space left on device |
kevman | 0:38ceb79fef03 | 351 | ESPIPE 29 Illegal seek |
kevman | 0:38ceb79fef03 | 352 | EROFS 30 Read-only file system |
kevman | 0:38ceb79fef03 | 353 | EMLINK 31 Too many links |
kevman | 0:38ceb79fef03 | 354 | EPIPE 32 Broken pipe |
kevman | 0:38ceb79fef03 | 355 | EDOM 33 Math argument out of domain of func |
kevman | 0:38ceb79fef03 | 356 | ERANGE 34 Math result not representable |
kevman | 0:38ceb79fef03 | 357 | EDEADLK 35 Resource deadlock would occur |
kevman | 0:38ceb79fef03 | 358 | ENAMETOOLONG 36 File name too long |
kevman | 0:38ceb79fef03 | 359 | ENOLCK 37 No record locks available |
kevman | 0:38ceb79fef03 | 360 | ENOSYS 38 Function not implemented |
kevman | 0:38ceb79fef03 | 361 | ENOTEMPTY 39 Directory not empty |
kevman | 0:38ceb79fef03 | 362 | ELOOP 40 Too many symbolic links encountered |
kevman | 0:38ceb79fef03 | 363 | EWOULDBLOCK EAGAIN Operation would block |
kevman | 0:38ceb79fef03 | 364 | ENOMSG 42 No message of desired type |
kevman | 0:38ceb79fef03 | 365 | EIDRM 43 Identifier removed |
kevman | 0:38ceb79fef03 | 366 | ECHRNG 44 Channel number out of range |
kevman | 0:38ceb79fef03 | 367 | EL2NSYNC 45 Level 2 not synchronized |
kevman | 0:38ceb79fef03 | 368 | EL3HLT 46 Level 3 halted |
kevman | 0:38ceb79fef03 | 369 | EL3RST 47 Level 3 reset |
kevman | 0:38ceb79fef03 | 370 | ELNRNG 48 Link number out of range |
kevman | 0:38ceb79fef03 | 371 | EUNATCH 49 Protocol driver not attached |
kevman | 0:38ceb79fef03 | 372 | ENOCSI 50 No CSI structure available |
kevman | 0:38ceb79fef03 | 373 | EL2HLT 51 Level 2 halted |
kevman | 0:38ceb79fef03 | 374 | EBADE 52 Invalid exchange |
kevman | 0:38ceb79fef03 | 375 | EBADR 53 Invalid request descriptor |
kevman | 0:38ceb79fef03 | 376 | EXFULL 54 Exchange full |
kevman | 0:38ceb79fef03 | 377 | ENOANO 55 No anode |
kevman | 0:38ceb79fef03 | 378 | EBADRQC 56 Invalid request code |
kevman | 0:38ceb79fef03 | 379 | EBADSLT 57 Invalid slot |
kevman | 0:38ceb79fef03 | 380 | EDEADLOCK EDEADLK Resource deadlock would occur |
kevman | 0:38ceb79fef03 | 381 | EBFONT 59 Bad font file format |
kevman | 0:38ceb79fef03 | 382 | ENOSTR 60 Device not a stream |
kevman | 0:38ceb79fef03 | 383 | ENODATA 61 No data available |
kevman | 0:38ceb79fef03 | 384 | ETIME 62 Timer expired |
kevman | 0:38ceb79fef03 | 385 | ENOSR 63 Out of streams resources |
kevman | 0:38ceb79fef03 | 386 | ENONET 64 Machine is not on the network |
kevman | 0:38ceb79fef03 | 387 | ENOPKG 65 Package not installed |
kevman | 0:38ceb79fef03 | 388 | EREMOTE 66 Object is remote |
kevman | 0:38ceb79fef03 | 389 | ENOLINK 67 Link has been severed |
kevman | 0:38ceb79fef03 | 390 | EADV 68 Advertise error |
kevman | 0:38ceb79fef03 | 391 | ESRMNT 69 Srmount error |
kevman | 0:38ceb79fef03 | 392 | ECOMM 70 Communication error on send |
kevman | 0:38ceb79fef03 | 393 | EPROTO 71 Protocol error |
kevman | 0:38ceb79fef03 | 394 | EMULTIHOP 72 Multihop attempted |
kevman | 0:38ceb79fef03 | 395 | EDOTDOT 73 RFS specific error |
kevman | 0:38ceb79fef03 | 396 | EBADMSG 74 Not a data message |
kevman | 0:38ceb79fef03 | 397 | EOVERFLOW 75 Value too large for defined data type |
kevman | 0:38ceb79fef03 | 398 | ENOTUNIQ 76 Name not unique on network |
kevman | 0:38ceb79fef03 | 399 | EBADFD 77 File descriptor in bad state |
kevman | 0:38ceb79fef03 | 400 | EREMCHG 78 Remote address changed |
kevman | 0:38ceb79fef03 | 401 | ELIBACC 79 Can not access a needed shared library |
kevman | 0:38ceb79fef03 | 402 | ELIBBAD 80 Accessing a corrupted shared library |
kevman | 0:38ceb79fef03 | 403 | ELIBSCN 81 .lib section in a.out corrupted |
kevman | 0:38ceb79fef03 | 404 | ELIBMAX 82 Attempting to link in too many shared libraries |
kevman | 0:38ceb79fef03 | 405 | ELIBEXEC 83 Cannot exec a shared library directly |
kevman | 0:38ceb79fef03 | 406 | EILSEQ 84 Illegal byte sequence |
kevman | 0:38ceb79fef03 | 407 | ERESTART 85 Interrupted system call should be restarted |
kevman | 0:38ceb79fef03 | 408 | ESTRPIPE 86 Streams pipe error |
kevman | 0:38ceb79fef03 | 409 | EUSERS 87 Too many users |
kevman | 0:38ceb79fef03 | 410 | ENOTSOCK 88 Socket operation on non-socket |
kevman | 0:38ceb79fef03 | 411 | EDESTADDRREQ 89 Destination address required |
kevman | 0:38ceb79fef03 | 412 | EMSGSIZE 90 Message too long |
kevman | 0:38ceb79fef03 | 413 | EPROTOTYPE 91 Protocol wrong type for socket |
kevman | 0:38ceb79fef03 | 414 | ENOPROTOOPT 92 Protocol not available |
kevman | 0:38ceb79fef03 | 415 | EPROTONOSUPPORT 93 Protocol not supported |
kevman | 0:38ceb79fef03 | 416 | ESOCKTNOSUPPORT 94 Socket type not supported |
kevman | 0:38ceb79fef03 | 417 | EOPNOTSUPP 95 Operation not supported on transport endpoint |
kevman | 0:38ceb79fef03 | 418 | EPFNOSUPPORT 96 Protocol family not supported |
kevman | 0:38ceb79fef03 | 419 | EAFNOSUPPORT 97 Address family not supported by protocol |
kevman | 0:38ceb79fef03 | 420 | EADDRINUSE 98 Address already in use |
kevman | 0:38ceb79fef03 | 421 | EADDRNOTAVAIL 99 Cannot assign requested address |
kevman | 0:38ceb79fef03 | 422 | ENETDOWN 100 Network is down |
kevman | 0:38ceb79fef03 | 423 | ENETUNREACH 101 Network is unreachable |
kevman | 0:38ceb79fef03 | 424 | ENETRESET 102 Network dropped connection because of reset |
kevman | 0:38ceb79fef03 | 425 | ECONNABORTED 103 Software caused connection abort |
kevman | 0:38ceb79fef03 | 426 | ECONNRESET 104 Connection reset by peer |
kevman | 0:38ceb79fef03 | 427 | ENOBUFS 105 No buffer space available |
kevman | 0:38ceb79fef03 | 428 | EISCONN 106 Transport endpoint is already connected |
kevman | 0:38ceb79fef03 | 429 | ENOTCONN 107 Transport endpoint is not connected |
kevman | 0:38ceb79fef03 | 430 | ESHUTDOWN 108 Cannot send after transport endpoint shutdown |
kevman | 0:38ceb79fef03 | 431 | ETOOMANYREFS 109 Too many references: cannot splice |
kevman | 0:38ceb79fef03 | 432 | ETIMEDOUT 110 Connection timed out |
kevman | 0:38ceb79fef03 | 433 | ECONNREFUSED 111 Connection refused |
kevman | 0:38ceb79fef03 | 434 | EHOSTDOWN 112 Host is down |
kevman | 0:38ceb79fef03 | 435 | EHOSTUNREACH 113 No route to host |
kevman | 0:38ceb79fef03 | 436 | EALREADY 114 Operation already in progress |
kevman | 0:38ceb79fef03 | 437 | EINPROGRESS 115 Operation now in progress |
kevman | 0:38ceb79fef03 | 438 | ESTALE 116 Stale NFS file handle |
kevman | 0:38ceb79fef03 | 439 | EUCLEAN 117 Structure needs cleaning |
kevman | 0:38ceb79fef03 | 440 | ENOTNAM 118 Not a XENIX named type file |
kevman | 0:38ceb79fef03 | 441 | ENAVAIL 119 No XENIX semaphores available |
kevman | 0:38ceb79fef03 | 442 | EISNAM 120 Is a named type file |
kevman | 0:38ceb79fef03 | 443 | EREMOTEIO 121 Remote I/O error |
kevman | 0:38ceb79fef03 | 444 | EDQUOT 122 Quota exceeded |
kevman | 0:38ceb79fef03 | 445 | ENOMEDIUM 123 No medium found |
kevman | 0:38ceb79fef03 | 446 | EMEDIUMTYPE 124 Wrong medium type |
kevman | 0:38ceb79fef03 | 447 | ECANCELED 125 Operation Canceled |
kevman | 0:38ceb79fef03 | 448 | ENOKEY 126 Required key not available |
kevman | 0:38ceb79fef03 | 449 | EKEYEXPIRED 127 Key has expired |
kevman | 0:38ceb79fef03 | 450 | EKEYREVOKED 128 Key has been revoked |
kevman | 0:38ceb79fef03 | 451 | EKEYREJECTED 129 Key was rejected by service |
kevman | 0:38ceb79fef03 | 452 | EOWNERDEAD 130 Owner died |
kevman | 0:38ceb79fef03 | 453 | ENOTRECOVERABLE 131 State not recoverable |
kevman | 0:38ceb79fef03 | 454 | \endverbatim |
kevman | 0:38ceb79fef03 | 455 | * |
kevman | 0:38ceb79fef03 | 456 | * @note |
kevman | 0:38ceb79fef03 | 457 | * MbedOS System Error codes are defined using the macro MBED_DEFINE_SYSTEM_ERROR\n |
kevman | 0:38ceb79fef03 | 458 | * For example MBED_DEFINE_SYSTEM_ERROR( INVALID_ARGUMENT ,1 ) macro defines the following values:\n |
kevman | 0:38ceb79fef03 | 459 | * ERROR_CODE_INVALID_ARGUMENT = MBED_SYSTEM_ERROR_BASE+1\n |
kevman | 0:38ceb79fef03 | 460 | * ERROR_INVALID_ARGUMENT = MAKE_MBED_ERROR(ERROR_TYPE_SYSTEM, MBED_MODULE_UNKNOWN, ERROR_CODE_INVALID_ARGUMENT)\n |
kevman | 0:38ceb79fef03 | 461 | * Its effectively equivalent to:\n |
kevman | 0:38ceb79fef03 | 462 | * ERROR_CODE_INVALID_ARGUMENT = 1\n |
kevman | 0:38ceb79fef03 | 463 | * ERROR_INVALID_ARGUMENT = 0x80FF0001\n (Note that MODULE field is set to MBED_MODULE_UNKNOWN) |
kevman | 0:38ceb79fef03 | 464 | * New System Error codes should be defined using MBED_DEFINE_SYSTEM_ERROR macro and must have an unique error code value\n |
kevman | 0:38ceb79fef03 | 465 | * passed as the second argument in the MBED_DEFINE_SYSTEM_ERROR macro.\n\n |
kevman | 0:38ceb79fef03 | 466 | * Below are the Mbed System error codes and the description: |
kevman | 0:38ceb79fef03 | 467 | * \verbatim |
kevman | 0:38ceb79fef03 | 468 | UNKNOWN 256 Unknown error |
kevman | 0:38ceb79fef03 | 469 | INVALID_ARGUMENT 257 Invalid Argument |
kevman | 0:38ceb79fef03 | 470 | INVALID_DATA 258 Invalid data |
kevman | 0:38ceb79fef03 | 471 | INVALID_FORMAT 259 Invalid format |
kevman | 0:38ceb79fef03 | 472 | INVALID_INDEX 260 Invalid Index |
kevman | 0:38ceb79fef03 | 473 | INVALID_SIZE 261 Invalid Size |
kevman | 0:38ceb79fef03 | 474 | INVALID_OPERATION 262 Invalid Operation |
kevman | 0:38ceb79fef03 | 475 | NOT_FOUND 263 Not Found |
kevman | 0:38ceb79fef03 | 476 | ACCESS_DENIED 264 Access Denied |
kevman | 0:38ceb79fef03 | 477 | NOT_SUPPORTED 265 Not supported |
kevman | 0:38ceb79fef03 | 478 | BUFFER_FULL 266 Buffer Full |
kevman | 0:38ceb79fef03 | 479 | MEDIA_FULL 267 Media/Disk Full |
kevman | 0:38ceb79fef03 | 480 | ALREADY_IN_USE 268 Already in use |
kevman | 0:38ceb79fef03 | 481 | TIMEOUT 269 Timeout error |
kevman | 0:38ceb79fef03 | 482 | NOT_READY 270 Not Ready |
kevman | 0:38ceb79fef03 | 483 | FAILED_OPERATION 271 Requested Operation failed |
kevman | 0:38ceb79fef03 | 484 | OPERATION_PROHIBITED 272 Operation prohibited |
kevman | 0:38ceb79fef03 | 485 | OPERATION_ABORTED 273 Operation failed |
kevman | 0:38ceb79fef03 | 486 | WRITE_PROTECTED 274 Attempt to write to write-protected resource |
kevman | 0:38ceb79fef03 | 487 | NO_RESPONSE 275 No response |
kevman | 0:38ceb79fef03 | 488 | SEMAPHORE_LOCK_FAILED 276 Semaphore lock failed |
kevman | 0:38ceb79fef03 | 489 | MUTEX_LOCK_FAILED 277 Mutex lock failed |
kevman | 0:38ceb79fef03 | 490 | SEMAPHORE_UNLOCK_FAILED 278 Semaphore unlock failed |
kevman | 0:38ceb79fef03 | 491 | MUTEX_UNLOCK_FAILED 279 Mutex unlock failed |
kevman | 0:38ceb79fef03 | 492 | CRC_ERROR 280 CRC error or mismatch |
kevman | 0:38ceb79fef03 | 493 | OPEN_FAILED 281 Open failed |
kevman | 0:38ceb79fef03 | 494 | CLOSE_FAILED 282 Close failed |
kevman | 0:38ceb79fef03 | 495 | READ_FAILED 283 Read failed |
kevman | 0:38ceb79fef03 | 496 | WRITE_FAILED 284 Write failed |
kevman | 0:38ceb79fef03 | 497 | INITIALIZATION_FAILED 285 Initialization failed |
kevman | 0:38ceb79fef03 | 498 | BOOT_FAILURE 286 Boot failure |
kevman | 0:38ceb79fef03 | 499 | OUT_OF_MEMORY 287 Out of memory |
kevman | 0:38ceb79fef03 | 500 | OUT_OF_RESOURCES 288 Out of resources |
kevman | 0:38ceb79fef03 | 501 | ALLOC_FAILED 289 Alloc failed |
kevman | 0:38ceb79fef03 | 502 | FREE_FAILED 290 Free failed |
kevman | 0:38ceb79fef03 | 503 | OVERFLOW 291 Overflow error |
kevman | 0:38ceb79fef03 | 504 | UNDERFLOW 292 Underflow error |
kevman | 0:38ceb79fef03 | 505 | STACK_OVERFLOW 293 Stack overflow error |
kevman | 0:38ceb79fef03 | 506 | ISR_QUEUE_OVERFLOW 294 ISR queue overflow |
kevman | 0:38ceb79fef03 | 507 | TIMER_QUEUE_OVERFLOW 295 Timer Queue overflow |
kevman | 0:38ceb79fef03 | 508 | CLIB_SPACE_UNAVAILABLE 296 Standard library error - Space unavailable |
kevman | 0:38ceb79fef03 | 509 | CLIB_EXCEPTION 297 Standard library error - Exception |
kevman | 0:38ceb79fef03 | 510 | CLIB_MUTEX_INIT_FAILURE 298 Standard library error - Mutex Init failure |
kevman | 0:38ceb79fef03 | 511 | CREATE_FAILED 299 Create failed |
kevman | 0:38ceb79fef03 | 512 | DELETE_FAILED 300 Delete failed |
kevman | 0:38ceb79fef03 | 513 | THREAD_CREATE_FAILED 301 Thread Create failed |
kevman | 0:38ceb79fef03 | 514 | THREAD_DELETE_FAILED 302 Thread Delete failed |
kevman | 0:38ceb79fef03 | 515 | PROHIBITED_IN_ISR_CONTEXT 303 Operation Prohibited in ISR context |
kevman | 0:38ceb79fef03 | 516 | PINMAP_INVALID 304 Pinmap Invalid |
kevman | 0:38ceb79fef03 | 517 | RTOS_EVENT 305 Unknown Rtos Error |
kevman | 0:38ceb79fef03 | 518 | RTOS_THREAD_EVENT 306 Rtos Thread Error |
kevman | 0:38ceb79fef03 | 519 | RTOS_MUTEX_EVENT 307 Rtos Mutex Error |
kevman | 0:38ceb79fef03 | 520 | RTOS_SEMAPHORE_EVENT 308 Rtos Semaphore Error |
kevman | 0:38ceb79fef03 | 521 | RTOS_MEMORY_POOL_EVENT 309 Rtos Memory Pool Error |
kevman | 0:38ceb79fef03 | 522 | RTOS_TIMER_EVENT 310 Rtos Timer Error |
kevman | 0:38ceb79fef03 | 523 | RTOS_EVENT_FLAGS_EVENT 311 Rtos Event flags Error |
kevman | 0:38ceb79fef03 | 524 | RTOS_MESSAGE_QUEUE_EVENT 312 Rtos Message queue Error |
kevman | 0:38ceb79fef03 | 525 | DEVICE_BUSY 313 Device Busy |
kevman | 0:38ceb79fef03 | 526 | CONFIG_UNSUPPORTED 314 Configuration not supported |
kevman | 0:38ceb79fef03 | 527 | CONFIG_MISMATCH 315 Configuration mismatch |
kevman | 0:38ceb79fef03 | 528 | ALREADY_INITIALIZED 316 Already initialized |
kevman | 0:38ceb79fef03 | 529 | HARDFAULT_EXCEPTION 317 HardFault exception |
kevman | 0:38ceb79fef03 | 530 | MEMMANAGE_EXCEPTION 318 MemManage exception |
kevman | 0:38ceb79fef03 | 531 | BUSFAULT_EXCEPTION 319 BusFault exception |
kevman | 0:38ceb79fef03 | 532 | USAGEFAULT_EXCEPTION 320 UsageFault exception |
kevman | 0:38ceb79fef03 | 533 | BLE_NO_FRAME_INITIALIZED, 321 BLE No frame initialized |
kevman | 0:38ceb79fef03 | 534 | BLE_BACKEND_CREATION_FAILED 322 BLE Backend creation failed |
kevman | 0:38ceb79fef03 | 535 | BLE_BACKEND_NOT_INITIALIZED 323 BLE Backend not initialized |
kevman | 0:38ceb79fef03 | 536 | \endverbatim |
kevman | 0:38ceb79fef03 | 537 | * |
kevman | 0:38ceb79fef03 | 538 | * @note |
kevman | 0:38ceb79fef03 | 539 | * Custom Error codes can be defined using the macro DEFINE_CUSTOM_ERROR\n |
kevman | 0:38ceb79fef03 | 540 | * This is mainly meant to capture non-generic error codes specific to a device. |
kevman | 0:38ceb79fef03 | 541 | * For example DEFINE_CUSTOM_ERROR( MY_CUSTOM_ERROR ,1 ) macro defines the following values:\n |
kevman | 0:38ceb79fef03 | 542 | * ERROR_CODE_MY_CUSTOM_ERROR = MBED_CUSTOM_ERROR_BASE+1\n |
kevman | 0:38ceb79fef03 | 543 | * ERROR_MY_CUSTOM_ERROR = MAKE_MBED_ERROR(ERROR_TYPE_CUSTOM, MBED_MODULE_UNKNOWN, ERROR_CODE_MY_CUSTOM_ERROR)\n |
kevman | 0:38ceb79fef03 | 544 | * Its effectively equivalent to:\n |
kevman | 0:38ceb79fef03 | 545 | * ERROR_CODE_MY_CUSTOM_ERROR = 4097\n |
kevman | 0:38ceb79fef03 | 546 | * ERROR_MY_CUSTOM_ERROR = 0xA0FF1001\n (Note that MODULE field is set to MBED_MODULE_UNKNOWN) \n\n |
kevman | 0:38ceb79fef03 | 547 | * |
kevman | 0:38ceb79fef03 | 548 | * @note |
kevman | 0:38ceb79fef03 | 549 | * **Using error codes:** \n |
kevman | 0:38ceb79fef03 | 550 | * Posix error codes may be used in modules/functions currently using Posix error codes and switching them to Mbed-OS error codes |
kevman | 0:38ceb79fef03 | 551 | * may cause interoperability issues. For example, some of the filesystem, network stack implementations may need to use |
kevman | 0:38ceb79fef03 | 552 | * Posix error codes in order to keep them compatible with other modules interfacing with them, and may continue to use Posix error codes. |
kevman | 0:38ceb79fef03 | 553 | * |
kevman | 0:38ceb79fef03 | 554 | * In all other cases, like for any native development of Mbed-OS modules Mbed-OS error codes should be used. |
kevman | 0:38ceb79fef03 | 555 | * This makes it easy to use Mbed-OS error reporting/logging infrastructure and makes debugging error scenarios |
kevman | 0:38ceb79fef03 | 556 | * much more efficient. |
kevman | 0:38ceb79fef03 | 557 | * |
kevman | 0:38ceb79fef03 | 558 | * @note |
kevman | 0:38ceb79fef03 | 559 | * **Searching for error codes in mbed-os source tree:** \n |
kevman | 0:38ceb79fef03 | 560 | * If you get an error report as below which you want to search for in mbed-os source tree, first take note of "Error Code" number. \n |
kevman | 0:38ceb79fef03 | 561 | * For example, the below error report has an error code of \b 259. Find the error name associated with the error code and in this case its \b INVALID_FORMAT. \n |
kevman | 0:38ceb79fef03 | 562 | * Use that error name(\b INVALID_FORMAT) to search the source tree for code locations setting that specific error code. \n |
kevman | 0:38ceb79fef03 | 563 | * If the Error module reported is not 255(which indicates unknown module), you can also use that to narrow down to the specific component reporting the error. |
kevman | 0:38ceb79fef03 | 564 | * See mbed_module_type_t enum above for module mapping. \n |
kevman | 0:38ceb79fef03 | 565 | * |
kevman | 0:38ceb79fef03 | 566 | * \verbatim |
kevman | 0:38ceb79fef03 | 567 | ++ MbedOS Error Info ++ |
kevman | 0:38ceb79fef03 | 568 | Error Status: 0x80FF013D Code: 317 Module: 255 |
kevman | 0:38ceb79fef03 | 569 | Error Message: Fault exception |
kevman | 0:38ceb79fef03 | 570 | Location: 0x5CD1 |
kevman | 0:38ceb79fef03 | 571 | Error Value: 0x4A2A |
kevman | 0:38ceb79fef03 | 572 | Current Thread: Id: 0x20001E80 Entry: 0x5EB1 StackSize: 0x1000 StackMem: 0x20000E80 SP: 0x2002FF90 |
kevman | 0:38ceb79fef03 | 573 | For more info, visit: https://mbed.com/s/error?error=0x80FF013D&mbedos=999999&core=0x410FC241&compile=1&ver=5060528 |
kevman | 0:38ceb79fef03 | 574 | -- MbedOS Error Info -- |
kevman | 0:38ceb79fef03 | 575 | \endverbatim |
kevman | 0:38ceb79fef03 | 576 | */ |
kevman | 0:38ceb79fef03 | 577 | |
kevman | 0:38ceb79fef03 | 578 | typedef enum _mbed_error_code { |
kevman | 0:38ceb79fef03 | 579 | //Below are POSIX ERROR CODE definitions, which starts at MBED_POSIX_ERROR_BASE(=0) |
kevman | 0:38ceb79fef03 | 580 | //POSIX ERROR CODE definitions starts at offset 0(MBED_POSIX_ERROR_BASE) to align them with actual Posix Error Code |
kevman | 0:38ceb79fef03 | 581 | //defintions in mbed_retarget.h |
kevman | 0:38ceb79fef03 | 582 | // Error Name Error Code |
kevman | 0:38ceb79fef03 | 583 | MBED_DEFINE_POSIX_ERROR(EPERM, EPERM), /* 1 Operation not permitted */ |
kevman | 0:38ceb79fef03 | 584 | MBED_DEFINE_POSIX_ERROR(ENOENT, ENOENT), /* 2 No such file or directory */ |
kevman | 0:38ceb79fef03 | 585 | MBED_DEFINE_POSIX_ERROR(ESRCH, ESRCH), /* 3 No such process */ |
kevman | 0:38ceb79fef03 | 586 | MBED_DEFINE_POSIX_ERROR(EINTR, EINTR), /* 4 Interrupted system call */ |
kevman | 0:38ceb79fef03 | 587 | MBED_DEFINE_POSIX_ERROR(EIO, EIO), /* 5 I/O error */ |
kevman | 0:38ceb79fef03 | 588 | MBED_DEFINE_POSIX_ERROR(ENXIO, ENXIO), /* 6 No such device or address */ |
kevman | 0:38ceb79fef03 | 589 | MBED_DEFINE_POSIX_ERROR(E2BIG, E2BIG), /* 7 Argument list too long */ |
kevman | 0:38ceb79fef03 | 590 | MBED_DEFINE_POSIX_ERROR(ENOEXEC, ENOEXEC), /* 8 Exec format error */ |
kevman | 0:38ceb79fef03 | 591 | MBED_DEFINE_POSIX_ERROR(EBADF, EBADF), /* 9 Bad file number */ |
kevman | 0:38ceb79fef03 | 592 | MBED_DEFINE_POSIX_ERROR(ECHILD, ECHILD), /* 10 No child processes */ |
kevman | 0:38ceb79fef03 | 593 | MBED_DEFINE_POSIX_ERROR(EAGAIN, EAGAIN), /* 11 Try again */ |
kevman | 0:38ceb79fef03 | 594 | MBED_DEFINE_POSIX_ERROR(ENOMEM, ENOMEM), /* 12 Out of memory */ |
kevman | 0:38ceb79fef03 | 595 | MBED_DEFINE_POSIX_ERROR(EACCES, EACCES), /* 13 Permission denied */ |
kevman | 0:38ceb79fef03 | 596 | MBED_DEFINE_POSIX_ERROR(EFAULT, EFAULT), /* 14 Bad address */ |
kevman | 0:38ceb79fef03 | 597 | MBED_DEFINE_POSIX_ERROR(ENOTBLK, ENOTBLK), /* 15 Block device required */ |
kevman | 0:38ceb79fef03 | 598 | MBED_DEFINE_POSIX_ERROR(EBUSY, EBUSY), /* 16 Device or resource busy */ |
kevman | 0:38ceb79fef03 | 599 | MBED_DEFINE_POSIX_ERROR(EEXIST, EEXIST), /* 17 File exists */ |
kevman | 0:38ceb79fef03 | 600 | MBED_DEFINE_POSIX_ERROR(EXDEV, EXDEV), /* 18 Cross-device link */ |
kevman | 0:38ceb79fef03 | 601 | MBED_DEFINE_POSIX_ERROR(ENODEV, ENODEV), /* 19 No such device */ |
kevman | 0:38ceb79fef03 | 602 | MBED_DEFINE_POSIX_ERROR(ENOTDIR, ENOTDIR), /* 20 Not a directory */ |
kevman | 0:38ceb79fef03 | 603 | MBED_DEFINE_POSIX_ERROR(EISDIR, EISDIR), /* 21 Is a directory */ |
kevman | 0:38ceb79fef03 | 604 | MBED_DEFINE_POSIX_ERROR(EINVAL, EINVAL), /* 22 Invalid argument */ |
kevman | 0:38ceb79fef03 | 605 | MBED_DEFINE_POSIX_ERROR(ENFILE, ENFILE), /* 23 File table overflow */ |
kevman | 0:38ceb79fef03 | 606 | MBED_DEFINE_POSIX_ERROR(EMFILE, EMFILE), /* 24 Too many open files */ |
kevman | 0:38ceb79fef03 | 607 | MBED_DEFINE_POSIX_ERROR(ENOTTY, ENOTTY), /* 25 Not a typewriter */ |
kevman | 0:38ceb79fef03 | 608 | MBED_DEFINE_POSIX_ERROR(ETXTBSY, ETXTBSY), /* 26 Text file busy */ |
kevman | 0:38ceb79fef03 | 609 | MBED_DEFINE_POSIX_ERROR(EFBIG, EFBIG), /* 27 File too large */ |
kevman | 0:38ceb79fef03 | 610 | MBED_DEFINE_POSIX_ERROR(ENOSPC, ENOSPC), /* 28 No space left on device */ |
kevman | 0:38ceb79fef03 | 611 | MBED_DEFINE_POSIX_ERROR(ESPIPE, ESPIPE), /* 29 Illegal seek */ |
kevman | 0:38ceb79fef03 | 612 | MBED_DEFINE_POSIX_ERROR(EROFS, EROFS), /* 30 Read-only file system */ |
kevman | 0:38ceb79fef03 | 613 | MBED_DEFINE_POSIX_ERROR(EMLINK, EMLINK), /* 31 Too many links */ |
kevman | 0:38ceb79fef03 | 614 | MBED_DEFINE_POSIX_ERROR(EPIPE, EPIPE), /* 32 Broken pipe */ |
kevman | 0:38ceb79fef03 | 615 | MBED_DEFINE_POSIX_ERROR(EDOM, EDOM), /* 33 Math argument out of domain of func */ |
kevman | 0:38ceb79fef03 | 616 | MBED_DEFINE_POSIX_ERROR(ERANGE, ERANGE), /* 34 Math result not representable */ |
kevman | 0:38ceb79fef03 | 617 | MBED_DEFINE_POSIX_ERROR(EDEADLK, EDEADLK), /* 35 Resource deadlock would occur */ |
kevman | 0:38ceb79fef03 | 618 | MBED_DEFINE_POSIX_ERROR(ENAMETOOLONG, ENAMETOOLONG), /* 36 File name too long */ |
kevman | 0:38ceb79fef03 | 619 | MBED_DEFINE_POSIX_ERROR(ENOLCK, ENOLCK), /* 37 No record locks available */ |
kevman | 0:38ceb79fef03 | 620 | MBED_DEFINE_POSIX_ERROR(ENOSYS, ENOSYS), /* 38 Function not implemented */ |
kevman | 0:38ceb79fef03 | 621 | MBED_DEFINE_POSIX_ERROR(ENOTEMPTY, ENOTEMPTY), /* 39 Directory not empty */ |
kevman | 0:38ceb79fef03 | 622 | MBED_DEFINE_POSIX_ERROR(ELOOP, ELOOP), /* 40 Too many symbolic links encountered */ |
kevman | 0:38ceb79fef03 | 623 | MBED_DEFINE_POSIX_ERROR(EWOULDBLOCK, EAGAIN), /* EAGAIN Operation would block */ |
kevman | 0:38ceb79fef03 | 624 | MBED_DEFINE_POSIX_ERROR(ENOMSG, ENOMSG), /* 42 No message of desired type */ |
kevman | 0:38ceb79fef03 | 625 | MBED_DEFINE_POSIX_ERROR(EIDRM, EIDRM), /* 43 Identifier removed */ |
kevman | 0:38ceb79fef03 | 626 | MBED_DEFINE_POSIX_ERROR(ECHRNG, ECHRNG), /* 44 Channel number out of range */ |
kevman | 0:38ceb79fef03 | 627 | MBED_DEFINE_POSIX_ERROR(EL2NSYNC, EL2NSYNC), /* 45 Level 2 not synchronized */ |
kevman | 0:38ceb79fef03 | 628 | MBED_DEFINE_POSIX_ERROR(EL3HLT, EL3HLT), /* 46 Level 3 halted */ |
kevman | 0:38ceb79fef03 | 629 | MBED_DEFINE_POSIX_ERROR(EL3RST, EL3RST), /* 47 Level 3 reset */ |
kevman | 0:38ceb79fef03 | 630 | MBED_DEFINE_POSIX_ERROR(ELNRNG, ELNRNG), /* 48 Link number out of range */ |
kevman | 0:38ceb79fef03 | 631 | MBED_DEFINE_POSIX_ERROR(EUNATCH, EUNATCH), /* 49 Protocol driver not attached */ |
kevman | 0:38ceb79fef03 | 632 | MBED_DEFINE_POSIX_ERROR(ENOCSI, ENOCSI), /* 50 No CSI structure available */ |
kevman | 0:38ceb79fef03 | 633 | MBED_DEFINE_POSIX_ERROR(EL2HLT, EL2HLT), /* 51 Level 2 halted */ |
kevman | 0:38ceb79fef03 | 634 | MBED_DEFINE_POSIX_ERROR(EBADE, EBADE), /* 52 Invalid exchange */ |
kevman | 0:38ceb79fef03 | 635 | MBED_DEFINE_POSIX_ERROR(EBADR, EBADR), /* 53 Invalid request descriptor */ |
kevman | 0:38ceb79fef03 | 636 | MBED_DEFINE_POSIX_ERROR(EXFULL, EXFULL), /* 54 Exchange full */ |
kevman | 0:38ceb79fef03 | 637 | MBED_DEFINE_POSIX_ERROR(ENOANO, ENOANO), /* 55 No anode */ |
kevman | 0:38ceb79fef03 | 638 | MBED_DEFINE_POSIX_ERROR(EBADRQC, EBADRQC), /* 56 Invalid request code */ |
kevman | 0:38ceb79fef03 | 639 | MBED_DEFINE_POSIX_ERROR(EBADSLT, EBADSLT), /* 57 Invalid slot */ |
kevman | 0:38ceb79fef03 | 640 | MBED_DEFINE_POSIX_ERROR(EDEADLOCK, EDEADLK), /* EDEADLK Resource deadlock would occur */ |
kevman | 0:38ceb79fef03 | 641 | MBED_DEFINE_POSIX_ERROR(EBFONT, EBFONT), /* 59 Bad font file format */ |
kevman | 0:38ceb79fef03 | 642 | MBED_DEFINE_POSIX_ERROR(ENOSTR, ENOSTR), /* 60 Device not a stream */ |
kevman | 0:38ceb79fef03 | 643 | MBED_DEFINE_POSIX_ERROR(ENODATA, ENODATA), /* 61 No data available */ |
kevman | 0:38ceb79fef03 | 644 | MBED_DEFINE_POSIX_ERROR(ETIME, ETIME), /* 62 Timer expired */ |
kevman | 0:38ceb79fef03 | 645 | MBED_DEFINE_POSIX_ERROR(ENOSR, ENOSR), /* 63 Out of streams resources */ |
kevman | 0:38ceb79fef03 | 646 | MBED_DEFINE_POSIX_ERROR(ENONET, ENONET), /* 64 Machine is not on the network */ |
kevman | 0:38ceb79fef03 | 647 | MBED_DEFINE_POSIX_ERROR(ENOPKG, ENOPKG), /* 65 Package not installed */ |
kevman | 0:38ceb79fef03 | 648 | MBED_DEFINE_POSIX_ERROR(EREMOTE, EREMOTE), /* 66 Object is remote */ |
kevman | 0:38ceb79fef03 | 649 | MBED_DEFINE_POSIX_ERROR(ENOLINK, ENOLINK), /* 67 Link has been severed */ |
kevman | 0:38ceb79fef03 | 650 | MBED_DEFINE_POSIX_ERROR(EADV, EADV), /* 68 Advertise error */ |
kevman | 0:38ceb79fef03 | 651 | MBED_DEFINE_POSIX_ERROR(ESRMNT, ESRMNT), /* 69 Srmount error */ |
kevman | 0:38ceb79fef03 | 652 | MBED_DEFINE_POSIX_ERROR(ECOMM, ECOMM), /* 70 Communication error on send */ |
kevman | 0:38ceb79fef03 | 653 | MBED_DEFINE_POSIX_ERROR(EPROTO, EPROTO), /* 71 Protocol error */ |
kevman | 0:38ceb79fef03 | 654 | MBED_DEFINE_POSIX_ERROR(EMULTIHOP, EMULTIHOP), /* 72 Multihop attempted */ |
kevman | 0:38ceb79fef03 | 655 | MBED_DEFINE_POSIX_ERROR(EDOTDOT, EDOTDOT), /* 73 RFS specific error */ |
kevman | 0:38ceb79fef03 | 656 | MBED_DEFINE_POSIX_ERROR(EBADMSG, EBADMSG), /* 74 Not a data message */ |
kevman | 0:38ceb79fef03 | 657 | MBED_DEFINE_POSIX_ERROR(EOVERFLOW, EOVERFLOW), /* 75 Value too large for defined data type */ |
kevman | 0:38ceb79fef03 | 658 | MBED_DEFINE_POSIX_ERROR(ENOTUNIQ, ENOTUNIQ), /* 76 Name not unique on network */ |
kevman | 0:38ceb79fef03 | 659 | MBED_DEFINE_POSIX_ERROR(EBADFD, EBADFD), /* 77 File descriptor in bad state */ |
kevman | 0:38ceb79fef03 | 660 | MBED_DEFINE_POSIX_ERROR(EREMCHG, EREMCHG), /* 78 Remote address changed */ |
kevman | 0:38ceb79fef03 | 661 | MBED_DEFINE_POSIX_ERROR(ELIBACC, ELIBACC), /* 79 Can not access a needed shared library */ |
kevman | 0:38ceb79fef03 | 662 | MBED_DEFINE_POSIX_ERROR(ELIBBAD, ELIBBAD), /* 80 Accessing a corrupted shared library */ |
kevman | 0:38ceb79fef03 | 663 | MBED_DEFINE_POSIX_ERROR(ELIBSCN, ELIBSCN), /* 81 .lib section in a.out corrupted */ |
kevman | 0:38ceb79fef03 | 664 | MBED_DEFINE_POSIX_ERROR(ELIBMAX, ELIBMAX), /* 82 Attempting to link in too many shared libraries */ |
kevman | 0:38ceb79fef03 | 665 | MBED_DEFINE_POSIX_ERROR(ELIBEXEC, ELIBEXEC), /* 83 Cannot exec a shared library directly */ |
kevman | 0:38ceb79fef03 | 666 | MBED_DEFINE_POSIX_ERROR(EILSEQ, EILSEQ), /* 84 Illegal byte sequence */ |
kevman | 0:38ceb79fef03 | 667 | MBED_DEFINE_POSIX_ERROR(ERESTART, ERESTART), /* 85 Interrupted system call should be restarted */ |
kevman | 0:38ceb79fef03 | 668 | MBED_DEFINE_POSIX_ERROR(ESTRPIPE, ESTRPIPE), /* 86 Streams pipe error */ |
kevman | 0:38ceb79fef03 | 669 | MBED_DEFINE_POSIX_ERROR(EUSERS, EUSERS), /* 87 Too many users */ |
kevman | 0:38ceb79fef03 | 670 | MBED_DEFINE_POSIX_ERROR(ENOTSOCK, ENOTSOCK), /* 88 Socket operation on non-socket */ |
kevman | 0:38ceb79fef03 | 671 | MBED_DEFINE_POSIX_ERROR(EDESTADDRREQ, EDESTADDRREQ), /* 89 Destination address required */ |
kevman | 0:38ceb79fef03 | 672 | MBED_DEFINE_POSIX_ERROR(EMSGSIZE, EMSGSIZE), /* 90 Message too long */ |
kevman | 0:38ceb79fef03 | 673 | MBED_DEFINE_POSIX_ERROR(EPROTOTYPE, EPROTOTYPE), /* 91 Protocol wrong type for socket */ |
kevman | 0:38ceb79fef03 | 674 | MBED_DEFINE_POSIX_ERROR(ENOPROTOOPT, ENOPROTOOPT), /* 92 Protocol not available */ |
kevman | 0:38ceb79fef03 | 675 | MBED_DEFINE_POSIX_ERROR(EPROTONOSUPPORT, EPROTONOSUPPORT), /* 93 Protocol not supported */ |
kevman | 0:38ceb79fef03 | 676 | MBED_DEFINE_POSIX_ERROR(ESOCKTNOSUPPORT, ESOCKTNOSUPPORT), /* 94 Socket type not supported */ |
kevman | 0:38ceb79fef03 | 677 | MBED_DEFINE_POSIX_ERROR(EOPNOTSUPP, EOPNOTSUPP), /* 95 Operation not supported on transport endpoint */ |
kevman | 0:38ceb79fef03 | 678 | MBED_DEFINE_POSIX_ERROR(EPFNOSUPPORT, EPFNOSUPPORT), /* 96 Protocol family not supported */ |
kevman | 0:38ceb79fef03 | 679 | MBED_DEFINE_POSIX_ERROR(EAFNOSUPPORT, EAFNOSUPPORT), /* 97 Address family not supported by protocol */ |
kevman | 0:38ceb79fef03 | 680 | MBED_DEFINE_POSIX_ERROR(EADDRINUSE, EADDRINUSE), /* 98 Address already in use */ |
kevman | 0:38ceb79fef03 | 681 | MBED_DEFINE_POSIX_ERROR(EADDRNOTAVAIL, EADDRNOTAVAIL), /* 99 Cannot assign requested address */ |
kevman | 0:38ceb79fef03 | 682 | MBED_DEFINE_POSIX_ERROR(ENETDOWN, ENETDOWN), /* 100 Network is down */ |
kevman | 0:38ceb79fef03 | 683 | MBED_DEFINE_POSIX_ERROR(ENETUNREACH, ENETUNREACH), /* 101 Network is unreachable */ |
kevman | 0:38ceb79fef03 | 684 | MBED_DEFINE_POSIX_ERROR(ENETRESET, ENETRESET), /* 102 Network dropped connection because of reset */ |
kevman | 0:38ceb79fef03 | 685 | MBED_DEFINE_POSIX_ERROR(ECONNABORTED, ECONNABORTED), /* 103 Software caused connection abort */ |
kevman | 0:38ceb79fef03 | 686 | MBED_DEFINE_POSIX_ERROR(ECONNRESET, ECONNRESET), /* 104 Connection reset by peer */ |
kevman | 0:38ceb79fef03 | 687 | MBED_DEFINE_POSIX_ERROR(ENOBUFS, ENOBUFS), /* 105 No buffer space available */ |
kevman | 0:38ceb79fef03 | 688 | MBED_DEFINE_POSIX_ERROR(EISCONN, EISCONN), /* 106 Transport endpoint is already connected */ |
kevman | 0:38ceb79fef03 | 689 | MBED_DEFINE_POSIX_ERROR(ENOTCONN, ENOTCONN), /* 107 Transport endpoint is not connected */ |
kevman | 0:38ceb79fef03 | 690 | MBED_DEFINE_POSIX_ERROR(ESHUTDOWN, ESHUTDOWN), /* 108 Cannot send after transport endpoint shutdown */ |
kevman | 0:38ceb79fef03 | 691 | MBED_DEFINE_POSIX_ERROR(ETOOMANYREFS, ETOOMANYREFS), /* 109 Too many references: cannot splice */ |
kevman | 0:38ceb79fef03 | 692 | MBED_DEFINE_POSIX_ERROR(ETIMEDOUT, ETIMEDOUT), /* 110 Connection timed out */ |
kevman | 0:38ceb79fef03 | 693 | MBED_DEFINE_POSIX_ERROR(ECONNREFUSED, ECONNREFUSED), /* 111 Connection refused */ |
kevman | 0:38ceb79fef03 | 694 | MBED_DEFINE_POSIX_ERROR(EHOSTDOWN, EHOSTDOWN), /* 112 Host is down */ |
kevman | 0:38ceb79fef03 | 695 | MBED_DEFINE_POSIX_ERROR(EHOSTUNREACH, EHOSTUNREACH), /* 113 No route to host */ |
kevman | 0:38ceb79fef03 | 696 | MBED_DEFINE_POSIX_ERROR(EALREADY, EALREADY), /* 114 Operation already in progress */ |
kevman | 0:38ceb79fef03 | 697 | MBED_DEFINE_POSIX_ERROR(EINPROGRESS, EINPROGRESS), /* 115 Operation now in progress */ |
kevman | 0:38ceb79fef03 | 698 | MBED_DEFINE_POSIX_ERROR(ESTALE, ESTALE), /* 116 Stale NFS file handle */ |
kevman | 0:38ceb79fef03 | 699 | MBED_DEFINE_POSIX_ERROR(EUCLEAN, EUCLEAN), /* 117 Structure needs cleaning */ |
kevman | 0:38ceb79fef03 | 700 | MBED_DEFINE_POSIX_ERROR(ENOTNAM, ENOTNAM), /* 118 Not a XENIX named type file */ |
kevman | 0:38ceb79fef03 | 701 | MBED_DEFINE_POSIX_ERROR(ENAVAIL, ENAVAIL), /* 119 No XENIX semaphores available */ |
kevman | 0:38ceb79fef03 | 702 | MBED_DEFINE_POSIX_ERROR(EISNAM, EISNAM), /* 120 Is a named type file */ |
kevman | 0:38ceb79fef03 | 703 | MBED_DEFINE_POSIX_ERROR(EREMOTEIO, EREMOTEIO), /* 121 Remote I/O error */ |
kevman | 0:38ceb79fef03 | 704 | MBED_DEFINE_POSIX_ERROR(EDQUOT, EDQUOT), /* 122 Quota exceeded */ |
kevman | 0:38ceb79fef03 | 705 | MBED_DEFINE_POSIX_ERROR(ENOMEDIUM, ENOMEDIUM), /* 123 No medium found */ |
kevman | 0:38ceb79fef03 | 706 | MBED_DEFINE_POSIX_ERROR(EMEDIUMTYPE, EMEDIUMTYPE), /* 124 Wrong medium type */ |
kevman | 0:38ceb79fef03 | 707 | MBED_DEFINE_POSIX_ERROR(ECANCELED, ECANCELED), /* 125 Operation Canceled */ |
kevman | 0:38ceb79fef03 | 708 | MBED_DEFINE_POSIX_ERROR(ENOKEY, ENOKEY), /* 126 Required key not available */ |
kevman | 0:38ceb79fef03 | 709 | MBED_DEFINE_POSIX_ERROR(EKEYEXPIRED, EKEYEXPIRED), /* 127 Key has expired */ |
kevman | 0:38ceb79fef03 | 710 | MBED_DEFINE_POSIX_ERROR(EKEYREVOKED, EKEYREVOKED), /* 128 Key has been revoked */ |
kevman | 0:38ceb79fef03 | 711 | MBED_DEFINE_POSIX_ERROR(EKEYREJECTED, EKEYREJECTED), /* 129 Key was rejected by service */ |
kevman | 0:38ceb79fef03 | 712 | MBED_DEFINE_POSIX_ERROR(EOWNERDEAD, EOWNERDEAD), /* 130 Owner died */ |
kevman | 0:38ceb79fef03 | 713 | MBED_DEFINE_POSIX_ERROR(ENOTRECOVERABLE, ENOTRECOVERABLE), /* 131 State not recoverable */ |
kevman | 0:38ceb79fef03 | 714 | |
kevman | 0:38ceb79fef03 | 715 | //Below are MBED SYSTEM ERROR CODE definitions |
kevman | 0:38ceb79fef03 | 716 | //MBED SYSTEM ERROR CODE definitions starts at offset MBED_SYSTEM_ERROR_BASE, see above. |
kevman | 0:38ceb79fef03 | 717 | // Error Name Error Offset Error Code |
kevman | 0:38ceb79fef03 | 718 | MBED_DEFINE_SYSTEM_ERROR(UNKNOWN, 0), /* 256 Unknown error */ |
kevman | 0:38ceb79fef03 | 719 | MBED_DEFINE_SYSTEM_ERROR(INVALID_ARGUMENT, 1), /* 257 Invalid Argument */ |
kevman | 0:38ceb79fef03 | 720 | MBED_DEFINE_SYSTEM_ERROR(INVALID_DATA_DETECTED, 2), /* 258 Invalid data detected */ |
kevman | 0:38ceb79fef03 | 721 | MBED_DEFINE_SYSTEM_ERROR(INVALID_FORMAT, 3), /* 259 Invalid format */ |
kevman | 0:38ceb79fef03 | 722 | MBED_DEFINE_SYSTEM_ERROR(INVALID_INDEX, 4), /* 260 Invalid Index */ |
kevman | 0:38ceb79fef03 | 723 | MBED_DEFINE_SYSTEM_ERROR(INVALID_SIZE, 5), /* 261 Invalid Size */ |
kevman | 0:38ceb79fef03 | 724 | MBED_DEFINE_SYSTEM_ERROR(INVALID_OPERATION, 6), /* 262 Invalid Operation */ |
kevman | 0:38ceb79fef03 | 725 | MBED_DEFINE_SYSTEM_ERROR(ITEM_NOT_FOUND, 7), /* 263 Item Not Found */ |
kevman | 0:38ceb79fef03 | 726 | MBED_DEFINE_SYSTEM_ERROR(ACCESS_DENIED, 8), /* 264 Access Denied */ |
kevman | 0:38ceb79fef03 | 727 | MBED_DEFINE_SYSTEM_ERROR(UNSUPPORTED, 9), /* 265 Unsupported */ |
kevman | 0:38ceb79fef03 | 728 | MBED_DEFINE_SYSTEM_ERROR(BUFFER_FULL, 10), /* 266 Buffer Full */ |
kevman | 0:38ceb79fef03 | 729 | MBED_DEFINE_SYSTEM_ERROR(MEDIA_FULL, 11), /* 267 Media/Disk Full */ |
kevman | 0:38ceb79fef03 | 730 | MBED_DEFINE_SYSTEM_ERROR(ALREADY_IN_USE, 12), /* 268 Already in use */ |
kevman | 0:38ceb79fef03 | 731 | MBED_DEFINE_SYSTEM_ERROR(TIME_OUT, 13), /* 269 Timeout error */ |
kevman | 0:38ceb79fef03 | 732 | MBED_DEFINE_SYSTEM_ERROR(NOT_READY, 14), /* 270 Not Ready */ |
kevman | 0:38ceb79fef03 | 733 | MBED_DEFINE_SYSTEM_ERROR(FAILED_OPERATION, 15), /* 271 Requested Operation failed */ |
kevman | 0:38ceb79fef03 | 734 | MBED_DEFINE_SYSTEM_ERROR(OPERATION_PROHIBITED, 16), /* 272 Operation prohibited */ |
kevman | 0:38ceb79fef03 | 735 | MBED_DEFINE_SYSTEM_ERROR(OPERATION_ABORTED, 17), /* 273 Operation failed */ |
kevman | 0:38ceb79fef03 | 736 | MBED_DEFINE_SYSTEM_ERROR(WRITE_PROTECTED, 18), /* 274 Attempt to write to write-protected resource */ |
kevman | 0:38ceb79fef03 | 737 | MBED_DEFINE_SYSTEM_ERROR(NO_RESPONSE, 19), /* 275 No response */ |
kevman | 0:38ceb79fef03 | 738 | MBED_DEFINE_SYSTEM_ERROR(SEMAPHORE_LOCK_FAILED, 20), /* 276 Semaphore lock failed */ |
kevman | 0:38ceb79fef03 | 739 | MBED_DEFINE_SYSTEM_ERROR(MUTEX_LOCK_FAILED, 21), /* 277 Mutex lock failed */ |
kevman | 0:38ceb79fef03 | 740 | MBED_DEFINE_SYSTEM_ERROR(SEMAPHORE_UNLOCK_FAILED, 22), /* 278 Semaphore unlock failed */ |
kevman | 0:38ceb79fef03 | 741 | MBED_DEFINE_SYSTEM_ERROR(MUTEX_UNLOCK_FAILED, 23), /* 279 Mutex unlock failed */ |
kevman | 0:38ceb79fef03 | 742 | MBED_DEFINE_SYSTEM_ERROR(CRC_ERROR, 24), /* 280 CRC error or mismatch */ |
kevman | 0:38ceb79fef03 | 743 | MBED_DEFINE_SYSTEM_ERROR(OPEN_FAILED, 25), /* 281 Open failed */ |
kevman | 0:38ceb79fef03 | 744 | MBED_DEFINE_SYSTEM_ERROR(CLOSE_FAILED, 26), /* 282 Close failed */ |
kevman | 0:38ceb79fef03 | 745 | MBED_DEFINE_SYSTEM_ERROR(READ_FAILED, 27), /* 283 Read failed */ |
kevman | 0:38ceb79fef03 | 746 | MBED_DEFINE_SYSTEM_ERROR(WRITE_FAILED, 28), /* 284 Write failed */ |
kevman | 0:38ceb79fef03 | 747 | MBED_DEFINE_SYSTEM_ERROR(INITIALIZATION_FAILED, 29), /* 285 Initialization failed */ |
kevman | 0:38ceb79fef03 | 748 | MBED_DEFINE_SYSTEM_ERROR(BOOT_FAILURE, 30), /* 286 Boot failure */ |
kevman | 0:38ceb79fef03 | 749 | MBED_DEFINE_SYSTEM_ERROR(OUT_OF_MEMORY, 31), /* 287 Out of memory */ |
kevman | 0:38ceb79fef03 | 750 | MBED_DEFINE_SYSTEM_ERROR(OUT_OF_RESOURCES, 32), /* 288 Out of resources */ |
kevman | 0:38ceb79fef03 | 751 | MBED_DEFINE_SYSTEM_ERROR(ALLOC_FAILED, 33), /* 289 Alloc failed */ |
kevman | 0:38ceb79fef03 | 752 | MBED_DEFINE_SYSTEM_ERROR(FREE_FAILED, 34), /* 290 Free failed */ |
kevman | 0:38ceb79fef03 | 753 | MBED_DEFINE_SYSTEM_ERROR(OVERFLOW, 35), /* 291 Overflow error */ |
kevman | 0:38ceb79fef03 | 754 | MBED_DEFINE_SYSTEM_ERROR(UNDERFLOW, 36), /* 292 Underflow error */ |
kevman | 0:38ceb79fef03 | 755 | MBED_DEFINE_SYSTEM_ERROR(STACK_OVERFLOW, 37), /* 293 Stack overflow error */ |
kevman | 0:38ceb79fef03 | 756 | MBED_DEFINE_SYSTEM_ERROR(ISR_QUEUE_OVERFLOW, 38), /* 294 ISR queue overflow */ |
kevman | 0:38ceb79fef03 | 757 | MBED_DEFINE_SYSTEM_ERROR(TIMER_QUEUE_OVERFLOW, 39), /* 295 Timer Queue overflow */ |
kevman | 0:38ceb79fef03 | 758 | MBED_DEFINE_SYSTEM_ERROR(CLIB_SPACE_UNAVAILABLE, 40), /* 296 Standard library error - Space unavailable */ |
kevman | 0:38ceb79fef03 | 759 | MBED_DEFINE_SYSTEM_ERROR(CLIB_EXCEPTION, 41), /* 297 Standard library error - Exception */ |
kevman | 0:38ceb79fef03 | 760 | MBED_DEFINE_SYSTEM_ERROR(CLIB_MUTEX_INIT_FAILURE, 42), /* 298 Standard library error - Mutex Init failure */ |
kevman | 0:38ceb79fef03 | 761 | MBED_DEFINE_SYSTEM_ERROR(CREATE_FAILED, 43), /* 299 Create failed */ |
kevman | 0:38ceb79fef03 | 762 | MBED_DEFINE_SYSTEM_ERROR(DELETE_FAILED, 44), /* 300 Delete failed */ |
kevman | 0:38ceb79fef03 | 763 | MBED_DEFINE_SYSTEM_ERROR(THREAD_CREATE_FAILED, 45), /* 301 Thread Create failed */ |
kevman | 0:38ceb79fef03 | 764 | MBED_DEFINE_SYSTEM_ERROR(THREAD_DELETE_FAILED, 46), /* 302 Thread Delete failed */ |
kevman | 0:38ceb79fef03 | 765 | MBED_DEFINE_SYSTEM_ERROR(PROHIBITED_IN_ISR_CONTEXT, 47), /* 303 Operation Prohibited in ISR context */ |
kevman | 0:38ceb79fef03 | 766 | MBED_DEFINE_SYSTEM_ERROR(PINMAP_INVALID, 48), /* 304 Pinmap Invalid */ |
kevman | 0:38ceb79fef03 | 767 | MBED_DEFINE_SYSTEM_ERROR(RTOS_EVENT, 49), /* 305 Unknown Rtos Error */ |
kevman | 0:38ceb79fef03 | 768 | MBED_DEFINE_SYSTEM_ERROR(RTOS_THREAD_EVENT, 50), /* 306 Rtos Thread Error */ |
kevman | 0:38ceb79fef03 | 769 | MBED_DEFINE_SYSTEM_ERROR(RTOS_MUTEX_EVENT, 51), /* 307 Rtos Mutex Error */ |
kevman | 0:38ceb79fef03 | 770 | MBED_DEFINE_SYSTEM_ERROR(RTOS_SEMAPHORE_EVENT, 52), /* 308 Rtos Semaphore Error */ |
kevman | 0:38ceb79fef03 | 771 | MBED_DEFINE_SYSTEM_ERROR(RTOS_MEMORY_POOL_EVENT, 53), /* 309 Rtos Memory Pool Error */ |
kevman | 0:38ceb79fef03 | 772 | MBED_DEFINE_SYSTEM_ERROR(RTOS_TIMER_EVENT, 54), /* 310 Rtos Timer Error */ |
kevman | 0:38ceb79fef03 | 773 | MBED_DEFINE_SYSTEM_ERROR(RTOS_EVENT_FLAGS_EVENT, 55), /* 311 Rtos Event flags Error */ |
kevman | 0:38ceb79fef03 | 774 | MBED_DEFINE_SYSTEM_ERROR(RTOS_MESSAGE_QUEUE_EVENT, 56), /* 312 Rtos Message queue Error */ |
kevman | 0:38ceb79fef03 | 775 | MBED_DEFINE_SYSTEM_ERROR(DEVICE_BUSY, 57), /* 313 Device Busy */ |
kevman | 0:38ceb79fef03 | 776 | MBED_DEFINE_SYSTEM_ERROR(CONFIG_UNSUPPORTED, 58), /* 314 Configuration not supported */ |
kevman | 0:38ceb79fef03 | 777 | MBED_DEFINE_SYSTEM_ERROR(CONFIG_MISMATCH, 59), /* 315 Configuration mismatch */ |
kevman | 0:38ceb79fef03 | 778 | MBED_DEFINE_SYSTEM_ERROR(ALREADY_INITIALIZED, 60), /* 316 Already initialized */ |
kevman | 0:38ceb79fef03 | 779 | MBED_DEFINE_SYSTEM_ERROR(HARDFAULT_EXCEPTION, 61), /* 317 HardFault exception */ |
kevman | 0:38ceb79fef03 | 780 | MBED_DEFINE_SYSTEM_ERROR(MEMMANAGE_EXCEPTION, 62), /* 318 MemManage exception */ |
kevman | 0:38ceb79fef03 | 781 | MBED_DEFINE_SYSTEM_ERROR(BUSFAULT_EXCEPTION, 63), /* 319 BusFault exception */ |
kevman | 0:38ceb79fef03 | 782 | MBED_DEFINE_SYSTEM_ERROR(USAGEFAULT_EXCEPTION, 64), /* 320 UsageFault exception*/ |
kevman | 0:38ceb79fef03 | 783 | MBED_DEFINE_SYSTEM_ERROR(BLE_NO_FRAME_INITIALIZED, 65), /* 321 BLE No frame initialized */ |
kevman | 0:38ceb79fef03 | 784 | MBED_DEFINE_SYSTEM_ERROR(BLE_BACKEND_CREATION_FAILED, 66), /* 322 BLE Backend creation failed */ |
kevman | 0:38ceb79fef03 | 785 | MBED_DEFINE_SYSTEM_ERROR(BLE_BACKEND_NOT_INITIALIZED, 67), /* 323 BLE Backend not initialized */ |
kevman | 0:38ceb79fef03 | 786 | |
kevman | 0:38ceb79fef03 | 787 | //Everytime you add a new system error code, you must update |
kevman | 0:38ceb79fef03 | 788 | //Error documentation under Handbook to capture the info on |
kevman | 0:38ceb79fef03 | 789 | //the new error status/codes |
kevman | 0:38ceb79fef03 | 790 | |
kevman | 0:38ceb79fef03 | 791 | //MBED CUSTOM ERROR CODE definitions starts at offset MBED_CUSTOM_ERROR_BASE, see above. |
kevman | 0:38ceb79fef03 | 792 | /* Add More/Custom Error Codes here, See example below */ |
kevman | 0:38ceb79fef03 | 793 | //DEFINE_CUSTOM_ERROR( MY_CUSTOM_ERROR , 1 ), |
kevman | 0:38ceb79fef03 | 794 | |
kevman | 0:38ceb79fef03 | 795 | } mbed_error_code_t; |
kevman | 0:38ceb79fef03 | 796 | |
kevman | 0:38ceb79fef03 | 797 | /** mbed_error_ctx struct |
kevman | 0:38ceb79fef03 | 798 | * |
kevman | 0:38ceb79fef03 | 799 | * This struct captures the context information at the time of error.\n |
kevman | 0:38ceb79fef03 | 800 | * It primarily contains information about the thread where the error originated,\n |
kevman | 0:38ceb79fef03 | 801 | * filename/line number of the source file where the error occurred, a context specific error value(error_value)\n |
kevman | 0:38ceb79fef03 | 802 | * and the address where the error originated.\n |
kevman | 0:38ceb79fef03 | 803 | * |
kevman | 0:38ceb79fef03 | 804 | * @note |
kevman | 0:38ceb79fef03 | 805 | * Below are the members of mbed_error_ctx struct\n |
kevman | 0:38ceb79fef03 | 806 | * error_status mbed_error_status_t value for this error\n |
kevman | 0:38ceb79fef03 | 807 | * error_function_address Address where the error occurred\n |
kevman | 0:38ceb79fef03 | 808 | * thread_id ID of the thread which generated the error\n |
kevman | 0:38ceb79fef03 | 809 | * thread_entry_address Entry function of the thread which generated the error\n |
kevman | 0:38ceb79fef03 | 810 | * thread_stack_size Stack Size of the thread which generated the error\n |
kevman | 0:38ceb79fef03 | 811 | * thread_stack_mem Stack Top of the thread which generated the error\n |
kevman | 0:38ceb79fef03 | 812 | * thread_current_sp Current Stack Pointer of the thread which generated the error\n |
kevman | 0:38ceb79fef03 | 813 | * error_value A context/error specific value associated with this error\n |
kevman | 0:38ceb79fef03 | 814 | * error_filename Filename where the error originated\n |
kevman | 0:38ceb79fef03 | 815 | * error_line_number Line number in error_filename where the error originated\n |
kevman | 0:38ceb79fef03 | 816 | */ |
kevman | 0:38ceb79fef03 | 817 | typedef struct _mbed_error_ctx { |
kevman | 0:38ceb79fef03 | 818 | mbed_error_status_t error_status; |
kevman | 0:38ceb79fef03 | 819 | uint32_t error_address; |
kevman | 0:38ceb79fef03 | 820 | uint32_t error_value; |
kevman | 0:38ceb79fef03 | 821 | uint32_t thread_id; |
kevman | 0:38ceb79fef03 | 822 | uint32_t thread_entry_address; |
kevman | 0:38ceb79fef03 | 823 | uint32_t thread_stack_size; |
kevman | 0:38ceb79fef03 | 824 | uint32_t thread_stack_mem; |
kevman | 0:38ceb79fef03 | 825 | uint32_t thread_current_sp; |
kevman | 0:38ceb79fef03 | 826 | #ifdef MBED_CONF_PLATFORM_MAX_ERROR_FILENAME_LEN |
kevman | 0:38ceb79fef03 | 827 | char error_filename[MBED_CONF_PLATFORM_MAX_ERROR_FILENAME_LEN]; |
kevman | 0:38ceb79fef03 | 828 | uint32_t error_line_number; |
kevman | 0:38ceb79fef03 | 829 | #endif |
kevman | 0:38ceb79fef03 | 830 | } mbed_error_ctx; |
kevman | 0:38ceb79fef03 | 831 | |
kevman | 0:38ceb79fef03 | 832 | /** To generate a fatal compile-time error, you can use the pre-processor #error directive. |
kevman | 0:38ceb79fef03 | 833 | * |
kevman | 0:38ceb79fef03 | 834 | * @param format C string that contains data stream to be printed. |
kevman | 0:38ceb79fef03 | 835 | * Code snippets below show valid format. |
kevman | 0:38ceb79fef03 | 836 | * |
kevman | 0:38ceb79fef03 | 837 | * @code |
kevman | 0:38ceb79fef03 | 838 | * #error "That shouldn't have happened!" |
kevman | 0:38ceb79fef03 | 839 | * @endcode |
kevman | 0:38ceb79fef03 | 840 | * |
kevman | 0:38ceb79fef03 | 841 | * If the compiler evaluates this line, it will report the error and stop the compile. |
kevman | 0:38ceb79fef03 | 842 | * |
kevman | 0:38ceb79fef03 | 843 | * For example, you could use this to check some user-defined compile-time variables: |
kevman | 0:38ceb79fef03 | 844 | * |
kevman | 0:38ceb79fef03 | 845 | * @code |
kevman | 0:38ceb79fef03 | 846 | * #define NUM_PORTS 7 |
kevman | 0:38ceb79fef03 | 847 | * #if (NUM_PORTS > 4) |
kevman | 0:38ceb79fef03 | 848 | * #error "NUM_PORTS must be less than 4" |
kevman | 0:38ceb79fef03 | 849 | * #endif |
kevman | 0:38ceb79fef03 | 850 | * @endcode |
kevman | 0:38ceb79fef03 | 851 | * |
kevman | 0:38ceb79fef03 | 852 | * Reporting Run-Time Errors: |
kevman | 0:38ceb79fef03 | 853 | * To generate a fatal run-time error, you can use the mbed error() function. |
kevman | 0:38ceb79fef03 | 854 | * |
kevman | 0:38ceb79fef03 | 855 | * @code |
kevman | 0:38ceb79fef03 | 856 | * error("That shouldn't have happened!"); |
kevman | 0:38ceb79fef03 | 857 | * @endcode |
kevman | 0:38ceb79fef03 | 858 | * |
kevman | 0:38ceb79fef03 | 859 | * If the mbed running the program executes this function, it will print the |
kevman | 0:38ceb79fef03 | 860 | * message via the USB serial port, and then die with the blue lights of death! |
kevman | 0:38ceb79fef03 | 861 | * |
kevman | 0:38ceb79fef03 | 862 | * The message can use printf-style formatting, so you can report variables in the |
kevman | 0:38ceb79fef03 | 863 | * message too. For example, you could use this to check a run-time condition: |
kevman | 0:38ceb79fef03 | 864 | * |
kevman | 0:38ceb79fef03 | 865 | * @code |
kevman | 0:38ceb79fef03 | 866 | * if(x >= 5) { |
kevman | 0:38ceb79fef03 | 867 | * error("expected x to be less than 5, but got %d", x); |
kevman | 0:38ceb79fef03 | 868 | * } |
kevman | 0:38ceb79fef03 | 869 | * @endcode |
kevman | 0:38ceb79fef03 | 870 | * |
kevman | 0:38ceb79fef03 | 871 | * |
kevman | 0:38ceb79fef03 | 872 | */ |
kevman | 0:38ceb79fef03 | 873 | |
kevman | 0:38ceb79fef03 | 874 | void error(const char *format, ...); |
kevman | 0:38ceb79fef03 | 875 | |
kevman | 0:38ceb79fef03 | 876 | /** |
kevman | 0:38ceb79fef03 | 877 | * Call this Macro to generate a mbed_error_status_t value for a System error |
kevman | 0:38ceb79fef03 | 878 | * @param module Module generating the error code. If its unknown, pass MBED_MODULE_UNKNOWN. See mbed_module_type_t for module types. |
kevman | 0:38ceb79fef03 | 879 | * @param error_code The mbed_error_code_t code to be used in generating the mbed_error_status_t. See mbed_error_code_t for error codes. |
kevman | 0:38ceb79fef03 | 880 | * |
kevman | 0:38ceb79fef03 | 881 | * @code |
kevman | 0:38ceb79fef03 | 882 | * |
kevman | 0:38ceb79fef03 | 883 | * mbed_error_status_t driver_error = MBED_MAKE_SYSTEM_ERROR( MODULE_DRIVER_USB, MBED_ERROR_CODE_INITIALIZATION_FAILED ) |
kevman | 0:38ceb79fef03 | 884 | * |
kevman | 0:38ceb79fef03 | 885 | * @endcode |
kevman | 0:38ceb79fef03 | 886 | * @note This macro generate mbed_error_status_t-es with error type set to MBED_ERROR_TYPE_SYSTEM |
kevman | 0:38ceb79fef03 | 887 | * |
kevman | 0:38ceb79fef03 | 888 | */ |
kevman | 0:38ceb79fef03 | 889 | #define MBED_MAKE_SYSTEM_ERROR(module, error_code) MAKE_MBED_ERROR(MBED_ERROR_TYPE_SYSTEM, module, error_code) |
kevman | 0:38ceb79fef03 | 890 | |
kevman | 0:38ceb79fef03 | 891 | /** |
kevman | 0:38ceb79fef03 | 892 | * Call this Macro to generate a mbed_error_status_t value for a Custom error |
kevman | 0:38ceb79fef03 | 893 | * @param module Module generating the error code. If its unknown, pass MBED_MODULE_UNKNOWN. See mbed_module_type_t for module types. |
kevman | 0:38ceb79fef03 | 894 | * @param error_code The mbed_error_code_t code to be used in generating the mbed_error_status_t. See mbed_error_code_t for error codes. |
kevman | 0:38ceb79fef03 | 895 | * |
kevman | 0:38ceb79fef03 | 896 | * @code |
kevman | 0:38ceb79fef03 | 897 | * |
kevman | 0:38ceb79fef03 | 898 | * mbed_error_status_t custom_error = MBED_MAKE_CUSTOM_ERROR( MBED_MODULE_APPLICATION, 0xDEAD//16-bit custom error code ) |
kevman | 0:38ceb79fef03 | 899 | * |
kevman | 0:38ceb79fef03 | 900 | * @endcode |
kevman | 0:38ceb79fef03 | 901 | * @note This macro generate mbed_error_status_t-es with error type set to MBED_ERROR_TYPE_CUSTOM |
kevman | 0:38ceb79fef03 | 902 | * |
kevman | 0:38ceb79fef03 | 903 | */ |
kevman | 0:38ceb79fef03 | 904 | #define MBED_MAKE_CUSTOM_ERROR(module, error_code) MAKE_MBED_ERROR(MBED_ERROR_TYPE_CUSTOM, module, error_code) |
kevman | 0:38ceb79fef03 | 905 | |
kevman | 0:38ceb79fef03 | 906 | /** |
kevman | 0:38ceb79fef03 | 907 | * Call this Macro to generate a mbed_error_status_t value for a System error |
kevman | 0:38ceb79fef03 | 908 | * @param module Module generating the error code. If its unknown, pass MBED_MODULE_UNKNOWN. See mbed_module_type_t for module types. |
kevman | 0:38ceb79fef03 | 909 | * @param error_code The mbed_error_code_t code to be used in generating the mbed_error_status_t. See mbed_error_code_t for error codes. |
kevman | 0:38ceb79fef03 | 910 | * |
kevman | 0:38ceb79fef03 | 911 | * @code |
kevman | 0:38ceb79fef03 | 912 | * |
kevman | 0:38ceb79fef03 | 913 | * mbed_error_status_t new_error = MBED_MAKE_ERROR( MODULE_DRIVER_USB, MBED_ERROR_INITIALIZATION_FAILED ) |
kevman | 0:38ceb79fef03 | 914 | * |
kevman | 0:38ceb79fef03 | 915 | * @endcode |
kevman | 0:38ceb79fef03 | 916 | * @note This macro generate mbed_error_status_t-es with error type set to MBED_ERROR_TYPE_SYSTEM |
kevman | 0:38ceb79fef03 | 917 | * |
kevman | 0:38ceb79fef03 | 918 | */ |
kevman | 0:38ceb79fef03 | 919 | #define MBED_MAKE_ERROR(module, error_code) MBED_MAKE_SYSTEM_ERROR(module, error_code) |
kevman | 0:38ceb79fef03 | 920 | |
kevman | 0:38ceb79fef03 | 921 | /** |
kevman | 0:38ceb79fef03 | 922 | * Callback/Error hook function prototype. Applications needing a callback when an error is reported can use mbed_set_error_hook function |
kevman | 0:38ceb79fef03 | 923 | * to register a callback/error hook function using the following prototype. When an error happens in the system error handling |
kevman | 0:38ceb79fef03 | 924 | * implementation will invoke this callback with the mbed_error_status_t reported and the error context at the time of error. |
kevman | 0:38ceb79fef03 | 925 | * @param error_ctx Error context structure associated with this error. |
kevman | 0:38ceb79fef03 | 926 | * @return void |
kevman | 0:38ceb79fef03 | 927 | * |
kevman | 0:38ceb79fef03 | 928 | */ |
kevman | 0:38ceb79fef03 | 929 | typedef void (*mbed_error_hook_t)(const mbed_error_ctx *error_ctx); |
kevman | 0:38ceb79fef03 | 930 | |
kevman | 0:38ceb79fef03 | 931 | /** |
kevman | 0:38ceb79fef03 | 932 | * Call this function to set a system error/warning. This function will log the error status with the context info and return to caller. |
kevman | 0:38ceb79fef03 | 933 | * |
kevman | 0:38ceb79fef03 | 934 | * @param error_status mbed_error_status_t status to be set(See mbed_error_status_t enum above for available error status values). |
kevman | 0:38ceb79fef03 | 935 | * @param error_msg The error message to be printed out to STDIO/Serial. |
kevman | 0:38ceb79fef03 | 936 | * @param error_value Value associated with the error status. This would depend on error code/error scenario. |
kevman | 0:38ceb79fef03 | 937 | * @param filename Name of the source file originating the error( Most callers can pass __FILE__ here ). |
kevman | 0:38ceb79fef03 | 938 | * @param line_number The line number of the source file originating the error( Most callers can pass __LINE__ here ) . |
kevman | 0:38ceb79fef03 | 939 | * @return 0 or MBED_SUCCESS. |
kevman | 0:38ceb79fef03 | 940 | * MBED_ERROR_INVALID_ARGUMENT if called with invalid error status/codes |
kevman | 0:38ceb79fef03 | 941 | * |
kevman | 0:38ceb79fef03 | 942 | * @code |
kevman | 0:38ceb79fef03 | 943 | * |
kevman | 0:38ceb79fef03 | 944 | * mbed_error( ERROR_OUT_OF_MEMORY, "Out of memory error", 0, __FILE__, __LINE__ ) |
kevman | 0:38ceb79fef03 | 945 | * |
kevman | 0:38ceb79fef03 | 946 | * @endcode |
kevman | 0:38ceb79fef03 | 947 | * |
kevman | 0:38ceb79fef03 | 948 | * @note See MBED_WARNING/MBED_ERROR macros which provides a wrapper on this API |
kevman | 0:38ceb79fef03 | 949 | */ |
kevman | 0:38ceb79fef03 | 950 | mbed_error_status_t mbed_warning(mbed_error_status_t error_status, const char *error_msg, unsigned int error_value, const char *filename, int line_number); |
kevman | 0:38ceb79fef03 | 951 | |
kevman | 0:38ceb79fef03 | 952 | /** |
kevman | 0:38ceb79fef03 | 953 | * Returns the first system error reported. |
kevman | 0:38ceb79fef03 | 954 | * @return mbed_error_status_t code logged for the first error or MBED_SUCCESS if no errors are logged. |
kevman | 0:38ceb79fef03 | 955 | * |
kevman | 0:38ceb79fef03 | 956 | */ |
kevman | 0:38ceb79fef03 | 957 | mbed_error_status_t mbed_get_first_error(void); |
kevman | 0:38ceb79fef03 | 958 | |
kevman | 0:38ceb79fef03 | 959 | /** |
kevman | 0:38ceb79fef03 | 960 | * Returns the most recent system error reported. |
kevman | 0:38ceb79fef03 | 961 | * @return mbed_error_status_t code logged for the last error or MBED_SUCCESS if no errors are logged. |
kevman | 0:38ceb79fef03 | 962 | * |
kevman | 0:38ceb79fef03 | 963 | */ |
kevman | 0:38ceb79fef03 | 964 | mbed_error_status_t mbed_get_last_error(void); |
kevman | 0:38ceb79fef03 | 965 | |
kevman | 0:38ceb79fef03 | 966 | /** |
kevman | 0:38ceb79fef03 | 967 | * Returns the number of system errors reported after boot. |
kevman | 0:38ceb79fef03 | 968 | * @return int Number of errors reported. |
kevman | 0:38ceb79fef03 | 969 | * |
kevman | 0:38ceb79fef03 | 970 | */ |
kevman | 0:38ceb79fef03 | 971 | int mbed_get_error_count(void); |
kevman | 0:38ceb79fef03 | 972 | |
kevman | 0:38ceb79fef03 | 973 | /** |
kevman | 0:38ceb79fef03 | 974 | * Call this function to set a fatal system error and halt the system. This function will log the fatal error with the context info and prints the error report and halts the system. |
kevman | 0:38ceb79fef03 | 975 | * |
kevman | 0:38ceb79fef03 | 976 | * @param error_status mbed_error_status_t status to be set(See mbed_error_status_t enum above for available error status values). |
kevman | 0:38ceb79fef03 | 977 | * @param error_msg The error message to be printed out to STDIO/Serial. |
kevman | 0:38ceb79fef03 | 978 | * @param error_value Value associated with the error status. This would depend on error code/error scenario. |
kevman | 0:38ceb79fef03 | 979 | * @param filename Name of the source file originating the error( Most callers can pass __FILE__ here ). |
kevman | 0:38ceb79fef03 | 980 | * @param line_number The line number of the source file originating the error( Most callers can pass __LINE__ here ) . |
kevman | 0:38ceb79fef03 | 981 | * @return 0 or MBED_SUCCESS. |
kevman | 0:38ceb79fef03 | 982 | * MBED_ERROR_INVALID_ARGUMENT if called with invalid error status/codes |
kevman | 0:38ceb79fef03 | 983 | * |
kevman | 0:38ceb79fef03 | 984 | * @code |
kevman | 0:38ceb79fef03 | 985 | * |
kevman | 0:38ceb79fef03 | 986 | * mbed_error( MBED_ERROR_PROHIBITED_OPERATION, "Prohibited operation tried", 0, __FILE__, __LINE__ ) |
kevman | 0:38ceb79fef03 | 987 | * |
kevman | 0:38ceb79fef03 | 988 | * @endcode |
kevman | 0:38ceb79fef03 | 989 | * |
kevman | 0:38ceb79fef03 | 990 | * @note See MBED_WARNING/MBED_ERROR macros which provides a wrapper on this API |
kevman | 0:38ceb79fef03 | 991 | */ |
kevman | 0:38ceb79fef03 | 992 | mbed_error_status_t mbed_error(mbed_error_status_t error_status, const char *error_msg, unsigned int error_value, const char *filename, int line_number); |
kevman | 0:38ceb79fef03 | 993 | |
kevman | 0:38ceb79fef03 | 994 | /** |
kevman | 0:38ceb79fef03 | 995 | * Registers an application defined error callback with the error handling system. |
kevman | 0:38ceb79fef03 | 996 | * This function will be called with error context info whenever system handles a mbed_error/mbed_warning call |
kevman | 0:38ceb79fef03 | 997 | * NOTE: This function should be implemented for re-entrancy as multiple threads may invoke mbed_error which may cause error hook to be called. |
kevman | 0:38ceb79fef03 | 998 | * @param custom_error_hook mbed_error_status_t status to be set(See mbed_error_status_t enum above for available error status values). |
kevman | 0:38ceb79fef03 | 999 | * @return 0 or MBED_SUCCESS on success. |
kevman | 0:38ceb79fef03 | 1000 | * MBED_ERROR_INVALID_ARGUMENT in case of NULL for custom_error_hook |
kevman | 0:38ceb79fef03 | 1001 | * |
kevman | 0:38ceb79fef03 | 1002 | * @code |
kevman | 0:38ceb79fef03 | 1003 | * |
kevman | 0:38ceb79fef03 | 1004 | * mbed_error_status_t my_custom_error_hook(mbed_error_status_t error_status, const mbed_error_ctx *error_ctx) { |
kevman | 0:38ceb79fef03 | 1005 | * //Do something with the error_status or error_ctx |
kevman | 0:38ceb79fef03 | 1006 | * } |
kevman | 0:38ceb79fef03 | 1007 | * |
kevman | 0:38ceb79fef03 | 1008 | * mbed_set_error_hook( my_custom_error_hook ) |
kevman | 0:38ceb79fef03 | 1009 | * |
kevman | 0:38ceb79fef03 | 1010 | * @endcode |
kevman | 0:38ceb79fef03 | 1011 | * @note The erro hook function implementation should be re-entrant. |
kevman | 0:38ceb79fef03 | 1012 | * |
kevman | 0:38ceb79fef03 | 1013 | */ |
kevman | 0:38ceb79fef03 | 1014 | mbed_error_status_t mbed_set_error_hook(mbed_error_hook_t custom_error_hook); |
kevman | 0:38ceb79fef03 | 1015 | |
kevman | 0:38ceb79fef03 | 1016 | /** |
kevman | 0:38ceb79fef03 | 1017 | * Reads the first error context information captured. |
kevman | 0:38ceb79fef03 | 1018 | * @param error_info This is the mbed_error_context info captured as part of the first mbed_error call. The caller should pass a pointer to mbed_error_context struct allocated by the caller. |
kevman | 0:38ceb79fef03 | 1019 | * @return 0 or MBED_SUCCESS on success. |
kevman | 0:38ceb79fef03 | 1020 | * MBED_ERROR_INVALID_ARGUMENT in case of invalid index |
kevman | 0:38ceb79fef03 | 1021 | * |
kevman | 0:38ceb79fef03 | 1022 | */ |
kevman | 0:38ceb79fef03 | 1023 | mbed_error_status_t mbed_get_first_error_info(mbed_error_ctx *error_info); |
kevman | 0:38ceb79fef03 | 1024 | |
kevman | 0:38ceb79fef03 | 1025 | /** |
kevman | 0:38ceb79fef03 | 1026 | * Reads the last error context information captured. |
kevman | 0:38ceb79fef03 | 1027 | * @param error_info This is the mbed_error_context info captured as part of the last mbed_error call. The caller should pass a pointer to mbed_error_context struct allocated by the caller. |
kevman | 0:38ceb79fef03 | 1028 | * @return 0 or MBED_ERROR_SUCCESS on success. |
kevman | 0:38ceb79fef03 | 1029 | * MBED_ERROR_INVALID_ARGUMENT in case of invalid index |
kevman | 0:38ceb79fef03 | 1030 | * |
kevman | 0:38ceb79fef03 | 1031 | */ |
kevman | 0:38ceb79fef03 | 1032 | mbed_error_status_t mbed_get_last_error_info(mbed_error_ctx *error_info); |
kevman | 0:38ceb79fef03 | 1033 | |
kevman | 0:38ceb79fef03 | 1034 | /** |
kevman | 0:38ceb79fef03 | 1035 | * Clears the last error, first error, error count and all entries in the error history. |
kevman | 0:38ceb79fef03 | 1036 | * @return 0 or MBED_SUCCESS on success. |
kevman | 0:38ceb79fef03 | 1037 | * |
kevman | 0:38ceb79fef03 | 1038 | */ |
kevman | 0:38ceb79fef03 | 1039 | mbed_error_status_t mbed_clear_all_errors(void); |
kevman | 0:38ceb79fef03 | 1040 | |
kevman | 0:38ceb79fef03 | 1041 | /** |
kevman | 0:38ceb79fef03 | 1042 | * Generates a mbed_error_status_t value based on passed in values for type, module and error code. |
kevman | 0:38ceb79fef03 | 1043 | * @param error_type Error type based on mbed_error_type_t enum. |
kevman | 0:38ceb79fef03 | 1044 | * @param module Module type based on mbed_module_type_t enum. |
kevman | 0:38ceb79fef03 | 1045 | * @param error_code Error codes defined by mbed_error_code_t enum |
kevman | 0:38ceb79fef03 | 1046 | * @return 0 or MBED_ERROR_SUCCESS on success. |
kevman | 0:38ceb79fef03 | 1047 | * |
kevman | 0:38ceb79fef03 | 1048 | */ |
kevman | 0:38ceb79fef03 | 1049 | mbed_error_status_t mbed_make_error(mbed_error_type_t error_type, mbed_module_type_t module, mbed_error_code_t error_code); |
kevman | 0:38ceb79fef03 | 1050 | |
kevman | 0:38ceb79fef03 | 1051 | /** |
kevman | 0:38ceb79fef03 | 1052 | * Returns the current number of entries in the error history, if there has been more than max number of errors logged the number returned will be max depth of error history. |
kevman | 0:38ceb79fef03 | 1053 | * @return Current number of entries in the error history. |
kevman | 0:38ceb79fef03 | 1054 | * |
kevman | 0:38ceb79fef03 | 1055 | */ |
kevman | 0:38ceb79fef03 | 1056 | int mbed_get_error_hist_count(void); |
kevman | 0:38ceb79fef03 | 1057 | |
kevman | 0:38ceb79fef03 | 1058 | /** |
kevman | 0:38ceb79fef03 | 1059 | * Reads the error context information for a specific error from error history, specified by the index. |
kevman | 0:38ceb79fef03 | 1060 | * |
kevman | 0:38ceb79fef03 | 1061 | * @param index index of the error context entry in the history to be retrieved.\n |
kevman | 0:38ceb79fef03 | 1062 | * The number of entries in the error history is configured during build and the max index depends on max depth of error history.\n |
kevman | 0:38ceb79fef03 | 1063 | * index = 0 points to the oldest entry in the history, and index = (max history depth - 1) points to the latest entry in the error history.\n |
kevman | 0:38ceb79fef03 | 1064 | * @param error_info This is the mbed_error_context info captured as part of the error history. The caller should pass a pointer to mbed_error_context struct allocated by the caller. |
kevman | 0:38ceb79fef03 | 1065 | * @return 0 or MBED_SUCCESS on success. |
kevman | 0:38ceb79fef03 | 1066 | * MBED_ERROR_INVALID_ARGUMENT in case of invalid index |
kevman | 0:38ceb79fef03 | 1067 | * |
kevman | 0:38ceb79fef03 | 1068 | */ |
kevman | 0:38ceb79fef03 | 1069 | mbed_error_status_t mbed_get_error_hist_info(int index, mbed_error_ctx *error_info); |
kevman | 0:38ceb79fef03 | 1070 | |
kevman | 0:38ceb79fef03 | 1071 | /** |
kevman | 0:38ceb79fef03 | 1072 | * Saves the error history information to a file |
kevman | 0:38ceb79fef03 | 1073 | * |
kevman | 0:38ceb79fef03 | 1074 | * @param path path to the file in the filesystem |
kevman | 0:38ceb79fef03 | 1075 | * @return 0 or MBED_ERROR_SUCCESS on success. |
kevman | 0:38ceb79fef03 | 1076 | * MBED_ERROR_WRITE_FAILED if writing to file failed |
kevman | 0:38ceb79fef03 | 1077 | * MBED_ERROR_INVALID_ARGUMENT if path is not valid |
kevman | 0:38ceb79fef03 | 1078 | * |
kevman | 0:38ceb79fef03 | 1079 | * @note Filesystem support is required in order for this function to work. |
kevman | 0:38ceb79fef03 | 1080 | * |
kevman | 0:38ceb79fef03 | 1081 | */ |
kevman | 0:38ceb79fef03 | 1082 | mbed_error_status_t mbed_save_error_hist(const char *path); |
kevman | 0:38ceb79fef03 | 1083 | |
kevman | 0:38ceb79fef03 | 1084 | #ifdef __cplusplus |
kevman | 0:38ceb79fef03 | 1085 | } |
kevman | 0:38ceb79fef03 | 1086 | #endif |
kevman | 0:38ceb79fef03 | 1087 | |
kevman | 0:38ceb79fef03 | 1088 | #endif |
kevman | 0:38ceb79fef03 | 1089 | |
kevman | 0:38ceb79fef03 | 1090 | /** @}*/ |
kevman | 0:38ceb79fef03 | 1091 | /** @}*/ |
kevman | 0:38ceb79fef03 | 1092 | |
kevman | 0:38ceb79fef03 | 1093 |