DIsabling the watchdog (sorta)

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

DIsabling the watchdog (sorta)

Post by TyRaNiD »

Well after much pissing around I finally narrowed down the place where the PSP calms the watchdog to prevent it from powering off when interrupts are disabled.

The code is called from the GPIO interrupt (4) sub interrupt 4 in SYSCON, the important bits are:

Code: Select all

void sceGpioPortClear(int port);
int sceGpioPortSet(int);

void clear_watchdog(void) {
sceGpioPortClear(8);
sceGpioPortSet(8);
}
This must be called on a regular basis while interrupts are disabled to prevent shutdown. Alas I am yet to actually get the PSP to recover after spending so long with interrupts disabled, though at least SIO still works :)
User avatar
groepaz
Posts: 305
Joined: Thu Sep 01, 2005 7:44 am
Contact:

Post by groepaz »

cool, so the missing bit diving into the gpio driver eh? =)
sea_monster
Posts: 7
Joined: Tue Mar 28, 2006 5:04 pm
Location: atlantic
Contact:

Thats great news!

Post by sea_monster »

Now how come I can't seem to find any reference to this "sceGpioPortClear" function in my entire toolchain?

I just updated the SDK using their toolchain download+build script.

How do I use it??
adrahil
Posts: 274
Joined: Thu Mar 16, 2006 1:55 am

Post by adrahil »

use a stub.
sea_monster
Posts: 7
Joined: Tue Mar 28, 2006 5:04 pm
Location: atlantic
Contact:

Use a stub!

Post by sea_monster »

a "stub" is a word for a bit of code that is only there to invoke another bit of code, like if bridging from C code to ASM code in a design, or whatever, jumping into some code from a compiler w/ a different calling convention, etc.

So I assume what you mean was "Write a stub function that invokes the proper function in the PSP resident firmware." That means finding the proper function in the PSP firmware, and also knowing its parameter types and return value.

Since I'm not familiar with PSP programming, "Use a stub" doesn't really help me any. And I imagine if I knew what a "stub" was, in the context of PSP hacking, I probably wouldn't have been asking my original question!

So, could you tell me exactly what to point this Stub to?

Thanks
adrahil
Posts: 274
Joined: Thu Mar 16, 2006 1:55 am

Post by adrahil »

Wise ass answer... I like it :) Put this into a file with a .S extension (as assembler source code):

Code: Select all

	.set noreorder

#include "pspstub.s"

	STUB_START	"sceGpio_driver",0x00010000,0x00120005
	STUB_FUNC	0xEABDB328,sceGpioInit
	STUB_FUNC	0x4A992B24,sceGpioEnd
	STUB_FUNC	0x17DAA8C2,sceGpioSuspend
	STUB_FUNC	0x64CD4536,sceGpioResume
	STUB_FUNC	0x4250D44A,sceGpioPortRead
	STUB_FUNC	0x310F0CCF,sceGpioPortSet
	STUB_FUNC	0x103C3EB2,sceGpioPortClear
	STUB_FUNC	0x95135905,sceGpio_driver_95135905
	STUB_FUNC	0x317D9D2C,sceGpioSetPortMode
	STUB_FUNC	0xCA8BE2EA,sceGpioGetPortMode
	STUB_FUNC	0x37C8DADC,sceGpioSetIntrMode
	STUB_FUNC	0xF856CE46,sceGpioGetIntrMode
	STUB_FUNC	0x785206CD,sceGpioEnableIntr
	STUB_FUNC	0x95D7F3B8,sceGpioDisableIntr
	STUB_FUNC	0x31F34AE6,sceGpioQueryIntr
	STUB_FUNC	0xBE77D1D0,sceGpioAcquireIntr
	STUB_FUNC	0xC6928224,sceGpio_driver_C6928224
	STUB_FUNC	0x6B38B826,sceGpio_driver_6B38B826
	STUB_END
This is a stub file :) Enjoy :P There probably is some documentation about it, but I don't know where... Search the forums, although it is very rare to use stubs for something (since the sdk is quite exhaustive) :)
Link to the .o file of the same name as the .S, and it will not need any supplementary library.
sea_monster
Posts: 7
Joined: Tue Mar 28, 2006 5:04 pm
Location: atlantic
Contact:

salty brine

Post by sea_monster »

Ah!!! Very nice!!! The stupid timeout bug is no longer. I have complete control over my PSP without having it reboot on me.

The asm code to accomplish what the sceGpioSet/etc funcs do is very simple. I knew it had to be something like this. Kudos to you, and to tyranid.

Your help in this matter is appreciated. If you ever find yourself in the ocean, don't hesitate to look me up.


-s. monster
Post Reply