sse-timer.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Arm SSE Subsystem System Timer
  3. *
  4. * Copyright (c) 2020 Linaro Limited
  5. * Written by Peter Maydell
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 or
  9. * (at your option) any later version.
  10. */
  11. /*
  12. * This is a model of the "System timer" which is documented in
  13. * the Arm SSE-123 Example Subsystem Technical Reference Manual:
  14. * https://developer.arm.com/documentation/101370/latest/
  15. *
  16. * QEMU interface:
  17. * + QOM property "counter": link property to be set to the
  18. * TYPE_SSE_COUNTER timestamp counter device this timer runs off
  19. * + sysbus MMIO region 0: the register bank
  20. * + sysbus IRQ 0: timer interrupt
  21. */
  22. #ifndef SSE_TIMER_H
  23. #define SSE_TIMER_H
  24. #include "hw/sysbus.h"
  25. #include "qemu/timer.h"
  26. #include "qom/object.h"
  27. #include "hw/timer/sse-counter.h"
  28. #define TYPE_SSE_TIMER "sse-timer"
  29. OBJECT_DECLARE_SIMPLE_TYPE(SSETimer, SSE_TIMER)
  30. struct SSETimer {
  31. /*< private >*/
  32. SysBusDevice parent_obj;
  33. /*< public >*/
  34. MemoryRegion iomem;
  35. qemu_irq irq;
  36. SSECounter *counter;
  37. QEMUTimer timer;
  38. Notifier counter_notifier;
  39. uint32_t cntfrq;
  40. uint32_t cntp_ctl;
  41. uint64_t cntp_cval;
  42. uint64_t cntp_aival;
  43. uint32_t cntp_aival_ctl;
  44. uint32_t cntp_aival_reload;
  45. };
  46. #endif