mirror of
https://github.com/dborth/snes9xgx.git
synced 2025-03-10 21:37:43 +01:00
add code for usb gecko debugging
This commit is contained in:
parent
6b46b52cf3
commit
62835600e5
@ -65,6 +65,10 @@ int ExitRequested = 0;
|
|||||||
char appPath[1024];
|
char appPath[1024];
|
||||||
int appLoadMethod = METHOD_AUTO;
|
int appLoadMethod = METHOD_AUTO;
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
extern void __exception_setreload(int t);
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Shutdown / Reboot / Exit
|
* Shutdown / Reboot / Exit
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
@ -314,6 +318,60 @@ static void CreateAppPath(char origpath[])
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* USB Gecko Debugging
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
static bool gecko = false;
|
||||||
|
static mutex_t gecko_mutex = 0;
|
||||||
|
|
||||||
|
static ssize_t __out_write(struct _reent *r, int fd, const char *ptr, size_t len)
|
||||||
|
{
|
||||||
|
u32 level;
|
||||||
|
|
||||||
|
if (!ptr || len <= 0 || !gecko)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
LWP_MutexLock(gecko_mutex);
|
||||||
|
level = IRQ_Disable();
|
||||||
|
usb_sendbuffer(1, ptr, len);
|
||||||
|
IRQ_Restore(level);
|
||||||
|
LWP_MutexUnlock(gecko_mutex);
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
const devoptab_t gecko_out = {
|
||||||
|
"stdout", // device name
|
||||||
|
0, // size of file structure
|
||||||
|
NULL, // device open
|
||||||
|
NULL, // device close
|
||||||
|
__out_write,// device write
|
||||||
|
NULL, // device read
|
||||||
|
NULL, // device seek
|
||||||
|
NULL, // device fstat
|
||||||
|
NULL, // device stat
|
||||||
|
NULL, // device link
|
||||||
|
NULL, // device unlink
|
||||||
|
NULL, // device chdir
|
||||||
|
NULL, // device rename
|
||||||
|
NULL, // device mkdir
|
||||||
|
0, // dirStateSize
|
||||||
|
NULL, // device diropen_r
|
||||||
|
NULL, // device dirreset_r
|
||||||
|
NULL, // device dirnext_r
|
||||||
|
NULL, // device dirclose_r
|
||||||
|
NULL // device statvfs_r
|
||||||
|
};
|
||||||
|
|
||||||
|
void USBGeckoOutput()
|
||||||
|
{
|
||||||
|
LWP_MutexInit(&gecko_mutex, false);
|
||||||
|
gecko = usb_isgeckoalive(1);
|
||||||
|
|
||||||
|
devoptab_list[STD_OUT] = &gecko_out;
|
||||||
|
devoptab_list[STD_ERR] = &gecko_out;
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* MAIN
|
* MAIN
|
||||||
*
|
*
|
||||||
@ -331,6 +389,9 @@ static void CreateAppPath(char origpath[])
|
|||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
//USBGeckoOutput(); // uncomment to enable USB gecko output
|
||||||
|
__exception_setreload(8);
|
||||||
|
|
||||||
#ifdef HW_DOL
|
#ifdef HW_DOL
|
||||||
ipl_set_config(6); // disable Qoob modchip
|
ipl_set_config(6); // disable Qoob modchip
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user