1 #include <system_def.h>
3 #include <hal_machperiph.h>
7 // set PLL multiplier & divisor.
8 // values computed from config.h
9 PLLCFG = PLLCFG_MSEL | PLLCFG_PSEL;
10 PLLFEED = 0xAA; // Make it happen. These two updates
11 PLLFEED = 0x55; // MUST occur in sequence.
15 PLLFEED = 0xAA; // Make it happen. These two updates
16 PLLFEED = 0x55; // MUST occur in sequence.
18 CCLKCFG = HCLK_DIV_CPU; //only odd values have to be used
19 USBCLKCFG = HCLK_DIV_USB; //only odd values have to be used
22 while (!(PLLSTAT & PLLSTAT_LOCK))
25 // enable & connect PLL
26 PLLCON = PLLCON_PLLE | PLLCON_PLLC;
27 PLLFEED = 0xAA; // Make it happen. These two updates
28 PLLFEED = 0x55; // MUST occur in sequence.
35 PLLFEED = 0xAA; // Make it happen. These two updates
36 PLLFEED = 0x55; // MUST occur in sequence.
39 void lpc_watchdog_feed()
49 void lpc_watchdog_init(int on,int timeout_ms)
52 WDCLKSEL=1; //PCLK as WDT source
53 /* FIXME - only seconds are used for WDT */
54 WDTC=(PCLK/4)*(timeout_ms/1000);
55 WDMOD = 0x03; /* Enable watchdog timer and reset */