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
11 #define OSC_CLOCK 10000000
14 #define P_CLOCK (OSC_CLOCK/P_DIV)
16 typedef unsigned char u8;
18 void uart0_init(int br) {
20 PINSEL0&=~((0x03<<0)|(0x03<<2)); // clear bits 0-3
21 PINSEL0|=((1<<0)|(1<<2)); // pin select: tx, rx
23 UART0_LCR|=(1<<7); // enable access to divisor
24 UART0_DLL=(P_CLOCK/(br*16))&0xff; // set divisor
25 UART0_DLL=((P_CLOCK/(br*16))&0xff00)>>8;
26 UART0_LCR&=~(1<<7); // disable access to divisor
28 UART0_LCR&=~(0x03<<2); // 1 stop bit, no parity
29 UART0_LCR|=0x03; // 8 data bits
31 UART0_FCR=0x01; // activate fifo
34 void uart_send(u8 byte) {
36 /* wait for empty transmit buffer */
37 while(!(UART0_LSR&(1<<5)))