It would be nice to add some source code to set gp32 clock speed on Pea's code repository.
What I have is quite a big mess. I will try to write it better as soon as I can (=not today).
Do you have any frequency I could add ?
What I have is quite a big mess. I will try to write it better as soon as I can (=not today).
Do you have any frequency I could add ?
Code:
//from aquafish
GpClockSpeedChange(67500000, 0x25002, 1) // 67.5 mhz
GpClockSpeedChange(99000000, 0x3a002, 2) // 99 mhz
GpClockSpeedChange(110000000, 0x2f011, 2) // 110 mhz
78000000, 0x2c002, 2 // 78 mhz
105000000, 0x1b001, 2 // 105 mhz
123000000, 0x21001, 2 // 123 mhz
135000000, 0x25001, 2 // 135 mhz
144000000, 0x28001, 2 // 144 mhz
Code:
// pour overclock (code thunderz)
// http://www.yaronet.com/posts.php?s=19489
#define CLOCK16 0
#define CLOCK33 1
#define CLOCK40 2
#define CLOCK50 3
#define CLOCK66 4
#define CLOCK80 5
#define CLOCK102 6
#define CLOCK133 7
#define CLOCK156 8
#define CLOCK166 9
#define MAXSPEED CLOCK166
char* freqStr[10] = {"16.5", "33", "40", "50", "66", "80", "102", "133", "156","166"};
//40, 80 et 102 ont un facteur 2.
//155 et 166 n'ont pas ete testes.
unsigned int ticks30 [10] = {28075, 56078, 34058, 42563, 28899, 68045, 86851, 56078, 66274, 70095};
void SetClockSpeed(int nClockSpeed)
{
// clkdvn MCLK HCLK PCLK
// 0 1 1 1
// 1 1 1 1/2
// 2 1 1/2 1/2
// 3 1 1/2 1/4
switch (nClockSpeed)
{
case CLOCK16:
/***** CPU at 16.5MHz *****/
GpClockSpeedChange(16500000, 0x71142, 0);
break;
case CLOCK33:
/***** CPU at 33MHz *****/
GpClockSpeedChange(33000000, 0x24003, 0);
break;
case CLOCK40:
// 40, 3
GpClockSpeedChange (40000000, 0x48013, 1);
break;
case CLOCK50:
/***** CPU at 50MHz *****/
GpClockSpeedChange(50000000,0x2a012,1);
break;
case CLOCK66:
// 67.8, 3
GpClockSpeedChange(67800000, 0x69032, 3);
break;
case CLOCK80:
GpClockSpeedChange( 80000000, 0x48012, 2 ); // 80 MHz
break;
case CLOCK102:
GpClockSpeedChange( 102000000, 0x1a020, 2 ); // 102 MHz
break;
case CLOCK133:
// 133, 3
GpClockSpeedChange(132000000, 0x3a011, 3);
break;
case CLOCK156:
GpClockSpeedChange (156000000, 0x2c001, 3);
break;
case CLOCK166:
GpClockSpeedChange (165000000, 0x2f001, 3);
break;
}
}