aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/chschd.c2
-rw-r--r--src/chsleep.c13
-rw-r--r--src/include/scheduler.h2
-rw-r--r--src/include/sleep.h10
4 files changed, 12 insertions, 15 deletions
diff --git a/src/chschd.c b/src/chschd.c
index c30040520..c88a63ead 100644
--- a/src/chschd.c
+++ b/src/chschd.c
@@ -34,7 +34,7 @@ Thread *currp;
#endif
#ifdef CH_USE_SYSTEMTIME
-t_time stime;
+volatile t_time stime;
#endif
/** @endcond */
diff --git a/src/chsleep.c b/src/chsleep.c
index 6c8cfc3c3..e8703ab1a 100644
--- a/src/chsleep.c
+++ b/src/chsleep.c
@@ -42,19 +42,6 @@ void chThdSleep(t_time time) {
#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 return 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.
- */
-t_time chSysGetTime(void) {
-
- return stime;
-}
-
-/**
* Suspends the invoking thread until the system time arrives to the specified
* value.
* @param time the system time
diff --git a/src/include/scheduler.h b/src/include/scheduler.h
index fccbfb446..12393e0db 100644
--- a/src/include/scheduler.h
+++ b/src/include/scheduler.h
@@ -78,7 +78,7 @@ extern Thread *currp;
* instead. Direct use of system global variables is discouraged because
* portability reasons.
*/
-extern t_time stime;
+extern volatile t_time stime;
#endif /* _SCHEDULER_H_ */
diff --git a/src/include/sleep.h b/src/include/sleep.h
index e3fa2ffda..e102a03a5 100644
--- a/src/include/sleep.h
+++ b/src/include/sleep.h
@@ -39,6 +39,16 @@ extern "C" {
}
#endif
+/**
+ * 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() stime
+
#endif /* _SLEEP_H_ */
/** @} */