gem5  v21.1.0.2
Classes | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
gem5::MC146818 Class Reference

Real-Time Clock (MC146818) More...

#include <mc146818.hh>

Inheritance diagram for gem5::MC146818:
gem5::EventManager gem5::MaltaIO::RTC gem5::RiscvRTC::RTC gem5::X86ISA::Cmos::X86RTC

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 gem5::EventManager
EventQueueeventQueue () 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. More...
 
void setCurTick (Tick newVal)
 
 EventManager (EventManager &em)
 Event manger manages events in the event queue. More...
 
 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 &reg)
 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 gem5::EventManager
EventQueueeventq
 A pointer to this object's event queue. More...
 

Detailed Description

Real-Time Clock (MC146818)

Definition at line 41 of file mc146818.hh.

Constructor & Destructor Documentation

◆ MC146818()

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.

◆ ~MC146818()

gem5::MC146818::~MC146818 ( )
virtual

Definition at line 110 of file mc146818.cc.

References gem5::EventManager::deschedule(), event, and tickEvent.

Member Function Documentation

◆ BitUnion8() [1/2]

gem5::MC146818::BitUnion8 ( RtcRegA  )
private

◆ BitUnion8() [2/2]

gem5::MC146818::BitUnion8 ( RtcRegB  )
private

◆ EndBitUnion() [1/2]

gem5::MC146818::EndBitUnion ( RtcRegA  ) const &
private

Is the DV field in regA set to disabled?

◆ EndBitUnion() [2/2]

gem5::MC146818::EndBitUnion ( RtcRegB  )
private

USA Daylight Savings Time enable.

RTC status register A

◆ handleEvent()

virtual void gem5::MC146818::handleEvent ( )
inlineprotectedvirtual

Reimplemented in gem5::X86ISA::Cmos::X86RTC, gem5::RiscvRTC::RTC, and gem5::MaltaIO::RTC.

Definition at line 44 of file mc146818.hh.

References warn.

◆ name()

const std::string& gem5::MC146818::name ( ) const
inlineprivate

Definition at line 88 of file mc146818.hh.

References _name.

◆ readData()

uint8_t gem5::MC146818::readData ( const uint8_t  addr)

◆ serialize()

void gem5::MC146818::serialize ( const std::string &  base,
CheckpointOut cp 
) const

Serialize this object to the given output stream.

Parameters
baseThe base name of the counter object.
osThe stream to serialize to.

Definition at line 266 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::RiscvRTC::serialize(), gem5::X86ISA::Cmos::serialize(), and gem5::MaltaIO::serialize().

◆ setTime()

void gem5::MC146818::setTime ( const struct tm  time)
private

Definition at line 64 of file mc146818.cc.

References gem5::bcdize(), curTime, hour, mday, min, mon, sec, stat_regB, wday, and year.

Referenced by MC146818(), and tickClock().

◆ startup()

void gem5::MC146818::startup ( )
virtual

◆ tickClock()

void gem5::MC146818::tickClock ( )

Definition at line 254 of file mc146818.cc.

References curTime, gem5::mkutctime(), setTime(), and stat_regB.

◆ unserialize()

void gem5::MC146818::unserialize ( const std::string &  base,
CheckpointIn cp 
)

Reconstruct the state of this object from a checkpoint.

Parameters
baseThe base name of the counter object.
cpThe checkpoint use.
sectionThe section name of this object

Definition at line 286 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::RiscvRTC::unserialize(), gem5::X86ISA::Cmos::unserialize(), and gem5::MaltaIO::unserialize().

◆ writeData()

void gem5::MC146818::writeData ( const uint8_t  addr,
const uint8_t  data 
)

Member Data Documentation

◆ @70

union { ... }

Data for real-time clock function.

◆ _name

std::string gem5::MC146818::_name
private

Definition at line 87 of file mc146818.hh.

Referenced by name().

◆ aie

Bitfield<5> gem5::MC146818::aie
private

1 = enable periodic clock interrupt

Definition at line 141 of file mc146818.hh.

◆ clock_data

uint8_t gem5::MC146818::clock_data[10]

Definition at line 99 of file mc146818.hh.

Referenced by MC146818(), readData(), serialize(), unserialize(), and writeData().

◆ curTime

struct tm gem5::MC146818::curTime
private

Definition at line 116 of file mc146818.hh.

Referenced by setTime(), tickClock(), and writeData().

◆ dm

Bitfield<2> gem5::MC146818::dm
private

1 = output sqare wave at SQW pin

Definition at line 144 of file mc146818.hh.

◆ dse

Bitfield<0> gem5::MC146818::dse
private

0 = 12 hours, 1 = 24 hours

Definition at line 146 of file mc146818.hh.

◆ dv

Bitfield<6, 4> gem5::MC146818::dv
private

1 = date and time update in progress

Definition at line 122 of file mc146818.hh.

◆ event

RTCEvent gem5::MC146818::event
private

RTC periodic interrupt event.

Definition at line 91 of file mc146818.hh.

Referenced by startup(), writeData(), and ~MC146818().

◆ format24h

Bitfield<1> gem5::MC146818::format24h
private

0 = BCD, 1 = Binary coded time

Definition at line 145 of file mc146818.hh.

◆ hour

uint8_t gem5::MC146818::hour

Definition at line 107 of file mc146818.hh.

Referenced by setTime(), and writeData().

◆ hour_alrm

uint8_t gem5::MC146818::hour_alrm

Definition at line 108 of file mc146818.hh.

◆ mday

uint8_t gem5::MC146818::mday

Definition at line 110 of file mc146818.hh.

Referenced by setTime(), and writeData().

◆ min

uint8_t gem5::MC146818::min

Definition at line 105 of file mc146818.hh.

Referenced by setTime(), and writeData().

◆ min_alrm

uint8_t gem5::MC146818::min_alrm

Definition at line 106 of file mc146818.hh.

◆ mon

uint8_t gem5::MC146818::mon

Definition at line 111 of file mc146818.hh.

Referenced by setTime(), and writeData().

◆ pie

Bitfield<6> gem5::MC146818::pie
private

stop clock updates

Definition at line 140 of file mc146818.hh.

◆ rs

Bitfield<3, 0> gem5::MC146818::rs
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.

◆ sec

uint8_t gem5::MC146818::sec

Definition at line 103 of file mc146818.hh.

Referenced by setTime(), and writeData().

◆ sec_alrm

uint8_t gem5::MC146818::sec_alrm

Definition at line 104 of file mc146818.hh.

◆ sqwe

Bitfield<3> gem5::MC146818::sqwe
private

1 = enable update-ended interrupt

Definition at line 143 of file mc146818.hh.

◆ stat_regB

RtcRegB gem5::MC146818::stat_regB
private

RTC status register B.

Definition at line 153 of file mc146818.hh.

Referenced by MC146818(), readData(), serialize(), setTime(), startup(), tickClock(), unserialize(), and writeData().

◆ tickEvent

RTCTickEvent gem5::MC146818::tickEvent
private

RTC tick event.

Definition at line 94 of file mc146818.hh.

Referenced by serialize(), startup(), unserialize(), writeData(), and ~MC146818().

◆ uie

Bitfield<4> gem5::MC146818::uie
private

1 = enable alarm interrupt

Definition at line 142 of file mc146818.hh.

◆ wday

uint8_t gem5::MC146818::wday

Definition at line 109 of file mc146818.hh.

Referenced by setTime(), and writeData().

◆ year

uint8_t gem5::MC146818::year

Definition at line 112 of file mc146818.hh.

Referenced by setTime(), and writeData().


The documentation for this class was generated from the following files:

Generated on Tue Sep 21 2021 12:27:45 for gem5 by doxygen 1.8.17