/* Set baud rate and characteristics (115200 8N1) and map to GPIO  */
void uart_init()
/* Set baud rate and characteristics (115200 8N1) and map to GPIO  */
void uart_init()
{
    register unsigned int r;
    *AUX_ENABLE |=1;
    *AUX_MU_CNTL = 0;
    *AUX_MU_LCR = 3;
    *AUX_MU_MCR = 0;
    *AUX_MU_IER = 0;
    *AUX_MU_IIR = 0xc6;
    *AUX_MU_BAUD = 270;
    r=*GPFSEL1;
    r&=~((7<<12)|(7<<15));
    r|=(2<<12)|(2<<15);
    *GPFSEL1 = r;
    *GPPUD = 0;
    r=150; while(r--) { asm volatile("nop"); }
    *GPPUDCLK0 = (1<<14)|(1<<15);
    r=150; while(r--) { asm volatile("nop"); }
    *GPPUDCLK0 = 0;
    *AUX_MU_CNTL = 3;
}