gem5
|
Real-Time Clock (MC146818) More...
#include <mc146818.hh>
Classes | |
struct | RTCEvent |
Event for RTC periodic interrupt. More... | |
struct | RTCTickEvent |
Event for RTC periodic interrupt. More... | |
Public Member Functions | |
MC146818 (EventManager *em, const std::string &name, const struct tm time, bool bcd, Tick frequency) | |
virtual | ~MC146818 () |
virtual void | startup () |
Start ticking. More... | |
void | writeData (const uint8_t addr, const uint8_t data) |
RTC write data. More... | |
uint8_t | readData (const uint8_t addr) |
RTC read data. More... | |
void | tickClock () |
void | serialize (const std::string &base, CheckpointOut &cp) const |
Serialize this object to the given output stream. More... | |
void | unserialize (const std::string &base, CheckpointIn &cp) |
Reconstruct the state of this object from a checkpoint. More... | |
Public Member Functions inherited from EventManager | |
EventManager (EventManager &em) | |
EventManager (EventManager *em) | |
EventManager (EventQueue *eq) | |
EventQueue * | eventQueue () const |
void | schedule (Event &event, Tick when) |
void | deschedule (Event &event) |
void | reschedule (Event &event, Tick when, bool always=false) |
void | schedule (Event *event, Tick when) |
void | deschedule (Event *event) |
void | reschedule (Event *event, Tick when, bool always=false) |
void | wakeupEventQueue (Tick when=(Tick)-1) |
void | setCurTick (Tick newVal) |
Protected Member Functions | |
virtual void | handleEvent () |
Private Member Functions | |
const std::string & | name () const |
void | setTime (const struct tm time) |
BitUnion8 (RtcRegA) Bitfield< 7 > uip | |
EndBitUnion (RtcRegA) static inline bool rega_dv_disabled(const RtcRegA ®) | |
Is the DV field in regA set to disabled? More... | |
BitUnion8 (RtcRegB) Bitfield< 7 > set | |
EndBitUnion (RtcRegB) RtcRegA stat_regA | |
USA Daylight Savings Time enable. More... | |
Private Attributes | |
std::string | _name |
RTCEvent | event |
RTC periodic interrupt event. More... | |
RTCTickEvent | tickEvent |
RTC tick event. More... | |
union { | |
uint8_t clock_data [10] | |
struct { | |
uint8_t sec | |
uint8_t sec_alrm | |
uint8_t min | |
uint8_t min_alrm | |
uint8_t hour | |
uint8_t hour_alrm | |
uint8_t wday | |
uint8_t mday | |
uint8_t mon | |
uint8_t year | |
} | |
}; | |
Data for real-time clock function. More... | |
struct tm | curTime |
Bitfield< 6, 4 > | dv |
1 = date and time update in progress More... | |
Bitfield< 3, 0 > | rs |
Divider configuration. More... | |
Bitfield< 6 > | pie |
stop clock updates More... | |
Bitfield< 5 > | aie |
1 = enable periodic clock interrupt More... | |
Bitfield< 4 > | uie |
1 = enable alarm interrupt More... | |
Bitfield< 3 > | sqwe |
1 = enable update-ended interrupt More... | |
Bitfield< 2 > | dm |
1 = output sqare wave at SQW pin More... | |
Bitfield< 1 > | format24h |
0 = BCD, 1 = Binary coded time More... | |
Bitfield< 0 > | dse |
0 = 12 hours, 1 = 24 hours More... | |
RtcRegB | stat_regB |
RTC status register B. More... | |
Additional Inherited Members | |
Protected Attributes inherited from EventManager | |
EventQueue * | eventq |
A pointer to this object's event queue. More... | |
Real-Time Clock (MC146818)
Definition at line 41 of file mc146818.hh.
MC146818::MC146818 | ( | EventManager * | em, |
const std::string & | name, | ||
const struct tm | time, | ||
bool | bcd, | ||
Tick | frequency | ||
) |
Definition at line 94 of file mc146818.cc.
References clock_data, DPRINTFN, RTCA_DV_32768HZ, RTCA_RS_1024HZ, setTime(), and stat_regB.
|
virtual |
Definition at line 113 of file mc146818.cc.
References EventManager::deschedule(), event, and tickEvent.
|
private |
|
private |
|
private |
Is the DV field in regA set to disabled?
|
private |
USA Daylight Savings Time enable.
RTC status register A
|
inlineprotectedvirtual |
Reimplemented in X86ISA::Cmos::X86RTC, TsunamiIO::RTC, and MaltaIO::RTC.
Definition at line 44 of file mc146818.hh.
References warn.
|
inlineprivate |
Definition at line 88 of file mc146818.hh.
References _name.
uint8_t MC146818::readData | ( | const uint8_t | addr | ) |
RTC read data.
Definition at line 232 of file mc146818.cc.
References addr, clock_data, panic, RTC_STAT_REGA, RTC_STAT_REGB, RTC_STAT_REGC, RTC_STAT_REGD, and stat_regB.
Referenced by TsunamiIO::read(), and X86ISA::Cmos::readRegister().
void MC146818::serialize | ( | const std::string & | base, |
CheckpointOut & | cp | ||
) | const |
Serialize this object to the given output stream.
base | The base name of the counter object. |
os | The stream to serialize to. |
Definition at line 269 of file mc146818.cc.
References arrayParamOut(), clock_data, curTick(), paramOut(), SERIALIZE_SCALAR, stat_regB, tickEvent, and Event::when().
Referenced by X86ISA::Cmos::serialize(), MaltaIO::serialize(), and TsunamiIO::serialize().
|
private |
Definition at line 67 of file mc146818.cc.
References bcdize().
Referenced by MC146818(), and tickClock().
|
virtual |
Start ticking.
Definition at line 127 of file mc146818.cc.
References curTick(), event, MC146818::RTCEvent::offset, MC146818::RTCTickEvent::offset, EventManager::schedule(), Event::scheduled(), stat_regB, and tickEvent.
Referenced by X86ISA::Cmos::startup(), MaltaIO::startup(), and TsunamiIO::startup().
void MC146818::tickClock | ( | ) |
Definition at line 257 of file mc146818.cc.
References curTime, mkutctime(), setTime(), and stat_regB.
void MC146818::unserialize | ( | const std::string & | base, |
CheckpointIn & | cp | ||
) |
Reconstruct the state of this object from a checkpoint.
base | The base name of the counter object. |
cp | The checkpoint use. |
section | The section name of this object |
Definition at line 289 of file mc146818.cc.
References arrayParamIn(), clock_data, MC146818::RTCTickEvent::offset, paramIn(), stat_regB, tickEvent, and UNSERIALIZE_SCALAR.
Referenced by X86ISA::Cmos::unserialize(), MaltaIO::unserialize(), and TsunamiIO::unserialize().
void MC146818::writeData | ( | const uint8_t | addr, |
const uint8_t | data | ||
) |
RTC write data.
Definition at line 139 of file mc146818.cc.
References addr, clock_data, curTick(), curTime, data, EventManager::deschedule(), event, hour, inform, mday, min, mon, panic, RTC_STAT_REGA, RTC_STAT_REGB, RTC_STAT_REGC, RTC_STAT_REGD, RTCA_DV_32768HZ, RTCA_RS_1024HZ, SimClock::Int::s, EventManager::schedule(), Event::scheduled(), MC146818::RTCEvent::scheduleIntr(), sec, stat_regB, tickEvent, unbcdize(), wday, and year.
Referenced by TsunamiIO::write(), and X86ISA::Cmos::writeRegister().
union { ... } |
Data for real-time clock function.
|
private |
Definition at line 87 of file mc146818.hh.
Referenced by name().
|
private |
1 = enable periodic clock interrupt
Definition at line 139 of file mc146818.hh.
uint8_t MC146818::clock_data[10] |
Definition at line 98 of file mc146818.hh.
Referenced by MC146818(), readData(), serialize(), unserialize(), and writeData().
|
private |
Definition at line 114 of file mc146818.hh.
Referenced by tickClock(), and writeData().
|
private |
1 = output sqare wave at SQW pin
Definition at line 142 of file mc146818.hh.
|
private |
0 = 12 hours, 1 = 24 hours
Definition at line 144 of file mc146818.hh.
|
private |
1 = date and time update in progress
Definition at line 120 of file mc146818.hh.
|
private |
RTC periodic interrupt event.
Definition at line 91 of file mc146818.hh.
Referenced by startup(), writeData(), and ~MC146818().
|
private |
0 = BCD, 1 = Binary coded time
Definition at line 143 of file mc146818.hh.
uint8_t MC146818::hour |
Definition at line 105 of file mc146818.hh.
Referenced by writeData().
uint8_t MC146818::hour_alrm |
Definition at line 106 of file mc146818.hh.
uint8_t MC146818::mday |
Definition at line 108 of file mc146818.hh.
Referenced by writeData().
uint8_t MC146818::min |
Definition at line 103 of file mc146818.hh.
Referenced by writeData().
uint8_t MC146818::min_alrm |
Definition at line 104 of file mc146818.hh.
uint8_t MC146818::mon |
Definition at line 109 of file mc146818.hh.
Referenced by writeData().
|
private |
stop clock updates
Definition at line 138 of file mc146818.hh.
|
private |
Divider configuration.
Rate selection 0 = Disabled For 32768 Hz time bases: Freq = 32768Hz / 2**(n-1) for n >= 3 Freq = 256Hz if n = 1 Freq = 128Hz if n = 2 Othwerise: Freq = 32768Hz / 2**(n-1)
Definition at line 130 of file mc146818.hh.
uint8_t MC146818::sec |
Definition at line 101 of file mc146818.hh.
Referenced by writeData().
uint8_t MC146818::sec_alrm |
Definition at line 102 of file mc146818.hh.
|
private |
1 = enable update-ended interrupt
Definition at line 141 of file mc146818.hh.
|
private |
RTC status register B.
Definition at line 151 of file mc146818.hh.
Referenced by MC146818(), readData(), serialize(), startup(), tickClock(), unserialize(), and writeData().
|
private |
RTC tick event.
Definition at line 94 of file mc146818.hh.
Referenced by serialize(), startup(), unserialize(), writeData(), and ~MC146818().
|
private |
1 = enable alarm interrupt
Definition at line 140 of file mc146818.hh.
uint8_t MC146818::wday |
Definition at line 107 of file mc146818.hh.
Referenced by writeData().
uint8_t MC146818::year |
Definition at line 110 of file mc146818.hh.
Referenced by writeData().