/*---------------------------------------------------------------------------* Project: OS Error APIs File: OSError.h Copyright 1998-2011 Nintendo. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. *---------------------------------------------------------------------------*/ #ifndef __OSERROR_H__ #define __OSERROR_H__ #include #ifdef __cplusplus extern "C" { #endif /*---------------------------------------------------------------------------* Error Handler API *---------------------------------------------------------------------------*/ typedef u16 OSError; /* * Note: for most errors, OSErrorHandler takes third and fourth arguments * /dsisr/ and /dar/, which are of type /u32/ like below: * * void (*OSErrorHandler)( OSError error, OSContext* context, * u32 dsisr, u32 dar ); * */ #define OS_ERROR_SYSTEM_RESET 0 #define OS_ERROR_MACHINE_CHECK 1 #define OS_ERROR_DSI 2 #define OS_ERROR_ISI 3 #define OS_ERROR_EXTERNAL_INTERRUPT 4 #define OS_ERROR_ALIGNMENT 5 #define OS_ERROR_PROGRAM 6 #define OS_ERROR_FLOATING_POINT 7 // floating-point unavailable #define OS_ERROR_DECREMENTER 8 #define OS_ERROR_SYSTEM_CALL 9 #define OS_ERROR_TRACE 10 #define OS_ERROR_PERFORMACE_MONITOR 11 #define OS_ERROR_BREAKPOINT 12 #define OS_ERROR_SYSTEM_INTERRUPT 13 #define OS_ERROR_THERMAL_INTERRUPT 14 #define OS_ERROR_PROTECTION 15 #define OS_ERROR_FPE 16 // floating-point exception #define OS_ERROR_MAX (OS_ERROR_FPE+1) u32 OSGetLastError( void ); void* OSGetSymbolName (u32 addr, u8* symbolName, u32 nameBufSize); // valid crash control modes #define CRASH_CONTROL_MODE_NONE 0 #define CRASH_CONTROL_MODE_UNHANDLED 1 #define CRASH_CONTROL_MODE_RESTART 2 #define CRASH_CONTROL_MODE_REBOOT 3 #define CRASH_CONTROL_MODE_KILL 4 typedef struct { u32 mode; void* message; u32 data0; u32 data1; u32 data2; } OSCrashControl; // valid crash error codes #define OS_CRASH_ERROR_DSI OS_ERROR_DSI #define OS_CRASH_ERROR_ISI OS_ERROR_ISI #define OS_CRASH_ERROR_PROGRAM OS_ERROR_PROGRAM #define OS_CRASH_ERROR_KILL OS_ERROR_MAX typedef struct { u32 error; UPID upid; u64 titleid; } OSCrashInfo; void __OSGetAppCrashControl(OSCrashControl *cntl); void __OSSetAppCrashControl(OSCrashControl *cntl); void __OSClearAppCrash(void); void OSGetCrashInfo(OSCrashInfo *cinfo); BOOL OSRestartCrashedApp(void *apArgs, u32 aArgsBytes); BOOL OSRebootCrash(void); void __OSSetTestSetting(const char *name, u32 value); u32 __OSGetTestSetting(const char *name); typedef void (*OSPanicCBFunc)(void *arg); void OSSetPanicCallback(OSPanicCBFunc func, void *arg); #define OS_CRASH_DUMP_TYPE_MINI 0 #define OS_CRASH_DUMP_TYPE_FULL 1 #define OS_MAX_CRASH_DUMP_TYPE 2 // illegal value u32 OSGetCrashDumpType(void); void OSSetCrashDumpType(u32 type); #ifdef __cplusplus } #endif #endif // __OSERROR_H__