44 #include "debug/Checkpoint.hh" 45 #include "debug/Timer.hh" 52 timer0(
name() +
".timer0", this, p->int_num0, p->clock0),
53 timer1(
name() +
".timer1", this, p->int_num1, p->clock1)
58 : _name(__name), parent(_parent), intNum(int_num), clock(_clock), control(0x20),
59 rawInt(false), pendingInt(false), loadValue(0xffffffff),
71 DPRINTF(
Timer,
"Reading from DualTimer at offset: %#x\n", daddr);
78 panic(
"Tried to read SP804 at offset %#x that doesn't exist\n", daddr);
92 DPRINTF(
Timer,
"Event schedule for %d, clock=%d, prescale=%d\n",
98 pkt->
setLE<uint32_t>(time);
113 panic(
"Tried to read SP804 timer at offset %#x\n", daddr);
116 DPRINTF(
Timer,
"Reading %#x from Timer at offset: %#x\n",
117 pkt->
getLE<uint32_t>(), daddr);
126 DPRINTF(
Timer,
"Writing to DualTimer at offset: %#x\n", daddr);
133 panic(
"Tried to write SP804 at offset %#x that doesn't exist\n", daddr);
142 pkt->
getLE<uint32_t>(), daddr);
153 old_enable =
control.timerEnable;
155 if ((old_enable == 0) &&
control.timerEnable)
170 panic(
"Tried to write SP804 timer at offset %#x\n", daddr);
178 DPRINTF(
Timer,
"Resetting counter with value %#x\n", val);
186 time *=
bits(val,15,0);
189 DPRINTF(
Timer,
"-- Event was already schedule, de-scheduling\n");
226 DPRINTF(Checkpoint,
"Serializing Arm Sp804\n");
228 uint32_t control_serial =
control;
248 DPRINTF(Checkpoint,
"Unserializing Arm Sp804\n");
250 uint32_t control_serial;
285 Sp804Params::create()
287 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()
void serializeSection(CheckpointOut &cp, const char *name) const
Serialize an object into a new section.
EndBitUnion(CTRL) protected Sp804 * parent
Pointer to parent class.
Tick when() const
Get the time that the event is scheduled.
void unserializeSection(CheckpointIn &cp, const char *name)
Unserialize an a child object.
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 deschedule(Event &event)
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.
bool scheduled() const
Determine if the current event is scheduled.
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.
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.
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 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 schedule(Event &event, Tick when)
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...
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.