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 

PSP Slim RAM partitions
Goto page Previous  1, 2
 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Cpasjuste



Joined: 29 May 2005
Posts: 214

PostPosted: Mon Sep 24, 2007 9:00 am    Post subject: Reply with quote

Yep its really cool :)

The main problem now is to rewrite all the code of most of my homebrews :/ I still can't understand some strange things while coding for the 3.71, sometime a function work, i remove a printf then nothing work anymore. I have a lot of strange things like this.
Back to top
View user's profile Send private message
mypspdev



Joined: 11 Jul 2007
Posts: 178

PostPosted: Thu Oct 04, 2007 5:34 pm    Post subject: Reply with quote

Is anybody updating this page
http://wiki.ps2dev.org/psp:memory_map
on RAM partion for S&L too?

Thanks, by best to all
Back to top
View user's profile Send private message
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Thu Oct 04, 2007 9:57 pm    Post subject: Reply with quote

mypspdev wrote:
Is anybody updating this page
http://wiki.ps2dev.org/psp:memory_map
on RAM partion for S&L too?

Thanks, by best to all


And they shouldn't call "kernel partition" to the volatile one too :p
User modules can be loaded there while kernel ones can't, so it is not definitely an appropiate name.
Back to top
View user's profile Send private message
mypspdev



Joined: 11 Jul 2007
Posts: 178

PostPosted: Wed Oct 17, 2007 1:29 am    Post subject: Reply with quote

I'm trying to investigate on, just as an exercise:

Code:
void check_RAM()
{
   int i;
   PspSysmemPartitionInfo pinfo;
   for(i = 0; i < 6; i++)
   {
      memset(&pinfo, 0, sizeof(pinfo));
      pinfo.size = sizeof(pinfo);
      sceKernelQueryMemoryPartitionInfo(i + 1, &pinfo);
      printf( "%u  0x%08x  0x%08x  0x%08x 0x%08x 0x%x", i + 1, pinfo.memsize, pinfo.startaddr, sceKernelPartitionTotalFreeMemSize (i + 1), sceKernelPartitionMaxFreeMemSize (i + 1), pinfo.attr);
   }
}


But it doesn't work properly.

Could please anyone check whet's wrong? thanks in advance
Back to top
View user's profile Send private message
mypspdev



Joined: 11 Jul 2007
Posts: 178

PostPosted: Wed Oct 17, 2007 6:52 am    Post subject: Reply with quote

Solved:

#step 1 Create a prx under 1.50 kernel

Code:
#include <pspsdk.h>
#include <pspkernel.h>
#include <pspctrl.h>
#include <string.h>
#include <pspsysmem_kernel.h>


PSP_MODULE_INFO("MyRAMPRX", 0x1006, 1, 1);
PSP_MAIN_THREAD_ATTR(0);


int PTotFreeMemSize(int i)
{
   u32 k1;
       k1 = pspSdkSetK1(0);
   int pttfms=sceKernelPartitionTotalFreeMemSize(i);
   pspSdkSetK1(k1);
   return pttfms;
}

int PMaxFreeMemSize(int i)
{
   u32 k1;
       k1 = pspSdkSetK1(0);
   int ptmfms=sceKernelPartitionMaxFreeMemSize(i);
   pspSdkSetK1(k1);
   return ptmfms;
}

PspSysmemPartitionInfo RAMpinfo(int i)
{
   u32 k1;
       k1 = pspSdkSetK1(0);
   PspSysmemPartitionInfo pinfo;

   memset(&pinfo, 0, sizeof(pinfo));
   pinfo.size = sizeof(pinfo);
   sceKernelQueryMemoryPartitionInfo(i, &pinfo);

   pspSdkSetK1(k1);
   return pinfo;
}


int module_start(SceSize args, void *argp)
{
   return 0;
}

int module_stop()
{
   return 0;
}


#step 2: create a main program 3.xx calling RAMprx:

Code:
#include <pspsdk.h>
#include <pspkernel.h>
#include <pspctrl.h>
#include <string.h>
#include <pspsysmem_kernel.h>

PSP_MODULE_INFO("MyRAMPRXLoader", 0, 1, 0);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER);
PSP_HEAP_SIZE_KB(2500);

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Functions imported from prx:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int PMaxFreeMemSize(int i);
int PTotFreeMemSize(int i);
PspSysmemPartitionInfo RAMpinfo(int i);

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Globals:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Main:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
int main(){
   SceUID modid;

   pspDebugScreenInit();

      
   pspDebugScreenPrintf("Eboot test\n");

   modid = pspSdkLoadStartModule("MyRAMPRX.prx", PSP_MEMORY_PARTITION_KERNEL);
   if (modid < 0){
      pspDebugScreenPrintf("Error 0x%08X loading/starting MyRAMPRX.prx.\n", modid);
        sceKernelDelayThread(5*1000*1000);
        return -1;
   }

   pspDebugScreenPrintf("Module ID %08X\n", modid);
   int i=0;
   for (i=1;i<7;i++)
   {
      int k=PTotFreeMemSize(i);
      pspDebugScreenPrintf("Total Free Mem Size - Partition %u 0x%08x  ", i, k);
      pspDebugScreenPrintf(" \n");
      int pmfms=PMaxFreeMemSize(i);
      pspDebugScreenPrintf("Max Free Mem Size - Partition %u 0x%08x  ",i , pmfms);
      pspDebugScreenPrintf(" \n");
      PspSysmemPartitionInfo pinfo;
      pinfo=RAMpinfo(i);
      pspDebugScreenPrintf( "Partition %u - memsize: 0x%08x start addr: 0x%08x attr: 0x%x",  i, pinfo.memsize, pinfo.startaddr, pinfo.attr);
      pspDebugScreenPrintf(" \n");
   }

      pspDebugScreenPrintf("Press X to quit\n");


      SceCtrlData pad;
      while(1){
      sceCtrlReadBufferPositive(&pad, 1);
      if (pad.Buttons & PSP_CTRL_CROSS){
          break;
      }
      }
   sceKernelExitGame();
      return 0;
}
Back to top
View user's profile Send private message
cloudhunter



Joined: 17 Aug 2006
Posts: 86

PostPosted: Wed Oct 17, 2007 8:16 am    Post subject: Reply with quote

Quote:
#step 1 Create a prx under 1.50 kernel


I'm no expert, but that is incorrect. I believe you actually make a kernel mode prx.

Cloudy
_________________
:)
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Wed Oct 17, 2007 10:37 am    Post subject: Reply with quote

cloudhunter wrote:
Quote:
#step 1 Create a prx under 1.50 kernel


I'm no expert, but that is incorrect. I believe you actually make a kernel mode prx.

Cloudy


Yes. Running in kernel mode does not necessarily mean 1.50 firmware. :)
Back to top
View user's profile Send private message AIM Address
mypspdev



Joined: 11 Jul 2007
Posts: 178

PostPosted: Wed Oct 17, 2007 4:52 pm    Post subject: Reply with quote

I apologize for used terminology, but finally it works fine: I have RAM Partition info from Fat and S&L.
It was impossible to do it within 3.xx I needed the prx to be called.
If anybody wants zip file, it's available.
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Wed Oct 17, 2007 4:55 pm    Post subject: Reply with quote

Well, it stands to reason that those functions would need to be called from kernel mode seeing as how they return info about kernel mode partitions. They aren't about to give you that info in user mode. :)
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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