gem5  v20.1.0.0
Classes | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
MC146818 Class Reference

Real-Time Clock (MC146818) More...

#include <mc146818.hh>

Inheritance diagram for MC146818:
EventManager MaltaIO::RTC 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 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 EventManager
EventQueueeventq
 A pointer to this object's event queue. More...
 

Detailed Description

Real-Time Clock (MC146818)

Definition at line 38 of file mc146818.hh.

Constructor & Destructor Documentation

◆ MC146818()

MC146818::MC146818 ( EventManager em,
const std::string &  name,
const struct tm  time,
bool  bcd,
Tick  frequency 
)

Definition at line 90 of file mc146818.cc.

References clock_data, DPRINTFN, RTCA_DV_32768HZ, RTCA_RS_1024HZ, setTime(), and stat_regB.

◆ ~MC146818()

MC146818::~MC146818 ( )
virtual

Definition at line 109 of file mc146818.cc.

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

Member Function Documentation

◆ BitUnion8() [1/2]

MC146818::BitUnion8 ( RtcRegA  )
private

◆ BitUnion8() [2/2]

MC146818::BitUnion8 ( RtcRegB  )
private

◆ EndBitUnion() [1/2]

MC146818::EndBitUnion ( RtcRegA  ) const &
private

Is the DV field in regA set to disabled?

◆ EndBitUnion() [2/2]

MC146818::EndBitUnion ( RtcRegB  )
private

USA Daylight Savings Time enable.

RTC status register A

◆ handleEvent()

virtual void MC146818::handleEvent ( )
inlineprotectedvirtual

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

Definition at line 41 of file mc146818.hh.

References warn.

◆ name()

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

Definition at line 85 of file mc146818.hh.

References _name.

◆ readData()

uint8_t MC146818::readData ( const uint8_t  addr)

RTC read data.

Definition at line 228 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 X86ISA::Cmos::readRegister().

◆ serialize()

void 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 265 of file mc146818.cc.

References arrayParamOut(), X86ISA::base, clock_data, curTick(), paramOut(), SERIALIZE_SCALAR, stat_regB, tickEvent, and Event::when().

Referenced by X86ISA::Cmos::serialize(), and MaltaIO::serialize().

◆ setTime()

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

Definition at line 63 of file mc146818.cc.

References bcdize().

Referenced by MC146818(), and tickClock().

◆ startup()

void MC146818::startup ( )
virtual

◆ tickClock()

void MC146818::tickClock ( )

Definition at line 253 of file mc146818.cc.

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

◆ unserialize()

void 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 285 of file mc146818.cc.

References arrayParamIn(), X86ISA::base, clock_data, MC146818::RTCTickEvent::offset, paramIn(), stat_regB, tickEvent, and UNSERIALIZE_SCALAR.

Referenced by X86ISA::Cmos::unserialize(), and MaltaIO::unserialize().

◆ writeData()

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

Member Data Documentation

◆ @75

union { ... }

Data for real-time clock function.

◆ _name

std::string MC146818::_name
private

Definition at line 84 of file mc146818.hh.

Referenced by name().

◆ aie

Bitfield<5> MC146818::aie
private

1 = enable periodic clock interrupt

Definition at line 136 of file mc146818.hh.

◆ clock_data

uint8_t MC146818::clock_data[10]

Definition at line 95 of file mc146818.hh.

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

◆ curTime

struct tm MC146818::curTime
private

Definition at line 111 of file mc146818.hh.

Referenced by tickClock(), and writeData().

◆ dm

Bitfield<2> MC146818::dm
private

1 = output sqare wave at SQW pin

Definition at line 139 of file mc146818.hh.

◆ dse

Bitfield<0> MC146818::dse
private

0 = 12 hours, 1 = 24 hours

Definition at line 141 of file mc146818.hh.

◆ dv

Bitfield<6, 4> MC146818::dv
private

1 = date and time update in progress

Definition at line 117 of file mc146818.hh.

◆ event

RTCEvent MC146818::event
private

RTC periodic interrupt event.

Definition at line 88 of file mc146818.hh.

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

◆ format24h

Bitfield<1> MC146818::format24h
private

0 = BCD, 1 = Binary coded time

Definition at line 140 of file mc146818.hh.

◆ hour

uint8_t MC146818::hour

Definition at line 102 of file mc146818.hh.

Referenced by writeData().

◆ hour_alrm

uint8_t MC146818::hour_alrm

Definition at line 103 of file mc146818.hh.

◆ mday

uint8_t MC146818::mday

Definition at line 105 of file mc146818.hh.

Referenced by writeData().

◆ min

uint8_t MC146818::min

Definition at line 100 of file mc146818.hh.

Referenced by writeData().

◆ min_alrm

uint8_t MC146818::min_alrm

Definition at line 101 of file mc146818.hh.

◆ mon

uint8_t MC146818::mon

Definition at line 106 of file mc146818.hh.

Referenced by writeData().

◆ pie

Bitfield<6> MC146818::pie
private

stop clock updates

Definition at line 135 of file mc146818.hh.

◆ rs

Bitfield<3, 0> 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 127 of file mc146818.hh.

◆ sec

uint8_t MC146818::sec

Definition at line 98 of file mc146818.hh.

Referenced by writeData().

◆ sec_alrm

uint8_t MC146818::sec_alrm

Definition at line 99 of file mc146818.hh.

◆ sqwe

Bitfield<3> MC146818::sqwe
private

1 = enable update-ended interrupt

Definition at line 138 of file mc146818.hh.

◆ stat_regB

RtcRegB MC146818::stat_regB
private

RTC status register B.

Definition at line 148 of file mc146818.hh.

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

◆ tickEvent

RTCTickEvent MC146818::tickEvent
private

RTC tick event.

Definition at line 91 of file mc146818.hh.

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

◆ uie

Bitfield<4> MC146818::uie
private

1 = enable alarm interrupt

Definition at line 137 of file mc146818.hh.

◆ wday

uint8_t MC146818::wday

Definition at line 104 of file mc146818.hh.

Referenced by writeData().

◆ year

uint8_t MC146818::year

Definition at line 107 of file mc146818.hh.

Referenced by writeData().


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

Generated on Wed Sep 30 2020 14:02:27 for gem5 by doxygen 1.8.17