Scratchpad and psplink memory free

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

Moderators: cheriff, TyRaNiD

Post Reply
coolkehon
Posts: 355
Joined: Mon Oct 20, 2008 5:44 am

Scratchpad and psplink memory free

Post by coolkehon »

my app is going to be stressed for memory so i'm trying to use all that i can because the main desktop uses 7000KB heap (so far) and is 1.3 MB in size (so far and rising) and another one that is 1.3 MB in size and 2000KB heap so i noticed the scratch pad on psplink so i want to know how can i use the scratch pad maybe for temp stuff like an in memory swap or something and what is the scratchpad

also what are those other partions on psplink when i do memreg and how can i find the one that my app is using because there should be two one for the main eboot and one for the desktop eboot
User avatar
Jim
Posts: 476
Joined: Sat Jul 02, 2005 10:06 pm
Location: Sydney
Contact:

Post by Jim »

Scratchpad is 4Kb of fast memory at 0x100000.

Jim
coolkehon
Posts: 355
Joined: Mon Oct 20, 2008 5:44 am

Post by coolkehon »

so how do i use it
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

Set PSP_THREAD_ATTR_SCRATCH_SRAM along with PSP_THREAD_ATTR_USER for your program, then bang on it directly. If I remember correctly, you're also supposed to clear the scratch ram before you exit the program.

Also, YAPSPD says it's 16 KB, not 4.

http://hitmen.c02.at/files/yapspd/psp_d ... .html#sec7
hlide
Posts: 739
Joined: Sun Sep 10, 2006 2:31 am

Post by hlide »

Jim wrote:Scratchpad is 4Kb of fast memory at 0x100000.

Jim
"fast" memory ? are you kidding :P ? it is 16 KB and not 4 KB and surely not fast the way it is connected to bus.
coolkehon
Posts: 355
Joined: Mon Oct 20, 2008 5:44 am

Post by coolkehon »

J.F. wrote:Set PSP_THREAD_ATTR_SCRATCH_SRAM along with PSP_THREAD_ATTR_USER for your program, then bang on it directly. If I remember correctly, you're also supposed to clear the scratch ram before you exit the program.

Also, YAPSPD says it's 16 KB, not 4.

http://hitmen.c02.at/files/yapspd/psp_d ... .html#sec7
so if i do that then how do i use it and how much faster is it and also where can i find PSP_THREAD_ATTR_SCRATCH_SRAM
coolkehon
Posts: 355
Joined: Mon Oct 20, 2008 5:44 am

Post by coolkehon »

so how do i bang on it directly







lol ;)
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

The one constant is in the same h file as the other. If you set USER fine, the other will set fine as well.

int *x = 0x00010000;

*x = y;
x[23] = y;
Etc.

Just use pointers.
coolkehon
Posts: 355
Joined: Mon Oct 20, 2008 5:44 am

Post by coolkehon »

am i correct in saying that the correct size is 16383 bytes tried to use gcalctool to do math with start and end addresses and it seems about right
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

Just look at my link above to YAPSPD. It tells you the start and end in hex.

0x00010000 to 0x00013FFF, or 0x4000 long... which is 4x4k = 16k = 16*1024
coolkehon
Posts: 355
Joined: Mon Oct 20, 2008 5:44 am

Post by coolkehon »

J.F. wrote:Just look at my link above to YAPSPD. It tells you the start and end in hex.

0x00010000 to 0x00013FFF, or 0x4000 long... which is 4x4k = 16k = 16*1024
yeah so i'm right just making sure my hex math was right cause i wasnt sure if it was exactly 16k or roughly 16k like 16.3k or some odd number

thanks
User avatar
Jim
Posts: 476
Joined: Sat Jul 02, 2005 10:06 pm
Location: Sydney
Contact:

Post by Jim »

OK, so the reference I found is old... :(

On the PS1 the scratchpad was a great place to build stuff. Is that not the case on PSP?

I hope the extra 16K solves the OP's problem :D

Jim
hlide
Posts: 739
Joined: Sun Sep 10, 2006 2:31 am

Post by hlide »

Jim wrote:OK, so the reference I found is old... :(

On the PS1 the scratchpad was a great place to build stuff. Is that not the case on PSP?

I hope the extra 16K solves the OP's problem :D

Jim
Indeed, it is useless if the goal is for performance because this scratch pad is not connected directly to CPU but is accessible only through the BUS the same way it is for main ram so at the BUS frequency. Bad design...
coolkehon
Posts: 355
Joined: Mon Oct 20, 2008 5:44 am

Post by coolkehon »

just gonna use it to communicate between prx's because its a static address and stays the same and is extra memory
coolkehon
Posts: 355
Joined: Mon Oct 20, 2008 5:44 am

Post by coolkehon »

i tried to use it by adding like this and it hangs the psp actually took a while to trace the problem because it was in a prx

Code: Select all

PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_SCRATCH_SRAM | THREAD_ATTR_USER | THREAD_ATTR_VFPU );
so how would i use this
coolkehon
Posts: 355
Joined: Mon Oct 20, 2008 5:44 am

Post by coolkehon »

seems i can use it without defining that although why would i need to define it if thats the case
Post Reply