auto-sync

This commit is contained in:
rusEfi 2014-11-17 18:03:26 -06:00
parent dd21201d57
commit 70e120d6dc
2 changed files with 11 additions and 9 deletions

View File

@ -27,13 +27,13 @@ static Executor instance;
extern schfunc_t globalTimerCallback; extern schfunc_t globalTimerCallback;
static int timerIsLate = 0; //static int timerIsLate = 0;
//static uint64_t callbackTime = 0;
/** /**
* these fields are global in order to facilitate debugging * these fields are global in order to facilitate debugging
*/ */
static uint64_t nextEventTimeNt = 0; static uint64_t nextEventTimeNt = 0;
static uint64_t hwAlarmTime = 0; static uint64_t hwAlarmTime = 0;
static uint64_t callbackTime = 0;
static void executorCallback(void *arg) { static void executorCallback(void *arg) {
(void)arg; (void)arg;
@ -60,7 +60,7 @@ void Executor::unlock(void) {
unlockAnyContext(); unlockAnyContext();
} }
void Executor::schedule2(const char *prefix, scheduling_s *scheduling, uint64_t timeUs, schfunc_t callback, void Executor::schedule2(scheduling_s *scheduling, uint64_t timeUs, schfunc_t callback,
void *param) { void *param) {
// if (delayUs < 0) { // if (delayUs < 0) {
// firmwareError("Negative delayUs %s: %d", prefix, delayUs); // firmwareError("Negative delayUs %s: %d", prefix, delayUs);
@ -81,9 +81,9 @@ void Executor::schedule2(const char *prefix, scheduling_s *scheduling, uint64_t
} }
} }
void Executor::schedule(const char *prefix, scheduling_s *scheduling, uint64_t nowUs, int delayUs, schfunc_t callback, void Executor::schedule(scheduling_s *scheduling, uint64_t nowUs, int delayUs, schfunc_t callback,
void *param) { void *param) {
schedule2(prefix, scheduling, nowUs + delayUs, callback, param); schedule2(scheduling, nowUs + delayUs, callback, param);
} }
void Executor::onTimerCallback() { void Executor::onTimerCallback() {
@ -145,11 +145,13 @@ void Executor::doExecute() {
* @param [in] dwell the number of ticks of output duration. * @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) { void scheduleTask(const char *prefix, scheduling_s *scheduling, int delayUs, schfunc_t callback, void *param) {
instance.schedule(prefix, scheduling, getTimeNowUs(), delayUs, callback, param); scheduling->name = prefix;
instance.schedule(scheduling, getTimeNowUs(), delayUs, callback, param);
} }
void scheduleTask2(const char *prefix, scheduling_s *scheduling, uint64_t time, schfunc_t callback, void *param) { void scheduleTask2(const char *prefix, scheduling_s *scheduling, uint64_t time, schfunc_t callback, void *param) {
instance.schedule2(prefix, scheduling, time, callback, param); scheduling->name = prefix;
instance.schedule2(scheduling, time, callback, param);
} }
void initSignalExecutorImpl(void) { void initSignalExecutorImpl(void) {

View File

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