[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] interrupts and signals (again)

From: Parthasaradhi Nayani
Subject: Re: [avr-gcc-list] interrupts and signals (again)
Date: Sat, 26 Mar 2005 06:41:05 -0800 (PST)

--- Jamie Morken <address@hidden> wrote:
> I just checked that an INTERRUPT can be interrupted
> by any other interrupt or signal, no matter its
> priority.. so this must mean that the INTERRUPTS
> mask bit is being cleared when the ISR is entered. 
> I think it would be a good idea to be able to clear
> the interrupts mask bit when the ISR completes as
> well.. that way maybe only ISR's with higher
> priority would be able to interrupt it.  Or maybe I
> am on the wrong track here.. 
> > Hi,
> > 
> > If I declare "SIG_SPI" as in INTERRUPT, will it
> only be 
> > interrupted by higher priority interrupts, ie.
> > 
> > I would like one of my interrupts to be able to
> interrupt all of 
> > the other ones, and also have it as the only one
> that can 
> > interrupt other interrupts.  I doubt this is
> possible but thought 
> > I would ask! :)
> > 
> > Also is there a way to change the order of
> priority for the 
> > interrupts?

Hello Jamie,

Firstly you need to get clarity on how interrupts are
handled by processors.
1. Priority of interrupts will come into picture only
when two or more interrupts occur at the same time.
The higher priority interrupt ISR will be executed by
the processor. The moment control enters ISR, global
interrupt is disabled. This means all maskable
interrupts are disabled no matter what their priority
is. Only NMI will be serviced in case the processor
supports it. AVRs do not have an NMI.

Next in the ISR if you enable the global interrupt
(this is what happens when you use the INTERRUPT
attribute in GCC) then again the previous status of
interrupts before the ISR is executed will be
restored. This means that the current ISR can again be

If you need to enable other interrupts then in the ISR
you must selectively enable these interrupts and then
enable the global interrupt. Please remember that even
a lower priority interrupt can be enabled and the
current interrupt can be disabled. 

Before getting out of the ISR, you must restore the
original status, if you need to restore.


Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!

reply via email to

[Prev in Thread] Current Thread [Next in Thread]