xref: /qemu/include/hw/rtc/pl031.h (revision db1015e92e04835c9eb50c29625fe566d1202dbd)
1 /*
2  * ARM AMBA PrimeCell PL031 RTC
3  *
4  * Copyright (c) 2007 CodeSourcery
5  *
6  * This file is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * Contributions after 2012-01-13 are licensed under the terms of the
11  * GNU GPL, version 2 or (at your option) any later version.
12  */
13 
14 #ifndef HW_RTC_PL031_H
15 #define HW_RTC_PL031_H
16 
17 #include "hw/sysbus.h"
18 #include "qemu/timer.h"
19 #include "qom/object.h"
20 
21 #define TYPE_PL031 "pl031"
22 typedef struct PL031State PL031State;
23 #define PL031(obj) OBJECT_CHECK(PL031State, (obj), TYPE_PL031)
24 
25 struct PL031State {
26     SysBusDevice parent_obj;
27 
28     MemoryRegion iomem;
29     QEMUTimer *timer;
30     qemu_irq irq;
31 
32     /*
33      * Needed to preserve the tick_count across migration, even if the
34      * absolute value of the rtc_clock is different on the source and
35      * destination.
36      */
37     uint32_t tick_offset_vmstate;
38     uint32_t tick_offset;
39     bool tick_offset_migrated;
40     bool migrate_tick_offset;
41 
42     uint32_t mr;
43     uint32_t lr;
44     uint32_t cr;
45     uint32_t im;
46     uint32_t is;
47 };
48 
49 #endif
50