X-Git-Url: https://hackdaworld.org/gitweb/?p=my-code%2Farm.git;a=blobdiff_plain;f=betty%2Ffwbc.c;h=169405583079b29a4a41ed078b2bf9be522b0ce4;hp=9682ee8292fb4396fb98f16f29aaf2560844e0a6;hb=af2e2299a2e4f4aca56de844f0c5011435672b92;hpb=ba94d4dc80e71b41a6458e028dd45673782bc5f5 diff --git a/betty/fwbc.c b/betty/fwbc.c index 9682ee8..1694055 100644 --- a/betty/fwbc.c +++ b/betty/fwbc.c @@ -27,11 +27,16 @@ #define MMAP_RAM 0x02 #define MMAP_EXT 0x03 +/* band 0/2 addr */ +#define BANK0 0x80000000 +#define BANK2 0x82000000 + /* * type definitions */ typedef unsigned char u8; +typedef unsigned short u16; typedef unsigned int u32; /* @@ -49,29 +54,50 @@ void uart0_send_char(char send); int main(void) { + /* variables */ + + u16 *flash; + u32 i; + u8 start; + /* memory mapping of interrupt vectors to static ram */ //mmap_init(MMAP_RAM); /* uart initialization */ -#ifdef USE_FUNCTIONS //uart0_init(); -#else + PINSEL0=0x05; // pin select -> tx, rx UART0_FCR=0x07; // enable fifo UART0_LCR=0x83; // set dlab + word length UART0_DLL=0x10; // br: 9600 @ 10/4 mhz UART0_DLM=0x00; UART0_LCR=0x03; // unset dlab -#endif /* external memory init */ - while(1) { + //BCFG0=; + //BCFG2=; + flash=(u16 *)BANK0; + + /* wait for fwdump to send transmit start character */ + start=0; + while(start!=0x23) { + while(!(UART0_LSR&(1<<0))) + continue; + start=UART0_RBR; + } + + /* transmit 1 mb of data */ + for(i=0;i<524288;i++) { + while(!(UART0_LSR&(1<<5))) + continue; + UART0_THR=((*flash&0xff00)>>8); while(!(UART0_LSR&(1<<5))) continue; - UART0_THR=0x23; + UART0_THR=(*flash&0xff); + flash++; } return 0;