2002-08-06 Theodore A. Roth
* doc/api/Makefile.am(EXTRA_DIST): Add interrupts.dox file. * doc/api/interrupts.dox: New file. * include/avr/interrupt.h: Added doxy comments. * include/avr/signal.h: Updated doxy comments. Index: doc/api/Makefile.am =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/doc/api/Makefile.am,v retrieving revision 1.11 diff -u -r1.11 Makefile.am --- doc/api/Makefile.am 5 Aug 2002 21:47:34 -0000 1.11 +++ doc/api/Makefile.am 6 Aug 2002 07:15:10 -0000 @@ -37,6 +37,7 @@ EXTRA_DIST = dox.css dox_html_header dox_html_footer \ main_page.dox \ inline_asm.dox \ + interrupts.dox \ faq.dox SUFFIXES = .pdf Index: doc/api/interrupts.dox =================================================================== RCS file: doc/api/interrupts.dox diff -N doc/api/interrupts.dox --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ doc/api/interrupts.dox 6 Aug 2002 07:15:10 -0000 @@ -0,0 +1,366 @@ +/* Copyright (c) 1999, 2000, 2001, 2002, Rich Neswold + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. */ + +/** \defgroup avr_interrupts Interrupts and Signals + +\note This discussion of interrupts and signals was taken from Rich Neswold's +document. See acknowledgements. [FIXME: write ack page and ref to it] + +It's nearly impossible to find compilers that agree on how to handle interrupt +code. Since the C language tries to stay away from machine dependent details, +each compiler writer is forced to design their method of support. + +In the AVR-GCC environment, the vector table is predefined to point to +interrupt routines with predetermined names. By using the appropriate name, +your routine will be called when the corresponding interrupt occurs. The +device library provides a set of default interrupt routines, which will get +used if you don't define your own. + +Patching into the vector table is only one part of the problem. The compiler +uses, by convention, a set of registers when it's normally executing +compiler-generated code. It's important that these registers, as well as the +status register, get saved and restored. The extra code needed to do this is +enabled by tagging the interrupt function with +__attribute__((interrupt)). + +These details seem to make interrupt routines a little messy, but all these +details are handled by the Interrupt API. An interrupt routine is defined with +one of two macros, INTERRUPT() and SIGNAL(). These macros register and mark +the routine as an interrupt handler for the specified peripheral. The +following is an example definition of a handler for the ADC interrupt. + +\code +#includeSignal Name | +Description | +
SIG_2WIRE_SERIAL | ++ |
SIG_ADC | +ADC Conversion complete | +
SIG_COMPARATOR | +Analog Comparator Interrupt | +
SIG_EEPROM_READY | +Eeprom ready | +
SIG_FPGA_INTERRUPT0 | ++ |
SIG_FPGA_INTERRUPT1 | ++ |
SIG_FPGA_INTERRUPT10 | ++ |
SIG_FPGA_INTERRUPT11 | ++ |
SIG_FPGA_INTERRUPT12 | ++ |
SIG_FPGA_INTERRUPT13 | ++ |
SIG_FPGA_INTERRUPT14 | ++ |
SIG_FPGA_INTERRUPT15 | ++ |
SIG_FPGA_INTERRUPT2 | ++ |
SIG_FPGA_INTERRUPT3 | ++ |
SIG_FPGA_INTERRUPT4 | ++ |
SIG_FPGA_INTERRUPT5 | ++ |
SIG_FPGA_INTERRUPT6 | ++ |
SIG_FPGA_INTERRUPT7 | ++ |
SIG_FPGA_INTERRUPT8 | ++ |
SIG_FPGA_INTERRUPT9 | ++ |
SIG_INPUT_CAPTURE1 | +Input Capture1 Interrupt | +
SIG_INPUT_CAPTURE3 | +Input Capture3 Interrupt | +
SIG_INTERRUPT0 | +External Interrupt0 | +
SIG_INTERRUPT1 | +External Interrupt1 | +
SIG_INTERRUPT2 | +External Interrupt2 | +
SIG_INTERRUPT3 | +External Interrupt3 | +
SIG_INTERRUPT4 | +External Interrupt4 | +
SIG_INTERRUPT5 | +External Interrupt5 | +
SIG_INTERRUPT6 | +External Interrupt6 | +
SIG_INTERRUPT7 | +External Interrupt7 | +
SIG_OUTPUT_COMPARE0 | +Output Compare0 Interrupt | +
SIG_OUTPUT_COMPARE1A | +Output Compare1(A) Interrupt | +
SIG_OUTPUT_COMPARE1B | +Output Compare1(B) Interrupt | +
SIG_OUTPUT_COMPARE1C | +Output Compare1(C) Interrupt | +
SIG_OUTPUT_COMPARE2 | +Output Compare2 Interrupt | +
SIG_OUTPUT_COMPARE3A | +Output Compare3(A) Interrupt | +
SIG_OUTPUT_COMPARE3B | +Output Compare3(B) Interrupt | +
SIG_OUTPUT_COMPARE3C | +Output Compare3(C) Interrupt | +
SIG_OVERFLOW0 | +Overflow0 Interrupt | +
SIG_OVERFLOW1 | +Overflow1 Interrupt | +
SIG_OVERFLOW2 | +Overflow2 Interrupt | +
SIG_OVERFLOW3 | +Overflow2 Interrupt | +
SIG_PIN | ++ |
SIG_PIN_CHANGE0 | ++ |
SIG_PIN_CHANGE1 | ++ |
SIG_RDMAC | ++ |
SIG_SPI | +SPI Interrupt | +
SIG_SPM_READY | ++ |
SIG_SUSPEND_RESUME | ++ |
SIG_TDMAC | ++ |
SIG_UART0 | ++ |
SIG_UART0_DATA | +UART(0) Data Register Empty Interrupt | +
SIG_UART0_RECV | +UART(0) Receive Complete Interrupt | +
SIG_UART0_TRANS | +UART(0) Transmit Complete Interrupt | +
SIG_UART1 | ++ |
SIG_UART1_DATA | +UART(1) Data Register Empty Interrupt | +
SIG_UART1_RECV | +UART(1) Receive Complete Interrupt | +
SIG_UART1_TRANS | +UART(1) Transmit Complete Interrupt | +
SIG_UART_DATA | ++ |
SIG_UART_RECV | ++ |
SIG_UART_TRANS | ++ |
SIG_USART0_DATA | +USART(0) Data Register Empty Interrupt | +
SIG_USART0_RECV | +USART(0) Receive Complete Interrupt | +
SIG_USART0_TRANS | +USART(0) Transmit Complete Interrupt | +
SIG_USART1_DATA | +USART(1) Data Register Empty Interrupt | +
SIG_USART1_RECV | +USART(1) Receive Complete Interrupt | +
SIG_USART1_TRANS | +USART(1) Transmit Complete Interrupt | +
SIG_USB_HW | ++ |