[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-libc-dev] [bug #12941] Table of Signal Names in "Interrupts and
From: |
Rolf Ebert |
Subject: |
Re: [avr-libc-dev] [bug #12941] Table of Signal Names in "Interrupts and Signals" is wrong/incomplete |
Date: |
Fri, 06 May 2005 20:35:46 +0200 |
User-agent: |
Opera M2/7.54 (Win32, build 3929) |
On Thu, 5 May 2005 08:33:45 +1100, Dmitry K. <address@hidden>
wrote:
On Wednesday 04 May 2005 08:26, Rolf Ebert wrote:
* the interrupt short names in the XML files sometimes contain funny
characters that cannot be part of an identifier. I replace all of
comma,
blank, or slash to underscores in the Python script. I don't know why
Atmel created interrupt names containing these characters in the first
place...
Rolf
First, the speech is about INTERRUPT SERVICE ROUTINES names. Not about of
electrical signals or human readable designations.
Yes, that's what I was talking about. Excuse my sloppy wording.
Let us look ATtiny2313 datasheet (next page after Table 21).
ISR names differ from specified above:
...
rjmp INT0
...
rjmp TIM1_CAPT
...
rjmp TIM1_OVF
This is sample assembler code. In assembler you can use whatever name
pleases you. The rjmp labels are not related in any way to the names of
the interrupts. Perhaps that is what you wanted to say above.
gcc doesn't have the same freedom for choosing names of the interrupt
service routines. Their internal names are fixed to __vector_<xx>
anyway. The corresponding io header file predefines the names that are to
be used in "SIGNAL(<name>)". Certainly it makes sense to call the ISR the
same as the triggering interrupt. AVR libc prepends SIG_ to all names, it
could as well append _HANDLER, that's not the point.
I still think the ISR name should be based on the documented (in the Atmel
data sheets) interrupt names. The XML for the three mentioned interrupts
of attiny2313 reads:
<VECTOR2>
<PROGRAM_ADDRESS>$001</PROGRAM_ADDRESS>
<SOURCE>INT0</SOURCE>
<DEFINITION>External Interrupt Request 0</DEFINITION>
</VECTOR2>
...
<VECTOR4>
<PROGRAM_ADDRESS>$003</PROGRAM_ADDRESS>
<SOURCE>TIMER1 CAPT</SOURCE>
<DEFINITION>Timer/Counter1 Capture Event</DEFINITION>
</VECTOR4>
...
<VECTOR6>
<PROGRAM_ADDRESS>$005</PROGRAM_ADDRESS>
<SOURCE>TIMER1 OVF</SOURCE>
<DEFINITION>Timer/Counter1 Overflow</DEFINITION>
</VECTOR6>
Note the blanks in the values of SOURCE of vector4 and vector6.
The Atmel assembler include file (AvrAssembler/Appnotes/tn2313def.inc)
reads:
.equ INT0addr = 0x001 ;External Interrupt0
...
.equ ICP1addr = 0x003 ;Input capture interrupt 1
...
.equ OVF1addr = 0x005 ;Overflow1 Interrupt
It claims to be autogenerated from the XML file. Although, I don't know
which algorithm generates "OVF1addr" from the XML info above...
Certainly, it would be good to use names from Atmel's datasheets from the
first. But, unfortunately, Atmel is very inaccurate in ISR's names.
Identical subroutines have different names for different chips (for
example,
EE_RDY in AT90S4433 and EE_READY in ATtiny2313). Sometimes the name
clashes
with other identificators (INT0 above).
Dmitry.
It won't clash with a prefix like SIG_ to all names, as it is right now.
Different names for different chips triggered by the same interrupt is
another topic. Personally, as a programmer I'd rather look up the name of
an identifier in the doc, i.e. data sheet, than to guess the name from
another chip. But then, there are projects that want to use a single
piece of code for several chips and it isn't beautiful to have #ifdefs all
over the place.
Rolf