static u_int ambauart_tx_empty(struct uart_port *port) { unsigned int status; status = UART_GET_LSR(port); return UART_TX_READY(status) ? TIOCSER_TEMT : 0; }
static int apbuart_scan_fifo_size(struct uart_port *port, int portnumber) { int ctrl; int status; int fifosize; unsigned long flags; ctrl = UART_GET_CTRL(port); printk("Testing fifo size for UART port %i: ", portnumber); /* * Enable the transceiver and wait for it to be ready to send data. * Clear interrupts so that this process will not be externally * interrupted in the middle (which can cause the transceiver to * drain prematurely). */ local_irq_save(flags); UART_PUT_CTRL(port, ctrl | LEON_REG_UART_CTRL_TE); while (!UART_TX_READY(UART_GET_STATUS(port))); /* * Disable the transceiver so data isn't actually sent during the * actual test. */ UART_PUT_CTRL(port, ctrl & ~(LEON_REG_UART_CTRL_TE)); fifosize = 1; UART_PUT_CHAR(port, 0); /* * So long as transmitting a character increments the tranceivier FIFO * length the FIFO must be at least that big. These bytes will automatically * drain off of the FIFO. */ status = UART_GET_STATUS(port); while (((status >> 20) & 0x3F) == fifosize) { fifosize++; UART_PUT_CHAR(port, 0); status = UART_GET_STATUS(port); } fifosize--; UART_PUT_CTRL(port, ctrl); local_irq_restore(flags); printk("got %i bytes.\n", fifosize); if (fifosize == 0) { fifosize = 1; } return fifosize; }
static void apbuart_console_putchar(struct uart_port *port, int ch) { unsigned int status; do { status = UART_GET_STATUS(port); } while (!UART_TX_READY(status)); UART_PUT_CHAR(port, ch); }
static void pl010_console_putchar(struct uart_port *port, int ch) { unsigned int status; do { status = readb(port->membase + UART01x_FR); barrier(); } while (!UART_TX_READY(status)); writel(ch, port->membase + UART01x_DR); }
static void pl010_console_putchar(struct uart_port *port, int ch) { struct uart_amba_port *uap = (struct uart_amba_port *)port; unsigned int status; do { status = readb(uap->port.membase + UART01x_FR); barrier(); } while (!UART_TX_READY(status)); writel(ch, uap->port.membase + UART01x_DR); }
static void leonuart_console_write(struct console *co, const char *s, unsigned int count) { struct uart_port *port = &leon_ports[co->index].port; unsigned int status, old_cr; int i; /* * First save the CR then disable the interrupts */ old_cr = UART_GET_CTRL(port); UART_PUT_CTRL(port, (old_cr & ~(LEON_REG_UART_CTRL_RI | LEON_REG_UART_CTRL_TI)) | (LEON_REG_UART_CTRL_RE | LEON_REG_UART_CTRL_TE)); /* * Now, do each character */ for (i = 0; i < count; i++) { do { status = UART_GET_STATUS(port); } while (!UART_TX_READY(status)); UART_PUT_CHAR(port, s[i]); if (s[i] == '\n') { do { status = UART_GET_STATUS(port); } while (!UART_TX_READY(status)); UART_PUT_CHAR(port, '\r'); } } /* * Finally, wait for transmitter to become empty * and restore the TCR */ do { status = UART_GET_STATUS(port); } while (!UART_TX_READY(status)); UART_PUT_CTRL(port, old_cr); }
static void uart00_console_write(struct console *co, const char *s, unsigned count) { #ifdef CONFIG_ARCH_CAMELOT struct uart_port *port = &epxa10db_port; unsigned int status, old_ies; int i; /* * First save the CR then disable the interrupts */ old_ies = UART_GET_IES(port); UART_PUT_IEC(port,0xff); /* * Now, do each character */ for (i = 0; i < count; i++) { do { status = UART_GET_TSR(port); } while (!UART_TX_READY(status)); UART_PUT_CHAR(port, s[i]); if (s[i] == '\n') { do { status = UART_GET_TSR(port); } while (!UART_TX_READY(status)); UART_PUT_CHAR(port, '\r'); } } /* * Finally, wait for transmitter to become empty * and restore the IES */ do { status = UART_GET_TSR(port); } while (status & UART_TSR_TX_LEVEL_MSK); UART_PUT_IES(port, old_ies); #endif }
static void pl010_console_write(struct console *co, const char *s, unsigned int count) { struct uart_port *port = &amba_ports[co->index].port; unsigned int status, old_cr; int i; /* * First save the CR then disable the interrupts */ old_cr = UART_GET_CR(port); UART_PUT_CR(port, UART01x_CR_UARTEN); /* * Now, do each character */ for (i = 0; i < count; i++) { do { status = UART_GET_FR(port); } while (!UART_TX_READY(status)); UART_PUT_CHAR(port, s[i]); if (s[i] == '\n') { do { status = UART_GET_FR(port); } while (!UART_TX_READY(status)); UART_PUT_CHAR(port, '\r'); } } /* * Finally, wait for transmitter to become empty * and restore the TCR */ do { status = UART_GET_FR(port); } while (status & UART01x_FR_BUSY); UART_PUT_CR(port, old_cr); }
static void apbuart_console_write(struct console *co, const char *s, unsigned int count) { struct uart_port *port = &grlib_apbuart_ports[co->index]; unsigned int status, old_cr, new_cr; old_cr = UART_GET_CTRL(port); new_cr = old_cr & ~(UART_CTRL_RI | UART_CTRL_TI); UART_PUT_CTRL(port, new_cr); uart_console_write(port, s, count, apbuart_console_putchar); do { status = UART_GET_STATUS(port); } while (!UART_TX_READY(status)); UART_PUT_CTRL(port, old_cr); }
static int apbuart_scan_fifo_size(struct uart_port *port, int portnumber) { int ctrl, loop = 0; int status; int fifosize; unsigned long flags; ctrl = UART_GET_CTRL(port); local_irq_save(flags); UART_PUT_CTRL(port, ctrl | UART_CTRL_TE); while (!UART_TX_READY(UART_GET_STATUS(port))) loop++; UART_PUT_CTRL(port, ctrl & ~(UART_CTRL_TE)); fifosize = 1; UART_PUT_CHAR(port, 0); status = UART_GET_STATUS(port); while (((status >> 20) & 0x3F) == fifosize) { fifosize++; UART_PUT_CHAR(port, 0); status = UART_GET_STATUS(port); } fifosize--; UART_PUT_CTRL(port, ctrl); local_irq_restore(flags); if (fifosize == 0) fifosize = 1; return fifosize; }
static void apbuart_console_write(struct console *co, const char *s, unsigned int count) { struct uart_port *port = &grlib_apbuart_ports[co->index]; unsigned int status, old_cr, new_cr; /* First save the CR then disable the interrupts */ old_cr = UART_GET_CTRL(port); new_cr = old_cr & ~(UART_CTRL_RI | UART_CTRL_TI); UART_PUT_CTRL(port, new_cr); uart_console_write(port, s, count, apbuart_console_putchar); /* * Finally, wait for transmitter to become empty * and restore the TCR */ do { status = UART_GET_STATUS(port); } while (!UART_TX_READY(status)); UART_PUT_CTRL(port, old_cr); }