cmsdk-apb-timer.h 995 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * ARM CMSDK APB timer emulation
  3. *
  4. * Copyright (c) 2017 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. #ifndef CMSDK_APB_TIMER_H
  12. #define CMSDK_APB_TIMER_H
  13. #include "hw/sysbus.h"
  14. #include "hw/ptimer.h"
  15. #include "hw/clock.h"
  16. #include "qom/object.h"
  17. #define TYPE_CMSDK_APB_TIMER "cmsdk-apb-timer"
  18. OBJECT_DECLARE_SIMPLE_TYPE(CMSDKAPBTimer, CMSDK_APB_TIMER)
  19. /*
  20. * QEMU interface:
  21. * + Clock input "pclk": clock for the timer
  22. * + sysbus MMIO region 0: the register bank
  23. * + sysbus IRQ 0: timer interrupt TIMERINT
  24. */
  25. struct CMSDKAPBTimer {
  26. /*< private >*/
  27. SysBusDevice parent_obj;
  28. /*< public >*/
  29. MemoryRegion iomem;
  30. qemu_irq timerint;
  31. struct ptimer_state *timer;
  32. Clock *pclk;
  33. uint32_t ctrl;
  34. uint32_t value;
  35. uint32_t reload;
  36. uint32_t intstatus;
  37. };
  38. #endif