xref: /openbmc/qemu/include/hw/timer/stellaris-gptm.h (revision 6c1ebe75)
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 
10 #ifndef HW_TIMER_STELLARIS_GPTM_H
11 #define HW_TIMER_STELLARIS_GPTM_H
12 
13 #include "qom/object.h"
14 #include "hw/sysbus.h"
15 #include "hw/irq.h"
16 #include "hw/clock.h"
17 
18 #define TYPE_STELLARIS_GPTM "stellaris-gptm"
19 OBJECT_DECLARE_SIMPLE_TYPE(gptm_state, STELLARIS_GPTM)
20 
21 /*
22  * QEMU interface:
23  *  + sysbus MMIO region 0: register bank
24  *  + sysbus IRQ 0: timer interrupt
25  *  + unnamed GPIO output 0: trigger output for the ADC
26  *  + Clock input "clk": the 32-bit countdown timer runs at this speed
27  */
28 struct gptm_state {
29     SysBusDevice parent_obj;
30 
31     MemoryRegion iomem;
32     uint32_t config;
33     uint32_t mode[2];
34     uint32_t control;
35     uint32_t state;
36     uint32_t mask;
37     uint32_t load[2];
38     uint32_t match[2];
39     uint32_t prescale[2];
40     uint32_t match_prescale[2];
41     uint32_t rtc;
42     int64_t tick[2];
43     struct gptm_state *opaque[2];
44     QEMUTimer *timer[2];
45     /* The timers have an alternate output used to trigger the ADC.  */
46     qemu_irq trigger;
47     qemu_irq irq;
48     Clock *clk;
49 };
50 
51 #endif
52