- PINSEL2=0x0d6041d4;
-}
-
-void uart0_init(void) {
-
- PINSEL0=0x05; // pin select -> tx, rx
- UART0_FCR=0x07; // enable fifo
- UART0_LCR=0x83; // set dlab + word length
- UART0_DLL=0x04; // br: 38400 @ 10/4 mhz
- UART0_DLM=0x00;
- UART0_LCR=0x03; // unset dlab
-}
-
-void uart0_send_string(char *txbuf) {
-
- int i;
-
- i=0;
-
- while(txbuf[i]) {
- UART0_THR=txbuf[i++];
- /* flush if tx buffer maximum reached */
- if(!(i%16))
- while(!(UART0_LSR&(1<<6)))
- continue;
- }
-
- /* flush if \n and \r do not fit in the tx buffer */
- if(i>14)
- while(!(UART0_LSR&(1<<6)))
- continue;
-
- UART0_THR='\n';
- UART0_THR='\r';
-
- /* flush uart0 anyways */
- while(!(UART0_LSR&(1<<6)))
- continue;
-}
-
-void uart0_send_buf16(u16 *buf,int len) {
-
- int i;
-
- i=0;
-
- for(i=0;i<len/2;i++) {
- if(!(i%8))
- while(!(UART0_LSR&(1<<6)))
- continue;
- UART0_THR=buf[i]&0xff;
- UART0_THR=(buf[i]>>8)&0xff;
- }
-}
-
-void uart0_send_buf32(u32 *buf,int len) {
-
- int i;
-
- i=0;
-
- for(i=0;i<len/4;i++) {
- if(!(i%4))
- while(!(UART0_LSR&(1<<6)))
- continue;
- UART0_THR=buf[i]&0xff;
- UART0_THR=(buf[i]>>8)&0xff;
- UART0_THR=(buf[i]>>16)&0xff;
- UART0_THR=(buf[i]>>24)&0xff;
- }
-}
-
-void uart0_send_byte(u8 send) {
-
- while(!(UART0_LSR&(1<<5)))
- continue;
-
- UART0_THR=send;
-}
-
-u8 uart0_get_byte(void) {
-
- u8 rx;
-
- while(!(UART0_LSR&(1<<0)))
- continue;