mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-11-16 19:04:53 +08:00
1 parent
7f46d3ca7a
commit
7209cd44d1
2 files changed
+12
No files matched your search
@@ -264,11 +264,15 @@ static void riscv_clock_initialize(void)
|
||||
rtems_timecounter_install(&tc->base);
|
||||
}
|
||||
|
||||
#ifndef RISCV_USE_S_MODE
|
||||
volatile uint32_t _RISCV_Counter_register;
|
||||
#endif
|
||||
|
||||
static void riscv_counter_initialize(void)
|
||||
{
|
||||
#ifndef RISCV_USE_S_MODE
|
||||
_RISCV_Counter_mutable = &riscv_clint->mtime.val_32[0];
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t _CPU_Counter_frequency( void )
|
||||
@@ -278,7 +282,12 @@ uint32_t _CPU_Counter_frequency( void )
|
||||
|
||||
CPU_Counter_ticks _CPU_Counter_read( void )
|
||||
{
|
||||
#ifdef RISCV_USE_S_MODE
|
||||
uint64_t now = rdtime();
|
||||
return (uint32_t) now;
|
||||
#else
|
||||
return *_RISCV_Counter;
|
||||
#endif
|
||||
}
|
||||
|
||||
RTEMS_SYSINIT_ITEM(
|
||||
|
||||
@@ -367,6 +367,7 @@ static inline uint32_t _RISCV_Read_FCSR( void )
|
||||
return fcsr;
|
||||
}
|
||||
|
||||
#ifndef RISCV_USE_S_MODE
|
||||
/*
|
||||
* The RISC-V ISA provides a rdtime instruction, however, it is implemented in
|
||||
* most chips via a trap-and-emulate. Using this in machine mode makes no
|
||||
@@ -405,6 +406,8 @@ extern volatile uint32_t *_RISCV_Counter_mutable;
|
||||
*/
|
||||
extern volatile uint32_t _RISCV_Counter_register;
|
||||
|
||||
#endif /* !RISCV_USE_S_MODE */
|
||||
|
||||
#ifdef RTEMS_SMP
|
||||
|
||||
static inline struct Per_CPU_Control *_RISCV_Get_current_per_CPU_control( void )
|
||||
|
||||
Reference in new issue
Block a user