2 * fwbc.c - broadcast the betty tv original firmware via uart0
3 * use fwdump to write it onto your computers harddisk
5 * author: hackbard@hackdaworld.org
20 #define OSC_CLOCK 10000000
23 #define P_CLOCK (OSC_CLOCK/P_DIV)
31 #define BANK0 0x80000000
32 #define BANK2 0x82000000
38 typedef unsigned char u8;
39 typedef unsigned short u16;
40 typedef unsigned int u32;
46 void mmap_init(u8 memtype);
47 void uart0_init(void);
48 void uart0_send_string(char *txbuf);
49 void uart0_send_char(char send);
63 /* memory mapping of interrupt vectors to static ram */
65 //mmap_init(MMAP_RAM);
67 /* uart initialization */
71 PINSEL0=0x05; // pin select -> tx, rx
72 UART0_FCR=0x07; // enable fifo
73 UART0_LCR=0x83; // set dlab + word length
74 UART0_DLL=0x10; // br: 9600 @ 10/4 mhz
76 UART0_LCR=0x03; // unset dlab
78 /* external memory init */
84 /* wait for fwdump to send transmit start character */
87 while(!(UART0_LSR&(1<<0)))
92 /* transmit 1 mb of data */
93 for(i=0;i<524288;i++) {
94 while(!(UART0_LSR&(1<<5)))
96 UART0_THR=((*flash&0xff00)>>8);
97 while(!(UART0_LSR&(1<<5)))
99 UART0_THR=(*flash&0xff);
110 void mmap_init(u8 memtype) {
115 void uart0_init(void) {
117 PINSEL0=0x05; // pin select -> tx, rx
118 UART0_FCR=0x07; // enable fifo
119 UART0_LCR=0x83; // set dlab + word length
120 UART0_DLL=0x10; // br: 9600 @ 10/4 mhz
122 UART0_LCR=0x03; // unset dlab
125 void uart0_send_string(char *txbuf) {
132 UART0_THR=txbuf[i++];
136 while(!(UART0_LSR&(1<<6))) {}
139 void uart0_send_char(char send) {
141 while(!(UART0_LSR&(1<<5)))