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-27 16:48:10 +0000
commitf11b31e9125a24b47d551f81f8d5ec92f5f17173 (patch)
treeabf7ddc7d042139adff37e47a90416dd12c2e07b
parent03328f1087025caa68f410763f87bbb131d377c9 (diff)
downloadchrome-ec-f11b31e9125a24b47d551f81f8d5ec92f5f17173.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>
-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 */