FR, MB91460, FR Clocks
Document No. 002-05317 Rev. *C
15
/* SAMPLE CODE */
/*------------------------------------------------------------------------*/
temp = CLKR_CLKS;
/* Switch the clock source to Main Oscillator */
if
( CLKR_CLKS == 3){
if
(OSCCR_OSCDS1 != 0 ){
CLKR &= 0x0E;
OSCRH = 0x24;
while
((!(OSCRH & 0x80))){
HWWD = 0x10;
/* awaiting stabilization time */
}
}
CLKR &= 0x0D;
}
else
{
CLKR_CLKS = 0;
}
if ((temp == 2)&&(PLLDIVG)) {
/* if normal freq switch and auto gear not disabled then wait for gear
down */
while
((!PLLCTRL_GRDN ))
{
HWWD = 0x10;
/* Wait for gear down flag (polling) */
}
HWWD = 0x10;
}
/* Reset gear down flag */
PLLCTRL_GRDN = 0;
/* Switch off the PLL */
CLKR_PLL1EN = 0;
/* Configure Clocks */
DIVR0 &= 0x00;
DIVR0 = cpu_clock_div << 4;
DIVR0 |= peripheral_clock_div;
DIVR1 = 0x00;
DIVR1 = external_bus_clock_div << 4;
/* Set the PLL interface registers (N, M, DG, MG) */
PLLDIVM = counter_m;
PLLDIVN = counter_n;
PLLDIVG = counter_g;
PLLMULG = counter_mulg;
//gear steps