gem5 v24.0.0.0
|
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. | |
void | writeData (const uint8_t addr, const uint8_t data) |
RTC write data. | |
uint8_t | readData (const uint8_t addr) |
RTC read data. | |
void | tickClock () |
void | serialize (const std::string &base, CheckpointOut &cp) const |
Serialize this object to the given output stream. | |
void | unserialize (const std::string &base, CheckpointIn &cp) |
Reconstruct the state of this object from a checkpoint. | |
Public Member Functions inherited from gem5::EventManager | |
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) |
This function is not needed by the usual gem5 event loop but may be necessary in derived EventQueues which host gem5 on other schedulers. | |
void | setCurTick (Tick newVal) |
EventManager (EventManager &em) | |
Event manger manages events in the event queue. | |
EventManager (EventManager *em) | |
EventManager (EventQueue *eq) | |
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? | |
BitUnion8 (RtcRegB) Bitfield< 7 > set | |
EndBitUnion (RtcRegB) RtcRegA stat_regA | |
USA Daylight Savings Time enable. | |
Private Attributes | ||
std::string | _name | |
RTCEvent | event | |
RTC periodic interrupt event. | ||
RTCTickEvent | tickEvent | |
RTC tick event. | ||
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. | ||
struct tm | curTime | |
Bitfield< 6, 4 > | dv | |
1 = date and time update in progress | ||
Bitfield< 3, 0 > | rs | |
Divider configuration. | ||
Bitfield< 6 > | pie | |
stop clock updates | ||
Bitfield< 5 > | aie | |
1 = enable periodic clock interrupt | ||
Bitfield< 4 > | uie | |
1 = enable alarm interrupt | ||
Bitfield< 3 > | sqwe | |
1 = enable update-ended interrupt | ||
Bitfield< 2 > | dm | |
1 = output sqare wave at SQW pin | ||
Bitfield< 1 > | format24h | |
0 = BCD, 1 = Binary coded time | ||
Bitfield< 0 > | dse | |
0 = 12 hours, 1 = 24 hours | ||
RtcRegB | stat_regB | |
RTC status register B. | ||
Additional Inherited Members | |
Protected Attributes inherited from gem5::EventManager | |
EventQueue * | eventq |
A pointer to this object's event queue. | |
Real-Time Clock (MC146818)
Definition at line 41 of file mc146818.hh.
gem5::MC146818::MC146818 | ( | EventManager * | em, |
const std::string & | name, | ||
const struct tm | time, | ||
bool | bcd, | ||
Tick | frequency ) |
Definition at line 91 of file mc146818.cc.
References clock_data, DPRINTFN, RTCA_DV_32768HZ, RTCA_RS_1024HZ, setTime(), and stat_regB.
|
virtual |
Definition at line 110 of file mc146818.cc.
References gem5::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 gem5::MaltaIO::RTC, gem5::RiscvRTC::RTC, and gem5::X86ISA::Cmos::X86RTC.
Definition at line 44 of file mc146818.hh.
References warn.
|
inlineprivate |
Definition at line 88 of file mc146818.hh.
References _name.
uint8_t gem5::MC146818::readData | ( | const uint8_t | addr | ) |
RTC read data.
Definition at line 229 of file mc146818.cc.
References gem5::X86ISA::addr, clock_data, panic, RTC_STAT_REGA, RTC_STAT_REGB, RTC_STAT_REGC, RTC_STAT_REGD, and stat_regB.
Referenced by gem5::X86ISA::Cmos::readRegister().
void gem5::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 267 of file mc146818.cc.
References gem5::arrayParamOut(), gem5::X86ISA::base, clock_data, gem5::curTick(), gem5::paramOut(), SERIALIZE_SCALAR, stat_regB, tickEvent, and gem5::Event::when().
Referenced by gem5::MaltaIO::serialize(), gem5::RiscvRTC::serialize(), and gem5::X86ISA::Cmos::serialize().
|
private |
Definition at line 64 of file mc146818.cc.
References gem5::bcdize(), curTime, hour, mday, mon, sec, stat_regB, wday, and year.
Referenced by MC146818(), and tickClock().
|
virtual |
Start ticking.
Definition at line 124 of file mc146818.cc.
References gem5::curTick(), event, gem5::MC146818::RTCEvent::offset, gem5::MC146818::RTCTickEvent::offset, gem5::EventManager::schedule(), gem5::Event::scheduled(), stat_regB, and tickEvent.
Referenced by gem5::MaltaIO::startup(), gem5::RiscvRTC::startup(), and gem5::X86ISA::Cmos::startup().
void gem5::MC146818::tickClock | ( | ) |
Definition at line 255 of file mc146818.cc.
References curTime, gem5::mkutctime(), setTime(), and stat_regB.
void gem5::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 287 of file mc146818.cc.
References gem5::arrayParamIn(), gem5::X86ISA::base, clock_data, gem5::MC146818::RTCTickEvent::offset, gem5::paramIn(), stat_regB, tickEvent, and UNSERIALIZE_SCALAR.
Referenced by gem5::MaltaIO::unserialize(), gem5::RiscvRTC::unserialize(), and gem5::X86ISA::Cmos::unserialize().
void gem5::MC146818::writeData | ( | const uint8_t | addr, |
const uint8_t | data ) |
RTC write data.
Definition at line 136 of file mc146818.cc.
References gem5::X86ISA::addr, clock_data, gem5::curTick(), curTime, data, gem5::EventManager::deschedule(), event, hour, inform, mday, mon, panic, RTC_STAT_REGA, RTC_STAT_REGB, RTC_STAT_REGC, RTC_STAT_REGD, RTCA_DV_32768HZ, RTCA_RS_1024HZ, gem5::sim_clock::as_int::s, gem5::EventManager::schedule(), gem5::Event::scheduled(), sec, stat_regB, tickEvent, gem5::unbcdize(), wday, and year.
Referenced by gem5::X86ISA::Cmos::writeRegister().
union { ... } gem5::MC146818 |
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 141 of file mc146818.hh.
uint8_t gem5::MC146818::clock_data[10] |
Definition at line 99 of file mc146818.hh.
Referenced by MC146818(), readData(), serialize(), unserialize(), and writeData().
|
private |
Definition at line 116 of file mc146818.hh.
Referenced by setTime(), tickClock(), and writeData().
|
private |
1 = output sqare wave at SQW pin
Definition at line 144 of file mc146818.hh.
|
private |
0 = 12 hours, 1 = 24 hours
Definition at line 146 of file mc146818.hh.
|
private |
1 = date and time update in progress
Definition at line 122 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 145 of file mc146818.hh.
uint8_t gem5::MC146818::hour |
Definition at line 107 of file mc146818.hh.
Referenced by setTime(), and writeData().
uint8_t gem5::MC146818::hour_alrm |
Definition at line 108 of file mc146818.hh.
uint8_t gem5::MC146818::mday |
Definition at line 110 of file mc146818.hh.
Referenced by setTime(), and writeData().
uint8_t gem5::MC146818::min |
Definition at line 105 of file mc146818.hh.
uint8_t gem5::MC146818::min_alrm |
Definition at line 106 of file mc146818.hh.
uint8_t gem5::MC146818::mon |
Definition at line 111 of file mc146818.hh.
Referenced by setTime(), and writeData().
|
private |
stop clock updates
Definition at line 140 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 132 of file mc146818.hh.
uint8_t gem5::MC146818::sec |
Definition at line 103 of file mc146818.hh.
Referenced by setTime(), and writeData().
uint8_t gem5::MC146818::sec_alrm |
Definition at line 104 of file mc146818.hh.
|
private |
1 = enable update-ended interrupt
Definition at line 143 of file mc146818.hh.
|
private |
RTC status register B.
Definition at line 153 of file mc146818.hh.
Referenced by MC146818(), readData(), serialize(), setTime(), 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 142 of file mc146818.hh.
uint8_t gem5::MC146818::wday |
Definition at line 109 of file mc146818.hh.
Referenced by setTime(), and writeData().
uint8_t gem5::MC146818::year |
Definition at line 112 of file mc146818.hh.
Referenced by setTime(), and writeData().