xref: /openbmc/qemu/include/hw/rtc/pl031.h (revision 4dad0a9aa818698e0735c8352bf7925a1660df6f)
1877c181cSPhilippe Mathieu-Daudé /*
2877c181cSPhilippe Mathieu-Daudé  * ARM AMBA PrimeCell PL031 RTC
3877c181cSPhilippe Mathieu-Daudé  *
4877c181cSPhilippe Mathieu-Daudé  * Copyright (c) 2007 CodeSourcery
5877c181cSPhilippe Mathieu-Daudé  *
6877c181cSPhilippe Mathieu-Daudé  * This file is free software; you can redistribute it and/or modify
7877c181cSPhilippe Mathieu-Daudé  * it under the terms of the GNU General Public License version 2 as
8877c181cSPhilippe Mathieu-Daudé  * published by the Free Software Foundation.
9877c181cSPhilippe Mathieu-Daudé  *
10877c181cSPhilippe Mathieu-Daudé  * Contributions after 2012-01-13 are licensed under the terms of the
11877c181cSPhilippe Mathieu-Daudé  * GNU GPL, version 2 or (at your option) any later version.
12877c181cSPhilippe Mathieu-Daudé  */
13877c181cSPhilippe Mathieu-Daudé 
14877c181cSPhilippe Mathieu-Daudé #ifndef HW_RTC_PL031_H
15877c181cSPhilippe Mathieu-Daudé #define HW_RTC_PL031_H
16877c181cSPhilippe Mathieu-Daudé 
17877c181cSPhilippe Mathieu-Daudé #include "hw/sysbus.h"
18877c181cSPhilippe Mathieu-Daudé #include "qemu/timer.h"
19db1015e9SEduardo Habkost #include "qom/object.h"
20877c181cSPhilippe Mathieu-Daudé 
21877c181cSPhilippe Mathieu-Daudé #define TYPE_PL031 "pl031"
22*8063396bSEduardo Habkost OBJECT_DECLARE_SIMPLE_TYPE(PL031State, PL031)
23877c181cSPhilippe Mathieu-Daudé 
24db1015e9SEduardo Habkost struct PL031State {
25877c181cSPhilippe Mathieu-Daudé     SysBusDevice parent_obj;
26877c181cSPhilippe Mathieu-Daudé 
27877c181cSPhilippe Mathieu-Daudé     MemoryRegion iomem;
28877c181cSPhilippe Mathieu-Daudé     QEMUTimer *timer;
29877c181cSPhilippe Mathieu-Daudé     qemu_irq irq;
30877c181cSPhilippe Mathieu-Daudé 
31877c181cSPhilippe Mathieu-Daudé     /*
32877c181cSPhilippe Mathieu-Daudé      * Needed to preserve the tick_count across migration, even if the
33877c181cSPhilippe Mathieu-Daudé      * absolute value of the rtc_clock is different on the source and
34877c181cSPhilippe Mathieu-Daudé      * destination.
35877c181cSPhilippe Mathieu-Daudé      */
36877c181cSPhilippe Mathieu-Daudé     uint32_t tick_offset_vmstate;
37877c181cSPhilippe Mathieu-Daudé     uint32_t tick_offset;
38877c181cSPhilippe Mathieu-Daudé     bool tick_offset_migrated;
39877c181cSPhilippe Mathieu-Daudé     bool migrate_tick_offset;
40877c181cSPhilippe Mathieu-Daudé 
41877c181cSPhilippe Mathieu-Daudé     uint32_t mr;
42877c181cSPhilippe Mathieu-Daudé     uint32_t lr;
43877c181cSPhilippe Mathieu-Daudé     uint32_t cr;
44877c181cSPhilippe Mathieu-Daudé     uint32_t im;
45877c181cSPhilippe Mathieu-Daudé     uint32_t is;
46db1015e9SEduardo Habkost };
47877c181cSPhilippe Mathieu-Daudé 
48877c181cSPhilippe Mathieu-Daudé #endif
49