I'd like to bring up something that someone mentioned in the other thread, which is why do we even provide these code->string conversions?
On Fri, Feb 7, 2014 at 4:10 AM, Sebastian Huber <sebastian.hu...@embedded-brains.de> wrote: > Rename rtems_internal_error_description() to > rtems_internal_error_text(). Rename rtems_fatal_source_description() to > rtems_fatal_source_text(). Rename rtems_status_code_description() to > rtems_status_text(). Remove previous implementation of > rtems_status_text(). > --- > c/src/lib/libbsp/powerpc/shared/startup/panic.c | 2 +- > cpukit/libcsupport/include/rtems/error.h | 2 - > cpukit/libcsupport/src/error.c | 42 -------------- > cpukit/rtems/Makefile.am | 2 +- > cpukit/rtems/include/rtems/rtems/status.h | 10 ++- > cpukit/rtems/src/statusdesc.c | 69 > ----------------------- > cpukit/rtems/src/statustext.c | 69 > +++++++++++++++++++++++ > cpukit/sapi/Makefile.am | 4 +- > cpukit/sapi/include/rtems/fatal.h | 20 ++++--- > cpukit/sapi/src/fatalsrcdesc.c | 53 ----------------- > cpukit/sapi/src/fatalsrctext.c | 53 +++++++++++++++++ > cpukit/sapi/src/interrdesc.c | 67 ---------------------- > cpukit/sapi/src/interrtext.c | 67 ++++++++++++++++++++++ > doc/user/Makefile.am | 2 +- > doc/user/dirstat.t | 13 ++-- > doc/user/fatal.t | 22 ++++--- > testsuites/psxtests/psxfatal_support/init.c | 4 +- > testsuites/sptests/spfatal_support/init.c | 4 +- > testsuites/sptests/spinternalerror02/init.c | 48 ++++++++-------- > 19 files changed, 258 insertions(+), 295 deletions(-) > delete mode 100644 cpukit/rtems/src/statusdesc.c > create mode 100644 cpukit/rtems/src/statustext.c > delete mode 100644 cpukit/sapi/src/fatalsrcdesc.c > create mode 100644 cpukit/sapi/src/fatalsrctext.c > delete mode 100644 cpukit/sapi/src/interrdesc.c > create mode 100644 cpukit/sapi/src/interrtext.c > > diff --git a/c/src/lib/libbsp/powerpc/shared/startup/panic.c > b/c/src/lib/libbsp/powerpc/shared/startup/panic.c > index 4553f77..f832054 100644 > --- a/c/src/lib/libbsp/powerpc/shared/startup/panic.c > +++ b/c/src/lib/libbsp/powerpc/shared/startup/panic.c > @@ -39,7 +39,7 @@ void _BSP_Fatal_error(unsigned int v) > switch (THESRC) { > case INTERNAL_ERROR_CORE: > printk(" RTEMS Core\n"); > - err = rtems_internal_error_description(THEERR); > + err = rtems_internal_error_text(THEERR); > break; > > case INTERNAL_ERROR_RTEMS_API: > diff --git a/cpukit/libcsupport/include/rtems/error.h > b/cpukit/libcsupport/include/rtems/error.h > index 9556763..cbcfa98 100644 > --- a/cpukit/libcsupport/include/rtems/error.h > +++ b/cpukit/libcsupport/include/rtems/error.h > @@ -84,8 +84,6 @@ typedef Internal_errors_t rtems_error_code_t; > #define RTEMS_ERROR_MASK \ > (RTEMS_ERROR_ERRNO | RTEMS_ERROR_ABORT | RTEMS_ERROR_PANIC) /* all */ > > -const char *rtems_status_text(rtems_status_code sc); > - > /** > * @brief Report an Error > * > diff --git a/cpukit/libcsupport/src/error.c b/cpukit/libcsupport/src/error.c > index 0e63fa4..81ddae2 100644 > --- a/cpukit/libcsupport/src/error.c > +++ b/cpukit/libcsupport/src/error.c > @@ -24,48 +24,6 @@ > > int rtems_panic_in_progress; > > -const rtems_assoc_t rtems_status_assoc[] = { > - { "successful completion", RTEMS_SUCCESSFUL, 0 }, > - { "returned from a thread", RTEMS_TASK_EXITTED, 0 }, > - { "multiprocessing not configured", RTEMS_MP_NOT_CONFIGURED, 0 }, > - { "invalid object name", RTEMS_INVALID_NAME, 0 }, > - { "invalid object id", RTEMS_INVALID_ID, 0 }, > - { "too many", RTEMS_TOO_MANY, 0 }, > - { "timed out waiting", RTEMS_TIMEOUT, 0 }, > - { "object deleted while waiting", RTEMS_OBJECT_WAS_DELETED, 0 }, > - { "specified size was invalid", RTEMS_INVALID_SIZE, 0 }, > - { "address specified is invalid", RTEMS_INVALID_ADDRESS, 0 }, > - { "number was invalid", RTEMS_INVALID_NUMBER, 0 }, > - { "item has not been initialized", RTEMS_NOT_DEFINED, 0 }, > - { "resources still outstanding", RTEMS_RESOURCE_IN_USE, 0 }, > - { "request not satisfied", RTEMS_UNSATISFIED, 0 }, > - { "thread is in wrong state", RTEMS_INCORRECT_STATE, 0 }, > - { "thread already in state", RTEMS_ALREADY_SUSPENDED, 0 }, > - { "illegal on calling thread", RTEMS_ILLEGAL_ON_SELF, 0 }, > - { "illegal for remote object", RTEMS_ILLEGAL_ON_REMOTE_OBJECT, 0 > }, > - { "called from wrong environment", RTEMS_CALLED_FROM_ISR, 0 }, > - { "invalid thread priority", RTEMS_INVALID_PRIORITY, 0 }, > - { "invalid date/time", RTEMS_INVALID_CLOCK, 0 }, > - { "invalid node id", RTEMS_INVALID_NODE, 0 }, > - { "directive not configured", RTEMS_NOT_CONFIGURED, 0 }, > - { "not owner of resource", RTEMS_NOT_OWNER_OF_RESOURCE , 0 }, > - { "directive not implemented", RTEMS_NOT_IMPLEMENTED, 0 }, > - { "RTEMS inconsistency detected", RTEMS_INTERNAL_ERROR, 0 }, > - { "could not get enough memory", RTEMS_NO_MEMORY, 0 }, > - { "driver IO error", RTEMS_IO_ERROR, 0 }, > - { "internal multiprocessing only", THREAD_STATUS_PROXY_BLOCKING, 0 }, > - { 0, 0, 0 }, > -}; > - > - > -const char *rtems_status_text( > - rtems_status_code status > -) > -{ > - return rtems_assoc_name_by_local(rtems_status_assoc, status); > -} > - > - > int rtems_verror( > rtems_error_code_t error_flag, > const char *printf_format, > diff --git a/cpukit/rtems/Makefile.am b/cpukit/rtems/Makefile.am > index f219db8..6688317 100644 > --- a/cpukit/rtems/Makefile.am > +++ b/cpukit/rtems/Makefile.am > @@ -255,7 +255,7 @@ librtems_a_SOURCES += src/workspacegreedy.c > librtems_a_SOURCES += src/modes.c > > librtems_a_SOURCES += src/status.c > -librtems_a_SOURCES += src/statusdesc.c > +librtems_a_SOURCES += src/statustext.c > > if HAS_MP > # We only build multiprocessing related files if HAS_MP was defined > diff --git a/cpukit/rtems/include/rtems/rtems/status.h > b/cpukit/rtems/include/rtems/rtems/status.h > index 19df500..f82b1f4 100644 > --- a/cpukit/rtems/include/rtems/rtems/status.h > +++ b/cpukit/rtems/include/rtems/rtems/status.h > @@ -242,14 +242,16 @@ RTEMS_INLINE_ROUTINE bool rtems_are_statuses_equal( > int rtems_status_code_to_errno(rtems_status_code sc); > > /** > - * @brief Returns a description for a status code. > + * @brief Returns a text for a status code. > + * > + * The text for each status code is the enumerator constant. > * > * @param[in] code The status code. > * > - * @retval description The status code description. > - * @retval ? The passed status code is invalid. > + * @retval text The status code text. > + * @retval "?" The passed status code is invalid. > */ > -const char *rtems_status_code_description( rtems_status_code code ); > +const char *rtems_status_text( rtems_status_code code ); > > /**@}*/ > > diff --git a/cpukit/rtems/src/statusdesc.c b/cpukit/rtems/src/statusdesc.c > deleted file mode 100644 > index 4cc426d..0000000 > --- a/cpukit/rtems/src/statusdesc.c > +++ /dev/null > @@ -1,69 +0,0 @@ > -/** > - * @file > - * > - * @ingroup ClassicStatus > - */ > - > -/* > - * Copyright (c) 2014 embedded brains GmbH. All rights reserved. > - * > - * embedded brains GmbH > - * Dornierstr. 4 > - * 82178 Puchheim > - * Germany > - * <rt...@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.h> > - > -static const char *const status_code_desc[] = { > - "RTEMS_SUCCESSFUL", > - "RTEMS_TASK_EXITTED", > - "RTEMS_MP_NOT_CONFIGURED", > - "RTEMS_INVALID_NAME", > - "RTEMS_INVALID_ID", > - "RTEMS_TOO_MANY", > - "RTEMS_TIMEOUT", > - "RTEMS_OBJECT_WAS_DELETED", > - "RTEMS_INVALID_SIZE", > - "RTEMS_INVALID_ADDRESS", > - "RTEMS_INVALID_NUMBER", > - "RTEMS_NOT_DEFINED", > - "RTEMS_RESOURCE_IN_USE", > - "RTEMS_UNSATISFIED", > - "RTEMS_INCORRECT_STATE", > - "RTEMS_ALREADY_SUSPENDED", > - "RTEMS_ILLEGAL_ON_SELF", > - "RTEMS_ILLEGAL_ON_REMOTE_OBJECT", > - "RTEMS_CALLED_FROM_ISR", > - "RTEMS_INVALID_PRIORITY", > - "RTEMS_INVALID_CLOCK", > - "RTEMS_INVALID_NODE", > - "RTEMS_NOT_CONFIGURED", > - "RTEMS_NOT_OWNER_OF_RESOURCE", > - "RTEMS_NOT_IMPLEMENTED", > - "RTEMS_INTERNAL_ERROR", > - "RTEMS_NO_MEMORY", > - "RTEMS_IO_ERROR", > - "RTEMS_PROXY_BLOCKING" > -}; > - > -const char *rtems_status_code_description( rtems_status_code code ) > -{ > - size_t i = code; > - const char *desc = "?"; > - > - if ( i < RTEMS_ARRAY_SIZE( status_code_desc ) ) { > - desc = status_code_desc [i]; > - } > - > - return desc; > -} > diff --git a/cpukit/rtems/src/statustext.c b/cpukit/rtems/src/statustext.c > new file mode 100644 > index 0000000..bdb91bb > --- /dev/null > +++ b/cpukit/rtems/src/statustext.c > @@ -0,0 +1,69 @@ > +/** > + * @file > + * > + * @ingroup ClassicStatus > + */ > + > +/* > + * Copyright (c) 2014 embedded brains GmbH. All rights reserved. > + * > + * embedded brains GmbH > + * Dornierstr. 4 > + * 82178 Puchheim > + * Germany > + * <rt...@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.h> > + > +static const char *const status_code_text[] = { > + "RTEMS_SUCCESSFUL", > + "RTEMS_TASK_EXITTED", > + "RTEMS_MP_NOT_CONFIGURED", > + "RTEMS_INVALID_NAME", > + "RTEMS_INVALID_ID", > + "RTEMS_TOO_MANY", > + "RTEMS_TIMEOUT", > + "RTEMS_OBJECT_WAS_DELETED", > + "RTEMS_INVALID_SIZE", > + "RTEMS_INVALID_ADDRESS", > + "RTEMS_INVALID_NUMBER", > + "RTEMS_NOT_DEFINED", > + "RTEMS_RESOURCE_IN_USE", > + "RTEMS_UNSATISFIED", > + "RTEMS_INCORRECT_STATE", > + "RTEMS_ALREADY_SUSPENDED", > + "RTEMS_ILLEGAL_ON_SELF", > + "RTEMS_ILLEGAL_ON_REMOTE_OBJECT", > + "RTEMS_CALLED_FROM_ISR", > + "RTEMS_INVALID_PRIORITY", > + "RTEMS_INVALID_CLOCK", > + "RTEMS_INVALID_NODE", > + "RTEMS_NOT_CONFIGURED", > + "RTEMS_NOT_OWNER_OF_RESOURCE", > + "RTEMS_NOT_IMPLEMENTED", > + "RTEMS_INTERNAL_ERROR", > + "RTEMS_NO_MEMORY", > + "RTEMS_IO_ERROR", > + "RTEMS_PROXY_BLOCKING" > +}; > + > +const char *rtems_status_text( rtems_status_code code ) > +{ > + size_t i = code; > + const char *text = "?"; > + > + if ( i < RTEMS_ARRAY_SIZE( status_code_text ) ) { > + text = status_code_text [i]; > + } > + > + return text; > +} > diff --git a/cpukit/sapi/Makefile.am b/cpukit/sapi/Makefile.am > index d7df541..7159208 100644 > --- a/cpukit/sapi/Makefile.am > +++ b/cpukit/sapi/Makefile.am > @@ -30,8 +30,8 @@ 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/interrdesc.c \ > - src/fatal2.c src/fatalsrcdesc.c > + src/chainprependnotify.c src/rbheap.c src/interrtext.c \ > + src/fatal2.c src/fatalsrctext.c > libsapi_a_SOURCES += src/chainsmp.c > libsapi_a_SOURCES += src/delaycpu.c > libsapi_a_SOURCES += src/delaymicro.c > diff --git a/cpukit/sapi/include/rtems/fatal.h > b/cpukit/sapi/include/rtems/fatal.h > index 47bf74f..1230182 100644 > --- a/cpukit/sapi/include/rtems/fatal.h > +++ b/cpukit/sapi/include/rtems/fatal.h > @@ -86,24 +86,28 @@ void rtems_fatal( > ) RTEMS_COMPILER_NO_RETURN_ATTRIBUTE; > > /** > - * @brief Returns a description for a fatal source. > + * @brief Returns a text for a fatal source. > + * > + * The text for each fatal source is the enumerator constant. > * > * @param[in] source is the fatal source. > * > - * @retval description The fatal source description. > - * @retval ? The passed fatal source is invalid. > + * @retval text The fatal source text. > + * @retval "?" The passed fatal source is invalid. > */ > -const char *rtems_fatal_source_description( rtems_fatal_source source ); > +const char *rtems_fatal_source_text( rtems_fatal_source source ); > > /** > - * @brief Returns a description for an internal error code. > + * @brief Returns a text for an internal error code. > + * > + * The text for each internal error code is the enumerator constant. > * > * @param[in] error is the error code. > * > - * @retval description The error code description. > - * @retval ? The passed error code is invalid. > + * @retval text The error code text. > + * @retval "?" The passed error code is invalid. > */ > -const char *rtems_internal_error_description( rtems_fatal_code error ); > +const char *rtems_internal_error_text( rtems_fatal_code error ); > > /** @} */ > > diff --git a/cpukit/sapi/src/fatalsrcdesc.c b/cpukit/sapi/src/fatalsrcdesc.c > deleted file mode 100644 > index fbe8485..0000000 > --- a/cpukit/sapi/src/fatalsrcdesc.c > +++ /dev/null > @@ -1,53 +0,0 @@ > -/** > - * @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 > - * <rt...@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; > -} > diff --git a/cpukit/sapi/src/fatalsrctext.c b/cpukit/sapi/src/fatalsrctext.c > new file mode 100644 > index 0000000..902a269 > --- /dev/null > +++ b/cpukit/sapi/src/fatalsrctext.c > @@ -0,0 +1,53 @@ > +/** > + * @file > + * > + * @brief Implementation of rtems_fatal_source_text() > + * > + * @ingroup ClassicFatal > + */ > + > +/* > + * Copyright (c) 2013-2014 embedded brains GmbH. All rights reserved. > + * > + * embedded brains GmbH > + * Dornierstr. 4 > + * 82178 Puchheim > + * Germany > + * <rt...@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_text[] = { > + "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_text( rtems_fatal_source source ) > +{ > + size_t i = source; > + const char *text = "?"; > + > + if ( i < RTEMS_ARRAY_SIZE( fatal_source_text ) ) { > + text = fatal_source_text[ i ]; > + } > + > + return text; > +} > diff --git a/cpukit/sapi/src/interrdesc.c b/cpukit/sapi/src/interrdesc.c > deleted file mode 100644 > index 5301475..0000000 > --- a/cpukit/sapi/src/interrdesc.c > +++ /dev/null > @@ -1,67 +0,0 @@ > -/** > - * @file > - * > - * @brief Returns a description for an internal error code. > - * > - * @ingroup ClassicFatal > - */ > - > -/* > - * Copyright (c) 2012 embedded brains GmbH. All rights reserved. > - * > - * embedded brains GmbH > - * Obere Lagerstr. 30 > - * 82178 Puchheim > - * Germany > - * <rt...@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", > - "INTERNAL_ERROR_CPU_ISR_INSTALL_VECTOR" > -}; > - > -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; > -} > diff --git a/cpukit/sapi/src/interrtext.c b/cpukit/sapi/src/interrtext.c > new file mode 100644 > index 0000000..a66add5 > --- /dev/null > +++ b/cpukit/sapi/src/interrtext.c > @@ -0,0 +1,67 @@ > +/** > + * @file > + * > + * @brief Returns a text for an internal error code. > + * > + * @ingroup ClassicFatal > + */ > + > +/* > + * Copyright (c) 2012-2014 embedded brains GmbH. All rights reserved. > + * > + * embedded brains GmbH > + * Dornierstr. 4 > + * 82178 Puchheim > + * Germany > + * <rt...@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_text[] = { > + "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", > + "INTERNAL_ERROR_CPU_ISR_INSTALL_VECTOR" > +}; > + > +const char *rtems_internal_error_text( rtems_fatal_code error ) > +{ > + size_t i = error; > + const char *text = "?"; > + > + if ( i < RTEMS_ARRAY_SIZE( internal_error_text ) ) { > + text = internal_error_text[ i ]; > + } > + > + return text; > +} > diff --git a/doc/user/Makefile.am b/doc/user/Makefile.am > index 1b6ddcb..eec627a 100644 > --- a/doc/user/Makefile.am > +++ b/doc/user/Makefile.am > @@ -144,7 +144,7 @@ fatal.texi: fatal.t > -n "Board Support Packages" < $< > $@ > > bsp.texi: bsp.t > - $(BMENU2) -p "Fatal Error Manager INTERNAL_ERROR_DESCRIPTION - > Returns a description for an internal error code" \ > + $(BMENU2) -p "Fatal Error Manager INTERNAL_ERROR_TEXT - Returns a > text for an internal error code" \ > -u "Top" \ > -n "User Extensions Manager" < $< > $@ > > diff --git a/doc/user/dirstat.t b/doc/user/dirstat.t > index adb675d..ea33883 100644 > --- a/doc/user/dirstat.t > +++ b/doc/user/dirstat.t > @@ -40,16 +40,14 @@ > @section Directives > > @page > -@subsection STATUS_CODE_DESCRIPTION - Returns a description for a status code > - > -@cindex fatal error > +@subsection STATUS_CODE_TEXT - Returns a text for a status code > > @subheading CALLING SEQUENCE: > > @ifset is-C > -@findex rtems_status_code_description > +@findex rtems_status_code_text > @example > -const char *rtems_status_code_description( > +const char *rtems_status_code_text( > rtems_status_code code > ); > @end example > @@ -57,8 +55,9 @@ const char *rtems_status_code_description( > > @subheading DIRECTIVE STATUS CODES > > -The status code description or "?" in case the passed status code is invalid. > +The status code text or "?" in case the passed status code is invalid. > > @subheading DESCRIPTION: > > -Returns a description for a status code. > +Returns a text for a status code. The text for each status code is the > +enumerator constant. > diff --git a/doc/user/fatal.t b/doc/user/fatal.t > index 20faa64..61e5261 100644 > --- a/doc/user/fatal.t > +++ b/doc/user/fatal.t > @@ -230,16 +230,16 @@ Prints the exception frame via printk(). > @c > @c > @page > -@subsection FATAL_SOURCE_DESCRIPTION - Returns a description for a fatal > source > +@subsection FATAL_SOURCE_TEXT - Returns a text for a fatal source > > @cindex fatal error > > @subheading CALLING SEQUENCE: > > @ifset is-C > -@findex rtems_fatal_source_description > +@findex rtems_fatal_source_text > @example > -const char *rtems_fatal_source_description( > +const char *rtems_fatal_source_text( > rtems_fatal_source source > ); > @end example > @@ -247,26 +247,27 @@ const char *rtems_fatal_source_description( > > @subheading DIRECTIVE STATUS CODES > > -The fatal source description or "?" in case the passed fatal source is > invalid. > +The fatal source text or "?" in case the passed fatal source is invalid. > > @subheading DESCRIPTION: > > -Returns a description for a fatal source. > +Returns a text for a fatal source. The text for fatal source is the > enumerator > +constant. > > @c > @c > @c > @page > -@subsection INTERNAL_ERROR_DESCRIPTION - Returns a description for an > internal error code > +@subsection INTERNAL_ERROR_TEXT - Returns a text for an internal error code > > @cindex fatal error > > @subheading CALLING SEQUENCE: > > @ifset is-C > -@findex rtems_internal_error_description > +@findex rtems_internal_error_text > @example > -const char *rtems_internal_error_description( > +const char *rtems_internal_error_text( > rtems_fatal_code error > ); > @end example > @@ -274,8 +275,9 @@ const char *rtems_internal_error_description( > > @subheading DIRECTIVE STATUS CODES > > -The error code description or "?" in case the passed error code is invalid. > +The error code text or "?" in case the passed error code is invalid. > > @subheading DESCRIPTION: > > -Returns a description for an internal error code. > +Returns a text for an internal error code. The text for each internal error > +code is the enumerator constant. > diff --git a/testsuites/psxtests/psxfatal_support/init.c > b/testsuites/psxtests/psxfatal_support/init.c > index 93645e6..ce83027 100644 > --- a/testsuites/psxtests/psxfatal_support/init.c > +++ b/testsuites/psxtests/psxfatal_support/init.c > @@ -65,7 +65,7 @@ char *Errors_Rtems[] = { > void Put_Error( uint32_t source, uint32_t error ) > { > if ( source == INTERNAL_ERROR_CORE ) { > - printk( rtems_internal_error_description( error ) ); > + printk( rtems_internal_error_text( error ) ); > } > else if (source == INTERNAL_ERROR_RTEMS_API ){ > if (error > RTEMS_NOT_IMPLEMENTED ) > @@ -80,7 +80,7 @@ void Put_Error( uint32_t source, uint32_t error ) > > void Put_Source( rtems_fatal_source source ) > { > - printk( "%s", rtems_fatal_source_description( source ) ); > + printk( "%s", rtems_fatal_source_text( source ) ); > } > > void Fatal_extension( > diff --git a/testsuites/sptests/spfatal_support/init.c > b/testsuites/sptests/spfatal_support/init.c > index 216c766..dfea488 100644 > --- a/testsuites/sptests/spfatal_support/init.c > +++ b/testsuites/sptests/spfatal_support/init.c > @@ -65,7 +65,7 @@ char *Errors_Rtems[] = { > void Put_Error( uint32_t source, uint32_t error ) > { > if ( source == INTERNAL_ERROR_CORE ) { > - printk( rtems_internal_error_description( error ) ); > + printk( rtems_internal_error_text( error ) ); > } > else if (source == INTERNAL_ERROR_RTEMS_API ){ > if (error > RTEMS_NOT_IMPLEMENTED ) > @@ -77,7 +77,7 @@ void Put_Error( uint32_t source, uint32_t error ) > > void Put_Source( rtems_fatal_source source ) > { > - printk( "%s", rtems_fatal_source_description( source ) ); > + printk( "%s", rtems_fatal_source_text( source ) ); > } > > static bool is_expected_error( rtems_fatal_code error ) > diff --git a/testsuites/sptests/spinternalerror02/init.c > b/testsuites/sptests/spinternalerror02/init.c > index b08a7d4..0d07fab 100644 > --- a/testsuites/sptests/spinternalerror02/init.c > +++ b/testsuites/sptests/spinternalerror02/init.c > @@ -20,50 +20,50 @@ > > #include <rtems.h> > > -static void test_internal_error_description(void) > +static void test_internal_error_text(void) > { > rtems_fatal_code error = 0; > - const char *desc = NULL; > - const char *desc_last; > + const char *text = NULL; > + const char *text_last; > > do { > - desc_last = desc; > - desc = rtems_internal_error_description( error ); > + text_last = text; > + text = rtems_internal_error_text( error ); > ++error; > - puts( desc ); > - } while ( desc != desc_last ); > + puts( text ); > + } while ( text != text_last ); > > rtems_test_assert( error - 3 == INTERNAL_ERROR_CPU_ISR_INSTALL_VECTOR ); > } > > -static void test_fatal_source_description(void) > +static void test_fatal_source_text(void) > { > rtems_fatal_source source = 0; > - const char *desc = NULL; > - const char *desc_last; > + const char *text = NULL; > + const char *text_last; > > do { > - desc_last = desc; > - desc = rtems_fatal_source_description( source ); > + text_last = text; > + text = rtems_fatal_source_text( source ); > ++source; > - puts( desc ); > - } while ( desc != desc_last ); > + puts( text ); > + } while ( text != text_last ); > > rtems_test_assert( source - 3 == RTEMS_FATAL_SOURCE_EXCEPTION ); > } > > -static void test_status_code_description(void) > +static void test_status_text(void) > { > rtems_status_code code = 0; > - const char *desc = NULL; > - const char *desc_last; > + const char *text = NULL; > + const char *text_last; > > do { > - desc_last = desc; > - desc = rtems_status_code_description( code ); > + text_last = text; > + text = rtems_status_text( code ); > ++code; > - puts( desc ); > - } while ( desc != desc_last ); > + puts( text ); > + } while ( text != text_last ); > > rtems_test_assert( code - 3 == RTEMS_PROXY_BLOCKING ); > } > @@ -72,9 +72,9 @@ static void Init(rtems_task_argument arg) > { > puts("\n\n*** TEST SPINTERNALERROR 2 ***"); > > - test_internal_error_description(); > - test_fatal_source_description(); > - test_status_code_description(); > + test_internal_error_text(); > + test_fatal_source_text(); > + test_status_text(); > > puts("*** END OF TEST SPINTERNALERROR 2 ***"); > > -- > 1.7.7 > > _______________________________________________ > rtems-devel mailing list > rtems-devel@rtems.org > http://www.rtems.org/mailman/listinfo/rtems-devel _______________________________________________ rtems-devel mailing list rtems-devel@rtems.org http://www.rtems.org/mailman/listinfo/rtems-devel