jcn@uncle.UUCP (James C. Nugen) (02/23/89)
I have a card that generates an interrupt when it has finished processing. What I want to do is have the interrupt routine send a message,signal, or something to my windows program. Has anyone done this, or have any ideas about it? Thanks, James Nugen
mcdonald@uxe.cso.uiuc.edu (03/01/89)
/* Written 9:41 pm Feb 22, 1989 by jcn@uncle.UUCP in uxe.cso.uiuc.edu:comp.windows.ms */ /* ---------- "Hardware Interrupts in Windows" ---------- */ I have a card that generates an interrupt when it has finished processing. What I want to do is have the interrupt routine send a message,signal, or something to my windows program. Has anyone done this, or have any ideas about it? Thanks, James Nugen /* End of text from uxe.cso.uiuc.edu:comp.windows.ms */ I have done it. You install a device handler subroutine in your program using the MSC 5.1 "interrupt" attribute. You then put the address of that subroutine in the proper place in low memory. The subroutine processes the interrupt, re-enables the interrupt controller, and sets a global flag to inform your main routine that something has happened. It is extyremely simple once you find all the addresses. (To re-enable the first interrupt controller, interrupts 0-7 you do an outp(0x20,0x20). To reenable interrupts 8-15, do outp(0x70,0x20);outp(0x20,0x20); ) You need to study up a LOT on the interrupt system and your card to find out all you need. Be sure to kill the interrupt before your program ends, and also before Windows ends, should the user click on "close" in the MS-DOS exec (is it End-Session or Query-end-session? I forget). Finally - LOCK THE CODE SEGMENT OF THE INTERRUPT HANDLER and THE DEFAULT DATA SEGMENT!!!! (If you can get by with only a flag and no actual global data, you could let the default data segment float by storing the signal in a fixed location in low memory.) [[[Note to anti-locking flamers: This is locking is necessary - think a minute about how interrupts work. And, I point out that Windows will put locked segments at the bottom of memory where they do no harm.]]] Doug McDonald