示例#1
0
static inline void receive_chars(struct mcf_serial *info)
{
	volatile unsigned char	*uartp;
	struct tty_struct	*tty = info->tty;
	unsigned char		status, ch;

	if (!tty)
		return;

	uartp = info->addr;

	while ((status = uartp[MCFUART_USR]) & MCFUART_USR_RXREADY) {

		if (tty->flip.count >= TTY_FLIPBUF_SIZE)
			break;

		ch = uartp[MCFUART_URB];
		info->stats.rx++;

#ifdef CONFIG_MAGIC_SYSRQ
		if (mcfrs_console_inited && (info->line == mcfrs_console_port)) {
			if (magic_sysrq_key(ch))
				continue;
		}
#endif

		tty->flip.count++;
		if (status & MCFUART_USR_RXERR) {
			uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETERR;
			if (status & MCFUART_USR_RXBREAK) {
				info->stats.rxbreak++;
				*tty->flip.flag_buf_ptr++ = TTY_BREAK;
			} else if (status & MCFUART_USR_RXPARITY) {
				info->stats.rxparity++;
				*tty->flip.flag_buf_ptr++ = TTY_PARITY;
			} else if (status & MCFUART_USR_RXOVERRUN) {
				info->stats.rxoverrun++;
				*tty->flip.flag_buf_ptr++ = TTY_OVERRUN;
			} else if (status & MCFUART_USR_RXFRAMING) {
				info->stats.rxframing++;
				*tty->flip.flag_buf_ptr++ = TTY_FRAME;
			} else {
				/* This should never happen... */
				*tty->flip.flag_buf_ptr++ = 0;
			}
		} else {
			*tty->flip.flag_buf_ptr++ = 0;
		}
		*tty->flip.char_buf_ptr++ = ch;
	}

	schedule_work(&tty->flip.work);
	return;
}
示例#2
0
static _INLINE_ void receive_chars(struct gbatxt_serial *info, struct pt_regs *regs, unsigned short rx)
{
    volatile unsigned char	*uartp;
    struct tty_struct	*tty = info->tty;
    unsigned char		status, ch;

    if (!tty)
        return;

#if defined(CONFIG_LEDMAN)
    ledman_cmd(LEDMAN_CMD_SET, info->line ? LEDMAN_COM2_RX : LEDMAN_COM1_RX);
#endif

    uartp = (volatile unsigned char *) info->addr;

    while ((status = uartp[MCFUART_USR]) & MCFUART_USR_RXREADY) {

        if (tty->flip.count >= TTY_FLIPBUF_SIZE)
            break;

        ch = uartp[MCFUART_URB];
        info->stats.rx++;

#ifdef CONFIG_MAGIC_SYSRQ
        if (gbatxt_console_inited && (info->line == gbatxt_console_port)) {
            if (magic_sysrq_key(ch))
                continue;
        }
#endif

        tty->flip.count++;
        if (status & MCFUART_USR_RXERR)
            uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETERR;
        if (status & MCFUART_USR_RXBREAK) {
            info->stats.rxbreak++;
            *tty->flip.flag_buf_ptr++ = TTY_BREAK;
        } else if (status & MCFUART_USR_RXPARITY) {
            info->stats.rxparity++;
            *tty->flip.flag_buf_ptr++ = TTY_PARITY;
        } else if (status & MCFUART_USR_RXOVERRUN) {
            info->stats.rxoverrun++;
            *tty->flip.flag_buf_ptr++ = TTY_OVERRUN;
        } else if (status & MCFUART_USR_RXFRAMING) {
            info->stats.rxframing++;
            *tty->flip.flag_buf_ptr++ = TTY_FRAME;
        } else {
            *tty->flip.flag_buf_ptr++ = 0;
        }
        *tty->flip.char_buf_ptr++ = ch;
    }

    queue_task_irq_off(&tty->flip.tqueue, &tq_timer);
    return;
}
static inline void receive_chars(struct mcf_serial *info)
{
	volatile unsigned char	*uartp;
	struct tty_struct	*tty = info->port.tty;
	unsigned char		status, ch, flag;

	if (!tty)
		return;

	uartp = info->addr;

	while ((status = uartp[MCFUART_USR]) & MCFUART_USR_RXREADY) {
		ch = uartp[MCFUART_URB];
		info->stats.rx++;

#ifdef CONFIG_MAGIC_SYSRQ
		if (mcfrs_console_inited && (info->line == mcfrs_console_port)) {
			if (magic_sysrq_key(ch))
				continue;
		}
#endif

		flag = TTY_NORMAL;
		if (status & MCFUART_USR_RXERR) {
			uartp[MCFUART_UCR] = MCFUART_UCR_CMDRESETERR;
			if (status & MCFUART_USR_RXBREAK) {
				info->stats.rxbreak++;
				flag = TTY_BREAK;
			} else if (status & MCFUART_USR_RXPARITY) {
				info->stats.rxparity++;
				flag = TTY_PARITY;
			} else if (status & MCFUART_USR_RXOVERRUN) {
				info->stats.rxoverrun++;
				flag = TTY_OVERRUN;
			} else if (status & MCFUART_USR_RXFRAMING) {
				info->stats.rxframing++;
				flag = TTY_FRAME;
			}
		}
		tty_insert_flip_char(tty, ch, flag);
	}
	tty_schedule_flip(tty);
	return;
}