From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wolfgang Denk Date: Mon, 24 Oct 2011 23:59:36 +0200 Subject: [U-Boot] [PATCH v2] NS16550: buffer reads In-Reply-To: <4EA5CD39.2070203@gmail.com> References: <1318742050-2201-1-git-send-email-sjg@chromium.org> <1318742050-2201-2-git-send-email-sjg@chromium.org> <20111017121846.132DE140797D@gemini.denx.de> <4EA28251.1080009@aribaud.net> <4EA34086.4030101@gmail.com> <20111023082051.6397518AE823@gemini.denx.de> <20111023171536.4FFAA1408771@gemini.denx.de> <20111023212231.396E81408771@gemini.denx.de> <20111023221848.535F81408E9B@gemini.denx.de> <20111024184700.080E01408E9B@gemini.denx.de> <4EA5BBEF.1050706@gmail.com> <20111024200012.5930514094B3@gemini.denx.de> <4EA5CD39.2070203@gmail.com> Message-ID: <20111024215936.EB6748237A@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Graeme Russ, In message <4EA5CD39.2070203@gmail.com> you wrote: > > > Assume we have a simple device with a small Rx FIFO - say, 8 bytes > > only. Guess what the chances are that we will overrun this FIFO (and > > then lose characters) before the other side stops sending? > > Should be zero (if you disable the hardware Tx buffer) unless you have an > incredibly slow Rx routine (in which case, your baud rate is too high). And > even with a Tx buffer in play the solution is fairly simple - After sending > an XOFF, flush the Rx buffer (and remote Tx buffer) into an internal buffer > until tstc() returns false - use this buffer for getc() until it is empty. Things are becoming more and more complicated, it seems. If you ask me: forget about all this, and stick with single line input. Do the processing on the sender's side (always wait for a prompt before sending the next line). This is MUCH easier. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "Never face facts; if you do, you'll never get up in the morning." - Marlo Thomas