00001 /* FreeEMS - the open source engine management system 00002 * 00003 * Copyright 2008, 2009, 2010 Fred Cooke, Jared Harvey 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 email them upstream to 00021 * us at admin(at)diyefi(dot)org or, even better, fork the code on github.com! 00022 * 00023 * Thank you for choosing FreeEMS to run your engine! 00024 */ 00025 00026 00042 /* Header file multiple inclusion protection courtesy eclipse Header Template */ 00043 /* and http://gcc.gnu.org/onlinedocs/gcc-3.1.1/cpp/ C pre processor manual */ 00044 #ifndef FILE_INTERRUPTS_H_SEEN 00045 #define FILE_INTERRUPTS_H_SEEN 00046 00047 00048 /* http://www.gnu.org/software/m68hc11/m68hc11_gcc.html Section 1.4.1 */ 00049 /* http://gcc.gnu.org/onlinedocs/gcc-4.0.0/gcc/Function-Attributes.html */ 00050 /* http://gcc.gnu.org/onlinedocs/gcc-4.0.0/gcc/Variable-Attributes.html */ 00051 00052 /* Interrupt attribute shortcut */ 00053 #define INT __attribute__((interrupt)) 00054 00055 /* Start and stop atomic operations (Things that we don't want interrupted half way through) */ 00056 /* For certain operations we will need to prevent the process from being interrupted, operations such as */ 00057 /* writing all vars to a block ready for reading and logging etc. The link below is for avrs, but goes */ 00058 /* into some detail about clearing and setting interrupts during important operations. */ 00059 /* http://hubbard.engr.scu.edu/embedded/avr/doc/avr-libc/avr-libc-user-manual/group__avr__interrupts.html */ 00060 #define ATOMIC_START() __asm__ __volatile__ ("sei") /* set global interrupt mask */ 00061 #define ATOMIC_END() __asm__ __volatile__ ("cli") /* clear global interrupt mask */ 00062 00063 /* Interrupt vector memory management */ 00064 #define VECTORS __attribute__ ((section (".vectors"))) 00065 extern void _start(void); 00066 00067 /* Interrupt sub-routine prototypes - assigned to text1 region in linear space */ 00068 void UISR(void) INT TEXT1; /* Unimplemented Interrupt Sub Routine */ 00070 void Injector1ISR(void) INT TEXT1; /* OC timer for injector channel 1 */ 00072 void Injector2ISR(void) INT TEXT1; /* OC timer for injector channel 2 */ 00074 void Injector3ISR(void) INT TEXT1; /* OC timer for injector channel 3 */ 00076 void Injector4ISR(void) INT TEXT1; /* OC timer for injector channel 4 */ 00078 void Injector5ISR(void) INT TEXT1; /* OC timer for injector channel 5 */ 00080 void Injector6ISR(void) INT TEXT1; /* OC timer for injector channel 6 */ 00081 00082 void PrimaryRPMISR(void) INT TEXT1; /* IC timer for primary engine position and RPM */ 00083 void SecondaryRPMISR(void) INT TEXT1; /* IC timer for secondary engine position and RPM */ 00084 00085 void TimerOverflow(void) INT TEXT1; /* IC/OC timer overflow handling */ 00086 void ModDownCtrISR(void) INT TEXT1; /* Modulus Down Counter */ 00087 00088 void IgnitionDwellISR(void) INT TEXT1; /* PIT timer 0 for dwell start */ 00089 void IgnitionFireISR(void) INT TEXT1; /* PIT timer 1 for coil firing */ 00090 void StagedOnISR(void) INT TEXT1; /* PIT timer 2 for switching staged injectors on */ 00091 void StagedOffISR(void) INT TEXT1; /* PIT timer 3 for switching staged injectors off */ 00092 00093 void PortPISR(void) INT TEXT1; /* Port P interrupt service routine */ 00094 void PortHISR(void) INT TEXT1; /* Port P interrupt service routine */ 00095 void PortJISR(void) INT TEXT1; /* Port P interrupt service routine */ 00096 00097 void IRQISR(void) INT TEXT1; /* IRQ/PE1 interrupt service routine */ 00098 void XIRQISR(void) INT TEXT1; /* XIRQ/PE0 interrupt service routine */ 00099 00100 void RTIISR(void) INT TEXT1; /* Real Time interrupt service routine */ 00101 00102 void SCI0ISR(void) INT TEXT1; /* Serial 0 interrupt service routine */ 00103 00104 void LowVoltageISR(void) INT TEXT1; /* Low voltage counter ISR */ 00105 void VRegAPIISR(void) INT TEXT1; /* VReg periodic interrupt ISR */ 00106 00107 typedef void (* interruptTable)(void); 00108 00109 00110 #else 00111 /* let us know if we are being untidy with headers */ 00112 #warning "Header file INTERRUPTS_H seen before, sort it out!" 00113 /* end of the wrapper ifdef from the very top */ 00114 #endif