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

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

Re: [avr-gcc-list] interrupt in as


From: Clemens Gerlach
Subject: Re: [avr-gcc-list] interrupt in as
Date: Tue, 9 Oct 2001 15:07:08 +0200
User-agent: Mutt/1.2.5i

On Tue, Oct 09, 2001 at 11:11:10AM +0200, Torsten Hahn wrote:
> I would need an interrupt routine with no overhead from the c-compiler. If I 
> use

use  __attribute__((naked)) for the function to avoid pro/epilog.
you have to save registers and status by yourself. 

i use this in one of my programs: 

void SIG_SPI(void) __attribute__((signal,naked));
void SIG_SPI(void)
{
        asm volatile (  "push r27\n\t"
                        "push r26\n\t"
                        "push r25\n\t"
                        "lds r26, sendp\n\t"
                        "sbic %0, 0\n\t"
                        "ldi r26, lo8(results)\n\t"
                        "ld r25, X+\n\t"
                        "out %0, r25\n\t"
                        "sts sendp, r26\n\t"
                        "pop r25\n\t"
                        "pop r26\n\t"
                        "pop r27\n\t"
                        "reti"
                        ::"I" (SPDR));

} 

the assembly is the only thing that appears in the isr.

but remember there's allways a jmp (2 clocks) from the interrupt table to
the isr.

clemens



reply via email to

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