diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-11-13 17:40:33 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-11-15 15:33:11 +0100 |
commit | dc6e830c108996c43e9267f05a51b7299dd3e6f9 (patch) | |
tree | fb18e0a10ef689e15aaa6054a25ab6bc3ee3eb00 /cpukit | |
parent | sapi: Add rtems_fatal_source and rtems_fatal_code (diff) | |
download | rtems-dc6e830c108996c43e9267f05a51b7299dd3e6f9.tar.bz2 |
sapi: Add and use rtems_internal_error_description
Diffstat (limited to 'cpukit')
-rw-r--r-- | cpukit/sapi/Makefile.am | 2 | ||||
-rw-r--r-- | cpukit/sapi/include/rtems/fatal.h | 11 | ||||
-rw-r--r-- | cpukit/sapi/src/interrdesc.c | 58 |
3 files changed, 70 insertions, 1 deletions
diff --git a/cpukit/sapi/Makefile.am b/cpukit/sapi/Makefile.am index 67f11eb859..4406708dae 100644 --- a/cpukit/sapi/Makefile.am +++ b/cpukit/sapi/Makefile.am @@ -37,7 +37,7 @@ libsapi_a_SOURCES = src/debug.c src/extension.c src/extensioncreate.c \ src/iounregisterdriver.c src/iowrite.c src/posixapi.c \ src/rtemsapi.c src/extensiondata.c src/getversionstring.c \ src/chainappendnotify.c src/chaingetnotify.c src/chaingetwait.c \ - src/chainprependnotify.c src/rbheap.c + src/chainprependnotify.c src/rbheap.c src/interrdesc.c libsapi_a_CPPFLAGS = $(AM_CPPFLAGS) include $(srcdir)/preinstall.am diff --git a/cpukit/sapi/include/rtems/fatal.h b/cpukit/sapi/include/rtems/fatal.h index 4ddb578c91..8f646a9417 100644 --- a/cpukit/sapi/include/rtems/fatal.h +++ b/cpukit/sapi/include/rtems/fatal.h @@ -23,6 +23,7 @@ #define _RTEMS_FATAL_H #include <rtems/score/basedefs.h> /* RTEMS_COMPILER_NO_RETURN_ATTRIBUTE */ +#include <rtems/extension.h> #ifdef __cplusplus extern "C" { @@ -42,6 +43,16 @@ void rtems_fatal_error_occurred( uint32_t the_error ) RTEMS_COMPILER_NO_RETURN_ATTRIBUTE; +/** + * @brief Returns a description for an internal error code. + * + * @param[in] error The error code. + * + * @return The error code description or "?" in case the passed error code is + * invalid. + */ +const char *rtems_internal_error_description( rtems_fatal_code error ); + #ifdef __cplusplus } #endif diff --git a/cpukit/sapi/src/interrdesc.c b/cpukit/sapi/src/interrdesc.c new file mode 100644 index 0000000000..181bcffd04 --- /dev/null +++ b/cpukit/sapi/src/interrdesc.c @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2012 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#if HAVE_CONFIG_H + #include "config.h" +#endif + +#include <rtems/fatal.h> + +static const char *const internal_error_desc [] = { + "INTERNAL_ERROR_NO_CONFIGURATION_TABLE", + "INTERNAL_ERROR_NO_CPU_TABLE", + "INTERNAL_ERROR_TOO_LITTLE_WORKSPACE", + "INTERNAL_ERROR_WORKSPACE_ALLOCATION", + "INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL", + "INTERNAL_ERROR_THREAD_EXITTED", + "INTERNAL_ERROR_INCONSISTENT_MP_INFORMATION", + "INTERNAL_ERROR_INVALID_NODE", + "INTERNAL_ERROR_NO_MPCI", + "INTERNAL_ERROR_BAD_PACKET", + "INTERNAL_ERROR_OUT_OF_PACKETS", + "INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS", + "INTERNAL_ERROR_OUT_OF_PROXIES", + "INTERNAL_ERROR_INVALID_GLOBAL_ID", + "INTERNAL_ERROR_BAD_STACK_HOOK", + "INTERNAL_ERROR_BAD_ATTRIBUTES", + "INTERNAL_ERROR_IMPLEMENTATION_KEY_CREATE_INCONSISTENCY", + "INTERNAL_ERROR_IMPLEMENTATION_BLOCKING_OPERATION_CANCEL", + "INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE", + "INTERNAL_ERROR_UNLIMITED_AND_MAXIMUM_IS_0", + "INTERNAL_ERROR_SHUTDOWN_WHEN_NOT_UP", + "INTERNAL_ERROR_GXX_KEY_ADD_FAILED", + "INTERNAL_ERROR_GXX_MUTEX_INIT_FAILED", + "INTERNAL_ERROR_NO_MEMORY_FOR_HEAP" +}; + +const char *rtems_internal_error_description( rtems_fatal_code error ) +{ + size_t i = error; + const char *desc = "?"; + + if ( i < RTEMS_ARRAY_SIZE( internal_error_desc ) ) { + desc = internal_error_desc [i]; + } + + return desc; +} |