delorie.com/archives/browse.cgi | search |
From: | "Mark Usher" <marku AT magnet DOT at> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Enabling a specific interrupt |
Date: | Sat, 5 Jun 1999 20:31:16 +0200 |
Organization: | Telenor magnet GmbH |
Lines: | 60 |
Message-ID: | <7jbqeo$sh$1@orudios.magnet.at> |
NNTP-Posting-Host: | n205p020.dipool.highway.telekom.at |
X-Trace: | orudios.magnet.at 928607512 913 195.3.121.148 (5 Jun 1999 18:31:52 GMT) |
X-Complaints-To: | abuse AT magnet DOT at |
NNTP-Posting-Date: | 5 Jun 1999 18:31:52 GMT |
X-Priority: | 3 |
X-MSMail-Priority: | Normal |
X-Newsreader: | Microsoft Outlook Express 5.00.2014.211 |
X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2014.211 |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
Hi I am writing directly to the PIC to check if an interrupt is enabled with the following code. If the interrupt is not enabled then I enable it. Two questions. 1) Is there any easier / eleganter way to do this 2) Should I install the handler for this interrupt before or after this routine. Mark Usher marku AT magnet DOT at #define CARD_INTERRUPT 0x07 #define SPECIFIC_EOI 0x60 byte CheckInterrupt(void) { byte value; byte mask; byte i; mask = 0x01 << CARD_INTERRUPT; /* test to see if the interrupt is in use */ asm ("cli"); value = CARD_INTERRUPT | SPECIFIC_EOI; outportb(0x20, value); /* OCW 2 */ i=0; do { /* Select IRR Interrupt Request Register */ outportb(0x20, 0x10); /* OCW 3 */ i++; value = inportb(0x20) & mask; } while ((i<255) && (value ==0)); if (i>=255) { printf("Interrupt already in use. 0x%X\n",value); return -1; } value = CARD_INTERRUPT | SPECIFIC_EOI; outportb(0x20, value); /* OCW 2 */ /* enable the cards interrupt */ value =inportb(0x21); value = value & ~(0x1 << CARD_INTERRUPT); /* Set the mask for the PIC command */ outportb(0x21, value); return 0; }
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |