2 * QEMU MC146818 RTC emulation
4 * Copyright (c) 2003-2004 Fabrice Bellard
6 * SPDX-License-Identifier: MIT
9 #ifndef HW_RTC_MC146818RTC_H
10 #define HW_RTC_MC146818RTC_H
12 #include "qapi/qapi-types-machine.h"
13 #include "qemu/queue.h"
14 #include "qemu/timer.h"
15 #include "hw/isa/isa.h"
16 #include "qom/object.h"
18 #define TYPE_MC146818_RTC "mc146818rtc"
19 OBJECT_DECLARE_SIMPLE_TYPE(MC146818RtcState
, MC146818_RTC
)
21 struct MC146818RtcState
{
25 MemoryRegion coalesced_io
;
26 uint8_t cmos_data
[128];
37 QEMUTimer
*periodic_timer
;
38 int64_t next_periodic_time
;
39 /* update-ended timer */
40 QEMUTimer
*update_timer
;
41 uint64_t next_alarm_time
;
42 uint16_t irq_reinject_on_ack_count
;
43 uint32_t irq_coalesced
;
45 QEMUTimer
*coalesced_timer
;
46 Notifier clock_reset_notifier
;
47 LostTickPolicy lost_tick_policy
;
48 Notifier suspend_notifier
;
49 QLIST_ENTRY(MC146818RtcState
) link
;
54 MC146818RtcState
*mc146818_rtc_init(ISABus
*bus
, int base_year
,
55 qemu_irq intercept_irq
);
56 void mc146818rtc_set_cmos_data(MC146818RtcState
*s
, int addr
, int val
);
57 int mc146818rtc_get_cmos_data(MC146818RtcState
*s
, int addr
);
58 void rtc_reset_reinjection(MC146818RtcState
*rtc
);
60 #endif /* HW_RTC_MC146818RTC_H */