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]; /* 2k */ 00050 EXTERN const volatile unsigned short CHTTransferTable[1024]; /* 2k */ 00051 EXTERN const volatile unsigned short MAFTransferTable[1024]; /* 2k */ 00052 EXTERN const volatile unsigned char TestTransferTable[2048]; /* 2k */ 00053 00054 EXTERN const unsigned short memdumplength; 00055 EXTERN const unsigned short maxBasicDatalogLength; 00056 00057 /* Interface version field 8 bit number, 8 bit number, 8 bit number, string of arbitrary length */ 00058 EXTERN const unsigned char interfaceVersionAndType[20]; /* Should be unique for serial comms */ 00059 00060 /* Firmware version string of arbitrary length for display and human ID purposes */ 00061 EXTERN const unsigned char firmwareVersion[47]; /* Should change with even the slightest code change */ 00062 00063 EXTERN const unsigned short dwellStartMasks[IGNITION_CHANNELS]; 00064 EXTERN const unsigned short ignitionMasks[IGNITION_CHANNELS]; 00065 00066 EXTERN const unsigned char injectorMainOnMasks[INJECTION_CHANNELS]; 00067 EXTERN const unsigned char injectorMainOffMasks[INJECTION_CHANNELS]; 00068 EXTERN const unsigned char injectorMainEnableMasks[INJECTION_CHANNELS]; 00069 EXTERN const unsigned char injectorMainDisableMasks[INJECTION_CHANNELS]; 00070 EXTERN const unsigned char injectorMainGoHighMasks[INJECTION_CHANNELS]; 00071 EXTERN const unsigned char injectorMainGoLowMasks[INJECTION_CHANNELS]; 00072 00073 00074 #endif 00075 00076 00077 /*&&&&&&&&&&&&&&&&&&&&&&&&&&& NON Arrays here &&&&&&&&&&&&&&&&&&&&&&&&&&&&*/ 00078 00079 /* Main lookup tables */ // TODO volatile here or not? 00080 EXTERN const volatile mainTable VETableMainFlash; 00081 EXTERN const volatile mainTable VETableSecondaryFlash; 00082 EXTERN const volatile mainTable VETableTertiaryFlash; 00083 EXTERN const volatile mainTable LambdaTableFlash; 00084 00085 EXTERN const volatile mainTable IgnitionAdvanceTableMainFlash; 00086 EXTERN const volatile mainTable IgnitionAdvanceTableSecondaryFlash; 00087 EXTERN const volatile mainTable InjectionAdvanceTableMainFlash; 00088 EXTERN const volatile mainTable InjectionAdvanceTableSecondaryFlash; 00089 00090 EXTERN const volatile mainTable VETableMainFlash2; 00091 EXTERN const volatile mainTable VETableSecondaryFlash2; 00092 EXTERN const volatile mainTable VETableTertiaryFlash2; 00093 EXTERN const volatile mainTable LambdaTableFlash2; 00094 00095 EXTERN const volatile mainTable IgnitionAdvanceTableMainFlash2; 00096 EXTERN const volatile mainTable IgnitionAdvanceTableSecondaryFlash2; 00097 EXTERN const volatile mainTable InjectionAdvanceTableMainFlash2; 00098 EXTERN const volatile mainTable InjectionAdvanceTableSecondaryFlash2; 00099 00100 EXTERN const volatile SmallTables1 SmallTablesAFlash; 00101 EXTERN const volatile SmallTables2 SmallTablesBFlash; 00102 EXTERN const volatile SmallTables3 SmallTablesCFlash; 00103 EXTERN const volatile SmallTables4 SmallTablesDFlash; 00104 00105 EXTERN const volatile SmallTables1 SmallTablesAFlash2; 00106 EXTERN const volatile SmallTables2 SmallTablesBFlash2; 00107 EXTERN const volatile SmallTables3 SmallTablesCFlash2; 00108 EXTERN const volatile SmallTables4 SmallTablesDFlash2; 00109 00110 EXTERN const volatile fixedConfig1 fixedConfigs1; 00111 EXTERN const volatile fixedConfig2 fixedConfigs2; 00112 00113 //EXTERN const twoDTableUS ; // ? 00114 00115 /* Fuel correction tables */ 00116 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 00117 EXTERN const volatile twoDTableUS injectorDeadTimeTableFlash; // display as ms, units in native 0.8us ticks 00118 EXTERN const volatile twoDTableUS postStartEnrichmentTableFlash; // ? 00119 EXTERN const volatile twoDTableUS engineTempEnrichmentTableFixedFlash; // ? 00120 EXTERN const volatile twoDTableUS engineTempEnrichmentTablePercentFlash; // ? 00121 00122 00123 /* Ignition correction tables */ 00124 EXTERN const volatile twoDTableUS dwellDesiredVersusVoltageTableFlash; // desired dwell vs voltage 00125 EXTERN const volatile twoDTableUS dwellMaxVersusRPMTableFlash; // maximum dwell vs rpm 00126 00127 00128 /* Fueling constants */ 00129 EXTERN const unsigned long masterFuelConstant; 00130 EXTERN const unsigned long MAFFuelConstant; 00131 00132 00133 /* These need to be changed if the timer period is changed at all */ 00134 /* The number of timer units it takes for the switch on scheduling code to run */ 00135 EXTERN const unsigned short injectorSwitchOnCodeTime; 00136 /* The number of timer units it takes for the switch off scheduling code to run */ 00137 EXTERN const unsigned short injectorSwitchOffCodeTime; 00138 /* The maximum a requested pulsewidth can be before it is truncated to this amount */ 00139 EXTERN const unsigned short injectorMaximumPulseWidth; 00140 /* The minimum a requested pulsewidth can be before it is not switched on at all */ 00141 EXTERN const unsigned short injectorMinimumPulseWidth; 00142 00143 00144 /* Ignition limits */ 00145 /* Ignition maximum dwell in timer units */ 00146 EXTERN const unsigned short ignitionMaximumDwell; 00147 00148 /* Ignition minimum dwell in timer units */ 00149 EXTERN const unsigned short ignitionMinimumDwell; 00150 00151 /* Ignition maximum delay post schedule tooth in timer units */ 00152 EXTERN const unsigned short ignitionMaximumDelayToDwellStartAfterTooth; 00153 00154 00155 /* Time in ticks taken to run */ 00156 EXTERN const unsigned short leadingEdgePrimaryRPMInputCodeTime; 00157 EXTERN const unsigned short trailingEdgePrimaryRPMInputCodeTime; 00158 EXTERN const unsigned short leadingEdgeSecondaryRPMInputCodeTime; 00159 EXTERN const unsigned short trailingEdgeSecondaryRPMInputCodeTime; 00160 00161 #else 00162 /* let us know if we are being untidy with headers */ 00163 #warning "Header file GLOBAL_CONSTANTS_H seen before, sort it out!" 00164 /* end of the wrapper ifdef from the very top */ 00165 #endif