46 #include "debug/Checkpoint.hh" 47 #include "debug/Timer.hh" 64 std::stringstream oss;
65 oss <<
name() <<
".timer" <<
i;
68 new Timer(oss.str(),
this,
69 p->int_timer->get(tc),
70 p->int_watchdog->get(tc)));
80 : _name(timer_name), parent(_parent), intTimer(int_timer),
81 intWatchdog(int_watchdog), timerControl(0x0), watchdogControl(0x0),
82 rawIntTimer(false), rawIntWatchdog(false),
83 rawResetWatchdog(false), watchdogDisableReg(0x0),
84 pendingIntTimer(false), pendingIntWatchdog(false),
85 timerLoadValue(0x0), watchdogLoadValue(0x0),
98 DPRINTF(
Timer,
"Reading from CpuLocalTimer at offset: %#x\n", daddr);
105 panic(
"Tried to read CpuLocalTimer at offset %#x that doesn't exist\n", daddr);
114 DPRINTF(
Timer,
"Reading from CpuLocalTimer at offset: %#x\n", daddr);
122 DPRINTF(
Timer,
"Event schedule for timer %d, clock=%d, prescale=%d\n",
129 pkt->
setLE<uint32_t>(time);
142 "Event schedule for watchdog %d, clock=%d, prescale=%d\n",
149 pkt->
setLE<uint32_t>(time);
161 panic(
"Tried to read from WatchdogDisableRegister\n");
164 panic(
"Tried to read CpuLocalTimer at offset %#x\n", daddr);
176 DPRINTF(
Timer,
"Writing to CpuLocalTimer at offset: %#x\n", daddr);
183 panic(
"Tried to write CpuLocalTimer at offset %#x that doesn't exist\n", daddr);
191 DPRINTF(
Timer,
"Writing to CpuLocalTimer at offset: %#x\n", daddr);
259 panic(
"Tried to write CpuLocalTimer timer at offset %#x\n", daddr);
268 DPRINTF(
Timer,
"Resetting timer counter with value %#x\n", val);
276 DPRINTF(
Timer,
"-- Event was already schedule, de-scheduling\n");
286 DPRINTF(
Timer,
"Resetting watchdog counter with value %#x\n", val);
294 DPRINTF(
Timer,
"-- Event was already schedule, de-scheduling\n");
341 fatal(
"gem5 ARM Model does not support true watchdog operation!\n");
359 DPRINTF(Checkpoint,
"Serializing Arm CpuLocalTimer\n");
380 Tick timer_event_time;
381 if (timer_is_in_event){
385 Tick watchdog_event_time;
386 if (watchdog_is_in_event){
395 DPRINTF(Checkpoint,
"Unserializing Arm CpuLocalTimer\n");
397 uint32_t timer_control_serial;
400 uint32_t watchdog_control_serial;
413 bool timer_is_in_event;
415 bool watchdog_is_in_event;
418 Tick timer_event_time;
419 if (timer_is_in_event){
423 Tick watchdog_event_time;
424 if (watchdog_is_in_event) {
447 CpuLocalTimerParams::create()
#define panic(...)
This implements a cprintf based panic() function.
Tick write(PacketPtr pkt) override
Handle a write to the device.
void read(PacketPtr pkt, Addr daddr)
Handle read for a single timer.
#define fatal(...)
This implements a cprintf based fatal() function.
void serializeSection(CheckpointOut &cp, const char *name) const
Serialize an object into a new section.
ArmInterruptPin * intWatchdog
Tick when() const
Get the time that the event is scheduled.
void restartTimerCounter(uint32_t val)
Restart the counter ticking at val.
void unserializeSection(CheckpointIn &cp, const char *name)
Unserialize an a child object.
bool pendingIntTimer
If an interrupt is currently pending.
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Timer(const std::string &name, CpuLocalTimer *_parent, ArmInterruptPin *int_timer, ArmInterruptPin *int_watchdog)
uint32_t timerLoadValue
Value to load into counters when periodic mode reaches 0.
ThreadContext is the external interface to all thread state for anything outside of the CPU...
const Params * params() const
EndBitUnion(WatchdogCtrl) protected CpuLocalTimer * parent
Pointer to parent class.
void deschedule(Event &event)
EventFunctionWrapper timerZeroEvent
void setLE(T v)
Set the value in the data pointer to v as little endian.
ThreadContext * getThreadContext(ContextID tid) const
void serialize(CheckpointOut &cp) const override
Serialize an object.
CpuLocalTimerParams Params
RequestPtr req
A pointer to the original request.
friend class CpuLocalTimer
#define UNSERIALIZE_SCALAR(scalar)
Tick curTick()
The current simulated tick.
std::string csprintf(const char *format, const Args &...args)
ArmInterruptPin * intTimer
Interrupt to cause/clear.
bool scheduled() const
Determine if the current event is scheduled.
Addr pioSize
Size that the device's address range.
std::vector< std::unique_ptr< Timer > > localTimer
Timers that do the actual work.
void serialize(CheckpointOut &cp) const override
Serialize an object.
void makeAtomicResponse()
TimerCtrl timerControl
Control register as specified above.
uint64_t Tick
Tick count type.
uint64_t power(uint32_t n, uint32_t e)
void write(PacketPtr pkt, Addr daddr)
Handle write for a single timer.
EventFunctionWrapper watchdogZeroEvent
unsigned numContexts() const
uint32_t watchdogLoadValue
void unserialize(CheckpointIn &cp) override
Unserialize an object.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
bool rawIntTimer
If timer has caused an interrupt.
This implements the cpu local timer from the Cortex-A9 MPCore Technical Reference Manual rev r2p2 (AR...
virtual const std::string name() const
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
void restartWatchdogCounter(uint32_t val)
void timerAtZero()
Called when the counter reaches 0.
void init() override
Inits the local timers.
#define SERIALIZE_SCALAR(scalar)
uint32_t watchdogDisableReg
Base class for ARM GIC implementations.
Declaration of the Packet class.
virtual void raise()=0
Signal an interrupt.
std::ostream CheckpointOut
Tick read(PacketPtr pkt) override
Handle a read to the device.
Tick pioDelay
Delay that the device experinces on an access.
void schedule(Event &event, Tick when)
T getLE() const
Get the data in the packet byte swapped from little endian to host endian.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Addr pioAddr
Address that the device listens to.
Generic representation of an Arm interrupt pin.
CpuLocalTimer(Params *p)
The constructor for RealView just registers itself with the MMU.
int ContextID
Globally unique thread context ID.
WatchdogCtrl watchdogControl