xref: /kvm-unit-tests/lib/arm/asm/timer.h (revision 0cc3a351b925928827baa4b69cf0e46ff5837083)
1 /*
2  * Copyright (C) 2020, Red Hat Inc, Andrew Jones <drjones@redhat.com>
3  *
4  * This work is licensed under the terms of the GNU LGPL, version 2.
5  */
6 #ifndef _ASMARM_TIMER_H_
7 #define _ASMARM_TIMER_H_
8 
9 #define ARCH_TIMER_CTL_ENABLE  (1 << 0)
10 #define ARCH_TIMER_CTL_IMASK   (1 << 1)
11 #define ARCH_TIMER_CTL_ISTATUS (1 << 2)
12 
13 #ifndef __ASSEMBLER__
14 
15 struct timer_state {
16 	struct {
17 		u32 irq;
18 		u32 irq_flags;
19 	} ptimer;
20 	struct {
21 		u32 irq;
22 		u32 irq_flags;
23 	} vtimer;
24 };
25 extern struct timer_state __timer_state;
26 
27 #define TIMER_PTIMER_IRQ (__timer_state.ptimer.irq)
28 #define TIMER_VTIMER_IRQ (__timer_state.vtimer.irq)
29 
30 void timer_save_state(void);
31 
32 #endif /* !__ASSEMBLER__ */
33 #endif /* _ASMARM_TIMER_H_ */
34