mc146818.cc (7683:f81f5f27592b) mc146818.cc (7823:dac01f14f20f)
1/*
2 * Copyright (c) 2004-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 200 unchanged lines hidden (view full) ---

209 arrayParamOut(os, base + ".clock_data", clock_data, sizeof(clock_data));
210 paramOut(os, base + ".stat_regA", stat_regA);
211 paramOut(os, base + ".stat_regB", stat_regB);
212
213 //
214 // save the timer tick and rtc clock tick values to correctly reschedule
215 // them during unserialize
216 //
1/*
2 * Copyright (c) 2004-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 200 unchanged lines hidden (view full) ---

209 arrayParamOut(os, base + ".clock_data", clock_data, sizeof(clock_data));
210 paramOut(os, base + ".stat_regA", stat_regA);
211 paramOut(os, base + ".stat_regB", stat_regB);
212
213 //
214 // save the timer tick and rtc clock tick values to correctly reschedule
215 // them during unserialize
216 //
217 Tick rtcTimerInterruptTickOffset = event.when() - curTick;
217 Tick rtcTimerInterruptTickOffset = event.when() - curTick();
218 SERIALIZE_SCALAR(rtcTimerInterruptTickOffset);
218 SERIALIZE_SCALAR(rtcTimerInterruptTickOffset);
219 Tick rtcClockTickOffset = event.when() - curTick;
219 Tick rtcClockTickOffset = event.when() - curTick();
220 SERIALIZE_SCALAR(rtcClockTickOffset);
221}
222
223void
224MC146818::unserialize(const string &base, Checkpoint *cp,
225 const string &section)
226{
227 arrayParamIn(cp, section, base + ".clock_data", clock_data,
228 sizeof(clock_data));
229 paramIn(cp, section, base + ".stat_regA", stat_regA);
230 paramIn(cp, section, base + ".stat_regB", stat_regB);
231
232 //
233 // properly schedule the timer and rtc clock events
234 //
235 Tick rtcTimerInterruptTickOffset;
236 UNSERIALIZE_SCALAR(rtcTimerInterruptTickOffset);
220 SERIALIZE_SCALAR(rtcClockTickOffset);
221}
222
223void
224MC146818::unserialize(const string &base, Checkpoint *cp,
225 const string &section)
226{
227 arrayParamIn(cp, section, base + ".clock_data", clock_data,
228 sizeof(clock_data));
229 paramIn(cp, section, base + ".stat_regA", stat_regA);
230 paramIn(cp, section, base + ".stat_regB", stat_regB);
231
232 //
233 // properly schedule the timer and rtc clock events
234 //
235 Tick rtcTimerInterruptTickOffset;
236 UNSERIALIZE_SCALAR(rtcTimerInterruptTickOffset);
237 reschedule(event, curTick + rtcTimerInterruptTickOffset);
237 reschedule(event, curTick() + rtcTimerInterruptTickOffset);
238 Tick rtcClockTickOffset;
239 UNSERIALIZE_SCALAR(rtcClockTickOffset);
238 Tick rtcClockTickOffset;
239 UNSERIALIZE_SCALAR(rtcClockTickOffset);
240 reschedule(tickEvent, curTick + rtcClockTickOffset);
240 reschedule(tickEvent, curTick() + rtcClockTickOffset);
241}
242
243MC146818::RTCEvent::RTCEvent(MC146818 * _parent, Tick i)
244 : parent(_parent), interval(i)
245{
246 DPRINTF(MC146818, "RTC Event Initilizing\n");
241}
242
243MC146818::RTCEvent::RTCEvent(MC146818 * _parent, Tick i)
244 : parent(_parent), interval(i)
245{
246 DPRINTF(MC146818, "RTC Event Initilizing\n");
247 parent->schedule(this, curTick + interval);
247 parent->schedule(this, curTick() + interval);
248}
249
250void
251MC146818::RTCEvent::scheduleIntr()
252{
248}
249
250void
251MC146818::RTCEvent::scheduleIntr()
252{
253 parent->schedule(this, curTick + interval);
253 parent->schedule(this, curTick() + interval);
254}
255
256void
257MC146818::RTCEvent::process()
258{
259 DPRINTF(MC146818, "RTC Timer Interrupt\n");
254}
255
256void
257MC146818::RTCEvent::process()
258{
259 DPRINTF(MC146818, "RTC Timer Interrupt\n");
260 parent->schedule(this, curTick + interval);
260 parent->schedule(this, curTick() + interval);
261 parent->handleEvent();
262}
263
264const char *
265MC146818::RTCEvent::description() const
266{
267 return "RTC interrupt";
268}
269
270void
271MC146818::RTCTickEvent::process()
272{
273 DPRINTF(MC146818, "RTC clock tick\n");
261 parent->handleEvent();
262}
263
264const char *
265MC146818::RTCEvent::description() const
266{
267 return "RTC interrupt";
268}
269
270void
271MC146818::RTCTickEvent::process()
272{
273 DPRINTF(MC146818, "RTC clock tick\n");
274 parent->schedule(this, curTick + SimClock::Int::s);
274 parent->schedule(this, curTick() + SimClock::Int::s);
275 parent->tickClock();
276}
277
278const char *
279MC146818::RTCTickEvent::description() const
280{
281 return "RTC clock tick";
282}
275 parent->tickClock();
276}
277
278const char *
279MC146818::RTCTickEvent::description() const
280{
281 return "RTC clock tick";
282}