static int s5p_serial_getc(struct udevice *dev)
{
	struct s5p_serial_platdata *plat = dev->platdata;
	struct s5p_uart *const uart = plat->reg;

	while (!(readl(&uart->utrstat) & (1 << 0)));

	serial_err_check(uart, 0);
	return (int)(readb(&uart->urxh) & 0xff);
}
示例#2
0
static int s5p_serial_getc(struct udevice *dev)
{
	struct s5p_serial_platdata *plat = dev->platdata;
	struct s5p_uart *const uart = plat->reg;

	if (!(readl(&uart->ufstat) & RX_FIFO_COUNT_MASK))
		return -EAGAIN;

	serial_err_check(uart, 0);
	return (int)(readb(&uart->urxh) & 0xff);
}
static int s5p_serial_putc(struct udevice *dev, const char ch)
{
	struct s5p_serial_platdata *plat = dev->platdata;
	struct s5p_uart *const uart = plat->reg;

	while (!(readl(&uart->utrstat) & (1 << 2)));

	writeb(ch, &uart->utxh);
	serial_err_check(uart, 1);

	return 0;
}
示例#4
0
文件: serial_s5p.c 项目: NVSL/MingII
/*
 * Read a single byte from the serial port. Returns 1 on success, 0
 * otherwise. When the function is succesfull, the character read is
 * written into its argument c.
 */
int serial_getc_dev(const int dev_index)
{
	struct s5p_uart *const uart = s5p_get_base_uart(dev_index);

	/* wait for character to arrive */
	while (!(readl(&uart->utrstat) & 0x1)) {
		if (serial_err_check(dev_index, 0))
			return 0;
	}

	return (int)(readb(&uart->urxh) & 0xff);
}
示例#5
0
void uart_tx_char(char c)
{
    struct s5p_uart *const uart = (struct s5p_uart *) UART0;


    while((readl(&uart->ufstat) & TX_FIFO_FULL_MASK)) {
        if (serial_err_check(1))
            return;
    }

    writeb(c, &uart->utxh);
}
示例#6
0
int serial_getc_dev(void)
{
    struct s5p_uart * const uart = (struct s5p_uart *) UART0;

    /* wait for character to arrive */
    while (!(readl(&uart->ufstat) & (RX_FIFO_COUNT_MASK | RX_FIFO_FULL_MASK))) {
        if (serial_err_check(0))
            return 0;
    }

    return (int) (readb(&uart->urxh) & 0xff);
}
示例#7
0
static int s5p_serial_putc(struct udevice *dev, const char ch)
{
	struct s5p_serial_platdata *plat = dev->platdata;
	struct s5p_uart *const uart = plat->reg;

	if (readl(&uart->ufstat) & TX_FIFO_FULL)
		return -EAGAIN;

	writeb(ch, &uart->utxh);
	serial_err_check(uart, 1);

	return 0;
}
示例#8
0
文件: serial_s5p.c 项目: NVSL/MingII
/*
 * Output a single byte to the serial port.
 */
void serial_putc_dev(const char c, const int dev_index)
{
	struct s5p_uart *const uart = s5p_get_base_uart(dev_index);

	/* wait for room in the tx FIFO */
	while (!(readl(&uart->utrstat) & 0x2)) {
		if (serial_err_check(dev_index, 1))
			return;
	}

	writeb(c, &uart->utxh);

	/* If \n, also do \r */
	if (c == '\n')
		serial_putc('\r');
}