Overclock option set to P5 / corrected frequency calculation for correct FPS&speed
This commit is contained in:
parent
901b5c16db
commit
ed9e0769e6
128
CppOutRun.layout
128
CppOutRun.layout
|
@ -2,24 +2,9 @@
|
|||
<CodeBlocks_layout_file>
|
||||
<FileVersion major="1" minor="0" />
|
||||
<ActiveTarget name="Release" />
|
||||
<File name="src/parameters.h" open="1" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<File name="src/include/clouds.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="505" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/include/drawstuff.h" open="0" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="655" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/fixed.h" open="0" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="5" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/include/circuit.h" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="1093" topLine="47" />
|
||||
<Cursor1 position="306" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="CMakeLists.txt" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
|
@ -27,9 +12,9 @@
|
|||
<Cursor1 position="302" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/src/utils.cc" open="0" top="0" tabpos="13" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<File name="src/src/saves.cc" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="30" topLine="0" />
|
||||
<Cursor1 position="294" topLine="2" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/include/menus.h" open="1" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
|
@ -37,9 +22,14 @@
|
|||
<Cursor1 position="505" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/src/saves.cc" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<File name="src/src/cars.cc" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="294" topLine="2" />
|
||||
<Cursor1 position="1019" topLine="8" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/clock.cc" open="0" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="5691" topLine="162" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/src/drawstuff.cc" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
|
@ -55,24 +45,25 @@
|
|||
<Collapse line="131" />
|
||||
</Folding>
|
||||
</File>
|
||||
<File name="src/clock.h" open="1" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<File name="src/main.cc" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="-2" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="0" topLine="0" />
|
||||
<Cursor1 position="725" topLine="9" />
|
||||
</Cursor>
|
||||
<Folding>
|
||||
<Collapse line="141" />
|
||||
<Collapse line="203" />
|
||||
<Collapse line="211" />
|
||||
<Collapse line="219" />
|
||||
</Folding>
|
||||
</File>
|
||||
<File name="TODO.txt" open="0" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="251" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/colors.h" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<File name="src/parameters.h" open="1" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="35" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/clock.cc" open="0" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="5691" topLine="162" />
|
||||
<Cursor1 position="505" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/include/utils.h" open="0" top="0" tabpos="12" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
|
@ -80,28 +71,24 @@
|
|||
<Cursor1 position="107" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/include/camera.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<File name="src/fixed.h" open="0" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="221" topLine="0" />
|
||||
<Cursor1 position="5" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/main.cc" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="-2" zoom_2="0">
|
||||
<File name="src/include/saves.h" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="22297" topLine="536" />
|
||||
</Cursor>
|
||||
<Folding>
|
||||
<Collapse line="141" />
|
||||
<Collapse line="193" />
|
||||
</Folding>
|
||||
</File>
|
||||
<File name="src/include/clouds.h" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="306" topLine="0" />
|
||||
<Cursor1 position="319" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/include/segment.h" open="0" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<File name="src/clock.h" open="1" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="783" topLine="3" />
|
||||
<Cursor1 position="0" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/include/circuit.h" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="1093" topLine="47" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/src/segment.cc" open="0" top="0" tabpos="15" split="0" active="1" splitpos="0" zoom_1="2" zoom_2="0">
|
||||
|
@ -109,32 +96,56 @@
|
|||
<Cursor1 position="410" topLine="29" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/src/menus.cc" open="1" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<File name="src/src/utils.cc" open="0" top="0" tabpos="13" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="29263" topLine="681" />
|
||||
<Cursor1 position="30" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/include/drawstuff.h" open="0" top="0" tabpos="11" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="655" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/include/camera.h" open="0" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="221" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/src/camera.cc" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="370" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/colors.h" open="0" top="0" tabpos="7" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="35" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/src/menus.cc" open="1" top="1" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="16425" topLine="474" />
|
||||
</Cursor>
|
||||
<Folding>
|
||||
<Collapse line="116" />
|
||||
<Collapse line="551" />
|
||||
<Collapse line="666" />
|
||||
<Collapse line="709" />
|
||||
<Collapse line="872" />
|
||||
</Folding>
|
||||
</File>
|
||||
<File name="src/src/clouds.cc" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="203" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/include/cars.h" open="0" top="0" tabpos="14" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="412" topLine="1" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/src/cars.cc" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<File name="src/include/segment.h" open="0" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="1019" topLine="8" />
|
||||
<Cursor1 position="783" topLine="3" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/include/saves.h" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<File name="src/src/clouds.cc" open="0" top="0" tabpos="0" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="319" topLine="0" />
|
||||
<Cursor1 position="203" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="src/src/circuit.cc" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
|
@ -164,9 +175,4 @@
|
|||
<Collapse line="1175" />
|
||||
</Folding>
|
||||
</File>
|
||||
<File name="src/src/camera.cc" open="0" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="370" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
</CodeBlocks_layout_file>
|
||||
|
|
82
src/clock.cc
82
src/clock.cc
|
@ -4,6 +4,7 @@
|
|||
#include <gint/cpu.h>
|
||||
#include <gint/mpu/bsc.h>
|
||||
#include <gint/mpu/cpg.h>
|
||||
#include <gint/clock.h>
|
||||
|
||||
|
||||
#define FLLFRQ_default 0x00004384
|
||||
|
@ -58,32 +59,22 @@ uint32_t initTimersTCNT[3];
|
|||
uint32_t initTimersTCOR[3];
|
||||
uint32_t newTimersTCNT[3];
|
||||
uint32_t newTimersTCOR[3];
|
||||
int initPphi;
|
||||
int newPphi;
|
||||
uint32_t initPphi;
|
||||
uint32_t newPphi;
|
||||
|
||||
static int getPphi_sh7305(void)
|
||||
|
||||
// Return the value of Pphi_Freq as per the current overclocking configuration
|
||||
uint32_t getPphi_sh7305(void)
|
||||
{
|
||||
/* The meaning of the PLL setting on SH7305 differs from the
|
||||
documentation of SH7224; the value must not be doubled. */
|
||||
int pll = CPG.FRQCR.STC + 1;
|
||||
uint32_t fll_freq;
|
||||
uint32_t pll_freq;
|
||||
uint32_t per_freq;
|
||||
|
||||
fll_freq = (SH7305_CPG.FLLFRQ.FLF * 32768) / (1 << SH7305_CPG.FLLFRQ.SELXM);
|
||||
pll_freq = fll_freq * (SH7305_CPG.FRQCR.STC + 1);
|
||||
per_freq = pll_freq / (1 << (SH7305_CPG.FRQCR.P1FC + 1));
|
||||
|
||||
/* The FLL ratio is the value of the setting, halved if SELXM=1 */
|
||||
int fll = CPG.FLLFRQ.FLF;
|
||||
if(CPG.FLLFRQ.SELXM == 1) fll >>= 1;
|
||||
|
||||
/* On SH7724, the divider ratio is given by 1 / (setting + 1), but on
|
||||
the SH7305 it is 1 / (2^setting + 1). */
|
||||
|
||||
int divb = CPG.FRQCR.BFC;
|
||||
int divi = CPG.FRQCR.IFC;
|
||||
int divp = CPG.FRQCR.P1FC;
|
||||
|
||||
/* Deduce the input frequency of divider 1 */
|
||||
int base = 32768;
|
||||
if(CPG.PLLCR.FLLE) base *= fll;
|
||||
if(CPG.PLLCR.PLLE) base *= pll;
|
||||
return (base >> (divp + 1));
|
||||
return per_freq;
|
||||
}
|
||||
|
||||
//We list all running timers and store this in a table (true/false)
|
||||
|
@ -91,16 +82,9 @@ void listTimerStatus( void )
|
|||
{
|
||||
for(int k=0;k<3; k++)
|
||||
{
|
||||
if(k < 3)
|
||||
{
|
||||
tmu_t *T = &TMU[k];
|
||||
runningTimers[k]= (!T->TCR.UNIE && !(*TSTR & (1 << k)));
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// etmu_t *T = &ETMU[k-3];
|
||||
// runningTimers[k]= (!T->TCR.UNIE && !T->TSTR);
|
||||
// }
|
||||
//runningTimers[k]= (!T->TCR.UNIE && !(*TSTR & (1 << k)));
|
||||
runningTimers[k] = (T->TCNT!=0xffffffff || T->TCOR!=0xffffffff); // as per Lephe's proposal for Libprof compatibility
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,18 +96,9 @@ void getInitialTimersParameters( void )
|
|||
{
|
||||
if (runningTimers[k]==true)
|
||||
{
|
||||
if(k < 3)
|
||||
{
|
||||
tmu_t *T = &TMU[k];
|
||||
initTimersTCNT[k]= T->TCNT;
|
||||
initTimersTCOR[k]= T->TCOR;
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// etmu_t *T = &ETMU[k-3];
|
||||
// initTimersTCNT[k]= T->TCNT;
|
||||
// initTimersTCOR[k]= T->TCOR;
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -141,44 +116,39 @@ void updateNewTimersParameters( void )
|
|||
{
|
||||
if (runningTimers[k]==true)
|
||||
{
|
||||
timer_stop( k );
|
||||
if(k < 3)
|
||||
{
|
||||
timer_pause( k );
|
||||
|
||||
tmu_t *T = &TMU[k];
|
||||
T->TCNT = newTimersTCNT[k];
|
||||
T->TCOR = newTimersTCOR[k];
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// etmu_t *T = &ETMU[k-3];
|
||||
// T->TCNT = newTimersTCNT[k];
|
||||
// T->TCOR = newTimersTCOR[k];
|
||||
// }
|
||||
|
||||
timer_start(k);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//We compute the new TCNT and new TCOR
|
||||
void computeNewTimersParameters( int initPphi_f, int newPphi_f )
|
||||
void computeNewTimersParameters( uint32_t initPphi_f, uint32_t newPphi_f )
|
||||
{
|
||||
for(int k=0;k<3; k++)
|
||||
{
|
||||
if (runningTimers[k]==true)
|
||||
{
|
||||
newTimersTCNT[k] = (uint32_t) ((uint64_t) initTimersTCNT[k] * (uint64_t) newPphi_f / (uint64_t) initPphi_f);
|
||||
newTimersTCOR[k] = (uint32_t) ((uint64_t) initTimersTCOR[k] * (uint64_t) newPphi_f / (uint64_t) initPphi_f);
|
||||
|
||||
if(initTimersTCOR[k] == 0xffffffff)
|
||||
newTimersTCOR[k] = 0xffffffff;
|
||||
else
|
||||
newTimersTCOR[k] = (uint32_t) ((uint64_t) initTimersTCOR[k] * (uint64_t) newPphi_f / (uint64_t) initPphi_f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static overclock_level current_clock_state = OC_Default;
|
||||
static overclock_level current_clock_state = -1;
|
||||
bool overclock_config_changed = false;
|
||||
|
||||
|
||||
|
||||
|
||||
void SetOCDefault( void )
|
||||
{
|
||||
BSC.CS0WCR.WR = WAIT18;
|
||||
|
@ -321,6 +291,8 @@ int clock_overclock( overclock_level level )
|
|||
|
||||
cpu_atomic_end();
|
||||
|
||||
cpg_compute_freq();
|
||||
|
||||
return 1;
|
||||
}
|
||||
else return 0;
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#define DEBUGXXX 0
|
||||
#define OVERCLCK_ACTIVABLE 1
|
||||
|
||||
char version[5] = {'V','1','.','0','5'};
|
||||
char version[5] = {'V','1','.','0','6'};
|
||||
|
||||
|
||||
extern bopti_image_t player;
|
||||
|
@ -527,7 +527,7 @@ int main(void)
|
|||
|
||||
gint_world_switch( GINT_CALL( saveparameters ) );
|
||||
|
||||
if (gint[HWCALC] == HWCALC_FXCG50 && isOCActivated == true) clock_overclock( OC_PtuneF4 );
|
||||
if (gint[HWCALC] == HWCALC_FXCG50 && isOCActivated == true) clock_overclock( OC_PtuneF5 );
|
||||
else if (gint[HWCALC] == HWCALC_FXCG50 && isOCActivated == false) clock_overclock( OC_Default );
|
||||
}
|
||||
else if (mode==3)
|
||||
|
|
Loading…
Reference in New Issue