diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2008-10-15 18:26:16 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2008-10-15 18:26:16 +0000 |
commit | 875c8f368683e77371f75c0b9f1aa18237f118f2 (patch) | |
tree | 960b33a15794765955b8f87d8bdc69eab2a369ef /src | |
parent | e6757ceef9a5d80d1102b6b4215929c719a4b96a (diff) | |
download | ChibiOS-875c8f368683e77371f75c0b9f1aa18237f118f2.tar.gz ChibiOS-875c8f368683e77371f75c0b9f1aa18237f118f2.tar.bz2 ChibiOS-875c8f368683e77371f75c0b9f1aa18237f118f2.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@468 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'src')
-rw-r--r-- | src/include/sleep.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/include/sleep.h b/src/include/sleep.h index 36ba9470a..ac76b3fe8 100644 --- a/src/include/sleep.h +++ b/src/include/sleep.h @@ -25,6 +25,23 @@ #ifndef _SLEEP_H_
#define _SLEEP_H_
+/**
+ * Time conversion utility. Converts from seconds to system ticks number.
+ */
+#define S2ST(sec) ((sec) * CH_FREQUENCY)
+
+/**
+ * Time conversion utility. Converts from milliseconds to system ticks number.
+ * @note The result is rounded upward to the next tick boundary.
+ */
+#define MS2ST(msec) (((((msec) - 1L) * CH_FREQUENCY) / 1000) + 1)
+
+/**
+ * Time conversion utility. Converts from microseconds to system ticks number.
+ * @note The result is rounded upward to the next tick boundary.
+ */
+#define US2ST(usec) (((((usec) - 1L) * CH_FREQUENCY) / 1000000) + 1)
+
#ifdef __cplusplus
extern "C" {
#endif
|