summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMary Ruthven <mruthven@chromium.org>2021-11-09 14:24:24 -0600
committerCommit Bot <commit-bot@chromium.org>2021-11-18 04:48:22 +0000
commit7d137985d47daa4ab91da3242ad66c016b88b39c (patch)
tree3f020f2fed94c08dca88524fa3e895ff41bcd12a
parentc10d4d86a7671be740b008e3935d401c5a1ef682 (diff)
downloadchrome-ec-7d137985d47daa4ab91da3242ad66c016b88b39c.tar.gz
Revert "motion sense: Calculate loop time based on sensor needs"
This reverts commit 0c71c4748699f5f2cb1423ffc07d4c852d04b3fc. BUG=b:200823466 TEST=make buildall -j Change-Id: Ie9e748eb3e726334c16dc7bc2302e14b9a7900f4 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3273387 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
-rw-r--r--include/timer.h29
1 files changed, 9 insertions, 20 deletions
diff --git a/include/timer.h b/include/timer.h
index 89a49762ae..8d569a35e9 100644
--- a/include/timer.h
+++ b/include/timer.h
@@ -134,23 +134,6 @@ void force_time(timestamp_t ts);
void timer_print_info(void);
/**
- * Returns a free running millisecond clock counter, which matches tpm2
- * library expectations.
- */
-clock_t clock(void);
-
-/**
- * Compute how far to_time is from from_time with rollover taken into account
- *
- * Return us until to_time given from_time, if negative then to_time has
- * passeed from_time.
- */
-static inline int time_until(uint32_t from_time, uint32_t to_time)
-{
- return (int32_t)(to_time - from_time);
-}
-
-/**
* Returns the number of microseconds that have elapsed from a start time.
*
* This function is for timing short delays typically of a few milliseconds
@@ -160,21 +143,27 @@ static inline int time_until(uint32_t from_time, uint32_t to_time)
* hour. After that, the value returned will wrap.
*
* @param start Start time to compare against
- * @return number of microseconds that have elapsed since that start time
+ * @return number of microseconds that have elspsed since that start time
*/
static inline unsigned time_since32(timestamp_t start)
{
- return time_until(start.le.lo, get_time().le.lo);
+ return get_time().le.lo - start.le.lo;
}
/**
+ * Returns a free running millisecond clock counter, which matches tpm2
+ * library expectations.
+ */
+clock_t clock(void);
+
+/**
* To compare time and deal with rollover
*
* Return true if a is after b.
*/
static inline int time_after(uint32_t a, uint32_t b)
{
- return time_until(a, b) < 0;
+ return (int32_t)(b - a) < 0;
}
#endif /* __CROS_EC_TIMER_H */