Go to the documentation of this file.
39 #include "debug/MC146818.hh"
49 result += (
val / 10) << 4;
58 result += (
val >> 4) * 10;
68 mon = time.tm_mon + 1;
75 wday = time.tm_wday + 1;
91 bool bcd,
Tick frequency)
106 DPRINTFN(
"Real-time clock set to %s", asctime(&time));
116 MC146818::rega_dv_disabled(
const RtcRegA &
reg)
130 if (!rega_dv_disabled(stat_regA))
137 bool panic_unsupported(
false);
151 RtcRegA old_rega(stat_regA);
154 stat_regA.uip = old_rega;
156 if (!rega_dv_disabled(stat_regA) &&
158 inform(
"RTC: Unimplemented divider configuration: %i\n",
160 panic_unsupported =
true;
164 inform(
"RTC: Unimplemented interrupt rate: %i\n",
166 panic_unsupported =
true;
169 if (rega_dv_disabled(stat_regA)) {
174 }
else if (rega_dv_disabled(old_rega)) {
186 inform(
"RTC: Unimplemented interrupt configuration: %s %s\n",
189 panic_unsupported =
true;
193 inform(
"RTC: The binary interface is not fully implemented.\n");
194 panic_unsupported =
true;
198 inform(
"RTC: The 12h time format not supported.\n");
199 panic_unsupported =
true;
203 inform(
"RTC: Automatic daylight saving time not supported.\n");
204 panic_unsupported =
true;
209 event.scheduleIntr();
217 panic(
"RTC status registers C and D are not implemented.\n");
222 if (panic_unsupported)
223 panic(
"Unimplemented RTC configuration!\n");
236 stat_regA.uip = !stat_regA.uip;
247 panic(
"Shouldn't be here");
255 assert(!rega_dv_disabled(stat_regA));
267 uint8_t regA_serial(stat_regA);
278 Tick rtcTimerInterruptTickOffset =
event.when() -
curTick();
300 Tick rtcTimerInterruptTickOffset;
302 event.offset = rtcTimerInterruptTickOffset;
303 Tick rtcClockTickOffset;
309 : parent(_parent), interval(
i),
offset(
i)
317 parent->schedule(
this,
curTick() + interval);
324 parent->schedule(
this,
curTick() + interval);
325 parent->handleEvent();
331 return "RTC interrupt";
345 return "RTC clock tick";
static uint8_t unbcdize(uint8_t val)
static const int RTC_STAT_REGA
bool scheduled() const
Determine if the current event is scheduled.
void unserialize(const std::string &base, CheckpointIn &cp)
Reconstruct the state of this object from a checkpoint.
static const int RTC_STAT_REGD
#define UNSERIALIZE_SCALAR(scalar)
void scheduleIntr()
Schedule the RTC periodic interrupt.
time_t mkutctime(struct tm *time)
const char * description() const
Event description.
uint64_t Tick
Tick count type.
void deschedule(Event &event)
RtcRegB stat_regB
RTC status register B.
RTCTickEvent tickEvent
RTC tick event.
static const int RTC_STAT_REGB
Tick when() const
Get the time that the event is scheduled.
void paramOut(CheckpointOut &cp, const string &name, ExtMachInst const &machInst)
static const int RTCA_DV_DISABLED1
void serialize(const std::string &base, CheckpointOut &cp) const
Serialize this object to the given output stream.
void schedule(Event &event, Tick when)
uint8_t readData(const uint8_t addr)
RTC read data.
static const int RTCA_DV_DISABLED0
RTCEvent(MC146818 *_parent, Tick i)
virtual void process()
Event process to occur at interrupt.
Real-Time Clock (MC146818)
virtual const char * description() const
Event description.
void process()
Event process to occur at interrupt.
void arrayParamOut(CheckpointOut &cp, const std::string &name, const CircleBuf< T > ¶m)
#define SERIALIZE_SCALAR(scalar)
static uint8_t bcdize(uint8_t val)
static const int RTCA_DV_32768HZ
static const int RTCA_RS_1024HZ
void writeData(const uint8_t addr, const uint8_t data)
RTC write data.
Overload hash function for BasicBlockRange type.
static const int RTC_STAT_REGC
MC146818(EventManager *em, const std::string &name, const struct tm time, bool bcd, Tick frequency)
void paramIn(CheckpointIn &cp, const string &name, ExtMachInst &machInst)
std::ostream CheckpointOut
void arrayParamIn(CheckpointIn &cp, const std::string &name, CircleBuf< T > ¶m)
void setTime(const struct tm time)
RTCEvent event
RTC periodic interrupt event.
#define panic(...)
This implements a cprintf based panic() function.
Tick curTick()
The current simulated tick.
virtual void startup()
Start ticking.
Generated on Wed Sep 30 2020 14:02:11 for gem5 by doxygen 1.8.17