00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #define FOSC 24000000
00016 #define PLL_MUL 1
00017 #define MSEL (PLL_MUL-1)
00018
00019
00020 #define CCLK (FOSC * PLL_MUL) // CPU Clock Freq.
00021 #define PBSD 4 // MUST BE 1, 2, or 4
00022 #define PCLK (CCLK / PBSD) // Pheripheal Bus Clock Freq.
00023 #define VPBDIV_VALUE (PBSD & 0x03) // VPBDIV value
00024
00025 #define FCCO_MAX (320000000) // Max CC Osc Freq.
00026 #define PLL_DIV 4 //(FCCO_MAX / (2 * CCLK)) // PLL Divider
00027 #define FCCO (FOSC * PLL_MUL * 2 * PLL_DIV) // CC Osc. Freq.
00028
00029
00030 #if ((FOSC < 10000000) || (FOSC > 25000000))
00031 #error Fosc out of range (10MHz-25MHz)
00032 #error correct and recompile
00033 #endif
00034
00035 #if ((CCLK < 10000000) || (CCLK > 60000000))
00036 #error cclk out of range (10MHz-60MHz)
00037 #error correct PLL_MUL and recompile
00038 #endif
00039
00040 #if ((FCCO < 150000000) || (FCCO > 320000000))
00041 #error Fcco out of range (156MHz-320MHz)
00042 #error internal algorithm error
00043 #endif
00044
00045 #if ((PBSD != 1) && (PBSD != 2) && (PBSD != 4))
00046 #error Pheripheal Bus Speed Divider (PBSD) illegal value (1, 2, or 4)
00047 #endif
00048
00049
00050