Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
mbed_error.h
00001 /** \addtogroup platform */ 00002 /** @{*/ 00003 /** 00004 * \defgroup platform_error Error functions 00005 * @{ 00006 */ 00007 /* mbed Microcontroller Library 00008 * Copyright (c) 2006-2013 ARM Limited 00009 * 00010 * Licensed under the Apache License, Version 2.0 (the "License"); 00011 * you may not use this file except in compliance with the License. 00012 * You may obtain a copy of the License at 00013 * 00014 * http://www.apache.org/licenses/LICENSE-2.0 00015 * 00016 * Unless required by applicable law or agreed to in writing, software 00017 * distributed under the License is distributed on an "AS IS" BASIS, 00018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00019 * See the License for the specific language governing permissions and 00020 * limitations under the License. 00021 */ 00022 #ifndef MBED_ERROR_H 00023 #define MBED_ERROR_H 00024 00025 #include "platform/mbed_retarget.h" 00026 #include "platform/mbed_toolchain.h" 00027 00028 #ifdef __cplusplus 00029 extern "C" { 00030 #endif 00031 00032 /** Define this macro to include filenames in error context. For release builds, do not include filename to save memory. 00033 * MBED_CONF_ERROR_FILENAME_CAPTURE_ENABLED 00034 */ 00035 00036 /** Define this macro to disable error logging, note that the first and last error capture will still be active by default. 00037 * MBED_CONF_ERROR_HIST_DISABLED 00038 */ 00039 00040 #ifndef MBED_CONF_MAX_ERROR_FILENAME_LEN 00041 #define MBED_CONF_MAX_ERROR_FILENAME_LEN 16 00042 #endif 00043 00044 #define MBED_ERROR_STATUS_CODE_MASK (0x0000FFFF) 00045 #define MBED_ERROR_STATUS_CODE_POS (0) 00046 #define MBED_ERROR_STATUS_CODE_FIELD_SIZE (16) 00047 00048 #define MBED_ERROR_STATUS_MODULE_MASK (0x00FF0000) 00049 #define MBED_ERROR_STATUS_MODULE_POS (16) 00050 #define MBED_ERROR_STATUS_MODULE_FIELD_SIZE (8) 00051 00052 #define MBED_ERROR_STATUS_TYPE_MASK (0x60000000) 00053 #define MBED_ERROR_STATUS_TYPE_POS (29) 00054 #define MBED_ERROR_STATUS_TYPE_FIELD_SIZE (2) 00055 00056 /* mbed_error_status_t Status Encoding */ 00057 //|31(1 bit) Always Negative|30-29(2 bits) |28-24 | 23-16(8 bits) | 15-0(16 bits) | 00058 //|-1 |TYPE |(unused/reserved) | MODULE TYPE | ERROR CODE | 00059 00060 #define MAKE_MBED_ERROR(type, module, error_code) (mbed_error_status_t) \ 00061 ((0x80000000) | \ 00062 (MBED_ERROR_STATUS_CODE_MASK & (error_code << MBED_ERROR_STATUS_CODE_POS)) | \ 00063 (MBED_ERROR_STATUS_MODULE_MASK & (module << MBED_ERROR_STATUS_MODULE_POS)) | \ 00064 (MBED_ERROR_STATUS_TYPE_MASK & (type << MBED_ERROR_STATUS_TYPE_POS))) 00065 00066 #define MBED_GET_ERROR_TYPE( error_status ) ((error_status & MBED_ERROR_STATUS_TYPE_MASK) >> MBED_ERROR_STATUS_TYPE_POS) 00067 #define MBED_GET_ERROR_MODULE( error_status ) ((error_status & MBED_ERROR_STATUS_MODULE_MASK) >> MBED_ERROR_STATUS_MODULE_POS) 00068 #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)) 00069 00070 /** mbed_error_status_t description 00071 * 00072 * 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 00073 * Internally its encoded as below with bit-fields representing error type, module and error code:\n\n 00074 * mbed_error_status_t Status Encoding:\n 00075 * 00076 \verbatim 00077 | 31 Always Negative | 30-29(2 bits) | 28-24 | 23-16(8 bits) | 15-0(16 bits) | 00078 | -1 | TYPE | (unused/reserved) | MODULE TYPE | ERROR CODE | 00079 \endverbatim 00080 * 00081 * The error status value range for each error type is as follows:\n 00082 * Posix Error Status-es - 0xFFFFFFFF to 0xFFFFFF01(-1 -255) - This corresponds to Posix error codes represented as negative.\n 00083 * 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 00084 * 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 00085 * 00086 * The ERROR CODE(values encoded into ERROR CODE bit-field in mbed_error_status_t) value range for each error type is also seperated as below:\n 00087 * Posix Error Codes - 1 to 255.\n 00088 * System Error Codes - 256 to 4095.\n 00089 * Custom Error Codes - 4096 to 65535.\n 00090 * 00091 * @note Posix error codes are always encoded as negative of their actual value. For example, EPERM is encoded as -EPERM. 00092 * And, the MODULE TYPE for Posix error codes are always encoded as MBED_MODULE_UNKNOWN.\n 00093 * This is to enable easy injection of Posix error codes into MbedOS error handling system without altering the actual Posix error values.\n 00094 * Accordingly, Posix error codes are represented as -1 to -255 under MbedOS error status representation. 00095 */ 00096 typedef int mbed_error_status_t; 00097 00098 /** 00099 * Macro for defining a Posix error status. This macro is mainly used to define Posix error values in mbed_error_code_t enumeration. 00100 * @param error_name Name of the error without the ERROR_ prefix 00101 * @param error_code Error code value to be used, must be between 1 and 255(inclusive). 00102 * 00103 */ 00104 #define MBED_DEFINE_POSIX_ERROR( error_name, error_code ) \ 00105 MBED_ERROR_CODE_##error_name = error_code, \ 00106 MBED_ERROR_##error_name = -(MBED_POSIX_ERROR_BASE + error_code) 00107 00108 /** 00109 * Macro for defining a System error status. This macro is used to define System error values in mbed_error_code_t enumeration. 00110 * @param error_name Name of the error without the ERROR_ prefix 00111 * @param error_code Error code value to be used, must be between 256 and 4096(inclusive). 00112 * 00113 */ 00114 #define MBED_DEFINE_SYSTEM_ERROR( error_name, error_code ) \ 00115 MBED_ERROR_CODE_##error_name = MBED_SYSTEM_ERROR_BASE + error_code, \ 00116 MBED_ERROR_##error_name = MAKE_MBED_ERROR(MBED_ERROR_TYPE_SYSTEM, MBED_MODULE_UNKNOWN, MBED_ERROR_CODE_##error_name) 00117 00118 /** 00119 * Macro for defining a Custom error status. This macro is used to define custom error values in mbed_error_code_t enumeration. 00120 * @param error_name Name of the error without the ERROR_ prefix 00121 * @param error_code Error code value to be used, must be between 4097 and 65535(inclusive). 00122 * 00123 */ 00124 #define MBED_DEFINE_CUSTOM_ERROR( error_name, error_code ) \ 00125 MBED_ERROR_CODE_##error_name = MBED_CUSTOM_ERROR_BASE + error_code, \ 00126 MBED_ERROR_##error_name = MAKE_MBED_ERROR(MBED_ERROR_TYPE_CUSTOM, MBED_MODULE_UNKNOWN, MBED_ERROR_CODE_##error_name) 00127 00128 00129 /** 00130 * Macros for setting a system warning. These macros will log the error, Its a wrapper for calling mbed_warning API. 00131 * There are 2 versions of this macro. MBED_WARNING takes status and message. MBED_WARNING1 takes an additional context specific argument 00132 * @param error_status mbed_error_status_t status to be set(See mbed_error_status_t enum above for available error status values). 00133 * @param error_msg The error message to be printed out to STDIO/Serial. 00134 * @param error_value Value associated with the error status. This would depend on error code/error scenario. 00135 * 00136 * @code 00137 * 00138 * MBED_WARNING( ERROR_INVALID_SIZE, "MyDriver: Invalid size in read" ) 00139 * MBED_WARNING1( ERROR_INVALID_SIZE, "MyDriver: Invalid size in read", size_val ) 00140 * 00141 * @endcode 00142 * @note The macro calls mbed_warning API with filename and line number info without caller explicitly passing them. 00143 * 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. 00144 * 00145 */ 00146 #ifdef NDEBUG 00147 #define MBED_WARNING1( error_status, error_msg, error_value ) mbed_warning( error_status, (const char *)NULL, (uint32_t)error_value, NULL, 0 ) 00148 #define MBED_WARNING( error_status, error_msg ) mbed_warning( error_status, (const char *)NULL, (uint32_t)0, NULL, 0 ) 00149 #else 00150 #if defined(MBED_CONF_ERROR_FILENAME_CAPTURE_ENABLED) 00151 #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__ ) 00152 #define MBED_WARNING( error_status, error_msg ) mbed_warning( error_status, (const char *)error_msg, (uint32_t)0 , (const char *)MBED_FILENAME, __LINE__ ) 00153 #else 00154 #define MBED_WARNING1( error_status, error_msg, error_value ) mbed_warning( error_status, (const char *)error_msg, (uint32_t)error_value, NULL, 0 ) 00155 #define MBED_WARNING( error_status, error_msg ) mbed_warning( error_status, (const char *)error_msg, (uint32_t)0, NULL, 0 ) 00156 #endif 00157 #endif 00158 00159 /** 00160 * 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. 00161 * There are 2 versions of this macro. MBED_ERROR takes status and message. MBED_ERROR1 takes an additional context specific argument 00162 * @param error_status mbed_error_status_t status to be set(See mbed_error_status_t enum above for available error status values). 00163 * @param error_msg The error message to be printed out to STDIO/Serial. 00164 * @param error_value Value associated with the error status. This would depend on error code/error scenario. Only available with MBED_ERROR1 00165 * @return 0 or MBED_SUCCESS. 00166 * MBED_ERROR_INVALID_ARGUMENT if called with invalid error status/codes 00167 * 00168 * @code 00169 * 00170 * MBED_ERROR( MBED_ERROR_MUTEX_LOCK_FAILED, "MyDriver: Can't lock driver Mutex" ) 00171 * MBED_ERROR1( MBED_ERROR_MUTEX_LOCK_FAILED, "MyDriver: Can't lock driver Mutex", &my_mutex ) 00172 * 00173 * @endcode 00174 * @note The macro calls mbed_error API with filename and line number info without caller explicitly passing them. 00175 * 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. 00176 * 00177 */ 00178 #ifdef NDEBUG 00179 #define MBED_ERROR1( error_status, error_msg, error_value ) mbed_error( error_status, (const char *)NULL, (uint32_t)error_value, NULL, 0 ) 00180 #define MBED_ERROR( error_status, error_msg ) mbed_error( error_status, (const char *)NULL, (uint32_t)0 , NULL, 0 ) 00181 #else 00182 #if defined(MBED_CONF_ERROR_FILENAME_CAPTURE_ENABLED) 00183 #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__ ) 00184 #define MBED_ERROR( error_status, error_msg ) mbed_error( error_status, (const char *)error_msg, (uint32_t)0 , (const char *)MBED_FILENAME, __LINE__ ) 00185 #else 00186 #define MBED_ERROR1( error_status, error_msg, error_value ) mbed_error( error_status, (const char *)error_msg, (uint32_t)error_value, NULL, 0 ) 00187 #define MBED_ERROR( error_status, error_msg ) mbed_error( error_status, (const char *)error_msg, (uint32_t)0 , NULL, 0 ) 00188 #endif 00189 #endif 00190 00191 //Error Type definition 00192 /** mbed_error_type_t definition 00193 * @note 00194 * This enumeration defines the Error types supported. The value of these enum values will be encoded into mbed_error_status_t TYPE field.\n 00195 * See mbed_error_status_t description for more info.\n 00196 * MBED_ERROR_TYPE_SYSTEM - Used to indicate that the error status is of System defined Error type.\n 00197 * MBED_ERROR_TYPE_CUSTOM - Used to indicate that the error status is of Custom defined Error type.\n 00198 * MBED_ERROR_TYPE_POSIX - Used to indicate that the error status is of Posix error type.\n 00199 * 00200 */ 00201 typedef enum _mbed_error_type_t 00202 { 00203 MBED_ERROR_TYPE_SYSTEM = 0, 00204 MBED_ERROR_TYPE_CUSTOM = 1, 00205 //2 is reserved 00206 //Use 3 for POSIX because we are mapping -1 to -255 to POSIX error codes 00207 //and thus we must use 3 to match the type bits in error status representation which are from 0xFFFFFFFF to 0xFFFFFF00 00208 MBED_ERROR_TYPE_POSIX = 3 00209 } mbed_error_type_t; 00210 00211 //Module type/id definitions 00212 /** mbed_module_type_t definition 00213 * @note 00214 * This enumeration defines the module types. The value of these enum values will be encoded into mbed_error_status_t MODULE field.\n\n 00215 * See mbed_error_status_t description for more info.\n 00216 * 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 00217 * Other module values can be used to provide more info on who/where the error originated from.\n\n 00218 * For example, if I2C driver is the component originating the error you can use MBED_MODULE_DRIVER_I2C to provide more info.\n 00219 * Its used in call to MBED_MAKE_ERROR/MBED_MAKE_SYSTEM_ERROR/MBED_MAKE_CUSTOM_ERROR macros.\n 00220 * 00221 * @code 00222 * Example: mbed_error_status_t i2c_driver_error = MBED_MAKE_ERROR( MBED_MODULE_DRIVER_I2C, MBED_ERROR_CONFIG_UNSUPPORTED ); 00223 * @endcode 00224 * 00225 * @note 00226 * \n Below are the module code mappings:\n 00227 \verbatim 00228 MBED_MODULE_APPLICATION 0 Application 00229 MBED_MODULE_PLATFORM 1 Platform 00230 MODULE_KERNEL 2 RTX Kernel 00231 MBED_MODULE_NETWORK_STACK 3 Network stack 00232 MBED_MODULE_HAL 4 HAL - Hardware Abstraction Layer 00233 MBED_MODULE_NETWORK_STACKMODULE_MEMORY_SUBSYSTEM 5 Memory Subsystem 00234 MBED_MODULE_FILESYSTEM 6 Filesystem 00235 MBED_MODULE_BLOCK_DEVICE 7 Block device 00236 MBED_MODULE_DRIVER 8 Driver 00237 MBED_MODULE_DRIVER_SERIAL 9 Serial Driver 00238 MBED_MODULE_DRIVER_RTC 10 RTC Driver 00239 MBED_MODULE_DRIVER_I2C 11 I2C Driver 00240 MODULE_DRIVER_SPI 12 SPI Driver 00241 MODULE_DRIVER_GPIO 13 GPIO Driver 00242 MODULE_DRIVER_ANALOG 14 Analog Driver 00243 MODULE_DRIVER_DIGITAL 15 DigitalIO Driver 00244 MODULE_DRIVER_CAN 16 CAN Driver 00245 MODULE_DRIVER_ETHERNET 17 Ethernet Driver 00246 MODULE_DRIVER_CRC 18 CRC Module 00247 MODULE_DRIVER_PWM 19 PWM Driver 00248 MODULE_DRIVER_QSPI 20 QSPI Driver 00249 MODULE_DRIVER_USB 21 USB Driver 00250 MODULE_TARGET_SDK 22 SDK 00251 00252 MBED_MODULE_UNKNOWN 255 Unknown module 00253 \endverbatim 00254 * 00255 */ 00256 typedef enum _mbed_module_type 00257 { 00258 MBED_MODULE_APPLICATION = 0, 00259 MBED_MODULE_PLATFORM, 00260 MBED_MODULE_KERNEL, 00261 MBED_MODULE_NETWORK_STACK, 00262 MBED_MODULE_HAL, 00263 MBED_MODULE_NETWORK_STACKMODULE_MEMORY_SUBSYSTEM, 00264 MBED_MODULE_FILESYSTEM, 00265 MBED_MODULE_BLOCK_DEVICE, 00266 MBED_MODULE_DRIVER, 00267 MBED_MODULE_DRIVER_SERIAL, 00268 MBED_MODULE_DRIVER_RTC, 00269 MBED_MODULE_DRIVER_I2C, 00270 MBED_MODULE_DRIVER_SPI, 00271 MBED_MODULE_DRIVER_GPIO, 00272 MBED_MODULE_DRIVER_ANALOG, 00273 MBED_MODULE_DRIVER_DIGITAL, 00274 MBED_MODULE_DRIVER_CAN, 00275 MBED_MODULE_DRIVER_ETHERNET, 00276 MBED_MODULE_DRIVER_CRC, 00277 MBED_MODULE_DRIVER_PWM, 00278 MBED_MODULE_DRIVER_QSPI, 00279 MBED_MODULE_DRIVER_USB, 00280 MBED_MODULE_TARGET_SDK, 00281 /* Add More entities here as required */ 00282 00283 MBED_MODULE_UNKNOWN = 255, 00284 MBED_MODULE_MAX = MBED_MODULE_UNKNOWN 00285 } mbed_module_type_t; 00286 00287 //Use MBED_SUCCESS(=0) or any postive number for successful returns 00288 #define MBED_SUCCESS 0 00289 00290 #define MBED_POSIX_ERROR_BASE 0 00291 #define MBED_SYSTEM_ERROR_BASE 256 00292 #define MBED_CUSTOM_ERROR_BASE 4096 00293 00294 //Error Code definitions 00295 /** mbed_error_code_t definition 00296 * 00297 * mbed_error_code_t enumeration defines the Error codes and Error status values for MBED_MODULE_UNKNOWN.\n 00298 * It defines all of Posix Error Codes/Statuses and Mbed System Error Codes/Statuses.\n\n 00299 * 00300 * @note 00301 * Posix Error codes are defined using the macro MBED_DEFINE_POSIX_ERROR\n 00302 * For example MBED_DEFINE_POSIX_ERROR( EPERM, EPERM ). This effectively defines the following values:\n 00303 * ERROR_CODE_EPERM = EPERM\n 00304 * ERROR_EPERM = -EPERM\n 00305 * 00306 * Posix Error codes are defined using the macro MBED_DEFINE_POSIX_ERROR\n 00307 * For example MBED_DEFINE_POSIX_ERROR( EPERM, EPERM ). This macro defines the following values:\n 00308 * ERROR_CODE_EPERM = MBED_POSIX_ERROR_BASE+EPERM\n 00309 * ERROR_EPERM = -(MBED_POSIX_ERROR_BASE+EPERM)\n 00310 * Its effectively equivalent to:\n 00311 * ERROR_CODE_EPERM = 1\n 00312 * ERROR_EPERM = -1\n 00313 * All Posix error codes currently supported by MbedOS(defined in mbed_retarget.h) are defined using the MBED_DEFINE_POSIX_ERROR macro.\n\n 00314 * Below are the Posic error codes and the description:\n 00315 * \verbatim 00316 EPERM 1 Operation not permitted 00317 ENOENT 2 No such file or directory 00318 ESRCH 3 No such process 00319 EINTR 4 Interrupted system call 00320 EIO 5 I/O error 00321 ENXIO 6 No such device or address 00322 E2BIG 7 Argument list too long 00323 ENOEXEC 8 Exec format error 00324 EBADF 9 Bad file number 00325 ECHILD 10 No child processes 00326 EAGAIN 11 Try again 00327 ENOMEM 12 Out of memory 00328 EACCES 13 Permission denied 00329 EFAULT 14 Bad address 00330 ENOTBLK 15 Block device required 00331 EBUSY 16 Device or resource busy 00332 EEXIST 17 File exists 00333 EXDEV 18 Cross-device link 00334 ENODEV 19 No such device 00335 ENOTDIR 20 Not a directory 00336 EISDIR 21 Is a directory 00337 EINVAL 22 Invalid argument 00338 ENFILE 23 File table overflow 00339 EMFILE 24 Too many open files 00340 ENOTTY 25 Not a typewriter 00341 ETXTBSY 26 Text file busy 00342 EFBIG 27 File too large 00343 ENOSPC 28 No space left on device 00344 ESPIPE 29 Illegal seek 00345 EROFS 30 Read-only file system 00346 EMLINK 31 Too many links 00347 EPIPE 32 Broken pipe 00348 EDOM 33 Math argument out of domain of func 00349 ERANGE 34 Math result not representable 00350 EDEADLK 35 Resource deadlock would occur 00351 ENAMETOOLONG 36 File name too long 00352 ENOLCK 37 No record locks available 00353 ENOSYS 38 Function not implemented 00354 ENOTEMPTY 39 Directory not empty 00355 ELOOP 40 Too many symbolic links encountered 00356 EWOULDBLOCK EAGAIN Operation would block 00357 ENOMSG 42 No message of desired type 00358 EIDRM 43 Identifier removed 00359 ECHRNG 44 Channel number out of range 00360 EL2NSYNC 45 Level 2 not synchronized 00361 EL3HLT 46 Level 3 halted 00362 EL3RST 47 Level 3 reset 00363 ELNRNG 48 Link number out of range 00364 EUNATCH 49 Protocol driver not attached 00365 ENOCSI 50 No CSI structure available 00366 EL2HLT 51 Level 2 halted 00367 EBADE 52 Invalid exchange 00368 EBADR 53 Invalid request descriptor 00369 EXFULL 54 Exchange full 00370 ENOANO 55 No anode 00371 EBADRQC 56 Invalid request code 00372 EBADSLT 57 Invalid slot 00373 EDEADLOCK EDEADLK Resource deadlock would occur 00374 EBFONT 59 Bad font file format 00375 ENOSTR 60 Device not a stream 00376 ENODATA 61 No data available 00377 ETIME 62 Timer expired 00378 ENOSR 63 Out of streams resources 00379 ENONET 64 Machine is not on the network 00380 ENOPKG 65 Package not installed 00381 EREMOTE 66 Object is remote 00382 ENOLINK 67 Link has been severed 00383 EADV 68 Advertise error 00384 ESRMNT 69 Srmount error 00385 ECOMM 70 Communication error on send 00386 EPROTO 71 Protocol error 00387 EMULTIHOP 72 Multihop attempted 00388 EDOTDOT 73 RFS specific error 00389 EBADMSG 74 Not a data message 00390 EOVERFLOW 75 Value too large for defined data type 00391 ENOTUNIQ 76 Name not unique on network 00392 EBADFD 77 File descriptor in bad state 00393 EREMCHG 78 Remote address changed 00394 ELIBACC 79 Can not access a needed shared library 00395 ELIBBAD 80 Accessing a corrupted shared library 00396 ELIBSCN 81 .lib section in a.out corrupted 00397 ELIBMAX 82 Attempting to link in too many shared libraries 00398 ELIBEXEC 83 Cannot exec a shared library directly 00399 EILSEQ 84 Illegal byte sequence 00400 ERESTART 85 Interrupted system call should be restarted 00401 ESTRPIPE 86 Streams pipe error 00402 EUSERS 87 Too many users 00403 ENOTSOCK 88 Socket operation on non-socket 00404 EDESTADDRREQ 89 Destination address required 00405 EMSGSIZE 90 Message too long 00406 EPROTOTYPE 91 Protocol wrong type for socket 00407 ENOPROTOOPT 92 Protocol not available 00408 EPROTONOSUPPORT 93 Protocol not supported 00409 ESOCKTNOSUPPORT 94 Socket type not supported 00410 EOPNOTSUPP 95 Operation not supported on transport endpoint 00411 EPFNOSUPPORT 96 Protocol family not supported 00412 EAFNOSUPPORT 97 Address family not supported by protocol 00413 EADDRINUSE 98 Address already in use 00414 EADDRNOTAVAIL 99 Cannot assign requested address 00415 ENETDOWN 100 Network is down 00416 ENETUNREACH 101 Network is unreachable 00417 ENETRESET 102 Network dropped connection because of reset 00418 ECONNABORTED 103 Software caused connection abort 00419 ECONNRESET 104 Connection reset by peer 00420 ENOBUFS 105 No buffer space available 00421 EISCONN 106 Transport endpoint is already connected 00422 ENOTCONN 107 Transport endpoint is not connected 00423 ESHUTDOWN 108 Cannot send after transport endpoint shutdown 00424 ETOOMANYREFS 109 Too many references: cannot splice 00425 ETIMEDOUT 110 Connection timed out 00426 ECONNREFUSED 111 Connection refused 00427 EHOSTDOWN 112 Host is down 00428 EHOSTUNREACH 113 No route to host 00429 EALREADY 114 Operation already in progress 00430 EINPROGRESS 115 Operation now in progress 00431 ESTALE 116 Stale NFS file handle 00432 EUCLEAN 117 Structure needs cleaning 00433 ENOTNAM 118 Not a XENIX named type file 00434 ENAVAIL 119 No XENIX semaphores available 00435 EISNAM 120 Is a named type file 00436 EREMOTEIO 121 Remote I/O error 00437 EDQUOT 122 Quota exceeded 00438 ENOMEDIUM 123 No medium found 00439 EMEDIUMTYPE 124 Wrong medium type 00440 ECANCELED 125 Operation Canceled 00441 ENOKEY 126 Required key not available 00442 EKEYEXPIRED 127 Key has expired 00443 EKEYREVOKED 128 Key has been revoked 00444 EKEYREJECTED 129 Key was rejected by service 00445 EOWNERDEAD 130 Owner died 00446 ENOTRECOVERABLE 131 State not recoverable 00447 \endverbatim 00448 * 00449 * @note 00450 * MbedOS System Error codes are defined using the macro MBED_DEFINE_SYSTEM_ERROR\n 00451 * For example MBED_DEFINE_SYSTEM_ERROR( INVALID_ARGUMENT ,1 ) macro defines the following values:\n 00452 * ERROR_CODE_INVALID_ARGUMENT = MBED_SYSTEM_ERROR_BASE+1\n 00453 * ERROR_INVALID_ARGUMENT = MAKE_MBED_ERROR(ERROR_TYPE_SYSTEM, MBED_MODULE_UNKNOWN, ERROR_CODE_INVALID_ARGUMENT)\n 00454 * Its effectively equivalent to:\n 00455 * ERROR_CODE_INVALID_ARGUMENT = 1\n 00456 * ERROR_INVALID_ARGUMENT = 0x80FF0001\n (Note that MODULE field is set to MBED_MODULE_UNKNOWN) 00457 * New System Error codes should be defined using MBED_DEFINE_SYSTEM_ERROR macro and must have an unique error code value\n 00458 * passed as the second argument in the MBED_DEFINE_SYSTEM_ERROR macro.\n\n 00459 * Below are the Mbed System error codes and the description: 00460 * \verbatim 00461 UNKNOWN 256 Unknown error 00462 INVALID_ARGUMENT 257 Invalid Argument 00463 INVALID_DATA 258 Invalid data 00464 INVALID_FORMAT 259 Invalid format 00465 INVALID_INDEX 260 Invalid Index 00466 INVALID_SIZE 261 Inavlid Size 00467 INVALID_OPERATION 262 Invalid Operation 00468 NOT_FOUND 263 Not Found 00469 ACCESS_DENIED 264 Access Denied 00470 NOT_SUPPORTED 265 Not supported 00471 BUFFER_FULL 266 Buffer Full 00472 MEDIA_FULL 267 Media/Disk Full 00473 ALREADY_IN_USE 268 Already in use 00474 TIMEOUT 269 Timeout error 00475 NOT_READY 270 Not Ready 00476 FAILED_OPERATION 271 Requested Operation failed 00477 OPERATION_PROHIBITED 272 Operation prohibited 00478 OPERATION_ABORTED 273 Operation failed 00479 WRITE_PROTECTED 274 Attempt to write to write-protected resource 00480 NO_RESPONSE 275 No response 00481 SEMAPHORE_LOCK_FAILED 276 Sempahore lock failed 00482 MUTEX_LOCK_FAILED 277 Mutex lock failed 00483 SEMAPHORE_UNLOCK_FAILED 278 Sempahore unlock failed 00484 MUTEX_UNLOCK_FAILED 279 Mutex unlock failed 00485 CRC_ERROR 280 CRC error or mismatch 00486 OPEN_FAILED 281 Open failed 00487 CLOSE_FAILED 282 Close failed 00488 READ_FAILED 283 Read failed 00489 WRITE_FAILED 284 Write failed 00490 INITIALIZATION_FAILED 285 Initialization failed 00491 BOOT_FAILURE 286 Boot failure 00492 OUT_OF_MEMORY 287 Out of memory 00493 OUT_OF_RESOURCES 288 Out of resources 00494 ALLOC_FAILED 289 Alloc failed 00495 FREE_FAILED 290 Free failed 00496 OVERFLOW 291 Overflow error 00497 UNDERFLOW 292 Underflow error 00498 STACK_OVERFLOW 293 Stack overflow error 00499 ISR_QUEUE_OVERFLOW 294 ISR queue overflow 00500 TIMER_QUEUE_OVERFLOW 295 Timer Queue overflow 00501 CLIB_SPACE_UNAVAILABLE 296 Standard library error - Space unavailable 00502 CLIB_EXCEPTION 297 Standard library error - Exception 00503 CLIB_MUTEX_INIT_FAILURE 298 Standard library error - Mutex Init failure 00504 CREATE_FAILED 299 Create failed 00505 DELETE_FAILED 300 Delete failed 00506 THREAD_CREATE_FAILED 301 Thread Create failed 00507 THREAD_DELETE_FAILED 302 Thread Delete failed 00508 PROHIBITED_IN_ISR_CONTEXT 303 Operation Prohibited in ISR context 00509 PINMAP_INVALID 304 Pinmap Invalid 00510 RTOS_EVENT 305 Unknown Rtos Error 00511 RTOS_THREAD_EVENT 306 Rtos Thread Error 00512 RTOS_MUTEX_EVENT 307 Rtos Mutex Error 00513 RTOS_SEMAPHORE_EVENT 308 Rtos Semaphore Error 00514 RTOS_MEMORY_POOL_EVENT 309 Rtos Memory Pool Error 00515 RTOS_TIMER_EVENT 310 Rtos Timer Error 00516 RTOS_EVENT_FLAGS_EVENT 311 Rtos Event flags Error 00517 RTOS_MESSAGE_QUEUE_EVENT 312 Rtos Message queue Error 00518 DEVICE_BUSY 313 Device Busy 00519 CONFIG_UNSUPPORTED 314 Configuration not supported 00520 CONFIG_MISMATCH 315 Configuration mismatch 00521 ALREADY_INITIALIZED 316 Already initialzied 00522 HARDFAULT_EXCEPTION 317 HardFault exception 00523 MEMMANAGE_EXCEPTION 318 MemManage exception 00524 BUSFAULT_EXCEPTION 319 BusFault exception 00525 USAGEFAULT_EXCEPTION 320 UsageFault exception 00526 \endverbatim 00527 * 00528 * @note 00529 * Custom Error codes can be defined using the macro DEFINE_CUSTOM_ERROR\n 00530 * This is mainly meant to capture non-generic error codes specific to a device. 00531 * For example DEFINE_CUSTOM_ERROR( MY_CUSTOM_ERROR ,1 ) macro defines the following values:\n 00532 * ERROR_CODE_MY_CUSTOM_ERROR = MBED_CUSTOM_ERROR_BASE+1\n 00533 * ERROR_MY_CUSTOM_ERROR = MAKE_MBED_ERROR(ERROR_TYPE_CUSTOM, MBED_MODULE_UNKNOWN, ERROR_CODE_MY_CUSTOM_ERROR)\n 00534 * Its effectively equivalent to:\n 00535 * ERROR_CODE_MY_CUSTOM_ERROR = 4097\n 00536 * ERROR_MY_CUSTOM_ERROR = 0xA0FF1001\n (Note that MODULE field is set to MBED_MODULE_UNKNOWN) \n\n 00537 * 00538 * @note 00539 * **Using error codes:** \n 00540 * Posix error codes may be used in modules/functions currently using Posix error codes and switching them to Mbed-OS error codes 00541 * may cause interoperability issues. For example, some of the filesystem, network stack implementations may need to use 00542 * Posix error codes in order to keep them compatible with other modules interfacing with them, and may continue to use Posix error codes. 00543 * 00544 * In all other cases, like for any native development of Mbed-OS modules Mbed-OS error codes should be used. 00545 * This makes it easy to use Mbed-OS error reporting/logging infrastructure and makes debugging error scenarios 00546 * much more efficient. 00547 * 00548 * @note 00549 * **Searching for error codes in mbed-os source tree:** \n 00550 * 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 00551 * 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 00552 * Use that error name(\b INVALID_FORMAT) to search the source tree for code locations setting that specific error code. \n 00553 * 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. 00554 * See mbed_module_type_t enum above for module mapping. \n 00555 * 00556 * \verbatim 00557 ++ MbedOS Error Info ++ 00558 Error Status: 0x80040103 00559 Error Code: 259 00560 Error Module: 04 00561 Error Message: HAL Module error 00562 Error Location: 0x000067C7 00563 Error Value: 0x00005566 00564 Current Thread: Id: 0x200024A8 EntryFn: 0x0000FB0D StackSize: 0x00001000 StackMem: 0x200014A8 SP: 0x2002FFD8 00565 -- MbedOS Error Info -- 00566 \endverbatim 00567 */ 00568 00569 typedef enum _mbed_error_code 00570 { 00571 //Below are POSIX ERROR CODE definitions, which starts at MBED_POSIX_ERROR_BASE(=0) 00572 //POSIX ERROR CODE definitions starts at offset 0(MBED_POSIX_ERROR_BASE) to align them with actual Posix Error Code 00573 //defintions in mbed_retarget.h 00574 // Error Name Error Code 00575 MBED_DEFINE_POSIX_ERROR( EPERM ,EPERM ), /* 1 Operation not permitted */ 00576 MBED_DEFINE_POSIX_ERROR( ENOENT ,ENOENT ), /* 2 No such file or directory */ 00577 MBED_DEFINE_POSIX_ERROR( ESRCH ,ESRCH ), /* 3 No such process */ 00578 MBED_DEFINE_POSIX_ERROR( EINTR ,EINTR ), /* 4 Interrupted system call */ 00579 MBED_DEFINE_POSIX_ERROR( EIO ,EIO ), /* 5 I/O error */ 00580 MBED_DEFINE_POSIX_ERROR( ENXIO ,ENXIO ), /* 6 No such device or address */ 00581 MBED_DEFINE_POSIX_ERROR( E2BIG ,E2BIG ), /* 7 Argument list too long */ 00582 MBED_DEFINE_POSIX_ERROR( ENOEXEC ,ENOEXEC ), /* 8 Exec format error */ 00583 MBED_DEFINE_POSIX_ERROR( EBADF ,EBADF ), /* 9 Bad file number */ 00584 MBED_DEFINE_POSIX_ERROR( ECHILD ,ECHILD ), /* 10 No child processes */ 00585 MBED_DEFINE_POSIX_ERROR( EAGAIN ,EAGAIN ), /* 11 Try again */ 00586 MBED_DEFINE_POSIX_ERROR( ENOMEM ,ENOMEM ), /* 12 Out of memory */ 00587 MBED_DEFINE_POSIX_ERROR( EACCES ,EACCES ), /* 13 Permission denied */ 00588 MBED_DEFINE_POSIX_ERROR( EFAULT ,EFAULT ), /* 14 Bad address */ 00589 MBED_DEFINE_POSIX_ERROR( ENOTBLK ,ENOTBLK ), /* 15 Block device required */ 00590 MBED_DEFINE_POSIX_ERROR( EBUSY ,EBUSY ), /* 16 Device or resource busy */ 00591 MBED_DEFINE_POSIX_ERROR( EEXIST ,EEXIST ), /* 17 File exists */ 00592 MBED_DEFINE_POSIX_ERROR( EXDEV ,EXDEV ), /* 18 Cross-device link */ 00593 MBED_DEFINE_POSIX_ERROR( ENODEV ,ENODEV ), /* 19 No such device */ 00594 MBED_DEFINE_POSIX_ERROR( ENOTDIR ,ENOTDIR ), /* 20 Not a directory */ 00595 MBED_DEFINE_POSIX_ERROR( EISDIR ,EISDIR ), /* 21 Is a directory */ 00596 MBED_DEFINE_POSIX_ERROR( EINVAL ,EINVAL ), /* 22 Invalid argument */ 00597 MBED_DEFINE_POSIX_ERROR( ENFILE ,ENFILE ), /* 23 File table overflow */ 00598 MBED_DEFINE_POSIX_ERROR( EMFILE ,EMFILE ), /* 24 Too many open files */ 00599 MBED_DEFINE_POSIX_ERROR( ENOTTY ,ENOTTY ), /* 25 Not a typewriter */ 00600 MBED_DEFINE_POSIX_ERROR( ETXTBSY ,ETXTBSY ), /* 26 Text file busy */ 00601 MBED_DEFINE_POSIX_ERROR( EFBIG ,EFBIG ), /* 27 File too large */ 00602 MBED_DEFINE_POSIX_ERROR( ENOSPC ,ENOSPC ), /* 28 No space left on device */ 00603 MBED_DEFINE_POSIX_ERROR( ESPIPE ,ESPIPE ), /* 29 Illegal seek */ 00604 MBED_DEFINE_POSIX_ERROR( EROFS ,EROFS ), /* 30 Read-only file system */ 00605 MBED_DEFINE_POSIX_ERROR( EMLINK ,EMLINK ), /* 31 Too many links */ 00606 MBED_DEFINE_POSIX_ERROR( EPIPE ,EPIPE ), /* 32 Broken pipe */ 00607 MBED_DEFINE_POSIX_ERROR( EDOM ,EDOM ), /* 33 Math argument out of domain of func */ 00608 MBED_DEFINE_POSIX_ERROR( ERANGE ,ERANGE ), /* 34 Math result not representable */ 00609 MBED_DEFINE_POSIX_ERROR( EDEADLK ,EDEADLK ), /* 35 Resource deadlock would occur */ 00610 MBED_DEFINE_POSIX_ERROR( ENAMETOOLONG ,ENAMETOOLONG ), /* 36 File name too long */ 00611 MBED_DEFINE_POSIX_ERROR( ENOLCK ,ENOLCK ), /* 37 No record locks available */ 00612 MBED_DEFINE_POSIX_ERROR( ENOSYS ,ENOSYS ), /* 38 Function not implemented */ 00613 MBED_DEFINE_POSIX_ERROR( ENOTEMPTY ,ENOTEMPTY ), /* 39 Directory not empty */ 00614 MBED_DEFINE_POSIX_ERROR( ELOOP ,ELOOP ), /* 40 Too many symbolic links encountered */ 00615 MBED_DEFINE_POSIX_ERROR( EWOULDBLOCK ,EAGAIN ), /* EAGAIN Operation would block */ 00616 MBED_DEFINE_POSIX_ERROR( ENOMSG ,ENOMSG ), /* 42 No message of desired type */ 00617 MBED_DEFINE_POSIX_ERROR( EIDRM ,EIDRM ), /* 43 Identifier removed */ 00618 MBED_DEFINE_POSIX_ERROR( ECHRNG ,ECHRNG ), /* 44 Channel number out of range */ 00619 MBED_DEFINE_POSIX_ERROR( EL2NSYNC ,EL2NSYNC ), /* 45 Level 2 not synchronized */ 00620 MBED_DEFINE_POSIX_ERROR( EL3HLT ,EL3HLT ), /* 46 Level 3 halted */ 00621 MBED_DEFINE_POSIX_ERROR( EL3RST ,EL3RST ), /* 47 Level 3 reset */ 00622 MBED_DEFINE_POSIX_ERROR( ELNRNG ,ELNRNG ), /* 48 Link number out of range */ 00623 MBED_DEFINE_POSIX_ERROR( EUNATCH ,EUNATCH ), /* 49 Protocol driver not attached */ 00624 MBED_DEFINE_POSIX_ERROR( ENOCSI ,ENOCSI ), /* 50 No CSI structure available */ 00625 MBED_DEFINE_POSIX_ERROR( EL2HLT ,EL2HLT ), /* 51 Level 2 halted */ 00626 MBED_DEFINE_POSIX_ERROR( EBADE ,EBADE ), /* 52 Invalid exchange */ 00627 MBED_DEFINE_POSIX_ERROR( EBADR ,EBADR ), /* 53 Invalid request descriptor */ 00628 MBED_DEFINE_POSIX_ERROR( EXFULL ,EXFULL ), /* 54 Exchange full */ 00629 MBED_DEFINE_POSIX_ERROR( ENOANO ,ENOANO ), /* 55 No anode */ 00630 MBED_DEFINE_POSIX_ERROR( EBADRQC ,EBADRQC ), /* 56 Invalid request code */ 00631 MBED_DEFINE_POSIX_ERROR( EBADSLT ,EBADSLT ), /* 57 Invalid slot */ 00632 MBED_DEFINE_POSIX_ERROR( EDEADLOCK ,EDEADLK ), /* EDEADLK Resource deadlock would occur */ 00633 MBED_DEFINE_POSIX_ERROR( EBFONT ,EBFONT ), /* 59 Bad font file format */ 00634 MBED_DEFINE_POSIX_ERROR( ENOSTR ,ENOSTR ), /* 60 Device not a stream */ 00635 MBED_DEFINE_POSIX_ERROR( ENODATA ,ENODATA ), /* 61 No data available */ 00636 MBED_DEFINE_POSIX_ERROR( ETIME ,ETIME ), /* 62 Timer expired */ 00637 MBED_DEFINE_POSIX_ERROR( ENOSR ,ENOSR ), /* 63 Out of streams resources */ 00638 MBED_DEFINE_POSIX_ERROR( ENONET ,ENONET ), /* 64 Machine is not on the network */ 00639 MBED_DEFINE_POSIX_ERROR( ENOPKG ,ENOPKG ), /* 65 Package not installed */ 00640 MBED_DEFINE_POSIX_ERROR( EREMOTE ,EREMOTE ), /* 66 Object is remote */ 00641 MBED_DEFINE_POSIX_ERROR( ENOLINK ,ENOLINK ), /* 67 Link has been severed */ 00642 MBED_DEFINE_POSIX_ERROR( EADV ,EADV ), /* 68 Advertise error */ 00643 MBED_DEFINE_POSIX_ERROR( ESRMNT ,ESRMNT ), /* 69 Srmount error */ 00644 MBED_DEFINE_POSIX_ERROR( ECOMM ,ECOMM ), /* 70 Communication error on send */ 00645 MBED_DEFINE_POSIX_ERROR( EPROTO ,EPROTO ), /* 71 Protocol error */ 00646 MBED_DEFINE_POSIX_ERROR( EMULTIHOP ,EMULTIHOP ), /* 72 Multihop attempted */ 00647 MBED_DEFINE_POSIX_ERROR( EDOTDOT ,EDOTDOT ), /* 73 RFS specific error */ 00648 MBED_DEFINE_POSIX_ERROR( EBADMSG ,EBADMSG ), /* 74 Not a data message */ 00649 MBED_DEFINE_POSIX_ERROR( EOVERFLOW ,EOVERFLOW ), /* 75 Value too large for defined data type */ 00650 MBED_DEFINE_POSIX_ERROR( ENOTUNIQ ,ENOTUNIQ ), /* 76 Name not unique on network */ 00651 MBED_DEFINE_POSIX_ERROR( EBADFD ,EBADFD ), /* 77 File descriptor in bad state */ 00652 MBED_DEFINE_POSIX_ERROR( EREMCHG ,EREMCHG ), /* 78 Remote address changed */ 00653 MBED_DEFINE_POSIX_ERROR( ELIBACC ,ELIBACC ), /* 79 Can not access a needed shared library */ 00654 MBED_DEFINE_POSIX_ERROR( ELIBBAD ,ELIBBAD ), /* 80 Accessing a corrupted shared library */ 00655 MBED_DEFINE_POSIX_ERROR( ELIBSCN ,ELIBSCN ), /* 81 .lib section in a.out corrupted */ 00656 MBED_DEFINE_POSIX_ERROR( ELIBMAX ,ELIBMAX ), /* 82 Attempting to link in too many shared libraries */ 00657 MBED_DEFINE_POSIX_ERROR( ELIBEXEC ,ELIBEXEC ), /* 83 Cannot exec a shared library directly */ 00658 MBED_DEFINE_POSIX_ERROR( EILSEQ ,EILSEQ ), /* 84 Illegal byte sequence */ 00659 MBED_DEFINE_POSIX_ERROR( ERESTART ,ERESTART ), /* 85 Interrupted system call should be restarted */ 00660 MBED_DEFINE_POSIX_ERROR( ESTRPIPE ,ESTRPIPE ), /* 86 Streams pipe error */ 00661 MBED_DEFINE_POSIX_ERROR( EUSERS ,EUSERS ), /* 87 Too many users */ 00662 MBED_DEFINE_POSIX_ERROR( ENOTSOCK ,ENOTSOCK ), /* 88 Socket operation on non-socket */ 00663 MBED_DEFINE_POSIX_ERROR( EDESTADDRREQ ,EDESTADDRREQ ), /* 89 Destination address required */ 00664 MBED_DEFINE_POSIX_ERROR( EMSGSIZE ,EMSGSIZE ), /* 90 Message too long */ 00665 MBED_DEFINE_POSIX_ERROR( EPROTOTYPE ,EPROTOTYPE ), /* 91 Protocol wrong type for socket */ 00666 MBED_DEFINE_POSIX_ERROR( ENOPROTOOPT ,ENOPROTOOPT ), /* 92 Protocol not available */ 00667 MBED_DEFINE_POSIX_ERROR( EPROTONOSUPPORT ,EPROTONOSUPPORT ), /* 93 Protocol not supported */ 00668 MBED_DEFINE_POSIX_ERROR( ESOCKTNOSUPPORT ,ESOCKTNOSUPPORT ), /* 94 Socket type not supported */ 00669 MBED_DEFINE_POSIX_ERROR( EOPNOTSUPP ,EOPNOTSUPP ), /* 95 Operation not supported on transport endpoint */ 00670 MBED_DEFINE_POSIX_ERROR( EPFNOSUPPORT ,EPFNOSUPPORT ), /* 96 Protocol family not supported */ 00671 MBED_DEFINE_POSIX_ERROR( EAFNOSUPPORT ,EAFNOSUPPORT ), /* 97 Address family not supported by protocol */ 00672 MBED_DEFINE_POSIX_ERROR( EADDRINUSE ,EADDRINUSE ), /* 98 Address already in use */ 00673 MBED_DEFINE_POSIX_ERROR( EADDRNOTAVAIL ,EADDRNOTAVAIL ), /* 99 Cannot assign requested address */ 00674 MBED_DEFINE_POSIX_ERROR( ENETDOWN ,ENETDOWN ), /* 100 Network is down */ 00675 MBED_DEFINE_POSIX_ERROR( ENETUNREACH ,ENETUNREACH ), /* 101 Network is unreachable */ 00676 MBED_DEFINE_POSIX_ERROR( ENETRESET ,ENETRESET ), /* 102 Network dropped connection because of reset */ 00677 MBED_DEFINE_POSIX_ERROR( ECONNABORTED ,ECONNABORTED ), /* 103 Software caused connection abort */ 00678 MBED_DEFINE_POSIX_ERROR( ECONNRESET ,ECONNRESET ), /* 104 Connection reset by peer */ 00679 MBED_DEFINE_POSIX_ERROR( ENOBUFS ,ENOBUFS ), /* 105 No buffer space available */ 00680 MBED_DEFINE_POSIX_ERROR( EISCONN ,EISCONN ), /* 106 Transport endpoint is already connected */ 00681 MBED_DEFINE_POSIX_ERROR( ENOTCONN ,ENOTCONN ), /* 107 Transport endpoint is not connected */ 00682 MBED_DEFINE_POSIX_ERROR( ESHUTDOWN ,ESHUTDOWN ), /* 108 Cannot send after transport endpoint shutdown */ 00683 MBED_DEFINE_POSIX_ERROR( ETOOMANYREFS ,ETOOMANYREFS ), /* 109 Too many references: cannot splice */ 00684 MBED_DEFINE_POSIX_ERROR( ETIMEDOUT ,ETIMEDOUT ), /* 110 Connection timed out */ 00685 MBED_DEFINE_POSIX_ERROR( ECONNREFUSED ,ECONNREFUSED ), /* 111 Connection refused */ 00686 MBED_DEFINE_POSIX_ERROR( EHOSTDOWN ,EHOSTDOWN ), /* 112 Host is down */ 00687 MBED_DEFINE_POSIX_ERROR( EHOSTUNREACH ,EHOSTUNREACH ), /* 113 No route to host */ 00688 MBED_DEFINE_POSIX_ERROR( EALREADY ,EALREADY ), /* 114 Operation already in progress */ 00689 MBED_DEFINE_POSIX_ERROR( EINPROGRESS ,EINPROGRESS ), /* 115 Operation now in progress */ 00690 MBED_DEFINE_POSIX_ERROR( ESTALE ,ESTALE ), /* 116 Stale NFS file handle */ 00691 MBED_DEFINE_POSIX_ERROR( EUCLEAN ,EUCLEAN ), /* 117 Structure needs cleaning */ 00692 MBED_DEFINE_POSIX_ERROR( ENOTNAM ,ENOTNAM ), /* 118 Not a XENIX named type file */ 00693 MBED_DEFINE_POSIX_ERROR( ENAVAIL ,ENAVAIL ), /* 119 No XENIX semaphores available */ 00694 MBED_DEFINE_POSIX_ERROR( EISNAM ,EISNAM ), /* 120 Is a named type file */ 00695 MBED_DEFINE_POSIX_ERROR( EREMOTEIO ,EREMOTEIO ), /* 121 Remote I/O error */ 00696 MBED_DEFINE_POSIX_ERROR( EDQUOT ,EDQUOT ), /* 122 Quota exceeded */ 00697 MBED_DEFINE_POSIX_ERROR( ENOMEDIUM ,ENOMEDIUM ), /* 123 No medium found */ 00698 MBED_DEFINE_POSIX_ERROR( EMEDIUMTYPE ,EMEDIUMTYPE ), /* 124 Wrong medium type */ 00699 MBED_DEFINE_POSIX_ERROR( ECANCELED ,ECANCELED ), /* 125 Operation Canceled */ 00700 MBED_DEFINE_POSIX_ERROR( ENOKEY ,ENOKEY ), /* 126 Required key not available */ 00701 MBED_DEFINE_POSIX_ERROR( EKEYEXPIRED ,EKEYEXPIRED ), /* 127 Key has expired */ 00702 MBED_DEFINE_POSIX_ERROR( EKEYREVOKED ,EKEYREVOKED ), /* 128 Key has been revoked */ 00703 MBED_DEFINE_POSIX_ERROR( EKEYREJECTED ,EKEYREJECTED ), /* 129 Key was rejected by service */ 00704 MBED_DEFINE_POSIX_ERROR( EOWNERDEAD ,EOWNERDEAD ), /* 130 Owner died */ 00705 MBED_DEFINE_POSIX_ERROR( ENOTRECOVERABLE ,ENOTRECOVERABLE ), /* 131 State not recoverable */ 00706 00707 //Below are MBED SYSTEM ERROR CODE definitions 00708 //MBED SYSTEM ERROR CODE definitions starts at offset MBED_SYSTEM_ERROR_BASE, see above. 00709 // Error Name Error Offset Error Code 00710 MBED_DEFINE_SYSTEM_ERROR( UNKNOWN ,0 ), /* 256 Unknown error */ 00711 MBED_DEFINE_SYSTEM_ERROR( INVALID_ARGUMENT ,1 ), /* 257 Invalid Argument */ 00712 MBED_DEFINE_SYSTEM_ERROR( INVALID_DATA_DETECTED ,2 ), /* 258 Invalid data detected */ 00713 MBED_DEFINE_SYSTEM_ERROR( INVALID_FORMAT ,3 ), /* 259 Invalid format */ 00714 MBED_DEFINE_SYSTEM_ERROR( INVALID_INDEX ,4 ), /* 260 Invalid Index */ 00715 MBED_DEFINE_SYSTEM_ERROR( INVALID_SIZE ,5 ), /* 261 Inavlid Size */ 00716 MBED_DEFINE_SYSTEM_ERROR( INVALID_OPERATION ,6 ), /* 262 Invalid Operation */ 00717 MBED_DEFINE_SYSTEM_ERROR( ITEM_NOT_FOUND ,7 ), /* 263 Item Not Found */ 00718 MBED_DEFINE_SYSTEM_ERROR( ACCESS_DENIED ,8 ), /* 264 Access Denied */ 00719 MBED_DEFINE_SYSTEM_ERROR( UNSUPPORTED ,9 ), /* 265 Unsupported */ 00720 MBED_DEFINE_SYSTEM_ERROR( BUFFER_FULL ,10 ), /* 266 Buffer Full */ 00721 MBED_DEFINE_SYSTEM_ERROR( MEDIA_FULL ,11 ), /* 267 Media/Disk Full */ 00722 MBED_DEFINE_SYSTEM_ERROR( ALREADY_IN_USE ,12 ), /* 268 Already in use */ 00723 MBED_DEFINE_SYSTEM_ERROR( TIME_OUT ,13 ), /* 269 Timeout error */ 00724 MBED_DEFINE_SYSTEM_ERROR( NOT_READY ,14 ), /* 270 Not Ready */ 00725 MBED_DEFINE_SYSTEM_ERROR( FAILED_OPERATION ,15 ), /* 271 Requested Operation failed */ 00726 MBED_DEFINE_SYSTEM_ERROR( OPERATION_PROHIBITED ,16 ), /* 272 Operation prohibited */ 00727 MBED_DEFINE_SYSTEM_ERROR( OPERATION_ABORTED ,17 ), /* 273 Operation failed */ 00728 MBED_DEFINE_SYSTEM_ERROR( WRITE_PROTECTED ,18 ), /* 274 Attempt to write to write-protected resource */ 00729 MBED_DEFINE_SYSTEM_ERROR( NO_RESPONSE ,19 ), /* 275 No response */ 00730 MBED_DEFINE_SYSTEM_ERROR( SEMAPHORE_LOCK_FAILED ,20 ), /* 276 Sempahore lock failed */ 00731 MBED_DEFINE_SYSTEM_ERROR( MUTEX_LOCK_FAILED ,21 ), /* 277 Mutex lock failed */ 00732 MBED_DEFINE_SYSTEM_ERROR( SEMAPHORE_UNLOCK_FAILED ,22 ), /* 278 Sempahore unlock failed */ 00733 MBED_DEFINE_SYSTEM_ERROR( MUTEX_UNLOCK_FAILED ,23 ), /* 279 Mutex unlock failed */ 00734 MBED_DEFINE_SYSTEM_ERROR( CRC_ERROR ,24 ), /* 280 CRC error or mismatch */ 00735 MBED_DEFINE_SYSTEM_ERROR( OPEN_FAILED ,25 ), /* 281 Open failed */ 00736 MBED_DEFINE_SYSTEM_ERROR( CLOSE_FAILED ,26 ), /* 282 Close failed */ 00737 MBED_DEFINE_SYSTEM_ERROR( READ_FAILED ,27 ), /* 283 Read failed */ 00738 MBED_DEFINE_SYSTEM_ERROR( WRITE_FAILED ,28 ), /* 284 Write failed */ 00739 MBED_DEFINE_SYSTEM_ERROR( INITIALIZATION_FAILED ,29 ), /* 285 Initialization failed */ 00740 MBED_DEFINE_SYSTEM_ERROR( BOOT_FAILURE ,30 ), /* 286 Boot failure */ 00741 MBED_DEFINE_SYSTEM_ERROR( OUT_OF_MEMORY ,31 ), /* 287 Out of memory */ 00742 MBED_DEFINE_SYSTEM_ERROR( OUT_OF_RESOURCES ,32 ), /* 288 Out of resources */ 00743 MBED_DEFINE_SYSTEM_ERROR( ALLOC_FAILED ,33 ), /* 289 Alloc failed */ 00744 MBED_DEFINE_SYSTEM_ERROR( FREE_FAILED ,34 ), /* 290 Free failed */ 00745 MBED_DEFINE_SYSTEM_ERROR( OVERFLOW ,35 ), /* 291 Overflow error */ 00746 MBED_DEFINE_SYSTEM_ERROR( UNDERFLOW ,36 ), /* 292 Underflow error */ 00747 MBED_DEFINE_SYSTEM_ERROR( STACK_OVERFLOW ,37 ), /* 293 Stack overflow error */ 00748 MBED_DEFINE_SYSTEM_ERROR( ISR_QUEUE_OVERFLOW ,38 ), /* 294 ISR queue overflow */ 00749 MBED_DEFINE_SYSTEM_ERROR( TIMER_QUEUE_OVERFLOW ,39 ), /* 295 Timer Queue overflow */ 00750 MBED_DEFINE_SYSTEM_ERROR( CLIB_SPACE_UNAVAILABLE ,40 ), /* 296 Standard library error - Space unavailable */ 00751 MBED_DEFINE_SYSTEM_ERROR( CLIB_EXCEPTION ,41 ), /* 297 Standard library error - Exception */ 00752 MBED_DEFINE_SYSTEM_ERROR( CLIB_MUTEX_INIT_FAILURE ,42 ), /* 298 Standard library error - Mutex Init failure */ 00753 MBED_DEFINE_SYSTEM_ERROR( CREATE_FAILED ,43 ), /* 299 Create failed */ 00754 MBED_DEFINE_SYSTEM_ERROR( DELETE_FAILED ,44 ), /* 300 Delete failed */ 00755 MBED_DEFINE_SYSTEM_ERROR( THREAD_CREATE_FAILED ,45 ), /* 301 Thread Create failed */ 00756 MBED_DEFINE_SYSTEM_ERROR( THREAD_DELETE_FAILED ,46 ), /* 302 Thread Delete failed */ 00757 MBED_DEFINE_SYSTEM_ERROR( PROHIBITED_IN_ISR_CONTEXT ,47 ), /* 303 Operation Prohibited in ISR context */ 00758 MBED_DEFINE_SYSTEM_ERROR( PINMAP_INVALID ,48 ), /* 304 Pinmap Invalid */ 00759 MBED_DEFINE_SYSTEM_ERROR( RTOS_EVENT ,49 ), /* 305 Unknown Rtos Error */ 00760 MBED_DEFINE_SYSTEM_ERROR( RTOS_THREAD_EVENT ,50 ), /* 306 Rtos Thread Error */ 00761 MBED_DEFINE_SYSTEM_ERROR( RTOS_MUTEX_EVENT ,51 ), /* 307 Rtos Mutex Error */ 00762 MBED_DEFINE_SYSTEM_ERROR( RTOS_SEMAPHORE_EVENT ,52 ), /* 308 Rtos Semaphore Error */ 00763 MBED_DEFINE_SYSTEM_ERROR( RTOS_MEMORY_POOL_EVENT ,53 ), /* 309 Rtos Memory Pool Error */ 00764 MBED_DEFINE_SYSTEM_ERROR( RTOS_TIMER_EVENT ,54 ), /* 310 Rtos Timer Error */ 00765 MBED_DEFINE_SYSTEM_ERROR( RTOS_EVENT_FLAGS_EVENT ,55 ), /* 311 Rtos Event flags Error */ 00766 MBED_DEFINE_SYSTEM_ERROR( RTOS_MESSAGE_QUEUE_EVENT ,56 ), /* 312 Rtos Message queue Error */ 00767 MBED_DEFINE_SYSTEM_ERROR( DEVICE_BUSY ,57 ), /* 313 Device Busy */ 00768 MBED_DEFINE_SYSTEM_ERROR( CONFIG_UNSUPPORTED ,58 ), /* 314 Configuration not supported */ 00769 MBED_DEFINE_SYSTEM_ERROR( CONFIG_MISMATCH ,59 ), /* 315 Configuration mismatch */ 00770 MBED_DEFINE_SYSTEM_ERROR( ALREADY_INITIALIZED ,60 ), /* 316 Already initialzied */ 00771 MBED_DEFINE_SYSTEM_ERROR( HARDFAULT_EXCEPTION ,61 ), /* 317 HardFault exception */ 00772 MBED_DEFINE_SYSTEM_ERROR( MEMMANAGE_EXCEPTION ,62 ), /* 318 MemManage exception */ 00773 MBED_DEFINE_SYSTEM_ERROR( BUSFAULT_EXCEPTION ,63 ), /* 319 BusFault exception */ 00774 MBED_DEFINE_SYSTEM_ERROR( USAGEFAULT_EXCEPTION ,64 ), /* 320 UsageFault exception*/ 00775 00776 //Everytime you add a new system error code, you must update 00777 //Error documentation under Handbook to capture the info on 00778 //the new error status/codes 00779 00780 //MBED CUSTOM ERROR CODE definitions starts at offset MBED_CUSTOM_ERROR_BASE, see above. 00781 /* Add More/Custom Error Codes here, See example below */ 00782 //DEFINE_CUSTOM_ERROR( MY_CUSTOM_ERROR , 1 ), 00783 00784 } mbed_error_code_t; 00785 00786 /** mbed_error_ctx struct 00787 * 00788 * This struct captures the context information at the time of error.\n 00789 * It primarily contains information about the thread where the error originated,\n 00790 * filename/line number of the source file where the error occurred, a context specific error value(error_value)\n 00791 * and the address where the error originated.\n 00792 * 00793 * @note 00794 * Below are the members of mbed_error_ctx struct\n 00795 * error_status mbed_error_status_t value for this error\n 00796 * error_function_address Address where the error occurred\n 00797 * thread_id ID of the thread which generated the error\n 00798 * thread_entry_address Entry function of the thread which generated the error\n 00799 * thread_stack_size Stack Size of the thread which generated the error\n 00800 * thread_stack_mem Stack Top of the thread which generated the error\n 00801 * thread_current_sp Current Stack Pointer of the thread which generated the error\n 00802 * error_value A context/error specific value associated with this error\n 00803 * error_filename Filename where the error originated\n 00804 * error_line_number Line number in error_filename where the error originated\n 00805 */ 00806 typedef struct _mbed_error_ctx { 00807 mbed_error_status_t error_status; 00808 uint32_t error_address; 00809 uint32_t error_value; 00810 uint32_t thread_id; 00811 uint32_t thread_entry_address; 00812 uint32_t thread_stack_size; 00813 uint32_t thread_stack_mem; 00814 uint32_t thread_current_sp; 00815 #ifdef MBED_CONF_ERROR_FILENAME_CAPTURE_ENABLED 00816 char error_filename[MBED_CONF_MAX_ERROR_FILENAME_LEN]; 00817 uint32_t error_line_number; 00818 #endif 00819 } mbed_error_ctx; 00820 00821 /** To generate a fatal compile-time error, you can use the pre-processor #error directive. 00822 * 00823 * @param format C string that contains data stream to be printed. 00824 * Code snippets below show valid format. 00825 * 00826 * @code 00827 * #error "That shouldn't have happened!" 00828 * @endcode 00829 * 00830 * If the compiler evaluates this line, it will report the error and stop the compile. 00831 * 00832 * For example, you could use this to check some user-defined compile-time variables: 00833 * 00834 * @code 00835 * #define NUM_PORTS 7 00836 * #if (NUM_PORTS > 4) 00837 * #error "NUM_PORTS must be less than 4" 00838 * #endif 00839 * @endcode 00840 * 00841 * Reporting Run-Time Errors: 00842 * To generate a fatal run-time error, you can use the mbed error() function. 00843 * 00844 * @code 00845 * error("That shouldn't have happened!"); 00846 * @endcode 00847 * 00848 * If the mbed running the program executes this function, it will print the 00849 * message via the USB serial port, and then die with the blue lights of death! 00850 * 00851 * The message can use printf-style formatting, so you can report variables in the 00852 * message too. For example, you could use this to check a run-time condition: 00853 * 00854 * @code 00855 * if(x >= 5) { 00856 * error("expected x to be less than 5, but got %d", x); 00857 * } 00858 * @endcode 00859 * 00860 * 00861 */ 00862 00863 void error(const char* format, ...); 00864 00865 /** 00866 * Call this Macro to generate a mbed_error_status_t value for a System error 00867 * @param module Module generating the error code. If its unknown, pass MBED_MODULE_UNKNOWN. See mbed_module_type_t for module types. 00868 * @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. 00869 * 00870 * @code 00871 * 00872 * mbed_error_status_t driver_error = MBED_MAKE_SYSTEM_ERROR( MODULE_DRIVER_USB, MBED_ERROR_CODE_INITIALIZATION_FAILED ) 00873 * 00874 * @endcode 00875 * @note This macro generate mbed_error_status_t-es with error type set to MBED_ERROR_TYPE_SYSTEM 00876 * 00877 */ 00878 #define MBED_MAKE_SYSTEM_ERROR(module, error_code) MAKE_MBED_ERROR(MBED_ERROR_TYPE_SYSTEM, module, error_code) 00879 00880 /** 00881 * Call this Macro to generate a mbed_error_status_t value for a Custom error 00882 * @param module Module generating the error code. If its unknown, pass MBED_MODULE_UNKNOWN. See mbed_module_type_t for module types. 00883 * @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. 00884 * 00885 * @code 00886 * 00887 * mbed_error_status_t custom_error = MBED_MAKE_CUSTOM_ERROR( MBED_MODULE_APPLICATION, 0xDEAD//16-bit custom error code ) 00888 * 00889 * @endcode 00890 * @note This macro generate mbed_error_status_t-es with error type set to MBED_ERROR_TYPE_CUSTOM 00891 * 00892 */ 00893 #define MBED_MAKE_CUSTOM_ERROR(module, error_code) MAKE_MBED_ERROR(MBED_ERROR_TYPE_CUSTOM, module, error_code) 00894 00895 /** 00896 * Call this Macro to generate a mbed_error_status_t value for a System error 00897 * @param module Module generating the error code. If its unknown, pass MBED_MODULE_UNKNOWN. See mbed_module_type_t for module types. 00898 * @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. 00899 * 00900 * @code 00901 * 00902 * mbed_error_status_t new_error = MBED_MAKE_ERROR( MODULE_DRIVER_USB, MBED_ERROR_INITIALIZATION_FAILED ) 00903 * 00904 * @endcode 00905 * @note This macro generate mbed_error_status_t-es with error type set to MBED_ERROR_TYPE_SYSTEM 00906 * 00907 */ 00908 #define MBED_MAKE_ERROR(module, error_code) MBED_MAKE_SYSTEM_ERROR(module, error_code) 00909 00910 /** 00911 * Callback/Error hook function prototype. Applications needing a callback when an error is reported can use mbed_set_error_hook function 00912 * to register a callback/error hook function using the following prototype. When an error happens in the system error handling 00913 * implementation will invoke this callback with the mbed_error_status_t reported and the error context at the time of error. 00914 * @param error_status mbed_error_status_t status being reported. 00915 * @param error_ctx Error context structure associated with this error. 00916 * @return void 00917 * 00918 */ 00919 typedef void (*mbed_error_hook_t)(const mbed_error_ctx *error_ctx); 00920 00921 /** 00922 * Call this function to set a system error/warning. This function will log the error status with the context info and return to caller. 00923 * 00924 * @param error_status mbed_error_status_t status to be set(See mbed_error_status_t enum above for available error status values). 00925 * @param error_msg The error message to be printed out to STDIO/Serial. 00926 * @param error_value Value associated with the error status. This would depend on error code/error scenario. 00927 * @param filename Name of the source file originating the error( Most callers can pass __FILE__ here ). 00928 * @param line_number The line number of the source file originating the error( Most callers can pass __LINE__ here ) . 00929 * @return 0 or MBED_SUCCESS. 00930 * MBED_ERROR_INVALID_ARGUMENT if called with invalid error status/codes 00931 * 00932 * @code 00933 * 00934 * mbed_error( ERROR_OUT_OF_MEMORY, "Out of memory error", 0, __FILE__, __LINE__ ) 00935 * 00936 * @endcode 00937 * 00938 * @note See MBED_WARNING/MBED_ERROR macros which provides a wrapper on this API 00939 */ 00940 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); 00941 00942 /** 00943 * Returns the first system error reported. 00944 * @return mbed_error_status_t code logged for the first error or MBED_SUCCESS if no errors are logged. 00945 * 00946 */ 00947 mbed_error_status_t mbed_get_first_error(void); 00948 00949 /** 00950 * Returns the most recent system error reported. 00951 * @return mbed_error_status_t code logged for the last error or MBED_SUCCESS if no errors are logged. 00952 * 00953 */ 00954 mbed_error_status_t mbed_get_last_error(void); 00955 00956 /** 00957 * Returns the number of system errors reported after boot. 00958 * @return int Number of errors reported. 00959 * 00960 */ 00961 int mbed_get_error_count(void); 00962 00963 /** 00964 * 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. 00965 * 00966 * @param error_status mbed_error_status_t status to be set(See mbed_error_status_t enum above for available error status values). 00967 * @param error_msg The error message to be printed out to STDIO/Serial. 00968 * @param error_value Value associated with the error status. This would depend on error code/error scenario. 00969 * @param filename Name of the source file originating the error( Most callers can pass __FILE__ here ). 00970 * @param line_number The line number of the source file originating the error( Most callers can pass __LINE__ here ) . 00971 * @return 0 or MBED_SUCCESS. 00972 * MBED_ERROR_INVALID_ARGUMENT if called with invalid error status/codes 00973 * 00974 * @code 00975 * 00976 * mbed_error( MBED_ERROR_PROHIBITED_OPERATION, "Prohibited operation tried", 0, __FILE__, __LINE__ ) 00977 * 00978 * @endcode 00979 * 00980 * @note See MBED_WARNING/MBED_ERROR macros which provides a wrapper on this API 00981 */ 00982 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); 00983 00984 /** 00985 * Registers an application defined error callback with the error handling system. 00986 * This function will be called with error context info whenever system handles a mbed_error/mbed_warning call 00987 * NOTE: This function should be implemented for re-entrancy as multiple threads may invoke mbed_error which may cause error hook to be called. 00988 * @param custom_error_hook mbed_error_status_t status to be set(See mbed_error_status_t enum above for available error status values). 00989 * @return 0 or MBED_SUCCESS on success. 00990 * MBED_ERROR_INVALID_ARGUMENT in case of NULL for custom_error_hook 00991 * 00992 * @code 00993 * 00994 * mbed_error_status_t my_custom_error_hook(mbed_error_status_t error_status, const mbed_error_ctx *error_ctx) { 00995 * //Do something with the error_status or error_ctx 00996 * } 00997 * 00998 * mbed_set_error_hook( my_custom_error_hook ) 00999 * 01000 * @endcode 01001 * @note The erro hook function implementation should be re-entrant. 01002 * 01003 */ 01004 mbed_error_status_t mbed_set_error_hook(mbed_error_hook_t custom_error_hook); 01005 01006 /** 01007 * Reads the first error context information captured. 01008 * @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. 01009 * @return 0 or MBED_SUCCESS on success. 01010 * MBED_ERROR_INVALID_ARGUMENT in case of invalid index 01011 * 01012 */ 01013 mbed_error_status_t mbed_get_first_error_info(mbed_error_ctx *error_info); 01014 01015 /** 01016 * Reads the last error context information captured. 01017 * @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. 01018 * @return 0 or MBED_ERROR_SUCCESS on success. 01019 * MBED_ERROR_INVALID_ARGUMENT in case of invalid index 01020 * 01021 */ 01022 mbed_error_status_t mbed_get_last_error_info(mbed_error_ctx *error_info); 01023 01024 /** 01025 * Clears the last error, first error, error count and all entries in the error history. 01026 * @return 0 or MBED_SUCCESS on success. 01027 * 01028 */ 01029 mbed_error_status_t mbed_clear_all_errors(void); 01030 01031 /** 01032 * Generates a mbed_error_status_t value based on passed in values for type, module and error code. 01033 * @param error_type Error type based on mbed_error_type_t enum. 01034 * @param module Module type based on mbed_module_type_t enum. 01035 * @param error_code Error codes defined by mbed_error_code_t enum 01036 * @return 0 or MBED_ERROR_SUCCESS on success. 01037 * 01038 */ 01039 mbed_error_status_t mbed_make_error(mbed_error_type_t error_type, mbed_module_type_t module, mbed_error_code_t error_code); 01040 01041 /** 01042 * 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. 01043 * @return Current number of entries in the error history. 01044 * 01045 */ 01046 int mbed_get_error_hist_count(void); 01047 01048 /** 01049 * Reads the error context information for a specific error from error history, specified by the index. 01050 * 01051 * @param index index of the error context entry in the history to be retrieved.\n 01052 * The number of entries in the error history is configured during build and the max index depends on max depth of error history.\n 01053 * 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 01054 * @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. 01055 * @return 0 or MBED_SUCCESS on success. 01056 * MBED_ERROR_INVALID_ARGUMENT in case of invalid index 01057 * 01058 */ 01059 mbed_error_status_t mbed_get_error_hist_info(int index, mbed_error_ctx *error_info); 01060 01061 /** 01062 * Saves the error history information to a file 01063 * 01064 * @param path path to the file in the filesystem 01065 * @return 0 or MBED_ERROR_SUCCESS on success. 01066 * MBED_ERROR_WRITE_FAILED if writing to file failed 01067 * MBED_ERROR_INVALID_ARGUMENT if path is not valid 01068 * 01069 * @note Filesystem support is required in order for this function to work. 01070 * 01071 */ 01072 mbed_error_status_t mbed_save_error_hist(const char *path); 01073 01074 #ifdef __cplusplus 01075 } 01076 #endif 01077 01078 #endif 01079 01080 /** @}*/ 01081 /** @}*/ 01082 01083
Generated on Tue Jul 12 2022 12:45:28 by
