FreeEMS
0.2.0-SNAPSHOT-285-g028e24c
|
Objects through which a decoder communicates. More...
#include "syncLossIDs.h"
Go to the source code of this file.
Macros | |
#define | EXTERN extern |
#define | BENCH_TEST_NAME "BenchTest" |
#define | degreeTicksPerMinute 4166667 |
#define | ticks_per_degree_multiplier (10 * ANGLE_FACTOR) |
#define | COMBUSTION_SYNC BIT0 |
Sync sufficient for Dizzy/Batch Injection. | |
#define | CRANK_SYNC BIT1 |
Sync sufficient for Wasted Spark/Semi-Sequential. | |
#define | CAM_SYNC BIT2 |
Sync sufficient for COP/CNP/Sequential. | |
#define | LAST_TIMESTAMP_VALID BIT3 |
Set when first decoder ISR runs post a reset. | |
#define | LAST_PERIOD_VALID BIT4 |
Set when second decoder ISR runs post a reset. | |
#define | LAST_MATCH_VALID BIT5 |
Missing teeth style decoders set this when a valid match is found. | |
#define | LAST_TPD_VALID BIT6 |
Set once sync is found and we've stored a Ticks Per Degree value. | |
#define | OK_TO_SCHEDULE BIT7 |
Sync confirmed OK by configured number of checks. | |
#define | ARBITRARY_DECODER_NAME_MAX_LENGTH 64 |
#define | SIZE_OF_EVENT_ARRAYS 256 |
#define | SET_SYNC_LEVEL_TO(SYNC_LEVEL) |
#define | SCHEDULE_ONE_ECT_OUTPUT() |
Functions | |
void | decoderInitPreliminary (void) |
void | perDecoderReset (void) |
void | descheduleAll (void) |
Loop over all schedules descheduling them as we go. | |
void | resetToNonRunningState (unsigned char uniqueLossID) |
Reset key state. | |
void | schedulePortTPin (unsigned char pin, LongTime timeStamp) |
Schedule an ignition output event on port T. |
Objects through which a decoder communicates.
This file contains the declarations of objects used as a common interface between all of the different wheel decoders and the main loop scheduler.
Definition in file decoderInterface.h.
#define EXTERN extern |
Definition at line 57 of file decoderInterface.h.
#define BENCH_TEST_NAME "BenchTest" |
Definition at line 61 of file decoderInterface.h.
Referenced by decodePacketAndRespond().
#define degreeTicksPerMinute 4166667 |
Definition at line 74 of file decoderInterface.h.
Referenced by generateCoreVars().
#define ticks_per_degree_multiplier (10 * ANGLE_FACTOR) |
Definition at line 75 of file decoderInterface.h.
Referenced by generateDerivedVars(), PrimaryRPMISR(), scheduleOutputs(), and SecondaryRPMISR().
#define COMBUSTION_SYNC BIT0 |
Sync sufficient for Dizzy/Batch Injection.
Introduce the concept of sync level to schedule for if NOT synced
and a way of deciding what to do in different sync states
and proper dividers for pulsewidths
and ability to lock pulsewidht/dwell for scheduling
and generalise scheduling to all pins
and provide a way of choosing a source of pulsewidth dwell or fuel duration
and a way of allowing overly advanced scheduling instead of none, when its fuel
Definition at line 150 of file decoderInterface.h.
Referenced by PrimaryRPMISR(), and resetToNonRunningState().
#define CRANK_SYNC BIT1 |
Sync sufficient for Wasted Spark/Semi-Sequential.
Definition at line 151 of file decoderInterface.h.
Referenced by resetToNonRunningState().
#define CAM_SYNC BIT2 |
Sync sufficient for COP/CNP/Sequential.
Definition at line 152 of file decoderInterface.h.
Referenced by PrimaryRPMISR(), resetToNonRunningState(), and SecondaryRPMISR().
#define LAST_TIMESTAMP_VALID BIT3 |
Set when first decoder ISR runs post a reset.
Definition at line 153 of file decoderInterface.h.
Referenced by PrimaryRPMISR(), and SecondaryRPMISR().
#define LAST_PERIOD_VALID BIT4 |
Set when second decoder ISR runs post a reset.
Definition at line 154 of file decoderInterface.h.
Referenced by PrimaryRPMISR(), and SecondaryRPMISR().
#define LAST_MATCH_VALID BIT5 |
Missing teeth style decoders set this when a valid match is found.
Definition at line 155 of file decoderInterface.h.
Referenced by PrimaryRPMISR().
#define LAST_TPD_VALID BIT6 |
Set once sync is found and we've stored a Ticks Per Degree value.
Definition at line 156 of file decoderInterface.h.
Referenced by PrimaryRPMISR().
#define OK_TO_SCHEDULE BIT7 |
Sync confirmed OK by configured number of checks.
Definition at line 157 of file decoderInterface.h.
Referenced by PrimaryRPMISR(), resetToNonRunningState(), and SecondaryRPMISR().
#define ARBITRARY_DECODER_NAME_MAX_LENGTH 64 |
Definition at line 161 of file decoderInterface.h.
#define SIZE_OF_EVENT_ARRAYS 256 |
Definition at line 162 of file decoderInterface.h.
#define SET_SYNC_LEVEL_TO | ( | SYNC_LEVEL | ) |
Definition at line 178 of file decoderInterface.h.
Referenced by PrimaryRPMISR(), and SecondaryRPMISR().
#define SCHEDULE_ONE_ECT_OUTPUT | ( | ) |
Definition at line 201 of file decoderInterface.h.
Referenced by schedulePortTPin().
void decoderInitPreliminary | ( | void | ) |
Definition at line 56 of file BenchTest.c.
References ICPAR, PACN1, TCTL4, TIE, and TIOS.
Referenced by initECTTimer().
void perDecoderReset | ( | void | ) |
Definition at line 71 of file BenchTest.c.
References BIT2, camTeethSeen, crankTeethSinceLastCamTooth, cumulativeBastardTeeth, cumulativeBastardTeethEroderCounter, doubleHighSeen, NumberOfTwinMatchedPairs, previousCrankTeethSeen, TCTL4, and unknownLeadingEdges.
Referenced by resetToNonRunningState().
void descheduleAll | ( | void | ) |
Loop over all schedules descheduling them as we go.
Definition at line 44 of file decoderInterface.c.
References MAX_NUMBER_OF_OUTPUT_EVENTS, and outputEventInputEventNumbers.
Referenced by initVariables(), and resetToNonRunningState().
void resetToNonRunningState | ( | unsigned char | uniqueLossID | ) |
Reset key state.
Reset all important variables to their non-running state.
uniqueLossID | 0 is reserved for system use, within your decoder never use the same value twice. |
Definition at line 60 of file decoderInterface.c.
References CAM_SYNC, COMBUSTION_SYNC, CRANK_SYNC, KeyUserDebug::currentEvent, KeyUserDebug::decoderFlags, fixedConfig2::decoderSettings, descheduleAll(), fixedConfigs2, FLAG_AND_INC_FLAGGABLE, FLAG_DECODER_SYNC_LOSSES_OFFSET, FLAG_DECODER_SYNC_STATE_CLEARS_OFFSET, FLAG_DECODER_SYNCS_NOT_CONFIRMED_OFFSET, KeyUserDebugs, OK_TO_SCHEDULE, perDecoderReset(), decoderSetting::syncConfirmationsRunning, syncConfirmationsRunningCounter, decoderSetting::syncConfirmationsStarting, syncConfirmationsStartingCounter, KeyUserDebug::syncLostOnThisEvent, KeyUserDebug::syncLostWithThisID, KeyUserDebug::syncResetCalls, ticksPerDegree0, and ticksPerDegree1.
Referenced by main(), PLLLockISR(), PrimaryRPMISR(), SecondaryRPMISR(), and SelfClockISR().
void schedulePortTPin | ( | unsigned char | outputEventNumber, |
LongTime | timeStamp | ||
) |
Schedule an ignition output event on port T.
Definition at line 108 of file decoderInterface.c.
References Counters, decoderMaxCodeTime, ectMainActiveMasks, ectMainControlRegisters, ectMainEndTimes, ectMainGoHighMasks, ectMainOnMasks, ectMainStartOffsetHolding, ectMainTimeRegisters, ectSwitchOffCodeTime, fixedConfigs1, newStartIsAfterOutputEndTimeAndCanSelfSet, outputEventDelayFinalPeriod, outputEventDelayFinalPeriodHolding, outputEventExtendNumberOfRepeats, outputEventExtendNumberOfRepeatsHolding, outputEventExtendRepeatPeriod, outputEventExtendRepeatPeriodHolding, schedulingSetting::outputEventPinNumbers, outputEventPulseWidthsHolding, outputEventPulseWidthsMath, Counter::pinScheduledAgainToStayOn, Counter::pinScheduledAlready, Counter::pinScheduledFromCold, Counter::pinScheduledToDoNothing, Counter::pinScheduledToSelfSchedule, Counter::pinScheduledToToggleError, SCHEDULE_ONE_ECT_OUTPUT, fixedConfig1::schedulingSettings, selfSetTimer, skipEventFlags, TIE, LongTime::timeLong, and LongTime::timeShorts.
Referenced by main(), and PrimaryRPMISR().
EXTERN unsigned char selfSetTimer |
Definition at line 83 of file decoderInterface.h.
Referenced by InjectorXISR(), and schedulePortTPin().
EXTERN unsigned short ticksPerDegree0 |
Definition at line 87 of file decoderInterface.h.
Referenced by initVariables(), main(), and resetToNonRunningState().
EXTERN unsigned short ticksPerDegree1 |
Definition at line 88 of file decoderInterface.h.
Referenced by initVariables(), main(), and resetToNonRunningState().
EXTERN unsigned short* ticksPerDegree |
Definition at line 89 of file decoderInterface.h.
Referenced by generateCoreVars(), initVariables(), main(), and scheduleOutputs().
EXTERN unsigned short* ticksPerDegreeRecord |
Definition at line 90 of file decoderInterface.h.
Referenced by initVariables(), main(), PrimaryRPMISR(), and SecondaryRPMISR().
EXTERN unsigned long lastEventTimeStamp |
Definition at line 132 of file decoderInterface.h.
Referenced by PrimaryRPMISR(), and SecondaryRPMISR().
EXTERN unsigned long lastPrimaryEventTimeStamp |
Definition at line 133 of file decoderInterface.h.
Referenced by PrimaryRPMISR().
EXTERN unsigned long lastSecondaryEventTimeStamp |
Definition at line 134 of file decoderInterface.h.
Referenced by PrimaryRPMISR(), and SecondaryRPMISR().
EXTERN unsigned short lastTicksPerDegree |
Definition at line 135 of file decoderInterface.h.
Referenced by PrimaryRPMISR(), and SecondaryRPMISR().
EXTERN unsigned short lastPrimaryTicksPerDegree |
Definition at line 136 of file decoderInterface.h.
Referenced by PrimaryRPMISR().
EXTERN unsigned short lastSecondaryTicksPerDegree |
Definition at line 137 of file decoderInterface.h.
EXTERN unsigned long skipEventFlags |
Definition at line 138 of file decoderInterface.h.
Referenced by scheduleOutputs(), and schedulePortTPin().
EXTERN unsigned char numberScheduled |
Definition at line 139 of file decoderInterface.h.
EXTERN unsigned char syncConfirmationsRunningCounter |
Definition at line 140 of file decoderInterface.h.
Referenced by resetToNonRunningState().
EXTERN unsigned char syncConfirmationsStartingCounter |
Definition at line 141 of file decoderInterface.h.
Referenced by resetToNonRunningState().
EXTERN const unsigned char decoderName[sizeof(BASE_FILE_NAME)] |
Definition at line 169 of file decoderInterface.h.
Referenced by decodePacketAndRespond().
EXTERN const unsigned char numberOfRealEvents |
Definition at line 170 of file decoderInterface.h.
Referenced by PrimaryRPMISR(), scheduleOutputs(), and SecondaryRPMISR().
EXTERN const unsigned char numberOfVirtualEvents |
Definition at line 171 of file decoderInterface.h.
Referenced by scheduleOutputs().
EXTERN const unsigned short eventAngles[SIZE_OF_EVENT_ARRAYS] |
Definition at line 172 of file decoderInterface.h.
EXTERN const unsigned char eventValidForCrankSync[SIZE_OF_EVENT_ARRAYS] |
Definition at line 173 of file decoderInterface.h.
EXTERN const unsigned short totalEventAngleRange |
Definition at line 174 of file decoderInterface.h.
Referenced by PrimaryRPMISR(), and scheduleOutputs().
EXTERN const unsigned short decoderMaxCodeTime |
Definition at line 175 of file decoderInterface.h.
Referenced by decodePacketAndRespond(), PrimaryRPMISR(), scheduleOutputs(), and schedulePortTPin().
EXTERN unsigned char outputEventInputEventNumbers[MAX_NUMBER_OF_OUTPUT_EVENTS] |
TODO two unsigned chars, and two unsigned shorts, which is the MAP ADC value, the MAP value is sampled on every event in a cycle, and if less than the previous stored value, which is reset at every zeroth event, with the old value and old event number stored globally.
TODO the same thing could be done, but with a median filter or similar, perhaps map sampling could be done dymanically like this, though it could yield unpredictable results, it could also yield the best running engines, just a thought...
Definition at line 308 of file decoderInterface.h.
Referenced by decodePacketAndRespond(), descheduleAll(), PrimaryRPMISR(), and scheduleOutputs().
EXTERN unsigned short outputEventPulseWidthsMath[MAX_NUMBER_OF_OUTPUT_EVENTS] |
Definition at line 310 of file decoderInterface.h.
Referenced by decodePacketAndRespond(), main(), PrimaryRPMISR(), scheduleOutputs(), and schedulePortTPin().
EXTERN unsigned char outputEventExtendNumberOfRepeats[MAX_NUMBER_OF_OUTPUT_EVENTS] |
Definition at line 311 of file decoderInterface.h.
Referenced by scheduleOutputs(), and schedulePortTPin().
EXTERN unsigned short outputEventExtendRepeatPeriod[MAX_NUMBER_OF_OUTPUT_EVENTS] |
Definition at line 312 of file decoderInterface.h.
Referenced by scheduleOutputs(), and schedulePortTPin().
EXTERN unsigned short outputEventDelayFinalPeriod[MAX_NUMBER_OF_OUTPUT_EVENTS] |
Definition at line 313 of file decoderInterface.h.
Referenced by decodePacketAndRespond(), main(), PrimaryRPMISR(), scheduleOutputs(), and schedulePortTPin().
EXTERN unsigned long outputEventDelayTotalPeriod[MAX_NUMBER_OF_OUTPUT_EVENTS] |
Definition at line 314 of file decoderInterface.h.
Referenced by scheduleOutputs().
EXTERN unsigned short outputEventPulseWidthsHolding[ECT_CHANNELS] |
Definition at line 316 of file decoderInterface.h.
Referenced by InjectorXISR(), and schedulePortTPin().
EXTERN unsigned char outputEventExtendNumberOfRepeatsHolding[ECT_CHANNELS] |
Definition at line 317 of file decoderInterface.h.
Referenced by InjectorXISR(), and schedulePortTPin().
EXTERN unsigned short outputEventExtendRepeatPeriodHolding[ECT_CHANNELS] |
Definition at line 318 of file decoderInterface.h.
Referenced by InjectorXISR(), and schedulePortTPin().
EXTERN unsigned short outputEventDelayFinalPeriodHolding[ECT_CHANNELS] |
Definition at line 319 of file decoderInterface.h.
Referenced by InjectorXISR(), and schedulePortTPin().
EXTERN unsigned short outputEventPulseWidthsRealtime[ECT_CHANNELS] |
Definition at line 321 of file decoderInterface.h.
Referenced by InjectorXISR().
EXTERN unsigned char outputEventExtendNumberOfRepeatsRealtime[ECT_CHANNELS] |
Definition at line 322 of file decoderInterface.h.
Referenced by InjectorXISR().
EXTERN unsigned short outputEventExtendRepeatPeriodRealtime[ECT_CHANNELS] |
Definition at line 323 of file decoderInterface.h.
Referenced by InjectorXISR().
EXTERN unsigned short outputEventDelayFinalPeriodRealtime[ECT_CHANNELS] |
Definition at line 324 of file decoderInterface.h.
Referenced by InjectorXISR().
EXTERN unsigned short ectMainStartOffsetHolding[ECT_CHANNELS] |
Definition at line 326 of file decoderInterface.h.
Referenced by InjectorXISR(), and schedulePortTPin().
EXTERN volatile unsigned short* volatile ectMainTimeRegisters[ECT_CHANNELS] |
Definition at line 331 of file decoderInterface.h.
Referenced by initVariables(), InjectorXISR(), and schedulePortTPin().
EXTERN volatile unsigned char* volatile ectMainControlRegisters[ECT_CHANNELS] |
Definition at line 332 of file decoderInterface.h.
Referenced by initVariables(), InjectorXISR(), and schedulePortTPin().
EXTERN unsigned long ectMainEndTimes[ECT_CHANNELS] |
Definition at line 336 of file decoderInterface.h.
Referenced by InjectorXISR(), and schedulePortTPin().
EXTERN unsigned short ectCodeLatencies[ECT_CHANNELS] |
Definition at line 338 of file decoderInterface.h.
Referenced by InjectorXISR().
EXTERN unsigned short ectCodeOpenRuntimes[ECT_CHANNELS] |
Definition at line 342 of file decoderInterface.h.
Referenced by InjectorXISR().
EXTERN unsigned short ectCodeCloseRuntimes[ECT_CHANNELS] |
Definition at line 343 of file decoderInterface.h.
Referenced by InjectorXISR().