fix #698
This commit is contained in:
parent
fb3d06aebf
commit
830e733053
|
@ -42,6 +42,7 @@ See https://rusefi.com/forum/viewtopic.php?f=5&t=9
|
||||||
|
|
||||||
| Release date | Revision | Details |
|
| Release date | Revision | Details |
|
||||||
| ------------ | --------- | ------- |
|
| ------------ | --------- | ------- |
|
||||||
|
| 02/27/2019 | r16886 | bugfix #698: concurrency defect with single timer executor initialization |
|
||||||
| 02/23/2019 | r16857 | improvement #688: better support for 144 and 176 pin packages |
|
| 02/23/2019 | r16857 | improvement #688: better support for 144 and 176 pin packages |
|
||||||
| 02/05/2019 | r16713 | improvement #631: ChibiOS 18 |
|
| 02/05/2019 | r16713 | improvement #631: ChibiOS 18 |
|
||||||
| 01/11/2019 | r16346 | bugfix #663: SPI fixes for CJ125 for stm32 errata STM32f405/7/15/17 |
|
| 01/11/2019 | r16346 | bugfix #663: SPI fixes for CJ125 for stm32 errata STM32f405/7/15/17 |
|
||||||
|
|
|
@ -48,7 +48,6 @@ InjectionSignalPair::InjectionSignalPair() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void initSignalExecutor(void) {
|
void initSignalExecutor(void) {
|
||||||
initSignalExecutorImpl();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if FUEL_MATH_EXTREME_LOGGING
|
#if FUEL_MATH_EXTREME_LOGGING
|
||||||
|
|
|
@ -156,7 +156,7 @@ void SingleTimerExecutor::scheduleTimerCallback() {
|
||||||
hwSetTimerDuration = GET_TIMESTAMP() - beforeHwSetTimer;
|
hwSetTimerDuration = GET_TIMESTAMP() - beforeHwSetTimer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void initSignalExecutorImpl(void) {
|
void initSingleTimerExecutorHardware(void) {
|
||||||
globalTimerCallback = executorCallback;
|
globalTimerCallback = executorCallback;
|
||||||
initMicrosecondTimer();
|
initMicrosecondTimer();
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ private:
|
||||||
void scheduleTimerCallback();
|
void scheduleTimerCallback();
|
||||||
};
|
};
|
||||||
|
|
||||||
void initSignalExecutorImpl(void);
|
void initSingleTimerExecutorHardware(void);
|
||||||
void executorStatistics();
|
void executorStatistics();
|
||||||
|
|
||||||
#endif /* SINGLETIMEREXECUTOR_H_ */
|
#endif /* SINGLETIMEREXECUTOR_H_ */
|
||||||
|
|
|
@ -91,8 +91,4 @@ void SleepExecutor::scheduleForLater(scheduling_s *scheduling, int delayUs, schf
|
||||||
doScheduleForLater(scheduling, delayUs, callback, param);
|
doScheduleForLater(scheduling, delayUs, callback, param);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initSignalExecutorImpl(void) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* EFI_SIGNAL_EXECUTOR_SLEEP */
|
#endif /* EFI_SIGNAL_EXECUTOR_SLEEP */
|
||||||
|
|
|
@ -375,6 +375,9 @@ void initHardware(Logging *l) {
|
||||||
resetConfigurationExt(sharedLogger, engineConfiguration->engineType PASS_ENGINE_PARAMETER_SUFFIX);
|
resetConfigurationExt(sharedLogger, engineConfiguration->engineType PASS_ENGINE_PARAMETER_SUFFIX);
|
||||||
#endif /* EFI_INTERNAL_FLASH */
|
#endif /* EFI_INTERNAL_FLASH */
|
||||||
|
|
||||||
|
// it's important to initialize this pretty early in the game before any scheduling usages
|
||||||
|
initSingleTimerExecutorHardware();
|
||||||
|
|
||||||
#if EFI_HD44780_LCD
|
#if EFI_HD44780_LCD
|
||||||
// initI2Cmodule();
|
// initI2Cmodule();
|
||||||
lcd_HD44780_init(sharedLogger);
|
lcd_HD44780_init(sharedLogger);
|
||||||
|
|
|
@ -48,6 +48,7 @@ static char buff[32];
|
||||||
|
|
||||||
static int timerFreezeCounter = 0;
|
static int timerFreezeCounter = 0;
|
||||||
static volatile int setHwTimerCounter = 0;
|
static volatile int setHwTimerCounter = 0;
|
||||||
|
static volatile bool hwStarted = false;
|
||||||
|
|
||||||
extern bool hasFirmwareErrorFlag;
|
extern bool hasFirmwareErrorFlag;
|
||||||
|
|
||||||
|
@ -56,6 +57,7 @@ extern bool hasFirmwareErrorFlag;
|
||||||
* 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 timeUs) {
|
||||||
|
efiAssertVoid(OBD_PCM_Processor_Fault, hwStarted, "HW.started");
|
||||||
setHwTimerCounter++;
|
setHwTimerCounter++;
|
||||||
/**
|
/**
|
||||||
* #259 BUG error: not positive timeUs
|
* #259 BUG error: not positive timeUs
|
||||||
|
@ -99,15 +101,6 @@ static void hwTimerCallback(GPTDriver *gptp) {
|
||||||
}
|
}
|
||||||
isTimerPending = false;
|
isTimerPending = false;
|
||||||
|
|
||||||
// // test code
|
|
||||||
// setOutputPinValue(LED_CRANKING, timerCallbackCounter % 2);
|
|
||||||
// int mod = timerCallbackCounter % 400;
|
|
||||||
// chSysLockFromISR()
|
|
||||||
// ;
|
|
||||||
// setHardwareUsTimer(400 - mod);
|
|
||||||
// chSysUnlockFromISR()
|
|
||||||
// ;
|
|
||||||
|
|
||||||
uint32_t before = GET_TIMESTAMP();
|
uint32_t before = GET_TIMESTAMP();
|
||||||
globalTimerCallback(NULL);
|
globalTimerCallback(NULL);
|
||||||
uint32_t precisionCallbackDuration = GET_TIMESTAMP() - before;
|
uint32_t precisionCallbackDuration = GET_TIMESTAMP() - before;
|
||||||
|
@ -116,7 +109,6 @@ static void hwTimerCallback(GPTDriver *gptp) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class MicrosecondTimerWatchdogController : public PeriodicController<UTILITY_THREAD_STACK_SIZE>
|
class MicrosecondTimerWatchdogController : public PeriodicController<UTILITY_THREAD_STACK_SIZE>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -151,18 +143,12 @@ void initMicrosecondTimer(void) {
|
||||||
|
|
||||||
gptStart(&GPTDEVICE, &gpt5cfg);
|
gptStart(&GPTDEVICE, &gpt5cfg);
|
||||||
efiAssertVoid(CUSTOM_ERR_TIMER_STATE, GPTDEVICE.state == GPT_READY, "hw state");
|
efiAssertVoid(CUSTOM_ERR_TIMER_STATE, GPTDEVICE.state == GPT_READY, "hw state");
|
||||||
|
hwStarted = true;
|
||||||
|
|
||||||
lastSetTimerTimeNt = getTimeNowNt();
|
lastSetTimerTimeNt = getTimeNowNt();
|
||||||
#if EFI_EMULATE_POSITION_SENSORS
|
#if EFI_EMULATE_POSITION_SENSORS
|
||||||
watchdogControllerInstance.Start();
|
watchdogControllerInstance.Start();
|
||||||
#endif /* EFI_ENGINE_EMULATOR */
|
#endif /* EFI_ENGINE_EMULATOR */
|
||||||
|
|
||||||
// // test code
|
|
||||||
// chSysLock()
|
|
||||||
// ;
|
|
||||||
// setHardwareUsTimer(300);
|
|
||||||
// chSysUnlock()
|
|
||||||
// ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
// This file was generated by Version2Header
|
// This file was generated by Version2Header
|
||||||
// Sat Feb 23 08:50:46 EST 2019
|
// Wed Feb 27 16:59:18 EST 2019
|
||||||
|
|
||||||
|
|
||||||
#ifndef GIT_HASH
|
#ifndef GIT_HASH
|
||||||
#define GIT_HASH "f3b64f5227a4160df076bc68d2c29094b185bfa5"
|
#define GIT_HASH "fb3d06aebfa19ceedc3619f50158fed13e7feadd"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef VCS_VERSION
|
#ifndef VCS_VERSION
|
||||||
#define VCS_VERSION "16857"
|
#define VCS_VERSION "16886"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -43,7 +43,3 @@ void TestExecutor::scheduleByTimestamp(scheduling_s *scheduling, efitimeus_t tim
|
||||||
}
|
}
|
||||||
schedulingQueue.insertTask(scheduling, timeUs, callback, param);
|
schedulingQueue.insertTask(scheduling, timeUs, callback, param);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initSignalExecutorImpl(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue