Unify RTCs that use host time, fix M48t59 alarm.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3984 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
balrog 2008-02-17 11:42:19 +00:00
parent a0d69e0097
commit f650305967
8 changed files with 115 additions and 123 deletions

View file

@ -1183,27 +1183,22 @@ static CPUWriteMemoryFunc *pxa2xx_rtc_writefn[] = {
static void pxa2xx_rtc_init(struct pxa2xx_state_s *s)
{
struct tm *tm;
time_t ti;
struct tm tm;
int wom;
s->rttr = 0x7fff;
s->rtsr = 0;
time(&ti);
if (rtc_utc)
tm = gmtime(&ti);
else
tm = localtime(&ti);
wom = ((tm->tm_mday - 1) / 7) + 1;
qemu_get_timedate(&tm, 0);
wom = ((tm.tm_mday - 1) / 7) + 1;
s->last_rcnr = (uint32_t) ti;
s->last_rdcr = (wom << 20) | ((tm->tm_wday + 1) << 17) |
(tm->tm_hour << 12) | (tm->tm_min << 6) | tm->tm_sec;
s->last_rycr = ((tm->tm_year + 1900) << 9) |
((tm->tm_mon + 1) << 5) | tm->tm_mday;
s->last_swcr = (tm->tm_hour << 19) |
(tm->tm_min << 13) | (tm->tm_sec << 7);
s->last_rcnr = (uint32_t) mktime(&tm);
s->last_rdcr = (wom << 20) | ((tm.tm_wday + 1) << 17) |
(tm.tm_hour << 12) | (tm.tm_min << 6) | tm.tm_sec;
s->last_rycr = ((tm.tm_year + 1900) << 9) |
((tm.tm_mon + 1) << 5) | tm.tm_mday;
s->last_swcr = (tm.tm_hour << 19) |
(tm.tm_min << 13) | (tm.tm_sec << 7);
s->last_rtcpicr = 0;
s->last_hz = s->last_sw = s->last_pi = qemu_get_clock(rt_clock);