From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Roese Date: Mon, 1 Oct 2007 12:03:06 +0200 Subject: [U-Boot-Users] API for serial functions In-Reply-To: <200710010541.29574.vapier@gentoo.org> References: <20071001092908.3F1B12475A@gemini.denx.de> <200710010541.29574.vapier@gentoo.org> Message-ID: <200710011203.06482.sr@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 Hi Mike, On Monday 01 October 2007, Mike Frysinger wrote: > > While it's not a strict requirement, I would expect that you wait > > until the charatcer has been sent. You have toi add some wait anway - > > either at the start or at the end of the function, and from the > > debugging point of view it makes more sense to wait for completion > > before continuing. Performancewise there will be no difference, I > > think. > > the optimal performance method would be at the start of serial_putc(), spin > until a byte has opened up in the hardware fifo, and then queue it up and > return ... in the normal path, the leading spin would probably not execute > even once as the hardware can go faster than people can type :) > > then in the serial_setbrg() function (what does "brg" stand for anyways?), > spin until both the fifo and the transmit register are empty so that you > dont go changing the baud rate while a character is in the middle of > transmission ... > > the current Blackfin serial driver posts a character into the fifo and then > spins until both the fifo and the transmit register is empty ... if there > is no higher level API dictacting the requirement (and my quick tests here > seem to back that up), then i'll just scrub the code and gain a little bit > of speed and lose a few bytes in code size :) I doubt that you will increase the "performance" notably by removing this check in the serial_putc routine. Please keep in mind that U-Boot is a bootloader, and while executing "printf" the CPU has nothing else to do. But you will loose some debug functionality when removing this check, since you can't use printf anymore for debugging and really be sure, that the received output in your terminal program matches the CPU state. So I vote for not removing this transmitter empty check. Best regards, Stefan ===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================