Пример #1
0
static void uart00_tx_chars(struct uart_port *port)
{
	struct circ_buf *xmit = &port->info->xmit;
	int count;

	if (port->x_char) {
		while ((UART_GET_TSR(port) & UART_TSR_TX_LEVEL_MSK) == 15)
			barrier();
		UART_PUT_CHAR(port, port->x_char);
		port->icount.tx++;
		port->x_char = 0;
		return;
	}
	if (uart_circ_empty(xmit) || uart_tx_stopped(port)) {
		uart00_stop_tx(port);
		return;
	}

	count = port->fifosize >> 1;
	do {
		while ((UART_GET_TSR(port) & UART_TSR_TX_LEVEL_MSK) == 15)
			barrier();
		UART_PUT_CHAR(port, xmit->buf[xmit->tail]);
		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
		port->icount.tx++;
		if (uart_circ_empty(xmit))
			break;
	} while (--count > 0);

	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
		uart_write_wakeup(port);

	if (uart_circ_empty(xmit))
		uart00_stop_tx(port);
}
Пример #2
0
static void uart00_tx_chars(struct uart_port *port)
{
	int count;
	struct uart_info *info = port->info;

	if (port->x_char) {
		while((UART_GET_TSR(port)& UART_TSR_TX_LEVEL_MSK)==15);
		UART_PUT_CHAR(port, port->x_char);
		port->icount.tx++;
		port->x_char = 0;
		
		return;
	}
	if (info->xmit.head == info->xmit.tail
	    || info->tty->stopped
	    || info->tty->hw_stopped) {
		uart00_stop_tx(port, 0);
		return;
	}

	count = port->fifosize >> 1;
	do {
		while((UART_GET_TSR(port)& UART_TSR_TX_LEVEL_MSK)==15);
		UART_PUT_CHAR(port, info->xmit.buf[info->xmit.tail]);
		info->xmit.tail = (info->xmit.tail + 1) & (UART_XMIT_SIZE - 1);
		port->icount.tx++;
		if (info->xmit.head == info->xmit.tail)
			break;
	} while (--count > 0);

	if (CIRC_CNT(info->xmit.head,
		     info->xmit.tail,
		     UART_XMIT_SIZE) < WAKEUP_CHARS)
		uart_write_wakeup(port);

	if (info->xmit.head == info->xmit.tail)
		uart00_stop_tx(port, 0);
}