32#include "debug/LupioTMR.hh"
34#include "params/LupioTMR.hh"
37#define LUPIO_TMR_IRQE 0x1
38#define LUPIO_TMR_PRDC 0x2
41#define LUPIO_TMR_EXPD 0x1
49 nThread(params.num_threads),
50 intType(params.int_type)
54 for (
int cpu = 0; cpu <
nThread; cpu++) {
67 for (
int cpu = 0; cpu <
nThread; cpu++) {
68 delete timers[cpu].tmrEvent;
78 tc->getCpuPtr()->postInterrupt(tc->threadId(),
intType, 0);
81 tc->getCpuPtr()->clearInterrupt(tc->threadId(),
intType, 0);
99 if (!
timers[cpu].tmrEvent->scheduled()) {
110 timers[cpu].expired =
true;
139 if (
timers[cpu].expired) {
144 timers[cpu].expired =
false;
150 panic(
"Unexpected read to the LupioTMR device at address %#llx!",
160 uint32_t
val = val64;
180 (
timers[cpu].tmrEvent)->scheduled()) {
191 panic(
"Unexpected write to the LupioTMR device at address %#llx!",
203 "Read request - addr: %#x, size: %#x\n", tmr_addr, pkt->
getSize());
Addr pioAddr
Address that the device listens to.
Tick pioDelay
Delay that the device experinces on an access.
LupioTMR: A virtual timer device which provides a real time counter, as well as a configurable timer ...
void updateIRQ(int level, int cpu)
Post or clear timer interrupts.
const ByteOrder byteOrder
std::vector< LupioTimer > timers
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
void lupioTMRCallback(int cpu)
Process the timer's event.
uint64_t lupioTMRRead(const uint8_t addr, int size)
Function to return data pertaining to the timer, such as the simulated time in ticks.
LupioTMR(const Params ¶ms)
void lupioTMRSet(int cpu)
Schedule the next timer event.
Tick read(PacketPtr pkt) override
Implement BasicPioDevice virtual functions.
uint64_t lupioTMRCurrentTime()
Return the simulated time.
void lupioTMRWrite(const uint8_t addr, uint64_t val64, int size)
Function to launch or stop the timer depending on the load value.
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 ...
void makeResponse()
Take a request packet and modify it in place to be suitable for returning as a response to that reque...
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 deschedule(Event &event)
void schedule(Event &event, Tick when)
#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.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
uint64_t Tick
Tick count type.
const std::string & name()