static int update_freq(void) { int i, max, maxsum; int cpu = 0, bus = 0; for (i = 0, max = 0, maxsum = -1; i < freqs_cnt; ++i) { if (maxsum < freqs[i].cpu + freqs[i].bus) { maxsum = freqs[i].cpu + freqs[i].bus; max = i; } } if (maxsum > 0) { cpu = freqs[max].cpu; bus = freqs[max].bus; } cpu = max(cpu, freq_list[config.freqs[0]][0]); cpu = min(333, cpu); bus = max(bus, freq_list[config.freqs[0]][1]); bus = min(166, bus); // dbg_printf(d, "%s: should set cpu/bus to %d/%d", __func__, cpu, bus); if (scePowerGetCpuClockFrequency() != cpu || scePowerGetBusClockFrequency() != bus) { power_set_clock(cpu, bus); { // dbg_printf(d, "%s: cpu: %d, bus: %d", __func__, scePowerGetCpuClockFrequency(), scePowerGetBusClockFrequency()); } } return 0; }
static int lua_getBus(lua_State *L) { int argc = lua_gettop(L); if(argc != 0) return luaL_error(L, "Argument error: System.getBusSpeed takes no argument."); u32 bus = scePowerGetBusClockFrequency(); lua_pushnumber(L,bus); return 1; }
void CSystem::GetSystemInfo() { /**BATTERY*/ /**PERCENTUALE CARICA DELLA BATTERIA*/ BatteryLifePerc = L"Battery charge percentage: "; BatteryLifePerc += scePowerGetBatteryLifePercent(); BatteryLifePerc += L"%"; /**PERCENTUALE CARICA DELLA BATTERIA*/ BatteryLifeTime = L"Battery Life Time: "; BatteryLifeTime += scePowerGetBatteryLifeTime() / 3600; BatteryLifeTime += L"m"; /**TEMPERATURA DELLA BATTERIA*/ BatteryTemp = L"Temperature of the battery: "; BatteryTemp += scePowerGetBatteryTemp(); BatteryTemp += L"deg C"; /**EXTERNAL POWER*/ IsPowerOnline = scePowerIsPowerOnline() ? L"External Power: Yes" : L"External Power: No "; /**BATTERY PRESENT*/ IsBatteryExist = scePowerIsBatteryExist() ? L"Battery Present: Yes" : L"Battery Present: No "; /**FREEMEMORY*/ FreeMemory = L"Free Memory: "; FreeMemory += __freemem(); /**CPU BUS*/ CpuClock = L"CPU: "; CpuClock += scePowerGetCpuClockFrequency(); CpuClock += " MHZ"; BusClock = L"BUS: "; BusClock += scePowerGetBusClockFrequency(); BusClock += " MHZ"; }
//************************************************************************************* // //************************************************************************************* static bool Initialize() { strcpy(gDaedalusExePath, DAEDALUS_PSP_PATH( "" )); printf( "Cpu was: %dMHz, Bus: %dMHz\n", scePowerGetCpuClockFrequency(), scePowerGetBusClockFrequency() ); if (scePowerSetClockFrequency(333, 333, 166) != 0) { printf( "Could not set CPU to 333MHz\n" ); } printf( "Cpu now: %dMHz, Bus: %dMHz\n", scePowerGetCpuClockFrequency(), scePowerGetBusClockFrequency() ); // Set up our Kernel Home button //ToDo: This doesn't work properly for Vita, there's no longer a "home" button available InitHomeButton(); // If (o) is pressed during boot the Emulator will use 32bit // else use default 16bit color mode SceCtrlData pad; sceCtrlPeekBufferPositive(&pad, 1); if( pad.Buttons & PSP_CTRL_CIRCLE ) g32bitColorMode = true; else g32bitColorMode = false; // Check for unsupported FW >=4.01 (We use M33 SDK 4.01) // Otherwise PSP model can't be detected correctly DaedalusFWCheck(); // Initiate MediaEngine //Note: Media Engine is not available for Vita bool bMeStarted = InitialiseJobManager(); // Disable for profiling // srand(time(0)); //Set the debug output to default if( g32bitColorMode ) pspDebugScreenInit(); else pspDebugScreenInitEx( NULL , GU_PSM_5650, 1); //Sets debug output to 16bit mode // This Breaks gdb, better disable it in debug build // #ifndef DAEDALUS_DEBUG_CONSOLE initExceptionHandler(); #endif _DisableFPUExceptions(); //Init Panic button thread SetupPanic(); // Init volatile memory VolatileMemInit(); #ifdef DAEDALUS_CALLBACKS //Set up callback for our thread SetupCallbacks(); #endif //Set up the DveMgr (TV Display) and Detect PSP Slim /3K/ Go if ( kuKernelGetModel() > PSP_MODEL_STANDARD ) { // Can't use extra memory if ME isn't available if( bMeStarted ) PSP_IS_SLIM = true; HAVE_DVE = CModule::Load("dvemgr.prx"); if (HAVE_DVE >= 0) PSP_TV_CABLE = pspDveMgrCheckVideoOut(); if (PSP_TV_CABLE == 1) PSP_TV_LACED = 1; // composite cable => interlaced else if( PSP_TV_CABLE == 0 ) CModule::Unload( HAVE_DVE ); // Stop and unload dvemgr.prx since if no video cable is connected } HAVE_DVE = (HAVE_DVE < 0) ? 0 : 1; // 0 == no dvemgr, 1 == dvemgr sceCtrlSetSamplingCycle(0); sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG); // Init the savegame directory strcpy( g_DaedalusConfig.mSaveDir, DAEDALUS_PSP_PATH( "SaveGames/" ) ); if (!System_Init()) return false; return true; }
void PSPInit() { psp_org_cpu_clock = scePowerGetCpuClockFrequency(); psp_org_bus_clock = scePowerGetBusClockFrequency(); }