FreeBSD/sys/arm/at91/uart_dev_at91usart.c
/*
 * Initialize this device for use as a console.
 */
Initialize this device for use as a console.
Initialize this device for use as a console .
static void
at91_usart_init(struct uart_bas *bas, int baudrate, int databits, int stopbits,
    int parity)
{
#ifdef EARLY_PRINTF
	if (early_putc != NULL) {
		printf("Early printf yielding control to the real console.\n");
		early_putc = NULL;
	}
#endif
	if (!(RD4(bas, USART_CSR) & USART_CSR_TXRDY))
		DELAY(10000);
	at91_usart_param(bas, baudrate, databits, stopbits, parity);
	WR4(bas, USART_CR, USART_CR_RSTSTA | USART_CR_RSTRX | USART_CR_RSTTX);
	WR4(bas, USART_CR, USART_CR_RXEN | USART_CR_TXEN);
	WR4(bas, USART_IDR, 0xffffffff);
}
static void at91_usart_init ( struct uart_bas * bas , int baudrate , int databits , int stopbits , int parity ) { #ifdef EARLY_PRINTF if ( early_putc != NULL ) { printf ( " \n " ) ; early_putc = NULL ; } #endif if ( ! ( RD4 ( bas , USART_CSR ) & USART_CSR_TXRDY ) ) DELAY ( 10000 ) ; at91_usart_param ( bas , baudrate , databits , stopbits , parity ) ; WR4 ( bas , USART_CR , USART_CR_RSTSTA | USART_CR_RSTRX | USART_CR_RSTTX ) ; WR4 ( bas , USART_CR , USART_CR_RXEN | USART_CR_TXEN ) ; WR4 ( bas , USART_IDR , 0xffffffff ) ; }
Initialize this device for use as a console.
Initialize this device for use as a console .
/*
	 * This routine is called multiple times, sometimes right after writing
	 * some output, and the last byte is still shifting out.  If that's the
	 * case delay briefly before resetting, but don't loop on TXRDY because
	 * we don't want to hang here forever if the hardware is in a bad state.
	 */ /* Reset the rx and tx buffers and turn on rx and tx */