delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/03/16/08:41:07

Date: Thu, 16 Mar 2000 12:01:45 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Frederic Cazenave <cazenave AT radar DOT mcgill DOT ca>
cc: djgpp AT delorie DOT com
Subject: Re: interrupt priority
In-Reply-To: <38CFF244.A29DDEDB@radar.mcgill.ca>
Message-ID: <Pine.SUN.3.91.1000316120125.3117O-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: dj-admin AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Wed, 15 Mar 2000, Frederic Cazenave wrote:

> I have made a program with 2 interrupts actives sources, One is coming
> from a ADC ISA board on IRQ5 et the second one is coming from a DSP
> pci board on a interrupt on the second PIC (IRQ 13 in think).
> The ADC interrupt appears 6 time more often than the DSP one.
> At a frequency up to 300 hz for the ADC interrupt, it seems that a ADC
> interrupt occurs during the execution of the DSP interrupt routine but
> , I lose it cause of this lower priority.

Right, the priority of IRQ 5 is below those of IRQs 8-15.

One thing you could try is to redirect the ADC board to one of the
IRQs in the slave PIC which is below the IRQ used for the DSP.  This
would take care of the priority issue automatically.

Using IRQ 5 is not a good thing anyway, since the interrupt associated
with it, Int 0Dh, is in conflict with the GPF exception.  If your
program causes GPFs (e.g., if it uses signals), you could lose
interrupts as a result.

> The code of the DSP interrupt is quite long.

This is not a good thing.  Can't you restructure your code so that
most of it doesn't run inside the interrupt handler?

> So I need to set the priority of the ADC interrupt higher than the
> DSP one.

This should usually be the last resort; you should generally avoid
messing with interrupt priorities, as it might disrupt the machine
operation in subtle ways.  I'd advise to look for other alternatives
first.

One thing you could try is to EOI the PICs early in the DSP interrupt
handler.  This will allow the ADC interrupt to take effect (since the
IRQ 2 bit in the Interrupt In Service Register would be reset by the
EOI), even though the DSP handler is still working.  (If you bother
about reentrancy in the DSP handler, you could solve it on the
software level.)

Also, are you quite sure that the priorities are your problem?  If
not, you could add code in the DSP handler that would periodically
check the Interrupt Request Register on the PIC, to see if the ADC
triggered.  This would tell you whether you have collisions.  You
could even invoke the ADC handler from the DSP handler, if you need
that.

> I have try to do than in two different  ways :
[snip]
> Unfortunately, I lose always one of the ADC int.

This might mean that the priorities is not the cause of your problem.
For example, are you sure your code doesn't disable interrupts while
the DSP handler runs?

- Raw text -


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