test test test

Dependencies:   mbed

Committer:
mohamedmoawya
Date:
Mon May 25 19:06:11 2020 +0000
Revision:
0:e4c5e6ec922e
snake game tteest

Who changed what in which revision?

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