renesas_cmt.h 819 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. #ifndef HW_TIMER_RENESAS_CMT_H
  9. #define HW_TIMER_RENESAS_CMT_H
  10. #include "qemu/timer.h"
  11. #include "hw/sysbus.h"
  12. #include "qom/object.h"
  13. #define TYPE_RENESAS_CMT "renesas-cmt"
  14. typedef struct RCMTState RCMTState;
  15. DECLARE_INSTANCE_CHECKER(RCMTState, RCMT,
  16. TYPE_RENESAS_CMT)
  17. enum {
  18. CMT_CH = 2,
  19. CMT_NR_IRQ = 1 * CMT_CH
  20. };
  21. struct RCMTState {
  22. /*< private >*/
  23. SysBusDevice parent_obj;
  24. /*< public >*/
  25. uint64_t input_freq;
  26. MemoryRegion memory;
  27. uint16_t cmstr;
  28. uint16_t cmcr[CMT_CH];
  29. uint16_t cmcnt[CMT_CH];
  30. uint16_t cmcor[CMT_CH];
  31. int64_t tick[CMT_CH];
  32. qemu_irq cmi[CMT_CH];
  33. QEMUTimer timer[CMT_CH];
  34. };
  35. #endif