Date: Sun, 6 Jun 1999 11:37:12 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz AT is To: Mark Usher cc: djgpp AT delorie DOT com Subject: Re: Enabling a specific interrupt In-Reply-To: <7jbqeo$sh$1@orudios.magnet.at> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk 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.