43#include "debug/Checkpoint.hh"
44#include "debug/Timer.hh"
53 :
AmbaIntDevice(
p, 0x1000), lastWrittenTick(0), loadVal(0), matchVal(0),
54 rawInt(false), maskInt(false), pendingInt(false),
58 struct tm local_time =
p.time;
71 DPRINTF(Timer,
"Reading from RTC at offset: %#x\n", daddr);
102 panic(
"Tried to read PL031 at offset %#x that doesn't exist\n", daddr);
117 DPRINTF(Timer,
"Writing to RTC at offset: %#x\n", daddr);
138 if (pkt->
getLE<uint32_t>()) {
146 panic(
"Tried to read PL031 at offset %#x that doesn't exist\n", daddr);
157 DPRINTF(Timer,
"Setting up new match event match=%d time=%d\n",
matchVal,
164 DPRINTF(Timer,
"-- Event was already schedule, de-scheduling\n");
168 DPRINTF(Timer,
"-- Scheduling new event for: %d\n",
curTick() + ticks_until);
174 DPRINTF(Timer,
"Counter reached zero\n");
180 DPRINTF(Timer,
"-- Causing interrupt\n");
188 DPRINTF(Checkpoint,
"Serializing Arm PL031\n");
210 DPRINTF(Checkpoint,
"Unserializing Arm PL031\n");
This is a base class for AMBA devices that have to respond to Device and Implementer ID calls.
bool readId(PacketPtr pkt, uint64_t amba_id, Addr pio_addr)
ArmInterruptPin *const interrupt
virtual void raise()=0
Signal an interrupt.
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.
bool rawInt
If timer has caused an interrupt.
bool pendingInt
If an interrupt is currently pending.
Tick read(PacketPtr pkt) override
Handle a read to the device.
Tick write(PacketPtr pkt) override
Handle writes to the device.
void serialize(CheckpointOut &cp) const override
Serialize an object.
PL031(const Params &p)
The constructor for RealView just registers itself with the MMU.
void counterMatch()
Called when the counter reaches matches.
EventFunctionWrapper matchEvent
void resyncMatch()
Called to update the matchEvent when the load Value or match value are written.
bool maskInt
If the timer interrupt mask that is anded with the raw interrupt to generate a pending interrupt.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
void setUintX(uint64_t w, ByteOrder endian)
Set the value in the word w after truncating it to the length of the packet and then byteswapping it ...
uint64_t getUintX(ByteOrder endian) const
Get the data in the packet byte swapped from the specified endianness and zero-extended to 64 bits.
void makeAtomicResponse()
T getLE() const
Get the data in the packet byte swapped from little endian to host endian.
void deschedule(Event &event)
bool scheduled() const
Determine if the current event is scheduled.
void schedule(Event &event, Tick when)
Tick when() const
Get the time that the event is scheduled.
#define panic(...)
This implements a cprintf based panic() function.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria 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.
time_t mkutctime(struct tm *time)
uint64_t Tick
Tick count type.
Declaration of the Packet class.
This implements the ARM Primecell 031 RTC.
#define UNSERIALIZE_SCALAR(scalar)
#define SERIALIZE_SCALAR(scalar)
const std::string & name()