Пример #1
0
void Uart_SendByte(int data)
{
	if(whichUart==0)
    {
		if(data=='\n')
		{
		    while(!(rUTRSTAT0 & 0x2));
		    Delay(10);				//because the slow response of hyper_terminal 
		    WrUTXH0('\r');
		}
		while(!(rUTRSTAT0 & 0x2)); 	//Wait until THR is empty.
		Delay(10);
		WrUTXH0(data);
   	}
	else
    {
		if(data=='\n')
		{
			while(!(rUTRSTAT1 & 0x2));
			Delay(10);				//because the slow response of hyper_terminal 
			rUTXH1='\r';
		}
		while(!(rUTRSTAT1 & 0x2));  //Wait until THR is empty.
		Delay(10);
		rUTXH1=data;
    }	
}		
Пример #2
0
 int putchar(int data)
//int usart_putc(int data)
{
    if(data == '\n') {
        while(!(rUTRSTAT0 & 0x2));   //Wait until THR is empty.    
        WrUTXH0('\r');
    }
	while(!(rUTRSTAT0 & 0x2));   //Wait until THR is empty.
	return WrUTXH0(data);
}
Пример #3
0
void Uart_Send_Byte(int data)
{
	if(data=='\n')
	{
		while(!(rUTRSTAT0 & 0x2));
		WrUTXH0('\r');
	}

	while(!(rUTRSTAT0 & 0x2));	
		WrUTXH0(data);
}
Пример #4
0
void Uart0_SendByte(int data) {
    char localBuf[2] = {'\0','\0'};

    if(data == '\n')		
	{
	   while (!(rUTRSTAT0 & 0x2));     // esperar a que THR se vacie
	   WrUTXH0('\r');			       // escribir retorno de carro (utilizar macro)
	}
	while (!(rUTRSTAT0 & 0x2)); 	   // esperar a que THR se vacie
	WrUTXH0(data);				       // escribir data (utilizar macro)
}
Пример #5
0
void Uart_SendByte(int data)
{
    if(data=='\n')
    {
        while(!(rUTRSTAT0 & 0x2));
        Delay();                 //because the slow response of hyper_terminal
        WrUTXH0('\r');
    }

    while(!(rUTRSTAT0 & 0x2));   //Wait until THR is empty.
    Delay();
    WrUTXH0(data);
}
Пример #6
0
void Uart0_TxInt(void)
{
    if(*uart0TxStr != '\0')     // mas caracteres que enviar?
    {
	   if(*uart0TxStr == '\n') 
	   {
	      WrUTXH0(CR_char);		// escribir retorno de carro
	      Uart_TxEmpty();
	   } 
	   WrUTXH0(*uart0TxStr++);  // escribir caracter y actualizar puntero
    }
    else						// fin de la cadena
    {
	   rINTMSK|=BIT_UTXD0;		// enmascarar UTXD0
	   uart0TxStr = 0;			// borrar puntero 
    }
    rI_ISPC=BIT_UTXD0;		    // finalizar interrupción
}
Пример #7
0
void Uart_SendByte(int data)
{
    char localBuf[2] = {'\0','\0'};
    
#ifdef UART_INT
    localBuf[0] = (char) data;	       // escribir caracter en el buffer
	uart0TxStr = localBuf;	           // actualizar puntero buffer
	rINTMSK &= ~(BIT_GLOBAL|BIT_UTXD0); // habilitar interrupción UTXD0
    while (uart0TxStr);	   			   // esperar a que se haya recorrido el buffer	
#else
    if(data == '\n')		
	{
	   while (!(rUTRSTAT0 & 0x2));     // esperar a que THR se vacie
	   WrUTXH0('\r');			       // escribir retorno de carro (utilizar macro)
	}
	while (!(rUTRSTAT0 & 0x2)); 	   // esperar a que THR se vacie
	Delay(10);					       // por precaución esperar 1 ms (hyper_terminal es lento)
	WrUTXH0(data);				       // escribir data (utilizar macro)
#endif
}
Пример #8
0
//---------------------------------------UART0 test function-------------------------------------
void __irq Uart0_TxInt(void)
{
    rINTSUBMSK|=(BIT_SUB_RXD0|BIT_SUB_TXD0|BIT_SUB_ERR0);	// Just for the safety
    if(*uart0TxStr != '\0') 
    {
        WrUTXH0(*uart0TxStr++);
	    ClearPending(BIT_UART0);		// Clear master pending
	    rSUBSRCPND=(BIT_SUB_TXD0);		// Clear Sub int pending
	    rINTSUBMSK&=~(BIT_SUB_TXD0);	// Unmask sub int
    }
    else
    {
    	isTxInt=0;
    	ClearPending(BIT_UART0);		// Clear master pending
        rSUBSRCPND=(BIT_SUB_TXD0);		// Clear Sub int pending
        rINTMSK|=(BIT_UART0);
    }
}
Пример #9
0
void __irq Uart0_TxFifo(void)
{
    rINTSUBMSK|=(BIT_SUB_RXD0|BIT_SUB_TXD0|BIT_SUB_ERR0);	// Just for the safety
    while (!(rUFSTAT0 & 0x200) && (*uart0TxStr != '\0')) 	//until tx fifo full or end of string
    	WrUTXH0(*uart0TxStr++);	
   
    if(*uart0TxStr == '\0') 
    {
    	rINTMSK|=BIT_UART0;
    	rSUBSRCPND=BIT_SUB_TXD0;	// Clear Sub int pending
        ClearPending(BIT_UART0);	// Clear master pending
    }
    else 
    {
        ClearPending(BIT_UART0);	// Clear master pending
    	rSUBSRCPND=BIT_SUB_TXD0;	// Clear Sub int pending
        rINTSUBMSK&=~(BIT_SUB_TXD0);	// Unmask sub int
    }
}
/*
 * 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;
	}
}
Пример #11
0
void __irq Uart0_AfcTx(void)
{
    rINTSUBMSK|=(BIT_SUB_RXD0|BIT_SUB_TXD0|BIT_SUB_ERR0);

    if(tx_cnt<AFC_BUFLEN)
    {
    	Uart_Printf("%d,",*txdataPt);
    	WrUTXH0(*txdataPt++);
	tx_cnt++;
        ClearPending(BIT_UART0);
        rSUBSRCPND=(BIT_SUB_TXD0);
        rINTSUBMSK&=~(BIT_SUB_TXD0);
    }
    else
    {
   	tx_end=1;
        while(rUFSTAT0 & 0x2f0);	//Until FIFO is empty
        ClearPending(BIT_UART0);
        rSUBSRCPND=(BIT_SUB_TXD0);
    	rINTMSK|=BIT_UART0;
    }
}
Пример #12
0
void Uart_SendByte(int data)
{
    while(!(rUTRSTAT0 & 0x2));   //Wait until THR is empty.
    Delay();
    WrUTXH0(data);
}
Пример #13
0
void uart_write(acoral_u8 ch){
	while(!(rUTRSTAT0 & 0x4));
	WrUTXH0(ch);
}