renesas_tmr.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Renesas 8bit timer Object
  3. *
  4. * Copyright (c) 2018 Yoshinori Sato
  5. *
  6. * SPDX-License-Identifier: GPL-2.0-or-later
  7. */
  8. #ifndef HW_TIMER_RENESAS_TMR_H
  9. #define HW_TIMER_RENESAS_TMR_H
  10. #include "qemu/timer.h"
  11. #include "hw/sysbus.h"
  12. #include "qom/object.h"
  13. #define TYPE_RENESAS_TMR "renesas-tmr"
  14. typedef struct RTMRState RTMRState;
  15. DECLARE_INSTANCE_CHECKER(RTMRState, RTMR,
  16. TYPE_RENESAS_TMR)
  17. enum timer_event {
  18. cmia = 0,
  19. cmib = 1,
  20. ovi = 2,
  21. none = 3,
  22. TMR_NR_EVENTS = 4
  23. };
  24. enum {
  25. TMR_CH = 2,
  26. TMR_NR_IRQ = 3 * TMR_CH
  27. };
  28. struct RTMRState {
  29. /*< private >*/
  30. SysBusDevice parent_obj;
  31. /*< public >*/
  32. uint64_t input_freq;
  33. MemoryRegion memory;
  34. int64_t tick;
  35. uint8_t tcnt[TMR_CH];
  36. uint8_t tcora[TMR_CH];
  37. uint8_t tcorb[TMR_CH];
  38. uint8_t tcr[TMR_CH];
  39. uint8_t tccr[TMR_CH];
  40. uint8_t tcor[TMR_CH];
  41. uint8_t tcsr[TMR_CH];
  42. int64_t div_round[TMR_CH];
  43. uint8_t next[TMR_CH];
  44. qemu_irq cmia[TMR_CH];
  45. qemu_irq cmib[TMR_CH];
  46. qemu_irq ovi[TMR_CH];
  47. QEMUTimer timer[TMR_CH];
  48. };
  49. #endif