www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/08/16/07:33:32

From: Brendan Simon <brendan AT rdt DOT monash DOT edu DOT au>
Date: Wed, 16 Aug 1995 20:02:54 +1000
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: v2.interrupts.example

More Interrupt questions for V2

I've tried the timer example compiled with V2 and it seems to work.

When I try to use a hardware interrupt with _go32_dpmi_set_interrupt_vector
the machine hangs and I have to reboot.  If I chain the interrupt (with
outportb(0x20, 0x20); and enable();) it seems to work.  I can only get about
2kHz with out crashing.  

Can someone please put an example of using __dpmi_set_interrupt....
with a routine that updates a counter.  Something like :-

irq3_routine()
{
  irq3_counter++;
  outportb(0x20, 0x20);		/* acknowledge interrupt */
  enable();
}

main()
{
  __dpmi_paddr	old_irq3_handler, new_irq3_handler;

  disable();
  __dpmi_get_protected_mode_interrupt_vector((3+8), &old_irq3_handler);
  new_irq3_handler.offset32 = (long)irq3_routine;
  new_irq3_handler.selector = (short)_my_cs();
  __dpmi_set_protected_mode_interrupt_vector((3+8), &new_irq3_handler);
  enable();
  ...
  ...  /* main code in here */
  ...
  __dpmi_set_protected_mode_interrupt_vector((3+8), &old_irq3_handler);
  return(0);
}


Does this code look right or wrong to anybody.  Please help. Please !!!!!!
Brendan.
brendan AT rdt DOT monash DOT edu DOT au

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019