auto-sync

This commit is contained in:
rusEfi 2014-09-13 07:02:58 -05:00
parent 1657285925
commit 648f115704
6 changed files with 18 additions and 18 deletions

View File

@ -333,6 +333,7 @@ void setMiata1996(engine_configuration_s *engineConfiguration, board_configurati
boardConfiguration->ignitionPinMode = OM_DEFAULT;
// harness is sequential but we have a limited board
engineConfiguration->crankingInjectionMode = IM_BATCH;
engineConfiguration->injectionMode = IM_BATCH;
boardConfiguration->injectionPins[0] = GPIOB_9; // Frankenstein: low side - inj #12

View File

@ -43,12 +43,20 @@ void Executor::unlock(void) {
unlockAnyContext();
}
void Executor::schedule(scheduling_s *scheduling, uint64_t nowUs, int delayUs, schfunc_t callback, void *param) {
void Executor::schedule(const char *prefix, scheduling_s *scheduling, uint64_t nowUs, int delayUs, schfunc_t callback, void *param) {
if (delayUs < 0) {
firmwareError("Negative delayUs %s: %d", prefix, delayUs);
return;
}
if (delayUs == 0) {
callback(param);
return;
}
if (!reentrantLock) {
// this would guard the queue and disable interrupts
lock();
}
queue.insertTask(scheduling, nowUs, delayUs, callback, param);
queue.insertTask(scheduling, nowUs + delayUs, callback, param);
if (!reentrantLock) {
doExecute(nowUs);
unlock();
@ -97,15 +105,7 @@ void Executor::doExecute(uint64_t nowUs) {
* @param [in] dwell the number of ticks of output duration.
*/
void scheduleTask(const char *prefix, scheduling_s *scheduling, int delayUs, schfunc_t callback, void *param) {
if (delayUs < 0) {
firmwareError("Negative delayUs %s: %d", prefix, delayUs);
return;
}
if (delayUs == 0) {
callback(param);
return;
}
instance.schedule(scheduling, getTimeNowUs(), delayUs, callback, param);
instance.schedule(prefix, scheduling, getTimeNowUs(), delayUs, callback, param);
}
void initSignalExecutorImpl(void) {

View File

@ -14,7 +14,7 @@
class Executor {
public:
Executor();
void schedule(scheduling_s *scheduling, uint64_t nowUs, int delayUs, schfunc_t callback, void *param);
void schedule(const char *prefix, scheduling_s *scheduling, uint64_t nowUs, int delayUs, schfunc_t callback, void *param);
void execute(uint64_t nowUs);
private:
EventQueue queue;

View File

@ -22,16 +22,16 @@ bool EventQueue::checkIfPending(scheduling_s *scheduling) {
return assertNotInList<scheduling_s>(head, scheduling);
}
void EventQueue::insertTask(scheduling_s *scheduling, uint64_t nowUs, int delayUs, schfunc_t callback, void *param) {
void EventQueue::insertTask(scheduling_s *scheduling, uint64_t timeUs, schfunc_t callback, void *param) {
if (callback == NULL)
firmwareError("NULL callback");
uint64_t time = nowUs + delayUs;
int alreadyPending = checkIfPending(scheduling);
if (alreadyPending || hasFirmwareError())
return;
scheduling->momentUs = time;
scheduling->momentUs = timeUs;
scheduling->callback = callback;
scheduling->param = param;

View File

@ -38,8 +38,7 @@ class EventQueue {
public:
EventQueue();
// void insertTask(scheduling_s *scheduling, int delayUs, schfunc_t callback, void *param);
void insertTask(scheduling_s *scheduling, uint64_t nowUs, int delayUs, schfunc_t callback, void *param);
void insertTask(scheduling_s *scheduling, uint64_t timeUs, schfunc_t callback, void *param);
void executeAll(uint64_t now);

View File

@ -235,5 +235,5 @@ void firmwareError(const char *fmt, ...) {
}
int getRusEfiVersion(void) {
return 20140912;
return 20140913;
}