diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/chschd.c | 10 | ||||
-rw-r--r-- | src/chsem.c | 1 | ||||
-rw-r--r-- | src/chsleep.c | 13 | ||||
-rw-r--r-- | src/include/scheduler.h | 3 | ||||
-rw-r--r-- | src/include/sleep.h | 3 | ||||
-rw-r--r-- | src/lib/evtimer.h | 10 |
6 files changed, 18 insertions, 22 deletions
diff --git a/src/chschd.c b/src/chschd.c index 7ad33d82f..65a1fd360 100644 --- a/src/chschd.c +++ b/src/chschd.c @@ -25,13 +25,7 @@ #include <ch.h>
/** @cond never*/
-
ReadyList rlist;
-
-#ifdef CH_USE_SYSTEMTIME
-volatile t_time stime;
-#endif
-
/** @endcond */
/**
@@ -44,7 +38,7 @@ void chSchInit(void) { rlist.r_prio = ABSPRIO;
rlist.r_preempt = CH_TIME_QUANTUM;
#ifdef CH_USE_SYSTEMTIME
- stime = 0;
+ rlist.r_stime = 0;
#endif
}
@@ -193,7 +187,7 @@ void chSchTimerHandlerI(void) { rlist.r_preempt--;
#ifdef CH_USE_SYSTEMTIME
- stime++;
+ rlist.r_stime++;
#endif
#ifdef CH_USE_VIRTUAL_TIMERS
diff --git a/src/chsem.c b/src/chsem.c index 6f24b08ec..df783dc7a 100644 --- a/src/chsem.c +++ b/src/chsem.c @@ -113,6 +113,7 @@ void chSemWaitS(Semaphore *sp) { #ifdef CH_USE_SEMAPHORES_TIMEOUT
static void wakeup(void *p) {
+
#ifdef CH_USE_DEBUG
if (((Thread *)p)->p_state != PRWTSEM)
chDbgPanic("chsem.c, wakeup()\r\n");
diff --git a/src/chsleep.c b/src/chsleep.c index e8703ab1a..ae6e394b8 100644 --- a/src/chsleep.c +++ b/src/chsleep.c @@ -25,6 +25,15 @@ #include <ch.h>
#ifdef CH_USE_SLEEP
+static void wakeup(void *p) {
+
+#ifdef CH_USE_DEBUG
+ if (((Thread *)p)->p_state != PRSLEEP)
+ chDbgPanic("chsleep.c, wakeup()\r\n");
+#endif
+ chSchReadyI(p, RDY_OK);
+}
+
/**
* Suspends the invoking thread for the specified time.
* @param time the system ticks number
@@ -34,7 +43,7 @@ void chThdSleep(t_time time) { chSysLock();
- chVTSetI(&vt, time, (t_vtfunc)chSchReadyI, currp);
+ chVTSetI(&vt, time, wakeup, currp);
chSchGoSleepS(PRSLEEP);
chSysUnlock();
@@ -53,7 +62,7 @@ void chThdSleepUntil(t_time time) { chSysLock();
- chVTSetI(&vt, (t_time)(time - stime), (t_vtfunc)chSchReadyI, currp);
+ chVTSetI(&vt, (t_time)(time - rlist.r_stime), wakeup, currp);
chSchGoSleepS(PRSLEEP);
chSysUnlock();
diff --git a/src/include/scheduler.h b/src/include/scheduler.h index 89bc37292..bb70a83af 100644 --- a/src/include/scheduler.h +++ b/src/include/scheduler.h @@ -44,6 +44,9 @@ typedef struct { #ifndef CH_CURRP_REGISTER_CACHE
Thread *r_current;
#endif
+#ifdef CH_USE_SYSTEMTIME
+ volatile t_time r_stime;
+#endif
} ReadyList;
extern ReadyList rlist;
diff --git a/src/include/sleep.h b/src/include/sleep.h index e102a03a5..161842a29 100644 --- a/src/include/sleep.h +++ b/src/include/sleep.h @@ -32,7 +32,6 @@ extern "C" { void chThdSleep(t_time time);
#ifdef CH_USE_SYSTEMTIME
void chThdSleepUntil(t_time time);
- t_time chSysGetTime(void);
#endif /* CH_USE_SYSTEMTIME */
#endif /* CH_USE_SLEEP */
#ifdef __cplusplus
@@ -47,7 +46,7 @@ extern "C" { * @note The function is available only if the \p CH_USE_SYSTEMTIME
* option is enabled in \p chconf.h.
*/
-#define chSysGetTime() stime
+#define chSysGetTime() rlist.r_stime
#endif /* _SLEEP_H_ */
diff --git a/src/lib/evtimer.h b/src/lib/evtimer.h index dfe09f0be..5999563d1 100644 --- a/src/lib/evtimer.h +++ b/src/lib/evtimer.h @@ -50,16 +50,6 @@ extern "C" { (etp)->et_vt.vt_func = NULL, \
(etp)->et_interval = (i))
-/**
- * Registers the invoking thread as listener on the timer event.
- */
-#define evtRegister(etp, el, eid) chEvtRegister(&(etp)->et_es, el, eid)
-
-/**
- * Unregisters the invoking thread as listener on the timer event.
- */
-#define evtUnregister(etp, el) chEvtUnregister(&(etp)->et_es, el)
-
#endif /* _EVTIMER_H_ */
/** @} */
|