31 : ram(config_, name, description,
size)
37 const DeviceConfig& config_,
const char* header_,
bool* loaded)
38 : schedulable(
std::in_place, config_.getReactor().getRTScheduler(), *this)
40 , ram(config, name,
"sram",
size)
47 const DeviceConfig& config_,
const char* header_,
bool* loaded)
48 : schedulable(
std::in_place, config_.getReactor().getRTScheduler(), *this)
50 , ram(config, name, description,
size)
65 if (schedulable && !schedulable->isPendingRT()) {
66 schedulable->scheduleRT(5000000);
68 assert(addr <
size());
69 ram.
write(addr, value);
74 if (schedulable && !schedulable->isPendingRT()) {
75 schedulable->scheduleRT(5000000);
77 assert((addr + aSize) <=
size());
81void SRAM::load(
bool* loaded)
84 if (loaded) *loaded =
false;
91 size_t length = strlen(header);
98 loadedFilename = file.getURL();
99 if (loaded) *loaded =
true;
102 "Warning no correct SRAM file: ", filename);
104 }
catch (FileNotFoundException& ) {
106 "SRAM file ", filename,
" not found, "
107 "assuming blank SRAM content.");
108 }
catch (FileException&
e) {
110 "Couldn't load SRAM ", filename,
111 " (",
e.getMessage(),
").");
123 auto length = strlen(header);
124 file.write(std::span{header,
length});
127 file.write(std::span{ram.
begin(), ram.
end()});
128 }
catch (FileException&
e) {
130 "Couldn't save SRAM ", filename,
131 " (",
e.getMessage(),
").");
135void SRAM::SRAMSchedulable::executeRT()
140template<
typename Archive>
143 ar.serialize(
"ram", ram);
void printInfo(std::string_view message)
void printWarning(std::string_view message)
CliComm & getCliComm() const
const FileContext & getFileContext() const
std::string_view getChildData(std::string_view name) const
const XMLElement * getXML() const
std::string resolveCreate(std::string_view filename) const
SRAM(size_t size, const XMLElement &xml, DontLoadTag)
void write(size_t addr, byte value)
void serialize(Archive &ar, unsigned version)
void memset(size_t addr, byte c, size_t size)
void write(size_t addr, byte value)
std::span< byte > getWriteBackdoor()
T length(const vecN< N, T > &x)
This file implemented 3 utility functions:
constexpr void fill(ForwardRange &&range, const T &value)
bool equal(InputRange1 &&range1, InputRange2 &&range2, Pred pred={}, Proj1 proj1={}, Proj2 proj2={})
size_t size(std::string_view utf8)
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)
#define VLA(TYPE, NAME, LENGTH)