clock: add k_cycle_get_64
This change adds `k_cycle_get_64()` on platforms that support a 64-bit cycle counter. The interface functions `arch_k_cycle_get_64()` and `sys_clock_cycle_get_64()` are also introduced. Fixes #39934 Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
This commit is contained in:
parent
90ed7557e7
commit
918a574c88
25 changed files with 205 additions and 4 deletions
|
@ -27,6 +27,13 @@ static inline uint32_t arch_k_cycle_get_32(void)
|
|||
{
|
||||
return sys_clock_cycle_get_32();
|
||||
}
|
||||
|
||||
extern uint64_t sys_clock_cycle_get_64(void);
|
||||
|
||||
static inline uint64_t arch_k_cycle_get_64(void)
|
||||
{
|
||||
return sys_clock_cycle_get_64();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -26,6 +26,13 @@ static inline uint32_t arch_k_cycle_get_32(void)
|
|||
return sys_clock_cycle_get_32();
|
||||
}
|
||||
|
||||
extern uint64_t sys_clock_cycle_get_64(void);
|
||||
|
||||
static inline uint64_t arch_k_cycle_get_64(void)
|
||||
{
|
||||
return sys_clock_cycle_get_64();
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE void arch_nop(void)
|
||||
{
|
||||
__asm__ volatile("nop");
|
||||
|
|
|
@ -27,6 +27,13 @@ static inline uint32_t arch_k_cycle_get_32(void)
|
|||
return sys_clock_cycle_get_32();
|
||||
}
|
||||
|
||||
extern uint64_t sys_clock_cycle_get_64(void);
|
||||
|
||||
static inline uint64_t arch_k_cycle_get_64(void)
|
||||
{
|
||||
return sys_clock_cycle_get_64();
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE void arch_nop(void)
|
||||
{
|
||||
__asm__ volatile("nop");
|
||||
|
|
|
@ -178,6 +178,13 @@ static inline uint32_t arch_k_cycle_get_32(void)
|
|||
return sys_clock_cycle_get_32();
|
||||
}
|
||||
|
||||
extern uint64_t sys_clock_cycle_get_64(void);
|
||||
|
||||
static inline uint64_t arch_k_cycle_get_64(void)
|
||||
{
|
||||
return sys_clock_cycle_get_64();
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE void arch_nop(void)
|
||||
{
|
||||
__asm__ volatile("nop");
|
||||
|
|
|
@ -51,6 +51,13 @@ static inline uint32_t arch_k_cycle_get_32(void)
|
|||
return sys_clock_cycle_get_32();
|
||||
}
|
||||
|
||||
extern uint64_t sys_clock_cycle_get_64(void);
|
||||
|
||||
static inline uint64_t arch_k_cycle_get_64(void)
|
||||
{
|
||||
return sys_clock_cycle_get_64();
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE void arch_nop(void)
|
||||
{
|
||||
__asm__ volatile("nop");
|
||||
|
|
|
@ -354,6 +354,13 @@ static inline uint32_t arch_k_cycle_get_32(void)
|
|||
return sys_clock_cycle_get_32();
|
||||
}
|
||||
|
||||
extern uint64_t sys_clock_cycle_get_64(void);
|
||||
|
||||
static inline uint64_t arch_k_cycle_get_64(void)
|
||||
{
|
||||
return sys_clock_cycle_get_64();
|
||||
}
|
||||
|
||||
#ifdef CONFIG_USERSPACE
|
||||
#include <arch/riscv/error.h>
|
||||
#endif /* CONFIG_USERSPACE */
|
||||
|
|
|
@ -100,6 +100,12 @@ static inline uint32_t arch_k_cycle_get_32(void)
|
|||
return sys_clock_cycle_get_32();
|
||||
}
|
||||
|
||||
extern uint64_t sys_clock_cycle_get_64(void);
|
||||
|
||||
static inline uint64_t arch_k_cycle_get_64(void)
|
||||
{
|
||||
return sys_clock_cycle_get_64();
|
||||
}
|
||||
|
||||
struct __esf {
|
||||
uint32_t out[8];
|
||||
|
|
|
@ -255,6 +255,14 @@ static inline uint32_t arch_k_cycle_get_32(void)
|
|||
return sys_clock_cycle_get_32();
|
||||
}
|
||||
|
||||
extern uint64_t sys_clock_cycle_get_64(void);
|
||||
|
||||
__pinned_func
|
||||
static inline uint64_t arch_k_cycle_get_64(void)
|
||||
{
|
||||
return sys_clock_cycle_get_64();
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE bool arch_irq_unlocked(unsigned int key)
|
||||
{
|
||||
return (key & 0x200) != 0;
|
||||
|
|
|
@ -63,6 +63,13 @@ static inline uint32_t arch_k_cycle_get_32(void)
|
|||
return sys_clock_cycle_get_32();
|
||||
}
|
||||
|
||||
extern uint64_t sys_clock_cycle_get_64(void);
|
||||
|
||||
static inline uint64_t arch_k_cycle_get_64(void)
|
||||
{
|
||||
return sys_clock_cycle_get_64();
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE void arch_nop(void)
|
||||
{
|
||||
__asm__ volatile("nop");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue