better variable name & docs
This commit is contained in:
parent
94e30b0b38
commit
7927f7c035
|
@ -67,23 +67,24 @@ extern bool hasFirmwareErrorFlag;
|
||||||
* sets the alarm to the specified number of microseconds from now.
|
* sets the alarm to the specified number of microseconds from now.
|
||||||
* This function should be invoked under kernel lock which would disable interrupts.
|
* This function should be invoked under kernel lock which would disable interrupts.
|
||||||
*/
|
*/
|
||||||
void setHardwareUsTimer(int32_t timeUs) {
|
void setHardwareUsTimer(int32_t deltaTimeUs) {
|
||||||
enginePins.debugSetTimer.setValue(1);
|
enginePins.debugSetTimer.setValue(1);
|
||||||
efiAssertVoid(OBD_PCM_Processor_Fault, hwStarted, "HW.started");
|
efiAssertVoid(OBD_PCM_Processor_Fault, hwStarted, "HW.started");
|
||||||
setHwTimerCounter++;
|
setHwTimerCounter++;
|
||||||
/**
|
/**
|
||||||
* #259 BUG error: not positive timeUs
|
* #259 BUG error: not positive deltaTimeUs
|
||||||
* Once in a while we night get an interrupt where we do not expect it
|
* Once in a while we night get an interrupt where we do not expect it
|
||||||
*/
|
*/
|
||||||
if (timeUs <= 0) {
|
if (deltaTimeUs <= 0) {
|
||||||
timerFreezeCounter++;
|
timerFreezeCounter++;
|
||||||
warning(CUSTOM_OBD_LOCAL_FREEZE, "local freeze cnt=%d", timerFreezeCounter);
|
warning(CUSTOM_OBD_LOCAL_FREEZE, "local freeze cnt=%d", timerFreezeCounter);
|
||||||
}
|
}
|
||||||
if (timeUs < 2)
|
if (deltaTimeUs < 2)
|
||||||
timeUs = 2; // for some reason '1' does not really work
|
deltaTimeUs = 2; // for some reason '1' does not really work
|
||||||
efiAssertVoid(CUSTOM_ERR_6681, timeUs > 0, "not positive timeUs");
|
efiAssertVoid(CUSTOM_ERR_6681, deltaTimeUs > 0, "not positive deltaTimeUs");
|
||||||
if (timeUs >= 10 * US_PER_SECOND) {
|
if (deltaTimeUs >= 10 * US_PER_SECOND) {
|
||||||
firmwareError(CUSTOM_ERR_TIMER_OVERFLOW, "setHardwareUsTimer() too long: %d", timeUs);
|
// we are trying to set callback for too far into the future. This does not look right at all
|
||||||
|
firmwareError(CUSTOM_ERR_TIMER_OVERFLOW, "setHardwareUsTimer() too long: %d", deltaTimeUs);
|
||||||
// let's make this look special and NOT toggle enginePins.debugSetTimer
|
// let's make this look special and NOT toggle enginePins.debugSetTimer
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -100,10 +101,10 @@ void setHardwareUsTimer(int32_t timeUs) {
|
||||||
// let's make this look special and NOT toggle enginePins.debugSetTimer
|
// let's make this look special and NOT toggle enginePins.debugSetTimer
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gptStartOneShotI(&GPTDEVICE, timeUs);
|
gptStartOneShotI(&GPTDEVICE, deltaTimeUs);
|
||||||
|
|
||||||
lastSetTimerTimeNt = getTimeNowNt();
|
lastSetTimerTimeNt = getTimeNowNt();
|
||||||
lastSetTimerValue = timeUs;
|
lastSetTimerValue = deltaTimeUs;
|
||||||
isTimerPending = TRUE;
|
isTimerPending = TRUE;
|
||||||
timerRestartCounter++;
|
timerRestartCounter++;
|
||||||
enginePins.debugSetTimer.setValue(0);
|
enginePins.debugSetTimer.setValue(0);
|
||||||
|
|
|
@ -5,8 +5,7 @@
|
||||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SIGNAL_TEMP_H_
|
#pragma once
|
||||||
#define SIGNAL_TEMP_H_
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
|
@ -14,10 +13,9 @@ extern "C"
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
void initMicrosecondTimer(void);
|
void initMicrosecondTimer(void);
|
||||||
void setHardwareUsTimer(int32_t timeUs);
|
void setHardwareUsTimer(int32_t deltaTimeUs);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
#endif /* SIGNAL_TEMP_H_ */
|
|
||||||
|
|
Loading…
Reference in New Issue