File indexing completed on 2025-05-11 08:24:47
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 #include <rtems/bspIo.h>
0030
0031 #include <tmacros.h>
0032
0033 rtems_task Init( rtems_task_argument argument );
0034
0035 const char rtems_test_name[] = "SPFATAL " FATAL_ERROR_TEST_NAME;
0036
0037 static void print_test_begin_message(void)
0038 {
0039 static bool done = false;
0040
0041 if (!done) {
0042 done = true;
0043 TEST_BEGIN();
0044 }
0045 }
0046
0047 rtems_task Init(
0048 rtems_task_argument argument
0049 )
0050 {
0051 print_test_begin_message();
0052 force_error();
0053 printk( "Fatal error (%s) NOT hit\n", FATAL_ERROR_DESCRIPTION );
0054 rtems_test_exit(0);
0055 }
0056
0057 #ifdef FATAL_ERROR_EXPECTED_ERROR
0058 static void Put_Error( uint32_t source, uint32_t error )
0059 {
0060 if ( source == INTERNAL_ERROR_CORE ) {
0061 printk( rtems_internal_error_text( error ) );
0062 }
0063 else if (source == INTERNAL_ERROR_RTEMS_API ){
0064 if (error > RTEMS_NOT_IMPLEMENTED )
0065 printk("Unknown Internal RTEMS Error (0x%08" PRIx32 ")", error);
0066 else
0067 printk( "%s", rtems_status_text( error ) );
0068 }
0069 }
0070 #endif
0071
0072 static void Put_Source( rtems_fatal_source source )
0073 {
0074 printk( "%s", rtems_fatal_source_text( source ) );
0075 }
0076
0077 static bool is_expected_error( rtems_fatal_code error )
0078 {
0079 #ifdef FATAL_ERROR_EXPECTED_ERROR
0080 return error == FATAL_ERROR_EXPECTED_ERROR;
0081 #else
0082 return FATAL_ERROR_EXPECTED_ERROR_CHECK( error );
0083 #endif
0084 }
0085
0086 static void Fatal_extension(
0087 rtems_fatal_source source,
0088 bool always_set_to_false,
0089 rtems_fatal_code error
0090 )
0091 {
0092 print_test_begin_message();
0093 printk( "Fatal error (%s) hit\n", FATAL_ERROR_DESCRIPTION );
0094
0095 if ( source != FATAL_ERROR_EXPECTED_SOURCE ){
0096 printk( "ERROR==> Fatal Extension source Expected (");
0097 Put_Source( FATAL_ERROR_EXPECTED_SOURCE );
0098 printk( ") received (");
0099 Put_Source( source );
0100 printk( ")\n" );
0101 }
0102
0103 if ( always_set_to_false )
0104 printk(
0105 "ERROR==> Fatal Extension is internal set to true expected false\n"
0106 );
0107
0108 #ifdef FATAL_ERROR_EXPECTED_ERROR
0109 if ( error != FATAL_ERROR_EXPECTED_ERROR ) {
0110 printk( "ERROR==> Fatal Error Expected (");
0111 Put_Error( source, FATAL_ERROR_EXPECTED_ERROR );
0112 printk( ") received (");
0113 Put_Error( source, error );
0114 printk( ")\n" );
0115 }
0116 #endif
0117
0118 if (
0119 source == FATAL_ERROR_EXPECTED_SOURCE
0120 && !always_set_to_false
0121 && is_expected_error( error )
0122 ) {
0123 TEST_END();
0124 }
0125 }
0126
0127 #define CONFIGURE_INIT
0128
0129 #define CONFIGURE_INITIAL_EXTENSIONS \
0130 { \
0131 NULL, \
0132 NULL, \
0133 NULL, \
0134 NULL, \
0135 NULL, \
0136 NULL, \
0137 NULL, \
0138 Fatal_extension \
0139 }, \
0140 RTEMS_TEST_INITIAL_EXTENSION
0141
0142
0143 #define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
0144 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
0145
0146
0147 #ifndef SPFATAL_TEST_CASE_EXTRA_TASKS
0148 #define SPFATAL_TEST_CASE_EXTRA_TASKS 0
0149 #endif
0150 #define CONFIGURE_MAXIMUM_TASKS \
0151 (SPFATAL_TEST_CASE_EXTRA_TASKS + 1)
0152
0153 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
0154
0155 #include <rtems/confdefs.h>