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 #define RCMT(obj) OBJECT_CHECK(RCMTState, (obj), TYPE_RENESAS_CMT) 19 20 enum { 21 CMT_CH = 2, 22 CMT_NR_IRQ = 1 * CMT_CH 23 }; 24 25 struct RCMTState { 26 /*< private >*/ 27 SysBusDevice parent_obj; 28 /*< public >*/ 29 30 uint64_t input_freq; 31 MemoryRegion memory; 32 33 uint16_t cmstr; 34 uint16_t cmcr[CMT_CH]; 35 uint16_t cmcnt[CMT_CH]; 36 uint16_t cmcor[CMT_CH]; 37 int64_t tick[CMT_CH]; 38 qemu_irq cmi[CMT_CH]; 39 QEMUTimer timer[CMT_CH]; 40 }; 41 42 #endif 43