allwinner-a10-pit.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #ifndef ALLWINNER_A10_PIT_H
  2. #define ALLWINNER_A10_PIT_H
  3. #include "hw/ptimer.h"
  4. #include "hw/sysbus.h"
  5. #include "qom/object.h"
  6. #define TYPE_AW_A10_PIT "allwinner-A10-timer"
  7. OBJECT_DECLARE_SIMPLE_TYPE(AwA10PITState, AW_A10_PIT)
  8. #define AW_A10_PIT_TIMER_NR 6
  9. #define AW_A10_PIT_TIMER_IRQ 0x1
  10. #define AW_A10_PIT_WDOG_IRQ 0x100
  11. #define AW_A10_PIT_TIMER_IRQ_EN 0
  12. #define AW_A10_PIT_TIMER_IRQ_ST 0x4
  13. #define AW_A10_PIT_TIMER_CONTROL 0x0
  14. #define AW_A10_PIT_TIMER_EN 0x1
  15. #define AW_A10_PIT_TIMER_RELOAD 0x2
  16. #define AW_A10_PIT_TIMER_MODE 0x80
  17. #define AW_A10_PIT_TIMER_INTERVAL 0x4
  18. #define AW_A10_PIT_TIMER_COUNT 0x8
  19. #define AW_A10_PIT_WDOG_CONTROL 0x90
  20. #define AW_A10_PIT_WDOG_MODE 0x94
  21. #define AW_A10_PIT_COUNT_CTL 0xa0
  22. #define AW_A10_PIT_COUNT_RL_EN 0x2
  23. #define AW_A10_PIT_COUNT_CLR_EN 0x1
  24. #define AW_A10_PIT_COUNT_LO 0xa4
  25. #define AW_A10_PIT_COUNT_HI 0xa8
  26. #define AW_A10_PIT_TIMER_BASE 0x10
  27. #define AW_A10_PIT_TIMER_BASE_END \
  28. (AW_A10_PIT_TIMER_BASE * 6 + AW_A10_PIT_TIMER_COUNT)
  29. #define AW_A10_PIT_DEFAULT_CLOCK 0x4
  30. typedef struct AwA10TimerContext {
  31. AwA10PITState *container;
  32. int index;
  33. } AwA10TimerContext;
  34. struct AwA10PITState {
  35. /*< private >*/
  36. SysBusDevice parent_obj;
  37. /*< public >*/
  38. qemu_irq irq[AW_A10_PIT_TIMER_NR];
  39. ptimer_state * timer[AW_A10_PIT_TIMER_NR];
  40. AwA10TimerContext timer_context[AW_A10_PIT_TIMER_NR];
  41. MemoryRegion iomem;
  42. uint32_t clk_freq[4];
  43. uint32_t irq_enable;
  44. uint32_t irq_status;
  45. uint32_t control[AW_A10_PIT_TIMER_NR];
  46. uint32_t interval[AW_A10_PIT_TIMER_NR];
  47. uint32_t count[AW_A10_PIT_TIMER_NR];
  48. uint32_t watch_dog_mode;
  49. uint32_t watch_dog_control;
  50. uint32_t count_lo;
  51. uint32_t count_hi;
  52. uint32_t count_ctl;
  53. };
  54. #endif