From 875c8f368683e77371f75c0b9f1aa18237f118f2 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 15 Oct 2008 18:26:16 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@468 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- src/include/sleep.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src') 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 -- cgit v1.2.3