static void periodicSlowCallback(Engine *engine) { efiAssertVoid(getRemainingStack(chThdSelf()) > 64, "lowStckOnEv"); #if EFI_PROD_CODE /** * We need to push current value into the 64 bit counter often enough so that we do not miss an overflow */ bool alreadyLocked = lockAnyContext(); updateAndSet(&halTime.state, hal_lld_get_counter_value()); if (!alreadyLocked) { unlockAnyContext(); } #endif if (!engine->rpmCalculator.isRunning()) { #if (EFI_PROD_CODE && EFI_ENGINE_CONTROL && EFI_INTERNAL_FLASH) || defined(__DOXYGEN__) writeToFlashIfPending(); #endif resetAccel(); } if (versionForConfigurationListeners.isOld()) { updateAccelParameters(); engine->engineState.warmupAfrPid.reset(); } engine->watchdog(); engine->updateSlowSensors(); #if (EFI_PROD_CODE && EFI_FSIO) || defined(__DOXYGEN__) runFsio(); #endif cylinderCleanupControl(engine); scheduleNextSlowInvocation(); }
efitime_t Overflow64Counter::update(uint32_t value) { updateAndSet(&state, value); return state.highBits + state.lowBits; }