From 2e70da24dbe76c4e386ca705359e836c9803ba81 Mon Sep 17 00:00:00 2001 From: rusefi Date: Sun, 21 May 2017 10:46:43 -0400 Subject: [PATCH] wider usage of EFI_CLOCK_LOCKS --- firmware/controllers/error_handling.cpp | 11 ++++++++--- firmware/controllers/trigger/trigger_central.cpp | 6 ++++++ firmware/development/engine_sniffer.cpp | 4 +++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/firmware/controllers/error_handling.cpp b/firmware/controllers/error_handling.cpp index 8bf672c4dc..1b47996135 100644 --- a/firmware/controllers/error_handling.cpp +++ b/firmware/controllers/error_handling.cpp @@ -113,9 +113,9 @@ bool warning(obd_code_e code, const char *fmt, ...) { #if EFI_SIMULATOR || defined(__DOXYGEN__) printf("sim_warning %s\r\n", fmt); -#endif +#endif /* EFI_SIMULATOR */ -#if EFI_SIMULATOR || EFI_PROD_CODE +#if EFI_SIMULATOR || EFI_PROD_CODE || defined(__DOXYGEN__) efiAssert(isWarningStreamInitialized, "warn stream not initialized", false); addWarningCode(code); @@ -146,7 +146,7 @@ bool warning(obd_code_e code, const char *fmt, ...) { va_end(ap); printf("\r\n"); -#endif +#endif /* EFI_SIMULATOR || EFI_PROD_CODE */ return false; } @@ -154,6 +154,8 @@ char *getWarning(void) { return warningBuffer; } + +#if EFI_CLOCK_LOCKS || defined(__DOXYGEN__) uint32_t lastLockTime; /** * Maximum time before requesting lock and releasing lock at the end of critical section @@ -175,6 +177,9 @@ void onUnlockHook(void) { // } } +#endif /* EFI_CLOCK_LOCKS */ + + void initErrorHandling(void) { #if EFI_SIMULATOR || EFI_PROD_CODE || defined(__DOXYGEN__) msObjectInit(&warningStream, (uint8_t *) warningBuffer, WARNING_BUFFER_SIZE, 0); diff --git a/firmware/controllers/trigger/trigger_central.cpp b/firmware/controllers/trigger/trigger_central.cpp index f5ac86aea9..47d907401f 100644 --- a/firmware/controllers/trigger/trigger_central.cpp +++ b/firmware/controllers/trigger/trigger_central.cpp @@ -406,7 +406,10 @@ void resetMaxValues() { #if (EFI_PROD_CODE || EFI_SIMULATOR) || defined(__DOXYGEN__) maxEventCallbackDuration = triggerMaxDuration = 0; #endif /* EFI_PROD_CODE || EFI_SIMULATOR */ + +#if EFI_CLOCK_LOCKS || defined(__DOXYGEN__) maxLockedDuration = 0; +#endif /* EFI_CLOCK_LOCKS */ #if (EFI_PROD_CODE) || defined(__DOXYGEN__) maxPrecisionCallbackDuration = 0; @@ -503,7 +506,10 @@ void triggerInfo(void) { engine->m.rpmCbTime, engine->m.mainTriggerCallbackTime); +#if EFI_CLOCK_LOCKS || defined(__DOXYGEN__) scheduleMsg(logger, "maxLockedDuration=%d / maxTriggerReentraint=%d", maxLockedDuration, maxTriggerReentraint); +#endif /* EFI_CLOCK_LOCKS */ + scheduleMsg(logger, "maxEventCallbackDuration=%d", maxEventCallbackDuration); scheduleMsg(logger, "hipLastExecutionCount=%d", hipLastExecutionCount); diff --git a/firmware/development/engine_sniffer.cpp b/firmware/development/engine_sniffer.cpp index 2883055b56..87c93d5803 100644 --- a/firmware/development/engine_sniffer.cpp +++ b/firmware/development/engine_sniffer.cpp @@ -114,7 +114,9 @@ static void printStatus(void) { static void setChartActive(int value) { engineConfiguration->isEngineChartEnabled = value; printStatus(); - maxLockedDuration = 0; +#if EFI_CLOCK_LOCKS || defined(__DOXYGEN__) + maxLockedDuration = 0; // todo: why do we reset this here? why only this and not all metrics? +#endif /* EFI_CLOCK_LOCKS */ } void setChartSize(int newSize) {