41a42
> #include "dev/mc146818.hh"
56,65d56
< /** Real-Time Clock (MC146818) */
< class RTC
< {
< private:
< /** Event for RTC periodic interrupt */
< struct RTCEvent : public Event
< {
< /** A pointer back to tsunami to create interrupt the processor. */
< Tsunami* tsunami;
< Tick interval;
67,112c58,59
< RTCEvent(Tsunami* t, Tick i);
<
< /** Schedule the RTC periodic interrupt */
< void scheduleIntr();
<
< /** Event process to occur at interrupt*/
< virtual void process();
<
< /** Event description */
< virtual const char *description() const;
< };
<
< private:
< std::string _name;
< const std::string &name() const { return _name; }
<
< /** RTC periodic interrupt event */
< RTCEvent event;
<
< /** Current RTC register address/index */
< int addr;
<
< /** Data for real-time clock function */
< 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;
< };
< };
<
< /** RTC status register A */
< uint8_t stat_regA;
<
< /** RTC status register B */
< uint8_t stat_regB;
<
---
> class TsunamiRTC : public MC146818
> {
114,115c61,62
< RTC(const std::string &name, Tsunami* tsunami,
< const TsunamiIOParams *params);
---
> Tsunami * tsunami;
> TsunamiRTC(const std::string &n, const TsunamiIOParams *p);
117,140c64,69
< /** RTC address port: write address of RTC RAM data to access */
< void writeAddr(const uint8_t data);
<
< /** RTC write data */
< void writeData(const uint8_t data);
<
< /** RTC read data */
< uint8_t readData();
<
< /**
< * Serialize this object to the given output stream.
< * @param base The base name of the counter object.
< * @param os The stream to serialize to.
< */
< void serialize(const std::string &base, std::ostream &os);
<
< /**
< * Reconstruct the state of this object from a checkpoint.
< * @param base The base name of the counter object.
< * @param cp The checkpoint use.
< * @param section The section name of this object
< */
< void unserialize(const std::string &base, Checkpoint *cp,
< const std::string &section);
---
> protected:
> void handleEvent()
> {
> //Actually interrupt the processor here
> tsunami->cchip->postRTC();
> }
299c228
< RTC rtc;
---
> TsunamiRTC rtc;
300a230,231
> uint8_t rtcAddr;
>