41 #include "debug/Sp805.hh" 43 #include "params/Sp805.hh" 47 timeoutInterval(0xffffffff),
49 persistedValue(timeoutInterval),
53 writeAccessEnabled(true),
54 integrationTestEnabled(false),
63 const size_t size = pkt->
getSize();
64 panic_if(size != 4,
"Sp805::read: Invalid size %i\n", size);
78 warn(
"Sp805::read: WO reg (0x%x) [WDOGINTCLR]\n", addr);
93 warn(
"Sp805::read: WO reg (0x%x) [WDOGITOP]\n", addr);
99 warn(
"Sp805::read: Unexpected address (0x%x:%i), assuming RAZ\n",
103 DPRINTF(
Sp805,
"Sp805::read: 0x%x<-0x%x(%i)\n", resp, addr, size);
114 const size_t size = pkt->
getSize();
115 panic_if(size != 4,
"Sp805::write: Invalid size %i\n", size);
131 warn(
"Sp805::write: RO reg (0x%x) [WDOGVALUE]\n", addr);
155 warn(
"Sp805::write: RO reg (0x%x) [WDOGRIS]\n", addr);
158 warn(
"Sp805::write: RO reg (0x%x) [WDOGMIS]\n", addr);
164 warn(
"Sp805::write: No support for integration test harness\n");
167 warn(
"Sp805::write: Unexpected address (0x%x:%i), assuming WI\n",
171 DPRINTF(
Sp805,
"Sp805::write: 0x%x->0x%x(%i)\n", data, addr, size);
215 warn(
"Watchdog timed out, system reset asserted\n");
269 Sp805Params::create()
271 return new Sp805(
this);
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 ...
static constexpr uint32_t WDOGLOCK_MAGIC
If written into WdogLock, registers are unlocked for writes.
Cycles is a wrapper class for representing cycle counts, i.e.
virtual void clearInt(uint32_t num)=0
Clear an interrupt from a device that is connected to the GIC.
void restartCounter(void)
Restarts the counter to the current timeout interval.
void stopCounter(void)
Stops the counter when watchdog becomes disabled.
Tick timeoutStartTick
Timeout start tick to keep track of the counter value.
uint32_t value(void) const
Returns the current counter value.
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
void timeoutExpired(void)
Triggered when value reaches 0.
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
uint64_t getUintX(ByteOrder endian) const
Get the data in the packet byte swapped from the specified endianness and zero-extended to 64 bits...
Sp805(Sp805Params const *params)
#define UNSERIALIZE_SCALAR(scalar)
EventFunctionWrapper timeoutEvent
Timeout event, triggered when the counter value reaches 0.
Tick curTick()
The current simulated tick.
bool resetEnabled
Indicates if reset behaviour is enabled when counter reaches 0.
virtual void sendInt(uint32_t num)=0
Post an interrupt from a device that is connected to the GIC.
uint64_t Tick
Tick count type.
uint32_t timeoutInterval
Timeout interval (in cycles) as specified in WdogLoad.
void deschedule(Event &event)
void clearInt(void)
Clears any active interrupts.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
bool readId(PacketPtr pkt, uint64_t amba_id, Addr pio_addr)
void reschedule(Event &event, Tick when, bool always=false)
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
bool enabled
Indicates if watchdog (counter and interrupt) is enabled.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
Tick clockEdge(Cycles cycles=Cycles(0)) const
Determine the tick when a cycle begins, by default the current one, but the argument also enables the...
#define SERIALIZE_SCALAR(scalar)
bool scheduled() const
Determine if the current event is scheduled.
bool intRaised
Indicates if an interrupt has been raised by the counter reaching 0.
void makeResponse()
Take a request packet and modify it in place to be suitable for returning as a response to that reque...
virtual const std::string name() const
uint32_t persistedValue
Value as persisted when the watchdog is stopped.
std::ostream CheckpointOut
bool integrationTestEnabled
Indicates if integration test harness is enabled.
Tick pioDelay
Delay that the device experinces on an access.
void serialize(CheckpointOut &cp) const override
Serialize an object.
bool writeAccessEnabled
Indicates if write access to registers is enabled.
T bits(T val, int first, int last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it...
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Tick when() const
Get the time that the event is scheduled.
Addr pioAddr
Address that the device listens to.
Arm Watchdog Module (SP805) Reference: Arm Watchdog Module (SP805) - Technical Reference Manual - rev...
void sendInt(void)
Raises an interrupt.