Re: serial ports

Shawn Rutledge (ecloud@goodnet.com)
Mon, 5 Aug 1996 21:53:05 -0700 (MST)


> Greetings
>
> The problem is that the ISA bus architecture uses edge-triggered interrupts.
> That means that the processor only takes notice when the IRQ line drops from
> the 1 state to the 0 state, not if it is held low. Since the serial device only
> releases the IRQ line when the processor reads the latched data, no other
> negative transitions (i.e. interrupts) are possible in the meantime. This
> causes overrun errors in other devices hanging off the same IRQ line as
> their interrupts are not serviced in time (or at all actually).

So how about checking both possible ports whenever the interrupt occurs?
Servicing doesn't take that long, or shouldn't on a fast machine, that the
other port will have a chance to get another character and overrun, if all you
do when you "service" the interrupt is queue the data. It can be done in a
few instructions. That way even if cua2 interrupts while you're servicing
cua0's interrupt, you'll get cua2's data in spite of missing the irq. And
cua0 doesn't have time to interrupt again in that amount of time. If
there's still a chance that data could be missed (like, cua2 interrupts
after you're done servicing it, but but before the irq line has gone high
somehow - is that even possible?) then a hybrid of this method plus polling
would fix it. The polling shouldn't need to be excessive, because you catch
most interrupts anyway, and the poll time should take into account the
size of the buffers in your 16550's - you don't even have to poll as often
as once per character if you have those.

-- 
  _______                      KB7PWD @ KC7Y.AZ.US.NOAM   ecloud@goodnet.com
 (_  | |_)   Shawn T. Rutledge    on the web: http://www.goodnet.com/~ecloud
 __) | | \__________________________________________________________________
* electronics * Linux * techno * robotics * eschew obfuscation * Khoros *