Go to the documentation of this file.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
00041 void pspDebugScreenInitEx(void *vram_base, int mode, int setup);
00042
00049 void pspDebugScreenPrintf(const char *fmt, ...) __attribute__((format(printf,1,2)));
00050
00060 void pspDebugScreenKprintf(const char *format, ...) __attribute__((format(printf,1,2)));
00061
00067 void pspDebugScreenEnableBackColor(int enable);
00068
00075 void pspDebugScreenSetBackColor(u32 color);
00076
00082 void pspDebugScreenSetTextColor(u32 color);
00083
00089 void pspDebugScreenSetColorMode(int mode);
00090
00099 void pspDebugScreenPutChar(int x, int y, u32 color, u8 ch);
00100
00104 void pspDebugScreenSetXY(int x, int y);
00105
00111 void pspDebugScreenSetOffset(int offset);
00112
00118 void pspDebugScreenSetBase(u32* base);
00119
00126 void pspDebugScreenSetMaxX(unsigned int maxx);
00127
00133 void pspDebugScreenSetMaxY(unsigned int maxy);
00134
00140 int pspDebugScreenGetX(void);
00141
00147 int pspDebugScreenGetY(void);
00148
00152 void pspDebugScreenClear(void);
00153
00162 int pspDebugScreenPrintData(const char *buff, int size);
00163
00171 int pspDebugScreenPuts(const char *str);
00172
00181 int pspDebugGetStackTrace(unsigned int* results, int max);
00182
00186 void pspDebugScreenClearLineEnable(void);
00187
00191 void pspDebugScreenClearLineDisable(void);
00192
00194 typedef struct _PspDebugRegBlock
00195 {
00196 u32 frame[6];
00198 u32 r[32];
00200 u32 status;
00202 u32 lo;
00203 u32 hi;
00204 u32 badvaddr;
00205 u32 cause;
00206 u32 epc;
00207 float fpr[32];
00208 u32 fsr;
00209 u32 fir;
00210 u32 frame_ptr;
00211 u32 unused;
00212
00213 u32 index;
00214 u32 random;
00215 u32 entrylo0;
00216 u32 entrylo1;
00217 u32 context;
00218 u32 pagemask;
00219 u32 wired;
00220 u32 cop0_7;
00221 u32 cop0_8;
00222 u32 cop0_9;
00223 u32 entryhi;
00224 u32 cop0_11;
00225 u32 cop0_12;
00226 u32 cop0_13;
00227 u32 cop0_14;
00228
00229 u32 prid;
00230 u32 padding[100];
00231 } PspDebugRegBlock;
00232
00234 typedef void (*PspDebugErrorHandler)(PspDebugRegBlock *regs);
00235
00243 int pspDebugInstallErrorHandler(PspDebugErrorHandler handler);
00244
00253 void pspDebugDumpException(PspDebugRegBlock *regs);
00254
00256 typedef int (*PspDebugKprintfHandler)(const char *format, u32 *args);
00257
00264 int pspDebugInstallKprintfHandler(PspDebugKprintfHandler handler);
00265
00267 typedef struct _PspDebugStackTrace
00268 {
00270 u32 call_addr;
00272 u32 func_addr;
00273 } PspDebugStackTrace;
00274
00287 int pspDebugGetStackTrace2(PspDebugRegBlock *regs, PspDebugStackTrace *trace, int max);
00288
00290 typedef struct _PspDebugProfilerRegs
00291 {
00292 volatile u32 enable;
00293 volatile u32 systemck;
00294 volatile u32 cpuck;
00295 volatile u32 internal;
00296 volatile u32 memory;
00297 volatile u32 copz;
00298 volatile u32 vfpu;
00299 volatile u32 sleep;
00300 volatile u32 bus_access;
00301 volatile u32 uncached_load;
00302 volatile u32 uncached_store;
00303 volatile u32 cached_load;
00304 volatile u32 cached_store;
00305 volatile u32 i_miss;
00306 volatile u32 d_miss;
00307 volatile u32 d_writeback;
00308 volatile u32 cop0_inst;
00309 volatile u32 fpu_inst;
00310 volatile u32 vfpu_inst;
00311 volatile u32 local_bus;
00312 } PspDebugProfilerRegs;
00313
00315 void pspDebugProfilerEnable(void);
00316
00318 void pspDebugProfilerDisable(void);
00319
00321 void pspDebugProfilerClear(void);
00322
00327 void pspDebugProfilerGetRegs(PspDebugProfilerRegs *regs);
00328
00330 void pspDebugProfilerPrint(void);
00331
00333 typedef int (*PspDebugPrintHandler)(const char *data, int len);
00334
00336 typedef int (*PspDebugInputHandler)(char *data, int len);
00337
00345 int pspDebugInstallStdinHandler(PspDebugInputHandler handler);
00346
00354 int pspDebugInstallStdoutHandler(PspDebugPrintHandler handler);
00355
00363 int pspDebugInstallStderrHandler(PspDebugPrintHandler handler);
00364
00370 void pspDebugSioPutchar(int ch);
00371
00377 int pspDebugSioGetchar(void);
00378
00384 void pspDebugSioPuts(const char *str);
00385
00394 int pspDebugSioPutData(const char *data, int len);
00395
00405 int pspDebugSioPutText(const char *data, int len);
00406
00411 void pspDebugSioInit(void);
00412
00417 void pspDebugSioSetBaud(int baud);
00418
00423 void pspDebugEnablePutchar(void);
00424
00430 void pspDebugSioInstallKprintf(void);
00431
00435 void pspDebugGdbStubInit(void);
00436
00440 void pspDebugBreakpoint(void);
00441
00445 void pspDebugSioEnableKprintf(void);
00446
00450 void pspDebugSioDisableKprintf(void);
00451
00454 #ifdef __cplusplus
00455 }
00456 #endif
00457
00458 #endif