aboutsummaryrefslogtreecommitdiff
path: root/hw/rtc/pl031.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/rtc/pl031.c')
-rw-r--r--hw/rtc/pl031.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/hw/rtc/pl031.c b/hw/rtc/pl031.c
index 2bbb2062ac..e7ced90b02 100644
--- a/hw/rtc/pl031.c
+++ b/hw/rtc/pl031.c
@@ -24,6 +24,7 @@
#include "qemu/log.h"
#include "qemu/module.h"
#include "trace.h"
+#include "qapi/qapi-events-misc-target.h"
#define RTC_DR 0x00 /* Data read register */
#define RTC_MR 0x04 /* Match register */
@@ -136,10 +137,17 @@ static void pl031_write(void * opaque, hwaddr offset,
trace_pl031_write(offset, value);
switch (offset) {
- case RTC_LR:
+ case RTC_LR: {
+ struct tm tm;
+
s->tick_offset += value - pl031_get_count(s);
+
+ qemu_get_timedate(&tm, s->tick_offset);
+ qapi_event_send_rtc_change(qemu_timedate_diff(&tm));
+
pl031_set_alarm(s);
break;
+ }
case RTC_MR:
s->mr = value;
pl031_set_alarm(s);