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