00001 /* interrupts.h 00002 00003 Copyright 2008 Fred Cooke 00004 00005 This file is part of the FreeEMS project. 00006 00007 FreeEMS software is free software: you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation, either version 3 of the License, or 00010 (at your option) any later version. 00011 00012 FreeEMS software is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with any FreeEMS software. If not, see <http://www.gnu.org/licenses/>. 00019 00020 We ask that if you make any changes to this file you send them upstream to us at admin@diyefi.org 00021 00022 Thank you for choosing FreeEMS to run your engine! */ 00023 00024 /* Header file multiple inclusion protection courtesy eclipse Header Template */ 00025 /* and http://gcc.gnu.org/onlinedocs/gcc-3.1.1/cpp/ C pre processor manual */ 00026 #ifndef FILE_INTERRUPTS_H_SEEN 00027 #define FILE_INTERRUPTS_H_SEEN 00028 00029 00030 /* http://www.gnu.org/software/m68hc11/m68hc11_gcc.html Section 1.4.1 */ 00031 /* http://gcc.gnu.org/onlinedocs/gcc-4.0.0/gcc/Function-Attributes.html */ 00032 /* http://gcc.gnu.org/onlinedocs/gcc-4.0.0/gcc/Variable-Attributes.html */ 00033 00034 /* Interrupt attribute shortcut */ 00035 #define INT __attribute__((interrupt)) 00036 00037 /* Start and stop atomic operations (Things that we don't want interrupted half way through) */ 00038 /* For certain operations we will need to prevent the process from being interrupted, operations such as */ 00039 /* writing all vars to a block ready for reading and logging etc. The link below is for avrs, but goes */ 00040 /* into some detail about clearing and setting interrupts during important operations. */ 00041 /* http://hubbard.engr.scu.edu/embedded/avr/doc/avr-libc/avr-libc-user-manual/group__avr__interrupts.html */ 00042 #define ATOMIC_START() __asm__ __volatile__ ("sei") /* set global interrupt mask */ 00043 #define ATOMIC_END() __asm__ __volatile__ ("cli") /* clear global interrupt mask */ 00044 00045 /* Interrupt vector memory management */ 00046 #define VECTORS __attribute__ ((section (".vectors"))) 00047 extern void _start(void); 00048 00049 // Interrupt sub-routine prototypes 00050 void UISR(void) INT; /* Unimplemented Interrupt Sub Routine */ 00051 00052 void Injector1ISR(void) INT; /* OC timer for injector channel 1 */ 00053 void Injector2ISR(void) INT; /* OC timer for injector channel 2 */ 00054 void Injector3ISR(void) INT; /* OC timer for injector channel 3 */ 00055 void Injector4ISR(void) INT; /* OC timer for injector channel 4 */ 00056 void Injector5ISR(void) INT; /* OC timer for injector channel 5 */ 00057 void Injector6ISR(void) INT; /* OC timer for injector channel 6 */ 00058 00059 void PrimaryRPMISR(void) INT; /* IC timer for primary engine position and RPM */ 00060 void SecondaryRPMISR(void) INT; /* IC timer for secondary engine position and RPM */ 00061 00062 void TimerOverflow(void) INT; /* IC/OC timer overflow handling */ 00063 void ModDownCtrISR(void) INT; /* Modulus Down Counter */ 00064 00065 void IgnitionDwellISR(void) INT; /* PIT timer 0 for dwell start */ 00066 void IgnitionFireISR(void) INT; /* PIT timer 1 for coil firing */ 00067 void StagedOnISR(void) INT; /* PIT timer 2 for switching staged injectors on */ 00068 void StagedOffISR(void) INT; /* PIT timer 3 for switching staged injectors off */ 00069 00070 void PortPISR(void) INT; /* Port P interrupt service routine */ 00071 void PortHISR(void) INT; /* Port P interrupt service routine */ 00072 void PortJISR(void) INT; /* Port P interrupt service routine */ 00073 00074 void IRQISR(void) INT; /* IRQ/PE1 interrupt service routine */ 00075 void XIRQISR(void) INT; /* XIRQ/PE0 interrupt service routine */ 00076 00077 void RTIISR(void) INT; /* Real Time interrupt service routine */ 00078 00079 void SCI0ISR(void) INT; /* Serial 0 interrupt service routine */ 00080 00081 void LowVoltageISR(void) INT; /* Low voltage counter ISR */ 00082 void VRegAPIISR(void) INT; /* VReg periodic interrupt ISR */ 00083 00084 typedef void (* interruptTable)(void); 00085 00086 #else 00087 /* let us know if we are being untidy with headers */ 00088 #warning "Header file INTERRUPTS_H seen before, sort it out!" 00089 /* end of the wrapper ifdef from the very top */ 00090 #endif