1 /*---------------------------------------------------------------------------*
2   Project:  TwlSDK - OS - include
3   File:     exception.h
4 
5   Copyright 2003-2008 Nintendo.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Date:: 2008-09-17#$
14   $Rev: 8556 $
15   $Author: okubata_ryoma $
16 
17  *---------------------------------------------------------------------------*/
18 
19 #ifndef NITRO_OS_EXCEPTION_H_
20 #define NITRO_OS_EXCEPTION_H_
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 #include <nitro/misc.h>
27 #include <nitro/types.h>
28 
29 //---- context for exception display
30 typedef struct
31 {
32     OSContext   context;
33     u32         cp15;
34     u32         spsr;
35 	u32			exinfo;
36 } OSExcpContext;
37 
38 //--------------------------------------------------------------------------------
39 //---- Exception Handler
40 typedef void (*OSExceptionHandler) (u32, void *);
41 
42 
43 //--------------------------------------------------------------------------------
44 /******************************** Exception Vector ********************************/
45 /*---------------------------------------------------------------------------*
46   Name:         OS_SetExceptionVectorUpper
47 
48   Description:  set exception vector to hi-address
49 
50   Arguments:    none
51 
52   Returns:      None
53  *---------------------------------------------------------------------------*/
54 void    OS_SetExceptionVectorUpper(void);
55 
56 /*---------------------------------------------------------------------------*
57   Name:         OS_SetExceptionVectorLower
58 
59   Description:  set exception vector to low-address
60 
61   Arguments:    none
62 
63   Returns:      None
64  *---------------------------------------------------------------------------*/
65 void    OS_SetExceptionVectorLower(void);
66 
67 
68 
69 
70 /******************************** Exception Handler ********************************/
71 /*---------------------------------------------------------------------------*
72   Name:         OS_InitException
73 
74   Description:  initialize exception system of sdk os.
75                 should be called once at first.
76 
77   Arguments:    none
78 
79   Returns:      None
80  *---------------------------------------------------------------------------*/
81 void    OS_InitException(void);
82 
83 
84 
85 /*---------------------------------------------------------------------------*
86   Name:         OS_SetUserExceptionHandler
87 
88   Description:  set user exception handler
89 
90   Arguments:    handler     user routine when exception occurred
91                 arg         argument in call user handler
92 
93   Returns:      None
94  *---------------------------------------------------------------------------*/
95 void    OS_SetUserExceptionHandler(OSExceptionHandler handler, void *arg);
96 
97 /*---------------------------------------------------------------------------*
98   Name:         OS_EnableUserExceptionHandlerOnDebugger
99 
100   Description:  enable user exception handler even if running on the debugger.
101 
102   Arguments:    None.
103 
104   Returns:      None.
105  *---------------------------------------------------------------------------*/
106 void    OS_EnableUserExceptionHandlerOnDebugger(void);
107 
108 
109 
110 #ifdef __cplusplus
111 } /* extern "C" */
112 #endif
113 
114 /* NITRO_OS_EXCEPTION_H_ */
115 #endif
116