kernel: remove tickless idle
This feature predated the tickless kernel and has been in legacy mode for a while. We now have no drivers or systems that do not support tickless, so remove this option and cleanup the code to only use tickless. Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
c5d6bdb404
commit
c076d94eec
17 changed files with 22 additions and 764 deletions
|
@ -189,7 +189,6 @@ config RV32M1_LPTMR_TIMER
|
|||
bool "RV32M1 LPTMR system timer driver"
|
||||
default y
|
||||
depends on SOC_OPENISA_RV32M1_RISCV32
|
||||
depends on !TICKLESS_IDLE
|
||||
depends on RV32M1_INTMUX
|
||||
help
|
||||
This module implements a kernel device driver for using the LPTMR
|
||||
|
@ -199,7 +198,6 @@ config RV32M1_LPTMR_TIMER
|
|||
config LITEX_TIMER
|
||||
bool "LiteX Timer"
|
||||
default y
|
||||
depends on !TICKLESS_IDLE
|
||||
depends on SOC_RISCV32_LITEX_VEXRISCV
|
||||
help
|
||||
This module implements a kernel device driver for LiteX Timer.
|
||||
|
|
|
@ -13,12 +13,23 @@
|
|||
#include "altera_avalon_timer_regs.h"
|
||||
#include "altera_avalon_timer.h"
|
||||
|
||||
#include "legacy_api.h"
|
||||
/* The old driver "now" API would return a full uptime value. The new
|
||||
* one only requires the driver to track ticks since the last announce
|
||||
* call. Implement the new call in terms of the old one on legacy
|
||||
* drivers by keeping (yet another) uptime value locally.
|
||||
*/
|
||||
static uint32_t driver_uptime;
|
||||
|
||||
static uint32_t accumulated_cycle_count;
|
||||
|
||||
static int32_t _sys_idle_elapsed_ticks = 1;
|
||||
|
||||
static void wrapped_announce(int32_t ticks)
|
||||
{
|
||||
driver_uptime += ticks;
|
||||
sys_clock_announce(ticks);
|
||||
}
|
||||
|
||||
static void timer_irq_handler(const void *unused)
|
||||
{
|
||||
ARG_UNUSED(unused);
|
||||
|
@ -28,7 +39,7 @@ static void timer_irq_handler(const void *unused)
|
|||
/* Clear the interrupt */
|
||||
alt_handle_irq((void *)TIMER_0_BASE, TIMER_0_IRQ);
|
||||
|
||||
sys_clock_announce(_sys_idle_elapsed_ticks);
|
||||
wrapped_announce(_sys_idle_elapsed_ticks);
|
||||
}
|
||||
|
||||
int sys_clock_driver_init(const struct device *device)
|
||||
|
@ -69,3 +80,8 @@ uint32_t sys_clock_cycle_get_32(void)
|
|||
*/
|
||||
return accumulated_cycle_count;
|
||||
}
|
||||
|
||||
uint32_t sys_clock_elapsed(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -326,7 +326,7 @@ void sys_clock_set_timeout(int32_t ticks, bool idle)
|
|||
* However for single core using 32-bits arc timer, idle cannot
|
||||
* be ignored, as 32-bits timer will overflow in a not-long time.
|
||||
*/
|
||||
if (IS_ENABLED(CONFIG_TICKLESS_IDLE) && ticks == K_TICKS_FOREVER) {
|
||||
if (IS_ENABLED(CONFIG_TICKLESS_KERNEL) && ticks == K_TICKS_FOREVER) {
|
||||
timer0_control_register_set(0);
|
||||
timer0_count_register_set(0);
|
||||
timer0_limit_register_set(0);
|
||||
|
@ -356,8 +356,7 @@ void sys_clock_set_timeout(int32_t ticks, bool idle)
|
|||
arch_irq_unlock(key);
|
||||
#endif
|
||||
#else
|
||||
if (IS_ENABLED(CONFIG_TICKLESS_IDLE) && idle
|
||||
&& ticks == K_TICKS_FOREVER) {
|
||||
if (IS_ENABLED(CONFIG_TICKLESS_KERNEL) && idle && ticks == K_TICKS_FOREVER) {
|
||||
timer0_control_register_set(0);
|
||||
timer0_count_register_set(0);
|
||||
timer0_limit_register_set(0);
|
||||
|
|
|
@ -172,8 +172,7 @@ void sys_clock_set_timeout(int32_t ticks, bool idle)
|
|||
* the counter. (Note: we can assume if idle==true that
|
||||
* interrupts are already disabled)
|
||||
*/
|
||||
if (IS_ENABLED(CONFIG_TICKLESS_IDLE) && idle
|
||||
&& ticks == K_TICKS_FOREVER) {
|
||||
if (IS_ENABLED(CONFIG_TICKLESS_KERNEL) && idle && ticks == K_TICKS_FOREVER) {
|
||||
SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk;
|
||||
last_load = TIMER_STOPPED;
|
||||
return;
|
||||
|
|
|
@ -1,74 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2018 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#ifndef ZEPHYR_LEGACY_SET_TIME_H__
|
||||
#define ZEPHYR_LEGACY_SET_TIME_H__
|
||||
|
||||
/* Stub implementation of sys_clock_set_timeout() and sys_clock_elapsed()
|
||||
* in terms of the original APIs. Used by older timer drivers.
|
||||
* Should be replaced.
|
||||
*
|
||||
* Yes, this "header" includes function definitions and must be
|
||||
* included only once in a single compilation.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_TICKLESS_IDLE
|
||||
void z_timer_idle_enter(int32_t ticks);
|
||||
void clock_idle_exit(void);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_TICKLESS_KERNEL
|
||||
void z_set_time(uint32_t time);
|
||||
extern uint32_t z_get_program_time(void);
|
||||
extern uint32_t z_get_remaining_program_time(void);
|
||||
extern uint32_t z_get_elapsed_program_time(void);
|
||||
#endif
|
||||
|
||||
extern uint64_t clock_uptime(void);
|
||||
|
||||
void sys_clock_set_timeout(int32_t ticks, bool idle)
|
||||
{
|
||||
#if defined(CONFIG_TICKLESS_IDLE) && defined(CONFIG_TICKLESS_KERNEL)
|
||||
if (idle) {
|
||||
z_timer_idle_enter(ticks);
|
||||
} else {
|
||||
z_set_time(ticks == K_TICKS_FOREVER ? 0 : ticks);
|
||||
}
|
||||
#endif /* TICKLESS_IDLE && TICKLESS_KERNEL */
|
||||
}
|
||||
|
||||
/* The old driver "now" API would return a full uptime value. The new
|
||||
* one only requires the driver to track ticks since the last announce
|
||||
* call. Implement the new call in terms of the old one on legacy
|
||||
* drivers by keeping (yet another) uptime value locally.
|
||||
*/
|
||||
static uint32_t driver_uptime;
|
||||
|
||||
uint32_t sys_clock_elapsed(void)
|
||||
{
|
||||
#ifdef CONFIG_TICKLESS_KERNEL
|
||||
return (uint32_t)(clock_uptime() - driver_uptime);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void wrapped_announce(int32_t ticks)
|
||||
{
|
||||
driver_uptime += ticks;
|
||||
sys_clock_announce(ticks);
|
||||
}
|
||||
|
||||
#define sys_clock_announce(t) wrapped_announce(t)
|
||||
|
||||
#define _sys_clock_always_on (0)
|
||||
|
||||
static inline void z_tick_set(int64_t val)
|
||||
{
|
||||
/* noop with current kernel code, use sys_clock_announce() */
|
||||
ARG_UNUSED(val);
|
||||
}
|
||||
|
||||
#endif /* ZEPHYR_LEGACY_SET_TIME_H__ */
|
Loading…
Add table
Add a link
Reference in a new issue