Interrupts and DEC (was Ultrix tape job is unkillable!)

Chris Torek chris at mimsy.UUCP
Fri Dec 23 05:45:06 AEST 1988


In article <16971 at onfcanim.UUCP> dave at onfcanim.UUCP (Dave Martindale) writes:
>Thus, it is common to have a Unibus device driver just handle the information
>passed back from the device by an interrupt without ever doing anything
>to change the state of the device.  The DONE or READY bit and IENABLE bits
>remain set, and the software knows that the hardware will not request
>another interrupt.

Right---for some devices, the sequence for (e.g.) a UART DONE interrupt
is:

	if (buf->count) {
		dev->xmit = *buf->ptr++;
		buf->count--;
	} else
		dev->ctl &= ~INTERRUPT_ENABLE;

but for typical DEC hardware one can leave out the `else' step.  It
does not really save anything, as you then must keep track of busy/
not-busy yourself:

	/* start DEC-style UART */
	if ((softstate & BUSY) == 0) {
		dev->xmit = *buf->ptr++;
		buf->count--;
		softstate |= BUSY;
	}
	/* else let interrupt handle it */

interrupt:
	if (buf->count) {
		dev->xmit = *buf->ptr++;
		buf->count--;
		/* BUSY still on */
	} else
		softstate &= ~BUSY;

The ugly case is where you need to turn off interrupt enable, but you
cannot *read* interrupt enable, so that you need need the software state
anyway.  (Actually, since reading from a device often interferes with
the operation of that device---now that everything is microprocessor
driven---you may *still* want the software state.)
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at mimsy.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.unix.wizards mailing list