1 /*
2  * Copyright (C) 2015-2021 Alibaba Group Holding Limited
3  */
4 
5 #ifndef DEBUG_PANIC_H
6 #define DEBUG_PANIC_H
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 #define DEBUG_PANIC_STEP_MAX 32
13 #define OS_PANIC_BY_NMI      0x31415926
14 #define OS_PANIC_NOT_REBOOT  0x21314916
15 
16 /* how many steps has finished when crash */
17 extern volatile uint32_t g_crash_steps;
18 /* crash status */
19 extern volatile uint32_t g_crash_by_NMI;
20 extern volatile uint32_t g_crash_not_reboot;
21 
22 /* fault/exception entry
23  * notice: this function maybe reentried by double exception
24  */
25 void panicHandler(void *context);
26 void panicNmiFlagSet();
27 int  panicNmiFlagCheck();
28 void debug_init(void);
29 void debug_cpu_stop(void);
30 uint32_t debug_cpu_in_crash(void);
31 void fiqafterpanicHandler(void *context);
32 void debug_fatal_error(kstat_t err, char *file, int line);
33 
34 #ifdef __cplusplus
35 }
36 #endif
37 
38 #endif /* DEBUG_PANIC_H */
39