Esempio n. 1
0
File: dbgu.c Progetto: 12019/openpcd
//*----------------------------------------------------------------------------
//* \fn    AT91F_DBGU_Printk
//* \brief This function is used to send a string through the DBGU channel (Very low level debugging)
//*----------------------------------------------------------------------------
void AT91F_DBGU_Printk(char *buffer)
{
	while (*buffer != '\0') {
		while (!AT91F_US_TxReady((AT91PS_USART) AT91C_BASE_DBGU)) ;
		AT91F_US_PutChar((AT91PS_USART) AT91C_BASE_DBGU, *buffer++);
	}
}
Esempio n. 2
0
//*----------------------------------------------------------------------------
//* \fn    AT91F_Putc
//* \brief This function sends a car through the DBGU
//*----------------------------------------------------------------------------
int AT91F_Putc(int ch) 
{
    /* Our implementation of fputc */ 
    while (!AT91F_US_TxReady((AT91PS_USART)AT91C_BASE_DBGU));
    AT91F_US_PutChar((AT91PS_USART)AT91C_BASE_DBGU, (char)ch);
    return ch; 
}
Esempio n. 3
0
File: dbgu.c Progetto: 12019/openpcd
static void __rb_flush(void)
{
	char ch;
	while (dbgu_rb_pull(&ch) >= 0) {
		while (!AT91F_US_TxReady((AT91PS_USART) AT91C_BASE_DBGU)) ;
		AT91F_US_PutChar((AT91PS_USART) AT91C_BASE_DBGU, ch);
	}
}
Esempio n. 4
0
//*----------------------------------------------------------------------------
//* \fn    AT91F_DBGU_Printk
//* \brief This function is used to send a string through the DBGU channel (Very low level debugging)
//*----------------------------------------------------------------------------
void AT91F_DBGU_Printk(
	char *buffer) // \arg pointer to a string ending by \0
{
	while(*buffer != '\0') {
		while (!AT91F_US_TxReady((AT91PS_USART)AT91C_BASE_DBGU));
		AT91F_US_PutChar((AT91PS_USART)AT91C_BASE_DBGU, *buffer++);
	}
}
Esempio n. 5
0
void
put_hexdigit(unsigned char		i)
{
	if( i < 0x0A )
		i += '0';
	else
		i += 'A' - 0x0A;
	while (!AT91F_US_TxReady(AT91C_BASE_US0));
		AT91F_US_PutChar(AT91C_BASE_US0, i);
}	
Esempio n. 6
0
static void my_putc(char c) 
{
	while (!AT91F_US_TxReady((AT91PS_USART)AT91C_BASE_DBGU));
	AT91F_US_PutChar((AT91PS_USART)AT91C_BASE_DBGU, c);
}
int main()
{
	int				_row, _col;
	char			c;
	U32				status;
	
	AT91PS_PIO    	pPioA  	= AT91C_BASE_PIOA;
	AT91PS_PMC    	pPMC   	= AT91C_BASE_PMC;
	AT91PS_USART 	pUART0 	= AT91C_BASE_US0;

	
	/* Initialize the Atmel AT91SAM7X256 (watchdog, PLL clock, default interrupts, etc.) */
	AT91F_LowLevel_Init();
	
	/* Init the LCD */
	InitLCD();

	/* Init the UART */
	AT91F_US_Configure(pUART0, MCK, AT91C_US_ASYNC_MODE, 9600L, 0 );
	AT91F_PMC_EnablePeripheralClock(pPMC, 1 << AT91C_ID_US0 );
    AT91F_US_EnableRx(pUART0);
    AT91F_US_EnableTx(pUART0);
	AT91F_PIO_Disable( pPioA, RXD0 | TXD0 | RTS0 | CTS0  );
	AT91F_PIO_A_RegisterSelection( pPioA, RXD0 | TXD0 | RTS0 | CTS0  );

	
	/* enable interrupts */
	AT91F_Finalize_Init();

	
	/* add your program here ... */
	LCD_ClearScreen( LCD_COLOR_RED );
	LCD_WriteString("UART Demo:", &Fixedsys_descriptor, 2, Fixedsys_descriptor.font_height, 
			                                               LCD_COLOR_WHITE, LCD_COLOR_RED);
	_row = 2*(Fixedsys_descriptor.font_height+2);
	_col = 2;
	
	/* ... and here */
	while ( true )
	{
		status = AT91F_US_RxReady(pUART0);
		if(status) {
			c = AT91F_US_GetChar(pUART0);
			AT91F_US_PutChar(pUART0, c);
			LCD_WriteChar(c, &Fixedsys_descriptor, _col, _row, LCD_COLOR_WHITE, LCD_COLOR_RED);
			if (_col<(128-Fixedsys_descriptor.font_width))
				_col += Fixedsys_descriptor.font_width;
			else {
				_col = 2;
				_row += (Fixedsys_descriptor.font_height+2);
				if (_row>(128-Fixedsys_descriptor.font_height)) {
					LCD_ClearScreen( LCD_COLOR_RED );
					_row = 2; //Fixedsys_descriptor.font_height;
					_col = 2;
				}
			}
		}
		else
			status = AT91F_US_TxReady(pUART0);
			if(status) {
				//AT91F_US_PutChar(pUART0, '.');
			}
	}
	
	/* Actually, the execution never gets here */
	return 0;
}
Esempio n. 8
0
int at91_dbgu_putc(int ch)
{
  while (!AT91F_US_TxReady((AT91PS_USART)AT91C_BASE_DBGU));
  AT91F_US_PutChar((AT91PS_USART)AT91C_BASE_DBGU, (char)ch);
  return ch;
}