General Int. Service routine?

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Gang....

I was wondering if there is a reasonably elegant way to declare a single function to service several different interrupts?

Right now, I 'm declaring five seperate functions which all do the same thing.

TIA,
Larry Wimble

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

i was the one who asked a month ago ;) none knew another solution than arturl. i still use that handler type of code. *mutters about wasted cycles*

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If the wasted two cycles are worth it, you can always hack your own
crt0.o file + linkerscript. ;-)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I was wondering if there is a reasonably elegant way to declare a single function to service several different interrupts?

Right now, I 'm declaring five seperate functions which all do the same thing.

Well, if timing isn't *too* critical you can just have each ISR call a single function that does all the processing. You just have the overhead of a function call and return added in.

.... Or, now that I'm thinking of it, you can declare the function that does all the processing with an always_inline attribute (see the GCC docs on function attributes) and this will cause that function to always be inlined. That way you can just write the routine once, but it will inline the code in all the ISRs. Of course, the trade off is that it will take up more code space.

admin's test signature