[Top][All Lists]

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

Re: [avr-libc-dev] Disable/Restore all Interrupts

From: E. Weddington
Subject: Re: [avr-libc-dev] Disable/Restore all Interrupts
Date: Fri, 5 Sep 2003 15:22:22 GMT

> I think that putting the opening and closing braces in 
separate macros is 
> asking for trouble.

Not necessarily so. I've seen it in Marek's macros in 
pgmspace.h (go back to older revs). They usually enclose a 
combination of C and inline assembly. IIRC, they just 
create a "block" in themselves. Where I find it useful is 
if you're creating a macro and you want to have some "local 
variables", but you have to use C99 to do this. Again see 
the pgmspace.h macros for cases of this.

In his particular case, I don't think it necessarily gains 
one anything.

> It's debatable whether saving and restoring only the I 
flag gains you 
> anything.

And here's the debate:
1. It's faster to save all of SREG and then restore all of 
2. However, when you restore all of SREG, you will 
overwrite all the other flags just to re-enable interrupts. 
Is this acceptable?

I still don't know the right answer myself. :-/


reply via email to

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