summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMary Ruthven <mruthven@chromium.org>2023-04-26 12:42:38 -0500
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-04-28 21:30:52 +0000
commitd21cc27bef05ad8aa6a8ae58e7debb236ad40ece (patch)
tree486edd9a7a653a5188f330d95c54d8d71b20e922
parent678681cc738c8f16825b9d5b11999fd8b91598a4 (diff)
downloadchrome-ec-d21cc27bef05ad8aa6a8ae58e7debb236ad40ece.tar.gz
hwtimer: define MAX_TIME_USEC
0xffffffff is the maximum source time. Define a constant and use it everywhere the source time is referenced. BUG=b:262036852 TEST=none Change-Id: I788515261ec8a1e810cc1fa1983ee348dbe091c4 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4481392 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> (cherry picked from commit f11b31e9125a24b47d551f81f8d5ec92f5f17173) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4491106 Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r--chip/g/hwtimer.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/chip/g/hwtimer.c b/chip/g/hwtimer.c
index 0e0251ca39..fe5db33858 100644
--- a/chip/g/hwtimer.c
+++ b/chip/g/hwtimer.c
@@ -31,7 +31,8 @@
* equivalent of approximately 0xffffffff usecs. Note that we lose 3us on
* timer wrap due to loss of precision during division.
*/
-#define TIMELS_MAX (usecs_to_ticks(0xffffffff))
+#define MAX_TIME_USEC 0xffffffff
+#define TIMELS_MAX (usecs_to_ticks(MAX_TIME_USEC))
/*
* The below calculation is lightweight and can be implemented using
@@ -114,7 +115,7 @@ uint32_t __hw_clock_source_read(void)
void __hw_clock_source_set(uint32_t ts)
{
- GREG32(TIMELS, SOURCE(LOAD)) = usecs_to_ticks(0xffffffff - ts);
+ GREG32(TIMELS, SOURCE(LOAD)) = usecs_to_ticks(MAX_TIME_USEC - ts);
}
/* This handles rollover in the HW timer */