X-Git-Url: http://rtime.felk.cvut.cz/gitweb/lincan.git/blobdiff_plain/cc1afb21bdc089426652f21769164645cae062fd..243fec4450d3a3246f3f0d92751a95daef7c1503:/embedded/arch/arm/mach-lpc21xx/libs/hal/hal_machperiph.c diff --git a/embedded/arch/arm/mach-lpc21xx/libs/hal/hal_machperiph.c b/embedded/arch/arm/mach-lpc21xx/libs/hal/hal_machperiph.c index 599fdc3..6316bb9 100644 --- a/embedded/arch/arm/mach-lpc21xx/libs/hal/hal_machperiph.c +++ b/embedded/arch/arm/mach-lpc21xx/libs/hal/hal_machperiph.c @@ -2,7 +2,9 @@ #include #include -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 @@ -21,14 +23,17 @@ void lpc_pll_on() 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()