mgh: fix for default HDD DMA mode, that wasn't correctly set
[open-ps2-loader.git] / modules / debug / ioptrap / ioptrap.h
bloba84f3e9f17643029c71fbf95ee6d49ee5e0310bd
1 /*
2 # _____ ___ ____ ___ ____
3 # ____| | ____| | | |____|
4 # | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5 #-----------------------------------------------------------------------
6 # Copyright 2001-2004, ps2dev - http://www.ps2dev.org
7 # Licenced under Academic Free License version 2.0
8 # Review ps2sdk README & LICENSE files for further details.
10 # $Id: ioptrap.h 598 2004-09-21 19:14:27Z lukasz $
13 #ifndef __IOPTRAP_H__
14 #define __IOPTRAP_H__
16 #include <types.h>
18 /* IDT_R3000_20.pdf 3-11 table 3.5 */
19 typedef enum {
20 EXCEPTION_Int, /* note you can't really work with this one. */
21 EXCEPTION_Mod,
22 EXCEPTION_TLBL,
23 EXCEPTION_TLBS,
24 EXCEPTION_AdEL,
25 EXCEPTION_AdES,
26 EXCEPTION_IBE,
27 EXCEPTION_DBE,
28 EXCEPTION_Syscall,
29 EXCEPTION_Bp,
30 EXCEPTION_RI,
31 EXCEPTION_CpU,
32 EXCEPTION_Ov,
33 EXCEPTION_RESERVED13,
34 EXCEPTION_RESERVED14 /* would be FPE, but that's not going to happen on the IOP */
35 } exception_type_t;
37 typedef struct exception_frame {
38 u32 epc;
39 u32 cause;
40 u32 badvaddr;
41 u32 sr;
42 u32 regs[32];
43 u32 hi;
44 u32 lo;
45 u32 dcic;
46 } exception_frame_t;
48 /* Beware: the handler will be run in a 'bad' state. Consider you are
49 on interrupt mode, so, only i* functions. */
50 typedef void (*trap_exception_handler_t)(exception_type_t, exception_frame_t *);
52 #define DCIC_WR (1<<27)
53 #define DCIC_RD (1<<26)
54 #define DCIC_DA (1<<25)
55 #define DCIC_PC (1<<24)
57 #define ioptrap_IMPORTS_start DECLARE_IMPORT_TABLE(ioptrap, 1, 1)
58 #define ioptrap_IMPORTS_end END_IMPORT_TABLE
60 const char * get_exception_name(exception_type_t type);
61 #define I_get_exception_name DECLARE_IMPORT(4, get_exception_name)
63 /* Will act as a setjmp. Returns 0 to say it was the first call,
64 otherwise, returns the exception number. (note that you'll never
65 get any interrupt...) Note that using this will completely disable
66 user defined exception handlers. */
67 exception_type_t dbg_setjmp();
68 #define I_dbg_setjmp DECLARE_IMPORT(5, dbg_setjmp)
70 /* Will return the old handler. */
71 trap_exception_handler_t set_exception_handler(exception_type_t type, trap_exception_handler_t handler);
72 #define I_set_exception_handler DECLARE_IMPORT(6, set_exception_handler)
73 trap_exception_handler_t get_exception_handler(exception_type_t type);
74 #define I_get_exception_handler DECLARE_IMPORT(7, get_exception_handler)
76 /* Breakpoint stuff. */
77 void set_dba(u32 v);
78 #define I_set_dba DECLARE_IMPORT(8, set_dba)
79 void set_dbam(u32 v);
80 #define I_set_dbam DECLARE_IMPORT(9, set_dbam)
81 void set_dcic(u32 v);
82 #define I_set_dcic DECLARE_IMPORT(10, set_dcic)
83 u32 get_dba();
84 #define I_get_dba DECLARE_IMPORT(11, get_dba)
85 u32 get_dbam();
86 #define I_get_dbam DECLARE_IMPORT(12, get_dbam)
87 u32 get_dcic();
88 #define I_get_dcic DECLARE_IMPORT(13, get_dcic)
90 #endif