17adca78eSYoshinori Sato /* 27adca78eSYoshinori Sato * Renesas 8bit timer Object 37adca78eSYoshinori Sato * 47adca78eSYoshinori Sato * Copyright (c) 2018 Yoshinori Sato 57adca78eSYoshinori Sato * 67adca78eSYoshinori Sato * SPDX-License-Identifier: GPL-2.0-or-later 77adca78eSYoshinori Sato */ 87adca78eSYoshinori Sato 97adca78eSYoshinori Sato #ifndef HW_TIMER_RENESAS_TMR_H 107adca78eSYoshinori Sato #define HW_TIMER_RENESAS_TMR_H 117adca78eSYoshinori Sato 127adca78eSYoshinori Sato #include "qemu/timer.h" 137adca78eSYoshinori Sato #include "hw/sysbus.h" 14db1015e9SEduardo Habkost #include "qom/object.h" 157adca78eSYoshinori Sato 167adca78eSYoshinori Sato #define TYPE_RENESAS_TMR "renesas-tmr" 17db1015e9SEduardo Habkost typedef struct RTMRState RTMRState; 18*8110fa1dSEduardo Habkost DECLARE_INSTANCE_CHECKER(RTMRState, RTMR, 19*8110fa1dSEduardo Habkost TYPE_RENESAS_TMR) 207adca78eSYoshinori Sato 217adca78eSYoshinori Sato enum timer_event { 227adca78eSYoshinori Sato cmia = 0, 237adca78eSYoshinori Sato cmib = 1, 247adca78eSYoshinori Sato ovi = 2, 257adca78eSYoshinori Sato none = 3, 267adca78eSYoshinori Sato TMR_NR_EVENTS = 4 277adca78eSYoshinori Sato }; 287adca78eSYoshinori Sato 297adca78eSYoshinori Sato enum { 307adca78eSYoshinori Sato TMR_CH = 2, 317adca78eSYoshinori Sato TMR_NR_IRQ = 3 * TMR_CH 327adca78eSYoshinori Sato }; 337adca78eSYoshinori Sato 34db1015e9SEduardo Habkost struct RTMRState { 357adca78eSYoshinori Sato /*< private >*/ 367adca78eSYoshinori Sato SysBusDevice parent_obj; 377adca78eSYoshinori Sato /*< public >*/ 387adca78eSYoshinori Sato 397adca78eSYoshinori Sato uint64_t input_freq; 407adca78eSYoshinori Sato MemoryRegion memory; 417adca78eSYoshinori Sato 427adca78eSYoshinori Sato int64_t tick; 437adca78eSYoshinori Sato uint8_t tcnt[TMR_CH]; 447adca78eSYoshinori Sato uint8_t tcora[TMR_CH]; 457adca78eSYoshinori Sato uint8_t tcorb[TMR_CH]; 467adca78eSYoshinori Sato uint8_t tcr[TMR_CH]; 477adca78eSYoshinori Sato uint8_t tccr[TMR_CH]; 487adca78eSYoshinori Sato uint8_t tcor[TMR_CH]; 497adca78eSYoshinori Sato uint8_t tcsr[TMR_CH]; 507adca78eSYoshinori Sato int64_t div_round[TMR_CH]; 517adca78eSYoshinori Sato uint8_t next[TMR_CH]; 527adca78eSYoshinori Sato qemu_irq cmia[TMR_CH]; 537adca78eSYoshinori Sato qemu_irq cmib[TMR_CH]; 547adca78eSYoshinori Sato qemu_irq ovi[TMR_CH]; 557adca78eSYoshinori Sato QEMUTimer timer[TMR_CH]; 56db1015e9SEduardo Habkost }; 577adca78eSYoshinori Sato 587adca78eSYoshinori Sato #endif 59