]> rtime.felk.cvut.cz Git - lincan.git/blobdiff - embedded/arch/arm/mach-lpc21xx/libs/hal/hal_machperiph.c
Update of system-less architecture and board support code to actual uLAN.sf.net version.
[lincan.git] / embedded / arch / arm / mach-lpc21xx / libs / hal / hal_machperiph.c
index 599fdc34c850061aee59cc1b1b0273fa4c1462a3..6316bb9e1f98cd39fab8712e0102400de2160b4c 100644 (file)
@@ -2,7 +2,9 @@
 #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
@@ -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()