X-Git-Url: https://hackdaworld.org/gitweb/?p=my-code%2Farm.git;a=blobdiff_plain;f=betty%2Fbetty.c;fp=betty%2Fbetty.c;h=af593d87008cfc5fcc6e4d163037a81f3d2032fc;hp=81b4687e2f18566f931a4e397e0a5b9ccddc3915;hb=60432148802391c2ba390e9c56f999514653c969;hpb=def8902c1681a94ccb70d90cc855aedbc6a9e918 diff --git a/betty/betty.c b/betty/betty.c index 81b4687..af593d8 100644 --- a/betty/betty.c +++ b/betty/betty.c @@ -5,48 +5,12 @@ * */ -/* - * includes - */ - -#include "lpc2xxx.h" +#include "betty.h" /* - * defines + * functions */ -/* bank 0/2 and boootloader addr/size */ -#define BANK0 0x80000000 -#define BANK1 0x81000000 -#define BANK2 0x82000000 -#define BANK_SIZE 0x00100000 -#define BOOTLOADER 0x7fffe000 -#define BL_SIZE 0x00002000 - -/* flash cmd addresses - flash[0-18] <--> arm[1-19]*/ -#define B0F555 (*((volatile unsigned short *)(BANK0|0xaaa))) // 0x555 -#define B0F2AA (*((volatile unsigned short *)(BANK0|0x554))) // 0x2aa -#define B0F (*((volatile unsigned short *)(BANK0))) -#define B2F555 (*((volatile unsigned short *)(BANK2|0xaaa))) // 0x555 -#define B2F2AA (*((volatile unsigned short *)(BANK2|0x554))) // 0x2aa -#define B2F (*((volatile unsigned short *)(BANK2))) - -/* lcd command and data addresses */ -#define LCD_CMD (*((volatile unsigned char *)(BANK1))) -#define LCD_DATA (*((volatile unsigned char *)(BANK1+1))) - -/* - * type definitions - */ - -typedef unsigned char u8; -typedef unsigned short u16; -typedef unsigned int u32; - - /* - * functions - */ - void mmap_init(u8 memtype) { MEMMAP=memtype; @@ -84,7 +48,10 @@ void pin_select_init() { void uart0_init(void) { - PINSEL0=0x05; // pin select -> tx, rx + /* select pins 0.0 and 0.1 as tx and rx */ + PINSEL0=(PINSEL0&~(0xf))|0x05; // pin select -> tx, rx + + /* configure uart0 */ UART0_FCR=0x07; // enable fifo UART0_LCR=0x83; // set dlab + word length UART0_DLL=0x04; // br: 38400 @ 10/4 mhz @@ -289,6 +256,8 @@ void bl_off(void) { int main() { char buf[]="betty - live from the flash at 0x80000000! ;)\r\n"; + u64 keys; + u8 i; pll_init(); uart0_init(); @@ -296,13 +265,24 @@ int main() { pin_select_init(); init_lcd(0); bl_init(); + button_init(); pause(0xffffff); + bl_toggle(); + while(1) { - uart0_send_string(buf); - bl_toggle(); - pause(0x9ffff); + uart0_send_string("\n"); + //uart0_send_string(buf); + //bl_toggle(); + pause(0x0fffff); + button_get_event(&keys,1000); + for(i=0;i<42;i++) { + //if(keys&(1<