xref: /qemu/include/hw/timer/bcm2835_systmr.h (revision 727385c4)
1 /*
2  * BCM2835 SYS timer emulation
3  *
4  * Copyright (c) 2019 Philippe Mathieu-Daudé <f4bug@amsat.org>
5  *
6  * SPDX-License-Identifier: GPL-2.0-or-later
7  */
8 
9 #ifndef BCM2835_SYSTIMER_H
10 #define BCM2835_SYSTIMER_H
11 
12 #include "hw/sysbus.h"
13 #include "hw/irq.h"
14 #include "qemu/timer.h"
15 #include "qom/object.h"
16 
17 #define TYPE_BCM2835_SYSTIMER "bcm2835-sys-timer"
18 OBJECT_DECLARE_SIMPLE_TYPE(BCM2835SystemTimerState, BCM2835_SYSTIMER)
19 
20 #define BCM2835_SYSTIMER_COUNT 4
21 
22 typedef struct {
23     unsigned id;
24     QEMUTimer timer;
25     qemu_irq irq;
26     BCM2835SystemTimerState *state;
27 } BCM2835SystemTimerCompare;
28 
29 struct BCM2835SystemTimerState {
30     /*< private >*/
31     SysBusDevice parent_obj;
32 
33     /*< public >*/
34     MemoryRegion iomem;
35     struct {
36         uint32_t ctrl_status;
37         uint32_t compare[BCM2835_SYSTIMER_COUNT];
38     } reg;
39     BCM2835SystemTimerCompare tmr[BCM2835_SYSTIMER_COUNT];
40 };
41 
42 #endif
43