diff --git a/components/drivers/Kconfig b/components/drivers/Kconfig index 4fd3553df22..98397ea3b03 100755 --- a/components/drivers/Kconfig +++ b/components/drivers/Kconfig @@ -77,41 +77,6 @@ config RT_USING_HWTIMER bool "Using hardware timer device drivers" default n -config RT_USING_CPUTIME - bool "Enable CPU time for high resolution clock counter" - default n - help - When enable this option, the BSP should provide a rt_clock_cputime_ops - for CPU time by: - const static struct rt_clock_cputime_ops _ops = {...}; - clock_cpu_setops(&_ops); - - Then user can use high resolution clock counter with: - - ts1 = clock_cpu_gettime(); - ts2 = clock_cpu_gettime(); - - /* and get the ms of delta tick with API: */ - ms_tick = clock_cpu_millisecond(t2 - t1); - us_tick = clock_cpu_microsecond(t2 - t1); - -if RT_USING_CPUTIME - config RT_USING_CPUTIME_CORTEXM - bool "Support Cortex-M CPU" - default y - depends on ARCH_ARM_CORTEX_M0 || ARCH_ARM_CORTEX_M3 || ARCH_ARM_CORTEX_M4 || ARCH_ARM_CORTEX_M7 - select PKG_USING_PERF_COUNTER - config RT_USING_CPUTIME_RISCV - bool "Use rdtime instructions for CPU time" - default y - depends on ARCH_RISCV64 - help - Some RISCV64 MCU Use rdtime instructions read CPU time. - config CPUTIME_TIMER_FREQ - int "CPUTIME timer freq" - default 0 -endif - config RT_USING_I2C bool "Using I2C device drivers" default n diff --git a/components/drivers/cputime/SConscript b/components/drivers/cputime/SConscript deleted file mode 100644 index 9fec4641e54..00000000000 --- a/components/drivers/cputime/SConscript +++ /dev/null @@ -1,18 +0,0 @@ -from building import * - -cwd = GetCurrentDir() -CPPPATH = [cwd + '/../include'] -src = Split(''' -cputime.c -cputimer.c -''') - -if GetDepend('RT_USING_CPUTIME_CORTEXM'): - src += ['cputime_cortexm.c'] - -if GetDepend('RT_USING_CPUTIME_RISCV'): - src += ['cputime_riscv.c'] - -group = DefineGroup('DeviceDrivers', src, depend = ['RT_USING_CPUTIME'], CPPPATH = CPPPATH) - -Return('group') diff --git a/components/drivers/cputime/cputime.c b/components/drivers/cputime/cputime.c deleted file mode 100644 index 42298ea98c1..00000000000 --- a/components/drivers/cputime/cputime.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2006-2023, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2017-12-23 Bernard first version - */ - -#include -#include -#include - -static const struct rt_clock_cputime_ops *_cputime_ops = RT_NULL; - -/** - * The clock_cpu_getres() function shall return the resolution of CPU time, the - * number of nanosecond per tick. - * - * @return the number of nanosecond per tick(x (1000UL * 1000)) - */ -uint64_t clock_cpu_getres(void) -{ - if (_cputime_ops) - return _cputime_ops->cputime_getres(); - - rt_set_errno(ENOSYS); - return 0; -} - -/** - * The clock_cpu_gettime() function shall return the current value of cpu time tick. - * - * @return the cpu tick - */ -uint64_t clock_cpu_gettime(void) -{ - if (_cputime_ops) - return _cputime_ops->cputime_gettime(); - - rt_set_errno(ENOSYS); - return 0; -} - -/** - * The clock_cpu_settimeout() fucntion set timeout time and timeout callback function - * The timeout callback function will be called when the timeout time is reached - * - * @param tick the Timeout tick - * @param timeout the Timeout function - * @param parameter the Parameters of timeout function - * - */ -int clock_cpu_settimeout(uint64_t tick, void (*timeout)(void *param), void *param) -{ - if (_cputime_ops) - return _cputime_ops->cputime_settimeout(tick, timeout, param); - - rt_set_errno(ENOSYS); - return 0; -} - -int clock_cpu_issettimeout(void) -{ - if (_cputime_ops) - return _cputime_ops->cputime_settimeout != RT_NULL; - return RT_FALSE; -} - -/** - * The clock_cpu_microsecond() fucntion shall return the microsecond according to - * cpu_tick parameter. - * - * @param cpu_tick the cpu tick - * - * @return the microsecond - */ -uint64_t clock_cpu_microsecond(uint64_t cpu_tick) -{ - uint64_t unit = clock_cpu_getres(); - - return (uint64_t)(((cpu_tick * unit) / (1000UL * 1000)) / 1000); -} - -/** - * The clock_cpu_microsecond() fucntion shall return the millisecond according to - * cpu_tick parameter. - * - * @param cpu_tick the cpu tick - * - * @return the millisecond - */ -uint64_t clock_cpu_millisecond(uint64_t cpu_tick) -{ - uint64_t unit = clock_cpu_getres(); - - return (uint64_t)(((cpu_tick * unit) / (1000UL * 1000)) / (1000UL * 1000)); -} - -/** - * The clock_cpu_seops() function shall set the ops of cpu time. - * - * @return always return 0. - */ -int clock_cpu_setops(const struct rt_clock_cputime_ops *ops) -{ - _cputime_ops = ops; - if (ops) - { - RT_ASSERT(ops->cputime_getres != RT_NULL); - RT_ASSERT(ops->cputime_gettime != RT_NULL); - } - - return 0; -} diff --git a/components/drivers/cputime/cputime_cortexm.c b/components/drivers/cputime/cputime_cortexm.c deleted file mode 100644 index 100910a9f9f..00000000000 --- a/components/drivers/cputime/cputime_cortexm.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2006-2023, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2017-12-23 Bernard first version - * 2022-06-14 Meco Man suuport pref_counter - */ - -#include -#include -#include - -#include -#ifdef PKG_USING_PERF_COUNTER -#include -#endif - -/* Use Cycle counter of Data Watchpoint and Trace Register for CPU time */ -static uint64_t cortexm_cputime_getres(void) -{ - uint64_t ret = 1000UL * 1000 * 1000; - - ret = (ret * (1000UL * 1000)) / SystemCoreClock; - return ret; -} - -static uint64_t cortexm_cputime_gettime(void) -{ -#ifdef PKG_USING_PERF_COUNTER - return get_system_ticks(); -#else - return DWT->CYCCNT; -#endif -} - -const static struct rt_clock_cputime_ops _cortexm_ops = -{ - cortexm_cputime_getres, - cortexm_cputime_gettime -}; - - -int cortexm_cputime_init(void) -{ -#ifdef PKG_USING_PERF_COUNTER - clock_cpu_setops(&_cortexm_ops); -#else - /* check support bit */ - if ((DWT->CTRL & (1UL << DWT_CTRL_NOCYCCNT_Pos)) == 0) - { - /* enable trace*/ - CoreDebug->DEMCR |= (1UL << CoreDebug_DEMCR_TRCENA_Pos); - - /* whether cycle counter not enabled */ - if ((DWT->CTRL & (1UL << DWT_CTRL_CYCCNTENA_Pos)) == 0) - { - /* enable cycle counter */ - DWT->CTRL |= (1UL << DWT_CTRL_CYCCNTENA_Pos); - } - - clock_cpu_setops(&_cortexm_ops); - } -#endif /* PKG_USING_PERF_COUNTER */ - return 0; -} -INIT_BOARD_EXPORT(cortexm_cputime_init); diff --git a/components/drivers/cputime/cputime_riscv.c b/components/drivers/cputime/cputime_riscv.c deleted file mode 100644 index 597157c226e..00000000000 --- a/components/drivers/cputime/cputime_riscv.c +++ /dev/null @@ -1,37 +0,0 @@ -#include -#include -#include - -#include - -/* Use Cycle counter of Data Watchpoint and Trace Register for CPU time */ - -static uint64_t riscv_cputime_getres(void) -{ - uint64_t ret = 1000UL * 1000 * 1000; - - ret = (ret * (1000UL * 1000)) / CPUTIME_TIMER_FREQ; - return ret; -} - -static uint64_t riscv_cputime_gettime(void) -{ - uint64_t time_elapsed; - __asm__ __volatile__( - "rdtime %0" - : "=r"(time_elapsed)); - return time_elapsed; -} - -const static struct rt_clock_cputime_ops _riscv_ops = -{ - riscv_cputime_getres, - riscv_cputime_gettime -}; - -int riscv_cputime_init(void) -{ - clock_cpu_setops(&_riscv_ops); - return 0; -} -INIT_BOARD_EXPORT(riscv_cputime_init); diff --git a/components/drivers/cputime/cputimer.c b/components/drivers/cputime/cputimer.c deleted file mode 100644 index 04318336407..00000000000 --- a/components/drivers/cputime/cputimer.c +++ /dev/null @@ -1,339 +0,0 @@ -/* - * Copyright (c) 2006-2023, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2023-02-13 zhkag first version - * 2023-04-03 xqyjlj fix cputimer in multithreading - */ - -#include -#include -#include - -static rt_list_t _cputimer_list = RT_LIST_OBJECT_INIT(_cputimer_list); -static struct rt_cputimer *_cputimer_nowtimer = RT_NULL; - -static void _cputime_sleep_timeout(void *parameter) -{ - struct rt_semaphore *sem; - sem = (struct rt_semaphore *)parameter; - rt_sem_release(sem); -} - -static void _cputime_timeout_callback(void *parameter) -{ - struct rt_cputimer *timer; - timer = (struct rt_cputimer *)parameter; - rt_base_t level; - level = rt_hw_interrupt_disable(); - _cputimer_nowtimer = RT_NULL; - rt_list_remove(&(timer->row)); - rt_hw_interrupt_enable(level); - timer->timeout_func(timer->parameter); - - if (&_cputimer_list != _cputimer_list.prev) - { - struct rt_cputimer *t; - t = rt_list_entry(_cputimer_list.next, struct rt_cputimer, row); - clock_cpu_settimeout(t->timeout_tick, _cputime_timeout_callback, t); - } - else - { - clock_cpu_settimeout(RT_NULL, RT_NULL, RT_NULL); - } -} - -static void _set_next_timeout() -{ - struct rt_cputimer *t; - - if (&_cputimer_list != _cputimer_list.prev) - { - t = rt_list_entry((&_cputimer_list)->next, struct rt_cputimer, row); - if (_cputimer_nowtimer != RT_NULL) - { - if (t != _cputimer_nowtimer && t->timeout_tick < _cputimer_nowtimer->timeout_tick) - { - _cputimer_nowtimer = t; - clock_cpu_settimeout(t->timeout_tick, _cputime_timeout_callback, t); - } - } - else - { - _cputimer_nowtimer = t; - clock_cpu_settimeout(t->timeout_tick, _cputime_timeout_callback, t); - } - } - else - { - _cputimer_nowtimer = RT_NULL; - clock_cpu_settimeout(RT_NULL, RT_NULL, RT_NULL); - } -} - -void rt_cputimer_init(rt_cputimer_t timer, - const char *name, - void (*timeout)(void *parameter), - void *parameter, - rt_uint64_t tick, - rt_uint8_t flag) -{ - /* parameter check */ - RT_ASSERT(timer != RT_NULL); - RT_ASSERT(timeout != RT_NULL); - RT_ASSERT(clock_cpu_issettimeout() != RT_FALSE); - - /* set flag */ - timer->parent.flag = flag; - - /* set deactivated */ - timer->parent.flag &= ~RT_TIMER_FLAG_ACTIVATED; - timer->timeout_func = timeout; - timer->parameter = parameter; - timer->timeout_tick = tick + clock_cpu_gettime(); - timer->init_tick = tick; - - rt_list_init(&(timer->row)); - rt_sem_init(&(timer->sem), "cputime", 0, RT_IPC_FLAG_PRIO); -} - -rt_err_t rt_cputimer_delete(rt_cputimer_t timer) -{ - rt_base_t level; - - /* parameter check */ - RT_ASSERT(timer != RT_NULL); - RT_ASSERT(clock_cpu_issettimeout() != RT_FALSE); - - /* disable interrupt */ - level = rt_hw_interrupt_disable(); - - rt_list_remove(&timer->row); - /* stop timer */ - timer->parent.flag &= ~RT_TIMER_FLAG_ACTIVATED; - - /* enable interrupt */ - rt_hw_interrupt_enable(level); - - _set_next_timeout(); - - return RT_EOK; -} - -rt_err_t rt_cputimer_start(rt_cputimer_t timer) -{ - rt_list_t *timer_list; - rt_base_t level; - - /* parameter check */ - RT_ASSERT(timer != RT_NULL); - RT_ASSERT(clock_cpu_issettimeout() != RT_FALSE); - - /* stop timer firstly */ - level = rt_hw_interrupt_disable(); - /* remove timer from list */ - - rt_list_remove(&timer->row); - /* change status of timer */ - timer->parent.flag &= ~RT_TIMER_FLAG_ACTIVATED; - - timer_list = &_cputimer_list; - - for (; timer_list != _cputimer_list.prev; - timer_list = timer_list->next) - { - struct rt_cputimer *t; - rt_list_t *p = timer_list->next; - - t = rt_list_entry(p, struct rt_cputimer, row); - - if ((t->timeout_tick - timer->timeout_tick) == 0) - { - continue; - } - else if ((t->timeout_tick - timer->timeout_tick) < 0x7fffffffffffffff) - { - break; - } - } - - rt_list_insert_after(timer_list, &(timer->row)); - - timer->parent.flag |= RT_TIMER_FLAG_ACTIVATED; - - _set_next_timeout(); - /* enable interrupt */ - rt_hw_interrupt_enable(level); - - return RT_EOK; -} - -rt_err_t rt_cputimer_stop(rt_cputimer_t timer) -{ - rt_base_t level; - - /* disable interrupt */ - level = rt_hw_interrupt_disable(); - - /* timer check */ - RT_ASSERT(timer != RT_NULL); - RT_ASSERT(clock_cpu_issettimeout() != RT_FALSE); - - if (!(timer->parent.flag & RT_TIMER_FLAG_ACTIVATED)) - { - rt_hw_interrupt_enable(level); - return -RT_ERROR; - } - - rt_list_remove(&timer->row); - /* change status */ - timer->parent.flag &= ~RT_TIMER_FLAG_ACTIVATED; - - _set_next_timeout(); - /* enable interrupt */ - rt_hw_interrupt_enable(level); - - return RT_EOK; -} - -rt_err_t rt_cputimer_control(rt_cputimer_t timer, int cmd, void *arg) -{ - rt_base_t level; - - /* parameter check */ - RT_ASSERT(timer != RT_NULL); - RT_ASSERT(clock_cpu_issettimeout() != RT_FALSE); - - level = rt_hw_interrupt_disable(); - switch (cmd) - { - case RT_TIMER_CTRL_GET_TIME: - *(rt_uint64_t *)arg = timer->init_tick; - break; - - case RT_TIMER_CTRL_SET_TIME: - RT_ASSERT((*(rt_uint64_t *)arg) < 0x7fffffffffffffff); - timer->init_tick = *(rt_uint64_t *)arg; - timer->timeout_tick = *(rt_uint64_t *)arg + clock_cpu_gettime(); - break; - - case RT_TIMER_CTRL_SET_ONESHOT: - timer->parent.flag &= ~RT_TIMER_FLAG_PERIODIC; - break; - - case RT_TIMER_CTRL_SET_PERIODIC: - timer->parent.flag |= RT_TIMER_FLAG_PERIODIC; - break; - - case RT_TIMER_CTRL_GET_STATE: - if (timer->parent.flag & RT_TIMER_FLAG_ACTIVATED) - { - /*timer is start and run*/ - *(rt_uint32_t *)arg = RT_TIMER_FLAG_ACTIVATED; - } - else - { - /*timer is stop*/ - *(rt_uint32_t *)arg = RT_TIMER_FLAG_DEACTIVATED; - } - break; - - case RT_TIMER_CTRL_GET_REMAIN_TIME: - *(rt_uint64_t *)arg = timer->timeout_tick; - break; - case RT_TIMER_CTRL_GET_FUNC: - arg = (void *)timer->timeout_func; - break; - - case RT_TIMER_CTRL_SET_FUNC: - timer->timeout_func = (void (*)(void *))arg; - break; - - case RT_TIMER_CTRL_GET_PARM: - *(void **)arg = timer->parameter; - break; - - case RT_TIMER_CTRL_SET_PARM: - timer->parameter = arg; - break; - - default: - break; - } - rt_hw_interrupt_enable(level); - - return RT_EOK; -} - -rt_err_t rt_cputimer_detach(rt_cputimer_t timer) -{ - rt_base_t level; - - /* parameter check */ - RT_ASSERT(timer != RT_NULL); - RT_ASSERT(clock_cpu_issettimeout() != RT_FALSE); - - /* disable interrupt */ - level = rt_hw_interrupt_disable(); - - rt_list_remove(&timer->row); - /* stop timer */ - timer->parent.flag &= ~RT_TIMER_FLAG_ACTIVATED; - - _set_next_timeout(); - /* enable interrupt */ - rt_hw_interrupt_enable(level); - - rt_sem_detach(&(timer->sem)); - - return RT_EOK; -} - -rt_err_t rt_cputime_sleep(rt_uint64_t tick) -{ - rt_base_t level; - struct rt_cputimer cputimer; - - if (!clock_cpu_issettimeout()) - { - rt_int32_t ms = clock_cpu_millisecond(tick); - return rt_thread_delay(rt_tick_from_millisecond(ms)); - } - - if (tick == 0) - { - return -RT_EINVAL; - } - - rt_cputimer_init(&cputimer, "cputime_sleep", _cputime_sleep_timeout, &(cputimer.sem), tick, - RT_TIMER_FLAG_ONE_SHOT | RT_TIMER_FLAG_SOFT_TIMER); - - /* disable interrupt */ - level = rt_hw_interrupt_disable(); - - rt_cputimer_start(&cputimer); /* reset the timeout of thread timer and start it */ - rt_hw_interrupt_enable(level); - rt_sem_take_interruptible(&(cputimer.sem), RT_WAITING_FOREVER); - - rt_cputimer_detach(&cputimer); - return RT_EOK; -} - -rt_err_t rt_cputime_ndelay(rt_uint64_t ns) -{ - uint64_t unit = clock_cpu_getres(); - return rt_cputime_sleep(ns * (1000UL * 1000) / unit); -} - -rt_err_t rt_cputime_udelay(rt_uint64_t us) -{ - return rt_cputime_ndelay(us * 1000); -} - -rt_err_t rt_cputime_mdelay(rt_uint64_t ms) -{ - return rt_cputime_ndelay(ms * 1000000); -} diff --git a/components/drivers/include/drivers/cputime.h b/components/drivers/include/drivers/cputime.h deleted file mode 100644 index 3b1eb2aec0f..00000000000 --- a/components/drivers/include/drivers/cputime.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2006-2023, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2017-12-23 Bernard first version - */ - -#ifndef CPUTIME_H__ -#define CPUTIME_H__ - -#include -#include "cputimer.h" - -struct rt_clock_cputime_ops -{ - uint64_t (*cputime_getres)(void); - uint64_t (*cputime_gettime)(void); - int (*cputime_settimeout)(uint64_t tick, void (*timeout)(void *param), void *param); -}; - -uint64_t clock_cpu_getres(void); -uint64_t clock_cpu_gettime(void); -int clock_cpu_settimeout(uint64_t tick, void (*timeout)(void *param), void *param); -int clock_cpu_issettimeout(void); - -uint64_t clock_cpu_microsecond(uint64_t cpu_tick); -uint64_t clock_cpu_millisecond(uint64_t cpu_tick); - -int clock_cpu_setops(const struct rt_clock_cputime_ops *ops); - -#endif diff --git a/components/drivers/include/drivers/cputimer.h b/components/drivers/include/drivers/cputimer.h deleted file mode 100644 index 371992a41e1..00000000000 --- a/components/drivers/include/drivers/cputimer.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2006-2023, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2023-02-13 zhkag first version - */ - -#ifndef CPUTIMER_H__ -#define CPUTIMER_H__ - -#include - -struct rt_cputimer -{ - struct rt_object parent; /**< inherit from rt_object */ - rt_list_t row; - void (*timeout_func)(void *parameter); - void *parameter; - rt_uint64_t init_tick; - rt_uint64_t timeout_tick; - struct rt_semaphore sem; -}; -typedef struct rt_cputimer *rt_cputimer_t; - -rt_err_t rt_cputimer_detach(rt_cputimer_t timer); - -#ifdef RT_USING_HEAP -void rt_cputimer_init(rt_cputimer_t timer, - const char *name, - void (*timeout)(void *parameter), - void *parameter, - rt_uint64_t tick, - rt_uint8_t flag); -rt_err_t rt_cputimer_delete(rt_cputimer_t timer); -#endif - -rt_err_t rt_cputimer_start(rt_cputimer_t timer); -rt_err_t rt_cputimer_stop(rt_cputimer_t timer); -rt_err_t rt_cputimer_control(rt_cputimer_t timer, int cmd, void *arg); -rt_err_t rt_cputime_sleep(rt_uint64_t tick); -rt_err_t rt_cputime_ndelay(rt_uint64_t ns); -rt_err_t rt_cputime_udelay(rt_uint64_t us); -rt_err_t rt_cputime_mdelay(rt_uint64_t ms); - -#endif diff --git a/components/drivers/include/rtdevice.h b/components/drivers/include/rtdevice.h index ebcbbe15bd7..b55968f84b0 100644 --- a/components/drivers/include/rtdevice.h +++ b/components/drivers/include/rtdevice.h @@ -113,10 +113,6 @@ extern "C" { #include "drivers/audio.h" #endif /* RT_USING_AUDIO */ -#ifdef RT_USING_CPUTIME -#include "drivers/cputime.h" -#endif /* RT_USING_CPUTIME */ - #ifdef RT_USING_ADC #include "drivers/adc.h" #endif /* RT_USING_ADC */ diff --git a/components/drivers/ktime/Kconfig b/components/drivers/ktime/Kconfig index 170271c222c..57cd7840a8f 100644 --- a/components/drivers/ktime/Kconfig +++ b/components/drivers/ktime/Kconfig @@ -1,3 +1,9 @@ menuconfig RT_USING_KTIME bool "Ktime: kernel time" default n + +if RT_USING_KTIME + config KTIME_CPUTIMER_FREQ + int "ktime cputimer freq(if cannot get it)" + default 10000000 +endif diff --git a/components/drivers/ktime/src/risc-v/virt64/cputimer.c b/components/drivers/ktime/src/risc-v/virt64/cputimer.c index bbc7576c5ec..65aab60fd22 100644 --- a/components/drivers/ktime/src/risc-v/virt64/cputimer.c +++ b/components/drivers/ktime/src/risc-v/virt64/cputimer.c @@ -14,12 +14,12 @@ static volatile unsigned long _init_cnt = 0; unsigned long rt_ktime_cputimer_getres(void) { - return ((1000UL * 1000 * 1000) * RT_KTIME_RESMUL) / CPUTIME_TIMER_FREQ; + return ((1000UL * 1000 * 1000) * RT_KTIME_RESMUL) / KTIME_CPUTIMER_FREQ; } unsigned long rt_ktime_cputimer_getfrq(void) { - return CPUTIME_TIMER_FREQ; + return KTIME_CPUTIMER_FREQ; } unsigned long rt_ktime_cputimer_getcnt(void) diff --git a/libcpu/risc-v/virt64/tick.c b/libcpu/risc-v/virt64/tick.c index 3dd9af48a35..844e1c83d19 100644 --- a/libcpu/risc-v/virt64/tick.c +++ b/libcpu/risc-v/virt64/tick.c @@ -49,7 +49,11 @@ int rt_hw_tick_init(void) clear_csr(sie, SIP_STIP); /* calculate the tick cycles */ - tick_cycles = CPUTIME_TIMER_FREQ / RT_TICK_PER_SECOND; +#ifdef KTIME_CPUTIMER_FREQ + tick_cycles = KTIME_CPUTIMER_FREQ / RT_TICK_PER_SECOND; +#else + tick_cycles = 10000000 / RT_TICK_PER_SECOND; +#endif /* Set timer */ sbi_set_timer(get_ticks() + tick_cycles);