00001 /* globalConstants.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_GLOBAL_CONSTANTS_H_SEEN 00027 #define FILE_GLOBAL_CONSTANTS_H_SEEN 00028 00029 00030 /* Types summary 00031 * 00032 * BEWARE : Be explicit!! 00033 * 00034 * char 8 bit (defaults to unsigned, but always specify signed/unsigned anyway) 00035 * short 16 bit (defaults to signed, but always specify signed/unsigned anyway) 00036 * 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) 00037 * long 32 bit (defaults to signed, but always specify signed/unsigned anyway) 00038 * long long 64 bit (inefficient, avoid these, if using : defaults to signed, but always specify signed/unsigned anyway) 00039 * float 32 bit IEEE floating point numbers (inefficient, avoid these, used fixed point math) 00040 * double 64 bit IEEE floating point numbers (inefficient, avoid these, used fixed point math) 00041 */ 00042 00043 00044 /*&&&&&&&&&&&&&&&&&&&&&&&&&&&&& Arrays here &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/ 00045 00046 #ifndef NO_CONST_ARRAYS 00047 00048 /* Thermistor ADC to temperature transfer tables as generated by FreeTherm */ 00049 EXTERN const volatile unsigned short IATTransferTable[1024]; 00050 EXTERN const volatile unsigned short CHTTransferTable[1024]; 00051 EXTERN const volatile unsigned short MAFTransferTable[1024]; 00052 00053 /* Interface version field 8 bit number, 8 bit number, 8 bit number, string of arbitrary length */ 00054 EXTERN const unsigned char interfaceVersionAndType[20]; /* Should be unique for serial comms */ 00055 00056 /* Firmware version string of arbitrary length for display and human ID purposes */ 00057 EXTERN const unsigned char firmwareVersion[34]; /* Should change with even the slightest code change */ 00058 00059 EXTERN const unsigned short dwellStartMasks[IGNITION_CHANNELS]; 00060 EXTERN const unsigned short ignitionMasks[IGNITION_CHANNELS]; 00061 00062 EXTERN const unsigned char injectorMainOnMasks[INJECTION_CHANNELS]; 00063 EXTERN const unsigned char injectorMainOffMasks[INJECTION_CHANNELS]; 00064 EXTERN const unsigned char injectorMainEnableMasks[INJECTION_CHANNELS]; 00065 EXTERN const unsigned char injectorMainDisableMasks[INJECTION_CHANNELS]; 00066 EXTERN const unsigned char injectorMainGoHighMasks[INJECTION_CHANNELS]; 00067 EXTERN const unsigned char injectorMainGoLowMasks[INJECTION_CHANNELS]; 00068 00069 00070 #endif 00071 00072 00073 /*&&&&&&&&&&&&&&&&&&&&&&&&&&& NON Arrays here &&&&&&&&&&&&&&&&&&&&&&&&&&&&*/ 00074 00075 /* Main lookup tables */ // TODO volatile here or not? 00076 EXTERN const volatile mainTable VETableMainFlash; 00077 EXTERN const volatile mainTable VETableSecondaryFlash; 00078 EXTERN const volatile mainTable VETableTertiaryFlash; 00079 EXTERN const volatile mainTable LambdaTableFlash; 00080 00081 EXTERN const volatile mainTable IgnitionAdvanceTableMainFlash; 00082 EXTERN const volatile mainTable IgnitionAdvanceTableSecondaryFlash; 00083 EXTERN const volatile mainTable InjectionAdvanceTableMainFlash; 00084 EXTERN const volatile mainTable InjectionAdvanceTableSecondaryFlash; 00085 00086 EXTERN const volatile mainTable VETableMainFlash2; 00087 EXTERN const volatile mainTable VETableSecondaryFlash2; 00088 EXTERN const volatile mainTable VETableTertiaryFlash2; 00089 EXTERN const volatile mainTable LambdaTableFlash2; 00090 00091 EXTERN const volatile mainTable IgnitionAdvanceTableMainFlash2; 00092 EXTERN const volatile mainTable IgnitionAdvanceTableSecondaryFlash2; 00093 EXTERN const volatile mainTable InjectionAdvanceTableMainFlash2; 00094 EXTERN const volatile mainTable InjectionAdvanceTableSecondaryFlash2; 00095 00096 EXTERN const volatile SmallTables1 SmallTablesAFlash; 00097 EXTERN const volatile SmallTables2 SmallTablesBFlash; 00098 EXTERN const volatile SmallTables3 SmallTablesCFlash; 00099 EXTERN const volatile SmallTables4 SmallTablesDFlash; 00100 00101 EXTERN const volatile SmallTables1 SmallTablesAFlash2; 00102 EXTERN const volatile SmallTables2 SmallTablesBFlash2; 00103 EXTERN const volatile SmallTables3 SmallTablesCFlash2; 00104 EXTERN const volatile SmallTables4 SmallTablesDFlash2; 00105 00106 EXTERN const volatile fixedConfig fixedConfigs; 00107 EXTERN const volatile fixedConfig fixedConfigs2; 00108 00109 //EXTERN const twoDTableUS ; // ? 00110 00111 /* Fuel correction tables */ 00112 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 00113 EXTERN const volatile twoDTableUS injectorDeadTimeTableFlash; // display as ms, units in native 0.8us ticks 00114 EXTERN const volatile twoDTableUS postStartEnrichmentTableFlash; // ? 00115 EXTERN const volatile twoDTableUS engineTempEnrichmentTableFixedFlash; // ? 00116 EXTERN const volatile twoDTableUS engineTempEnrichmentTablePercentFlash; // ? 00117 00118 00119 /* Ignition correction tables */ 00120 EXTERN const volatile twoDTableUS dwellDesiredVersusVoltageTableFlash; // desired dwell vs voltage 00121 EXTERN const volatile twoDTableUS dwellMaxVersusRPMTableFlash; // maximum dwell vs rpm 00122 00123 00124 /* Fueling constants */ 00125 EXTERN const unsigned long masterFuelConstant; 00126 EXTERN const unsigned long MAFFuelConstant; 00127 EXTERN const unsigned short FlashSectorSize; 00128 00129 /* These need to be changed if the timer period is changed at all */ 00130 /* The number of timer units it takes for the switch on scheduling code to run */ 00131 EXTERN const unsigned short injectorSwitchOnCodeTime; 00132 /* The number of timer units it takes for the switch off scheduling code to run */ 00133 EXTERN const unsigned short injectorSwitchOffCodeTime; 00134 /* The maximum a requested pulsewidth can be before it is truncated to this amount */ 00135 EXTERN const unsigned short injectorMaximumPulseWidth; 00136 /* The minimum a requested pulsewidth can be before it is not switched on at all */ 00137 EXTERN const unsigned short injectorMinimumPulseWidth; 00138 00139 00140 /* Ignition limits */ 00141 /* Ignition maximum dwell in timer units */ 00142 EXTERN const unsigned short ignitionMaximumDwell; 00143 00144 /* Ignition minimum dwell in timer units */ 00145 EXTERN const unsigned short ignitionMinimumDwell; 00146 00147 /* Ignition maximum delay post schedule tooth in timer units */ 00148 EXTERN const unsigned short ignitionMaximumDelayToDwellStartAfterTooth; 00149 00150 00151 /* Time in ticks taken to run */ 00152 EXTERN const unsigned short leadingEdgePrimaryRPMInputCodeTime; 00153 EXTERN const unsigned short trailingEdgePrimaryRPMInputCodeTime; 00154 EXTERN const unsigned short leadingEdgeSecondaryRPMInputCodeTime; 00155 EXTERN const unsigned short trailingEdgeSecondaryRPMInputCodeTime; 00156 00157 #else 00158 /* let us know if we are being untidy with headers */ 00159 #warning "Header file GLOBAL_CONSTANTS_H seen before, sort it out!" 00160 /* end of the wrapper ifdef from the very top */ 00161 #endif