Skip to content

✨ feat(components/drivers/): delete cputime #8119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 0 additions & 35 deletions components/drivers/Kconfig
Original file line number Diff line number Diff line change
@@ -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
18 changes: 0 additions & 18 deletions components/drivers/cputime/SConscript

This file was deleted.

116 changes: 0 additions & 116 deletions components/drivers/cputime/cputime.c

This file was deleted.

69 changes: 0 additions & 69 deletions components/drivers/cputime/cputime_cortexm.c

This file was deleted.

37 changes: 0 additions & 37 deletions components/drivers/cputime/cputime_riscv.c

This file was deleted.

339 changes: 0 additions & 339 deletions components/drivers/cputime/cputimer.c

This file was deleted.

34 changes: 0 additions & 34 deletions components/drivers/include/drivers/cputime.h

This file was deleted.

48 changes: 0 additions & 48 deletions components/drivers/include/drivers/cputimer.h

This file was deleted.

4 changes: 0 additions & 4 deletions components/drivers/include/rtdevice.h
Original file line number Diff line number Diff line change
@@ -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 */
6 changes: 6 additions & 0 deletions components/drivers/ktime/Kconfig
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions components/drivers/ktime/src/risc-v/virt64/cputimer.c
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 5 additions & 1 deletion libcpu/risc-v/virt64/tick.c
Original file line number Diff line number Diff line change
@@ -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);