1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2012 Regents of the University of California
6 #ifndef _ASM_RISCV_TIMEX_H
7 #define _ASM_RISCV_TIMEX_H
11 typedef unsigned long cycles_t;
13 static inline cycles_t get_cycles_inline(void)
17 __asm__ __volatile__ (
22 #define get_cycles get_cycles_inline
25 static inline uint64_t get_cycles64(void)
30 static inline uint64_t get_cycles64(void)
33 __asm__ __volatile__ (
39 : "=&r" (hi), "=&r" (lo), "=&r" (tmp));
40 return ((u64)hi << 32) | lo;
44 #define ARCH_HAS_READ_CURRENT_TIMER
46 static inline int read_current_timer(unsigned long *timer_val)
48 *timer_val = get_cycles();
52 #endif /* _ASM_RISCV_TIMEX_H */