source: rtems/testsuites/sptests/spfatal_support/init.c @ f0157b8

4.104.114.95
Last change on this file since f0157b8 was f0157b8, checked in by Ralf Corsepius <ralf.corsepius@…>, on 09/06/08 at 03:39:58

Convert to "bool".

  • Property mode set to 100644
File size: 5.0 KB
Line 
1/*  Init
2 *
3 *  This routine is the initialization task for this test program.
4 *  It is a user initialization task and has the responsibility for creating
5 *  and starting the tasks that make up the test.  If the time of day
6 *  clock is required for the test, it should also be set to a known
7 *  value by this function.
8 *
9 *  Input parameters:
10 *    argument - task argument
11 *
12 *  Output parameters:  NONE
13 *
14 *  COPYRIGHT (c) 1989-2008.
15 *  On-Line Applications Research Corporation (OAR).
16 *
17 *  The license and distribution terms for this file may be
18 *  found in the file LICENSE in this distribution or at
19 *  http://www.rtems.com/license/LICENSE.
20 *
21 *  $Id$
22 */
23
24#define CONFIGURE_INIT
25#include "system.h"
26
27rtems_task Init(
28  rtems_task_argument argument
29)
30{
31  force_error();
32  printk( "Fatal error (%s) NOT hit\n", FATAL_ERROR_DESCRIPTION );
33  rtems_test_exit(0);
34}
35
36char *Sources[] = {
37  "INTERNAL_ERROR_CORE",
38  "INTERNAL_ERROR_RTEMS_API",
39  "INTERNAL_ERROR_POSIX_API",
40  "INTERNAL_ERROR_ITRON_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_INVALID_WORKSPACE_ADDRESS",
76  "INTERNAL_ERROR_TOO_LITTLE_WORKSPACE",
77  "INTERNAL_ERROR_WORKSPACE_ALLOCATION",
78  "INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL",
79  "INTERNAL_ERROR_THREAD_EXITTED",
80  "INTERNAL_ERROR_INCONSISTENT_MP_INFORMATION",
81  "INTERNAL_ERROR_INVALID_NODE",
82  "INTERNAL_ERROR_NO_MPCI",
83  "INTERNAL_ERROR_BAD_PACKET",
84  "INTERNAL_ERROR_OUT_OF_PACKETS",
85  "INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS",
86  "INTERNAL_ERROR_OUT_OF_PROXIES",
87  "INTERNAL_ERROR_INVALID_GLOBAL_ID",
88  "INTERNAL_ERROR_BAD_STACK_HOOK",
89  "INTERNAL_ERROR_BAD_ATTRIBUTES",
90  "INTERNAL_ERROR_IMPLEMENTATION_KEY_CREATE_INCONSISTENCY",
91  "INTERNAL_ERROR_IMPLEMENTATION_BLOCKING_OPERATION_CANCEL",
92  "INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE"
93};
94
95void Put_Error( uint32_t source, uint32_t error )
96{
97  if ( source == INTERNAL_ERROR_CORE ) {
98    if ( error >  INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE )
99      printk("Unknown Internal Core Error (%d)", error);
100    else
101      printk( Errors_Core[ error ] );
102  }
103  else if (source == INTERNAL_ERROR_RTEMS_API ){
104    if (error >  RTEMS_NOT_IMPLEMENTED )
105      printk("Unknown Internal Rtems Error (%d)", error);
106    else
107      printk( Errors_Rtems[ error ] );
108  }
109}
110
111void Put_Source( uint32_t source )
112{
113  if ( source > INTERNAL_ERROR_ITRON_API )
114    printk("Unknown Source (%d)", source);
115  else
116    printk( Sources[ source ] );
117}
118
119
120rtems_extension Fatal_extension(
121  uint32_t   source,
122  bool       is_internal,
123  uint32_t   error
124)
125{
126  printk( "Fatal error (%s) hit\n", FATAL_ERROR_DESCRIPTION );
127
128  if ( source != FATAL_ERROR_EXPECTED_SOURCE ){
129    printk( "ERROR==> Fatal Extension source Expected (");
130    Put_Source( FATAL_ERROR_EXPECTED_SOURCE );
131    printk( ") received (");
132    Put_Source( source );
133    printk( ")\n" );
134  }
135
136  if ( is_internal !=  FATAL_ERROR_EXPECTED_IS_INTERNAL )
137  {
138    if ( is_internal == TRUE )
139      printk( "ERROR==> Fatal Extension is internal set to TRUE expected FALSE\n" );
140    else
141      printk( "ERROR==> Fatal Extension is internal set to FALSE expected TRUE\n" );
142  }
143 
144  if ( error !=  FATAL_ERROR_EXPECTED_ERROR ) {
145    printk( "ERROR==> Fatal Error Expected (");
146    Put_Error( source, FATAL_ERROR_EXPECTED_ERROR );
147    printk( ") received (");
148    Put_Error( source, error );
149    printk( ")\n" );
150  }
151
152  /* return and let the CPU halt */
153}
154
Note: See TracBrowser for help on using the repository browser.