From 9c41cff9b3424ebe3b2185af782c45042fa8ab50 Mon Sep 17 00:00:00 2001 From: FredCooke Date: Thu, 1 Jan 2009 14:15:45 +0000 Subject: [PATCH] Tidied up various things and changed the way these and some other core global headers interract. --- src/doxy/changeLogs.h | 18 +++++++++++++++++- src/globalConstants.c | 23 +++++++++++++++-------- src/inc/freeEMS.h | 2 +- src/inc/globalConstants.h | 23 +++++++++++++++-------- src/inc/globalDefines.h | 13 ++++++++++--- src/inc/pagedLocationBuffers.h | 2 +- 6 files changed, 59 insertions(+), 22 deletions(-) diff --git a/src/doxy/changeLogs.h b/src/doxy/changeLogs.h index 221599f..9b2132c 100644 --- a/src/doxy/changeLogs.h +++ b/src/doxy/changeLogs.h @@ -30,7 +30,23 @@ * - Updated some TODOs entries etc in preparation for the weekends work * - Fred 31/12/08 09:45 GMT: * - Doxygenated the source code - * - more even more lots more etc + * - Modularised the initial contents of the tunable config structs for reuse + * - Separated the content from the two copies of the tunable config structs in a shared header + * - Added extra header checks for EXTERN pre definition + * - Moved zassembly to assembly + * - Removed the silly z prefix from the build dir names in the Makefiles + * - Added .gitignore for generated .s, .o, .pp.c and output files and doxygen output files + * - Moved this change logs to this doxygen html format for easier releases + * - Added coding style document + * - Added doc page for files not parsed by doxy + * - Fred 1/1/09 00:36 GMT: + * - Named the next release :-) + * - Started converting TODOs into doxy format + * - Added mainPage doxy page for an intro page when entering the doxy docs + * - Fred 1/1/09 13:24 GMT: + * - Rearranged headers and comments for FixedConfigs.h and TunableConfigs.h + * - Fixed up random comments in various headers + * - Changed the way the headers are used for core global stuff * * @anchor oldChangeLogs * @b Old @b Changes: diff --git a/src/globalConstants.c b/src/globalConstants.c index 18c927f..766449b 100644 --- a/src/globalConstants.c +++ b/src/globalConstants.c @@ -1,7 +1,9 @@ -/* globalConstants.c +/** @file globalConstants.c Copyright 2008 Fred Cooke + All global constants values are and should be defined here. + This file is part of the FreeEMS project. FreeEMS software is free software: you can redistribute it and/or modify @@ -23,8 +25,10 @@ #define NO_CONST_ARRAYS +#define GLOBAL_CONSTANTS_C #include "inc/freeEMS.h" + /* Types summary * * BEWARE : Be explicit!! @@ -38,6 +42,7 @@ * double 64 bit IEEE floating point numbers (inefficient, avoid these, used fixed point math) */ + const unsigned short memdumplength = 0x100; const unsigned short maxBasicDatalogLength = sizeof(CoreVar) + sizeof(DerivedVar) + sizeof(ADCArray); @@ -46,15 +51,17 @@ const unsigned short maxBasicDatalogLength = sizeof(CoreVar) + sizeof(DerivedVar /* &&&&&&&&&& WARNING &&&&&&&&&& These need to be changed if the timer period is changed at all!! &&&&&&&&&& WARNING &&&&&&&&&& */ /* TODO It may be better to make these actual times and calculate the number of timer units such that a change in time base of the timer doesn't affect the code. */ -/* Serial interface unique identifier */ +/** Serial interface unique identifier + * This should only change when the serial interface changes (even a little) + * This field consists of 3 chars for a 3 part version number and a free form string. For any unique string the version + * number is also unique. In this way tools can easily support a range of versions for a specific unique string ID + */ const unsigned char interfaceVersionAndType[20] = {0,0,2,'I','F','r','e','e','E','M','S',' ','V','a','n','i','l','l','a',0}; -/* This should only change when the serial interface changes (even a little) */ -/* This field consists of 3 chars for a 3 part version number and a free form string. For any unique string the version - * number is also unique. In this way tools can easily support a range of versions for a specific unique string ID */ -/* Displayable firmware version identifier */ +/** Displayable firmware version identifier + * This should change everytime the code is changed at all (even a little) before each release. + */ const unsigned char firmwareVersion[47] = {"FreeEMS Vanilla 0.0.18 JackTheRipper pre-alpha"}; -/* This should change everytime the code is changed at all (even a little) before each release. */ /* divisors and untunable physical constants combined into a single master fuel constant * @@ -75,7 +82,7 @@ const unsigned char firmwareVersion[47] = {"FreeEMS Vanilla 0.0.18 JackTheRipper * http://www.google.com/search?hl=en&safe=off&q=((1250+*+2897+*+4096+*+1024+*+1024000)+%2F+(34056+*++100+*+32768)&btnG=Search */ const unsigned long masterFuelConstant = 139371764; /* ((1250 * 2897 * 4096 * 1024 * 1024000) / (34056 * 100 * 32768) */ -/* Yet to be determined */ +/* MAF const : Yet to be determined TODO */ const unsigned long MAFFuelConstant = 0; /* Injection limits */ diff --git a/src/inc/freeEMS.h b/src/inc/freeEMS.h index e0ce72e..1adfe11 100644 --- a/src/inc/freeEMS.h +++ b/src/inc/freeEMS.h @@ -37,7 +37,7 @@ #include "memory.h" #include "9S12XDP512.h" #include "flashGlobals.h" /// @todo TODO For Sean to integrate back in -///#include "registerMasks.h @todo TODO we should define the register masks that we use in one place, but probably not in the main device header. +///include "registerMasks.h @todo TODO we should define the register masks that we use in one place, but probably not in the main device header. /* Include define files at the top here as other includes use them */ #include "errorDefines.h" diff --git a/src/inc/globalConstants.h b/src/inc/globalConstants.h index 3e16b34..5f72dd9 100644 --- a/src/inc/globalConstants.h +++ b/src/inc/globalConstants.h @@ -1,4 +1,4 @@ -/* globalConstants.h +/** @file globalConstants.h Copyright 2008 Fred Cooke @@ -21,12 +21,26 @@ Thank you for choosing FreeEMS to run your engine! */ + /* Header file multiple inclusion protection courtesy eclipse Header Template */ /* and http://gcc.gnu.org/onlinedocs/gcc-3.1.1/cpp/ C pre processor manual */ #ifndef FILE_GLOBAL_CONSTANTS_H_SEEN #define FILE_GLOBAL_CONSTANTS_H_SEEN +#ifdef EXTERN +#warning "EXTERN already defined by another header, please sort it out!" +#undef EXTERN /* If fail on warning is off, remove the definition such that we can redefine correctly. */ +#endif + + +#ifdef GLOBAL_CONSTANTS_C +#define EXTERN +#else +#define EXTERN extern +#endif + + /* Types summary * * BEWARE : Be explicit!! @@ -41,13 +55,6 @@ */ -#ifdef MAIN_OR_GLOBALS -#define EXTERN -#else -#define EXTERN extern -#endif - - /*&&&&&&&&&&&&&&&&&&&&&&&&&&&&& Arrays here &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/ #ifndef NO_CONST_ARRAYS diff --git a/src/inc/globalDefines.h b/src/inc/globalDefines.h index e0c5242..4b8eee2 100644 --- a/src/inc/globalDefines.h +++ b/src/inc/globalDefines.h @@ -178,19 +178,26 @@ #define AFR1020LambdaMax 49152 /* Lambda read at highest ADC reading */ #define AFR1020LambdaRange 32768 /* Lambda difference between lowest and highest ADC reading */ + /* MAP Sensor Data Explanation * - * Motorola/Freescale pressure sensor data obtained from the + * Motorola/Freescale pressure sensor data obtained from the * data sheets by extrapolation of the "typical" line to the - * borders of the transfer function chart. + * borders of the transfer function chart. This gives us the + * correct values in the middle despite not being able to + * reach the ends of the scale. * * By min and max I mean the OV and 5V pressures that aren't * attainable, but that give the correct function in between. */ + + +/* www.freescale.com/files/sensors/doc/data_sheet/MPX4100A.pdf */ #define MPX4100AMin 1400 /* Pressure read at lowest ADC reading */ #define MPX4100AMax 10750 /* Pressure read at highest ADC reading */ #define MPX4100ARange 9350 /* Pressure difference between lowest and highest ADC readings */ +/* www.freescale.com/files/sensors/doc/data_sheet/MPX4250A.pdf */ #define MPX4250AMin 800 /* Pressure read at lowest ADC reading */ #define MPX4250AMax 26000 /* Pressure read at highest ADC reading */ #define MPX4250ARange 25200 /* Pressure difference between lowest and highest ADC readings */ @@ -226,7 +233,7 @@ #define userTextFieldArrayLength1 966 /* Arbitrary field length to avoid wasting excess space on flash */ #define userTextFieldArrayLength2 1004 /* Arbitrary field length to avoid wasting excess space on flash */ -#define baudDivisor115p2 22 /* (40MHz / (16*115.2kHz)) = 21.7013889 */ +#define divisorFor115200bps 22 /* (40MHz / (16*115.2kHz)) = 21.7013889 */ /* http://www.google.com/search?hl=en&safe=off&q=22%2F%28%2840000000%2F16%29%2F115200%29&btnG=Search 1.376% error in speed */ /* http://www.google.com/search?hl=en&safe=off&q=40MHz%2F%2816*22%29&btnG=Search 113.636 kHz */ diff --git a/src/inc/pagedLocationBuffers.h b/src/inc/pagedLocationBuffers.h index 9504dc9..ff5cd98 100644 --- a/src/inc/pagedLocationBuffers.h +++ b/src/inc/pagedLocationBuffers.h @@ -27,7 +27,7 @@ #ifndef FILE_PAGED_LOCATION_BUFFERS_H_SEEN #define FILE_PAGED_LOCATION_BUFFERS_H_SEEN -#ifdef MAIN_OR_GLOBALS +#ifdef BLOCK_DETAILS_LOOKUP_C #define EXTERN #else #define EXTERN extern -- 2.11.4.GIT