delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/06/05:54:16

Date: Sun, 6 Jun 1999 11:37:12 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Mark Usher <marku AT magnet DOT at>
cc: djgpp AT delorie DOT com
Subject: Re: Enabling a specific interrupt
In-Reply-To: <7jbqeo$sh$1@orudios.magnet.at>
Message-ID: <Pine.SUN.3.91.990606113644.16109V-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Sat, 5 Jun 1999, Mark Usher wrote:

> 1) Is there any easier / eleganter way to do this

I don't understand certain parts of your code (see below).  If you
care to explain them, I could try to judge their necessity.

> 2) Should I install the handler for this interrupt before or after this
> routine.

You should always install the handler BEFORE enabling the interrupt.
Otherwise, there's a small window of opportunity that the interrupt
will hit while the handler address points to void.

For maximum safety, you should disable the IRQ in the Interrupt
Controller while you install the handler.

Note that your code calls CLI at the beginning, but doesn't call STI
before it returns.

>     do
>     {
>         /* Select IRR Interrupt Request Register */
>         outportb(0x20, 0x10);        /* OCW 3 */
>         i++;
>         value = inportb(0x20) & mask;
>     }
>     while ((i<255) && (value ==0));

I don't understand the need for this.  Why do you care if the IRQ is
high or not?

And btw, "outportb(0x20, 0x10);" is wrong AFAIK.  If you need to issue
a command that would cause "inportb(0x20);" to read the Interrupt
Request Register, you need to send the 0Ah (not 10h) command to the
port 20h.

- Raw text -


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