tools/remove: add 0x to hex debug prints.

This commit is contained in:
Florent Kermarrec 2020-11-24 14:06:14 +01:00
parent cddf19df98
commit f918d0bf02
4 changed files with 8 additions and 8 deletions

View File

@ -33,7 +33,7 @@ class CommPCIe:
for i in range(length_int): for i in range(length_int):
value = ctypes.c_uint32.from_buffer(self.mmap, addr + 4*i).value value = ctypes.c_uint32.from_buffer(self.mmap, addr + 4*i).value
if self.debug: if self.debug:
print("read {:08x} @ {:08x}".format(value, addr + 4*i)) print("read 0x{:08x} @ 0x{:08x}".format(value, addr + 4*i))
if length is None: if length is None:
return value return value
data.append(value) data.append(value)
@ -45,4 +45,4 @@ class CommPCIe:
for i, value in enumerate(data): for i, value in enumerate(data):
ctypes.c_uint32.from_buffer(self.mmap, addr + 4*i).value = value ctypes.c_uint32.from_buffer(self.mmap, addr + 4*i).value = value
if self.debug: if self.debug:
print("write {:08x} @ {:08x}".format(value, addr + 4*i)) print("write 0x{:08x} @ 0x{:08x}".format(value, addr + 4*i))

View File

@ -61,7 +61,7 @@ class CommUART:
for i in range(length_int): for i in range(length_int):
value = int.from_bytes(self._read(4), "big") value = int.from_bytes(self._read(4), "big")
if self.debug: if self.debug:
print("read {:08x} @ {:08x}".format(value, addr + 4*i)) print("read 0x{:08x} @ 0x{:08x}".format(value, addr + 4*i))
if length is None: if length is None:
return value return value
data.append(value) data.append(value)
@ -83,6 +83,6 @@ class CommUART:
for i, value in enumerate(data[offset:offset+size]): for i, value in enumerate(data[offset:offset+size]):
self._write(list(value.to_bytes(4, byteorder="big"))) self._write(list(value.to_bytes(4, byteorder="big")))
if self.debug: if self.debug:
print("write {:08x} @ {:08x}".format(value, addr + offset, 4*i)) print("write 0x{:08x} @ 0x{:08x}".format(value, addr + offset, 4*i))
offset += size offset += size
length -= size length -= size

View File

@ -48,7 +48,7 @@ class CommUDP:
datas = packet.records.pop().writes.get_datas() datas = packet.records.pop().writes.get_datas()
if self.debug: if self.debug:
for i, value in enumerate(datas): for i, value in enumerate(datas):
print("read {:08x} @ {:08x}".format(value, addr + 4*i)) print("read 0x{:08x} @ 0x{:08x}".format(value, addr + 4*i))
return datas[0] if length is None else datas return datas[0] if length is None else datas
def write(self, addr, datas): def write(self, addr, datas):
@ -66,4 +66,4 @@ class CommUDP:
if self.debug: if self.debug:
for i, value in enumerate(datas): for i, value in enumerate(datas):
print("write {:08x} @ {:08x}".format(value, addr + 4*i)) print("write 0x{:08x} @ 0x{:08x}".format(value, addr + 4*i))

View File

@ -102,7 +102,7 @@ class CommUSB:
if value is None: if value is None:
value = 0xffffffff value = 0xffffffff
if self.debug: if self.debug:
print("read {:08x} @ {:08x}".format(value, addr)) print("read 0x{:08x} @ 0x{:08x}".format(value, addr))
if length is None: if length is None:
return value return value
data.append(value) data.append(value)
@ -137,7 +137,7 @@ class CommUSB:
for i, value in enumerate(data): for i, value in enumerate(data):
self.usb_write(addr, value) self.usb_write(addr, value)
if self.debug: if self.debug:
print("write {:08x} @ {:08x}".format(value, addr + 4*i)) print("write 0x{:08x} @ 0x{:08x}".format(value, addr + 4*i))
def usb_write(self, addr, value, depth=0): def usb_write(self, addr, value, depth=0):
try: try: