#include <cpu_def.h>
#include <hal_machperiph.h>
-void lpc_pll_on()
+unsigned int system_frequency = FOSC; /*!< System Clock Frequency (Core Clock) */
+
+void system_clock_init(void)
{
// set PLL multiplier & divisor.
// values computed from config.h
PLLCON = PLLCON_PLLE | PLLCON_PLLC;
PLLFEED = 0xAA; // Make it happen. These two updates
PLLFEED = 0x55; // MUST occur in sequence.
-}
-void lpc_pll_off()
-{
- // disable PLL
- PLLCON = 0;
- PLLFEED = 0xAA; // Make it happen. These two updates
- PLLFEED = 0x55; // MUST occur in sequence.
+ system_frequency=CCLK;
+
+ // setup & enable the MAM
+ MAMCR = 0;
+ MAMTIM = MAMTIM_CYCLES;
+ MAMCR = MAMCR_FULL;
+
+ // set the peripheral bus speed
+ // value computed from config.h
+ VPBDIV = VPBDIV_VALUE; // set the peripheral bus clock speed
}
void lpc_watchdog_feed()