skeezix
Internal Development
I'm sure this topic has been done to death, but I figure I've got to get auto-frameskip in for craigix one of these days (CaSTaway/GP).
Hmm, I suck; I was sure I used a table, but I didn't.. I cheaped out with an if-block nabbed partly from someone else:
if ( ac == cl_66 ) {
GpClockSpeedChange(67800000, 0x69032, 3);
//GpClockSpeedChange(66000000, 0x24001, 2);
} else if ( ac == cl_99 ) {
GpClockSpeedChange( 99000000, 0x19001, 2); // or mode 3?
} else if ( ac == cl_132 ) {
GpClockSpeedChange(132000000, 0x24001, 2); /* 132MHz? */
} else if ( ac == cl_150 ) {
GpClockSpeedChange( 150000000, 0x2a001, 3); // Thanks [SoD]Thor!
} else if ( ac == cl_156 ) {
GpClockSpeedChange( 156000000, 0x2c001, 3); // Thanks [SoD]Thor!
} else if ( ac == cl_160 ) {
GpClockSpeedChange ( 160000000, 0x48011, 3 ); // Thanks [SoD]Thor!
} else if ( ac == cl_166 ) {
GpClockSpeedChange ( 166000000, 0x4b011, 3 ); // pllset tool
}
It really should be something like this..
typedef struct {
char *c_name;
unsigned long int c_a, c_b;
unsigned char c_c;
unsigned int c_ticks_per_second;
} clock_t;
clock_t clocks[] = {
{ "66MHz", 67800000, 0x69032, 3, 67800000 },
// etc
{ NULL, 0, 0, 0, 0 }
};
I'm sure everyone else has a table like that.
So ..
Anyone have a nice collection of setting to GpClockSpeed.. that shows the 3 settings and what resulting tick count you get?
I'd like to make a good solid re-usable .c file for setting rate, from 40MHz to 220MHz say.
jeff
Hmm, I suck; I was sure I used a table, but I didn't.. I cheaped out with an if-block nabbed partly from someone else:
if ( ac == cl_66 ) {
GpClockSpeedChange(67800000, 0x69032, 3);
//GpClockSpeedChange(66000000, 0x24001, 2);
} else if ( ac == cl_99 ) {
GpClockSpeedChange( 99000000, 0x19001, 2); // or mode 3?
} else if ( ac == cl_132 ) {
GpClockSpeedChange(132000000, 0x24001, 2); /* 132MHz? */
} else if ( ac == cl_150 ) {
GpClockSpeedChange( 150000000, 0x2a001, 3); // Thanks [SoD]Thor!
} else if ( ac == cl_156 ) {
GpClockSpeedChange( 156000000, 0x2c001, 3); // Thanks [SoD]Thor!
} else if ( ac == cl_160 ) {
GpClockSpeedChange ( 160000000, 0x48011, 3 ); // Thanks [SoD]Thor!
} else if ( ac == cl_166 ) {
GpClockSpeedChange ( 166000000, 0x4b011, 3 ); // pllset tool
}
It really should be something like this..
typedef struct {
char *c_name;
unsigned long int c_a, c_b;
unsigned char c_c;
unsigned int c_ticks_per_second;
} clock_t;
clock_t clocks[] = {
{ "66MHz", 67800000, 0x69032, 3, 67800000 },
// etc
{ NULL, 0, 0, 0, 0 }
};
I'm sure everyone else has a table like that.
So ..
Anyone have a nice collection of setting to GpClockSpeed.. that shows the 3 settings and what resulting tick count you get?
I'd like to make a good solid re-usable .c file for setting rate, from 40MHz to 220MHz say.
jeff