gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 TsunamiIO::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
 EventManager (EventManager &em)
 
 EventManager (EventManager *em)
 
 EventManager (EventQueue *eq)
 
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)
 
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 &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 41 of file mc146818.hh.

Constructor & Destructor Documentation

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.

MC146818::~MC146818 ( )
virtual

Definition at line 113 of file mc146818.cc.

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

Member Function Documentation

MC146818::BitUnion8 ( RtcRegA  )
private
MC146818::BitUnion8 ( RtcRegB  )
private
MC146818::EndBitUnion ( RtcRegA  ) const
private

Is the DV field in regA set to disabled?

MC146818::EndBitUnion ( RtcRegB  )
private

USA Daylight Savings Time enable.

RTC status register A

virtual void MC146818::handleEvent ( )
inlineprotectedvirtual

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

Definition at line 44 of file mc146818.hh.

References warn.

const std::string& MC146818::name ( ) const
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.

Parameters
baseThe base name of the counter object.
osThe 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().

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

Definition at line 67 of file mc146818.cc.

References bcdize().

Referenced by MC146818(), and tickClock().

void MC146818::startup ( )
virtual
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.

Parameters
baseThe base name of the counter object.
cpThe checkpoint use.
sectionThe 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 
)

Member Data Documentation

union { ... }

Data for real-time clock function.

std::string MC146818::_name
private

Definition at line 87 of file mc146818.hh.

Referenced by name().

Bitfield<5> MC146818::aie
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().

struct tm MC146818::curTime
private

Definition at line 114 of file mc146818.hh.

Referenced by tickClock(), and writeData().

Bitfield<2> MC146818::dm
private

1 = output sqare wave at SQW pin

Definition at line 142 of file mc146818.hh.

Bitfield<0> MC146818::dse
private

0 = 12 hours, 1 = 24 hours

Definition at line 144 of file mc146818.hh.

Bitfield<6, 4> MC146818::dv
private

1 = date and time update in progress

Definition at line 120 of file mc146818.hh.

RTCEvent MC146818::event
private

RTC periodic interrupt event.

Definition at line 91 of file mc146818.hh.

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

Bitfield<1> MC146818::format24h
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().

Bitfield<6> MC146818::pie
private

stop clock updates

Definition at line 138 of file mc146818.hh.

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 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.

Bitfield<3> MC146818::sqwe
private

1 = enable update-ended interrupt

Definition at line 141 of file mc146818.hh.

RtcRegB MC146818::stat_regB
private

RTC status register B.

Definition at line 151 of file mc146818.hh.

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

RTCTickEvent MC146818::tickEvent
private

RTC tick event.

Definition at line 94 of file mc146818.hh.

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

Bitfield<4> MC146818::uie
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().


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

Generated on Fri Jun 9 2017 13:04:14 for gem5 by doxygen 1.8.6