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

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

RE: [avr-gcc-list] Sharing interrupts


From: Dave Hansen
Subject: RE: [avr-gcc-list] Sharing interrupts
Date: Mon, 08 Dec 2003 16:17:50 -0500

From: Pablo Bleyer Kocik <address@hidden>

 Hello list.

I was wondering, is there an easy way to register two interrupt vectors with the same interrupt handler? The SIGNAL/INTERRUPT macros expand to a function declaration and function definition header, so it is not possible to assign function pointers with them.


I don't know of any way to do it directly. But the obvious solution would be to write your routine as a normal function and call it from the other ISRs, e.g.

  void isr(void)
  {
     // Do what you gotta do
  }

  SIGNAL(SIG_WHATEVER)
  {
     isr();
  }

  SIGNAL(SIG_WHATEVER_ELSE)
  {
     isr();
  }

Another solution might be to write an assembly ISR to jump to the other ISR. I'm less sure of how this would work, but something like

  // In a C file
  SIGNAL(SIG_FOR_VECTOR_X)
  {
     // Do what you gotta do
  }


  ; in an assembly file
  __vector_y:   rjmp __vector_x

This would be faster and require less space, but would make maintenance more difficult.

HTH,
  -=Dave

_________________________________________________________________
Tired of slow downloads and busy signals? Get a high-speed Internet connection! Comparison-shop your local high-speed providers here. https://broadband.msn.com



reply via email to

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