/* Set up and initialize clocking prior to call to main */ void Board_SetupClocking(void) { int i; Chip_SetupCoreClock(CLKIN_CRYSTAL, MAX_CLOCK_FREQ, true); /* Reset and enable 32Khz oscillator */ LPC_CREG->CREG0 &= ~((1 << 3) | (1 << 2)); LPC_CREG->CREG0 |= (1 << 1) | (1 << 0); /* Setup a divider E for main PLL clock switch SPIFI clock to that divider. Divide rate is based on CPU speed and speed of SPI FLASH part. */ #if (MAX_CLOCK_FREQ > 180000000) Chip_Clock_SetDivider(CLK_IDIV_E, CLKIN_MAINPLL, 5); #else Chip_Clock_SetDivider(CLK_IDIV_E, CLKIN_MAINPLL, 4); #endif Chip_Clock_SetBaseClock(CLK_BASE_SPIFI, CLKIN_IDIVE, true, false); /* Setup system base clocks and initial states. This won't enable and disable individual clocks, but sets up the base clock sources for each individual peripheral clock. */ for (i = 0; i < (sizeof(InitClkStates) / sizeof(InitClkStates[0])); i++) { Chip_Clock_SetBaseClock(InitClkStates[i].clk, InitClkStates[i].clkin, InitClkStates[i].autoblock_enab, InitClkStates[i].powerdn); } }
void InicializarCPU(void) { Chip_SetupCoreClock(CLKIN_IRC, MAX_CLOCK_FREQ/4, true); }
/* Set up and initialize hardware prior to call to main */ void Chip_SetupIrcClocking(void) { Chip_SetupCoreClock(CLKIN_IRC, MAX_CLOCK_FREQ, true); }
/* Setup system clocking */ void Chip_SetupXtalClocking(void) { Chip_SetupCoreClock(CLKIN_CRYSTAL, MAX_CLOCK_FREQ, true); }