void xmbrs_put_char(char ch)
{
	volatile unsigned int *uartp, out_word=ch;
	unsigned long		flags;
	int			i;

	uartp = (volatile unsigned int *) CONFIG_XILINX_UARTLITE_0_BASEADDR;

	save_flags_cli(flags);

	/* wait for tx buffer not full */
	for (i = 0; (i < 0x10000); i++) {
		if (!(uartp[XUL_STATUS_REG_OFFSET/4] & XUL_SR_TX_FIFO_FULL))
			break;
	}

	/* Did it drain? */
	if (i < 0x10000) {
		/* Send the char */
		uartp[XUL_TX_FIFO_OFFSET/4]=out_word;

		/* Wait for it to go */
		for (i = 0; (i < 0x10000); i++)
			if (!(uartp[XUL_STATUS_REG_OFFSET/4] & XUL_SR_TX_FIFO_FULL))
				break;
	}

	/* Was it sent? */
	if (i >= 0x10000)
		xmbrs_init_console(); /* try and get it back */

	restore_flags(flags);

	return;
}
示例#2
0
int xmbrs_console_setup(struct console *cp, char *arg)
{
	if (!cp)
		return(-1);

	xmbrs_console_port = cp->index;
	xmbrs_init_console(); 
	return(0);
}
void xmbrs_console_write(struct console *cp, const char *p, unsigned len)
{
	if (!xmbrs_console_inited)
		xmbrs_init_console();
	while (len-- > 0) {
		if (*p == '\n')
			xmbrs_put_char('\r');
		xmbrs_put_char(*p++);
	}
}
int xmbrs_console_setup(struct console *cp, char *arg)
{
	if (!cp)
		return(-1);

	if (!strncmp(cp->name, "ttyS", 4))
                xmbrs_console_port = cp->index;
        else if (!strncmp(cp->name, "cua", 3))
                xmbrs_console_port = cp->index;
        else
                return(-1);

	xmbrs_init_console(); 
	return(0);
}