aboutsummaryrefslogtreecommitdiffstats
path: root/wirish/time.h
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@mit.edu>2010-09-13 13:32:01 -0400
committerMarti Bolivar <mbolivar@mit.edu>2010-09-13 13:32:01 -0400
commitee5667f54d76022beec4584ccf50879c68361a33 (patch)
tree555d9c15d11f5d56fa675e4dda0a930013cd00a9 /wirish/time.h
parent5bfeb40e4795eb5cf21ea84311936acf97969365 (diff)
downloadlibrambutan-ee5667f54d76022beec4584ccf50879c68361a33.tar.gz
librambutan-ee5667f54d76022beec4584ccf50879c68361a33.zip
bugfix MAPLE_RELOAD_VAL, whitespace fixes
Diffstat (limited to 'wirish/time.h')
-rw-r--r--wirish/time.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/wirish/time.h b/wirish/time.h
index f73d133..ad39057 100644
--- a/wirish/time.h
+++ b/wirish/time.h
@@ -23,7 +23,7 @@
* ****************************************************************************/
/**
- * @brief
+ * @brief
*/
#ifndef _TIME_H
@@ -59,7 +59,10 @@ static inline uint32 micros(void) {
nvic_globalirq_enable();
- res = (ms * US_PER_MS) + (MAPLE_RELOAD_VAL - cycle_cnt)/CYCLES_PER_MICROSECOND;
+ /* MAPLE_RELOAD_VAL is 1 less than the number of cycles it actually
+ takes to complete a systick reload */
+ res = (ms * US_PER_MS) +
+ (MAPLE_RELOAD_VAL + 1 - cycle_cnt)/CYCLES_PER_MICROSECOND;
return res;
}