diff options
| author | xqyjlj <[email protected]> | 2023-07-26 14:48:00 +0800 |
|---|---|---|
| committer | guo <[email protected]> | 2023-07-27 11:35:29 +0800 |
| commit | d23dd56692c6cff65480fbed286362889c96c7ba (patch) | |
| tree | 0f081dd0613366f119a976888eb59da11480a7be /libcpu/risc-v | |
| parent | 0eaa757cffe21231ee6b57e0e2c9681f966e6f56 (diff) | |
🐞 fix(ktime): fix wrong boottime
因为tick从中断到设置中间的时延特别大,因此暂不采用tick做基准时间,直接取gtime的cnt做基准时间
Diffstat (limited to 'libcpu/risc-v')
| -rw-r--r-- | libcpu/risc-v/virt64/tick.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libcpu/risc-v/virt64/tick.c b/libcpu/risc-v/virt64/tick.c index cd628f0835..3dd9af48a3 100644 --- a/libcpu/risc-v/virt64/tick.c +++ b/libcpu/risc-v/virt64/tick.c @@ -14,6 +14,10 @@ #include <encoding.h> #include "sbi.h" +#ifdef RT_USING_KTIME +#include <ktime.h> +#endif + static volatile uint64_t time_elapsed = 0; static volatile unsigned long tick_cycles = 0; @@ -49,6 +53,9 @@ int rt_hw_tick_init(void) /* Set timer */ sbi_set_timer(get_ticks() + tick_cycles); +#ifdef RT_USING_KTIME + rt_ktime_cputimer_init(); +#endif /* Enable the Supervisor-Timer bit in SIE */ set_csr(sie, SIP_STIP); |
