1 #include <system_def.h>
3 #include <hal_machperiph.h>
5 unsigned int system_frequency = FOSC; /*!< System Clock Frequency (Core Clock) */
7 void system_clock_init(void)
9 // set PLL multiplier & divisor.
10 // values computed from config.h
11 PLLCFG = PLLCFG_MSEL | PLLCFG_PSEL;
15 PLLFEED = 0xAA; // Make it happen. These two updates
16 PLLFEED = 0x55; // MUST occur in sequence.
19 while (!(PLLSTAT & PLLSTAT_LOCK))
22 // enable & connect PLL
23 PLLCON = PLLCON_PLLE | PLLCON_PLLC;
24 PLLFEED = 0xAA; // Make it happen. These two updates
25 PLLFEED = 0x55; // MUST occur in sequence.
27 system_frequency=CCLK;
29 // setup & enable the MAM
31 MAMTIM = MAMTIM_CYCLES;
34 // set the peripheral bus speed
35 // value computed from config.h
36 VPBDIV = VPBDIV_VALUE; // set the peripheral bus clock speed
39 void lpc_watchdog_feed()
49 void lpc_watchdog_init(int on,int timeout_ms)
52 WDTC = PCLK/(1000/timeout_ms);
53 WDMOD = 0x03; /* Enable watchdog timer and reset */