[comp.sys.ibm.pc] Hardware interrupts, IRQ7, and Burr-Brown PCI 20098C

d88-eli@nada.kth.se (Erik Liljencrantz) (12/03/89)

The Burr-Brown PCI 20098 multifunction carrier is a general purpose
A/D conversion board for the PC. It contains a programmable squarewave-
generator that can generate an interrupt of selectable level (IRQ2-IRQ7).

In order to use the squarewave as timerinterrupt I do this:
1. Set the frequency on the carrier (verified squarewave).
2. Select generation of IRQ7 on positive flanks.
3. Set interrupt vector 0F to point to my handler. The handler contains code
   to send EOI (MOV AL,20h/OUT 20h,AL) and reset the interrupt mask on the
   carrier.
4. Enable IRQ7 on port 21h by clearing bit 7.
This procedure really works! But the troubles starts when I'm trying to change
the frequency on the carrier board. It works sometimes (by disabling the
squarewave and the interrupt and reprogramming), but sooner or later it
doesn't work (not a lockup, just no interrupts). To be able to generate
the interrupts again I have to turn the power off and on again (a reset isn't
enough).

Have I done the necessary interruptcontroller setup (Enable IRQ7 and the EOI
signal in the handler)? Perhaps the problem is with the A/D carrier board,
as the 8259 is completely reprogrammed during the BIOS POST.

Is IRQ7 a good choice? I checked with Ralf Brown's excellent interrupt list,
and it seems the INT 0F vector isn't used that frequently...

Any and all advices and pointers appreciated.

(I haven't included any sourcecode, but I hope the general idea of what I'm
 trying to do with the interrupt is obvious...)

BTW: I'm using a Compaq 386/20e, but I will try it on a 286e now...

-- 
Erik Liljencrantz     | "No silly quotes!!"
d88-eli@nada.kth.se   |  Embraquel D. Tuta

pipkins@qmsseq.imagen.com (Jeff Pipkins) (12/05/89)

WARNING: WHEN WRITING AN ISR FOR IRQ7, YOU MUST BE CAREFUL TO HANDLE GLITCHES!

The 8259 Programmable Interrupt Controller used in ATs has 8 channels numbered
0-7.  But aside from the priorities, line 7 still has one major difference
from the rest that should be noted.  Any time the 8259 detects a glitch
(or a request that is too short) on ANY OF THE LINES, it will generate
a synthesized interrupt on IRQ7.  Your ISR can tell whether it's a real
interrupt or a glitch by checking bit 7 of the In Service Register.
Same precautions apply for IRQ15, since this is on channel 7 of a second
(cascaded) 8259.  (As an added bonus, the HP Vectra has THREE 8259s,
although I can't figure out why?!)
If your interrupt service routine is invoked by a glitch, you must NOT
issue an EOI before IReturning.

IntService:
	     <Save Regs>
	     Mov AL, 0Bh
	     Out 20h, AL
	     Jmp Short $+2 ; See related thread...
	     In AL, 21h ; Read the ISR
	     Test AL, 80h  ; Bit 7 on?
	     Jz IReturn    ; If not on, jump to IRet instruction
	     <continue...>

I hope the numbers here are right; I've got the book in front
of me, but my newsreader won't let me look at my code right now.
I think this is right, though.  This code is IRQ7 specific.

Hope this helps.