source: rtems/testsuites/sptests/spfatal_support/init.c @ 47a3cd8

4.115
Last change on this file since 47a3cd8 was 47a3cd8, checked in by Sebastian Huber <sebastian.huber@…>, on 08/09/12 at 14:48:00

score: Work area initialization API change

The work areas (RTEMS work space and C program heap) will be initialized
now in a separate step and are no longer part of
rtems_initialize_data_structures(). Initialization is performed with
tables of Heap_Area entries. This allows usage of scattered memory
areas present on various small scale micro-controllers.

The sbrk() support API changes also. The bsp_sbrk_init() must now deal
with a minimum size for the first memory chunk to take the configured
work space size into account.

  • Property mode set to 100644
File size: 5.3 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2011.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 */
9
10#ifdef HAVE_CONFIG_H
11#include "config.h"
12#endif
13
14#define CONFIGURE_INIT
15#include "system.h"
16
17static void print_test_begin_message(void)
18{
19  static bool done = false;
20
21  if (!done) {
22    done = true;
23    printk( "\n\n\n*** TEST FATAL " FATAL_ERROR_TEST_NAME " ***\n" );
24  }
25}
26
27rtems_task Init(
28  rtems_task_argument argument
29)
30{
31  print_test_begin_message();
32  force_error();
33  printk( "Fatal error (%s) NOT hit\n", FATAL_ERROR_DESCRIPTION );
34  rtems_test_exit(0);
35}
36
37char *Sources[] = {
38  "INTERNAL_ERROR_CORE",
39  "INTERNAL_ERROR_RTEMS_API",
40  "INTERNAL_ERROR_POSIX_API",
41};
42
43
44char *Errors_Rtems[] = {
45  "RTEMS_SUCCESSFUL",               /* successful completion */
46  "RTEMS_TASK_EXITTED",             /* returned from a task */
47  "RTEMS_MP_NOT_CONFIGURED",        /* multiprocessing not configured */
48  "RTEMS_INVALID_NAME",             /* invalid object name */
49  "RTEMS_INVALID_ID",               /* invalid object id */
50  "RTEMS_TOO_MANY",                 /* too many */
51  "RTEMS_TIMEOUT",                  /* timed out waiting */
52  "RTEMS_OBJECT_WAS_DELETED",       /* object was deleted while waiting */
53  "RTEMS_INVALID_SIZE",             /* specified size was invalid */
54  "RTEMS_INVALID_ADDRESS",          /* address specified is invalid */
55  "RTEMS_INVALID_NUMBER",           /* number was invalid */
56  "RTEMS_NOT_DEFINED",              /* item has not been initialized */
57  "RTEMS_RESOURCE_IN_USE",          /* resources still outstanding */
58  "RTEMS_UNSATISFIED",              /* request not satisfied */
59  "RTEMS_INCORRECT_STATE",          /* task is in wrong state */
60  "RTEMS_ALREADY_SUSPENDED",        /* task already in state */
61  "RTEMS_ILLEGAL_ON_SELF",          /* illegal operation on calling task */
62  "RTEMS_ILLEGAL_ON_REMOTE_OBJECT", /* illegal operation for remote object */
63  "RTEMS_CALLED_FROM_ISR",          /* called from ISR */
64  "RTEMS_INVALID_PRIORITY",         /* invalid task priority */
65  "RTEMS_INVALID_CLOCK",            /* invalid date/time */
66  "RTEMS_INVALID_NODE",             /* invalid node id */
67  "RTEMS_NOT_OWNER_OF_RESOURCE",    /* not owner of resource */
68  "RTEMS_NOT_CONFIGURED",           /* directive not configured */
69  "RTEMS_NOT_IMPLEMENTED"           /* directive not implemented */
70};
71
72char *Errors_Core[] = {
73  "INTERNAL_ERROR_NO_CONFIGURATION_TABLE",
74  "INTERNAL_ERROR_NO_CPU_TABLE",
75  "INTERNAL_ERROR_TOO_LITTLE_WORKSPACE",
76  "INTERNAL_ERROR_WORKSPACE_ALLOCATION",
77  "INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL",
78  "INTERNAL_ERROR_THREAD_EXITTED",
79  "INTERNAL_ERROR_INCONSISTENT_MP_INFORMATION",
80  "INTERNAL_ERROR_INVALID_NODE",
81  "INTERNAL_ERROR_NO_MPCI",
82  "INTERNAL_ERROR_BAD_PACKET",
83  "INTERNAL_ERROR_OUT_OF_PACKETS",
84  "INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS",
85  "INTERNAL_ERROR_OUT_OF_PROXIES",
86  "INTERNAL_ERROR_INVALID_GLOBAL_ID",
87  "INTERNAL_ERROR_BAD_STACK_HOOK",
88  "INTERNAL_ERROR_BAD_ATTRIBUTES",
89  "INTERNAL_ERROR_IMPLEMENTATION_KEY_CREATE_INCONSISTENCY",
90  "INTERNAL_ERROR_IMPLEMENTATION_BLOCKING_OPERATION_CANCEL",
91  "INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE",
92  "INTERNAL_ERROR_UNLIMITED_AND_MAXIMUM_IS_0",
93  "INTERNAL_ERROR_SHUTDOWN_WHEN_NOT_UP",
94  "INTERNAL_ERROR_GXX_KEY_ADD_FAILED",
95  "INTERNAL_ERROR_GXX_MUTEX_INIT_FAILED",
96  "INTERNAL_ERROR_NO_MEMORY_FOR_HEAP"
97};
98
99void Put_Error( uint32_t source, uint32_t error )
100{
101  if ( source == INTERNAL_ERROR_CORE ) {
102    if ( error >  INTERNAL_ERROR_NO_MEMORY_FOR_HEAP )
103      printk("Unknown Internal Core Error (%d)", error);
104    else
105      printk( Errors_Core[ error ] );
106  }
107  else if (source == INTERNAL_ERROR_RTEMS_API ){
108    if (error >  RTEMS_NOT_IMPLEMENTED )
109      printk("Unknown Internal Rtems Error (0x%08x)", error);
110    else
111      printk( Errors_Rtems[ error ] );
112  }
113}
114
115void Put_Source( uint32_t source )
116{
117  if ( source > INTERNAL_ERROR_POSIX_API )
118    printk("Unknown Source (%d)", source);
119  else
120    printk( Sources[ source ] );
121}
122
123
124void Fatal_extension(
125  uint32_t   source,
126  bool       is_internal,
127  uint32_t   error
128)
129{
130  print_test_begin_message();
131  printk( "Fatal error (%s) hit\n", FATAL_ERROR_DESCRIPTION );
132
133  if ( source != FATAL_ERROR_EXPECTED_SOURCE ){
134    printk( "ERROR==> Fatal Extension source Expected (");
135    Put_Source( FATAL_ERROR_EXPECTED_SOURCE );
136    printk( ") received (");
137    Put_Source( source );
138    printk( ")\n" );
139  }
140
141  if ( is_internal !=  FATAL_ERROR_EXPECTED_IS_INTERNAL )
142  {
143    if ( is_internal == TRUE )
144      printk(
145        "ERROR==> Fatal Extension is internal set to TRUE expected FALSE\n"
146      );
147    else
148      printk(
149        "ERROR==> Fatal Extension is internal set to FALSE expected TRUE\n"
150      );
151  }
152
153  if ( error !=  FATAL_ERROR_EXPECTED_ERROR ) {
154    printk( "ERROR==> Fatal Error Expected (");
155    Put_Error( source, FATAL_ERROR_EXPECTED_ERROR );
156    printk( ") received (");
157    Put_Error( source, error );
158    printk( ")\n" );
159  }
160
161  if (
162    source == FATAL_ERROR_EXPECTED_SOURCE
163      && is_internal == FATAL_ERROR_EXPECTED_IS_INTERNAL
164      && error == FATAL_ERROR_EXPECTED_ERROR
165  ) {
166    printk( "*** END OF TEST FATAL " FATAL_ERROR_TEST_NAME " ***\n" );
167  }
168
169  if ( _System_state_Is_up( _System_state_Get() ) )
170    _Thread_Stop_multitasking();
171}
172
Note: See TracBrowser for help on using the repository browser.