From: Gregg Roe Newsgroups: comp.os.msdos.djgpp Subject: Hooking a parallel port interrupt Date: Thu, 25 May 2000 09:51:44 -0500 Organization: MSS, Inc. Lines: 43 Message-ID: <392D3E00.15DFD7FB@magsep.com> X-Complaints-To: newsabuse AT supernews DOT com X-Mailer: Mozilla 4.72 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com I'm trying to execute a C procedure when an interrupt on a Lava parallel PCI board is received. The following code does hook the interrupt, but then crashes. This occurs whether memory is locked or not. If I change the code to use the built-in parallel port, it doesn't work at all. Any suggestions or sample code would be appreciated. Gregg Roe MSS, Inc. void int_test() { gTemp++; outportb(PIC,0x20); } // *** Initialize the external interrupt void init_ext_int() { _go32_dpmi_seginfo oldh, newh; // put port in forward direction outportb( PARCONT, inportb( PARCONT) & 0xDF); // write data to port outportb( PARDATA, 0xAA); // lock test function and variable LOCK_FUNCTION(int_test); LOCK_VARIABLE(gTemp); // get the old handler info _go32_dpmi_get_protected_mode_interrupt_vector( PARIRQ, &oldh); // set new handler info newh.pm_offset = (int)int_test; newh.pm_selector = _go32_my_cs(); // get the wrapper _go32_dpmi_allocate_iret_wrapper( &newh); // make it the new interrupt handler _go32_dpmi_set_protected_mode_interrupt_vector( PARIRQ, &newh); // unmask PIC outportb( PIC+1, inportb( PIC+1) & 0xEF); // set IRQ enable bit on port outportb( PARCONT, inportb( PARCONT) | 0x10); }