2016-06-29 11:12:57 +03:00
|
|
|
#ifndef ALLWINNER_A10_PIT_H
|
|
|
|
#define ALLWINNER_A10_PIT_H
|
2013-12-17 23:42:37 +04:00
|
|
|
|
|
|
|
#include "hw/ptimer.h"
|
2019-08-12 08:23:31 +03:00
|
|
|
#include "hw/sysbus.h"
|
2020-09-03 23:43:22 +03:00
|
|
|
#include "qom/object.h"
|
2013-12-17 23:42:37 +04:00
|
|
|
|
|
|
|
#define TYPE_AW_A10_PIT "allwinner-A10-timer"
|
2020-09-03 23:43:22 +03:00
|
|
|
typedef struct AwA10PITState AwA10PITState;
|
2020-09-01 00:07:33 +03:00
|
|
|
DECLARE_INSTANCE_CHECKER(AwA10PITState, AW_A10_PIT,
|
|
|
|
TYPE_AW_A10_PIT)
|
2013-12-17 23:42:37 +04:00
|
|
|
|
|
|
|
#define AW_A10_PIT_TIMER_NR 6
|
|
|
|
#define AW_A10_PIT_TIMER_IRQ 0x1
|
|
|
|
#define AW_A10_PIT_WDOG_IRQ 0x100
|
|
|
|
|
|
|
|
#define AW_A10_PIT_TIMER_IRQ_EN 0
|
|
|
|
#define AW_A10_PIT_TIMER_IRQ_ST 0x4
|
|
|
|
|
|
|
|
#define AW_A10_PIT_TIMER_CONTROL 0x0
|
|
|
|
#define AW_A10_PIT_TIMER_EN 0x1
|
|
|
|
#define AW_A10_PIT_TIMER_RELOAD 0x2
|
|
|
|
#define AW_A10_PIT_TIMER_MODE 0x80
|
|
|
|
|
|
|
|
#define AW_A10_PIT_TIMER_INTERVAL 0x4
|
|
|
|
#define AW_A10_PIT_TIMER_COUNT 0x8
|
|
|
|
#define AW_A10_PIT_WDOG_CONTROL 0x90
|
|
|
|
#define AW_A10_PIT_WDOG_MODE 0x94
|
|
|
|
|
|
|
|
#define AW_A10_PIT_COUNT_CTL 0xa0
|
|
|
|
#define AW_A10_PIT_COUNT_RL_EN 0x2
|
|
|
|
#define AW_A10_PIT_COUNT_CLR_EN 0x1
|
|
|
|
#define AW_A10_PIT_COUNT_LO 0xa4
|
|
|
|
#define AW_A10_PIT_COUNT_HI 0xa8
|
|
|
|
|
|
|
|
#define AW_A10_PIT_TIMER_BASE 0x10
|
|
|
|
#define AW_A10_PIT_TIMER_BASE_END \
|
|
|
|
(AW_A10_PIT_TIMER_BASE * 6 + AW_A10_PIT_TIMER_COUNT)
|
|
|
|
|
|
|
|
#define AW_A10_PIT_DEFAULT_CLOCK 0x4
|
|
|
|
|
2014-03-25 22:22:06 +04:00
|
|
|
|
|
|
|
typedef struct AwA10TimerContext {
|
|
|
|
AwA10PITState *container;
|
|
|
|
int index;
|
|
|
|
} AwA10TimerContext;
|
|
|
|
|
|
|
|
struct AwA10PITState {
|
2013-12-17 23:42:37 +04:00
|
|
|
/*< private >*/
|
|
|
|
SysBusDevice parent_obj;
|
|
|
|
/*< public >*/
|
|
|
|
qemu_irq irq[AW_A10_PIT_TIMER_NR];
|
|
|
|
ptimer_state * timer[AW_A10_PIT_TIMER_NR];
|
2014-03-25 22:22:06 +04:00
|
|
|
AwA10TimerContext timer_context[AW_A10_PIT_TIMER_NR];
|
2013-12-17 23:42:37 +04:00
|
|
|
MemoryRegion iomem;
|
2014-03-25 22:22:08 +04:00
|
|
|
uint32_t clk_freq[4];
|
2013-12-17 23:42:37 +04:00
|
|
|
|
|
|
|
uint32_t irq_enable;
|
|
|
|
uint32_t irq_status;
|
|
|
|
uint32_t control[AW_A10_PIT_TIMER_NR];
|
|
|
|
uint32_t interval[AW_A10_PIT_TIMER_NR];
|
|
|
|
uint32_t count[AW_A10_PIT_TIMER_NR];
|
|
|
|
uint32_t watch_dog_mode;
|
|
|
|
uint32_t watch_dog_control;
|
|
|
|
uint32_t count_lo;
|
|
|
|
uint32_t count_hi;
|
|
|
|
uint32_t count_ctl;
|
2014-03-25 22:22:06 +04:00
|
|
|
};
|
2013-12-17 23:42:37 +04:00
|
|
|
|
|
|
|
#endif
|