60/2 perf grab #1850
a) removing more of stack validating - one validation within the deepest method would be enough b) un-wrapping main callback loop for explicit order of execution
This commit is contained in:
parent
6b95579706
commit
030ec42ac7
|
@ -368,7 +368,7 @@ uint32_t *cyccnt = (uint32_t*) &DWT->CYCCNT;
|
||||||
* This is the main trigger event handler.
|
* This is the main trigger event handler.
|
||||||
* Both injection and ignition are controlled from this method.
|
* Both injection and ignition are controlled from this method.
|
||||||
*/
|
*/
|
||||||
static void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t trgEventIndex, efitick_t edgeTimestamp DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t trgEventIndex, efitick_t edgeTimestamp DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
ScopePerf perf(PE::MainTriggerCallback);
|
ScopePerf perf(PE::MainTriggerCallback);
|
||||||
|
|
||||||
(void) ckpSignalType;
|
(void) ckpSignalType;
|
||||||
|
@ -559,7 +559,6 @@ void initMainEventListener(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX
|
||||||
printMsg(logger, "!!!!!!!!!!!!!!!!!!! injection disabled");
|
printMsg(logger, "!!!!!!!!!!!!!!!!!!! injection disabled");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
addTriggerEventListener(mainTriggerCallback, "main loop", engine);
|
|
||||||
|
|
||||||
// We start prime injection pulse at the early init stage - don't wait for the engine to start spinning!
|
// We start prime injection pulse at the early init stage - don't wait for the engine to start spinning!
|
||||||
if (CONFIG(startOfCrankingPrimingPulse) > 0)
|
if (CONFIG(startOfCrankingPrimingPulse) > 0)
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
|
|
||||||
void initMainEventListener(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX);
|
void initMainEventListener(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
|
void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t trgEventIndex, efitick_t edgeTimestamp DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
void startPrimeInjectionPulse(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
void startPrimeInjectionPulse(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
||||||
void startSimultaniousInjection(Engine *engine);
|
void startSimultaniousInjection(Engine *engine);
|
||||||
|
|
|
@ -267,7 +267,7 @@ void refreshMapAveragingPreCalc(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
/**
|
/**
|
||||||
* Shaft Position callback used to schedule start and end of MAP averaging
|
* Shaft Position callback used to schedule start and end of MAP averaging
|
||||||
*/
|
*/
|
||||||
static void mapAveragingTriggerCallback(trigger_event_e ckpEventType,
|
void mapAveragingTriggerCallback(trigger_event_e ckpEventType,
|
||||||
uint32_t index, efitick_t edgeTimestamp DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
uint32_t index, efitick_t edgeTimestamp DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
|
|
||||||
ScopePerf perf(PE::MapAveragingTriggerCallback);
|
ScopePerf perf(PE::MapAveragingTriggerCallback);
|
||||||
|
@ -351,10 +351,6 @@ void initMapAveraging(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
logger = sharedLogger;
|
logger = sharedLogger;
|
||||||
|
|
||||||
#if !EFI_UNIT_TEST
|
#if !EFI_UNIT_TEST
|
||||||
#if EFI_SHAFT_POSITION_INPUT
|
|
||||||
addTriggerEventListener(&mapAveragingTriggerCallback, "MAP averaging", engine);
|
|
||||||
#endif /* EFI_SHAFT_POSITION_INPUT */
|
|
||||||
|
|
||||||
addConsoleAction("faststat", showMapStats);
|
addConsoleAction("faststat", showMapStats);
|
||||||
#endif /* EFI_UNIT_TEST */
|
#endif /* EFI_UNIT_TEST */
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,9 @@ void mapAveragingAdcCallback(adcsample_t newValue);
|
||||||
void initMapAveraging(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX);
|
void initMapAveraging(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||||
void refreshMapAveragingPreCalc(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
void refreshMapAveragingPreCalc(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
||||||
|
void mapAveragingTriggerCallback(trigger_event_e ckpEventType,
|
||||||
|
uint32_t index, efitick_t edgeTimestamp DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
#if EFI_TUNER_STUDIO
|
#if EFI_TUNER_STUDIO
|
||||||
void postMapState(TunerStudioOutputChannels *tsOutputChannels);
|
void postMapState(TunerStudioOutputChannels *tsOutputChannels);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -241,7 +241,6 @@ void RpmCalculator::setSpinningUp(efitick_t nowNt) {
|
||||||
*/
|
*/
|
||||||
void rpmShaftPositionCallback(trigger_event_e ckpSignalType,
|
void rpmShaftPositionCallback(trigger_event_e ckpSignalType,
|
||||||
uint32_t index, efitick_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
uint32_t index, efitick_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
efiAssertVoid(CUSTOM_ERR_6632, getCurrentRemainingStack() > EXPECTED_REMAINING_STACK, "lowstckRCL");
|
|
||||||
|
|
||||||
RpmCalculator *rpmState = &engine->rpmCalculator;
|
RpmCalculator *rpmState = &engine->rpmCalculator;
|
||||||
|
|
||||||
|
@ -326,7 +325,7 @@ static void onTdcCallback(Engine *engine) {
|
||||||
/**
|
/**
|
||||||
* This trigger callback schedules the actual physical TDC callback in relation to trigger synchronization point.
|
* This trigger callback schedules the actual physical TDC callback in relation to trigger synchronization point.
|
||||||
*/
|
*/
|
||||||
static void tdcMarkCallback(trigger_event_e ckpSignalType,
|
void tdcMarkCallback(trigger_event_e ckpSignalType,
|
||||||
uint32_t index0, efitick_t edgeTimestamp DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
uint32_t index0, efitick_t edgeTimestamp DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
(void) ckpSignalType;
|
(void) ckpSignalType;
|
||||||
bool isTriggerSynchronizationPoint = index0 == 0;
|
bool isTriggerSynchronizationPoint = index0 == 0;
|
||||||
|
@ -377,11 +376,6 @@ void initRpmCalculator(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
ENGINE(rpmCalculator).Register();
|
ENGINE(rpmCalculator).Register();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !EFI_UNIT_TEST
|
|
||||||
addTriggerEventListener(tdcMarkCallback, "chart TDC mark", engine);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
addTriggerEventListener(rpmShaftPositionCallback, "rpm reporter", engine);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -154,7 +154,11 @@ private:
|
||||||
|
|
||||||
#define isValidRpm(rpm) ((rpm) > 0 && (rpm) < UNREALISTIC_RPM)
|
#define isValidRpm(rpm) ((rpm) > 0 && (rpm) < UNREALISTIC_RPM)
|
||||||
|
|
||||||
void rpmShaftPositionCallback(trigger_event_e ckpSignalType, uint32_t index DECLARE_ENGINE_PARAMETER_SUFFIX);
|
void rpmShaftPositionCallback(trigger_event_e ckpSignalType, uint32_t index, efitick_t edgeTimestamp DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
|
void tdcMarkCallback(trigger_event_e ckpSignalType,
|
||||||
|
uint32_t index0, efitick_t edgeTimestamp DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialize RPM calculator
|
* @brief Initialize RPM calculator
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -25,6 +25,9 @@
|
||||||
#include "rpm_calculator.h"
|
#include "rpm_calculator.h"
|
||||||
#include "tooth_logger.h"
|
#include "tooth_logger.h"
|
||||||
#include "perf_trace.h"
|
#include "perf_trace.h"
|
||||||
|
#include "map_averaging.h"
|
||||||
|
#include "main_trigger_callback.h"
|
||||||
|
|
||||||
|
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE
|
||||||
#include "pin_repository.h"
|
#include "pin_repository.h"
|
||||||
|
@ -482,6 +485,22 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal, efitick_t timesta
|
||||||
scheduleMsg(logger, "trigger %d %d %d", triggerIndexForListeners, getRevolutionCounter(), (int)getTimeNowUs());
|
scheduleMsg(logger, "trigger %d %d %d", triggerIndexForListeners, getRevolutionCounter(), (int)getTimeNowUs());
|
||||||
#endif /* TRIGGER_EXTREME_LOGGING */
|
#endif /* TRIGGER_EXTREME_LOGGING */
|
||||||
|
|
||||||
|
|
||||||
|
rpmShaftPositionCallback(signal, triggerIndexForListeners, timestamp PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
|
#if !EFI_UNIT_TEST
|
||||||
|
tdcMarkCallback(signal, triggerIndexForListeners, timestamp PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !EFI_UNIT_TEST
|
||||||
|
#if EFI_SHAFT_POSITION_INPUT
|
||||||
|
mapAveragingTriggerCallback(signal, triggerIndexForListeners, timestamp PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
#endif /* EFI_SHAFT_POSITION_INPUT */
|
||||||
|
#endif /* EFI_UNIT_TEST */
|
||||||
|
|
||||||
|
//auxValveTriggerCallback
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Here we invoke all the listeners - the main engine control logic is inside these listeners
|
* Here we invoke all the listeners - the main engine control logic is inside these listeners
|
||||||
*/
|
*/
|
||||||
|
@ -490,6 +509,9 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal, efitick_t timesta
|
||||||
(listener)(signal, triggerIndexForListeners, timestamp PASS_ENGINE_PARAMETER_SUFFIX);
|
(listener)(signal, triggerIndexForListeners, timestamp PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mainTriggerCallback(signal, triggerIndexForListeners, timestamp PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue