File: allwinner-a10-pit.h

package info (click to toggle)
qemu 1%3A7.2%2Bdfsg-7%2Bdeb12u13
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 288,192 kB
  • sloc: ansic: 2,701,923; pascal: 112,708; python: 62,697; sh: 50,281; asm: 48,732; makefile: 17,260; cpp: 9,441; perl: 8,084; xml: 2,911; objc: 1,870; php: 1,299; tcl: 1,188; yacc: 604; lex: 363; sql: 71; awk: 35; sed: 11; javascript: 7
file content (68 lines) | stat: -rw-r--r-- 1,812 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef ALLWINNER_A10_PIT_H
#define ALLWINNER_A10_PIT_H

#include "hw/ptimer.h"
#include "hw/sysbus.h"
#include "qom/object.h"

#define TYPE_AW_A10_PIT "allwinner-A10-timer"
OBJECT_DECLARE_SIMPLE_TYPE(AwA10PITState, AW_A10_PIT)

#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


typedef struct AwA10TimerContext {
    AwA10PITState *container;
    int index;
} AwA10TimerContext;

struct AwA10PITState {
    /*< private >*/
    SysBusDevice parent_obj;
    /*< public >*/
    qemu_irq irq[AW_A10_PIT_TIMER_NR];
    ptimer_state * timer[AW_A10_PIT_TIMER_NR];
    AwA10TimerContext timer_context[AW_A10_PIT_TIMER_NR];
    MemoryRegion iomem;
    uint32_t clk_freq[4];

    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;
};

#endif