1 #ifndef __ARM_TIME_H__ 2 #define __ARM_TIME_H__ 3 4 #include <asm/sysregs.h> 5 #include <asm/system.h> 6 7 #define DT_MATCH_TIMER \ 8 DT_MATCH_COMPATIBLE("arm,armv7-timer"), \ 9 DT_MATCH_COMPATIBLE("arm,armv8-timer") 10 11 typedef uint64_t cycles_t; 12 get_cycles(void)13 static inline cycles_t get_cycles (void) 14 { 15 isb(); 16 return READ_SYSREG64(CNTPCT_EL0); 17 } 18 19 /* List of timer's IRQ */ 20 enum timer_ppi 21 { 22 TIMER_PHYS_SECURE_PPI = 0, 23 TIMER_PHYS_NONSECURE_PPI = 1, 24 TIMER_VIRT_PPI = 2, 25 TIMER_HYP_PPI = 3, 26 MAX_TIMER_PPI = 4, 27 }; 28 29 /* 30 * Value of "clock-frequency" in the DT timer node if present. 31 * 0 means the property doesn't exist. 32 */ 33 extern uint32_t timer_dt_clock_frequency; 34 35 /* Get one of the timer IRQ number */ 36 unsigned int timer_get_irq(enum timer_ppi ppi); 37 38 /* Set up the timer interrupt on this CPU */ 39 extern void init_timer_interrupt(void); 40 41 /* Counter value at boot time */ 42 extern uint64_t boot_count; 43 44 extern s_time_t ticks_to_ns(uint64_t ticks); 45 extern uint64_t ns_to_ticks(s_time_t ns); 46 47 void preinit_xen_time(void); 48 49 #endif /* __ARM_TIME_H__ */ 50 /* 51 * Local variables: 52 * mode: C 53 * c-file-style: "BSD" 54 * c-basic-offset: 4 55 * indent-tabs-mode: nil 56 * End: 57 */ 58