diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-08-07 18:00:38 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-08-07 18:00:38 -0600 |
commit | f4f8030be0af79250de05d323106dd34a5e7dc85 (patch) | |
tree | ac6ac62508e391422efee525bc3c438206e31259 /nuttx/include/nuttx/clock.h | |
parent | f39ae5a8b656f320d99f391972e8b81a8c2d52fd (diff) | |
download | nuttx-f4f8030be0af79250de05d323106dd34a5e7dc85.tar.gz nuttx-f4f8030be0af79250de05d323106dd34a5e7dc85.tar.bz2 nuttx-f4f8030be0af79250de05d323106dd34a5e7dc85.zip |
Change all time conversions. Yech. New timer units in microseconds breaks all existing logic that used milliseconds in the conversions. Something likely got broken doing this, probably because I confused a MSEC2TICK conversion with a TICK2MSEC conversion. Also, the tickless OS no appears fully functional and passes the OS test on the simulator with no errors
Diffstat (limited to 'nuttx/include/nuttx/clock.h')
-rw-r--r-- | nuttx/include/nuttx/clock.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/nuttx/include/nuttx/clock.h b/nuttx/include/nuttx/clock.h index 509d624d2..fcd8c5c58 100644 --- a/nuttx/include/nuttx/clock.h +++ b/nuttx/include/nuttx/clock.h @@ -115,13 +115,12 @@ #define TICK_PER_DSEC (USEC_PER_DSEC / USEC_PER_TICK) /* Truncates! */ #define TICK_PER_SEC (USEC_PER_SEC / USEC_PER_TICK) /* Truncates! */ -#define MSEC_PER_TICK (USEC_PER_MSEC / USEC_PER_TICK) /* Truncates! */ +#define TICK_PER_MSEC (USEC_PER_MSEC / USEC_PER_TICK) /* Truncates! */ +#define MSEC_PER_TICK (USEC_PER_TICK / USEC_PER_MSEC) /* Truncates! */ #define NSEC_PER_TICK (USEC_PER_TICK * NSEC_PER_USEC) /* Exact */ #define NSEC2TICK(nsec) (((nsec)+(NSEC_PER_TICK/2))/NSEC_PER_TICK) /* Rounds */ #define USEC2TICK(usec) (((usec)+(USEC_PER_TICK/2))/USEC_PER_TICK) /* Rounds */ -#define DSEC2TICK(dsec) MSEC2TICK((dsec)*MSEC_PER_DSEC) /* Exact */ -#define SEC2TICK(sec) MSEC2TICK((sec)*MSEC_PER_SEC) /* Exact */ #if (MSEC_PER_TICK * USEC_PER_MSEC) == USEC_PER_TICK # define MSEC2TICK(msec) (((msec)+(MSEC_PER_TICK/2))/MSEC_PER_TICK) /* Rounds */ @@ -129,10 +128,11 @@ # define MSEC2TICK(msec) USEC2TICK(msec * 1000) /* Rounds */ #endif +#define DSEC2TICK(dsec) MSEC2TICK((dsec)*MSEC_PER_DSEC) /* Exact */ +#define SEC2TICK(sec) MSEC2TICK((sec)*MSEC_PER_SEC) /* Exact */ + #define TICK2NSEC(tick) ((tick)*NSEC_PER_TICK) /* Exact */ #define TICK2USEC(tick) ((tick)*USEC_PER_TICK) /* Exact */ -#define TICK2DSEC(tick) (((tick)+(TICK_PER_DSEC/2))/TICK_PER_DSEC) /* Rounds */ -#define TICK2SEC(tick) (((tick)+(TICK_PER_SEC/2))/TICK_PER_SEC) /* Rounds */ #if (MSEC_PER_TICK * USEC_PER_MSEC) == USEC_PER_TICK #define TICK2USEC(tick) ((tick)*MSEC_PER_TICK) /* Exact */ @@ -140,6 +140,9 @@ # define TICK2MSEC(tick) (((tick)*USEC_PER_TICK)/USEC_PER_MSEC) /* Rounds */ #endif +#define TICK2DSEC(tick) (((tick)+(TICK_PER_DSEC/2))/TICK_PER_DSEC) /* Rounds */ +#define TICK2SEC(tick) (((tick)+(TICK_PER_SEC/2))/TICK_PER_SEC) /* Rounds */ + /**************************************************************************** * Public Types ****************************************************************************/ |