forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DIsabling the watchdog (sorta)

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Thu Dec 28, 2006 7:06 am    Post subject: DIsabling the watchdog (sorta) Reply with quote

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:
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 :)
Back to top
View user's profile Send private message
groepaz



Joined: 01 Sep 2005
Posts: 305

PostPosted: Mon Jan 01, 2007 2:56 am    Post subject: Reply with quote

cool, so the missing bit diving into the gpio driver eh? =)
_________________
http://www.hitmen-console.org
http://hitmen.c02.at/files/yapspd/
Back to top
View user's profile Send private message Visit poster's website
sea_monster



Joined: 28 Mar 2006
Posts: 7
Location: atlantic

PostPosted: Wed Jan 03, 2007 7:30 pm    Post subject: Thats great news! Reply with quote

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??
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
adrahil



Joined: 16 Mar 2006
Posts: 277

PostPosted: Thu Jan 04, 2007 3:07 am    Post subject: Reply with quote

use a stub.
Back to top
View user's profile Send private message
sea_monster



Joined: 28 Mar 2006
Posts: 7
Location: atlantic

PostPosted: Thu Jan 04, 2007 5:41 am    Post subject: Use a stub! Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
adrahil



Joined: 16 Mar 2006
Posts: 277

PostPosted: Thu Jan 04, 2007 2:58 pm    Post subject: Reply with quote

Wise ass answer... I like it :) Put this into a file with a .S extension (as assembler source code):
Code:
   .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.
Back to top
View user's profile Send private message
sea_monster



Joined: 28 Mar 2006
Posts: 7
Location: atlantic

PostPosted: Thu Jan 04, 2007 3:35 pm    Post subject: salty brine Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group