10b8ceee8SPeter Maydell /* 20b8ceee8SPeter Maydell * Arm SSE Subsystem System Timer 30b8ceee8SPeter Maydell * 40b8ceee8SPeter Maydell * Copyright (c) 2020 Linaro Limited 50b8ceee8SPeter Maydell * Written by Peter Maydell 60b8ceee8SPeter Maydell * 70b8ceee8SPeter Maydell * This program is free software; you can redistribute it and/or modify 80b8ceee8SPeter Maydell * it under the terms of the GNU General Public License version 2 or 90b8ceee8SPeter Maydell * (at your option) any later version. 100b8ceee8SPeter Maydell */ 110b8ceee8SPeter Maydell 120b8ceee8SPeter Maydell /* 130b8ceee8SPeter Maydell * This is a model of the "System timer" which is documented in 140b8ceee8SPeter Maydell * the Arm SSE-123 Example Subsystem Technical Reference Manual: 150b8ceee8SPeter Maydell * https://developer.arm.com/documentation/101370/latest/ 160b8ceee8SPeter Maydell * 170b8ceee8SPeter Maydell * QEMU interface: 180b8ceee8SPeter Maydell * + QOM property "counter": link property to be set to the 190b8ceee8SPeter Maydell * TYPE_SSE_COUNTER timestamp counter device this timer runs off 200b8ceee8SPeter Maydell * + sysbus MMIO region 0: the register bank 210b8ceee8SPeter Maydell * + sysbus IRQ 0: timer interrupt 220b8ceee8SPeter Maydell */ 230b8ceee8SPeter Maydell 240b8ceee8SPeter Maydell #ifndef SSE_TIMER_H 250b8ceee8SPeter Maydell #define SSE_TIMER_H 260b8ceee8SPeter Maydell 270b8ceee8SPeter Maydell #include "hw/sysbus.h" 28*7a5951f6SMarkus Armbruster #include "qemu/timer.h" 290b8ceee8SPeter Maydell #include "qom/object.h" 300b8ceee8SPeter Maydell #include "hw/timer/sse-counter.h" 310b8ceee8SPeter Maydell 320b8ceee8SPeter Maydell #define TYPE_SSE_TIMER "sse-timer" 330b8ceee8SPeter Maydell OBJECT_DECLARE_SIMPLE_TYPE(SSETimer, SSE_TIMER) 340b8ceee8SPeter Maydell 350b8ceee8SPeter Maydell struct SSETimer { 360b8ceee8SPeter Maydell /*< private >*/ 370b8ceee8SPeter Maydell SysBusDevice parent_obj; 380b8ceee8SPeter Maydell 390b8ceee8SPeter Maydell /*< public >*/ 400b8ceee8SPeter Maydell MemoryRegion iomem; 410b8ceee8SPeter Maydell qemu_irq irq; 420b8ceee8SPeter Maydell SSECounter *counter; 430b8ceee8SPeter Maydell QEMUTimer timer; 440b8ceee8SPeter Maydell Notifier counter_notifier; 450b8ceee8SPeter Maydell 460b8ceee8SPeter Maydell uint32_t cntfrq; 470b8ceee8SPeter Maydell uint32_t cntp_ctl; 480b8ceee8SPeter Maydell uint64_t cntp_cval; 490b8ceee8SPeter Maydell uint64_t cntp_aival; 500b8ceee8SPeter Maydell uint32_t cntp_aival_ctl; 510b8ceee8SPeter Maydell uint32_t cntp_aival_reload; 520b8ceee8SPeter Maydell }; 530b8ceee8SPeter Maydell 540b8ceee8SPeter Maydell #endif 55