libdragon
|
00001 00006 #ifndef __LIBDRAGON_EXCEPTION_H 00007 #define __LIBDRAGON_EXCEPTION_H 00008 00009 #include <stdint.h> 00010 00019 enum 00020 { 00022 EXCEPTION_TYPE_UNKNOWN = 0, 00024 EXCEPTION_TYPE_RESET, 00026 EXCEPTION_TYPE_CRITICAL 00027 }; 00028 00034 typedef volatile struct 00035 { 00037 volatile uint64_t gpr[32]; 00039 volatile uint32_t sr; 00041 volatile uint32_t epc; 00043 volatile uint64_t hi; 00045 volatile uint64_t lo; 00047 volatile uint64_t fc31; 00049 volatile uint64_t fpr[32]; 00050 } reg_block_t; 00051 00055 typedef struct 00056 { 00061 int32_t type; 00063 const char* info; 00065 volatile const reg_block_t* regs; 00066 } exception_t; 00067 00070 #ifdef __cplusplus 00071 extern "C" { 00072 #endif 00073 00074 void register_exception_handler( void (*cb)(exception_t *) ); 00075 00076 #ifdef __cplusplus 00077 } 00078 #endif 00079 00080 #endif