3 Copyright 2008 Fred Cooke
5 This file is part of the FreeEMS project.
7 FreeEMS software is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 FreeEMS software is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with any FreeEMS software. If not, see <http://www.gnu.org/licenses/>.
20 We ask that if you make any changes to this file you send them upstream to us at admin@diyefi.org
22 Thank you for choosing FreeEMS to run your engine! */
24 /* Header file multiple inclusion protection courtesy eclipse Header Template */
25 /* and http://gcc.gnu.org/onlinedocs/gcc-3.1.1/cpp/ C pre processor manual */
26 #ifndef FILE_INTERRUPTS_H_SEEN
27 #define FILE_INTERRUPTS_H_SEEN
30 /* http://www.gnu.org/software/m68hc11/m68hc11_gcc.html Section 1.4.1 */
31 /* http://gcc.gnu.org/onlinedocs/gcc-4.0.0/gcc/Function-Attributes.html */
32 /* http://gcc.gnu.org/onlinedocs/gcc-4.0.0/gcc/Variable-Attributes.html */
34 /* Interrupt attribute shortcut */
35 #define INT __attribute__((interrupt))
37 /* Start and stop atomic operations (Things that we don't want interrupted half way through) */
38 /* For certain operations we will need to prevent the process from being interrupted, operations such as */
39 /* writing all vars to a block ready for reading and logging etc. The link below is for avrs, but goes */
40 /* into some detail about clearing and setting interrupts during important operations. */
41 /* http://hubbard.engr.scu.edu/embedded/avr/doc/avr-libc/avr-libc-user-manual/group__avr__interrupts.html */
42 #define ATOMIC_START() __asm__ __volatile__ ("sei") /* set global interrupt mask */
43 #define ATOMIC_END() __asm__ __volatile__ ("cli") /* clear global interrupt mask */
45 /* Interrupt vector memory management */
46 #define VECTORS __attribute__ ((section (".vectors")))
47 extern void _start(void);
49 /* Interrupt sub-routine prototypes - assigned to text1 region in linear space */
50 void UISR(void) INT TEXT1
; /* Unimplemented Interrupt Sub Routine */
52 void Injector1ISR(void) INT TEXT1
; /* OC timer for injector channel 1 */
53 void Injector2ISR(void) INT TEXT1
; /* OC timer for injector channel 2 */
54 void Injector3ISR(void) INT TEXT1
; /* OC timer for injector channel 3 */
55 void Injector4ISR(void) INT TEXT1
; /* OC timer for injector channel 4 */
56 void Injector5ISR(void) INT TEXT1
; /* OC timer for injector channel 5 */
57 void Injector6ISR(void) INT TEXT1
; /* OC timer for injector channel 6 */
59 void PrimaryRPMISR(void) INT TEXT1
; /* IC timer for primary engine position and RPM */
60 void SecondaryRPMISR(void) INT TEXT1
; /* IC timer for secondary engine position and RPM */
62 void TimerOverflow(void) INT TEXT1
; /* IC/OC timer overflow handling */
63 void ModDownCtrISR(void) INT TEXT1
; /* Modulus Down Counter */
65 void IgnitionDwellISR(void) INT TEXT1
; /* PIT timer 0 for dwell start */
66 void IgnitionFireISR(void) INT TEXT1
; /* PIT timer 1 for coil firing */
67 void StagedOnISR(void) INT TEXT1
; /* PIT timer 2 for switching staged injectors on */
68 void StagedOffISR(void) INT TEXT1
; /* PIT timer 3 for switching staged injectors off */
70 void PortPISR(void) INT TEXT1
; /* Port P interrupt service routine */
71 void PortHISR(void) INT TEXT1
; /* Port P interrupt service routine */
72 void PortJISR(void) INT TEXT1
; /* Port P interrupt service routine */
74 void IRQISR(void) INT TEXT1
; /* IRQ/PE1 interrupt service routine */
75 void XIRQISR(void) INT TEXT1
; /* XIRQ/PE0 interrupt service routine */
77 void RTIISR(void) INT TEXT1
; /* Real Time interrupt service routine */
79 void SCI0ISR(void) INT TEXT1
; /* Serial 0 interrupt service routine */
81 void LowVoltageISR(void) INT TEXT1
; /* Low voltage counter ISR */
82 void VRegAPIISR(void) INT TEXT1
; /* VReg periodic interrupt ISR */
84 typedef void (* interruptTable
)(void);
87 /* let us know if we are being untidy with headers */
88 #warning "Header file INTERRUPTS_H seen before, sort it out!"
89 /* end of the wrapper ifdef from the very top */