source: rtems/testsuites/psxtests/psxfatal_support/init.c @ cafefbf

4.115
Last change on this file since cafefbf was cafefbf, checked in by Ralf Corsepius <ralf.corsepius@…>, on 02/22/11 at 09:47:36

Add HAVE_CONFIG_H.

  • Property mode set to 100644
File size: 4.9 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2010.
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
19void *POSIX_Init(
20  void *argument
21)
22{
23  force_error();
24  printk( "Fatal error (%s) NOT hit\n", FATAL_ERROR_DESCRIPTION );
25  rtems_test_exit(0);
26}
27
28char *Sources[] = {
29  "INTERNAL_ERROR_CORE",
30  "INTERNAL_ERROR_RTEMS_API",
31  "INTERNAL_ERROR_POSIX_API",
32};
33
34char *Errors_Rtems[] = {
35  "RTEMS_SUCCESSFUL",               /* successful completion */
36  "RTEMS_TASK_EXITTED",             /* returned from a task */
37  "RTEMS_MP_NOT_CONFIGURED",        /* multiprocessing not configured */
38  "RTEMS_INVALID_NAME",             /* invalid object name */
39  "RTEMS_INVALID_ID",               /* invalid object id */
40  "RTEMS_TOO_MANY",                 /* too many */
41  "RTEMS_TIMEOUT",                  /* timed out waiting */
42  "RTEMS_OBJECT_WAS_DELETED",       /* object was deleted while waiting */
43  "RTEMS_INVALID_SIZE",             /* specified size was invalid */
44  "RTEMS_INVALID_ADDRESS",          /* address specified is invalid */
45  "RTEMS_INVALID_NUMBER",           /* number was invalid */
46  "RTEMS_NOT_DEFINED",              /* item has not been initialized */
47  "RTEMS_RESOURCE_IN_USE",          /* resources still outstanding */
48  "RTEMS_UNSATISFIED",              /* request not satisfied */
49  "RTEMS_INCORRECT_STATE",          /* task is in wrong state */
50  "RTEMS_ALREADY_SUSPENDED",        /* task already in state */
51  "RTEMS_ILLEGAL_ON_SELF",          /* illegal operation on calling task */
52  "RTEMS_ILLEGAL_ON_REMOTE_OBJECT", /* illegal operation for remote object */
53  "RTEMS_CALLED_FROM_ISR",          /* called from ISR */
54  "RTEMS_INVALID_PRIORITY",         /* invalid task priority */
55  "RTEMS_INVALID_CLOCK",            /* invalid date/time */
56  "RTEMS_INVALID_NODE",             /* invalid node id */
57  "RTEMS_NOT_OWNER_OF_RESOURCE",    /* not owner of resource */
58  "RTEMS_NOT_CONFIGURED",           /* directive not configured */
59  "RTEMS_NOT_IMPLEMENTED"           /* directive not implemented */
60};
61
62char *Errors_Core[] = {
63  "INTERNAL_ERROR_NO_CONFIGURATION_TABLE",
64  "INTERNAL_ERROR_NO_CPU_TABLE",
65  "INTERNAL_ERROR_TOO_LITTLE_WORKSPACE",
66  "INTERNAL_ERROR_WORKSPACE_ALLOCATION",
67  "INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL",
68  "INTERNAL_ERROR_THREAD_EXITTED",
69  "INTERNAL_ERROR_INCONSISTENT_MP_INFORMATION",
70  "INTERNAL_ERROR_INVALID_NODE",
71  "INTERNAL_ERROR_NO_MPCI",
72  "INTERNAL_ERROR_BAD_PACKET",
73  "INTERNAL_ERROR_OUT_OF_PACKETS",
74  "INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS",
75  "INTERNAL_ERROR_OUT_OF_PROXIES",
76  "INTERNAL_ERROR_INVALID_GLOBAL_ID",
77  "INTERNAL_ERROR_BAD_STACK_HOOK",
78  "INTERNAL_ERROR_BAD_ATTRIBUTES",
79  "INTERNAL_ERROR_IMPLEMENTATION_KEY_CREATE_INCONSISTENCY",
80  "INTERNAL_ERROR_IMPLEMENTATION_BLOCKING_OPERATION_CANCEL",
81  "INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE"
82};
83
84void Put_Error( uint32_t source, uint32_t error )
85{
86  if ( source == INTERNAL_ERROR_CORE ) {
87    if ( error >  INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE )
88      printk("Unknown Internal Core Error (%d)", error);
89    else
90      printk( Errors_Core[ error ] );
91  }
92  else if (source == INTERNAL_ERROR_RTEMS_API ){
93    if (error >  RTEMS_NOT_IMPLEMENTED )
94      printk("Unknown Internal Rtems Error (%d)", error);
95    else
96      printk( Errors_Rtems[ error ] );
97  }
98  else if (source == INTERNAL_ERROR_POSIX_API ) {
99      printk( "SOURCE=%d ERROR=%d %s", source, error, strerror( error ) );
100  }
101}
102
103void Put_Source( uint32_t source )
104{
105  if ( source > INTERNAL_ERROR_POSIX_API )
106    printk("Unknown Source (%d)", source);
107  else
108    printk( Sources[ source ] );
109}
110
111
112void Fatal_extension(
113  uint32_t   source,
114  bool       is_internal,
115  uint32_t   error
116)
117{
118  printk( "Fatal error (%s) hit\n", FATAL_ERROR_DESCRIPTION );
119
120  if ( source != FATAL_ERROR_EXPECTED_SOURCE ){
121    printk( "ERROR==> Fatal Extension source Expected (");
122    Put_Source( FATAL_ERROR_EXPECTED_SOURCE );
123    printk( ") received (");
124    Put_Source( source );
125    printk( ")\n" );
126  }
127
128  if ( is_internal !=  FATAL_ERROR_EXPECTED_IS_INTERNAL )
129  {
130    if ( is_internal == TRUE )
131      printk( "ERROR==> Fatal Extension is internal set to TRUE expected FALSE\n" );
132    else
133      printk( "ERROR==> Fatal Extension is internal set to FALSE expected TRUE\n" );
134  }
135
136  if ( error !=  FATAL_ERROR_EXPECTED_ERROR ) {
137    printk( "ERROR==> Fatal Error Expected (");
138    Put_Error( source, FATAL_ERROR_EXPECTED_ERROR );
139    printk( ") received (");
140    Put_Error( source, error );
141    printk( ")\n" );
142  }
143
144  if (
145    source == FATAL_ERROR_EXPECTED_SOURCE
146      && is_internal == FATAL_ERROR_EXPECTED_IS_INTERNAL
147      && error == FATAL_ERROR_EXPECTED_ERROR
148  ) {
149    printk( "*** END OF TEST ***\n" );
150  }
151
152  _Thread_Stop_multitasking();
153}
154
Note: See TracBrowser for help on using the repository browser.