42 #include "debug/Checkpoint.hh" 43 #include "debug/Timer.hh" 50 timer0(
name() +
".timer0", this, p->int_num0, p->clock0),
51 timer1(
name() +
".timer1", this, p->int_num1, p->clock1)
56 : _name(__name), parent(_parent), intNum(int_num), clock(_clock), control(0x20),
57 rawInt(false), pendingInt(false), loadValue(0xffffffff),
69 DPRINTF(
Timer,
"Reading from DualTimer at offset: %#x\n", daddr);
76 panic(
"Tried to read SP804 at offset %#x that doesn't exist\n", daddr);
90 DPRINTF(
Timer,
"Event schedule for %d, clock=%d, prescale=%d\n",
96 pkt->
setLE<uint32_t>(time);
111 panic(
"Tried to read SP804 timer at offset %#x\n", daddr);
114 DPRINTF(
Timer,
"Reading %#x from Timer at offset: %#x\n",
115 pkt->
getLE<uint32_t>(), daddr);
124 DPRINTF(
Timer,
"Writing to DualTimer at offset: %#x\n", daddr);
131 panic(
"Tried to write SP804 at offset %#x that doesn't exist\n", daddr);
140 pkt->
getLE<uint32_t>(), daddr);
151 old_enable =
control.timerEnable;
153 if ((old_enable == 0) &&
control.timerEnable)
168 panic(
"Tried to write SP804 timer at offset %#x\n", daddr);
176 DPRINTF(
Timer,
"Resetting counter with value %#x\n", val);
184 time *=
bits(val,15,0);
187 DPRINTF(
Timer,
"-- Event was already schedule, de-scheduling\n");
224 DPRINTF(Checkpoint,
"Serializing Arm Sp804\n");
226 uint32_t control_serial =
control;
246 DPRINTF(Checkpoint,
"Unserializing Arm Sp804\n");
248 uint32_t control_serial;
283 Sp804Params::create()
285 return new Sp804(
this);
#define panic(...)
This implements a cprintf based panic() function.
void counterAtZero()
Called when the counter reaches 0.
void read(PacketPtr pkt, Addr daddr)
Handle read for a single timer.
virtual void clearInt(uint32_t num)=0
Clear an interrupt from a device that is connected to the GIC.
const std::string & name()
EndBitUnion(CTRL) protected Sp804 * parent
Pointer to parent class.
void restartCounter(uint32_t val)
Restart the counter ticking at val.
CTRL control
Control register as specified above.
AmbaPioDeviceParams Params
Timer timer0
Timers that do the actual work.
void serializeSection(CheckpointOut &cp, const char *name) const
Serialize an object into a new section.
void serialize(CheckpointOut &cp) const override
Serialize an object.
void setLE(T v)
Set the value in the data pointer to v as little endian.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
#define UNSERIALIZE_SCALAR(scalar)
Tick curTick()
The current simulated tick.
Sp804(Params *p)
The constructor for RealView just registers itself with the MMU.
Addr pioSize
Size that the device's address range.
virtual void sendInt(uint32_t num)=0
Post an interrupt from a device that is connected to the GIC.
void makeAtomicResponse()
uint64_t Tick
Tick count type.
uint64_t power(uint32_t n, uint32_t e)
void unserialize(CheckpointIn &cp) override
Unserialize an object.
void deschedule(Event &event)
bool pendingInt
If an interrupt is currently pending.
uint32_t loadValue
Value to load into counter when periodic mode reaches 0.
Tick write(PacketPtr pkt) override
All writes are simply ignored.
void schedule(Event &event, Tick when)
This implements the dual Sp804 timer block.
bool readId(PacketPtr pkt, uint64_t amba_id, Addr pio_addr)
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
EventFunctionWrapper zeroEvent
#define SERIALIZE_SCALAR(scalar)
bool scheduled() const
Determine if the current event is scheduled.
bool rawInt
If timer has caused an interrupt.
Base class for ARM GIC implementations.
Declaration of the Packet class.
std::ostream CheckpointOut
const Tick clock
Number of ticks in a clock input.
Tick pioDelay
Delay that the device experinces on an access.
void write(PacketPtr pkt, Addr daddr)
Handle write for a single timer.
T getLE() const
Get the data in the packet byte swapped from little endian to host endian.
Timer(std::string __name, Sp804 *parent, int int_num, Tick clock)
T bits(T val, int first, int last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it...
Tick when() const
Get the time that the event is scheduled.
Addr pioAddr
Address that the device listens to.
BaseGic * gic
Pointer to the GIC for causing an interrupt.
const uint32_t intNum
Number of interrupt to cause/clear.
void serialize(CheckpointOut &cp) const override
Serialize an object.
Tick read(PacketPtr pkt) override
Handle a read to the device.
void unserializeSection(CheckpointIn &cp, const char *name)
Unserialize an a child object.