本文整理汇总了C++中UART_PUT_CHAR函数的典型用法代码示例。如果您正苦于以下问题:C++ UART_PUT_CHAR函数的具体用法?C++ UART_PUT_CHAR怎么用?C++ UART_PUT_CHAR使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UART_PUT_CHAR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: omahauart_console_write
static void omahauart_console_write(struct console *co, const char *s, u_int count)
{
struct uart_port *port = omaha_ports + co->index;
unsigned int status;
int i;
/*
* First save the CR then disable the interrupts
*/
/*
* Now, do each character
*/
for (i = 0; i < count; i++) {
do {
status = UART_GET_FR(port);
} while ((status & OMAHA_UTX_EMPTY) == 0);
UART_PUT_CHAR(port, s[i]);
if (s[i] == '\n') {
do {
status = UART_GET_FR(port);
} while ((status & OMAHA_UTX_EMPTY) == 0);
UART_PUT_CHAR(port, '\r');
}
}
/*
* Finally, wait for transmitter to become empty
* and restore the TCR
*/
do {
status = UART_GET_FR(port);
} while ((status & OMAHA_UTX_EMPTY) == 0);
}
示例2: apbuart_tx_chars
static void apbuart_tx_chars(struct uart_port *port)
{
struct circ_buf *xmit = &port->state->xmit;
int count;
if (port->x_char) {
UART_PUT_CHAR(port, port->x_char);
port->icount.tx++;
port->x_char = 0;
return;
}
if (uart_circ_empty(xmit) || uart_tx_stopped(port)) {
apbuart_stop_tx(port);
return;
}
/* amba: fill FIFO */
count = port->fifosize >> 1;
do {
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))
apbuart_stop_tx(port);
}
示例3: uart00_tx_chars
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, 0);
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, 0);
}
示例4: at91_tx_chars
/*
* Transmit characters (called from interrupt handler)
*/
static void at91_tx_chars(struct uart_port *port)
{
struct circ_buf *xmit = &port->info->xmit;
if (port->x_char) {
UART_PUT_CHAR(port, port->x_char);
port->icount.tx++;
port->x_char = 0;
return;
}
if (uart_circ_empty(xmit) || uart_tx_stopped(port)) {
at91_stop_tx(port);
return;
}
while (UART_GET_CSR(port) & AT91_US_TXRDY) {
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;
}
if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
uart_write_wakeup(port);
if (uart_circ_empty(xmit))
at91_stop_tx(port);
}
示例5: ambauart_tx_chars
static void ambauart_tx_chars(struct uart_info *info)
{
struct uart_port *port = info->port;
int count;
if (port->x_char) {
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) {
ambauart_stop_tx(port, 0);
return;
}
count = port->fifosize >> 1;
do {
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_event(info, EVT_WRITE_WAKEUP);
if (info->xmit.head == info->xmit.tail)
ambauart_stop_tx(info->port, 0);
}
示例6: ssauart_tx_chars
static void ssauart_tx_chars (struct uart_port *port)
{
struct circ_buf *xmit = &port->info->xmit;
int count;
if (port->x_char)
{
UART_PUT_CHAR(port, port->x_char);
port->x_char = 0;
port->icount.tx++;
return;
}
if (uart_circ_empty (xmit) || uart_tx_stopped (port))
{
ssauart_stop_tx (port, 0);
return;
}
/*
Write upto (port->fifosize) to the UART from the SW Tx buffer.
Stops early if the SW Tx Buffer has no more data.
Warning: Does NOT stop early if there is no space in the UART Tx fifo.
(ie we assume that port->fifosize is correct !!)
*/
count = port->fifosize;
do
{
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 the number of bytes remaining in the SW Tx circular buffer is less
than WAKEUP_CHARS, wake up tasks trying to write to the UART device.
*/
if (uart_circ_chars_pending (xmit) < WAKEUP_CHARS)
{
uart_write_wakeup (port);
/*
If there are no more bytes to transmit, disable Tx interrupts.
(We don't need to refill the UART Tx fifo when it next becomes empty).
*/
if (uart_circ_empty (xmit))
ssauart_stop_tx (port, 0);
}
}
示例7: ks8695_console_putchar
static void ks8695_console_putchar(struct uart_port *port, int ch)
{
while (!(UART_GET_LSR(port) & URLS_URTHRE))
barrier();
UART_PUT_CHAR(port, ch);
}
示例8: send_buf
static void send_buf(struct serial_dev *devp)
{
UART_DIB_WIRQ(devp->index);//disable recvive irq
while(devp->send_rd_point != devp->send_wr_point)
{
if(!UART_PUT_RSR(devp->index))
{
UART_PUT_CHAR(devp->index, devp->send_buf[devp->send_rd_point++]);
if(devp->send_rd_point >= MAX_BUF_LEN)
{
devp->send_rd_point = 0;
}
devp->send_full_flag = 0;
}
else
{
break;
}
}
if(devp->send_rd_point == devp->send_wr_point)
{
// UART_DIB_WIRQ(devp->index);
return;
}
UART_ENB_WIRQ(devp->index);
}
示例9: sa1100_console_putchar
static void sa1100_console_putchar(struct uart_port *port, int ch)
{
struct sa1100_port *sport = (struct sa1100_port *)port;
while (!(UART_GET_UTSR1(sport) & UTSR1_TNF))
barrier();
UART_PUT_CHAR(sport, ch);
}
示例10: apbuart_console_putchar
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);
}
示例11: early_serial_putc
static __init void early_serial_putc(struct uart_port *port, int ch)
{
unsigned timeout = 0xffff;
struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
while ((!(UART_GET_LSR(uart) & THRE)) && --timeout)
cpu_relax();
UART_PUT_CHAR(uart, ch);
}
示例12: bfin_serial_poll_put_char
static void bfin_serial_poll_put_char(struct uart_port *port, unsigned char chr)
{
struct bfin_serial_port *uart = (struct bfin_serial_port *)port;
while (!(UART_GET_LSR(uart) & THRE))
cpu_relax();
UART_CLEAR_DLAB(uart);
UART_PUT_CHAR(uart, (unsigned char)chr);
}
示例13: ssauart_tx_one_char
/* Called with interrupts off only from start_tx() */
static void ssauart_tx_one_char (struct uart_port *port)
{
struct circ_buf *xmit = &port->info->xmit;
/* The Fifo may already contain data in which case, our work is
* done since when it drains it will trigger an interrupt.
*/
if ((UART_GET_LSR(port) & (1 << 6)) == 0)
return;
if (port->x_char)
{
UART_PUT_CHAR(port, port->x_char);
port->x_char = 0;
port->icount.tx++;
return;
}
if (uart_circ_empty (xmit) || uart_tx_stopped (port))
return;
UART_PUT_CHAR(port, xmit->buf[xmit->tail]);
xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
port->icount.tx++;
/*
If the number of bytes remaining in the SW Tx circular buffer is less
than WAKEUP_CHARS, wake up tasks trying to write to the UART device.
*/
if (uart_circ_chars_pending (xmit) < WAKEUP_CHARS)
{
uart_write_wakeup (port);
/*
If there are no more bytes to transmit, disable Tx interrupts.
(We don't need to refill the UART Tx fifo when it next becomes empty).
*/
if (uart_circ_empty (xmit))
ssauart_stop_tx (port, 0);
}
}
示例14: apbuart_scan_fifo_size
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;
}
示例15: sa1100_tx_chars
static void sa1100_tx_chars(struct sa1100_port *sport)
{
struct circ_buf *xmit = &sport->port.state->xmit;
if (sport->port.x_char) {
UART_PUT_CHAR(sport, sport->port.x_char);
sport->port.icount.tx++;
sport->port.x_char = 0;
return;
}
/*
* Check the modem control lines before
* transmitting anything.
*/
sa1100_mctrl_check(sport);
if (uart_circ_empty(xmit) || uart_tx_stopped(&sport->port)) {
sa1100_stop_tx(&sport->port);
return;
}
/*
* Tried using FIFO (not checking TNF) for fifo fill:
* still had the '4 bytes repeated' problem.
*/
while (UART_GET_UTSR1(sport) & UTSR1_TNF) {
UART_PUT_CHAR(sport, xmit->buf[xmit->tail]);
xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
sport->port.icount.tx++;
if (uart_circ_empty(xmit))
break;
}
if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
uart_write_wakeup(&sport->port);
if (uart_circ_empty(xmit))
sa1100_stop_tx(&sport->port);
}