Ejemplo n.º 1
0
void Uart1_SendByte(int data) {
    char localBuf[2] = {'\0','\0'};

    if(data == '\n') {
	   while (!(rUTRSTAT1 & 0x2));     // esperar a que THR se vacie
	   WrUTXH1('\r');			       // escribir retorno de carro (utilizar macro)
	}
	while (!(rUTRSTAT1 & 0x2)); 	   // esperar a que THR se vacie
	WrUTXH1(data);				       // escribir data (utilizar macro)
}
/*
 * Output a single byte to the serial port.
 */
void serial_putc_s3c24xx(const int uart, const char c)
{
	switch(uart)
	{
	case UART0:
		while ( !( rUTRSTAT0 & 0x2 ) );
		WrUTXH0(c);
		break;
	case UART1:
		while ( !( rUTRSTAT1 & 0x2 ) );
		WrUTXH1(c);
		break;
	case UART2:
		while ( !( rUTRSTAT2 & 0x2 ) );
		WrUTXH2(c);
		break;
	default:
		break;
	}
}