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

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

Re: [avr-gcc-list] reentrant interrupt service routine


From: Pink Boy
Subject: Re: [avr-gcc-list] reentrant interrupt service routine
Date: Tue, 1 Apr 2008 11:37:57 -0700 (PDT)

Sven Schlender sez,

> I just wondering if there are some experiences with
> reentrant interrupt service routines with avr-gcc. 

I have a timer routine that is reentrant.

> Is this a known issue? How the avr-gcc handle
> it? Is there a possibility to find such reentrant calls
> with a compiler or linker command line option?

One thing I've found that is important is to have a 
way of knowing that you are already in the ISR. I
do the following.

SIGNAL(BLAH_INT)
{
  static volatile uint8_t int_blk = 0;

  /* do some basic timer stuff */

  if(int_blk)
    return;   // Oops we're still here

  int_blk = 1;
  sei();

  /* do stuff that takes a while */

  cli();  // turn ints back off
  blk = 0;  // reset blk flag;
}

PS: The volatile prefix is needed to keep the new gcc compilers
dirty mitts off of int_blk, otherwise it will very wrongly
optimize it away.

Mr Foo





reply via email to

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