[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [avr-gcc-list] Inserting code before context save in an ISR(forneste
From: |
Stu Bell |
Subject: |
RE: [avr-gcc-list] Inserting code before context save in an ISR(fornested interrupts) |
Date: |
Mon, 13 Aug 2007 13:55:08 -0600 |
Joerg Wunsch wrote:
> Christian Ludlam <address@hidden> wrote:
>
> > Oh that's awful! I don't see why using a clumsy attribute syntax
with
> > the same deprecated name is any less confusing... can't we add a new
> > macro, something like REENTRANT_ISR() or ISR_SEI()?
>
> Sounds useful, would you file a bug report for this?
I thought Dean Camera submitted a macro file for this to avr-libc. I've
got it encapsulated in a file ISRMacro.h.
He redefined the ISR macro to have a second parameter:
ISR_BLOCK - ISR, interrupts disable until ISR completes.
ISR_NOBLOCK - ISR, interrupts enabled until ISR completes.
ISR_NAKED - ISR, no prologue or epilogue.
I suppose this is incompatible with the ISR macro, since we redefine it.
But it seems to meet this bill.
I've included my source for ISRMacro.h below.
Stu Bell
DataPlay (DPHI, Inc.)
========================================================================
===========
/* Must be included after avr/interrupt.h. This file re-defines the new
ISR macro to extend it to allow custom attributes. When the old ISR
macros SIGNAL and INTERRUPT were depricated, no suitable replacement
was specifed for interruptable ISR routine (and no macro at all
exists
for naked ISRs). This file avoids the clumsyness of declaring the ISR
routines manually with custom attributes and thus gives code
uniformity.
As a bonus, the default vector (called when an interrupt fires which
does
not have an associated ISR routine) is aliased here to a more
descriptive
name - use the new name as you would a standard signal name.
The avaliable attributes are:
1) ISR_BLOCK - ISR, interrupts disable until ISR completes.
2) ISR_NOBLOCK - ISR, interrupts enabled until ISR completes.
3) ISR_NAKED - ISR, no prologue or epilogue.
*/
#ifndef __ISRMACRO_H__
#define __ISRMACRO_H__
// If present, kill the current ISR macro:
#ifdef ISR
#undef ISR
#endif
// The default vector is given a more descriptive alias here:
#define BADISR_vect __vector_default
// The three attributes are defined here:
#ifdef GCC_41
#define ISR_NOBLOCK __attribute__((interrupt, used))
#define ISR_BLOCK __attribute__((signal, used))
#define ISR_NAKED __attribute__((signal, used, naked))
#else
#define ISR_NOBLOCK __attribute__((interrupt))
#define ISR_BLOCK __attribute__((signal))
#define ISR_NAKED __attribute__((signal, naked))
#endif
// Define the new ISR macro:
#define ISR(vector, attribute) \
void vector (void) attribute; \
void vector (void)
#endif // __ISRMACRO_H__
- Re: [avr-gcc-list] Inserting code before context save in an ISR (for nested interrupts), (continued)
- Re: [avr-gcc-list] Inserting code before context save in an ISR (for nested interrupts), Klaus Rudolph, 2007/08/06
- Re: [avr-gcc-list] Inserting code before context save in an ISR (for nested interrupts), Paulo Marques, 2007/08/06
- Re: [avr-gcc-list] Inserting code before context save in an ISR (for nested interrupts), David Brown, 2007/08/06
- RE: [avr-gcc-list] Inserting code before context save in an ISR (fornested interrupts), Eric Weddington, 2007/08/06
- Re: [avr-gcc-list] Inserting code before context save in an ISR (fornested interrupts), Joerg Wunsch, 2007/08/07
- Re: [avr-gcc-list] Inserting code before context save in an ISR (fornested interrupts), David Carr, 2007/08/07
- RE: [avr-gcc-list] Inserting code before context save in an ISR(fornested interrupts), Eric Weddington, 2007/08/07
- Re: [avr-gcc-list] Inserting code before context save in an ISR (fornested interrupts), Christian Ludlam, 2007/08/13
- RE: [avr-gcc-list] Inserting code before context save in an ISR(fornested interrupts), Eric Weddington, 2007/08/13
- Re: [avr-gcc-list] Inserting code before context save in an ISR (fornested interrupts), Joerg Wunsch, 2007/08/13
- RE: [avr-gcc-list] Inserting code before context save in an ISR(fornested interrupts),
Stu Bell <=
- Re: [avr-gcc-list] Inserting code before context save in an ISR(fornested interrupts), Joerg Wunsch, 2007/08/13
- RE: [avr-gcc-list] Inserting code before context save in anISR(fornested interrupts), Eric Weddington, 2007/08/13