qapi: Restrict LostTickPolicy enum to machine code
[qemu/ar7.git] / include / hw / rtc / mc146818rtc.h
blob5b45b229244c4b33d6eda20a44cbeb8ca91fb271
1 /*
2 * QEMU MC146818 RTC emulation
4 * Copyright (c) 2003-2004 Fabrice Bellard
6 * SPDX-License-Identifier: MIT
7 */
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(RTCState, MC146818_RTC)
21 struct RTCState {
22 ISADevice parent_obj;
24 MemoryRegion io;
25 MemoryRegion coalesced_io;
26 uint8_t cmos_data[128];
27 uint8_t cmos_index;
28 int32_t base_year;
29 uint64_t base_rtc;
30 uint64_t last_update;
31 int64_t offset;
32 qemu_irq irq;
33 int it_shift;
34 /* periodic timer */
35 QEMUTimer *periodic_timer;
36 int64_t next_periodic_time;
37 /* update-ended timer */
38 QEMUTimer *update_timer;
39 uint64_t next_alarm_time;
40 uint16_t irq_reinject_on_ack_count;
41 uint32_t irq_coalesced;
42 uint32_t period;
43 QEMUTimer *coalesced_timer;
44 Notifier clock_reset_notifier;
45 LostTickPolicy lost_tick_policy;
46 Notifier suspend_notifier;
47 QLIST_ENTRY(RTCState) link;
50 #define RTC_ISA_IRQ 8
51 #define RTC_ISA_BASE 0x70
53 ISADevice *mc146818_rtc_init(ISABus *bus, int base_year,
54 qemu_irq intercept_irq);
55 void rtc_set_memory(ISADevice *dev, int addr, int val);
56 int rtc_get_memory(ISADevice *dev, int addr);
58 #endif /* MC146818RTC_H */