xref: /openbmc/qemu/include/hw/timer/renesas_cmt.h (revision d2dfe0b5)
1 /*
2  * Renesas Compare-match timer Object
3  *
4  * Copyright (c) 2019 Yoshinori Sato
5  *
6  * SPDX-License-Identifier: GPL-2.0-or-later
7  */
8 
9 #ifndef HW_TIMER_RENESAS_CMT_H
10 #define HW_TIMER_RENESAS_CMT_H
11 
12 #include "qemu/timer.h"
13 #include "hw/sysbus.h"
14 #include "qom/object.h"
15 
16 #define TYPE_RENESAS_CMT "renesas-cmt"
17 typedef struct RCMTState RCMTState;
18 DECLARE_INSTANCE_CHECKER(RCMTState, RCMT,
19                          TYPE_RENESAS_CMT)
20 
21 enum {
22     CMT_CH = 2,
23     CMT_NR_IRQ = 1 * CMT_CH
24 };
25 
26 struct RCMTState {
27     /*< private >*/
28     SysBusDevice parent_obj;
29     /*< public >*/
30 
31     uint64_t input_freq;
32     MemoryRegion memory;
33 
34     uint16_t cmstr;
35     uint16_t cmcr[CMT_CH];
36     uint16_t cmcnt[CMT_CH];
37     uint16_t cmcor[CMT_CH];
38     int64_t tick[CMT_CH];
39     qemu_irq cmi[CMT_CH];
40     QEMUTimer timer[CMT_CH];
41 };
42 
43 #endif
44