bcm2835_systmr.h 891 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * BCM2835 SYS timer emulation
  3. *
  4. * Copyright (c) 2019 Philippe Mathieu-Daudé <f4bug@amsat.org>
  5. *
  6. * SPDX-License-Identifier: GPL-2.0-or-later
  7. */
  8. #ifndef BCM2835_SYSTMR_H
  9. #define BCM2835_SYSTMR_H
  10. #include "hw/sysbus.h"
  11. #include "hw/irq.h"
  12. #include "qemu/timer.h"
  13. #include "qom/object.h"
  14. #define TYPE_BCM2835_SYSTIMER "bcm2835-sys-timer"
  15. OBJECT_DECLARE_SIMPLE_TYPE(BCM2835SystemTimerState, BCM2835_SYSTIMER)
  16. #define BCM2835_SYSTIMER_COUNT 4
  17. typedef struct {
  18. unsigned id;
  19. QEMUTimer timer;
  20. qemu_irq irq;
  21. BCM2835SystemTimerState *state;
  22. } BCM2835SystemTimerCompare;
  23. struct BCM2835SystemTimerState {
  24. /*< private >*/
  25. SysBusDevice parent_obj;
  26. /*< public >*/
  27. MemoryRegion iomem;
  28. struct {
  29. uint32_t ctrl_status;
  30. uint32_t compare[BCM2835_SYSTIMER_COUNT];
  31. } reg;
  32. BCM2835SystemTimerCompare tmr[BCM2835_SYSTIMER_COUNT];
  33. };
  34. #endif