clock: remove z_ from semi-public APIs

The clock/timer APIs are not application facing APIs, however, similar
to arch_ and a few other APIs they are available to implement drivers
and add support for new hardware and are documented and available to be
used outside of the clock/kernel subsystems.

Remove the leading z_ and provide them as clock_* APIs for someone
writing a new timer driver to use.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2021-02-25 15:33:15 -05:00
commit 9c1efe6b4b
33 changed files with 171 additions and 168 deletions

View file

@ -35,7 +35,7 @@ static uint32_t last_load;
/*
* This local variable holds the amount of SysTick HW cycles elapsed
* and it is updated in z_clock_isr() and z_clock_set_timeout().
* and it is updated in z_clock_isr() and sys_clock_set_timeout().
*
* Note:
* At an arbitrary point in time the "current" value of the SysTick
@ -65,7 +65,7 @@ static volatile uint32_t overflow_cyc;
/* This internal function calculates the amount of HW cycles that have
* elapsed since the last time the absolute HW cycles counter has been
* updated. 'cycle_count' may be updated either by the ISR, or when we
* re-program the SysTick.LOAD register, in z_clock_set_timeout().
* re-program the SysTick.LOAD register, in sys_clock_set_timeout().
*
* Additionally, the function updates the 'overflow_cyc' counter, that
* holds the amount of elapsed HW cycles due to (possibly) multiple
@ -129,11 +129,11 @@ void z_clock_isr(void *arg)
if (TICKLESS) {
/* In TICKLESS mode, the SysTick.LOAD is re-programmed
* in z_clock_set_timeout(), followed by resetting of
* in sys_clock_set_timeout(), followed by resetting of
* the counter (VAL = 0).
*
* If a timer wrap occurs right when we re-program LOAD,
* the ISR is triggered immediately after z_clock_set_timeout()
* the ISR is triggered immediately after sys_clock_set_timeout()
* returns; in that case we shall not increment the cycle_count
* because the value has been updated before LOAD re-program.
*
@ -142,14 +142,14 @@ void z_clock_isr(void *arg)
dticks = (cycle_count - announced_cycles) / CYC_PER_TICK;
announced_cycles += dticks * CYC_PER_TICK;
z_clock_announce(dticks);
sys_clock_announce(dticks);
} else {
z_clock_announce(1);
sys_clock_announce(1);
}
z_arm_int_exit();
}
int z_clock_driver_init(const struct device *device)
int sys_clock_driver_init(const struct device *device)
{
ARG_UNUSED(device);
@ -164,7 +164,7 @@ int z_clock_driver_init(const struct device *device)
return 0;
}
void z_clock_set_timeout(int32_t ticks, bool idle)
void sys_clock_set_timeout(int32_t ticks, bool idle)
{
/* Fast CPUs and a 24 bit counter mean that even idle systems
* need to wake up multiple times per second. If the kernel
@ -225,7 +225,7 @@ void z_clock_set_timeout(int32_t ticks, bool idle)
#endif
}
uint32_t z_clock_elapsed(void)
uint32_t sys_clock_elapsed(void)
{
if (!TICKLESS) {
return 0;
@ -247,7 +247,7 @@ uint32_t z_timer_cycle_get_32(void)
return ret;
}
void z_clock_idle_exit(void)
void sys_clock_idle_exit(void)
{
if (last_load == TIMER_STOPPED) {
SysTick->CTRL |= SysTick_CTRL_ENABLE_Msk;