| View previous topic :: View next topic |
| Author |
Message |
coolkehon
Joined: 20 Oct 2008 Posts: 355
|
Posted: Fri Jun 19, 2009 12:41 pm Post subject: Scratchpad and psplink memory free |
|
|
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 |
|
| Back to top |
|
 |
Jim

Joined: 02 Jul 2005 Posts: 487 Location: Sydney
|
|
| Back to top |
|
 |
coolkehon
Joined: 20 Oct 2008 Posts: 355
|
Posted: Sat Jun 20, 2009 8:21 am Post subject: |
|
|
| so how do i use it |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Sat Jun 20, 2009 9:20 am Post subject: |
|
|
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_doc/chap7.html#sec7 |
|
| Back to top |
|
 |
hlide
Joined: 10 Sep 2006 Posts: 750
|
Posted: Sat Jun 20, 2009 9:26 am Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
coolkehon
Joined: 20 Oct 2008 Posts: 355
|
Posted: Sat Jun 20, 2009 9:36 am Post subject: |
|
|
| 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_doc/chap7.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 |
|
| Back to top |
|
 |
coolkehon
Joined: 20 Oct 2008 Posts: 355
|
Posted: Sat Jun 20, 2009 9:46 am Post subject: |
|
|
so how do i bang on it directly
lol ;) |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Sat Jun 20, 2009 10:32 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
coolkehon
Joined: 20 Oct 2008 Posts: 355
|
Posted: Sat Jun 20, 2009 1:56 pm Post subject: |
|
|
| 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 |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Sat Jun 20, 2009 2:18 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
coolkehon
Joined: 20 Oct 2008 Posts: 355
|
Posted: Sat Jun 20, 2009 7:22 pm Post subject: |
|
|
| 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 |
|
| Back to top |
|
 |
Jim

Joined: 02 Jul 2005 Posts: 487 Location: Sydney
|
Posted: Sat Jun 20, 2009 10:36 pm Post subject: |
|
|
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 _________________ http://www.dbfinteractive.com |
|
| Back to top |
|
 |
hlide
Joined: 10 Sep 2006 Posts: 750
|
Posted: Sun Jun 21, 2009 12:11 am Post subject: |
|
|
| 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... |
|
| Back to top |
|
 |
coolkehon
Joined: 20 Oct 2008 Posts: 355
|
Posted: Sun Jun 21, 2009 3:59 am Post subject: |
|
|
| just gonna use it to communicate between prx's because its a static address and stays the same and is extra memory |
|
| Back to top |
|
 |
coolkehon
Joined: 20 Oct 2008 Posts: 355
|
Posted: Mon Jun 29, 2009 8:08 am Post subject: |
|
|
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: | | PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_SCRATCH_SRAM | THREAD_ATTR_USER | THREAD_ATTR_VFPU ); |
so how would i use this |
|
| Back to top |
|
 |
coolkehon
Joined: 20 Oct 2008 Posts: 355
|
Posted: Mon Jun 29, 2009 8:16 am Post subject: |
|
|
| seems i can use it without defining that although why would i need to define it if thats the case |
|
| Back to top |
|
 |
|