From 5c90ceb105ce80647b56c899eb24e5ae0b4442af Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Sat, 13 Mar 2021 08:19:53 -0500 Subject: [PATCH] clock: rename z_tick_get_32 -> sys_clock_tick_get_32 Do not use z_ for internal APIs, z_ is for private APIs within one subsystem only. Signed-off-by: Anas Nashif --- include/sys_clock.h | 4 +-- kernel/sched.c | 4 +-- kernel/timeout.c | 2 +- lib/cmsis_rtos_v2/kernel.c | 4 +-- tests/kernel/context/src/main.c | 36 +++++++++---------- .../fpu_sharing/generic/src/load_store.c | 4 +-- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/include/sys_clock.h b/include/sys_clock.h index c6c0f4bcc42..e4d901fff58 100644 --- a/include/sys_clock.h +++ b/include/sys_clock.h @@ -175,7 +175,7 @@ extern void z_enable_sys_clock(void); * @return the current system tick count * */ -uint32_t z_tick_get_32(void); +uint32_t sys_clock_tick_get_32(void); /** * @@ -188,7 +188,7 @@ int64_t z_tick_get(void); #ifndef CONFIG_SYS_CLOCK_EXISTS #define z_tick_get() (0) -#define z_tick_get_32() (0) +#define sys_clock_tick_get_32() (0) #endif uint64_t z_timeout_end_calc(k_timeout_t timeout); diff --git a/kernel/sched.c b/kernel/sched.c index a361ea1b242..99d76887a10 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -1233,7 +1233,7 @@ static int32_t z_tick_sleep(k_ticks_t ticks) k_timeout_t timeout = Z_TIMEOUT_TICKS(ticks); - expected_wakeup_ticks = ticks + z_tick_get_32(); + expected_wakeup_ticks = ticks + sys_clock_tick_get_32(); k_spinlock_key_t key = k_spin_lock(&sched_spinlock); @@ -1248,7 +1248,7 @@ static int32_t z_tick_sleep(k_ticks_t ticks) __ASSERT(!z_is_thread_state_set(_current, _THREAD_SUSPENDED), ""); - ticks = (k_ticks_t)expected_wakeup_ticks - z_tick_get_32(); + ticks = (k_ticks_t)expected_wakeup_ticks - sys_clock_tick_get_32(); if (ticks > 0) { return ticks; } diff --git a/kernel/timeout.c b/kernel/timeout.c index 79262db5700..2e0179bd7d4 100644 --- a/kernel/timeout.c +++ b/kernel/timeout.c @@ -275,7 +275,7 @@ int64_t z_tick_get(void) return t; } -uint32_t z_tick_get_32(void) +uint32_t sys_clock_tick_get_32(void) { #ifdef CONFIG_TICKLESS_KERNEL return (uint32_t)z_tick_get(); diff --git a/lib/cmsis_rtos_v2/kernel.c b/lib/cmsis_rtos_v2/kernel.c index ed6d5fb85ba..2dbd0346412 100644 --- a/lib/cmsis_rtos_v2/kernel.c +++ b/lib/cmsis_rtos_v2/kernel.c @@ -9,7 +9,7 @@ #include #include -extern uint32_t z_tick_get_32(void); +extern uint32_t sys_clock_tick_get_32(void); /** * @brief Get RTOS Kernel Information. @@ -89,7 +89,7 @@ int32_t osKernelRestoreLock(int32_t lock) */ uint32_t osKernelGetTickCount(void) { - return z_tick_get_32(); + return sys_clock_tick_get_32(); } /** diff --git a/tests/kernel/context/src/main.c b/tests/kernel/context/src/main.c index 114e5996782..725d07a0d72 100644 --- a/tests/kernel/context/src/main.c +++ b/tests/kernel/context/src/main.c @@ -442,15 +442,15 @@ static void _test_kernel_interrupts(disable_int_func disable_int, int imask; /* Align to a "tick boundary" */ - tick = z_tick_get_32(); - while (z_tick_get_32() == tick) { + tick = sys_clock_tick_get_32(); + while (sys_clock_tick_get_32() == tick) { #if defined(CONFIG_ARCH_POSIX) k_busy_wait(1000); #endif } tick++; - while (z_tick_get_32() == tick) { + while (sys_clock_tick_get_32() == tick) { #if defined(CONFIG_ARCH_POSIX) k_busy_wait(1000); #endif @@ -467,15 +467,15 @@ static void _test_kernel_interrupts(disable_int_func disable_int, count <<= 4; imask = disable_int(irq); - tick = z_tick_get_32(); + tick = sys_clock_tick_get_32(); for (i = 0; i < count; i++) { - z_tick_get_32(); + sys_clock_tick_get_32(); #if defined(CONFIG_ARCH_POSIX) k_busy_wait(1000); #endif } - tick2 = z_tick_get_32(); + tick2 = sys_clock_tick_get_32(); /* * Re-enable interrupts before returning (for both success and failure @@ -493,13 +493,13 @@ static void _test_kernel_interrupts(disable_int_func disable_int, /* Now repeat with interrupts unlocked. */ for (i = 0; i < count; i++) { - z_tick_get_32(); + sys_clock_tick_get_32(); #if defined(CONFIG_ARCH_POSIX) k_busy_wait(1000); #endif } - tick2 = z_tick_get_32(); + tick2 = sys_clock_tick_get_32(); zassert_not_equal(tick, tick2, "tick didn't advance as expected"); } @@ -530,13 +530,13 @@ static void _test_kernel_interrupts(disable_int_func disable_int, * -# Do action to align to a tick boundary. * -# Left shift 4 bits for the value of counts. * -# Call irq_lock() and restore its return value to imask. - * -# Call z_tick_get_32() and store its return value to tick. - * -# Repeat counts of calling z_tick_get_32(). - * -# Call z_tick_get_32() and store its return value to tick2. + * -# Call sys_clock_tick_get_32() and store its return value to tick. + * -# Repeat counts of calling sys_clock_tick_get_32(). + * -# Call sys_clock_tick_get_32() and store its return value to tick2. * -# Call irq_unlock() with parameter imask. * -# Check if tick is equal to tick2. - * -# Repeat counts of calling z_tick_get_32(). - * -# Call z_tick_get_32() and store its return value to tick2. + * -# Repeat counts of calling sys_clock_tick_get_32(). + * -# Call sys_clock_tick_get_32() and store its return value to tick2. * -# Check if tick is NOT equal to tick2. * * Expected Test Result: @@ -588,13 +588,13 @@ static void test_kernel_interrupts(void) * -# Do action to align to a tick boundary. * -# Left shift 4 bit for the value of counts. * -# Call irq_disable() and restore its return value to imask. - * -# Call z_tick_get_32() and store its return value to tick. - * -# Repeat counts of calling z_tick_get_32(). - * -# Call z_tick_get_32() and store its return value to tick2. + * -# Call sys_clock_tick_get_32() and store its return value to tick. + * -# Repeat counts of calling sys_clock_tick_get_32(). + * -# Call sys_clock_tick_get_32() and store its return value to tick2. * -# Call irq_enable() with parameter imask. * -# Check if tick is equal to tick2. - * -# Repeat counts of calling z_tick_get_32(). - * -# Call z_tick_get_32() and store its return value to tick2. + * -# Repeat counts of calling sys_clock_tick_get_32(). + * -# Call sys_clock_tick_get_32() and store its return value to tick2. * -# Check if tick is NOT equal to tick2. * * Expected Test Result: diff --git a/tests/kernel/fpu_sharing/generic/src/load_store.c b/tests/kernel/fpu_sharing/generic/src/load_store.c index b870919561d..1d2f95a0230 100644 --- a/tests/kernel/fpu_sharing/generic/src/load_store.c +++ b/tests/kernel/fpu_sharing/generic/src/load_store.c @@ -136,10 +136,10 @@ static void load_store_low(void) * thread an opportunity to run when the low priority thread is * using the floating point registers. * - * IMPORTANT: This logic requires that z_tick_get_32() not + * IMPORTANT: This logic requires that sys_clock_tick_get_32() not * perform any floating point operations! */ - while ((z_tick_get_32() % 5) != 0) { + while ((sys_clock_tick_get_32() % 5) != 0) { /* * Use a volatile variable to prevent compiler * optimizing out the spin loop.