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)
34 typedef unsigned char u8;
35 typedef unsigned int u32;
41 void mmap_init(u8 memtype);
42 void uart0_init(void);
43 void uart0_send_string(char *txbuf);
44 void uart0_send_char(char send);
52 /* memory mapping of interrupt vectors to static ram */
54 //mmap_init(MMAP_RAM);
56 /* uart initialization */
61 PINSEL0=0x05; // pin select -> tx, rx
62 UART0_FCR=0x07; // enable fifo
63 UART0_LCR=0x83; // set dlab + word length
64 UART0_DLL=0x10; // br: 9600 @ 10/4 mhz
66 UART0_LCR=0x03; // unset dlab
69 /* external memory init */
72 while(!(UART0_LSR&(1<<5)))
84 void mmap_init(u8 memtype) {
89 void uart0_init(void) {
91 PINSEL0=0x05; // pin select -> tx, rx
92 UART0_FCR=0x07; // enable fifo
93 UART0_LCR=0x83; // set dlab + word length
94 UART0_DLL=0x10; // br: 9600 @ 10/4 mhz
96 UART0_LCR=0x03; // unset dlab
99 void uart0_send_string(char *txbuf) {
106 UART0_THR=txbuf[i++];
110 while(!(UART0_LSR&(1<<6))) {}
113 void uart0_send_char(char send) {
115 while(!(UART0_LSR&(1<<5)))