freeEMS.h File Reference

The main project header file. More...

#include "memory.h"
Include dependency graph for freeEMS.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

union  Tables1
union  Tables2
union  Tables3
union  Tables4
union  LongTime

Defines

#define EXTERN   extern
 include "registerMasks.h
#define asyncDatalogOff   0x00
#define asyncDatalogBasic   0x01
#define asyncDatalogConfig   0x02
#define asyncDatalogLogic   0x03
#define asyncDatalogADC   0x04
#define asyncDatalogCircBuf   0x05
#define asyncDatalogCircCAS   0x06
#define asyncDatalogTrigger   0x07
#define COREA01   BIT1_16
#define PRIMARY_SYNC   BIT2_16
#define SECONDARY_SYNC   BIT3_16
#define ENGINE_PHASE   BIT4_16
#define FUEL_CUT   BIT5_16
#define HARD_SPARK_CUT   BIT6_16
#define SOFT_SPARK_CUT   BIT7_16
#define SPARK_RETARD   BIT8_16
#define STAGED_REQUIRED   BIT9_16
#define CALC_FUEL_IGN   BIT10_16
#define FORCE_READING   BIT11_16
#define COREA12   BIT12_16
#define COREA13   BIT13_16
#define COREA14   BIT14_16
#define COREA15   BIT15_16
#define COREA16   BIT16_16
#define CLEAR_PRIMARY_SYNC   NBIT2_16
#define STAGED_NOT_REQUIRED   NBIT9_16
#define CLEAR_CALC_FUEL_IGN   NBIT10_16
#define CLEAR_FORCE_READING   NBIT11_16

Variables

EXTERN unsigned short RPM0
EXTERN unsigned short RPM1
unsigned short tachoPeriod
EXTERN unsigned char portHDebounce
unsigned char asyncDatalogType
EXTERN unsigned short configuredBasicDatalogLength
EXTERN unsigned char ShouldSendLog
EXTERN Clock Clocks
EXTERN Counter Counters
EXTERN RuntimeVar RuntimeVars
EXTERN ISRLatencyVar ISRLatencyVars
EXTERN CoreVarCoreVars
EXTERN CoreVar CoreVars0
EXTERN DerivedVarDerivedVars
EXTERN DerivedVar DerivedVars0
EXTERN ADCArrayADCArrays
EXTERN ADCArrayADCArraysRecord
EXTERN ADCArray ADCArrays0
EXTERN ADCArray ADCArrays1
EXTERN ADCArrayasyncADCArrays
EXTERN ADCArrayasyncADCArraysRecord
EXTERN ADCArray asyncADCArrays0
EXTERN ADCArray asyncADCArrays1
EXTERN unsigned short * mathSampleTimeStamp
EXTERN unsigned short * mathSampleTimeStampRecord
EXTERN unsigned short * currentDwellMath
EXTERN unsigned short * currentDwellRealtime
EXTERN unsigned short currentDwell0
EXTERN unsigned short currentDwell1
EXTERN unsigned char TXBuffer[TX_BUFFER_SIZE] TXBUF
EXTERN unsigned char RXBuffer[RX_BUFFER_SIZE] RXBUF
EXTERN Tables1 TablesA RWINDOW
EXTERN unsigned char currentFuelRPage
EXTERN unsigned char currentTuneRPage
EXTERN unsigned char currentTimeRPage
unsigned short masterPulseWidth
 * Pointers to main tables to aid readability */
EXTERN unsigned short totalDwell
unsigned short totalAngleAfterReferenceInjection
unsigned short totalAngleAfterReferenceIgnition
EXTERN unsigned long bootFuelConst
EXTERN unsigned short TPSMAPRange
EXTERN unsigned short TPSADCRange
EXTERN unsigned short boundedTPSADC
EXTERN unsigned short bootTimeAAP
EXTERN unsigned short coreStatusA
unsigned short timerExtensionClock
EXTERN unsigned char mainOn
EXTERN unsigned short dwellOn
EXTERN unsigned char stagedOn
EXTERN unsigned char selfSetTimer
EXTERN unsigned char rescheduleFuelFlags
EXTERN unsigned short primaryPulsesPerSecondaryPulse
EXTERN unsigned long primaryLeadingEdgeTimeStamp
EXTERN unsigned long primaryTrailingEdgeTimeStamp
EXTERN unsigned long timeBetweenSuccessivePrimaryPulses
EXTERN unsigned long lastPrimaryPulseTimeStamp
EXTERN unsigned long lengthOfSecondaryLowPulses
EXTERN unsigned long lastSecondaryPulseLeadingTimeStamp
EXTERN unsigned long lastSecondaryPulseTrailingTimeStamp
unsigned long engineCyclePeriod
EXTERN unsigned long lastSecondaryOddTimeStamp
EXTERN unsigned short primaryTeethDroppedFromLackOfSync
EXTERN unsigned char dwellQueueLength
EXTERN unsigned char ignitionQueueLength
EXTERN unsigned char nextDwellChannel
EXTERN unsigned char nextIgnitionChannel
EXTERN unsigned short ignitionAdvances [IGNITION_CHANNELS *2]
EXTERN unsigned short queuedDwellOffsets [IGNITION_CHANNELS]
EXTERN unsigned short queuedIgnitionOffsets [IGNITION_CHANNELS]
EXTERN volatile unsigned short
*volatile 
injectorMainTimeRegisters [INJECTION_CHANNELS]
EXTERN volatile unsigned char
*volatile 
injectorMainControlRegisters [INJECTION_CHANNELS]
EXTERN unsigned short injectorMainStartTimesHolding [INJECTION_CHANNELS]
EXTERN unsigned long injectorMainEndTimes [INJECTION_CHANNELS]
EXTERN unsigned short injectorCodeOpenRuntimes [INJECTION_CHANNELS]
EXTERN unsigned short injectorCodeCloseRuntimes [INJECTION_CHANNELS]
EXTERN unsigned short * injectorMainPulseWidthsMath
EXTERN unsigned short * injectorStagedPulseWidthsMath
EXTERN unsigned short * injectorMainPulseWidthsRealtime
EXTERN unsigned short * injectorStagedPulseWidthsRealtime
EXTERN unsigned short injectorMainPulseWidths0 [INJECTION_CHANNELS]
EXTERN unsigned short injectorMainPulseWidths1 [INJECTION_CHANNELS]
EXTERN unsigned short injectorStagedPulseWidths0 [INJECTION_CHANNELS]
EXTERN unsigned short injectorStagedPulseWidths1 [INJECTION_CHANNELS]
EXTERN unsigned short injectorCodeLatencies [INJECTION_CHANNELS]

Detailed Description

The main project header file.

The central header for all source files to include. This pulls in the device header, all other shared headers, all global defines, all global constant declarations, all type definitions and all global variables. Other variables that are actually in global space but only shared between a few select files should be placed in the header for the main file that uses them.

Author:
Fred Cooke

Definition in file freeEMS.h.


Define Documentation

#define asyncDatalogADC   0x04

Definition at line 118 of file freeEMS.h.

Referenced by main().

#define asyncDatalogBasic   0x01

Definition at line 114 of file freeEMS.h.

Referenced by main().

#define asyncDatalogCircBuf   0x05

Definition at line 119 of file freeEMS.h.

Referenced by main().

#define asyncDatalogCircCAS   0x06

Definition at line 120 of file freeEMS.h.

Referenced by main().

#define asyncDatalogConfig   0x02

Definition at line 116 of file freeEMS.h.

Referenced by main().

#define asyncDatalogLogic   0x03

Definition at line 117 of file freeEMS.h.

Referenced by main().

#define asyncDatalogOff   0x00

Definition at line 113 of file freeEMS.h.

Referenced by main().

#define asyncDatalogTrigger   0x07

Definition at line 121 of file freeEMS.h.

Referenced by main().

#define CALC_FUEL_IGN   BIT10_16

Definition at line 319 of file freeEMS.h.

Referenced by main(), and PrimaryRPMISR().

#define CLEAR_CALC_FUEL_IGN   NBIT10_16

Definition at line 329 of file freeEMS.h.

Referenced by main().

#define CLEAR_FORCE_READING   NBIT11_16

Definition at line 330 of file freeEMS.h.

Referenced by main().

#define CLEAR_PRIMARY_SYNC   NBIT2_16

Definition at line 327 of file freeEMS.h.

Referenced by PrimaryRPMISR(), resetToNonRunningState(), and SecondaryRPMISR().

#define COREA01   BIT1_16

Definition at line 310 of file freeEMS.h.

#define COREA12   BIT12_16

Definition at line 321 of file freeEMS.h.

#define COREA13   BIT13_16

Definition at line 322 of file freeEMS.h.

#define COREA14   BIT14_16

Definition at line 323 of file freeEMS.h.

#define COREA15   BIT15_16

Definition at line 324 of file freeEMS.h.

#define COREA16   BIT16_16

Definition at line 325 of file freeEMS.h.

#define ENGINE_PHASE   BIT4_16

Definition at line 313 of file freeEMS.h.

#define EXTERN   extern

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.

Definition at line 83 of file freeEMS.h.

#define FORCE_READING   BIT11_16

Definition at line 320 of file freeEMS.h.

Referenced by main(), and RTIISR().

#define FUEL_CUT   BIT5_16

Definition at line 314 of file freeEMS.h.

#define HARD_SPARK_CUT   BIT6_16

Definition at line 315 of file freeEMS.h.

#define PRIMARY_SYNC   BIT2_16

Definition at line 311 of file freeEMS.h.

Referenced by PrimaryRPMISR(), and SecondaryRPMISR().

#define SECONDARY_SYNC   BIT3_16

Definition at line 312 of file freeEMS.h.

#define SOFT_SPARK_CUT   BIT7_16

Definition at line 316 of file freeEMS.h.

#define SPARK_RETARD   BIT8_16

Definition at line 317 of file freeEMS.h.

#define STAGED_NOT_REQUIRED   NBIT9_16

Definition at line 328 of file freeEMS.h.

Referenced by calculateFuelAndIgnition().

#define STAGED_REQUIRED   BIT9_16

Definition at line 318 of file freeEMS.h.

Referenced by calculateFuelAndIgnition(), and InjectorXISR().


Variable Documentation

Bank 0 secondary running variables

Definition at line 176 of file freeEMS.h.

Referenced by calculateFuelAndIgnition(), generateCoreVars(), initVariables(), main(), populateBasicDatalog(), and PrimaryRPMISR().

main adc storage area for syncronous sampling in the engine position ISR or injection ISR or ignition ISR etc.

Definition at line 178 of file freeEMS.h.

Referenced by initVariables(), and main().

main adc storage area for syncronous sampling in the engine position ISR or injection ISR or ignition ISR etc.

Definition at line 179 of file freeEMS.h.

Referenced by initVariables(), and main().

main adc storage area for syncronous sampling in the engine position ISR or injection ISR or ignition ISR etc.

Definition at line 177 of file freeEMS.h.

Referenced by initVariables(), and main().

main adc storage area for syncronous sampling in the engine position ISR or injection ISR or ignition ISR etc.

Definition at line 181 of file freeEMS.h.

Referenced by initVariables().

secondary adc storage area for asynchronously sampling in the RTC/RTI ISR

Definition at line 183 of file freeEMS.h.

Referenced by initVariables().

secondary adc storage area for asynchronously sampling in the RTC/RTI ISR

Definition at line 184 of file freeEMS.h.

Referenced by initVariables().

secondary adc storage area for asynchronously sampling in the RTC/RTI ISR

Definition at line 182 of file freeEMS.h.

Referenced by initVariables().

unsigned char asyncDatalogType

Definition at line 46 of file staticInit.c.

Referenced by decodePacketAndRespond(), and main().

EXTERN unsigned long bootFuelConst

Definition at line 297 of file freeEMS.h.

Referenced by calculateFuelAndIgnition(), and initConfiguration().

EXTERN unsigned short bootTimeAAP

Definition at line 302 of file freeEMS.h.

Referenced by generateCoreVars().

EXTERN unsigned short boundedTPSADC

Definition at line 300 of file freeEMS.h.

Referenced by generateCoreVars().

EXTERN Clock Clocks

Definition at line 129 of file freeEMS.h.

Referenced by PrimaryRPMISR(), and RTIISR().

EXTERN unsigned short configuredBasicDatalogLength

Definition at line 122 of file freeEMS.h.

Referenced by decodePacketAndRespond(), initVariables(), main(), and populateBasicDatalog().

EXTERN unsigned short coreStatusA
EXTERN CoreVar* CoreVars

Pointer to the core running variables

Definition at line 169 of file freeEMS.h.

Referenced by initVariables().

EXTERN Counter Counters
EXTERN unsigned short currentDwell0

Definition at line 190 of file freeEMS.h.

Referenced by initVariables(), and main().

EXTERN unsigned short currentDwell1

Definition at line 191 of file freeEMS.h.

Referenced by initVariables(), and main().

EXTERN unsigned short* currentDwellMath

Definition at line 188 of file freeEMS.h.

Referenced by calculateFuelAndIgnition(), initVariables(), and main().

EXTERN unsigned short* currentDwellRealtime

Definition at line 189 of file freeEMS.h.

Referenced by initVariables(), and main().

EXTERN unsigned char currentFuelRPage

Definition at line 247 of file freeEMS.h.

Referenced by generateDerivedVars(), and setupPagedRAM().

EXTERN unsigned char currentTimeRPage

Definition at line 249 of file freeEMS.h.

Referenced by setupPagedRAM().

EXTERN unsigned char currentTuneRPage

Definition at line 248 of file freeEMS.h.

Referenced by setupPagedRAM().

Bank 0 core running variables

Definition at line 172 of file freeEMS.h.

Referenced by calculateFuelAndIgnition(), generateDerivedVars(), initVariables(), and populateBasicDatalog().

Pointer to the secondary running variables

Definition at line 173 of file freeEMS.h.

Referenced by initVariables().

EXTERN unsigned short dwellOn

Definition at line 348 of file freeEMS.h.

EXTERN unsigned char dwellQueueLength

Definition at line 391 of file freeEMS.h.

Referenced by IgnitionDwellISR(), and PrimaryRPMISR().

unsigned long engineCyclePeriod

Definition at line 72 of file staticInit.c.

Referenced by ModDownCtrISR(), PrimaryRPMISR(), resetToNonRunningState(), and SecondaryRPMISR().

EXTERN unsigned short ignitionAdvances[IGNITION_CHANNELS *2]

Definition at line 395 of file freeEMS.h.

Referenced by calculateFuelAndIgnition().

EXTERN unsigned char ignitionQueueLength

Definition at line 392 of file freeEMS.h.

Referenced by IgnitionFireISR(), and PrimaryRPMISR().

EXTERN unsigned short injectorCodeCloseRuntimes[INJECTION_CHANNELS]

Definition at line 413 of file freeEMS.h.

Referenced by InjectorXISR().

EXTERN unsigned short injectorCodeLatencies[INJECTION_CHANNELS]

Definition at line 426 of file freeEMS.h.

Referenced by InjectorXISR().

EXTERN unsigned short injectorCodeOpenRuntimes[INJECTION_CHANNELS]

Definition at line 412 of file freeEMS.h.

Referenced by InjectorXISR().

EXTERN volatile unsigned char* volatile injectorMainControlRegisters[INJECTION_CHANNELS]

Definition at line 404 of file freeEMS.h.

Referenced by initVariables(), InjectorXISR(), and PrimaryRPMISR().

EXTERN unsigned long injectorMainEndTimes[INJECTION_CHANNELS]

Definition at line 408 of file freeEMS.h.

Referenced by InjectorXISR(), and PrimaryRPMISR().

EXTERN unsigned short injectorMainPulseWidths0[INJECTION_CHANNELS]

Definition at line 420 of file freeEMS.h.

Referenced by initVariables(), and main().

EXTERN unsigned short injectorMainPulseWidths1[INJECTION_CHANNELS]

Definition at line 421 of file freeEMS.h.

Referenced by initVariables(), and main().

EXTERN unsigned short* injectorMainPulseWidthsMath

Definition at line 416 of file freeEMS.h.

Referenced by calculateFuelAndIgnition(), initVariables(), and main().

EXTERN unsigned short* injectorMainPulseWidthsRealtime

Definition at line 418 of file freeEMS.h.

Referenced by initVariables(), InjectorXISR(), main(), and PrimaryRPMISR().

EXTERN unsigned short injectorMainStartTimesHolding[INJECTION_CHANNELS]

Definition at line 407 of file freeEMS.h.

Referenced by InjectorXISR(), and PrimaryRPMISR().

EXTERN volatile unsigned short* volatile injectorMainTimeRegisters[INJECTION_CHANNELS]

Definition at line 403 of file freeEMS.h.

Referenced by initVariables(), InjectorXISR(), and PrimaryRPMISR().

EXTERN unsigned short injectorStagedPulseWidths0[INJECTION_CHANNELS]

Definition at line 422 of file freeEMS.h.

Referenced by initVariables(), and main().

EXTERN unsigned short injectorStagedPulseWidths1[INJECTION_CHANNELS]

Definition at line 423 of file freeEMS.h.

Referenced by initVariables(), and main().

EXTERN unsigned short* injectorStagedPulseWidthsMath

Definition at line 417 of file freeEMS.h.

Referenced by initVariables(), and main().

EXTERN unsigned short* injectorStagedPulseWidthsRealtime

Definition at line 419 of file freeEMS.h.

Referenced by initVariables(), and main().

Definition at line 132 of file freeEMS.h.

Referenced by initVariables(), main(), PrimaryRPMISR(), and SecondaryRPMISR().

EXTERN unsigned long lastPrimaryPulseTimeStamp

Definition at line 363 of file freeEMS.h.

Referenced by PrimaryRPMISR().

EXTERN unsigned long lastSecondaryOddTimeStamp

Definition at line 379 of file freeEMS.h.

Referenced by SecondaryRPMISR().

EXTERN unsigned long lastSecondaryPulseLeadingTimeStamp

Definition at line 376 of file freeEMS.h.

Referenced by SecondaryRPMISR().

Definition at line 377 of file freeEMS.h.

Referenced by SecondaryRPMISR().

EXTERN unsigned long lengthOfSecondaryLowPulses

Definition at line 372 of file freeEMS.h.

Referenced by generateDerivedVars(), and SecondaryRPMISR().

EXTERN unsigned char mainOn

Definition at line 347 of file freeEMS.h.

unsigned short masterPulseWidth

* Pointers to main tables to aid readability */

* Pointers to SmallTablesA */ * Pointers to SmallTablesB */

Definition at line 51 of file staticInit.c.

Referenced by calculateFuelAndIgnition(), and PrimaryRPMISR().

EXTERN unsigned short* mathSampleTimeStamp

secondary adc storage area for asynchronously sampling in the RTC/RTI ISR

Definition at line 186 of file freeEMS.h.

Referenced by initVariables(), and main().

EXTERN unsigned short* mathSampleTimeStampRecord

Definition at line 187 of file freeEMS.h.

Referenced by initVariables(), main(), and PrimaryRPMISR().

EXTERN unsigned char nextDwellChannel

Definition at line 393 of file freeEMS.h.

Referenced by IgnitionDwellISR(), and PrimaryRPMISR().

EXTERN unsigned char nextIgnitionChannel

Definition at line 394 of file freeEMS.h.

Referenced by IgnitionFireISR(), and PrimaryRPMISR().

EXTERN unsigned char portHDebounce

Definition at line 109 of file freeEMS.h.

Referenced by PortHISR(), and RTIISR().

EXTERN unsigned long primaryLeadingEdgeTimeStamp

Definition at line 359 of file freeEMS.h.

Referenced by PrimaryRPMISR().

EXTERN unsigned short primaryPulsesPerSecondaryPulse

Definition at line 357 of file freeEMS.h.

Referenced by PrimaryRPMISR(), and SecondaryRPMISR().

EXTERN unsigned short primaryTeethDroppedFromLackOfSync

Definition at line 386 of file freeEMS.h.

Referenced by PrimaryRPMISR().

EXTERN unsigned long primaryTrailingEdgeTimeStamp

Definition at line 360 of file freeEMS.h.

EXTERN unsigned short queuedDwellOffsets[IGNITION_CHANNELS]

Definition at line 396 of file freeEMS.h.

Referenced by IgnitionDwellISR(), and PrimaryRPMISR().

EXTERN unsigned short queuedIgnitionOffsets[IGNITION_CHANNELS]

Definition at line 397 of file freeEMS.h.

Referenced by IgnitionFireISR(), and PrimaryRPMISR().

EXTERN unsigned char rescheduleFuelFlags

Definition at line 351 of file freeEMS.h.

EXTERN unsigned short RPM0

Definition at line 106 of file freeEMS.h.

Referenced by initVariables(), main(), and resetToNonRunningState().

EXTERN unsigned short RPM1

Definition at line 107 of file freeEMS.h.

Referenced by initVariables(), main(), and resetToNonRunningState().

Definition at line 131 of file freeEMS.h.

Referenced by main(), PrimaryRPMISR(), RTIISR(), SCI0ISR(), and SecondaryRPMISR().

EXTERN Tables4 TablesD RWINDOW

Definition at line 240 of file freeEMS.h.

EXTERN unsigned char RXBuffer [RX_BUFFER_SIZE] RXBUF

Definition at line 239 of file freeEMS.h.

EXTERN unsigned char selfSetTimer

Definition at line 350 of file freeEMS.h.

Referenced by InjectorXISR(), and PrimaryRPMISR().

EXTERN unsigned char ShouldSendLog

Definition at line 126 of file freeEMS.h.

Referenced by main(), and RTIISR().

EXTERN unsigned char stagedOn

Definition at line 349 of file freeEMS.h.

Referenced by InjectorXISR().

unsigned short tachoPeriod

Definition at line 48 of file staticInit.c.

Referenced by ModDownCtrISR().

EXTERN unsigned long timeBetweenSuccessivePrimaryPulses

Definition at line 361 of file freeEMS.h.

Referenced by generateDerivedVars(), and PrimaryRPMISR().

unsigned short timerExtensionClock

Definition at line 335 of file freeEMS.h.

Referenced by InjectorXISR(), PrimaryRPMISR(), SecondaryRPMISR(), and TimerOverflow().

Definition at line 52 of file staticInit.c.

Definition at line 53 of file staticInit.c.

Referenced by calculateFuelAndIgnition(), and PrimaryRPMISR().

EXTERN unsigned short totalDwell

Definition at line 293 of file freeEMS.h.

EXTERN unsigned short TPSADCRange

Definition at line 299 of file freeEMS.h.

Referenced by generateCoreVars(), and initConfiguration().

EXTERN unsigned short TPSMAPRange

Definition at line 298 of file freeEMS.h.

Referenced by generateCoreVars(), and initConfiguration().

EXTERN unsigned char TXBuffer [TX_BUFFER_SIZE] TXBUF

Definition at line 238 of file freeEMS.h.

Generated on Sat Oct 16 21:29:10 2010 for FreeEMS by  doxygen 1.6.3