diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/delta.h | 40 | ||||
-rw-r--r-- | src/include/scheduler.h | 3 | ||||
-rw-r--r-- | src/include/sleep.h | 12 |
3 files changed, 21 insertions, 34 deletions
diff --git a/src/include/delta.h b/src/include/delta.h index 4d59c1a73..4d1c9ac23 100644 --- a/src/include/delta.h +++ b/src/include/delta.h @@ -25,8 +25,6 @@ #ifndef _DELTA_H_
#define _DELTA_H_
-#ifdef CH_USE_VIRTUAL_TIMERS
-
/** Virtual Timer callback function.*/
typedef void (*vtfunc_t)(void *);
@@ -37,17 +35,17 @@ typedef struct VirtualTimer VirtualTimer; * @extends DeltaList
*/
struct VirtualTimer {
- /** Next timer in the delta list.*/
- VirtualTimer *vt_next;
- /** Previous timer in the delta list.*/
- VirtualTimer *vt_prev;
- /** Time delta before timeout.*/
- systime_t vt_dtime;
- /** Timer callback function pointer. The pointer is reset to zero after
- the callback is invoked.*/
- vtfunc_t vt_func;
- /** Timer callback function parameter.*/
- void *vt_par;
+ /** Next timer in the delta list.*/
+ VirtualTimer *vt_next;
+ /** Previous timer in the delta list.*/
+ VirtualTimer *vt_prev;
+ /** Time delta before timeout.*/
+ systime_t vt_dtime;
+ /** Timer callback function pointer. The pointer is reset to zero after
+ the callback is invoked.*/
+ vtfunc_t vt_func;
+ /** Timer callback function parameter.*/
+ void *vt_par;
};
/**
@@ -57,17 +55,19 @@ struct VirtualTimer { * is often used in the code.
*/
typedef struct {
- /** Next timer in the list (the one that will be triggered next).*/
- VirtualTimer *dl_next;
- /** Last timer in the list.*/
- VirtualTimer *dl_prev;
- /** Not used but it must be set to -1.*/
- systime_t dl_dtime;
+ /** Next timer in the list (the one that will be triggered next).*/
+ VirtualTimer *dl_next;
+ /** Last timer in the list.*/
+ VirtualTimer *dl_prev;
+ /** Not used but it must be set to -1.*/
+ systime_t dl_dtime;
+ volatile systime_t dl_stime;
} DeltaList;
extern DeltaList dlist;
#define chVTDoTickI() { \
+ dlist.dl_stime++; \
if (&dlist != (DeltaList *)dlist.dl_next) { \
VirtualTimer *vtp; \
\
@@ -100,8 +100,6 @@ extern "C" { /** Returns TRUE if the speciified timer is armed.*/
#define chVTIsArmedI(vtp) ((vtp)->vt_func != NULL)
-#endif /* CH_USE_VIRTUAL_TIMER */
-
#endif /* _DELTA_H_ */
/** @} */
diff --git a/src/include/scheduler.h b/src/include/scheduler.h index 362dd9d31..3f9eb7a39 100644 --- a/src/include/scheduler.h +++ b/src/include/scheduler.h @@ -48,9 +48,6 @@ typedef struct { /** the currently running thread */ Thread *r_current; #endif -#ifdef CH_USE_SYSTEMTIME - volatile systime_t r_stime; -#endif } ReadyList; extern ReadyList rlist; diff --git a/src/include/sleep.h b/src/include/sleep.h index 109d9d072..faed26109 100644 --- a/src/include/sleep.h +++ b/src/include/sleep.h @@ -46,29 +46,22 @@ extern "C" {
#endif
void chThdSleep(systime_t time);
-#ifdef CH_USE_SYSTEMTIME
-bool_t chSysInTimeWindow(systime_t start, systime_t end);
-#endif /* CH_USE_SYSTEMTIME */
+ bool_t chSysInTimeWindow(systime_t start, systime_t end);
#ifdef __cplusplus
}
#endif
-#ifdef CH_USE_SYSTEMTIME
/**
* Returns the number of system ticks since the \p chSysInit() invocation.
* @return the system ticks number
* @note The counter can reach its maximum and then returns to zero.
* @note This function is designed to work with the \p chThdSleepUntil().
- * @note The function is available only if the \p CH_USE_SYSTEMTIME
- * option is enabled in \p chconf.h.
*/
-#define chSysGetTime() rlist.r_stime
+#define chSysGetTime() dlist.dl_stime
/**
* Suspends the invoking thread until the system time arrives to the specified
* value.
- * @note The function is available only if the \p CH_USE_SYSTEMTIME
- * option is enabled in \p chconf.h.
*/
#define chThdSleepUntil(t) { \
chSysLock(); \
@@ -76,7 +69,6 @@ bool_t chSysInTimeWindow(systime_t start, systime_t end); (systime_t)((t) - chSysGetTime())); \
chSysUnlock(); \
}
-#endif /* CH_USE_SYSTEMTIME */
#endif /* _SLEEP_H_ */
|