DSPRelated.com
Forums

interrupt, interrupts, interruptf

Started by Unknown September 19, 2001
Hi,

Would someone explain the differences between them? (VisualDSP++ 1.0
SP1 for SHARC)



A Summary (from ADI's EE-134)
* the regular interrupt() takes 128 cycles and saves and restores all
regs.
* The fast interruptf takes 60 cycles and saves and restores scratcg
regs only
* The superfast interrupts takes 30 cycles and saves and uses
alternate reg set, with nothing saved. Interrupt nesting is disabled.

See ADI's Engineer-to-Engineer Note 134 at
http://www.analog.com/techsupt/application_notes/EE_notes/pdf_files/ee_134.p
df.

Also, ADI's site
http://www.analog.com/publications/documentation/C_Library_Manual/Chapter_4.
pdf has good definitions.
> -----Original Message-----
> From: [SMTP:]
> Sent: Wednesday, September 19, 2001 2:02 AM
> To:
> Subject: [adsp] interrupt, interrupts, interruptf
>
> Hi,
>
> Would someone explain the differences between them? (VisualDSP++ 1.0
> SP1 for SHARC) >
> _____________________________________
> Note: If you do a simple "reply" with your email client, only the author
> of this message will receive your answer. You need to do a "reply all" if
> you want your answer to be distributed to the entire group.
>
> _____________________________________
> About this discussion group:
>
> To Join: Send an email to
>
> To Post: Send an email to
>
> To Leave: Send an email to
>
> Archives: http://groups.yahoo.com/group/adsp
>
> Other Groups: http://www.dsprelated.com/groups.php3 > ">http://docs.yahoo.com/info/terms/
>




It has been a long time since I dealt with the interrupt functions. Here is
what I know from working with them in the GNU based compiler (pre-VDSP).
The functions provide different level of system state saving/restoring at
the entry/exit of your interrupt service routines.

interrupt() is the normal version and saves "everything" in the system. It
is the safest, but also the slowest. If I remember correctly, it took about
125 clock cycles before execution made it to the actual ISR.

interruptf() is the "fast" version. It saves most registers, but does not
save the hardware loop stack, so you are limited to a total of 6 levels of
hardware DO loops. Therefore the total of the number used in your ISR and
the the maximum number used in the main code cannot exceed 6. I don't know
if the C compiler actually uses the hardware DO loops, if not, then I this
won't be a problem unless you write your own loops in assembly. This uses
about 60 clock cycles.

interrupts() is the "super fast" version. Like interruptf(), the loop stack
is not saved. In addition the alternate register set is used which saves
time. Interrupt nesting will not work using this version. Interrupt
nesting works in the other 2 verisons. The uses about 30 clock cycles.

Debugging problems in the interrupt dispatcher are painful. My
recomendation is to use interrupt(). Then change to interruptf() or
interrupts() if you find that your ISRs are not responding quickly enough.

Hope that helps.

Derek
----- Original Message -----
From: <>
To: <>
Sent: Wednesday, September 19, 2001 2:02 AM
Subject: [adsp] interrupt, interrupts, interruptf > Hi,
>
> Would someone explain the differences between them? (VisualDSP++ 1.0
> SP1 for SHARC) >
> _____________________________________
> Note: If you do a simple "reply" with your email client, only the author
of this message will receive your answer. You need to do a "reply all" if
you want your answer to be distributed to the entire group.
>
> _____________________________________
> About this discussion group:
>
> To Join: Send an email to
>
> To Post: Send an email to
>
> To Leave: Send an email to
>
> Archives: http://groups.yahoo.com/group/adsp
>
> Other Groups: http://www.dsprelated.com/groups.php3 > ">http://docs.yahoo.com/info/terms/
>


wrote:
> Would someone explain the differences between them? (VisualDSP++ 1.0
> SP1 for SHARC)

You might take a look at ...

- the C/C++ compiler & library manual p 3-10 (where signal.h is described)
- the source code of libc.dlb (interrup.asm, signal.asm, int_cnXl.asm etc.)

HTH
Michael


On Wed, 19 Sep 2001 06:02:04 -0000, wrote:

> Would someone explain the differences between them? (VisualDSP++ 1.0
> SP1 for SHARC)

See VisualDSP\Docs\cc21kpl\cc21k_03.pdf, page 3-10, on the file
signal.h.

In a nutshell, they save different amounts of state, so you tradeoff
interrupt overhead vs. what it's safe to do in your handler.


Hi,

You can find a detailed description in the following document from AD
(www.analog.com).

Document: C/C++ Compiler and Library Manual for ADSP-21xxx Family DSPs

This can be downloaded free of charge, as are all of ADs documents. Three interrupt functions let you disable interrupts and modify the
processors MODE1 register from an interrupt handler.

interrupt:
Saves all scratch registers and the loop stack. Do loop and interrupt
nesting is allowed because data is pushed onto the stack. Requires
approximately 125 cycles for interrupt overhead.
Preserves MODE1 register writes in an interrupt handler after the
interrupt is serviced.
Freezes the cache.

interruptf:
Does not save the loop stack; DO loop handling is restricted to six
levels (specified in hardware). If the interrupt service routine (ISR)
uses one level of nesting, your code cannot exceed five levels.
Preserves MODE1 register writes in an interrupt handler after the
interrupt is serviced.
Interrupt nesting is not restricted (20 levels available). Does not
send the interrupt number type to the ISR as a parameter. Requires
approximately 60 cycles for interrupt overhead.

interrupts:
Does not save the loop stack, therefore do loop handling is restricted
to six levels (specified in hardware). Interrupt nesting is disabled.
This dispatcher does not send the interrupt number type to the ISR
as a parameter.
Uses the secondary register set. This dispatcher requires approximately
30 cycles for interrupt overhead. If you processor is not of the 21xxx family it may be worth checking in the
compiler documentation for your processor to make sure that this is still
true.
-----Original Message-----
From: [mailto:]
Sent: Wednesday, September 19, 2001 7:02 AM
To:
Subject: [adsp] interrupt, interrupts, interruptf Hi,

Would someone explain the differences between them? (VisualDSP++ 1.0
SP1 for SHARC)
_____________________________________
Note: If you do a simple "reply" with your email client, only the author of
this message will receive your answer. You need to do a "reply all" if you
want your answer to be distributed to the entire group.

_____________________________________
About this discussion group:

To Join: Send an email to

To Post: Send an email to

To Leave: Send an email to

Archives: http://groups.yahoo.com/group/adsp

Other Groups: http://www.dsprelated.com/groups.php3 ">http://docs.yahoo.com/info/terms/


On Thu, 20 Sep 2001 14:15:07 -0500, Jaime Andrs Aranguren Cardona
wrote:

> But does it work all the same for the 2106x and the 21160?

Check the library source code for the dispatchers and registration
functions. I recall seeing conditionals in there. One obvious issue is
that the 211xx has a second ALU that needs to be saved, so there's got
to be extra code in the dispatcher for that case.

Also, there's a display bug in the current debugger DLL for the
secondary registers. The debugger fails to recognize when the alternate
registers are active, so it still displays the primary registers when
in a super-fast ISR, not the secondaries. As a workaround, view the
"inactive" registers to see the correct set. And recognize that your
locals window and expressions window will be wrong for any variables
held in registers, as it will be evaluting the wrong register set. The
mixed source view is extremely helpful here.