Added OC options for PRIZM CG10/20 similar to one of CG50/G90+E

This commit is contained in:
Sylvain PILLOT 2022-04-17 09:48:06 +02:00
parent ed9e0769e6
commit a664af3a64
4 changed files with 458 additions and 208 deletions

View File

@ -2,152 +2,6 @@
<CodeBlocks_layout_file>
<FileVersion major="1" minor="0" />
<ActiveTarget name="Release" />
<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" />
</Cursor>
</File>
<File name="CMakeLists.txt" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="302" 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">
<Cursor>
<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">
<Cursor>
<Cursor1 position="505" topLine="0" />
</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">
<Cursor>
<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">
<Cursor>
<Cursor1 position="2807" topLine="14" />
</Cursor>
<Folding>
<Collapse line="9" />
<Collapse line="33" />
<Collapse line="40" />
<Collapse line="46" />
<Collapse line="76" />
<Collapse line="131" />
</Folding>
</File>
<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="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/parameters.h" open="1" top="0" tabpos="9" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<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">
<Cursor>
<Cursor1 position="107" 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/saves.h" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="319" topLine="0" />
</Cursor>
</File>
<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="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">
<Cursor>
<Cursor1 position="410" topLine="29" />
</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">
<Cursor>
<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/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/include/segment.h" open="0" top="0" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="783" topLine="3" />
</Cursor>
</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/src/circuit.cc" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="31927" topLine="269" />
@ -175,4 +29,150 @@
<Collapse line="1175" />
</Folding>
</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">
<Cursor>
<Cursor1 position="107" 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/src/saves.cc" open="1" top="0" tabpos="6" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<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">
<Cursor>
<Cursor1 position="505" 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">
<Cursor>
<Cursor1 position="783" topLine="3" />
</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">
<Cursor>
<Cursor1 position="1019" topLine="8" />
</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">
<Cursor>
<Cursor1 position="319" 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/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/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/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/main.cc" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="-2" zoom_2="0">
<Cursor>
<Cursor1 position="43460" topLine="306" />
</Cursor>
<Folding>
<Collapse line="141" />
<Collapse line="203" />
<Collapse line="211" />
<Collapse line="219" />
</Folding>
</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/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" />
</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">
<Cursor>
<Cursor1 position="2807" topLine="14" />
</Cursor>
<Folding>
<Collapse line="9" />
<Collapse line="33" />
<Collapse line="40" />
<Collapse line="46" />
<Collapse line="76" />
<Collapse line="131" />
</Folding>
</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">
<Cursor>
<Cursor1 position="30" topLine="0" />
</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">
<Cursor>
<Cursor1 position="410" topLine="29" />
</Cursor>
</File>
<File name="CMakeLists.txt" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="302" topLine="0" />
</Cursor>
</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/clock.h" open="1" top="1" tabpos="10" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="0" />
</Cursor>
</File>
<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="505" 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/menus.cc" open="1" top="0" tabpos="8" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="46095" topLine="898" />
</Cursor>
<Folding>
<Collapse line="116" />
<Collapse line="551" />
<Collapse line="666" />
<Collapse line="709" />
<Collapse line="872" />
</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/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>
</CodeBlocks_layout_file>

View File

@ -7,27 +7,51 @@
#include <gint/clock.h>
#define FLLFRQ_default 0x00004384
#define FRQCR_default 0x0F011112
#define FLLFRQ_default_CG50 0x00004384
#define FRQCR_default_CG50 0x0F011112
#define CS0BCR_default_CG50 0x36DA0400 // CG50
#define CS2BCR_default_CG50 0x36DA3400 // CG50
#define CS3BCR_default_CG50 0x36DB4400 // CG50
#define CS4BCR_default_CG50 0x36DB0400
#define CS5aBCR_default_CG50 0x17DF0400
#define CS5bBCR_default_CG50 0x17DF0400
#define CS6aBCR_default_CG50 0x34D30200
#define CS6bBCR_default_CG50 0x34D30200
#define CS0WCR_default_CG50 0x000003C0 // CG50
#define CS2WCR_default_CG50 0x000003C0 // CG50
#define CS3WCR_default_CG50 0x000024D1 // CG50
#define CS4WCR_default_CG50 0x00000540
#define CS5aWCR_default_CG50 0x000203C1
#define CS5bWCR_default_CG50 0x000203C1
#define CS6aWCR_default_CG50 0x000302C0
#define CS6bWCR_default_CG50 0x000302C0
//#define SDCR_default 0x00000A08
#define FLLFRQ_default_CG10_20 0x00004384
#define FRQCR_default_CG10_20 0x0F102203
#define CS0BCR_default_CG10_20 0x24920400
#define CS2BCR_default_CG10_20 0x24923400
#define CS3BCR_default_CG10_20 0x24924400
#define CS4BCR_default_CG10_20 0x36DB0400
#define CS5aBCR_default_CG10_20 0x15140400
#define CS5bBCR_default_CG10_20 0x15140400
#define CS6aBCR_default_CG10_20 0x34D30200
#define CS6bBCR_default_CG10_20 0x34D30200
#define CS0WCR_default_CG10_20 0x000001C0
#define CS2WCR_default_CG10_20 0x00000140
#define CS3WCR_default_CG10_20 0x000024D0
#define CS4WCR_default_CG10_20 0x00000540
#define CS5aWCR_default_CG10_20 0x00010240
#define CS5bWCR_default_CG10_20 0x00010240
#define CS6aWCR_default_CG10_20 0x000302C0
#define CS6bWCR_default_CG10_20 0x000302C0
#define CS0BCR_default 0x36DA0400 // CG50
#define CS2BCR_default 0x36DA3400 // CG50
#define CS3BCR_default 0x36DB4400 // CG50
#define CS4BCR_default 0x36DB0400
#define CS5aBCR_default 0x17DF0400
#define CS5bBCR_default 0x17DF0400
#define CS6aBCR_default 0x34D30200
#define CS6bBCR_default 0x34D30200
#define CS0WCR_default 0x000003C0 // CG50
#define CS2WCR_default 0x000003C0 // CG50
#define CS3WCR_default 0x000024D1 // CG50
#define CS4WCR_default 0x00000540
#define CS5aWCR_default 0x000203C1
#define CS5bWCR_default 0x000203C1
#define CS6aWCR_default 0x000302C0
#define CS6bWCR_default 0x000302C0
#define SDCR_default 0x00000A08
#define PLL_32x 0b011111 //
#define PLL_26x 0b011001 //
@ -37,6 +61,7 @@
#define DIV_4 0b0001 // 1/4
#define DIV_8 0b0010 // 1/8
#define DIV16 0b0011 // 1/16
#define DIV32 0b0100 // 1/32
#define WAIT18 0b1011
@ -149,30 +174,30 @@ static overclock_level current_clock_state = -1;
bool overclock_config_changed = false;
void SetOCDefault( void )
void SetOCDefault_CG50( void )
{
BSC.CS0WCR.WR = WAIT18;
CPG.FLLFRQ.lword = FLLFRQ_default;
CPG.FRQCR.lword = FRQCR_default;
CPG.FLLFRQ.lword = FLLFRQ_default_CG50;
CPG.FRQCR.lword = FRQCR_default_CG50;
CPG.FRQCR.KICK = 1 ;
while((CPG.LSTATS & 1)!=0)
BSC.CS0BCR.lword = CS0BCR_default;
BSC.CS0WCR.lword = CS0WCR_default;
BSC.CS2BCR.lword = CS2BCR_default;
BSC.CS2WCR.lword = CS2WCR_default;
BSC.CS3BCR.lword = CS3BCR_default;
BSC.CS3WCR.lword = CS3WCR_default;
BSC.CS0BCR.lword = CS0BCR_default_CG50;
BSC.CS0WCR.lword = CS0WCR_default_CG50;
BSC.CS2BCR.lword = CS2BCR_default_CG50;
BSC.CS2WCR.lword = CS2WCR_default_CG50;
BSC.CS3BCR.lword = CS3BCR_default_CG50;
BSC.CS3WCR.lword = CS3WCR_default_CG50;
if ( BSC.CS3WCR.A3CL == 1 ) SDMR3_CL2 = 0; else SDMR3_CL3 = 0;
BSC.CS5ABCR.lword = CS5aBCR_default;
BSC.CS5AWCR.lword = CS5aWCR_default;
BSC.CS5ABCR.lword = CS5aBCR_default_CG50;
BSC.CS5AWCR.lword = CS5aWCR_default_CG50;
}
void SetOCPtuneF2( void )
void SetOCPtuneF2_CG50( void )
{
BSC.CS0WCR.WR = WAIT18;
@ -185,17 +210,17 @@ void SetOCPtuneF2( void )
BSC.CS0BCR.lword = 0x24920400;
BSC.CS0WCR.lword = 0x00000340;
BSC.CS2BCR.lword = 0x24923400;
BSC.CS2WCR.lword = CS2WCR_default;
BSC.CS2WCR.lword = CS2WCR_default_CG50;
BSC.CS3BCR.lword = 0x24924400;
BSC.CS3WCR.lword = CS3WCR_default;
BSC.CS3WCR.lword = CS3WCR_default_CG50;
if ( BSC.CS3WCR.A3CL == 1 ) SDMR3_CL2 = 0; else SDMR3_CL3 = 0;
BSC.CS5ABCR.lword = CS5aBCR_default;
BSC.CS5AWCR.lword = CS5aWCR_default;
BSC.CS5ABCR.lword = CS5aBCR_default_CG50;
BSC.CS5AWCR.lword = CS5aWCR_default_CG50;
}
void SetOCPtuneF3( void )
void SetOCPtuneF3_CG50( void )
{
BSC.CS0WCR.WR = WAIT18;
@ -208,17 +233,17 @@ void SetOCPtuneF3( void )
BSC.CS0BCR.lword = 0x24920400;
BSC.CS0WCR.lword = 0x00000240;
BSC.CS2BCR.lword = 0x24923400;
BSC.CS2WCR.lword = CS2WCR_default;
BSC.CS2WCR.lword = CS2WCR_default_CG50;
BSC.CS3BCR.lword = 0x24924400;
BSC.CS3WCR.lword = CS3WCR_default;
BSC.CS3WCR.lword = CS3WCR_default_CG50;
if ( BSC.CS3WCR.A3CL == 1 ) SDMR3_CL2 = 0; else SDMR3_CL3 = 0;
BSC.CS5ABCR.lword = CS5aBCR_default;
BSC.CS5AWCR.lword = CS5aWCR_default;
BSC.CS5ABCR.lword = CS5aBCR_default_CG50;
BSC.CS5AWCR.lword = CS5aWCR_default_CG50;
}
void SetOCPtuneF4( void )
void SetOCPtuneF4_CG50( void )
{
BSC.CS0WCR.WR = WAIT18;
@ -232,14 +257,17 @@ void SetOCPtuneF4( void )
BSC.CS0BCR.lword = 0x24920400;
BSC.CS0WCR.lword = 0x000002C0;
BSC.CS2BCR.lword = 0x24923400;
BSC.CS2WCR.lword = CS2WCR_default;
BSC.CS2WCR.lword = CS2WCR_default_CG50;
BSC.CS3BCR.lword = 0x24924400;
BSC.CS3WCR.lword = CS3WCR_default;
BSC.CS5ABCR.lword = CS5aBCR_default;
BSC.CS5AWCR.lword = CS5aWCR_default;
BSC.CS3WCR.lword = CS3WCR_default_CG50;
if ( BSC.CS3WCR.A3CL == 1 ) SDMR3_CL2 = 0; else SDMR3_CL3 = 0;
BSC.CS5ABCR.lword = CS5aBCR_default_CG50;
BSC.CS5AWCR.lword = CS5aWCR_default_CG50;
}
void SetOCPtuneF5( void )
void SetOCPtuneF5_CG50( void )
{
BSC.CS0WCR.WR = WAIT18;
@ -252,17 +280,203 @@ void SetOCPtuneF5( void )
BSC.CS0BCR.lword = 0x24920400;
BSC.CS0WCR.lword = 0x00000440;
BSC.CS2BCR.lword = 0x24923400;
BSC.CS2WCR.lword = CS2WCR_default;
BSC.CS2WCR.lword = CS2WCR_default_CG50;
BSC.CS3BCR.lword = 0x24924400;
BSC.CS3WCR.lword = CS3WCR_default;
BSC.CS3WCR.lword = CS3WCR_default_CG50;
if ( BSC.CS3WCR.A3CL == 1 ) SDMR3_CL2 = 0; else SDMR3_CL3 = 0;
BSC.CS5ABCR.lword = CS5aBCR_default;
BSC.CS5AWCR.lword = CS5aWCR_default;
BSC.CS5ABCR.lword = CS5aBCR_default_CG50;
BSC.CS5AWCR.lword = CS5aWCR_default_CG50;
}
void SetOCDefault_CG10_20( void )
{
BSC.CS0WCR.WR = WAIT18;
CPG.FLLFRQ.lword = FLLFRQ_default_CG10_20;
CPG.FRQCR.lword = FRQCR_default_CG10_20;
CPG.FRQCR.KICK = 1 ;
while((CPG.LSTATS & 1)!=0)
BSC.CS0BCR.lword = CS0BCR_default_CG10_20;
BSC.CS0WCR.lword = CS0WCR_default_CG10_20;
BSC.CS2BCR.lword = CS2BCR_default_CG10_20;
BSC.CS2WCR.lword = CS2WCR_default_CG10_20;
BSC.CS3BCR.lword = CS3BCR_default_CG10_20;
BSC.CS3WCR.lword = CS3WCR_default_CG10_20;
if ( BSC.CS3WCR.A3CL == 1 ) SDMR3_CL2 = 0; else SDMR3_CL3 = 0;
BSC.CS5ABCR.lword = CS5aBCR_default_CG10_20;
BSC.CS5AWCR.lword = CS5aWCR_default_CG10_20;
}
void SetOCPtuneF2_CG10_20( void )
{
BSC.CS0WCR.WR = WAIT18;
CPG.FLLFRQ.lword = 0x00004000+900;
CPG.FRQCR.lword = (PLL_32x<<24)+(DIV_8<<20)+(DIV16<<12)+(DIV16<<8)+DIV32;
CPG.FRQCR.KICK = 1 ;
while((CPG.LSTATS & 1)!=0)
BSC.CS0BCR.lword = 0x04900400;
BSC.CS0WCR.lword = 0x00000140;
BSC.CS2BCR.lword = 0x04903400;
BSC.CS2WCR.lword = 0x000100C0;
BSC.CS3BCR.lword = CS3BCR_default_CG10_20;
BSC.CS3WCR.lword = CS3WCR_default_CG10_20;
if ( BSC.CS3WCR.A3CL == 1 ) SDMR3_CL2 = 0; else SDMR3_CL3 = 0;
BSC.CS5ABCR.lword = CS5aBCR_default_CG10_20;
BSC.CS5AWCR.lword = CS5aWCR_default_CG10_20;
}
void SetOCPtuneF3_CG10_20( void )
{
BSC.CS0WCR.WR = WAIT18;
CPG.FLLFRQ.lword = 0x00004000+900;
CPG.FRQCR.lword = (PLL_32x<<24)+(DIV_4<<20)+(DIV_8<<12)+(DIV_8<<8)+DIV32;
CPG.FRQCR.KICK = 1 ;
while((CPG.LSTATS & 1)!=0)
BSC.CS0BCR.lword = 0x24900400;
BSC.CS0WCR.lword = 0x000002C0;
BSC.CS2BCR.lword = 0x04903400;
BSC.CS2WCR.lword = 0x000201C0;
BSC.CS3BCR.lword = CS3BCR_default_CG10_20;
BSC.CS3WCR.lword = CS3WCR_default_CG10_20;
if ( BSC.CS3WCR.A3CL == 1 ) SDMR3_CL2 = 0; else SDMR3_CL3 = 0;
BSC.CS5ABCR.lword = CS5aBCR_default_CG10_20;
BSC.CS5AWCR.lword = CS5aWCR_default_CG10_20;
}
void SetOCPtuneF4_CG10_20( void )
{
BSC.CS0WCR.WR = WAIT18;
CPG.FLLFRQ.lword = 0x00004000+900;
CPG.FRQCR.lword = (PLL_32x<<24)+(DIV_4<<20)+(DIV_4<<12)+(DIV_4<<8)+DIV32;
CPG.FRQCR.KICK = 1 ;
while((CPG.LSTATS & 1)!=0)
BSC.CS0BCR.lword = 0x44900400;
BSC.CS0WCR.lword = 0x00000440;
BSC.CS2BCR.lword = 0x04903400;
BSC.CS2WCR.lword = 0x00040340;
BSC.CS3BCR.lword = CS3BCR_default_CG10_20;
BSC.CS3WCR.lword = CS3WCR_default_CG10_20;
if ( BSC.CS3WCR.A3CL == 1 ) SDMR3_CL2 = 0; else SDMR3_CL3 = 0;
BSC.CS5ABCR.lword = CS5aBCR_default_CG10_20;
BSC.CS5AWCR.lword = CS5aWCR_default_CG10_20;
}
void SetOCPtuneF5_CG10_20( void )
{
BSC.CS0WCR.WR = WAIT18;
CPG.FLLFRQ.lword = 0x00004000+900;
CPG.FRQCR.lword = (PLL_26x<<24)+(DIV_2<<20)+(DIV_4<<12)+(DIV_4<<8)+DIV16;
CPG.FRQCR.KICK = 1 ;
while((CPG.LSTATS & 1)!=0)
BSC.CS0BCR.lword = 0x34900400;
BSC.CS0WCR.lword = 0x000003C0;
BSC.CS2BCR.lword = 0x04903400;
BSC.CS2WCR.lword = 0x000402C0;
BSC.CS3BCR.lword = CS3BCR_default_CG10_20;
BSC.CS3WCR.lword = CS3WCR_default_CG10_20;
if ( BSC.CS3WCR.A3CL == 1 ) SDMR3_CL2 = 0; else SDMR3_CL3 = 0;
BSC.CS5ABCR.lword = CS5aBCR_default_CG10_20;
BSC.CS5AWCR.lword = CS5aWCR_default_CG10_20;
}
overclock_level overclock_detect( void )
{
if(gint[HWCALC] == HWCALC_FXCG50)
{
// OC_Default configuration
if (CPG.FLLFRQ.lword == FLLFRQ_default_CG50 && CPG.FRQCR.lword == FRQCR_default_CG50 && BSC.CS0BCR.lword == CS0BCR_default_CG50 && BSC.CS0WCR.lword == CS0WCR_default_CG50 &&
BSC.CS2BCR.lword == CS2BCR_default_CG50 && BSC.CS2WCR.lword == CS2WCR_default_CG50 && BSC.CS3BCR.lword == CS3BCR_default_CG50 && BSC.CS3WCR.lword == CS3WCR_default_CG50 &&
BSC.CS5ABCR.lword == CS5aBCR_default_CG50 && BSC.CS5AWCR.lword == CS5aWCR_default_CG50 ) return OC_Default;
// OC_PtuneF2 configuration
else if (CPG.FLLFRQ.lword == 0x00004000+900 && CPG.FRQCR.lword == (PLL_16x<<24)+(DIV_4<<20)+(DIV_8<<12)+(DIV_8<<8)+DIV_8 && BSC.CS0BCR.lword == 0x24920400 &&
BSC.CS0WCR.lword == 0x00000340 && BSC.CS2BCR.lword == 0x24923400 && BSC.CS2WCR.lword == CS2WCR_default_CG50 && BSC.CS3BCR.lword == 0x24924400 &&
BSC.CS3WCR.lword == CS3WCR_default_CG50 && BSC.CS5ABCR.lword == CS5aBCR_default_CG50 && BSC.CS5AWCR.lword == CS5aWCR_default_CG50 ) return OC_PtuneF2;
// OC_PtuneF3 configuration
else if (CPG.FLLFRQ.lword == 0x00004000+900 && CPG.FRQCR.lword == (PLL_26x<<24)+(DIV_4<<20)+(DIV_8<<12)+(DIV_8<<8)+DIV_8 && BSC.CS0BCR.lword == 0x24920400 &&
BSC.CS0WCR.lword == 0x00000240 && BSC.CS2BCR.lword == 0x24923400 && BSC.CS2WCR.lword == CS2WCR_default_CG50 && BSC.CS3BCR.lword == 0x24924400 &&
BSC.CS3WCR.lword == CS3WCR_default_CG50 && BSC.CS5ABCR.lword == CS5aBCR_default_CG50 && BSC.CS5AWCR.lword == CS5aWCR_default_CG50) return OC_PtuneF3;
// OC_PtuneF4 configuration
else if (CPG.FLLFRQ.lword == 0x00004000+900 && CPG.FRQCR.lword == (PLL_32x<<24)+(DIV_2<<20)+(DIV_4<<12)+(DIV_8<<8)+DIV16 && BSC.CS0BCR.lword == 0x24920400 &&
BSC.CS0WCR.lword == 0x000002C0 && BSC.CS2BCR.lword == 0x24923400 && BSC.CS2WCR.lword == CS2WCR_default_CG50 && BSC.CS3BCR.lword == 0x24924400 &&
BSC.CS3WCR.lword == CS3WCR_default_CG50 && BSC.CS5ABCR.lword == CS5aBCR_default_CG50 && BSC.CS5AWCR.lword == CS5aWCR_default_CG50) return OC_PtuneF4;
// OC_PtuneF5 configuration
else if (CPG.FLLFRQ.lword == 0x00004000+900 && CPG.FRQCR.lword == (PLL_26x<<24)+(DIV_2<<20)+(DIV_4<<12)+(DIV_4<<8)+DIV_8 && BSC.CS0BCR.lword == 0x24920400 &&
BSC.CS0WCR.lword == 0x00000440 && BSC.CS2BCR.lword == 0x24923400 && BSC.CS2WCR.lword == CS2WCR_default_CG50 && BSC.CS3BCR.lword == 0x24924400 &&
BSC.CS3WCR.lword == CS3WCR_default_CG50 && BSC.CS5ABCR.lword == CS5aBCR_default_CG50 && BSC.CS5AWCR.lword == CS5aWCR_default_CG50) return OC_PtuneF5;
// Not recognized
else return OC_Undefined;
}
else if(gint[HWCALC] == HWCALC_PRIZM)
{
// OC_Default configuration
if (CPG.FLLFRQ.lword == FLLFRQ_default_CG10_20 && CPG.FRQCR.lword == FRQCR_default_CG10_20 && BSC.CS0BCR.lword == CS0BCR_default_CG10_20 && BSC.CS0WCR.lword == CS0WCR_default_CG10_20 &&
BSC.CS2BCR.lword == CS2BCR_default_CG10_20 && BSC.CS2WCR.lword == CS2WCR_default_CG10_20 && BSC.CS3BCR.lword == CS3BCR_default_CG10_20 && BSC.CS3WCR.lword == CS3WCR_default_CG10_20 &&
BSC.CS5ABCR.lword == CS5aBCR_default_CG10_20 && BSC.CS5AWCR.lword == CS5aWCR_default_CG10_20 ) return OC_Default;
// OC_PtuneF2 configuration
else if (CPG.FLLFRQ.lword == 0x00004000+900 && CPG.FRQCR.lword == (PLL_32x<<24)+(DIV_8<<20)+(DIV16<<12)+(DIV16<<8)+DIV32 && BSC.CS0BCR.lword == 0x04900400 &&
BSC.CS0WCR.lword == 0x00000140 && BSC.CS2BCR.lword == 0x04903400 && BSC.CS2WCR.lword == 0x000100C0 && BSC.CS3BCR.lword == CS3BCR_default_CG10_20 &&
BSC.CS3WCR.lword == CS3WCR_default_CG10_20 && BSC.CS5ABCR.lword == CS5aBCR_default_CG10_20 && BSC.CS5AWCR.lword == CS5aWCR_default_CG10_20 ) return OC_PtuneF2;
// OC_PtuneF3 configuration
else if (CPG.FLLFRQ.lword == 0x00004000+900 && CPG.FRQCR.lword == (PLL_32x<<24)+(DIV_4<<20)+(DIV_8<<12)+(DIV_8<<8)+DIV32 && BSC.CS0BCR.lword == 0x24900400 &&
BSC.CS0WCR.lword == 0x000002C0 && BSC.CS2BCR.lword == 0x04903400 && BSC.CS2WCR.lword == 0x000201C0 && BSC.CS3BCR.lword == CS3BCR_default_CG10_20 &&
BSC.CS3WCR.lword == CS3WCR_default_CG10_20 && BSC.CS5ABCR.lword == CS5aBCR_default_CG10_20 && BSC.CS5AWCR.lword == CS5aWCR_default_CG10_20 ) return OC_PtuneF3;
// OC_PtuneF4 configuration
else if (CPG.FLLFRQ.lword == 0x00004000+900 && CPG.FRQCR.lword == (PLL_32x<<24)+(DIV_4<<20)+(DIV_4<<12)+(DIV_4<<8)+DIV32 && BSC.CS0BCR.lword == 0x44900400 &&
BSC.CS0WCR.lword == 0x00000440 && BSC.CS2BCR.lword == 0x04903400 && BSC.CS2WCR.lword == 0x00040340 && BSC.CS3BCR.lword == CS3BCR_default_CG10_20 &&
BSC.CS3WCR.lword == CS3WCR_default_CG10_20 && BSC.CS5ABCR.lword == CS5aBCR_default_CG10_20 && BSC.CS5AWCR.lword == CS5aWCR_default_CG10_20 ) return OC_PtuneF4;
// OC_PtuneF5 configuration
else if (CPG.FLLFRQ.lword == 0x00004000+900 && CPG.FRQCR.lword == (PLL_26x<<24)+(DIV_2<<20)+(DIV_4<<12)+(DIV_4<<8)+DIV16 && BSC.CS0BCR.lword == 0x34900400 &&
BSC.CS0WCR.lword == 0x000003C0 && BSC.CS2BCR.lword == 0x04903400 && BSC.CS2WCR.lword == 0x000402C0 && BSC.CS3BCR.lword == CS3BCR_default_CG10_20 &&
BSC.CS3WCR.lword == CS3WCR_default_CG10_20 && BSC.CS5ABCR.lword == CS5aBCR_default_CG10_20 && BSC.CS5AWCR.lword == CS5aWCR_default_CG10_20) return OC_PtuneF5;
// Not recognized
else return OC_Undefined;
}
}
// return 0 if no need to change
// return 1 if successful change
// return -1 on error
@ -271,6 +485,8 @@ int clock_overclock( overclock_level level )
{
uint32_t count=0;
if (level==OC_Undefined) return 0;
if(gint[HWCALC] == HWCALC_FXCG50 && current_clock_state!=level)
{
cpu_atomic_start();
@ -279,11 +495,11 @@ int clock_overclock( overclock_level level )
initPphi = getPphi_sh7305(); // we get the current P_Phi_f
getInitialTimersParameters(); // we collect the current TCNT and TCOR
if (level == OC_Default && current_clock_state!=OC_Default) SetOCDefault(), current_clock_state= OC_Default, overclock_config_changed=true;
if (level == OC_PtuneF2 && current_clock_state!=OC_PtuneF2) SetOCPtuneF2(), current_clock_state= OC_PtuneF2, overclock_config_changed=true;
if (level == OC_PtuneF3 && current_clock_state!=OC_PtuneF3) SetOCPtuneF3(), current_clock_state= OC_PtuneF3, overclock_config_changed=true;
if (level == OC_PtuneF4 && current_clock_state!=OC_PtuneF4) SetOCPtuneF4(), current_clock_state= OC_PtuneF4, overclock_config_changed=true;
if (level == OC_PtuneF5 && current_clock_state!=OC_PtuneF5) SetOCPtuneF5(), current_clock_state= OC_PtuneF5, overclock_config_changed=true;
if (level == OC_Default && current_clock_state!=OC_Default) SetOCDefault_CG50(), current_clock_state= OC_Default, overclock_config_changed=true;
if (level == OC_PtuneF2 && current_clock_state!=OC_PtuneF2) SetOCPtuneF2_CG50(), current_clock_state= OC_PtuneF2, overclock_config_changed=true;
if (level == OC_PtuneF3 && current_clock_state!=OC_PtuneF3) SetOCPtuneF3_CG50(), current_clock_state= OC_PtuneF3, overclock_config_changed=true;
if (level == OC_PtuneF4 && current_clock_state!=OC_PtuneF4) SetOCPtuneF4_CG50(), current_clock_state= OC_PtuneF4, overclock_config_changed=true;
if (level == OC_PtuneF5 && current_clock_state!=OC_PtuneF5) SetOCPtuneF5_CG50(), current_clock_state= OC_PtuneF5, overclock_config_changed=true;
newPphi = getPphi_sh7305(); // we get the new P_Phi_f after OC
computeNewTimersParameters( initPphi, newPphi ); // we compute the new TCNT and TCOR as per the new frequency
@ -295,5 +511,32 @@ int clock_overclock( overclock_level level )
return 1;
}
else if(gint[HWCALC] == HWCALC_PRIZM && current_clock_state!=level)
{
cpu_atomic_start();
listTimerStatus(); // we list the running timers
initPphi = getPphi_sh7305(); // we get the current P_Phi_f
getInitialTimersParameters(); // we collect the current TCNT and TCOR
if (level == OC_Default && current_clock_state!=OC_Default) SetOCDefault_CG10_20(), current_clock_state= OC_Default, overclock_config_changed=true;
if (level == OC_PtuneF2 && current_clock_state!=OC_PtuneF2) SetOCPtuneF2_CG10_20(), current_clock_state= OC_PtuneF2, overclock_config_changed=true;
if (level == OC_PtuneF3 && current_clock_state!=OC_PtuneF3) SetOCPtuneF3_CG10_20(), current_clock_state= OC_PtuneF3, overclock_config_changed=true;
if (level == OC_PtuneF4 && current_clock_state!=OC_PtuneF4) SetOCPtuneF4_CG10_20(), current_clock_state= OC_PtuneF4, overclock_config_changed=true;
if (level == OC_PtuneF5 && current_clock_state!=OC_PtuneF5) SetOCPtuneF5_CG10_20(), current_clock_state= OC_PtuneF5, overclock_config_changed=true;
newPphi = getPphi_sh7305(); // we get the new P_Phi_f after OC
computeNewTimersParameters( initPphi, newPphi ); // we compute the new TCNT and TCOR as per the new frequency
updateNewTimersParameters(); // we adjust the timers accordingly
cpu_atomic_end();
cpg_compute_freq();
return 1;
}
else return 0;
}

View File

@ -8,6 +8,7 @@ extern "C" {
typedef enum
{
OC_Undefined = -1, // Mode not recognized as a PTune/FTune configuration (i.e. certainly a user-defined mode)
OC_Default = 0, // Default (118MHz)
OC_PtuneF2 = 1, // 59MHz
OC_PtuneF3 = 2, // 96MHz
@ -22,6 +23,7 @@ typedef enum
int clock_overclock( overclock_level level );
overclock_level overclock_detect( void );
#ifdef __cplusplus
}

View File

@ -36,7 +36,7 @@
#define DEBUGXXX 0
#define OVERCLCK_ACTIVABLE 1
char version[5] = {'V','1','.','0','6'};
char version[5] = {'V','1','.','0','7'};
extern bopti_image_t player;
@ -136,6 +136,7 @@ int lastindex=0;
int CC=0; // current curve
int CS=0;
overclock_level EntryLevel;
void initEverything( void )
@ -398,9 +399,11 @@ int main(void)
bool canWeAllocate3Mb = false;
#if (OVERCLCK_ACTIVABLE==1)
//Check if we can overclock i.e. if we have a CG50/Graph 90+E
if (gint[HWCALC] == HWCALC_FXCG50)
if (gint[HWCALC] == HWCALC_FXCG50 || gint[HWCALC] == HWCALC_PRIZM)
{
EntryLevel = overclock_detect();
isOCPossible = true;
}
else
isOCPossible = false;
#endif
@ -527,8 +530,9 @@ int main(void)
gint_world_switch( GINT_CALL( saveparameters ) );
if (gint[HWCALC] == HWCALC_FXCG50 && isOCActivated == true) clock_overclock( OC_PtuneF5 );
else if (gint[HWCALC] == HWCALC_FXCG50 && isOCActivated == false) clock_overclock( OC_Default );
if ((gint[HWCALC] == HWCALC_FXCG50 || gint[HWCALC] == HWCALC_PRIZM) && isOCActivated == true) clock_overclock( OC_PtuneF5 );
else if ((gint[HWCALC] == HWCALC_FXCG50 || gint[HWCALC] == HWCALC_PRIZM) && isOCActivated == false && EntryLevel != OC_Undefined) clock_overclock( EntryLevel );
else if ((gint[HWCALC] == HWCALC_FXCG50 || gint[HWCALC] == HWCALC_PRIZM) && isOCActivated == false && EntryLevel == OC_Undefined) clock_overclock( OC_Default );
}
else if (mode==3)
{
@ -1169,7 +1173,7 @@ int main(void)
dimage( 198-bigflag.width/2, 112-bigflag.height/2, &bigflag );
if (ranking!=-1)
if (ranking!=-1 || mode==0)
{
dfont(&startseq);
@ -1371,7 +1375,8 @@ int main(void)
usb_close();
#endif
if (gint[HWCALC] == HWCALC_FXCG50 && isOCActivated == true) clock_overclock( OC_Default );
if ((gint[HWCALC] == HWCALC_FXCG50 || gint[HWCALC] == HWCALC_PRIZM) && isOCActivated == true && EntryLevel != OC_Undefined) clock_overclock( EntryLevel );
else if ((gint[HWCALC] == HWCALC_FXCG50 || gint[HWCALC] == HWCALC_PRIZM) && isOCActivated == true && EntryLevel == OC_Undefined) clock_overclock( OC_Default );
delete cam;