[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-libc-dev] Re: C++ Interrupts
From: |
Joerg Wunsch |
Subject: |
Re: [avr-libc-dev] Re: C++ Interrupts |
Date: |
Sun, 20 Jan 2008 20:29:27 +0100 |
User-agent: |
Mutt/1.5.11 |
As Dean Camera wrote:
> My solution:
>
> #define CLASS_ISR(vector, ...) { vector(); } ISR(vector, __VA_ARGS__)
Thanks!
> Which means you can name the function anything, and it should be
> accessible as a normal function, but also link in as an ISR. As I
> can't seem to get the intermixed assembly listing, I can't see how
> effective it is, but it should allow you to call the ISR by the
> member function name you give it, with either no penalty at all (if
> the optimizer inlines it) or a small penalty of a JUMP instruction.
The only downside appears to be one empty instance of
Test::__vector_29():
...
0000010a <__bad_interrupt>:
10a: 0c 94 00 00 jmp 0 ; 0x0 <__heap_end>
0000010e <Test::~Test()>:
10e: 08 95 ret
00000110 <Test::~Test()>:
110: 08 95 ret
00000112 <Test::__vector_29()>:
112: 08 95 ret
00000114 <Test::Test()>:
114: 08 95 ret
00000116 <Test::Test()>:
116: 08 95 ret
00000118 <__vector_29>:
118: f 92 push r1
11a: 0f 92 push r0
11c: 0f b6 in r0, 0x3f ; 63
11e: 0f 92 push r0
120: 11 24 eor r1, r1
122: 8f 93 push r24
124: 8f ef ldi r24, 0xFF ; 255
126: 88 b9 out 0x08, r24 ; 8
128: 8f 91 pop r24
12a: 0f 90 pop r0
12c: 0f be out 0x3f, r0 ; 63
12e: 0f 90 pop r0
130: f 90 pop r1
132: 18 95 reti
00000134 <main>:
...
Btw., I remember that Marek once mentioned an idea how the entire
interrupt vector setup could be changed so arbitrarily named interrupt
vectors are possible. However, I cannot find his idea at a quick
glance in my archive of avr-libc-dev, so I guess it has been discussed
in avr-gcc-list by its time (which I do not archive personally). I
just remembered that idea when Ron asked that question in
avrfreaks.net because I think it will also provide a solution.
Anyway, the macro above looks as a really good start to me, and even
when/if we've got a different vector naming scheme some day, it would
be as simple to adapt that macro to the new scheme, so the API will be
retained.
--
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-libc-dev] Re: C++ Interrupts,
Joerg Wunsch <=
[avr-libc-dev] Re: C++ Interrupts, Ron Kreymborg, 2008/01/21