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 

scePower Question

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



Joined: 18 Jun 2006
Posts: 8

PostPosted: Sun Jul 02, 2006 8:25 pm    Post subject: scePower Question Reply with quote

Is there a way to set the cpu clock frequency on 1.5 and when you exit that program, the clock still remains at the frequency set.

Thanks
Back to top
View user's profile Send private message
pegasus21



Joined: 18 Jun 2006
Posts: 8

PostPosted: Mon Jul 03, 2006 4:42 pm    Post subject: Reply with quote

Ok, I've read that only via a loadmodule will the cpu be able to stick at the rate I've set so I came up with the following code but I'm unable to load the module. I get a 80020001 error code.

Code:
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspdisplay.h>
#include <stdio.h>
#include <pspmoduleinfo.h>

/* Define the module info section */
//PSP_MODULE_INFO("CPU Test", 0, 0, 71);
PSP_MODULE_INFO("CPU TEST", 0x1000, 1, 1);
PSP_MAIN_THREAD_ATTR(0);

/* Define printf, just to make typing easier */
#define printf  pspDebugScreenPrintf

/**
 * Function that is called from _init in kernelmode before the
 * main thread is started in usermode.
 */
__attribute__ ((constructor))
void loaderInit()
{
    pspKernelSetKernelPC();
    pspSdkInstallNoDeviceCheckPatch();
    pspSdkInstallNoPlainModuleCheckPatch();
    pspDebugInstallKprintfHandler(NULL);
}

int LoadThread() {
   SceUID moduid;
   int start;
   char *eboot = "flash0:/vsh/module/vshmain.prx";

   if ((moduid = sceKernelLoadModule(eboot, 0, NULL)) & 0x80000000)
   {
         printf("Error %08X loading module.\n", moduid);     
   }

   if ((start = sceKernelStartModule(moduid, 0, NULL, NULL, NULL)) & 0x80000000)
   {
      printf("Error %08X starting module.\n", start);
   }

   return 0;
}

/* Exit callback */
int exit_callback(int arg1, int arg2, void *common) {
          sceKernelExitGame();
          return 0;
}

/* Callback thread */
int CallbackThread(SceSize args, void *argp) {
          int cbid;

          cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
          sceKernelRegisterExitCallback(cbid);

          sceKernelSleepThreadCB();

          return 0;
}

/* Sets up the callback thread and returns its thread id */
int SetupCallbacks(void) {
          int thid = 0;

          thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
          if(thid >= 0) {
                    sceKernelStartThread(thid, 0, 0);
          }

          return thid;
}

/* main routine */
int main(int argc, char *argv[])
{
    int thid = 0;

    //init screen and callbacks
    pspDebugScreenInit();
    pspDebugScreenClear();
    SetupCallbacks();

    thid = sceKernelCreateThread("load_thread", LoadThread, 0x10, 0xFA0, 0, 0);
    if(thid >= 0) {
       sceKernelStartThread(thid, 0, 0);
    }

    sceKernelSleepThread();
    sceKernelExitGame();

    return 0;
}



Any help? Thanks.
Back to top
View user's profile Send private message
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Tue Jul 04, 2006 2:09 am    Post subject: Reply with quote

Loading just vshmain wont get you very far as loading the vsh up requires a few more modules. And yes by default unless you use loadmodule the clock frequency wont stick, in fact even with hacks it wont stick (but you can reset it again once the psp has rebooted).
Back to top
View user's profile Send private message
pegasus21



Joined: 18 Jun 2006
Posts: 8

PostPosted: Tue Jul 04, 2006 4:06 am    Post subject: Reply with quote

I see. Thx for the reply.

Looks like loadexec of the vshmain.prx does load other prx along with it. Since it restarts the menu.
Back to top
View user's profile Send private message
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