avr-libc-dev
[Top][All Lists]
Advanced

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

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


From: Joerg Wunsch
Subject: Re: [avr-libc-dev] Disable/Restore all Interrupts
Date: Fri, 5 Sep 2003 15:38:54 +0200
User-agent: Mutt/1.2.5i

As Theodore A. Roth wrote:

> Note that sei() has it's place. You can use it once to initially
> enable interrupts.

Also, you can use it in situations where you're sure that interrupts
have been disabled previously (like it's usually the case in the
application's main loop).  While saving SREG in a temp reg is
certainly the safe way, it would waste the storage for a temporary
register in these situations.

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

You can be sure to not clobber any flags the compiler expects to
persist.  IMHO, just saving the entire SREG is only safe in the
function prologue/epilogue, or am i missing something here?  Does the
compiler perhaps automatically expect the flags to be clobbered as
soon as a single inline asm statement is executed?
-- 
J"org Wunsch                                           Unix support engineer
address@hidden        http://www.interface-systems.de/~j/




reply via email to

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