avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] interrupt optimization


From: Lars Noschinski
Subject: Re: [avr-gcc-list] interrupt optimization
Date: Fri, 3 Feb 2006 00:11:55 +0100
User-agent: mutt-ng devel (Linux)

* Paulo Marques <address@hidden> [2006-02-02 23:55]:
Then, to call the function, just do in assembly:
        in __tmp_reg__, SREG
        push __tmp_reg__
        call _not_inline_function_

The __tmp_reg__ (SREG) push is made to match the IRET instruction from the now "interrupt" function.

If the function call is the last thing you need to do, you can also
replace the call by a jmp instruction (of course, you may not push
something to the stack).

For example, i've an interrupt which only does something, if there is
an bit in an IO register set:

#define NAKED __attribute__ ((naked))

NAKED SIGNAL (SIG_INTERRUPT1) {
   if (_BV(PB0) & PINB)
       return;
   asm ("rjmp do_work" "\n\t");
}

This ensures minimal overhead, if this condition is not met.




reply via email to

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