Deleted Added
sdiff udiff text old ( 3885:fd4067a5b903 ) new ( 3932:62e915bb6704 )
full compact
1/*
2 * Copyright (c) 2004-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 43 unchanged lines hidden (view full) ---

52#include "mem/port.hh"
53#include "sim/builder.hh"
54#include "sim/system.hh"
55
56using namespace std;
57//Should this be AlphaISA?
58using namespace TheISA;
59
60TsunamiIO::RTC::RTC(const string &n, Tsunami* tsunami, time_t t, Tick i)
61 : _name(n), event(tsunami, i), addr(0)
62{
63 memset(clock_data, 0, sizeof(clock_data));
64 stat_regA = RTCA_32768HZ | RTCA_1024HZ;
65 stat_regB = RTCB_PRDC_IE |RTCB_BIN | RTCB_24HR;
66
67 struct tm tm;
68 gmtime_r(&t, &tm);
69
70 sec = tm.tm_sec;
71 min = tm.tm_min;
72 hour = tm.tm_hour;
73 wday = tm.tm_wday + 1;
74 mday = tm.tm_mday;
75 mon = tm.tm_mon + 1;
76 year = tm.tm_year;
77
78 DPRINTFN("Real-time clock set to %s", asctime(&tm));
79}
80
81void
82TsunamiIO::RTC::writeAddr(const uint8_t data)
83{
84 if (data <= RTC_STAT_REGD)
85 addr = data;
86 else

--- 332 unchanged lines hidden (view full) ---

419const char *
420TsunamiIO::PITimer::Counter::CounterEvent::description()
421{
422 return "tsunami 8254 Interval timer";
423}
424
425TsunamiIO::TsunamiIO(Params *p)
426 : BasicPioDevice(p), tsunami(p->tsunami), pitimer(p->name + "pitimer"),
427 rtc(p->name + ".rtc", p->tsunami, p->init_time, p->frequency)
428{
429 pioSize = 0x100;
430
431 // set the back pointer from tsunami to myself
432 tsunami->io = this;
433
434 timerData = 0;
435 picr = 0;

--- 208 unchanged lines hidden (view full) ---

644
645BEGIN_DECLARE_SIM_OBJECT_PARAMS(TsunamiIO)
646
647 Param<Addr> pio_addr;
648 Param<Tick> pio_latency;
649 Param<Tick> frequency;
650 SimObjectParam<Platform *> platform;
651 SimObjectParam<System *> system;
652 Param<time_t> time;
653 SimObjectParam<Tsunami *> tsunami;
654
655END_DECLARE_SIM_OBJECT_PARAMS(TsunamiIO)
656
657BEGIN_INIT_SIM_OBJECT_PARAMS(TsunamiIO)
658
659 INIT_PARAM(pio_addr, "Device Address"),
660 INIT_PARAM(pio_latency, "Programmed IO latency"),
661 INIT_PARAM(frequency, "clock interrupt frequency"),
662 INIT_PARAM(platform, "platform"),
663 INIT_PARAM(system, "system object"),
664 INIT_PARAM(time, "System time to use (0 for actual time"),
665 INIT_PARAM(tsunami, "Tsunami")
666
667END_INIT_SIM_OBJECT_PARAMS(TsunamiIO)
668
669CREATE_SIM_OBJECT(TsunamiIO)
670{
671 TsunamiIO::Params *p = new TsunamiIO::Params;
672 p->frequency = frequency;
673 p->name = getInstanceName();
674 p->pio_addr = pio_addr;
675 p->pio_delay = pio_latency;
676 p->platform = platform;
677 p->system = system;
678 p->init_time = time;
679 p->tsunami = tsunami;
680 return new TsunamiIO(p);
681}
682
683REGISTER_SIM_OBJECT("TsunamiIO", TsunamiIO)