summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/m68k/mrm332/misc/interr.c
blob: c0a8650d478dae4efc21ae2a5fff68ac550d5f01 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
 *  COPYRIGHT (c) 1989-1999.
 *  On-Line Applications Research Corporation (OAR).
 *
 *  The license and distribution terms for this file may be
 *  found in the file LICENSE in this distribution or at
 *  http://www.rtems.org/license/LICENSE.
 */

#include <bsp.h>
#include <bsp/bootcard.h>
#include <rtems/bspIo.h>

/*
 * Ugly hack.... _CPU_Fatal_halt() disonnects the bdm. Without this
 * change, the_error is only known only to the cpu :).
 */

#define RAW_PUTS(str) \
  { register char *ptr = str; \
    while (*ptr) outbyte(*ptr++); \
  }

#define RAW_PUTI(n) { \
    register int i, j; \
    \
    RAW_PUTS("0x"); \
    for (i=28;i>=0;i -= 4) { \
      j = (n>>i) & 0xf; \
      outbyte( (j>9 ? j-10+'a' : j+'0') ); \
    } \
  }

void bsp_fatal_extension(
  rtems_fatal_source source,
  bool is_internal,
  rtems_fatal_code the_error
)
{
  /* try to print error message to outbyte */
  RAW_PUTS("\r\nRTEMS: A fatal error has occured.\r\n");
  RAW_PUTS("RTEMS:    fatal error ");
  RAW_PUTI( the_error );
  RAW_PUTS(" (");
  outbyte( (char)((the_error>>24) & 0xff) );
  outbyte( (char)((the_error>>16) & 0xff) );
  outbyte( (char)((the_error>>8) & 0xff) );
  outbyte( (char)(the_error & 0xff) );
  RAW_PUTS(").\r\n");
}