Revision 868d585a hw/m48t59.c

b/hw/m48t59.c
161 161
    NVRAM->alarm = mktime(tm);
162 162
    if (NVRAM->alrm_timer != NULL) {
163 163
        qemu_del_timer(NVRAM->alrm_timer);
164
	NVRAM->alrm_timer = NULL;
164
        if (NVRAM->alarm - time(NULL) > 0)
165
            qemu_mod_timer(NVRAM->alrm_timer, NVRAM->alarm * 1000);
165 166
    }
166
    if (NVRAM->alarm - time(NULL) > 0)
167
	qemu_mod_timer(NVRAM->alrm_timer, NVRAM->alarm * 1000);
168 167
}
169 168

  
170 169
/* Watchdog management */
......
188 187
{
189 188
    uint64_t interval; /* in 1/16 seconds */
190 189

  
190
    NVRAM->buffer[0x1FF0] &= ~0x80;
191 191
    if (NVRAM->wd_timer != NULL) {
192 192
        qemu_del_timer(NVRAM->wd_timer);
193
	NVRAM->wd_timer = NULL;
194
    }
195
    NVRAM->buffer[0x1FF0] &= ~0x80;
196
    if (value != 0) {
197
	interval = (1 << (2 * (value & 0x03))) * ((value >> 2) & 0x1F);
198
	qemu_mod_timer(NVRAM->wd_timer, ((uint64_t)time(NULL) * 1000) +
199
		       ((interval * 1000) >> 4));
193
        if (value != 0) {
194
            interval = (1 << (2 * (value & 0x03))) * ((value >> 2) & 0x1F);
195
            qemu_mod_timer(NVRAM->wd_timer, ((uint64_t)time(NULL) * 1000) +
196
                           ((interval * 1000) >> 4));
197
        }
200 198
    }
201 199
}
202 200

  

Also available in: Unified diff