diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-01-07 16:01:45 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-01-07 16:08:19 +0100 |
commit | f2f39b62a284afefbf8f1840255602162a9b2a01 (patch) | |
tree | 389db5d1428bf56ae63477aa632ed735e3d5a2a5 /cpukit | |
parent | bsp/lpc24xx: Declare conditionally (diff) | |
download | rtems-f2f39b62a284afefbf8f1840255602162a9b2a01.tar.bz2 |
sapi: Add rtems_fatal_source_description()
Diffstat (limited to 'cpukit')
-rw-r--r-- | cpukit/sapi/Makefile.am | 2 | ||||
-rw-r--r-- | cpukit/sapi/include/rtems/fatal.h | 10 | ||||
-rw-r--r-- | cpukit/sapi/src/fatalsrcdesc.c | 53 |
3 files changed, 64 insertions, 1 deletions
diff --git a/cpukit/sapi/Makefile.am b/cpukit/sapi/Makefile.am index 232028e63c..f9fd4f9696 100644 --- a/cpukit/sapi/Makefile.am +++ b/cpukit/sapi/Makefile.am @@ -38,7 +38,7 @@ libsapi_a_SOURCES = src/debug.c src/extension.c src/extensioncreate.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/interrdesc.c \ - src/fatal2.c + src/fatal2.c src/fatalsrcdesc.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 64344b36b8..46a7ab9574 100644 --- a/cpukit/sapi/include/rtems/fatal.h +++ b/cpukit/sapi/include/rtems/fatal.h @@ -83,6 +83,16 @@ void rtems_fatal( ) RTEMS_COMPILER_NO_RETURN_ATTRIBUTE; /** + * @brief Returns a description for a fatal source. + * + * @param[in] source The fatal source. + * + * @return The fatal source description or "?" in case the passed fatal source + * is invalid. + */ +const char *rtems_fatal_source_description( rtems_fatal_source source ); + +/** * @brief Returns a description for an internal error code. * * @param[in] error The error code. diff --git a/cpukit/sapi/src/fatalsrcdesc.c b/cpukit/sapi/src/fatalsrcdesc.c new file mode 100644 index 0000000000..fbe8485853 --- /dev/null +++ b/cpukit/sapi/src/fatalsrcdesc.c @@ -0,0 +1,53 @@ +/** + * @file + * + * @brief Implementation of rtems_fatal_source_description() + * + * @ingroup ClassicFatal + */ + +/* + * Copyright (c) 2013 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 fatal_source_desc [] = { + "INTERNAL_ERROR_CORE", + "INTERNAL_ERROR_RTEMS_API", + "INTERNAL_ERROR_POSIX_API", + "RTEMS_FATAL_SOURCE_BDBUF", + "RTEMS_FATAL_SOURCE_APPLICATION", + "RTEMS_FATAL_SOURCE_EXIT", + "RTEMS_FATAL_SOURCE_BSP_GENERIC", + "RTEMS_FATAL_SOURCE_BSP_SPECIFIC", + "RTEMS_FATAL_SOURCE_ASSERT", + "RTEMS_FATAL_SOURCE_STACK_CHECKER", + "RTEMS_FATAL_SOURCE_EXCEPTION" +}; + +const char *rtems_fatal_source_description( rtems_fatal_source source ) +{ + size_t i = source; + const char *desc = "?"; + + if ( i < RTEMS_ARRAY_SIZE( fatal_source_desc ) ) { + desc = fatal_source_desc [i]; + } + + return desc; +} |