mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-08-20 23:20:51 +08:00
score: Change debug helper functions
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().
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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
|
||||
*
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 );
|
||||
|
||||
/**@}*/
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
#include <rtems.h>
|
||||
|
||||
static const char *const status_code_desc[] = {
|
||||
static const char *const status_code_text[] = {
|
||||
"RTEMS_SUCCESSFUL",
|
||||
"RTEMS_TASK_EXITTED",
|
||||
"RTEMS_MP_NOT_CONFIGURED",
|
||||
@@ -56,14 +56,14 @@ static const char *const status_code_desc[] = {
|
||||
"RTEMS_PROXY_BLOCKING"
|
||||
};
|
||||
|
||||
const char *rtems_status_code_description( rtems_status_code code )
|
||||
const char *rtems_status_text( rtems_status_code code )
|
||||
{
|
||||
size_t i = code;
|
||||
const char *desc = "?";
|
||||
const char *text = "?";
|
||||
|
||||
if ( i < RTEMS_ARRAY_SIZE( status_code_desc ) ) {
|
||||
desc = status_code_desc [i];
|
||||
if ( i < RTEMS_ARRAY_SIZE( status_code_text ) ) {
|
||||
text = status_code_text [i];
|
||||
}
|
||||
|
||||
return desc;
|
||||
return text;
|
||||
}
|
||||
@@ -29,8 +29,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_CPPFLAGS = $(AM_CPPFLAGS)
|
||||
|
||||
|
||||
@@ -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 );
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Implementation of rtems_fatal_source_description()
|
||||
* @brief Implementation of rtems_fatal_source_text()
|
||||
*
|
||||
* @ingroup ClassicFatal
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2013 embedded brains GmbH. All rights reserved.
|
||||
* Copyright (c) 2013-2014 embedded brains GmbH. All rights reserved.
|
||||
*
|
||||
* embedded brains GmbH
|
||||
* Obere Lagerstr. 30
|
||||
* Dornierstr. 4
|
||||
* 82178 Puchheim
|
||||
* Germany
|
||||
* <rtems@embedded-brains.de>
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
#include <rtems/fatal.h>
|
||||
|
||||
static const char *const fatal_source_desc [] = {
|
||||
static const char *const fatal_source_text[] = {
|
||||
"INTERNAL_ERROR_CORE",
|
||||
"INTERNAL_ERROR_RTEMS_API",
|
||||
"INTERNAL_ERROR_POSIX_API",
|
||||
@@ -40,14 +40,14 @@ static const char *const fatal_source_desc [] = {
|
||||
"RTEMS_FATAL_SOURCE_EXCEPTION"
|
||||
};
|
||||
|
||||
const char *rtems_fatal_source_description( rtems_fatal_source source )
|
||||
const char *rtems_fatal_source_text( rtems_fatal_source source )
|
||||
{
|
||||
size_t i = source;
|
||||
const char *desc = "?";
|
||||
const char *text = "?";
|
||||
|
||||
if ( i < RTEMS_ARRAY_SIZE( fatal_source_desc ) ) {
|
||||
desc = fatal_source_desc [i];
|
||||
if ( i < RTEMS_ARRAY_SIZE( fatal_source_text ) ) {
|
||||
text = fatal_source_text[ i ];
|
||||
}
|
||||
|
||||
return desc;
|
||||
return text;
|
||||
}
|
||||
@@ -1,16 +1,16 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Returns a description for an internal error code.
|
||||
* @brief Returns a text for an internal error code.
|
||||
*
|
||||
* @ingroup ClassicFatal
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 embedded brains GmbH. All rights reserved.
|
||||
* Copyright (c) 2012-2014 embedded brains GmbH. All rights reserved.
|
||||
*
|
||||
* embedded brains GmbH
|
||||
* Obere Lagerstr. 30
|
||||
* Dornierstr. 4
|
||||
* 82178 Puchheim
|
||||
* Germany
|
||||
* <rtems@embedded-brains.de>
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
#include <rtems/fatal.h>
|
||||
|
||||
static const char *const internal_error_desc [] = {
|
||||
static const char *const internal_error_text[] = {
|
||||
"INTERNAL_ERROR_NO_CONFIGURATION_TABLE",
|
||||
"INTERNAL_ERROR_NO_CPU_TABLE",
|
||||
"INTERNAL_ERROR_TOO_LITTLE_WORKSPACE",
|
||||
@@ -54,14 +54,14 @@ static const char *const internal_error_desc [] = {
|
||||
"INTERNAL_ERROR_CPU_ISR_INSTALL_VECTOR"
|
||||
};
|
||||
|
||||
const char *rtems_internal_error_description( rtems_fatal_code error )
|
||||
const char *rtems_internal_error_text( rtems_fatal_code error )
|
||||
{
|
||||
size_t i = error;
|
||||
const char *desc = "?";
|
||||
const char *text = "?";
|
||||
|
||||
if ( i < RTEMS_ARRAY_SIZE( internal_error_desc ) ) {
|
||||
desc = internal_error_desc [i];
|
||||
if ( i < RTEMS_ARRAY_SIZE( internal_error_text ) ) {
|
||||
text = internal_error_text[ i ];
|
||||
}
|
||||
|
||||
return desc;
|
||||
return text;
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
@c On-Line Applications Research Corporation (OAR).
|
||||
@c All rights reserved.
|
||||
|
||||
@node Example Application, Glossary, Directive Status Codes, Top
|
||||
@node Example Application, Glossary, Directive Status Codes STATUS_TEXT - Returns a text for a status code, Top
|
||||
@chapter Example Application
|
||||
|
||||
@example
|
||||
|
||||
@@ -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" < $< > $@
|
||||
|
||||
|
||||
+6
-7
@@ -40,16 +40,14 @@
|
||||
@section Directives
|
||||
|
||||
@page
|
||||
@subsection STATUS_CODE_DESCRIPTION - Returns a description for a status code
|
||||
|
||||
@cindex fatal error
|
||||
@subsection STATUS_TEXT - Returns a text for a status code
|
||||
|
||||
@subheading CALLING SEQUENCE:
|
||||
|
||||
@ifset is-C
|
||||
@findex rtems_status_code_description
|
||||
@findex rtems_status_text
|
||||
@example
|
||||
const char *rtems_status_code_description(
|
||||
const char *rtems_status_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.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
@c On-Line Applications Research Corporation (OAR).
|
||||
@c All rights reserved.
|
||||
|
||||
@node Example Application, Glossary, Directive Status Codes STATUS_CODE_DESCRIPTION - Returns a description for a status code, Top
|
||||
@node Example Application, Glossary, Directive Status Codes STATUS_TEXT - Returns a text for a status code, Top
|
||||
@chapter Example Application
|
||||
|
||||
@example
|
||||
|
||||
+12
-10
@@ -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.
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -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 ***");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user