Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Jul 1997 08:17:25 GMT
From:      mouth@ibm.net (John Kelly)
To:        Michael Smith <msmith@atrad.adelaide.edu.au>
Cc:        msmith@atrad.adelaide.edu.au, freebsd@atipa.com, hackers@FreeBSD.ORG, terry@lambert.org
Subject:   Re: Sharing interrupts
Message-ID:  <33e5c558.25976723@smtp-gw01.ny.us.ibm.net>
In-Reply-To: <199707292329.IAA15471@genesis.atrad.adelaide.edu.au>
References:  <199707292329.IAA15471@genesis.atrad.adelaide.edu.au>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 30 Jul 1997 08:59:50 +0930 (CST),  Michael Smith wrote:

>I have no problems with you sharing the information

Good.  Here it is.  

Is this appropriate for the list?  Yes, because the man page for SIO
says "Shared IRQs on different cards are not supported," and that
statement is false.  The multiport support in FreeBSD is NOT the
determining factor.

Everyone agrees that FreeBSD does support interrupt sharing for
non-intelligent multiport cards which have two or more UARTS (on a
single ISA adapter).  However, to the multiport support in FreeBSD,
two or more serial cards can appear to function as a single card as
long as each UART is given a unique I/O address.

People often say that two or more serial cards with totem-pole or
tri-stated outputs cannot ACTIVELY share an edge-triggered ISA
interrupt.  Once the serial port is opened, either type of driver will
hold the IRQ line to ground (logic low).  When the UART signals an
interrupt, the driver gates a voltage onto the IRQ line, between 3.5
to 4.5 volts (logic high).

This means that two serial cards jumpered to use the same IRQ line
will fight each other.

To signal an interrupt, one card will try to drive the line high while
the other card is still holding it to ground.  Which one wins?  The
one holding the line to ground, because TTL pulls low better than it
pulls high.  So unless they both signal an interrupt at precisely the
same instant, neither one will be able to tell the 8259 interrupt
controller they need service.  This is why people say it won't work.

But with diodes, a resistor, and a soldering iron, we can overcome
these limitations.  If we prevent the TTL drivers from pulling the
line to ground, the cards will no longer fight each other.  However,
we would still want the TTL drivers to gate their voltage onto the
line for signaling an interrupt.  

For that, we need a diode.  It's a one-way street for electricity.

Serial cards typically have jumpers which select the IRQ line.  We can
easily break the connection between the IRQ line and the TTL output by
pulling the jumper off.  Then we can solder a diode between the two
pins, orienting the diode with the visible stripe towards the IRQ pin.

Do this for each port on each serial card.  It does not matter how
many ports you have per card or how many cards you have.

Since the diodes will prevent every TTL driver from pulling the line
to ground, how is this going to work?  For an edge triggered interrupt
to be recognized, there must be a transition from low to high.

TTL specifies that any voltage between -0.5V and 0.8V is a valid input
for logic low, and any voltage between 2.0V and 5.5V is a valid input
for logic high.

On an ISA bus motherboard, another voltage source is present on the
IRQ line.  There is a 10K (10,000 ohm) resistor connected between the
IRQ line and Vcc (5.0V), so when your ISA slots are empty the IRQ line
is held high at 5.0V.  But with a serial card in place, the TTL driver
pulls the line to ground, overpowering the resistor, and the voltage
drops to 0.0V.  Or at least it would have before we modified the card
with diodes.

Now that our diodes in place, we can accomplish the same thing with a
"pull-down" resistor.  A 390 ohm resistor connected between the IRQ
line and ground will pull the line IRQ line down to about 0.4V, giving
us a reasonable margin of noise immunity between 0.4V and the upper
limit of 0.8V for logic low.

Since all the cards will be wired together through the IRQ line when
installed in the machine, we only need one resistor.   Choose any of
the modified serial cards and solder the resistor between the IRQ pin
(corresponding to IRQ line you are sharing) and a ground pin on the
serial card.  This card will be the "master" because it must remain in
the machine for any of the other modified cards to work properly (do
not confuse this with the "master" serial port terminology used in the
FreeBSD kernel config).

When one of the UARTs signals an interrupt, the TTL output will gate
its voltage of 3.5-4.5V through the diode onto the line.  It will have
enough current to overpower the pull-down resistor and pull the IRQ
line up to a voltage recognized as "input high."

There will be a small voltage drop across the diode, about 0.5V.  That
should leave at least 2.9V on the IRQ line, giving a reasonable margin
of noise immunity above the "logic high" minimum of 2.0V.

Available at Radio Shack, 1N4001silicon diodes are ideal for this
application because they have a minimal voltage drop.  If those are
not in stock, substitute 1N4002 or others of the same family.  For our
purposes, their higher peak inverse voltage will not matter.

John




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?33e5c558.25976723>