code clean up!
[my-code/arm.git] / betty / system.c
diff --git a/betty/system.c b/betty/system.c
new file mode 100644 (file)
index 0000000..4876802
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * system.c - misc system specific stuff
+ *
+ * author: hackbard@hackdaworld.org
+ *
+ */
+
+#include "system.h"
+
+/*
+ * functions
+ */
+
+void mmap_init(u8 memtype) {
+
+       MEMMAP=memtype;
+}
+
+void pll_init(void) {
+
+       /* configuration */
+       PLLCFG=0x42;    // multiplier = 3 (for cclk), dividor = 4 (for f_cco)
+       PLLCON=0x03;    // enable and set as clk source for the lpc
+
+       /* feed sequence */
+       PLLFEED=0xaa;
+       PLLFEED=0x55;
+
+       /* wait for lock */
+       while(!(PLLSTAT&(1<<10)))
+               continue;
+}
+
+void pause(int cnt) {
+
+       while(cnt--)
+               asm volatile ("nop");
+}
+