delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/12/15/01:45:56

Date: Fri, 2 Aug 1996 22:2:47 +0800
From: "Bob.D" <timercat AT 163 DOT net>
To: bob <timercat AT 163 DOT net>
Cc: "djgpp AT delorie DOT com" <djgpp AT delorie DOT com>
Subject: Re: Re: my interrupt routine not called any more.
X-mailer: FoxMail 3.0 beta 1 [cn]
Mime-Version: 1.0
Message-Id: <20001214140218.A7CE81D328694@bjapp4.163.net>
Reply-To: djgpp AT delorie DOT com

On Wed, 13 Dec 2000, bob wrote:

> void dos_ISRTimer()
> {
>   enable();
>   (*dos_callbackTimer)();//call to the main processing routine
>   enable();
>   outportb(0x20,0x20);//eoi
>   outportb(0xa0,0x20);//eoei
> }

The EOI commands above are in the wrong order: you need to EOI the
slave PIC _before_ the master, not after it.

Also, you want to lose those enable() calls: they are not needed, and
they slow down your handler; in some environments the slow-down will
be tremendous.

>   _go32_dpmi_set_protected_mode_interrupt_vector
>      (dos_M_VectTimer,&infoMyISRTimer);

What is the value of dos_M_VectTimer?

> I find that dos_ISRTimer never called, when run a test program.

Probably because IRQ 10 is disabled by default.  This is accomplished
by sending the command 0x4 to the port 0xa1.  You didn't do that.

> So, I re-program the 8259s on the pc board as follows,
> /*-------------------------*/
>    outportb(0x20,0x11);
>   outportb(0x21,0x8);//modi CW2 register of primary 8259
>   outportb(0x21,0x4);
>   outportb(0x21,0x1);
>   outportb(0xa0,0x11);
>   outportb(0xa1,0x70);
>   outportb(0xa1,0x2);
>   outportb(0xa1,0x1);
>   outportb(0x21,0);
>   outportb(0xa1,0);

I don't why did you need to send all this to the 8259.  There are lots
of commands here, some of which cause the PIC to reinitialize itself
for no good reason.  You also didn't disable interrupts while
initializing the PIC, and didn't restore the original interrupt mask
after all these commands.

Basically, most of this stuff is not needed at all.  Just enable IRQ10
as shown above, all the rest should already be set up for you.

> this time  my ISR called three times and then it said:
> "Double Fault at eip=........error=0000" 
> and the program aborted.

Probably because some of the outportb commands above switched the PIC
to a dangerous state.

- Raw text -


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