00001 /* FreeEMS - the open source engine management system 00002 * 00003 * Copyright 2008, 2009, 2010 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 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 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_GLOBAL_CONSTANTS_H_SEEN 00042 #define FILE_GLOBAL_CONSTANTS_H_SEEN 00043 00044 00045 #ifdef EXTERN 00046 #warning "EXTERN already defined by another header, please sort it out!" 00047 #undef EXTERN /* If fail on warning is off, remove the definition such that we can redefine correctly. */ 00048 #endif 00049 00050 00051 #ifdef GLOBAL_CONSTANTS_C 00052 #define EXTERN 00053 #else 00054 #define EXTERN extern 00055 #endif 00056 00057 00058 /* Types summary 00059 * 00060 * BEWARE : Be explicit!! 00061 * 00062 * char 8 bit (defaults to unsigned, but always specify signed/unsigned anyway) 00063 * short 16 bit (defaults to signed, but always specify signed/unsigned anyway) 00064 * int 16 bit DO NOT USE! (current compile flags make this 16 bits, but a change of flags could will change your program if you use this because they will all be 32 bit all of a sudden) 00065 * long 32 bit (defaults to signed, but always specify signed/unsigned anyway) 00066 * long long 64 bit (inefficient, avoid these, if using : defaults to signed, but always specify signed/unsigned anyway) 00067 * float 32 bit IEEE floating point numbers (inefficient, avoid these, used fixed point math) 00068 * double 64 bit IEEE floating point numbers (inefficient, avoid these, used fixed point math) 00069 */ 00070 00071 00072 /*&&&&&&&&&&&&&&&&&&&&&&&&&&&&& Arrays here &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/ 00073 00074 #ifndef NO_CONST_ARRAYS 00075 00076 /* Thermistor ADC to temperature transfer tables as generated by FreeTherm */ 00077 EXTERN const volatile unsigned short IATTransferTable[1024]; /* 2k */ 00078 EXTERN const volatile unsigned short CHTTransferTable[1024]; /* 2k */ 00079 EXTERN const volatile unsigned short MAFTransferTable[1024]; /* 2k */ 00080 EXTERN const volatile unsigned char TestTransferTable[2048]; /* 2k */ 00081 00082 /* Version strings */ 00083 EXTERN const unsigned char interfaceVersionAndType[20]; 00084 EXTERN const unsigned char firmwareVersion[29]; 00085 00086 /* Ignition */ 00087 EXTERN const unsigned short dwellStartMasks[IGNITION_CHANNELS]; 00088 EXTERN const unsigned short ignitionMasks[IGNITION_CHANNELS]; 00089 00090 /* Injection */ 00091 EXTERN const unsigned char injectorMainOnMasks[INJECTION_CHANNELS]; 00092 EXTERN const unsigned char injectorMainOffMasks[INJECTION_CHANNELS]; 00093 EXTERN const unsigned char injectorMainEnableMasks[INJECTION_CHANNELS]; 00094 EXTERN const unsigned char injectorMainDisableMasks[INJECTION_CHANNELS]; 00095 EXTERN const unsigned char injectorMainGoHighMasks[INJECTION_CHANNELS]; 00096 EXTERN const unsigned char injectorMainGoLowMasks[INJECTION_CHANNELS]; 00097 00098 00099 #endif 00100 00101 00102 /*&&&&&&&&&&&&&&&&&&&&&&&&&&& NON Arrays here &&&&&&&&&&&&&&&&&&&&&&&&&&&&*/ 00103 00104 /* Main lookup tables */ // TODO volatile here or not? 00105 EXTERN const volatile mainTable VETableMainFlash; 00106 EXTERN const volatile mainTable VETableSecondaryFlash; 00107 EXTERN const volatile mainTable VETableTertiaryFlash; 00108 EXTERN const volatile mainTable LambdaTableFlash; 00109 00110 EXTERN const volatile mainTable IgnitionAdvanceTableMainFlash; 00111 EXTERN const volatile mainTable IgnitionAdvanceTableSecondaryFlash; 00112 EXTERN const volatile mainTable InjectionAdvanceTableMainFlash; 00113 EXTERN const volatile mainTable InjectionAdvanceTableSecondaryFlash; 00114 00115 EXTERN const volatile mainTable VETableMainFlash2; 00116 EXTERN const volatile mainTable VETableSecondaryFlash2; 00117 EXTERN const volatile mainTable VETableTertiaryFlash2; 00118 EXTERN const volatile mainTable LambdaTableFlash2; 00119 00120 EXTERN const volatile mainTable IgnitionAdvanceTableMainFlash2; 00121 EXTERN const volatile mainTable IgnitionAdvanceTableSecondaryFlash2; 00122 EXTERN const volatile mainTable InjectionAdvanceTableMainFlash2; 00123 EXTERN const volatile mainTable InjectionAdvanceTableSecondaryFlash2; 00124 00125 EXTERN const volatile SmallTables1 SmallTablesAFlash; 00126 EXTERN const volatile SmallTables2 SmallTablesBFlash; 00127 EXTERN const volatile SmallTables3 SmallTablesCFlash; 00128 EXTERN const volatile SmallTables4 SmallTablesDFlash; 00129 00130 EXTERN const volatile SmallTables1 SmallTablesAFlash2; 00131 EXTERN const volatile SmallTables2 SmallTablesBFlash2; 00132 EXTERN const volatile SmallTables3 SmallTablesCFlash2; 00133 EXTERN const volatile SmallTables4 SmallTablesDFlash2; 00134 00135 EXTERN const volatile fixedConfig1 fixedConfigs1; 00136 EXTERN const volatile fixedConfig2 fixedConfigs2; 00137 00138 //EXTERN const twoDTableUS ; // ? 00139 00140 /* Fuel correction tables */ 00141 EXTERN const volatile twoDTableUS primingVolumeTableFlash; // perhaps micro litres (cubic milli meters) would be good, 5 - 100 seem to be the norm 327.68 = 65535/200 00142 EXTERN const volatile twoDTableUS injectorDeadTimeTableFlash; // display as ms, units in native 0.8us ticks 00143 EXTERN const volatile twoDTableUS postStartEnrichmentTableFlash; // ? 00144 EXTERN const volatile twoDTableUS engineTempEnrichmentTableFixedFlash; // ? 00145 EXTERN const volatile twoDTableUS engineTempEnrichmentTablePercentFlash; // ? 00146 00147 00148 /* Ignition correction tables */ 00149 EXTERN const volatile twoDTableUS dwellDesiredVersusVoltageTableFlash; // desired dwell vs voltage 00150 EXTERN const volatile twoDTableUS dwellMaxVersusRPMTableFlash; // maximum dwell vs rpm 00151 00152 00153 /* Fueling constants */ 00154 EXTERN const unsigned long masterFuelConstant; 00155 EXTERN const unsigned long MAFFuelConstant; 00156 00157 00158 /* Serial data log stuff, temporary */ 00159 EXTERN const unsigned short maxBasicDatalogLength; 00160 00161 00162 00163 /* These need to be changed if the timer period is changed at all */ 00164 /* The number of timer units it takes for the switch on scheduling code to run */ 00165 EXTERN const unsigned short injectorSwitchOnCodeTime; 00166 /* The number of timer units it takes for the switch off scheduling code to run */ 00167 EXTERN const unsigned short injectorSwitchOffCodeTime; 00168 /* The maximum a requested pulsewidth can be before it is truncated to this amount */ 00169 EXTERN const unsigned short injectorMaximumPulseWidth; 00170 /* The minimum a requested pulsewidth can be before it is not switched on at all */ 00171 EXTERN const unsigned short injectorMinimumPulseWidth; 00172 00173 00174 /* Ignition limits */ 00175 /* Ignition maximum dwell in timer units */ 00176 EXTERN const unsigned short ignitionMaximumDwell; 00177 00178 /* Ignition minimum dwell in timer units */ 00179 EXTERN const unsigned short ignitionMinimumDwell; 00180 00181 /* Ignition maximum delay post schedule tooth in timer units */ 00182 EXTERN const unsigned short ignitionMaximumDelayToDwellStartAfterTooth; 00183 00184 00185 /* Time in ticks taken to run */ 00186 EXTERN const unsigned short leadingEdgePrimaryRPMInputCodeTime; 00187 EXTERN const unsigned short trailingEdgePrimaryRPMInputCodeTime; 00188 EXTERN const unsigned short leadingEdgeSecondaryRPMInputCodeTime; 00189 EXTERN const unsigned short trailingEdgeSecondaryRPMInputCodeTime; 00190 00191 00192 #undef EXTERN 00193 00194 00195 #else 00196 /* let us know if we are being untidy with headers */ 00197 #warning "Header file GLOBAL_CONSTANTS_H seen before, sort it out!" 00198 /* end of the wrapper ifdef from the very top */ 00199 #endif