linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Russell King <rmk+lkml@arm.linux.org.uk>
To: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org, ralf@linux-mips.org
Subject: Re: [PATCH] serial: serial_txx9 driver update
Date: Mon, 23 Jan 2006 19:49:30 +0000	[thread overview]
Message-ID: <20060123194930.GA32110@flint.arm.linux.org.uk> (raw)
In-Reply-To: <20060123.223943.104642974.anemo@mba.ocn.ne.jp>

On Mon, Jan 23, 2006 at 10:39:43PM +0900, Atsushi Nemoto wrote:
> rmk> If we successfully received the string ABCDEFGH, and the next character
> rmk> to be received (I) causes an overrun condition, what happens in the
> rmk> case that overruns are not ignored?
> 
> In this case, I will read ABCDEFG without errors, and then I with an overrun 

Duely ignored.

> rmk> Will you read ABCDEFG without any errors from the UART, and then H with
> rmk> an overrun error?  If so, you should pass to the TTY layer ABCDEFGH and
> rmk> then a NUL character with TTY_OVERRUN set.  Note that uart_insert_char()
> rmk> does this for you.
> 
> Yes, in this case I will read ABCDEFG without error, and then H with
> an overrun error.  But the UART still hold "I" in its "read buffer".
> The "read buffer" is exist outside the receiver FIFO.  So if 'J' comes
> in later, I will read "IJ".  There is no way to clear the "read
> buffer" except resetting the UART.

Ok, so if someone sent you ABCDEFGHIJ, all before you could read anything
from the UART, where I causes an overrun, you'll read ABCDEFGHJ, but the
status associated with H will indicate an overrun condition?

However, either way the behaviour after the overrun condition has no
bearing on what follows.

Your overrun behaviour is near enough to typical 8250 behaviour that you
can use the helper provided - uart_insert_char().  This eliminates the
special flag handling you seem to have created.

IOW, you want to do:

	ch = read_uart_fifo_data_register();
	status = read_uart_status_register();

	/*
	... error processing ... to set flag but omitting overrun.
	... don't do ignore processing here - uart_insert_char does
	... that for you ...
	*/

	uart_insert_char(port, status, STATUS_OVERRUN_BIT, ch, flag);

For an example, see receive_chars() in 8250.c.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

  parent reply	other threads:[~2006-01-23 19:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-17 17:19 [PATCH] serial: serial_txx9 driver update Atsushi Nemoto
2006-01-22  7:36 ` Andrew Morton
2006-01-22  8:00   ` Russell King
2006-01-22  8:33     ` Andrew Morton
2006-01-22 23:02       ` Russell King
2006-01-23  6:05         ` Atsushi Nemoto
2006-01-23  9:57           ` Russell King
2006-01-23 13:39             ` Atsushi Nemoto
2006-01-23 13:42               ` Atsushi Nemoto
2006-01-23 19:49               ` Russell King [this message]
2006-01-24  2:24                 ` Atsushi Nemoto
2006-12-21 17:01 Atsushi Nemoto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060123194930.GA32110@flint.arm.linux.org.uk \
    --to=rmk+lkml@arm.linux.org.uk \
    --cc=akpm@osdl.org \
    --cc=anemo@mba.ocn.ne.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ralf@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).