Lines Matching refs:rtc
27 static void aspeed_rtc_calc_offset(AspeedRtcState *rtc) in aspeed_rtc_calc_offset() argument
31 uint32_t reg1 = rtc->reg[COUNTER1]; in aspeed_rtc_calc_offset()
32 uint32_t reg2 = rtc->reg[COUNTER2]; in aspeed_rtc_calc_offset()
44 rtc->offset = qemu_timedate_diff(&tm); in aspeed_rtc_calc_offset()
47 static uint32_t aspeed_rtc_get_counter(AspeedRtcState *rtc, int r) in aspeed_rtc_get_counter() argument
52 qemu_get_timedate(&now, rtc->offset); in aspeed_rtc_get_counter()
71 AspeedRtcState *rtc = opaque; in aspeed_rtc_read() local
78 if (rtc->reg[CONTROL] & RTC_ENABLED) { in aspeed_rtc_read()
79 rtc->reg[r] = aspeed_rtc_get_counter(rtc, r); in aspeed_rtc_read()
83 val = rtc->reg[r]; in aspeed_rtc_read()
100 AspeedRtcState *rtc = opaque; in aspeed_rtc_write() local
106 if (!(rtc->reg[CONTROL] & RTC_UNLOCKED)) { in aspeed_rtc_write()
111 rtc->reg[r] = val; in aspeed_rtc_write()
112 aspeed_rtc_calc_offset(rtc); in aspeed_rtc_write()
125 AspeedRtcState *rtc = ASPEED_RTC(d); in aspeed_rtc_reset() local
127 rtc->offset = 0; in aspeed_rtc_reset()
128 memset(rtc->reg, 0, sizeof(rtc->reg)); in aspeed_rtc_reset()