xref: /qemu/include/hw/timer/sse-timer.h (revision 84615a19)
1 /*
2  * Arm SSE Subsystem System Timer
3  *
4  * Copyright (c) 2020 Linaro Limited
5  * Written by Peter Maydell
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License version 2 or
9  * (at your option) any later version.
10  */
11 
12 /*
13  * This is a model of the "System timer" which is documented in
14  * the Arm SSE-123 Example Subsystem Technical Reference Manual:
15  * https://developer.arm.com/documentation/101370/latest/
16  *
17  * QEMU interface:
18  *  + QOM property "counter": link property to be set to the
19  *    TYPE_SSE_COUNTER timestamp counter device this timer runs off
20  *  + sysbus MMIO region 0: the register bank
21  *  + sysbus IRQ 0: timer interrupt
22  */
23 
24 #ifndef SSE_TIMER_H
25 #define SSE_TIMER_H
26 
27 #include "hw/sysbus.h"
28 #include "qemu/timer.h"
29 #include "qom/object.h"
30 #include "hw/timer/sse-counter.h"
31 
32 #define TYPE_SSE_TIMER "sse-timer"
33 OBJECT_DECLARE_SIMPLE_TYPE(SSETimer, SSE_TIMER)
34 
35 struct SSETimer {
36     /*< private >*/
37     SysBusDevice parent_obj;
38 
39     /*< public >*/
40     MemoryRegion iomem;
41     qemu_irq irq;
42     SSECounter *counter;
43     QEMUTimer timer;
44     Notifier counter_notifier;
45 
46     uint32_t cntfrq;
47     uint32_t cntp_ctl;
48     uint64_t cntp_cval;
49     uint64_t cntp_aival;
50     uint32_t cntp_aival_ctl;
51     uint32_t cntp_aival_reload;
52 };
53 
54 #endif
55