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