X-Git-Url: https://hackdaworld.org/gitweb/?p=my-code%2Farm.git;a=blobdiff_plain;f=betty%2Fsystem.c;fp=betty%2Fsystem.c;h=487680243b87fb1bb14af1b80d3ab19f16333cdc;hp=0000000000000000000000000000000000000000;hb=b4ca71fc214ba3c58cec25661ba1f81cf7b1b871;hpb=d6814c7408b23db8a441f731b44d4b638df24c64 diff --git a/betty/system.c b/betty/system.c new file mode 100644 index 0000000..4876802 --- /dev/null +++ b/betty/system.c @@ -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"); +} +