From 7b8d68b2f84fd0ef51e64b13058d550eee5cb53a Mon Sep 17 00:00:00 2001 From: Andrzej Stalke Date: Tue, 7 Nov 2023 16:06:22 +0100 Subject: [PATCH] hal: Rename argument of hal_timerSetWakeup - Reason: The old name `when` is misleadig, since it is time to wait and not a fixed moment in time. Changed it to `waitUs`. JIRA: RTOS-530 --- hal/armv7a/imx6ull/timer.c | 9 +++++---- hal/armv7a/zynq7000/timer.c | 2 +- hal/armv7m/imxrt/timer.c | 8 ++++---- hal/armv7m/stm32/l4/timer.c | 2 +- hal/armv8m/nrf/91/timer.c | 2 +- hal/ia32/timer.c | 2 +- hal/riscv64/timer.c | 2 +- hal/sparcv8leon3/gr716/timer.c | 2 +- hal/timer.h | 2 +- 9 files changed, 16 insertions(+), 15 deletions(-) diff --git a/hal/armv7a/imx6ull/timer.c b/hal/armv7a/imx6ull/timer.c index b747f08ef..93fa4d64c 100644 --- a/hal/armv7a/imx6ull/timer.c +++ b/hal/armv7a/imx6ull/timer.c @@ -87,15 +87,16 @@ static time_t hal_timerGetCyc(void) } -void hal_timerSetWakeup(u32 when) +void hal_timerSetWakeup(u32 waitUs) { spinlock_ctx_t sc; u32 cyc; - if (!when) - ++when; + if (waitUs == 0) { + ++waitUs; + } - cyc = when * 66; + cyc = waitUs * 66; hal_spinlockSet(&timer_common.lock, &sc); *(timer_common.epit1 + epit_lr) = cyc; diff --git a/hal/armv7a/zynq7000/timer.c b/hal/armv7a/zynq7000/timer.c index d96c5fdb7..093575b1c 100644 --- a/hal/armv7a/zynq7000/timer.c +++ b/hal/armv7a/zynq7000/timer.c @@ -90,7 +90,7 @@ static time_t hal_timerGetCyc(void) } -void hal_timerSetWakeup(u32 when) +void hal_timerSetWakeup(u32 waitUs) { } diff --git a/hal/armv7m/imxrt/timer.c b/hal/armv7m/imxrt/timer.c index e1f1d0c17..dd24277ff 100644 --- a/hal/armv7m/imxrt/timer.c +++ b/hal/armv7m/imxrt/timer.c @@ -85,17 +85,17 @@ static time_t hal_timerGetCyc(void) } -void hal_timerSetWakeup(u32 when) +void hal_timerSetWakeup(u32 waitUs) { spinlock_ctx_t sc; - if (when > timer_common.interval) { - when = timer_common.interval; + if (waitUs > timer_common.interval) { + waitUs = timer_common.interval; } hal_spinlockSet(&timer_common.sp, &sc); /* Modulo handled implicitly */ - *(timer_common.base + gpt_ocr2) = hal_timerUs2Cyc(when) + *(timer_common.base + gpt_cnt); + *(timer_common.base + gpt_ocr2) = hal_timerUs2Cyc(waitUs) + *(timer_common.base + gpt_cnt); *(timer_common.base + gpt_sr) |= 1 << 1; hal_cpuDataMemoryBarrier(); hal_spinlockClear(&timer_common.sp, &sc); diff --git a/hal/armv7m/stm32/l4/timer.c b/hal/armv7m/stm32/l4/timer.c index 602c63dcb..c56564f25 100644 --- a/hal/armv7m/stm32/l4/timer.c +++ b/hal/armv7m/stm32/l4/timer.c @@ -192,7 +192,7 @@ void timer_setAlarm(time_t us) } -void hal_timerSetWakeup(u32 when) +void hal_timerSetWakeup(u32 waitUs) { } diff --git a/hal/armv8m/nrf/91/timer.c b/hal/armv8m/nrf/91/timer.c index 2191897c4..5c5908a9d 100644 --- a/hal/armv8m/nrf/91/timer.c +++ b/hal/armv8m/nrf/91/timer.c @@ -68,7 +68,7 @@ static int timer_irqHandler(unsigned int n, cpu_context_t *ctx, void *arg) /* Interface functions */ -void hal_timerSetWakeup(u32 when) +void hal_timerSetWakeup(u32 waitUs) { } diff --git a/hal/ia32/timer.c b/hal/ia32/timer.c index b15f6847d..319e333d3 100644 --- a/hal/ia32/timer.c +++ b/hal/ia32/timer.c @@ -39,7 +39,7 @@ static int timer_irqHandler(unsigned int n, cpu_context_t *ctx, void *arg) return 0; } -void hal_timerSetWakeup(u32 when) +void hal_timerSetWakeup(u32 waitUs) { } diff --git a/hal/riscv64/timer.c b/hal/riscv64/timer.c index 9383177ba..d325685eb 100644 --- a/hal/riscv64/timer.c +++ b/hal/riscv64/timer.c @@ -41,7 +41,7 @@ static int timer_irqHandler(unsigned int n, cpu_context_t *ctx, void *arg) } -void hal_timerSetWakeup(u32 when) +void hal_timerSetWakeup(u32 waitUs) { } diff --git a/hal/sparcv8leon3/gr716/timer.c b/hal/sparcv8leon3/gr716/timer.c index 93b38eb54..8669cfcd6 100644 --- a/hal/sparcv8leon3/gr716/timer.c +++ b/hal/sparcv8leon3/gr716/timer.c @@ -131,7 +131,7 @@ time_t hal_timerGetUs(void) } -void hal_timerSetWakeup(u32 when) +void hal_timerSetWakeup(u32 waitUs) { } diff --git a/hal/timer.h b/hal/timer.h index 369cb02ac..c47a1b48a 100644 --- a/hal/timer.h +++ b/hal/timer.h @@ -23,7 +23,7 @@ extern time_t hal_timerGetUs(void); -extern void hal_timerSetWakeup(u32 when); +extern void hal_timerSetWakeup(u32 waitUs); extern int hal_timerRegister(int (*f)(unsigned int, cpu_context_t *, void *), void *data, intr_handler_t *h);