This is the mail archive of the ecos-discuss@sourceware.cygnus.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: pid_serial driver



When I was working on the 16550 drivers for the PC HAL, I started with the
AEB driver and was able to easily add in the FIFO logic.  There are a
couple of things I learned--there seems to be a rumor about how 16550
parts have bugs in the FIFOs but that 16550A devices work properly...  so
while noone really had a description of the symptoms, there were plenty of
code snippets which could detect which device you were talking to.  Since
y'all aren't working with PCs (which have completely unpredictable (and
always *cheap*) components) you may not have to worry about this...

Anyway, the driver isn't too tough:  It turns out that the driver
..._serial_putc function should return true if it's able to send the
character or false if it can't... the OS will call the function with
successive data until it returns false.  Since the '550 is kinda lame and
has neither a FIFO counter or FIFO full indicator, we have to keep a
counter to tell us when we can't store any more data.  I just added it
into the pc_serial_info structure, set it to zero when the transmitter
empty interrupt is received, and make sure that I do 16 ..._serial_putc
calls before returning false.  If the '550 did have a Tx FIFO full
indicator, we could save a bit of interrupt overhead by having the
receiver interrupt also top up the transmitter buffer when possible, but I
think that the interrupt response time is so short compared to the
character transmission time that the savings is really insignificant.

Anyway, this code is already done, so feel free to borrow as much as you
like... there's more information at
ftp://sourceware.cygnus.com/pub/ecos/contrib/hal/i386/hal-i386-pc-20000210.html.
Hope this helps!

-patrick


On Tue, 7 Mar 2000, Grant Edwards wrote:

> 
> > The pid_serial driver appears to be a generic 16c550 driver,
> > right?  Apart from the addresses of the UARTs being hard-wired
> > into the source code (grin) I don't see anyting that looks
> > specific to the PID board or even to the ARM processor.
> 
> FYI,
> 
> I've noticed that the 16c550 driver (pid_serial_with_ints.c)
> doesn't take advantage of the transmit FIFO.  For each Tx
> interrupt it only writes a single byte to the UART.  IIRC, on
> the '550 there's no read the Tx FIFO count or tell when the
> FIFO is full.  You just have to "know" that when you get an
> interrupt you can write 12 bytes.  (I think it's 12...)
> 
> With the '850, you can actually read the Tx FIFO count, and use
> that instead of the transmitter holding register empty bit in
> *_putc() to determine if there's room for another byte.
> 
> -- 
> Grant Edwards
> grante@visi.com
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]