summaryrefslogtreecommitdiffstats
path: root/bsps/sparc/leon3/start/bsp_fatal_halt.c
blob: 5a6e3f490e6b2772c68dca7dd59d7c8e6b08b9d9 (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
/**
 * @file
 * @ingroup sparc_leon3
 * @brief LEON3 BSP Fatal_halt handler.
 *
 *  COPYRIGHT (c) 2014.
 *  Aeroflex Gaisler AB.
 *
 *  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 <leon.h>
#include <rtems/score/cpuimpl.h>

void _CPU_Fatal_halt( uint32_t source, CPU_Uint32ptr error )
{
#ifdef BSP_POWER_DOWN_AT_FATAL_HALT
  /* Power down LEON CPU on fatal error exit */
  sparc_disable_interrupts();
  leon3_power_down_loop();
#else
  /*
   * Return to debugger, simulator, hypervisor or similar by exiting
   * with an error code. g1=1, g2=FATAL_SOURCE, G3=error-code.
   */
  sparc_syscall_exit(source, error);
#endif
}