drivers: timer: get mtime cmp reg by reading mhartid
It is not guaranteed that a multi-core RISC-V hart numbering scheme will match Zephyr's sequential cpu numbering scheme. Read the hartid and use that value in calculation to get mtime_cmp reg, instead of the current_cpu id. Signed-off-by: Conor Paxton <conor.paxton@microchip.com>
This commit is contained in:
parent
343d1919f1
commit
6b641c3483
1 changed files with 1 additions and 1 deletions
|
@ -74,7 +74,7 @@ const int32_t z_sys_timer_irq_for_test = TIMER_IRQN;
|
||||||
|
|
||||||
static uint64_t get_hart_mtimecmp(void)
|
static uint64_t get_hart_mtimecmp(void)
|
||||||
{
|
{
|
||||||
return MTIMECMP_REG + (_current_cpu->id * 8);
|
return MTIMECMP_REG + (arch_proc_id() * 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_mtimecmp(uint64_t time)
|
static void set_mtimecmp(uint64_t time)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue