FreeEMS  0.2.0-SNAPSHOT-282-g9efc524
globalConstants.h
Go to the documentation of this file.
1 /* FreeEMS - the open source engine management system
2  *
3  * Copyright 2008-2014 Fred Cooke
4  *
5  * This file is part of the FreeEMS project.
6  *
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.
11  *
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.
16  *
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/
19  *
20  * We ask that if you make any changes to this file you email them upstream to
21  * us at admin(at)diyefi(dot)org or, even better, fork the code on github.com!
22  *
23  * Thank you for choosing FreeEMS to run your engine!
24  */
25 
26 
27 /** @file
28  *
29  * @ingroup allHeaders
30  * @ingroup globalHeaders
31  *
32  * @brief Global constant declarations
33  *
34  * All global constants are declared in this file for use throughout the program.
35  */
36 
37 
38 /* Header file multiple inclusion protection courtesy eclipse Header Template */
39 /* and http://gcc.gnu.org/onlinedocs/gcc-3.1.1/cpp/ C pre processor manual */
40 #ifndef FILE_GLOBAL_CONSTANTS_H_SEEN
41 #define FILE_GLOBAL_CONSTANTS_H_SEEN
42 
43 
44 #ifdef EXTERN
45 #warning "EXTERN already defined by another header, please sort it out!"
46 #undef EXTERN /* If fail on warning is off, remove the definition such that we can redefine correctly. */
47 #endif
48 
49 
50 #ifdef GLOBAL_CONSTANTS_C
51 #define EXTERN
52 #else
53 #define EXTERN extern
54 #endif
55 
56 
57 #define INTERFACE_VERSION "IFreeEMS Vanilla 0.0.0" // Migrate to come from the makefile where it can be extracted from any file with any tool.
58 
59 // Sizes for array must be outside ifndef block
60 #define INTERFACE_VERSION_LENGTH sizeof(INTERFACE_VERSION)
61 #define FIRMWARE_VERSION_LENGTH sizeof(FIRMWARE_VERSION) + sizeof(BUILD_CONFIG) + 1
62 #define FIRMWARE_BUILD_DATE_LENGTH sizeof(FIRMWARE_BUILD_DATE)
63 #define COMPILER_VERSION_LENGTH sizeof(__VERSION__)
64 #define OPERATING_SYSTEM_LENGTH sizeof(OPERATING_SYSTEM)
65 #define BUILT_BY_NAME_LENGTH sizeof(BUILT_BY_NAME)
66 #define SUPPORT_EMAIL_LENGTH sizeof(SUPPORT_EMAIL)
67 
68 
69 /*&&&&&&&&&&&&&&&&&&&&&&&&&&&&& Arrays here &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
70 
71 #ifndef NO_CONST_ARRAYS
72 
73 /* Thermistor ADC to temperature transfer tables as generated by FreeTherm */
74 EXTERN const volatile unsigned short IATTransferTable[1024]; /* 2k */
75 EXTERN const volatile unsigned short CHTTransferTable[1024]; /* 2k */
76 EXTERN const volatile unsigned short MAFTransferTable[1024]; /* 2k */
77 EXTERN const volatile unsigned char TestTransferTable[2048]; /* 2k */
78 
79 
80 /** Serial interface unique identifier
81  *
82  * This should only change when the serial interface changes (even a little)
83  *
84  * This field consists of 3 chars for a 3 part version number and a free form string. For any unique string the version
85  * number is also unique. In this way tools can easily support a range of versions for a specific unique string ID
86  */
88 
89 /** Displayable firmware version identifier
90  *
91  * This changes automatically every time the code is changed at all (even a little) thanks to Git.
92  */
94 
95 EXTERN const unsigned char buildTimeAndDate[FIRMWARE_BUILD_DATE_LENGTH]; ///< When and roughly where it was built
96 EXTERN const unsigned char compilerVersion[COMPILER_VERSION_LENGTH]; ///< GCC supplied compiler version used to build it
97 EXTERN const unsigned char operatingSystem[OPERATING_SYSTEM_LENGTH]; ///< Which OS was it built on
98 EXTERN const unsigned char builtByName[BUILT_BY_NAME_LENGTH]; ///< Name of the person who built it
99 EXTERN const unsigned char supportEmail[SUPPORT_EMAIL_LENGTH]; ///< Support email for this build
100 
101 
102 /* ECT output register masks */
103 EXTERN const unsigned char ectMainOnMasks[ECT_CHANNELS];
104 EXTERN const unsigned char ectMainOffMasks[ECT_CHANNELS];
109 EXTERN const unsigned char ectMainGoLowMasks[ECT_CHANNELS];
110 
111 #endif
112 
113 
114 /*&&&&&&&&&&&&&&&&&&&&&&&&&&& NON Arrays here &&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
115 
116 /* Main lookup tables */ // TODO volatile here or not?
121 
126 
131 
136 
141 
146 
149 
150 
151 /* Fueling constants */
152 EXTERN const unsigned long masterFuelConstant;
153 EXTERN const unsigned long MAFFuelConstant;
154 
155 
156 /// @todo TODO Move these to decoder interface AND rename to be more generic/meaningful/accurate, and make set by each decoder where appropriate
157 // These need to be changed if the timer period is changed at all
158 /* The number of timer units it takes for the switch on scheduling code to run */
159 EXTERN const unsigned short ectSwitchOnCodeTime;
160 /* The number of timer units it takes for the switch off scheduling code to run */
161 EXTERN const unsigned short ectSwitchOffCodeTime;
162 
163 
164 #undef EXTERN
165 
166 
167 #else
168  /* let us know if we are being untidy with headers */
169  #warning "Header file GLOBAL_CONSTANTS_H seen before, sort it out!"
170 /* end of the wrapper ifdef from the very top */
171 #endif