@@ -57,16 +57,6 @@ const struct dt_irq *timer_dt_irq(enum timer_ppi ppi)
return &timer_irq[ppi];
}
-/*static inline*/ s_time_t ticks_to_ns(uint64_t ticks)
-{
- return muldiv64(ticks, SECONDS(1), 1000 * cpu_khz);
-}
-
-/*static inline*/ uint64_t ns_to_ticks(s_time_t ns)
-{
- return muldiv64(ns, 1000 * cpu_khz, SECONDS(1));
-}
-
/* TODO: On a real system the firmware would have set the frequency in
the CNTFRQ register. Also we'd need to use devicetree to find
the RTC. When we've seen some real systems, we can delete this.
@@ -26,9 +26,6 @@
#include <asm/gic.h>
#include <asm/regs.h>
-extern s_time_t ticks_to_ns(uint64_t ticks);
-extern uint64_t ns_to_ticks(s_time_t ns);
-
static void phys_timer_expired(void *data)
{
struct vtimer *t = data;
@@ -5,6 +5,8 @@
DT_MATCH_COMPATIBLE("arm,armv7-timer"), \
DT_MATCH_COMPATIBLE("arm,armv8-timer")
+#include <xen/lib.h>
+
typedef unsigned long cycles_t;
static inline cycles_t get_cycles (void)
@@ -34,6 +36,17 @@ extern void __cpuinit init_timer_interrupt(void);
/* Counter value at boot time */
extern uint64_t boot_count;
+/* Helpers to convert ticks <=> ns */
+static inline s_time_t ticks_to_ns(uint64_t ticks)
+{
+ return muldiv64(ticks, SECONDS(1), 1000 * cpu_khz);
+}
+
+static inline uint64_t ns_to_ticks(s_time_t ns)
+{
+ return muldiv64(ns, 1000 * cpu_khz, SECONDS(1));
+}
+
#endif /* __ARM_TIME_H__ */
/*
* Local variables:
Both ticks_to_ns and ns_to_ticks are wrapper to a division. Move it into asm/time.h to let the compiler inlines them. Signed-off-by: Julien Grall <julien.grall@linaro.org> Cc: Ian Campbell <ian.campbell@citrix.com> Cc: Stefano Stabellini <stefano.stabellini@citrix.com> Cc: Tim Deegan <tim@xen.org> --- xen/arch/arm/time.c | 10 ---------- xen/arch/arm/vtimer.c | 3 --- xen/include/asm-arm/time.h | 13 +++++++++++++ 3 files changed, 13 insertions(+), 13 deletions(-)