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 

Scratchpad and psplink memory free

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



Joined: 20 Oct 2008
Posts: 355

PostPosted: Fri Jun 19, 2009 12:41 pm    Post subject: Scratchpad and psplink memory free Reply with quote

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
View user's profile Send private message MSN Messenger
Jim



Joined: 02 Jul 2005
Posts: 487
Location: Sydney

PostPosted: Sat Jun 20, 2009 7:45 am    Post subject: Reply with quote

Scratchpad is 4Kb of fast memory at 0x100000.

Jim
_________________
http://www.dbfinteractive.com
Back to top
View user's profile Send private message Visit poster's website
coolkehon



Joined: 20 Oct 2008
Posts: 355

PostPosted: Sat Jun 20, 2009 8:21 am    Post subject: Reply with quote

so how do i use it
Back to top
View user's profile Send private message MSN Messenger
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sat Jun 20, 2009 9:20 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
hlide



Joined: 10 Sep 2006
Posts: 750

PostPosted: Sat Jun 20, 2009 9:26 am    Post subject: Reply with quote

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
View user's profile Send private message
coolkehon



Joined: 20 Oct 2008
Posts: 355

PostPosted: Sat Jun 20, 2009 9:36 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
coolkehon



Joined: 20 Oct 2008
Posts: 355

PostPosted: Sat Jun 20, 2009 9:46 am    Post subject: Reply with quote

so how do i bang on it directly







lol ;)
Back to top
View user's profile Send private message MSN Messenger
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sat Jun 20, 2009 10:32 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
coolkehon



Joined: 20 Oct 2008
Posts: 355

PostPosted: Sat Jun 20, 2009 1:56 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sat Jun 20, 2009 2:18 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
coolkehon



Joined: 20 Oct 2008
Posts: 355

PostPosted: Sat Jun 20, 2009 7:22 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
Jim



Joined: 02 Jul 2005
Posts: 487
Location: Sydney

PostPosted: Sat Jun 20, 2009 10:36 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
hlide



Joined: 10 Sep 2006
Posts: 750

PostPosted: Sun Jun 21, 2009 12:11 am    Post subject: Reply with quote

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
View user's profile Send private message
coolkehon



Joined: 20 Oct 2008
Posts: 355

PostPosted: Sun Jun 21, 2009 3:59 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
coolkehon



Joined: 20 Oct 2008
Posts: 355

PostPosted: Mon Jun 29, 2009 8:08 am    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
coolkehon



Joined: 20 Oct 2008
Posts: 355

PostPosted: Mon Jun 29, 2009 8:16 am    Post subject: Reply with quote

seems i can use it without defining that although why would i need to define it if thats the case
Back to top
View user's profile Send private message 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