1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: err_Api.h 4 Copyright (C)2010 Nintendo Co., Ltd. All rights reserved. 5 These coded instructions, statements, and computer programs contain 6 proprietary information of Nintendo of America Inc. and/or Nintendo 7 Company Ltd., and are protected by Federal copyright law. They may 8 not be disclosed to third parties or copied or duplicated in any form, 9 in whole or in part, without the prior written consent of Nintendo. 10 $Rev: 31762 $ 11 *--------------------------------------------------------------------------- 12 13 14 */ 15 16 #ifndef NN_ERR_CTR_ERR_API_H_ 17 #define NN_ERR_CTR_ERR_API_H_ 18 19 #include <nn/types.h> 20 #include <nn/Result.h> 21 22 #ifdef __cplusplus 23 namespace nn { 24 namespace err { 25 namespace CTR { 26 27 void ThrowFatalErr( Result result ); 28 29 }}} // namespace nn::err::CTR 30 31 #ifndef NN_HARDWARE_CTR_LEGACY 32 #ifdef NN_PROCESSOR_ARM11MPCORE 33 34 /* 35 Throws a fatal error for the error display applet. 36 Notification occurs only if the Result LEVEL is FATAL. 37 */ 38 #define NN_ERR_THROW_FATAL_IF_FATAL_ONLY(result) \ 39 do \ 40 { \ 41 ::nn::Result resultLocal = (result); \ 42 if ( resultLocal.GetLevel() == ::nn::Result::LEVEL_FATAL ) \ 43 { \ 44 ::nn::err::ThrowFatalErr(resultLocal); \ 45 } \ 46 } while(0) 47 48 /* 49 Throws a fatal error for the error display applet. 50 Notification is sent when the Result LEVEL is not SUCCESS, STATUS, or INFO (not recommended) - this indicates a fatal error or error that cannot occur in retail product. 51 52 53 */ 54 #define NN_ERR_THROW_FATAL(result) \ 55 do \ 56 { \ 57 ::nn::Result resultLocal = (result); \ 58 switch ( resultLocal.GetLevel() ) \ 59 { \ 60 case ::nn::Result::LEVEL_INFO: \ 61 case ::nn::Result::LEVEL_SUCCESS: \ 62 case ::nn::Result::LEVEL_STATUS: \ 63 break; \ 64 default: \ 65 ::nn::err::ThrowFatalErr(resultLocal); \ 66 } \ 67 } while(0) 68 69 /* 70 Throws a fatal error for the error display applet. 71 Sends notification for all error results. 72 */ 73 #define NN_ERR_THROW_FATAL_ALL(result) \ 74 do \ 75 { \ 76 ::nn::Result resultLocal = (result); \ 77 if ( resultLocal.IsFailure() ) \ 78 { \ 79 ::nn::err::ThrowFatalErr(resultLocal); \ 80 } \ 81 } while(0) 82 83 84 #else /* NN_PROCESSOR_ARM11MPCORE */ 85 86 #define NN_ERR_THROW_FATAL_IF_FATAL_ONLY(result) NN_UTIL_PANIC_IF_FAILED(result) 87 #define NN_ERR_THROW_FATAL(result) NN_UTIL_PANIC_IF_FAILED(result) 88 #define NN_ERR_THROW_FATAL_ALL(result) NN_UTIL_PANIC_IF_FAILED(result) 89 90 #endif /* NN_PROCESSOR_ARM11MPCORE */ 91 #else /* NN_HARDWARE_CTR_LEGACY */ 92 93 #define NN_ERR_THROW_FATAL_IF_FATAL_ONLY(result) \ 94 do \ 95 { \ 96 ::nn::Result resultLocal = (result); \ 97 NN_UNUSED_VAR(resultLocal); \ 98 } while(0) 99 100 #define NN_ERR_THROW_FATAL(result) \ 101 do \ 102 { \ 103 ::nn::Result resultLocal = (result); \ 104 NN_UNUSED_VAR(resultLocal); \ 105 } while(0) 106 107 #define NN_ERR_THROW_FATAL_ALL(result) \ 108 do \ 109 { \ 110 ::nn::Result resultLocal = (result); \ 111 NN_UNUSED_VAR(resultLocal); \ 112 } while(0) 113 114 #endif /* NN_HARDWARE_CTR_LEGACY */ 115 #endif // __cplusplus 116 117 118 #endif /* NN_ERR_CTR_ERR_API_H_ */ 119