45 #include "debug/Checkpoint.hh"
46 #include "debug/Timer.hh"
53 lastWrittenTick(0), loadVal(0), matchVal(0),
54 rawInt(false), maskInt(false), pendingInt(false), matchEvent(this)
67 DPRINTF(Timer,
"Reading from RTC at offset: %#x\n", daddr);
94 data = pkt->
get<uint32_t>();
97 panic(
"Tried to read PL031 at offset %#x that doesn't exist\n", daddr);
112 panic(
"Uart read size too big?\n");
127 DPRINTF(Timer,
"Writing to RTC at offset: %#x\n", daddr);
148 if (pkt->
get<uint32_t>()) {
156 panic(
"Tried to read PL031 at offset %#x that doesn't exist\n", daddr);
167 DPRINTF(Timer,
"Setting up new match event match=%d time=%d\n",
matchVal,
174 DPRINTF(Timer,
"-- Event was already schedule, de-scheduling\n");
178 DPRINTF(Timer,
"-- Scheduling new event for: %d\n",
curTick() + ticks_until);
184 DPRINTF(Timer,
"Counter reached zero\n");
190 DPRINTF(Timer,
"-- Causing interrupt\n");
198 DPRINTF(Checkpoint,
"Serializing Arm PL031\n");
220 DPRINTF(Checkpoint,
"Unserializing Arm PL031\n");
243 PL031Params::create()
245 return new PL031(
this);
void set(T v, ByteOrder endian)
Set the value in the data pointer to v using the specified endianness.
Tick read(PacketPtr pkt) override
Handle a read to the device.
bool scheduled() const
Determine if the current event is scheduled.
AmbaPioDeviceParams Params
Tick write(PacketPtr pkt) override
Handle writes to the device.
void resyncMatch()
Called to update the matchEvent when the load Value or match value are written.
bool rawInt
If timer has caused an interrupt.
void deschedule(Event &event)
T get(ByteOrder endian) const
Get the data in the packet byte swapped from the specified endianness.
#define UNSERIALIZE_SCALAR(scalar)
bool maskInt
If the timer interrupt mask that is anded with the raw interrupt to generate a pending interrupt...
Tick curTick()
The current simulated tick.
Addr pioSize
Size that the device's address range.
void serialize(CheckpointOut &cp) const override
Serialize an object.
This is a base class for AMBA devices that have to respond to Device and Implementer ID calls...
Tick when() const
Get the time that the event is scheduled.
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.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
EventWrapper< PL031,&PL031::counterMatch > matchEvent
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...
#define SERIALIZE_SCALAR(scalar)
This implements the ARM Primecell 031 RTC.
Declaration of the Packet class.
std::ostream CheckpointOut
time_t mkutctime(struct tm *time)
bool pendingInt
If an interrupt is currently pending.
Tick pioDelay
Delay that the device experinces on an access.
PL031(Params *p)
The constructor for RealView just registers itself with the MMU.
void schedule(Event &event, Tick when)
void counterMatch()
Called when the counter reaches matches.
Addr pioAddr
Address that the device listens to.