42a43
> #include "base/time.hh"
53d53
< #include "sim/builder.hh"
60,62c60,62
< TsunamiIO::RTC::RTC(const string &n, Tsunami* tsunami, const vector<int> &t,
< bool bcd, Tick i)
< : _name(n), event(tsunami, i), addr(0), year_is_bcd(bcd)
---
> TsunamiIO::RTC::RTC(const string &n, Tsunami* tsunami,
> const TsunamiIO::Params *p)
> : _name(n), event(tsunami, p->frequency), addr(0)
68,69c68
< struct tm tm;
< parseTime(t, &tm);
---
> year = p->time.tm_year;
71,73c70
< year = tm.tm_year;
<
< if (year_is_bcd) {
---
> if (p->year_is_bcd) {
84,88c81,85
< mon = tm.tm_mon + 1;
< mday = tm.tm_mday;
< hour = tm.tm_hour;
< min = tm.tm_min;
< sec = tm.tm_sec;
---
> mon = p->time.tm_mon + 1;
> mday = p->time.tm_mday;
> hour = p->time.tm_hour;
> min = p->time.tm_min;
> sec = p->time.tm_sec;
91c88
< wday = tm.tm_wday + 1;
---
> wday = p->time.tm_wday + 1;
93c90
< DPRINTFN("Real-time clock set to %s", asctime(&tm));
---
> DPRINTFN("Real-time clock set to %s", asctime(&p->time));
440c437
< TsunamiIO::TsunamiIO(Params *p)
---
> TsunamiIO::TsunamiIO(const Params *p)
442,443c439
< rtc(p->name + ".rtc", p->tsunami, p->init_time, p->year_is_bcd,
< p->frequency)
---
> rtc(p->name + ".rtc", p->tsunami, p)
661,687c657,658
< BEGIN_DECLARE_SIM_OBJECT_PARAMS(TsunamiIO)
<
< Param<Addr> pio_addr;
< Param<Tick> pio_latency;
< Param<Tick> frequency;
< SimObjectParam<Platform *> platform;
< SimObjectParam<System *> system;
< VectorParam<int> time;
< Param<bool> year_is_bcd;
< SimObjectParam<Tsunami *> tsunami;
<
< END_DECLARE_SIM_OBJECT_PARAMS(TsunamiIO)
<
< BEGIN_INIT_SIM_OBJECT_PARAMS(TsunamiIO)
<
< INIT_PARAM(pio_addr, "Device Address"),
< INIT_PARAM(pio_latency, "Programmed IO latency"),
< INIT_PARAM(frequency, "clock interrupt frequency"),
< INIT_PARAM(platform, "platform"),
< INIT_PARAM(system, "system object"),
< INIT_PARAM(time, "System time to use (0 for actual time"),
< INIT_PARAM(year_is_bcd, ""),
< INIT_PARAM(tsunami, "Tsunami")
<
< END_INIT_SIM_OBJECT_PARAMS(TsunamiIO)
<
< CREATE_SIM_OBJECT(TsunamiIO)
---
> TsunamiIO *
> TsunamiIOParams::create()
689,699c660
< TsunamiIO::Params *p = new TsunamiIO::Params;
< p->frequency = frequency;
< p->name = getInstanceName();
< p->pio_addr = pio_addr;
< p->pio_delay = pio_latency;
< p->platform = platform;
< p->system = system;
< p->init_time = time;
< p->year_is_bcd = year_is_bcd;
< p->tsunami = tsunami;
< return new TsunamiIO(p);
---
> return new TsunamiIO(this);
701,702d661
<
< REGISTER_SIM_OBJECT("TsunamiIO", TsunamiIO)