OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [lib/] [libbsp/] [m68k/] [efi332/] [misc/] [interr.c] - Blame information for rev 173

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
2
 *  Internal Error Handler
3
 *
4
 *  COPYRIGHT (c) 1989-1999.
5
 *  On-Line Applications Research Corporation (OAR).
6
 *
7
 *  The license and distribution terms for this file may be
8
 *  found in the file LICENSE in this distribution or at
9
 *  http://www.OARcorp.com/rtems/license.html.
10
 *
11
 *  $Id: interr.c,v 1.2 2001-09-27 12:00:02 chris Exp $
12
 */
13
 
14
#include <rtems/system.h>
15
#include <rtems/score/interr.h>
16
#include <rtems/score/sysstate.h>
17
#include <rtems/score/userext.h>
18
 
19
/*PAGE
20
 *
21
 *  _Internal_error_Occurred
22
 *
23
 *  This routine will invoke the fatal error handler supplied by the user
24
 *  followed by the the default one provided by the executive.  The default
25
 *  error handler assumes no hardware is present to help inform the user
26
 *  of the problem.  Halt stores the error code in a known register,
27
 *  disables interrupts, and halts the CPU.  If the CPU does not have a
28
 *  halt instruction, it will loop to itself.
29
 *
30
 *  Input parameters:
31
 *    the_source  - what subsystem the error originated in
32
 *    is_internal - if the error was internally generated
33
 *    the_error   - fatal error status code
34
 *
35
 *  Output parameters:
36
 *    As much information as possible is stored in a CPU dependent fashion.
37
 *    See the CPU dependent code for more information.
38
 *
39
 *  NOTE: The the_error is not necessarily a directive status code.
40
 */
41
 
42
/*
43
 * Ugly hack.... _CPU_Fatal_halt() disonnects the bdm. Without this
44
 * change, the_error is only known only to the cpu :).
45
 *
46
 * From "bsp.h" which is not yet available in the arch tree during
47
 * this phase of install. jsg
48
 */
49
void outbyte(char);
50
void bsp_cleanup( void );
51
 
52
#define RAW_PUTS(str) \
53
  { register char *ptr = str; \
54
    while (*ptr) outbyte(*ptr++); \
55
  }
56
 
57
#define RAW_PUTI(n) { \
58
    register int i, j; \
59
    \
60
    RAW_PUTS("0x"); \
61
    for (i=28;i>=0;i -= 4) { \
62
      j = (n>>i) & 0xf; \
63
      outbyte( (j>9 ? j-10+'a' : j+'0') ); \
64
    } \
65
  }
66
 
67
void volatile _Internal_error_Occurred(
68
  Internal_errors_Source  the_source,
69
  boolean                 is_internal,
70
  unsigned32              the_error
71
)
72
{
73
 
74
  Internal_errors_What_happened.the_source  = the_source;
75
  Internal_errors_What_happened.is_internal = is_internal;
76
  Internal_errors_What_happened.the_error   = the_error;
77
 
78
  _User_extensions_Fatal( the_source, is_internal, the_error );
79
 
80
  _System_state_Set( SYSTEM_STATE_FAILED );
81
 
82
  /* try to print error message to outbyte */
83
  RAW_PUTS("\r\nRTEMS: A fatal error has occured.\r\n");
84
  RAW_PUTS("RTEMS:    fatal error ");
85
  RAW_PUTI( the_error );
86
  RAW_PUTS(" (");
87
  outbyte( (char)((the_error>>24) & 0xff) );
88
  outbyte( (char)((the_error>>16) & 0xff) );
89
  outbyte( (char)((the_error>>8) & 0xff) );
90
  outbyte( (char)(the_error & 0xff) );
91
  RAW_PUTS(").\r\n");
92
 
93
  /* configure peripherals for a safe exit */
94
  bsp_cleanup();
95
 
96
  _CPU_Fatal_halt( the_error );
97
 
98
  /* will not return from this routine */
99
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.