[U-Boot-Users] API for serial functions

Stefan Roese sr at denx.de
Mon Oct 1 12:03:06 CEST 2007


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
=====================================================================




More information about the U-Boot mailing list