00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef __DEBUG_H__
00015 #define __DEBUG_H__
00016
00017 #include <psptypes.h>
00018 #include <pspmoduleinfo.h>
00019
00020 #ifdef __cplusplus
00021 extern "C" {
00022 #endif
00023
00028
00032 void pspDebugScreenInit(void);
00033
00040 void pspDebugScreenPrintf(const char *fmt, ...) __attribute__((format(printf,1,2)));
00041
00048 void pspDebugScreenSetBackColor(u32 color);
00049
00055 void pspDebugScreenSetTextColor(u32 color);
00056
00065 void pspDebugScreenPutChar(int x, int y, u32 color, u8 ch);
00066
00070 void pspDebugScreenSetXY(int x, int y);
00071
00077 int pspDebugScreenGetX(void);
00078
00084 int pspDebugScreenGetY(void);
00085
00089 void pspDebugScreenClear(void);
00090
00099 int pspDebugScreenPrintData(const char *buff, int size);
00100
00107 void pspDebugGetStackTrace(unsigned int* results,int max);
00108
00110 typedef struct _PspDebugRegBlock
00111 {
00112 u32 frame[6];
00114 u32 r[32];
00116 u32 status;
00118 u32 lo;
00119 u32 hi;
00120 u32 badvaddr;
00121 u32 cause;
00122 u32 epc;
00123 u32 fpr[32];
00124 u32 fsr;
00125 u32 fir;
00126 u32 frame_ptr;
00127 u32 unused;
00128
00129 u32 index;
00130 u32 random;
00131 u32 entrylo0;
00132 u32 entrylo1;
00133 u32 context;
00134 u32 pagemask;
00135 u32 wired;
00136 u32 cop0_7;
00137 u32 cop0_8;
00138 u32 cop0_9;
00139 u32 entryhi;
00140 u32 cop0_11;
00141 u32 cop0_12;
00142 u32 cop0_13;
00143 u32 cop0_14;
00144
00145 u32 prid;
00146 u32 padding[100];
00147 } PspDebugRegBlock;
00148
00150 typedef void (*PspDebugErrorHandler)(PspDebugRegBlock *regs);
00151
00159 int pspDebugInstallErrorHandler(PspDebugErrorHandler handler);
00160
00169 void pspDebugDumpException(PspDebugRegBlock *regs);
00170
00172 typedef int (*PspDebugKprintfHandler)(const char *format, u32 *args);
00173
00180 int pspDebugInstallKprintfHandler(PspDebugKprintfHandler handler);
00181
00183 typedef struct _PspDebugStackTrace
00184 {
00186 u32 call_addr;
00188 u32 func_addr;
00189 } PspDebugStackTrace;
00190
00203 int pspDebugGetStackTrace2(PspDebugRegBlock *regs, PspDebugStackTrace *trace, int max);
00204
00206 typedef struct _PspDebugProfilerRegs
00207 {
00208 u32 enable;
00209 u32 systemck;
00210 u32 cpuck;
00211 u32 stall;
00212 u32 internal;
00213 u32 memory;
00214 u32 copz;
00215 u32 vfpu;
00216 u32 sleep;
00217 u32 bus_access;
00218 u32 uncached_load;
00219 u32 uncached_store;
00220 u32 cached_load;
00221 u32 cached_store;
00222 u32 i_miss;
00223 u32 d_miss;
00224 u32 d_writeback;
00225 u32 cop0_inst;
00226 u32 fpu_inst;
00227 u32 vfpu_inst;
00228 u32 local_bus;
00229 } PspDebugProfilerRegs;
00230
00232 void pspDebugProfilerEnable(void);
00233
00235 void pspDebugProfilerDisable(void);
00236
00238 void pspDebugProfilerClear(void);
00239
00244 void pspDebugProfilerGetRegs(PspDebugProfilerRegs *regs);
00245
00247 void pspDebugProfilerPrint(void);
00248
00250 typedef int (*PspDebugPrintHandler)(const char *data, int len);
00251
00253 typedef int (*PspDebugInputHandler)(char *data, int len);
00254
00262 int pspDebugInstallStdinHandler(PspDebugInputHandler handler);
00263
00271 int pspDebugInstallStdoutHandler(PspDebugPrintHandler handler);
00272
00280 int pspDebugInstallStderrHandler(PspDebugPrintHandler handler);
00281
00287 void pspDebugSioPutchar(int ch);
00288
00294 int pspDebugSioGetchar(void);
00295
00301 void pspDebugSioPuts(const char *str);
00302
00311 int pspDebugSioPutData(const char *data, int len);
00312
00317 void pspDebugSioInit(void);
00318
00323 void pspDebugSioSetBaud(int baud);
00324
00329 void pspDebugEnablePutchar(void);
00330
00336 void pspDebugSioInstallKprintf(void);
00337
00341 void pspDebugGdbStubInit(void);
00342
00346 void pspDebugBreakpoint(void);
00347
00350 #ifdef __cplusplus
00351 }
00352 #endif
00353
00354 #endif