pspdebug.h

Go to the documentation of this file.
00001 /*
00002  * PSP Software Development Kit - http://www.pspdev.org
00003  * -----------------------------------------------------------------------
00004  * Licensed under the BSD license, see LICENSE in PSPSDK root for details.
00005  *
00006  *  pspdebug.h - Prototypes for the pspDebug library
00007  *
00008  * Copyright (c) 2005 Marcus R. Brown <mrbrown@ocgnet.org>
00009  * Copyright (c) 2005 James Forshaw <tyranid@gmail.com>
00010  * Copyright (c) 2005 John Kelley <ps2dev@kelley.ca>
00011  *
00012  * $Id: pspdebug.h 2190 2007-02-25 21:00:40Z tyranid $
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 
00057 void pspDebugScreenSetBackColor(u32 color);
00058 
00064 void pspDebugScreenSetTextColor(u32 color);
00065 
00071 void pspDebugScreenSetColorMode(int mode);
00072 
00081 void pspDebugScreenPutChar(int x, int y, u32 color, u8 ch);
00082 
00086 void pspDebugScreenSetXY(int x, int y);
00087 
00093 void pspDebugScreenSetOffset(int offset);
00094 
00100 void pspDebugScreenSetBase(u32* base);
00101 
00107 int pspDebugScreenGetX(void);
00108 
00114 int pspDebugScreenGetY(void);
00115 
00119 void pspDebugScreenClear(void);
00120 
00129 int pspDebugScreenPrintData(const char *buff, int size);
00130 
00138 int pspDebugScreenPuts(const char *str);
00139 
00148 int pspDebugGetStackTrace(unsigned int* results, int max);
00149 
00151 typedef struct _PspDebugRegBlock
00152 {
00153         u32 frame[6];
00155         u32 r[32];
00157         u32 status;
00159         u32 lo;
00160         u32 hi;
00161         u32 badvaddr;
00162         u32 cause;
00163         u32 epc;
00164         float fpr[32];
00165         u32 fsr;
00166         u32 fir;
00167         u32 frame_ptr;
00168         u32 unused;
00169         /* Unused on PSP */
00170         u32 index;
00171         u32 random;
00172         u32 entrylo0;
00173         u32 entrylo1;
00174         u32 context;
00175         u32 pagemask;
00176         u32 wired;
00177         u32 cop0_7;
00178         u32 cop0_8;
00179         u32 cop0_9;
00180         u32 entryhi;
00181         u32 cop0_11;
00182         u32 cop0_12;
00183         u32 cop0_13;
00184         u32 cop0_14;
00185         /* PRId should still be okay */
00186         u32 prid;
00187         u32 padding[100];
00188 } PspDebugRegBlock;
00189 
00191 typedef void (*PspDebugErrorHandler)(PspDebugRegBlock *regs);
00192 
00200 int pspDebugInstallErrorHandler(PspDebugErrorHandler handler);
00201 
00210 void pspDebugDumpException(PspDebugRegBlock *regs);
00211 
00213 typedef int (*PspDebugKprintfHandler)(const char *format, u32 *args);
00214 
00221 int pspDebugInstallKprintfHandler(PspDebugKprintfHandler handler);
00222 
00224 typedef struct _PspDebugStackTrace
00225 {
00227         u32 call_addr;
00229         u32 func_addr;
00230 } PspDebugStackTrace;
00231 
00244 int pspDebugGetStackTrace2(PspDebugRegBlock *regs, PspDebugStackTrace *trace, int max);
00245 
00247 typedef struct _PspDebugProfilerRegs
00248 {
00249         volatile u32 enable;
00250         volatile u32 systemck;
00251         volatile u32 cpuck;
00252         volatile u32 internal;
00253         volatile u32 memory;
00254         volatile u32 copz;
00255         volatile u32 vfpu;
00256         volatile u32 sleep;
00257         volatile u32 bus_access;
00258         volatile u32 uncached_load;
00259         volatile u32 uncached_store;
00260         volatile u32 cached_load;
00261         volatile u32 cached_store;
00262         volatile u32 i_miss;
00263         volatile u32 d_miss;
00264         volatile u32 d_writeback;
00265         volatile u32 cop0_inst;
00266         volatile u32 fpu_inst;
00267         volatile u32 vfpu_inst;
00268         volatile u32 local_bus;
00269 } PspDebugProfilerRegs;
00270 
00272 void pspDebugProfilerEnable(void);
00273 
00275 void pspDebugProfilerDisable(void);
00276 
00278 void pspDebugProfilerClear(void);
00279 
00284 void pspDebugProfilerGetRegs(PspDebugProfilerRegs *regs);
00285 
00287 void pspDebugProfilerPrint(void);
00288 
00290 typedef int (*PspDebugPrintHandler)(const char *data, int len);
00291 
00293 typedef int (*PspDebugInputHandler)(char *data, int len);
00294 
00302 int pspDebugInstallStdinHandler(PspDebugInputHandler handler);
00303 
00311 int pspDebugInstallStdoutHandler(PspDebugPrintHandler handler);
00312 
00320 int pspDebugInstallStderrHandler(PspDebugPrintHandler handler);
00321 
00327 void pspDebugSioPutchar(int ch);
00328 
00334 int pspDebugSioGetchar(void);
00335 
00341 void pspDebugSioPuts(const char *str);
00342 
00351 int pspDebugSioPutData(const char *data, int len);
00352 
00362 int pspDebugSioPutText(const char *data, int len);
00363 
00368 void pspDebugSioInit(void);
00369 
00374 void pspDebugSioSetBaud(int baud);
00375 
00380 void pspDebugEnablePutchar(void);
00381 
00387 void pspDebugSioInstallKprintf(void);
00388 
00392 void pspDebugGdbStubInit(void);
00393 
00397 void pspDebugBreakpoint(void);
00398 
00402 void pspDebugSioEnableKprintf(void);
00403 
00407 void pspDebugSioDisableKprintf(void);
00408 
00411 #ifdef __cplusplus
00412 }
00413 #endif
00414 
00415 #endif

Generated on Tue Jul 24 15:21:22 2007 for PSPSDK-Rev2272 by  doxygen 1.5.2