[BACK]Return to cons_ns16550.c CVS log [TXT][DIR] Up to [local] / prex / boot / arm / cats

File: [local] / prex / boot / arm / cats / cons_ns16550.c (download)

Revision 1.1, Tue Aug 19 16:35:35 2008 UTC (15 years, 9 months ago) by nbrk
Branch: MAIN
CVS Tags: HEAD

backport bootldr bits for StrongARM-based EB110ATX boards.

/*
 * $Id: cons_ns16550.c,v 1.1 2008/08/19 16:35:35 nbrk Exp $
 */
/*
 * ns16550 USART to be used by bootldr.
 */
#include <boot.h>
#include <platform.h>

#define IO_BASE	0x7c000000

#define USART0_BASE	(IO_BASE + 0x3f8)
#define USART1_BASE	(IO_BASE + 0x2f8)

#define UART_DR	0	/* TX/RX data register */
#define UART_LSR	5	/* line status register */
#define  LST_DR		0x01	/* receiver data ready */
#define  LSR_TEMT	0x40	/* transmitter empty */

void
putchar(int c)
{
	uint32_t	dev;
	
	dev = USART0_BASE;

	/* poll TEMT */
	while (((*(volatile uint32_t *)(dev + UART_LSR * 4)) & LSR_TEMT) != 0)
		;

	/* write tx fifo */
	*(volatile uint32_t *)(dev + UART_DR * 4) = (c & 0x7f);
}