45#include "debug/Checkpoint.hh"
46#include "debug/Timer.hh"
50#include "params/Sp804.hh"
57 timer0(
name() +
".timer0", this,
p.int0->get(),
p.clock0),
78 DPRINTF(
Timer,
"Reading from DualTimer at offset: %#x\n", daddr);
85 panic(
"Tried to read SP804 at offset %#x that doesn't exist\n", daddr);
99 DPRINTF(
Timer,
"Event schedule for %d, clock=%d, prescale=%d\n",
105 pkt->
setLE<uint32_t>(time);
120 panic(
"Tried to read SP804 timer at offset %#x\n", daddr);
123 DPRINTF(
Timer,
"Reading %#x from Timer at offset: %#x\n",
124 pkt->
getLE<uint32_t>(), daddr);
133 DPRINTF(
Timer,
"Writing to DualTimer at offset: %#x\n", daddr);
140 panic(
"Tried to write SP804 at offset %#x that doesn't exist\n", daddr);
149 pkt->
getLE<uint32_t>(), daddr);
160 old_enable =
control.timerEnable;
162 if ((old_enable == 0) &&
control.timerEnable)
177 panic(
"Tried to write SP804 timer at offset %#x\n", daddr);
196 DPRINTF(
Timer,
"-- Event was already schedule, de-scheduling\n");
233 DPRINTF(Checkpoint,
"Serializing Arm Sp804\n");
235 uint32_t control_serial =
control;
242 bool is_in_event =
zeroEvent.scheduled();
255 DPRINTF(Checkpoint,
"Unserializing Arm Sp804\n");
257 uint32_t control_serial;
280 timer0.serializeSection(
cp,
"timer0");
281 timer1.serializeSection(
cp,
"timer1");
287 timer0.unserializeSection(
cp,
"timer0");
288 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()