[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] uco-ii ISR routine
From: |
Julius Luukko |
Subject: |
Re: [avr-gcc-list] uco-ii ISR routine |
Date: |
Mon, 8 Mar 2004 07:32:03 +0200 |
User-agent: |
KMail/1.4.3 |
On Sunday 07 March 2004 12:06, Ewout Boks wrote:
> Hi all,
>
> I am using Julius Luukko's ISR routines for ucos-ii with avr-gcc.
>
> I noticed that at the end of the ISR, the ret is used as opposed to the
> reti instruction. The same thing goes for the OSTickISR routine.
>
>
> My ISR work fine but I haven't been able to figure out how interrupts
> are re-enabled after the ISR is executed. The I bit is cleared when an
> interrupt is done so how does this work ?
>
>
> Greetings,
>
> Ewout
>
> _______________________________________________
> avr-gcc-list mailing list
> address@hidden
> http://www.avr1.org/mailman/listinfo/avr-gcc-list
Hello all,
(to Ewout: I forgot to send this to the list first)
The global interrupt flag I is one of the bits in the status register SREG as
you know. It is one of the registers which are pushed to the stack before a
context switch and also in the beginning of an ISR. During the context switch
and in the end of an ISR the SREG is popped from the stack.
Since the AVR core always clears the I bit in SREG, the I bit must be set by
hand in the value of SREG which is pushed to the stack. Note that the bit is
not set in the core SREG value at this time. When the value for SREG is then
popped from the stack, the I bit is set. Therefore you don't need to use
reti.
Setting of the I bit can be seen in the macro PUSHSREGISR in os_cpu_a.asm
.macro PUSHSREGISR
in r16,_SFR_IO_ADDR(SREG)
sbr r16,0x80
push r16
.endm
and also in the macro pushsreg() in avr_isr.h. Note that pushsreg() is
included in the macro PushRS(), which is the macro that you are supposed to
use in your applications.
Hope this clears the situation. You could mail me directly, not to the
avr-gcc-list, if you'd like to discuss this further.
--
D.Sc. Julius Luukko
Laboratory of Control Engineering/Department of Electrical Engineering
Lappeenranta University of Technology, FINLAND
phone:+358-5-621 6713, fax:+358-5-621 6799, www: http://www.ee.lut.fi
_______________________________________________
avr-gcc-list mailing list
address@hidden
http://www.avr1.org/mailman/listinfo/avr-gcc-list