1 /** @file globalConstants.h
3 Copyright 2008 Fred Cooke
5 This file is part of the FreeEMS project.
7 FreeEMS software is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 FreeEMS software is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with any FreeEMS software. If not, see http://www.gnu.org/licenses/
20 We ask that if you make any changes to this file you send them upstream to us at admin@diyefi.org
22 Thank you for choosing FreeEMS to run your engine! */
25 /* Header file multiple inclusion protection courtesy eclipse Header Template */
26 /* and http://gcc.gnu.org/onlinedocs/gcc-3.1.1/cpp/ C pre processor manual */
27 #ifndef FILE_GLOBAL_CONSTANTS_H_SEEN
28 #define FILE_GLOBAL_CONSTANTS_H_SEEN
32 #warning "EXTERN already defined by another header, please sort it out!"
33 #undef EXTERN /* If fail on warning is off, remove the definition such that we can redefine correctly. */
37 #ifdef GLOBAL_CONSTANTS_C
46 * BEWARE : Be explicit!!
48 * char 8 bit (defaults to unsigned, but always specify signed/unsigned anyway)
49 * short 16 bit (defaults to signed, but always specify signed/unsigned anyway)
50 * 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)
51 * long 32 bit (defaults to signed, but always specify signed/unsigned anyway)
52 * long long 64 bit (inefficient, avoid these, if using : defaults to signed, but always specify signed/unsigned anyway)
53 * float 32 bit IEEE floating point numbers (inefficient, avoid these, used fixed point math)
54 * double 64 bit IEEE floating point numbers (inefficient, avoid these, used fixed point math)
58 /*&&&&&&&&&&&&&&&&&&&&&&&&&&&&& Arrays here &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
60 #ifndef NO_CONST_ARRAYS
62 /* Thermistor ADC to temperature transfer tables as generated by FreeTherm */
63 EXTERN
const volatile unsigned short IATTransferTable
[1024]; /* 2k */
64 EXTERN
const volatile unsigned short CHTTransferTable
[1024]; /* 2k */
65 EXTERN
const volatile unsigned short MAFTransferTable
[1024]; /* 2k */
66 EXTERN
const volatile unsigned char TestTransferTable
[2048]; /* 2k */
68 EXTERN
const unsigned short memdumplength
;
69 EXTERN
const unsigned short maxBasicDatalogLength
;
71 /* Interface version field 8 bit number, 8 bit number, 8 bit number, string of arbitrary length */
72 EXTERN
const unsigned char interfaceVersionAndType
[20]; /* Should be unique for serial comms */
74 /* Firmware version string of arbitrary length for display and human ID purposes */
75 EXTERN
const unsigned char firmwareVersion
[45]; /* Should change with even the slightest code change */
77 EXTERN
const unsigned short dwellStartMasks
[IGNITION_CHANNELS
];
78 EXTERN
const unsigned short ignitionMasks
[IGNITION_CHANNELS
];
80 EXTERN
const unsigned char injectorMainOnMasks
[INJECTION_CHANNELS
];
81 EXTERN
const unsigned char injectorMainOffMasks
[INJECTION_CHANNELS
];
82 EXTERN
const unsigned char injectorMainEnableMasks
[INJECTION_CHANNELS
];
83 EXTERN
const unsigned char injectorMainDisableMasks
[INJECTION_CHANNELS
];
84 EXTERN
const unsigned char injectorMainGoHighMasks
[INJECTION_CHANNELS
];
85 EXTERN
const unsigned char injectorMainGoLowMasks
[INJECTION_CHANNELS
];
91 /*&&&&&&&&&&&&&&&&&&&&&&&&&&& NON Arrays here &&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
93 /* Main lookup tables */ // TODO volatile here or not?
94 EXTERN
const volatile mainTable VETableMainFlash
;
95 EXTERN
const volatile mainTable VETableSecondaryFlash
;
96 EXTERN
const volatile mainTable VETableTertiaryFlash
;
97 EXTERN
const volatile mainTable LambdaTableFlash
;
99 EXTERN
const volatile mainTable IgnitionAdvanceTableMainFlash
;
100 EXTERN
const volatile mainTable IgnitionAdvanceTableSecondaryFlash
;
101 EXTERN
const volatile mainTable InjectionAdvanceTableMainFlash
;
102 EXTERN
const volatile mainTable InjectionAdvanceTableSecondaryFlash
;
104 EXTERN
const volatile mainTable VETableMainFlash2
;
105 EXTERN
const volatile mainTable VETableSecondaryFlash2
;
106 EXTERN
const volatile mainTable VETableTertiaryFlash2
;
107 EXTERN
const volatile mainTable LambdaTableFlash2
;
109 EXTERN
const volatile mainTable IgnitionAdvanceTableMainFlash2
;
110 EXTERN
const volatile mainTable IgnitionAdvanceTableSecondaryFlash2
;
111 EXTERN
const volatile mainTable InjectionAdvanceTableMainFlash2
;
112 EXTERN
const volatile mainTable InjectionAdvanceTableSecondaryFlash2
;
114 EXTERN
const volatile SmallTables1 SmallTablesAFlash
;
115 EXTERN
const volatile SmallTables2 SmallTablesBFlash
;
116 EXTERN
const volatile SmallTables3 SmallTablesCFlash
;
117 EXTERN
const volatile SmallTables4 SmallTablesDFlash
;
119 EXTERN
const volatile SmallTables1 SmallTablesAFlash2
;
120 EXTERN
const volatile SmallTables2 SmallTablesBFlash2
;
121 EXTERN
const volatile SmallTables3 SmallTablesCFlash2
;
122 EXTERN
const volatile SmallTables4 SmallTablesDFlash2
;
124 EXTERN
const volatile fixedConfig1 fixedConfigs1
;
125 EXTERN
const volatile fixedConfig2 fixedConfigs2
;
127 //EXTERN const twoDTableUS ; // ?
129 /* Fuel correction tables */
130 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
131 EXTERN
const volatile twoDTableUS injectorDeadTimeTableFlash
; // display as ms, units in native 0.8us ticks
132 EXTERN
const volatile twoDTableUS postStartEnrichmentTableFlash
; // ?
133 EXTERN
const volatile twoDTableUS engineTempEnrichmentTableFixedFlash
; // ?
134 EXTERN
const volatile twoDTableUS engineTempEnrichmentTablePercentFlash
; // ?
137 /* Ignition correction tables */
138 EXTERN
const volatile twoDTableUS dwellDesiredVersusVoltageTableFlash
; // desired dwell vs voltage
139 EXTERN
const volatile twoDTableUS dwellMaxVersusRPMTableFlash
; // maximum dwell vs rpm
142 /* Fueling constants */
143 EXTERN
const unsigned long masterFuelConstant
;
144 EXTERN
const unsigned long MAFFuelConstant
;
147 /* These need to be changed if the timer period is changed at all */
148 /* The number of timer units it takes for the switch on scheduling code to run */
149 EXTERN
const unsigned short injectorSwitchOnCodeTime
;
150 /* The number of timer units it takes for the switch off scheduling code to run */
151 EXTERN
const unsigned short injectorSwitchOffCodeTime
;
152 /* The maximum a requested pulsewidth can be before it is truncated to this amount */
153 EXTERN
const unsigned short injectorMaximumPulseWidth
;
154 /* The minimum a requested pulsewidth can be before it is not switched on at all */
155 EXTERN
const unsigned short injectorMinimumPulseWidth
;
158 /* Ignition limits */
159 /* Ignition maximum dwell in timer units */
160 EXTERN
const unsigned short ignitionMaximumDwell
;
162 /* Ignition minimum dwell in timer units */
163 EXTERN
const unsigned short ignitionMinimumDwell
;
165 /* Ignition maximum delay post schedule tooth in timer units */
166 EXTERN
const unsigned short ignitionMaximumDelayToDwellStartAfterTooth
;
169 /* Time in ticks taken to run */
170 EXTERN
const unsigned short leadingEdgePrimaryRPMInputCodeTime
;
171 EXTERN
const unsigned short trailingEdgePrimaryRPMInputCodeTime
;
172 EXTERN
const unsigned short leadingEdgeSecondaryRPMInputCodeTime
;
173 EXTERN
const unsigned short trailingEdgeSecondaryRPMInputCodeTime
;
180 /* let us know if we are being untidy with headers */
181 #warning "Header file GLOBAL_CONSTANTS_H seen before, sort it out!"
182 /* end of the wrapper ifdef from the very top */