45#include "debug/Checkpoint.hh"
46#include "debug/Timer.hh"
56 timer0(
name() +
".timer0", this,
p.int0->get(),
p.clock0),
77 DPRINTF(
Timer,
"Reading from DualTimer at offset: %#x\n", daddr);
84 panic(
"Tried to read SP804 at offset %#x that doesn't exist\n", daddr);
98 DPRINTF(
Timer,
"Event schedule for %d, clock=%d, prescale=%d\n",
104 pkt->
setLE<uint32_t>(time);
119 panic(
"Tried to read SP804 timer at offset %#x\n", daddr);
122 DPRINTF(
Timer,
"Reading %#x from Timer at offset: %#x\n",
123 pkt->
getLE<uint32_t>(), daddr);
132 DPRINTF(
Timer,
"Writing to DualTimer at offset: %#x\n", daddr);
139 panic(
"Tried to write SP804 at offset %#x that doesn't exist\n", daddr);
148 pkt->
getLE<uint32_t>(), daddr);
159 old_enable =
control.timerEnable;
161 if ((old_enable == 0) &&
control.timerEnable)
176 panic(
"Tried to write SP804 timer at offset %#x\n", daddr);
195 DPRINTF(
Timer,
"-- Event was already schedule, de-scheduling\n");
232 DPRINTF(Checkpoint,
"Serializing Arm Sp804\n");
234 uint32_t control_serial =
control;
241 bool is_in_event =
zeroEvent.scheduled();
254 DPRINTF(Checkpoint,
"Unserializing Arm Sp804\n");
256 uint32_t control_serial;
279 timer0.serializeSection(
cp,
"timer0");
280 timer1.serializeSection(
cp,
"timer1");
286 timer0.unserializeSection(
cp,
"timer0");
287 timer1.unserializeSection(
cp,
"timer1");
Base class for ARM GIC implementations.
bool readId(PacketPtr pkt, uint64_t amba_id, Addr pio_addr)
AmbaPioDevice(const Params &p, Addr pio_size)
Generic representation of an Arm interrupt pin.
Addr pioAddr
Address that the device listens to.
Tick pioDelay
Delay that the device experinces on an access.
Addr pioSize
Size that the device's address range.
void setLE(T v)
Set the value in the data pointer to v as little endian.
void makeAtomicResponse()
T getLE() const
Get the data in the packet byte swapped from little endian to host endian.
EndBitUnion(CTRL) protected Sp804 * parent
Pointer to parent class.
Timer(std::string __name, Sp804 *parent, ArmInterruptPin *_interrupt, Tick clock)
CTRL control
Control register as specified above.
void counterAtZero()
Called when the counter reaches 0.
uint32_t loadValue
Value to load into counter when periodic mode reaches 0.
bool pendingInt
If an interrupt is currently pending.
void restartCounter(uint32_t val)
Restart the counter ticking at val.
const Tick clock
Number of ticks in a clock input.
EventFunctionWrapper zeroEvent
void serialize(CheckpointOut &cp) const override
Serialize an object.
void write(PacketPtr pkt, Addr daddr)
Handle write for a single timer.
bool rawInt
If timer has caused an interrupt.
void read(PacketPtr pkt, Addr daddr)
Handle read for a single timer.
ArmInterruptPin *const interrupt
Pointer to the interrupt pin.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
void serialize(CheckpointOut &cp) const override
Serialize an object.
Timer timer0
Timers that do the actual work.
Sp804(const Params &p)
The constructor for RealView just registers itself with the MMU.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Tick read(PacketPtr pkt) override
Handle a read to the device.
Tick write(PacketPtr pkt) override
All writes are simply ignored.
constexpr T bits(T val, unsigned first, unsigned last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
#define panic(...)
This implements a cprintf based panic() function.
Copyright (c) 2024 Arm Limited All rights reserved.
Tick curTick()
The universal simulation clock.
std::ostream CheckpointOut
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
uint64_t Tick
Tick count type.
Declaration of the Packet class.
#define UNSERIALIZE_SCALAR(scalar)
#define SERIALIZE_SCALAR(scalar)
This implements the dual Sp804 timer block.
const std::string & name()