source: rtems/testsuites/sptests/spfatal_support/init.c @ 9e15e9b

4.115
Last change on this file since 9e15e9b was 9e15e9b, checked in by Joel Sherrill <joel.sherrill@…>, on 07/24/11 at 22:10:20

2011-07-24 Joel Sherrill <joel.sherrill@…>

  • sp04/tswitch.c, sp07/task1.c, sp07/task2.c, sp09/screen07.c, sp11/task1.c, sp11/task2.c, sp12/pridrv.c, sp12/pritask.c, sp13/task1.c, sp14/asr.c, sp14/task1.c, sp19/first.c, sp19/fptask.c, sp19/inttest.h, sp19/task1.c, sp20/task1.c, sp25/task1.c, sp26/task1.c, sp28/init.c, sp29/init.c, sp31/task1.c, sp32/init.c, sp33/init.c, sp34/changepri.c, sp36/strict_order_mut.c, sp37/init.c, sp43/init.c, sp44/init.c, sp48/init.c, sp54/init.c, sp59/init.c, sp65/init.c, sp68/init.c, spchain/init.c, spclockget/init.c, spfatal03/testcase.h, spfatal07/testcase.h, spfatal_support/init.c: Do not line length exceed 80 columns.
  • Property mode set to 100644
File size: 4.8 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 *  $Id$
10 */
11
12#ifdef HAVE_CONFIG_H
13#include "config.h"
14#endif
15
16#define CONFIGURE_INIT
17#include "system.h"
18
19rtems_task Init(
20  rtems_task_argument argument
21)
22{
23  printk( "\n\n\n*** TEST FATAL " FATAL_ERROR_TEST_NAME " ***\n" );
24  force_error();
25  printk( "Fatal error (%s) NOT hit\n", FATAL_ERROR_DESCRIPTION );
26  rtems_test_exit(0);
27}
28
29char *Sources[] = {
30  "INTERNAL_ERROR_CORE",
31  "INTERNAL_ERROR_RTEMS_API",
32  "INTERNAL_ERROR_POSIX_API",
33};
34
35
36char *Errors_Rtems[] = {
37  "RTEMS_SUCCESSFUL",               /* successful completion */
38  "RTEMS_TASK_EXITTED",             /* returned from a task */
39  "RTEMS_MP_NOT_CONFIGURED",        /* multiprocessing not configured */
40  "RTEMS_INVALID_NAME",             /* invalid object name */
41  "RTEMS_INVALID_ID",               /* invalid object id */
42  "RTEMS_TOO_MANY",                 /* too many */
43  "RTEMS_TIMEOUT",                  /* timed out waiting */
44  "RTEMS_OBJECT_WAS_DELETED",       /* object was deleted while waiting */
45  "RTEMS_INVALID_SIZE",             /* specified size was invalid */
46  "RTEMS_INVALID_ADDRESS",          /* address specified is invalid */
47  "RTEMS_INVALID_NUMBER",           /* number was invalid */
48  "RTEMS_NOT_DEFINED",              /* item has not been initialized */
49  "RTEMS_RESOURCE_IN_USE",          /* resources still outstanding */
50  "RTEMS_UNSATISFIED",              /* request not satisfied */
51  "RTEMS_INCORRECT_STATE",          /* task is in wrong state */
52  "RTEMS_ALREADY_SUSPENDED",        /* task already in state */
53  "RTEMS_ILLEGAL_ON_SELF",          /* illegal operation on calling task */
54  "RTEMS_ILLEGAL_ON_REMOTE_OBJECT", /* illegal operation for remote object */
55  "RTEMS_CALLED_FROM_ISR",          /* called from ISR */
56  "RTEMS_INVALID_PRIORITY",         /* invalid task priority */
57  "RTEMS_INVALID_CLOCK",            /* invalid date/time */
58  "RTEMS_INVALID_NODE",             /* invalid node id */
59  "RTEMS_NOT_OWNER_OF_RESOURCE",    /* not owner of resource */
60  "RTEMS_NOT_CONFIGURED",           /* directive not configured */
61  "RTEMS_NOT_IMPLEMENTED"           /* directive not implemented */
62};
63
64char *Errors_Core[] = {
65  "INTERNAL_ERROR_NO_CONFIGURATION_TABLE",
66  "INTERNAL_ERROR_NO_CPU_TABLE",
67  "INTERNAL_ERROR_TOO_LITTLE_WORKSPACE",
68  "INTERNAL_ERROR_WORKSPACE_ALLOCATION",
69  "INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL",
70  "INTERNAL_ERROR_THREAD_EXITTED",
71  "INTERNAL_ERROR_INCONSISTENT_MP_INFORMATION",
72  "INTERNAL_ERROR_INVALID_NODE",
73  "INTERNAL_ERROR_NO_MPCI",
74  "INTERNAL_ERROR_BAD_PACKET",
75  "INTERNAL_ERROR_OUT_OF_PACKETS",
76  "INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS",
77  "INTERNAL_ERROR_OUT_OF_PROXIES",
78  "INTERNAL_ERROR_INVALID_GLOBAL_ID",
79  "INTERNAL_ERROR_BAD_STACK_HOOK",
80  "INTERNAL_ERROR_BAD_ATTRIBUTES",
81  "INTERNAL_ERROR_IMPLEMENTATION_KEY_CREATE_INCONSISTENCY",
82  "INTERNAL_ERROR_IMPLEMENTATION_BLOCKING_OPERATION_CANCEL",
83  "INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE"
84};
85
86void Put_Error( uint32_t source, uint32_t error )
87{
88  if ( source == INTERNAL_ERROR_CORE ) {
89    if ( error >  INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE )
90      printk("Unknown Internal Core Error (%d)", error);
91    else
92      printk( Errors_Core[ error ] );
93  }
94  else if (source == INTERNAL_ERROR_RTEMS_API ){
95    if (error >  RTEMS_NOT_IMPLEMENTED )
96      printk("Unknown Internal Rtems Error (0x%08x)", error);
97    else
98      printk( Errors_Rtems[ error ] );
99  }
100}
101
102void Put_Source( uint32_t source )
103{
104  if ( source > INTERNAL_ERROR_POSIX_API )
105    printk("Unknown Source (%d)", source);
106  else
107    printk( Sources[ source ] );
108}
109
110
111void Fatal_extension(
112  uint32_t   source,
113  bool       is_internal,
114  uint32_t   error
115)
116{
117  printk( "Fatal error (%s) hit\n", FATAL_ERROR_DESCRIPTION );
118
119  if ( source != FATAL_ERROR_EXPECTED_SOURCE ){
120    printk( "ERROR==> Fatal Extension source Expected (");
121    Put_Source( FATAL_ERROR_EXPECTED_SOURCE );
122    printk( ") received (");
123    Put_Source( source );
124    printk( ")\n" );
125  }
126
127  if ( is_internal !=  FATAL_ERROR_EXPECTED_IS_INTERNAL )
128  {
129    if ( is_internal == TRUE )
130      printk(
131        "ERROR==> Fatal Extension is internal set to TRUE expected FALSE\n"
132      );
133    else
134      printk(
135        "ERROR==> Fatal Extension is internal set to FALSE expected TRUE\n"
136      );
137  }
138
139  if ( error !=  FATAL_ERROR_EXPECTED_ERROR ) {
140    printk( "ERROR==> Fatal Error Expected (");
141    Put_Error( source, FATAL_ERROR_EXPECTED_ERROR );
142    printk( ") received (");
143    Put_Error( source, error );
144    printk( ")\n" );
145  }
146
147  if (
148    source == FATAL_ERROR_EXPECTED_SOURCE
149      && is_internal == FATAL_ERROR_EXPECTED_IS_INTERNAL
150      && error == FATAL_ERROR_EXPECTED_ERROR
151  ) {
152    printk( "*** END OF TEST ***\n" );
153  }
154
155  _Thread_Stop_multitasking();
156}
157
Note: See TracBrowser for help on using the repository browser.