FreeEMS  0.2.0-SNAPSHOT-285-g028e24c
tableTypes.h
Go to the documentation of this file.
1 /* FreeEMS - the open source engine management system
2  *
3  * Copyright 2008-2012 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  * @ingroup dataStructures
32  *
33  * @brief Table struct typedefs
34  *
35  * This file contains all of the tabular struct typedefs.
36  */
37 
38 
39 /* Header file multiple inclusion protection courtesy eclipse Header Template */
40 /* and http://gcc.gnu.org/onlinedocs/gcc-3.1.1/cpp/ C pre processor manual */
41 #ifndef FILE_TABLE_TYPES_H_SEEN
42 #define FILE_TABLE_TYPES_H_SEEN
43 
44 
45 #define TWODTABLEUS_LENGTH 16
46 /// This block used for various curves
47 typedef struct {
48  unsigned short Axis[TWODTABLEUS_LENGTH];
49  unsigned short Values[TWODTABLEUS_LENGTH];
50 } twoDTableUS;
51 
52 
53 #define MAINTABLE_RPM_LENGTH 24 ///< How many cells on the X axis
54 #define MAINTABLE_LOAD_LENGTH 19 ///< How many cells on the Y axis
55 #define MAINTABLE_MAX_RPM_LENGTH 27 ///< Max number of cells on the X axis
56 #define MAINTABLE_MAX_LOAD_LENGTH 21 ///< Max number of cells on the Y axis
57 #define MAINTABLE_MAX_MAIN_LENGTH 462 ///< 924B 462 shorts maximum main table length
58 
59 
60 /** Main Table Structure definition
61  *
62  * Use this table descriptor to manage the
63  * - main VE table
64  * - Lambda table
65  * - Timing tables
66  *
67  * Tables can be made any size from 1x1 to 27x17 or 22x21 provided that the multiple of
68  * the two doesn't exceed the max main length and neither axis exceeds it's
69  * specified maximum.
70  *
71  * For a more detailed discussion of how this structure is actually used...
72  *
73  * @see lookupPagedMainTableCellValue
74  */
75 typedef struct {
76  unsigned short RPMLength; ///< The length of the RPM axis array
77  unsigned short LoadLength; ///< The length of the Load axis array
78  unsigned short RPM[MAINTABLE_MAX_RPM_LENGTH]; ///< The array of RPM (X) axis values
79  unsigned short Load[MAINTABLE_MAX_LOAD_LENGTH]; ///< The array of Load (Y) axis values
80  unsigned short Table[MAINTABLE_MAX_MAIN_LENGTH]; ///< The table as an array of values
81 } mainTable;
82 
83 
84 #else
85  /* let us know if we are being untidy with headers */
86  #warning "Header file TABLE_TYPES_H seen before, sort it out!"
87 /* end of the wrapper ifdef from the very top */
88 #endif