[comp.unix.questions] two interrupt service routines

paul@phoenix.Princeton.EDU (Paul Lansky) (08/17/88)

I have a device which is capable of interrupting to two different
interrupt vectors.  How do I write a probe routine in the driver
(under Ultrix 2.0 or 4.3) which can set up both vectors and probe 
both addresses, and attach a different interrupt routine to each 
vector?  Alternatively, how could I attach the same interrupt service
routine to each one, and test for interrupt condition there?

The device is the Dec DRQ3B DMA card, by the way.  The fifo will
interrupt to one location and the DMA to another.  Thanks in advance.

Paul Lansky
Music Dept.
Princeton University

paul@phoenix.princeton.edu    or
paul%winnie.princeton.edu@princeton.princeton.edu

chris@mimsy.UUCP (Chris Torek) (08/17/88)

In article <3486@phoenix.Princeton.EDU> paul@phoenix.Princeton.EDU
(Paul Lansky) writes:
>I have a device which is capable of interrupting to two different
>interrupt vectors.  How do I write a probe routine in the driver
>(under Ultrix 2.0 or 4.3) ...?  The device is the Dec DRQ3B DMA
>card, by the way.

While I am not familiar with that particular card, most if not all
DEC hardware that uses multiple vectors also uses adjacent vectors.
What you must do is arrange for an interrupt to occur at the lowest
numbered vector.  If the vector(s) is/are programmable, one uses
uba_hd[uban].uh_lastiv to select the vectors; in that case, it may
not be necessary to have the device interrupt, although it will not
hurt.

If for some reason it is inconvenient or impossible to make the device
interrupt at its lowest vector, use some other vector, then adjust
`cvec' afterward by the difference:

		addr->foo_csr = FOO_MAINT_INTR;
		DELAY(1000);
		addr->foo_csr = 0;
		if (cvec && cvec != 0x200)
			cvec -= 4;	/* 1 vector's worth */

Note that in recent Ultrix kernels, br and cvec must NOT be
declared in the probe routine, while in 4.xBSD kernels, they
MUST be the first two register variables.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris@mimsy.umd.edu	Path:	uunet!mimsy!chris

matt@oddjob.UChicago.EDU (Mr. nEtural) (08/18/88)

In article <13040@mimsy.UUCP> chris@mimsy.UUCP (Chris Torek) writes:
) If for some reason it is inconvenient or impossible to make the device
) interrupt at its lowest vector, use some other vector, then adjust
) `cvec' afterward by the difference ...

And if, even worse, you can't make sure which interrupt you're going
to get, you can often test the low bits of the vector and determine
which interrupt occurred, then adjust as needed.
________________________________________________________
Matt Crawford	     		matt@oddjob.uchicago.edu