source: rtems/c/src/lib/libbsp/powerpc/shared/startup/panic.c @ b6606e8

5
Last change on this file since b6606e8 was b6606e8, checked in by Sebastian Huber <sebastian.huber@…>, on 12/08/16 at 15:41:30

score: Remove fatal is internal indicator

The fatal is internal indicator is redundant since the fatal source and
error code uniquely identify a fatal error. Keep the fatal user
extension is internal parameter for backward compatibility and set it to
false always.

Update #2825.

  • Property mode set to 100644
File size: 1.8 KB
Line 
1#include <rtems.h>
2#include <bsp.h>
3#include <bsp/bootcard.h>
4#include <bsp/uart.h>
5#include <rtems/bspIo.h>
6#include <rtems/error.h>
7#include <libcpu/stackTrace.h>
8#include <rtems/score/percpu.h>
9#include <rtems/score/threaddispatch.h>
10
11static void
12rebootQuestion(void)
13{
14  printk("Press a key to reboot\n");
15  BSP_poll_char_via_serial();
16  bsp_reset();
17}
18
19void BSP_panic(char *s)
20{
21  printk("%s PANIC %s\n",_RTEMS_version, s);
22  rebootQuestion();
23}
24
25#define THESRC _Internal_errors_What_happened.the_source
26#define THEERR _Internal_errors_What_happened.the_error
27
28void _BSP_Fatal_error(unsigned int v)
29{
30  unsigned long flags;
31  const char *err = 0;
32
33  rtems_interrupt_disable(flags);
34  (void) flags; /* avoid set but not used warning */
35
36  printk("%s\n",_RTEMS_version);
37  printk("FATAL ERROR:\n");
38  printk("Environment:");
39  switch (THESRC) {
40    case INTERNAL_ERROR_CORE:
41      printk(" RTEMS Core\n");
42      err = rtems_internal_error_text(THEERR);
43    break;
44
45      case INTERNAL_ERROR_RTEMS_API:
46      printk(" RTEMS API\n");
47      err = rtems_status_text(THEERR);
48    break;
49
50      case INTERNAL_ERROR_POSIX_API:
51      printk(" POSIX API (errno)\n");
52      /* could use strerror but I'd rather avoid using this here */
53    break;
54
55    default:
56      printk("  UNKNOWN (0x%x)\n",THESRC);
57  break;
58  }
59  if ( _Thread_Dispatch_is_enabled() )
60    printk("enabled\n");
61  else
62    printk(
63      "  Error occurred in a Thread Dispatching DISABLED context (level %i)\n",
64      _Thread_Dispatch_get_disable_level());
65
66  if ( _ISR_Nest_level ) {
67    printk(
68      "  Error occurred from ISR context (ISR nest level %i)\n",
69      _ISR_Nest_level
70    );
71  }
72
73  printk("Error %d",THEERR);
74  if (err) {
75    printk(": %s",err);
76  }
77  printk("\n");
78  printk("Stack Trace:\n");
79  CPU_print_stack();
80
81  rebootQuestion();
82}
Note: See TracBrowser for help on using the repository browser.