Mail Archives: djgpp/2000/05/25/19:15:16
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);
}
- Raw text -