xref: /openbmc/qemu/include/hw/timer/renesas_cmt.h (revision df0f3d13)
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 
15 #define TYPE_RENESAS_CMT "renesas-cmt"
16 #define RCMT(obj) OBJECT_CHECK(RCMTState, (obj), TYPE_RENESAS_CMT)
17 
18 enum {
19     CMT_CH = 2,
20     CMT_NR_IRQ = 1 * CMT_CH
21 };
22 
23 typedef struct RCMTState {
24     /*< private >*/
25     SysBusDevice parent_obj;
26     /*< public >*/
27 
28     uint64_t input_freq;
29     MemoryRegion memory;
30 
31     uint16_t cmstr;
32     uint16_t cmcr[CMT_CH];
33     uint16_t cmcnt[CMT_CH];
34     uint16_t cmcor[CMT_CH];
35     int64_t tick[CMT_CH];
36     qemu_irq cmi[CMT_CH];
37     QEMUTimer timer[CMT_CH];
38 } RCMTState;
39 
40 #endif
41