41 #ifndef __DEV_ARM_GENERIC_TIMER_HH__
42 #define __DEV_ARM_GENERIC_TIMER_HH__
56 class GenericTimerParams;
57 class GenericTimerMemParams;
136 const std::
string _name;
164 ArchTimer(const std::
string &
name,
170 std::
string name()
const {
return _name; }
190 uint64_t
value()
const;
215 unsigned _irqPhys,
unsigned _irqVirt)
334 #endif // __DEV_ARM_GENERIC_TIMER_HH__
void unserialize(CheckpointIn &cp) override
Unserialize an object.
uint64_t timerRead(Addr addr, size_t size) const
void setFreq(uint32_t freq)
Sets the counter frequency.
AddrRangeList getAddrRanges() const override
Every PIO device is obliged to provide an implementation that returns the address ranges the device r...
uint64_t _counterLimit
Programmed limit value for the upcounter ({CNTP/CNTHP/CNTV}_CVAL).
ArchTimer::Interrupt irqVirt
Tick period() const
Returns the counter period.
GenericTimer(GenericTimerParams *p)
CoreTimers(GenericTimer &parent, unsigned cpu, unsigned _irqPhys, unsigned _irqVirt)
void unserialize(CheckpointIn &cp) override
Unserialize an object.
static const Addr TIMER_CNTVCT_LO
ArmISA::MiscReg readMiscReg(int misc_reg) override
Read a system register belonging to this device.
static const Addr TIMER_CNTFRQ
CoreTimers & getTimers(int cpu_id)
EndBitUnion(UserDescFlags) struct UserDesc32
static const Addr TIMER_CNTP_TVAL
uint64_t compareValue() const
Returns the CompareValue view of the timer.
Per-CPU architected timer.
static const Addr TIMER_CNTV_CVAL_LO
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
void timerWrite(Addr addr, size_t size, uint64_t value)
BitUnion32(ArchTimerCtrl) Bitfield< 0 > enable
Control register.
Base class for devices that use the MiscReg interfaces.
void setMiscReg(int misc_reg, unsigned cpu, ArmISA::MiscReg val)
const AddrRangeList addrRanges
GenericTimerMem(GenericTimerMemParams *p)
const unsigned irqVirt
Virtual timer interrupt.
void setTimerValue(uint32_t val)
Sets the TimerValue view of the timer.
ArchTimerCtrl _control
Value of the control register ({CNTP/CNTHP/CNTV}_CTL).
static const Addr TIMER_CNTV_CTL
ArmISA::MiscReg readMiscReg(int misc_reg, unsigned cpu)
void counterLimitReached()
Called when the upcounter reaches the programmed value.
Tick _resetTick
Tick when the counter was reset.
Tick _period
Cached copy of the counter period (inverse of the frequency).
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
static const Addr CTRL_CNTVOFF_HI_BASE
uint64_t _freq
Counter frequency (as specified by CNTFRQ).
void setOffset(uint64_t val)
Tick curTick()
The current simulated tick.
Interrupt(BaseGic &gic, unsigned irq, unsigned cpu)
std::string csprintf(const char *format, const Args &...args)
EventWrapper< ArchTimer,&ArchTimer::counterLimitReached > _counterLimitReachedEvent
uint64_t value() const
Returns the current value of the physical counter.
void serialize(CheckpointOut &cp) const override
Serialize an object.
const unsigned irqPhys
Physical timer interrupt.
static const Addr TIMER_CNTVOFF_LO
std::string name() const
Returns the timer name.
const AddrRange ctrlRange
uint64_t Tick
Tick count type.
SystemCounter systemCounter
System counter.
void createTimers(unsigned cpus)
void serialize(CheckpointOut &cp) const override
Serialize an object.
uint32_t timerValue() const
Returns the TimerValue view of the timer.
void setCompareValue(uint64_t val)
Sets the CompareValue view of the timer.
uint64_t ctrlRead(Addr addr, size_t size) const
uint32_t getKernelControl()
void setKernelControl(uint32_t val)
static const Addr CTRL_CNTACR_BASE
void ctrlWrite(Addr addr, size_t size, uint64_t value)
This device is the base class which all devices senstive to an address range inherit from...
static const Addr TIMER_CNTEL0ACR
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...
Basic support for object serialization.
ArchTimer::Interrupt irqPhys
virtual const std::string name() const
Base class for ARM GIC implementations.
static const Addr TIMER_CNTPCT_LO
static const Addr CTRL_CNTTIDR
void serialize(CheckpointOut &cp) const override
Serialize an object.
std::ostream CheckpointOut
static const Addr TIMER_CNTP_CTL
Interrupt(BaseGic &gic, unsigned irq)
void serialize(CheckpointOut &cp) const override
Serialize an object.
static const Addr TIMER_CNTP_CVAL_LO
static const Addr TIMER_CNTV_TVAL
static const Addr TIMER_CNTP_CVAL_HI
void unserialize(CheckpointIn &cp) override
Unserialize an object.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
static const Addr CTRL_CNTNSAR
SystemCounter systemCounter
System counter.
uint64_t value() const
Returns the value of the counter which this timer relies on.
GenericTimerISA(GenericTimer &_parent, unsigned _cpu)
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
uint32_t control() const
Sets the control register.
ArchTimer(const std::string &name, SimObject &parent, SystemCounter &sysctr, const Interrupt &interrupt)
static const Addr TIMER_CNTVOFF_HI
void setMiscReg(int misc_reg, ArmISA::MiscReg val) override
Write to a system register belonging to this device.
void setControl(uint32_t val)
std::vector< std::unique_ptr< CoreTimers > > timers
Per-CPU physical architected timers.
BaseGic *const gic
Pointer to the GIC, needed to trigger timer interrupts.
const AddrRange timerRange
static const Addr TIMER_CNTV_CVAL_HI
static const Addr CTRL_CNTFRQ
SystemCounter & _systemCounter
static const Addr TIMER_CNTVCT_HI
void updateCounter()
Timer settings or the offset has changed, re-evaluate trigger condition and raise interrupt if necess...
static const Addr TIMER_CNTPCT_HI
Abstract superclass for simulation objects.
uint64_t _offset
Offset relative to the physical timer (CNTVOFF)
static const Addr CTRL_CNTVOFF_LO_BASE
EndBitUnion(ArchTimerCtrl) const std SimObject & _parent
Name of this timer.
uint64_t freq() const
Returns the counter frequency.