| View previous topic :: View next topic |
| Author |
Message |
phobox
Joined: 24 Mar 2008 Posts: 140
|
Posted: Sat Jul 04, 2009 11:09 pm Post subject: gpio question |
|
|
looking at lowio.prx I discovered how sceGpioPortRead, sceGpioPortSet and sceGpioPortClear are defined:
| Code: |
int sceGpioPortRead ()
{
return = *((int *) 0xBE240004);
}
void sceGpioPortSet (int arg1)
{
*((int *) 0xBE240008) = arg1;
__asm__ ("sync;");
return;
}
void sceGpioPortClear (int arg1)
{
*((int *) 0xBE24000C) = arg1;
__asm__ ("sync;");
return;
}
|
knowing that sceGpioSet(0x80) will turn on the WLAN led and sceGpioSet(0x40) will turn on the MS one
and that sceGpioClear(0x80) will turn wlan led off and with arg 0x40 the ms led..
so.. portSet will set the value passed as an argument at address 0xBE240008
but if i do something like
sceGpioSet(0x80)
sceGpioSet(0x40)
both leds are on, BUT the value at 0xBE240008 is overwritten
then another thing that i cannot understand is why in the three functions the addresses are different...
and what about the "sync"?
thanks _________________ Ciao! from Italy |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Sun Jul 05, 2009 12:16 am Post subject: |
|
|
| They use separate addresses because it's hardware. Writing to one address will cause the set bits to be set in the hardware. They will stay set until you write to the other address, where set bits will clear that bit in the hardware. It's pretty common in various things. You could combine the LED and MS by writing 0xC0, which is just both bits 0x80 and 0x40. Anywho, it's pretty common to put a sync after writing to hardware - it makes sure the hardware bus transfer is done before continuing. |
|
| Back to top |
|
 |
phobox
Joined: 24 Mar 2008 Posts: 140
|
Posted: Sun Jul 05, 2009 12:34 am Post subject: |
|
|
ok, i understand thank you!.
but from now on, things can be discovered only by testing, is no more possible to "reverse" i mean, to discover the 0x80 an 0x40 values i can only look (for example) at led.prx, but not "inside" gpio..
am i right?
and since i'm writing, where can i get more info on gpio?, what is it in psp hardware? is it a chip? is it like syscon?
thanks _________________ Ciao! from Italy |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Sun Jul 05, 2009 4:41 am Post subject: |
|
|
| phobox wrote: | ok, i understand thank you!.
but from now on, things can be discovered only by testing, is no more possible to "reverse" i mean, to discover the 0x80 an 0x40 values i can only look (for example) at led.prx, but not "inside" gpio..
am i right?
and since i'm writing, where can i get more info on gpio?, what is it in psp hardware? is it a chip? is it like syscon?
thanks |
Once you hit the hardware, you either need to know more functions like the one to set the power or ms leds, or you just have to poke the hardware with different values and see what happens. The latter can sometimes get you in trouble if the values do something bad, so it's better to RE functions if you have them.
GPIO means General Purpose Input/Output. It's a register in the hardware that simply buffers lines that do things, like control the LEDs or connect to switches or similar hardware related things. I seem to remember old threads with some info on the GPIO - you might try searching the old threads. |
|
| Back to top |
|
 |
Dariusc123456
Joined: 12 Aug 2008 Posts: 394
|
Posted: Sun Jul 05, 2009 4:44 am Post subject: Re: gpio question |
|
|
| phobox wrote: | looking at lowio.prx I discovered how sceGpioPortRead, sceGpioPortSet and sceGpioPortClear are defined:
| Code: |
int sceGpioPortRead ()
{
return = *((int *) 0xBE240004);
}
void sceGpioPortSet (int arg1)
{
*((int *) 0xBE240008) = arg1;
__asm__ ("sync;");
return;
}
void sceGpioPortClear (int arg1)
{
*((int *) 0xBE24000C) = arg1;
__asm__ ("sync;");
return;
}
|
knowing that sceGpioSet(0x80) will turn on the WLAN led and sceGpioSet(0x40) will turn on the MS one
and that sceGpioClear(0x80) will turn wlan led off and with arg 0x40 the ms led..
so.. portSet will set the value passed as an argument at address 0xBE240008
but if i do something like
sceGpioSet(0x80)
sceGpioSet(0x40)
both leds are on, BUT the value at 0xBE240008 is overwritten
then another thing that i cannot understand is why in the three functions the addresses are different...
and what about the "sync"?
thanks |
the "int argX" stands for the number of arguments for that function. Its runs differently than what you might think. _________________ PSHN - Playstation Hacking Network
PSX/PS1 - HACK - Game Shark
PS2 - HACK - Swap
PSP - HACK - Pandora
PS3 - ? |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Sun Jul 05, 2009 8:48 am Post subject: |
|
|
| Why are you posting a non-answer to a question I already answered? Try reading the thread to see if there are still questions before posting, especially when your post doesn't give any extra info. |
|
| Back to top |
|
 |
phobox
Joined: 24 Mar 2008 Posts: 140
|
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Tue Jul 07, 2009 12:09 am Post subject: |
|
|
| That's the one I remember - notice that someone made defines for the bits/lines handling the LEDs and the IRDA, among other things. |
|
| Back to top |
|
 |
phobox
Joined: 24 Mar 2008 Posts: 140
|
Posted: Tue Jul 07, 2009 1:23 am Post subject: |
|
|
ok in this one are wiriiten strange things...
eg
sceGpioPortSet(0x00000003);
is
_sw(0xBE240008, _lw(0xBE240008) | 0x00000003);
and another one
sceGpioPortClear(0x00000003);
is
_sw(0xBE240008, _lw(0xBE240008) | 0x00000003);
now there are two things to consider: i did't understand that that code is right (but i don't think so) OR that info is incorrect or old.
-----------
by my self ( a bit of testing) i figured out that if I call
sceGpioPortSet(0x80)
to turn the wlan led on, the value returned with
sceGpioPortRead(); is the default value + 0x80.
the default value is 0x07000027.
if i do (for example)
sceGpioPortSet(0x80)
sceGpioPortSet(0x40)
sceGpioPortRead() will return 0x070000E7, that is 0x07000027 + 0x80 + 0x40
in other words, portSet will add the arg value to the gpio and portClear will subtract it....
EDIT: another thing, if I simply call sceGpioPortSet(led) the led will simply flash and then it turns off, to keep it on you need to keep calling that function.
don't know why this.... _________________ Ciao! from Italy |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Tue Jul 07, 2009 3:56 am Post subject: |
|
|
Yeah, there probably are some problems with some of that old hardware info... remember that most of that stuff is only slightly researched - there wasn't much need for that for the majority of homebrew.
The LED flashing is probably due to a system function setting the LEDs to what it thinks they are supposed to be periodically. You'd have to find where it stores its copy of what to set the GPIO to, or hook that function to make the LEDs not flash. Again, that's something that really hasn't been looked into much. |
|
| Back to top |
|
 |
|