41#include "debug/RVCTRL.hh"
44#include "params/RealViewCtrl.hh"
45#include "params/RealViewOsc.hh"
46#include "params/RealViewTemperatureSensor.hh"
76 pkt->
setLE((uint32_t)(clk));
81 pkt->
setLE((uint32_t)(clk100));
84 pkt->
setLE<uint32_t>(0);
87 pkt->
setLE<uint32_t>(0x00001F00);
90 pkt->
setLE<uint32_t>(0x00012C5C);
93 pkt->
setLE<uint32_t>(0x00002CC0);
96 pkt->
setLE<uint32_t>(0x00002C75);
99 pkt->
setLE<uint32_t>(0x00020211);
102 pkt->
setLE<uint32_t>(0x00002C75);
114 pkt->
setLE<uint32_t>(1);
121 pkt->
setLE<uint32_t>(0);
122 DPRINTF(RVCTRL,
"Read 0 from CfgCtrl\n");
125 warn(
"Tried to read RealView I/O at offset %#x that doesn't exist\n",
127 pkt->
setLE<uint32_t>(0);
155 warn_once(
"Ignoring write to reset control\n");
170 CfgCtrlReg req = pkt->
getLE<uint32_t>();
172 DPRINTF(RVCTRL,
"SCReg: write %#x to ctrl but not starting\n",
177 auto it_dev(
devices.find(req & CFG_CTRL_ADDR_MASK));
179 warn_once(
"SCReg: Access to unknown device "
180 "dcc%d:site%d:pos%d:fn%d:dev%d\n",
181 req.dcc, req.site, req.pos, req.func, req.dev);
189 DPRINTF(RVCTRL,
"SCReg: Writing %#x (ctrlWr %#x)\n",
195 DPRINTF(RVCTRL,
"SCReg: Reading %#x (ctrlRd %#x)\n",
201 warn(
"Tried to write RVIO at offset %#x (data %#x) that doesn't exist\n",
202 daddr, pkt->
getLE<uint32_t>());
223 uint8_t
dcc, uint16_t
dev,
234 fatal(
"Platform device dcc%d:site%d:pos%d:fn%d:dev%d "
235 "already registered.",
246 p.site,
p.position,
p.dcc,
p.device)
249 fatal(
"Oscillator frequency out of range: %f\n",
250 sim_clock::as_float::s / p.freq / 1E6);
261 m->updateClockPeriod();
279 panic_if(clock_period == 0,
"%s has a clock period of zero\n",
name());
283 m->updateClockPeriod();
289 m->updateClockPeriod();
296 DPRINTF(RVCTRL,
"Reading OSC frequency: %f MHz\n", freq / 1E6);
303 DPRINTF(RVCTRL,
"Setting new OSC frequency: %f MHz\n", freq / 1E6);
308 const RealViewTemperatureSensorParams &
p)
311 p.position,
p.dcc,
p.device),
321 double t =
tm->getTemperature().toCelsius();
323 warn(
"Temperature below zero!\n");
324 return fmax(0,
t) * 1000000;
Addr pioAddr
Address that the device listens to.
BasicPioDevice(const Params &p, Addr size)
Tick pioDelay
Delay that the device experinces on an access.
Addr pioSize
Size that the device's address range.
std::vector< DerivedClockDomain * > children
Pointers to potential derived clock domains so we can propagate changes.
ClockDomain(const Params &p, VoltageDomain *voltage_domain)
Tick _clockPeriod
Pre-computed clock period in ticks.
Tick clockPeriod() const
Get the clock period.
std::vector< Clocked * > members
Pointers to members of this clock domain, so that when the clock period changes, we can update each m...
virtual std::string name() const
void setLE(T v)
Set the value in the data pointer to v as little endian.
void makeAtomicResponse()
T getLE() const
Get the data in the packet byte swapped from little endian to host endian.
Device(RealViewCtrl &parent, DeviceFunc func, uint8_t site, uint8_t pos, uint8_t dcc, uint16_t dev)
void registerDevice(DeviceFunc func, uint8_t site, uint8_t pos, uint8_t dcc, uint16_t dev, Device *handler)
Tick write(PacketPtr pkt) override
All writes are simply ignored.
uint32_t scData
This register contains the result from a system control reg access.
Tick read(PacketPtr pkt) override
Handle a read to the device.
uint32_t flags
This register is used for smp booting.
RealViewCtrl(const Params &p)
The constructor for RealView just registers itself with the MMU.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
void serialize(CheckpointOut &cp) const override
Serialize an object.
std::map< uint32_t, Device * > devices
void startup() override
startup() is the final initialization call before simulation.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
RealViewOsc(const RealViewOscParams &p)
void write(uint32_t freq) override
uint32_t read() const override
void serialize(CheckpointOut &cp) const override
Serialize an object.
RealViewTemperatureSensor(const RealViewTemperatureSensorParams &p)
uint32_t read() const override
System * system
The system this RV device belongs to.
#define fatal(...)
This implements a cprintf based fatal() function.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
const Params & params() const
SimObject(const Params &p)
FloatType fmax(FloatType a, FloatType b)
double s
These variables equal the number of ticks in the unit of time they're named after in a double.
Copyright (c) 2024 Arm Limited 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.
uint64_t Tick
Tick count type.
Declaration of the Packet class.
This implements the simple real view registers on a PBXA9.
#define UNSERIALIZE_SCALAR(scalar)
#define SERIALIZE_SCALAR(scalar)