MCPcopy
hub / github.com/AsahiLinux/m1n1 / writemem

Method writemem

proxyclient/m1n1/proxy.py:389–409  ·  view source on GitHub ↗
(self, addr, data, progress=False)

Source from the content-addressed store, hash-verified

387 return self.reply(self.REQ_PROXY)
388
389 def writemem(self, addr, data, progress=False):
390 checksum = self.data_checksum(data)
391 size = len(data)
392 req = struct.pack("<QQI", addr, size, checksum)
393 self.cmd(self.REQ_MEMWRITE, req)
394 if self.debug:
395 print("<< DATA:")
396 chexdump(data)
397 for i in range(0, len(data), 8192):
398 self.dev.write(data[i:i + 8192])
399 if progress:
400 sys.stdout.write(".")
401 sys.stdout.flush()
402 if progress:
403 print()
404 if self.enabled_features & Feature.DISABLE_DATA_CSUMS:
405 # Extra sentinel after the data to make sure no data is lost
406 self.dev.write(struct.pack("<I", self.DATA_END_SENTINEL))
407
408 # should automatically report a CRC failure
409 self.reply(self.REQ_MEMWRITE)
410
411 def readmem(self, addr, size):
412 if size == 0:

Callers 1

requestMethod · 0.45

Calls 6

data_checksumMethod · 0.95
cmdMethod · 0.95
replyMethod · 0.95
chexdumpFunction · 0.85
writeMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected