2018-12-08 15:11:28 -08:00
|
|
|
/*
|
|
|
|
* global_execution_queue.cpp
|
|
|
|
*
|
|
|
|
* @date Dec 8, 2018
|
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2018
|
|
|
|
*/
|
|
|
|
|
2019-01-08 21:53:54 -08:00
|
|
|
#include "global_execution_queue.h"
|
2018-12-08 15:11:28 -08:00
|
|
|
|
|
|
|
bool_t debugSignalExecutor = false;
|
2019-08-24 23:01:09 -07:00
|
|
|
extern bool verboseMode;
|
2018-12-08 15:11:28 -08:00
|
|
|
|
2019-01-09 04:57:43 -08:00
|
|
|
void TestExecutor::scheduleForLater(scheduling_s *scheduling, int delayUs, schfunc_t callback, void *param) {
|
|
|
|
if (debugSignalExecutor) {
|
|
|
|
printf("scheduleTask %d\r\n", delayUs);
|
|
|
|
}
|
|
|
|
scheduleByTimestamp(scheduling, getTimeNowUs() + delayUs, callback, param);
|
|
|
|
}
|
|
|
|
|
2019-01-09 16:52:01 -08:00
|
|
|
int TestExecutor::executeAll(efitime_t now) {
|
|
|
|
return schedulingQueue.executeAll(now);
|
|
|
|
}
|
2019-01-09 07:17:35 -08:00
|
|
|
|
|
|
|
void TestExecutor::clear() {
|
|
|
|
schedulingQueue.clear();
|
2019-01-08 21:53:54 -08:00
|
|
|
}
|
|
|
|
|
2019-01-09 07:36:35 -08:00
|
|
|
int TestExecutor::size() {
|
|
|
|
return schedulingQueue.size();
|
|
|
|
}
|
|
|
|
|
2019-01-09 13:42:34 -08:00
|
|
|
scheduling_s* TestExecutor::getForUnitTest(int index) {
|
|
|
|
return schedulingQueue.getForUnitText(index);
|
|
|
|
}
|
|
|
|
|
2019-01-09 07:17:35 -08:00
|
|
|
void TestExecutor::scheduleByTimestamp(scheduling_s *scheduling, efitimeus_t timeUs, schfunc_t callback, void *param) {
|
2018-12-08 15:11:28 -08:00
|
|
|
if (debugSignalExecutor) {
|
2019-01-09 04:57:43 -08:00
|
|
|
printf("scheduleByTime %d\r\n", timeUs);
|
2018-12-08 15:11:28 -08:00
|
|
|
}
|
2019-01-09 04:57:43 -08:00
|
|
|
schedulingQueue.insertTask(scheduling, timeUs, callback, param);
|
2018-12-08 15:11:28 -08:00
|
|
|
}
|