[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] interrupt optimization
From: |
Joerg Wunsch |
Subject: |
Re: [avr-gcc-list] interrupt optimization |
Date: |
Wed, 1 Feb 2006 22:55:06 +0100 (MET) |
"David Bourgeois" <address@hidden> wrote:
> ISR(...)
> {
> if (sampling-- == 0)
> {
> sampling = 0x7F;
> callInlineFunction();
> }
> }
> What's the way to go in this situation?
Two things: I'm not sure, but I guess the compiler handles an inlined
function the same way as any other function, i.e. it treats any
call-clobbered register as something that needs to be pushed upon
entering the ISR. So it's usually best to avoid any kind of function
call inside the ISR.
If that doesn't help, code it completely in assembly.
__tmp_reg__ = 0
__SREG__ = 0x3d
.global XXX_vect
XXX_vect:
push __tmp_reg__
in __tmp_reg__, __SREG__
push r16
lds r16, sampling
and r16, r16
brne 1f
ldi r16, 0x7f
;; do some stuff here
rjmp 2f
1:
dec r16
2: sts sampling, r16
pop r16
out __SREG__, __tmp_reg__
pop __tmp_reg__
reti
--
cheers, J"org .-.-. --... ...-- -.. . DL8DTL
http://www.sax.de/~joerg/ NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)
RE: [avr-gcc-list] interrupt optimization, Nigel Winterbottom, 2006/02/01
Re: [avr-gcc-list] interrupt optimization,
Joerg Wunsch <=
Re: [avr-gcc-list] interrupt optimization, David Brown, 2006/02/02
- RE: [avr-gcc-list] interrupt optimization, MuRaT KaRaDeNiZ, 2006/02/04
- [avr-gcc-list] avr-libc version in Latest WinAVR ?, Anton Erasmus, 2006/02/05
- Re: [avr-gcc-list] avr-libc version in Latest WinAVR ?, Joerg Wunsch, 2006/02/05
- [avr-gcc-list] Memory Size Report, Peter Harrison, 2006/02/05
- Re: [avr-gcc-list] Memory Size Report, Ned Konz, 2006/02/05
- Re: [avr-gcc-list] Memory Size Report, Peter Harrison, 2006/02/05
- Re: [avr-gcc-list] Memory Size Report, Joerg Wunsch, 2006/02/06
- Re: [avr-gcc-list] Memory Size Report, Peter Harrison, 2006/02/05
- Re: [avr-gcc-list] avr-libc version in Latest WinAVR ?, Anton Erasmus, 2006/02/05