
On Monday 01 October 2007, Wolfgang Denk wrote:
Dear Mike,
in message 200710010415.35958.vapier@gentoo.org you wrote:
is there a document that outlines the exact expected behavior of the serial functions ? specifically, i'm looking to see if the serial_putc() function
There is no such document...
oh well :/
is supposed to wait until the character it is given has been fully transmitted over the wire, or if it is simply required to queue the character up into the hardware fifo and then return ...
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 :)
thanks ! -mike