allwinner-a10-pit.h 1.8 KB

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