stellaris-gptm.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Luminary Micro Stellaris General Purpose Timer Module
  3. *
  4. * Copyright (c) 2006 CodeSourcery.
  5. * Written by Paul Brook
  6. *
  7. * This code is licensed under the GPL.
  8. */
  9. #ifndef HW_TIMER_STELLARIS_GPTM_H
  10. #define HW_TIMER_STELLARIS_GPTM_H
  11. #include "qom/object.h"
  12. #include "hw/sysbus.h"
  13. #include "hw/irq.h"
  14. #include "hw/clock.h"
  15. #define TYPE_STELLARIS_GPTM "stellaris-gptm"
  16. OBJECT_DECLARE_SIMPLE_TYPE(gptm_state, STELLARIS_GPTM)
  17. /*
  18. * QEMU interface:
  19. * + sysbus MMIO region 0: register bank
  20. * + sysbus IRQ 0: timer interrupt
  21. * + unnamed GPIO output 0: trigger output for the ADC
  22. * + Clock input "clk": the 32-bit countdown timer runs at this speed
  23. */
  24. struct gptm_state {
  25. SysBusDevice parent_obj;
  26. MemoryRegion iomem;
  27. uint32_t config;
  28. uint32_t mode[2];
  29. uint32_t control;
  30. uint32_t state;
  31. uint32_t mask;
  32. uint32_t load[2];
  33. uint32_t match[2];
  34. uint32_t prescale[2];
  35. uint32_t match_prescale[2];
  36. uint32_t rtc;
  37. int64_t tick[2];
  38. struct gptm_state *opaque[2];
  39. QEMUTimer *timer[2];
  40. /* The timers have an alternate output used to trigger the ADC. */
  41. qemu_irq trigger;
  42. qemu_irq irq;
  43. Clock *clk;
  44. };
  45. #endif