Driver/tiny_serial/tiny_tx_chars()

Last-modified: 2007-09-20 (木) 15:15:06

059 :static void tiny_tx_chars(struct uart_port *port)
060 :{
061 : struct circ_buf *xmit = &port->info->xmit;
062 : int count;
063 :
064 : if (port->x_char) {

送信用キャラクタがあるか

065 : pr_debug("wrote %2x", port->x_char);
066 : port->icount.tx++;
067 : port->x_char = 0;
068 : return;
069 : }
070 : if (uart_circ_empty(xmit) || uart_tx_stopped(port)) {

待ち列が空か確認する

071 : tiny_stop_tx(port, 0);
072 : return;
073 : }
074 :
075 : count = port->fifosize >> 1;
076 : do {
077 : pr_debug("wrote %2x", xmit->buf[xmit->tail]);
078 : xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
079 : port->icount.tx++;
080 : if (uart_circ_empty(xmit))
081 : break;
082 : } while (--count > 0);
083 :
084 : if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)

ペンディングする?

085 : uart_write_wakeup(port);
086 :
087 : if (uart_circ_empty(xmit))
088 : tiny_stop_tx(port, 0);
089 :}