From: Florent Kermarrec Date: Mon, 30 May 2016 14:16:05 +0000 (+0200) Subject: soc/tools/remove/comm_uart: limit write bursts to 8 32bits words X-Git-Tag: 24jan2021_ls180~1939 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f193873bb8cfdc52e073c5a64568d1beaf8487f3;p=litex.git soc/tools/remove/comm_uart: limit write bursts to 8 32bits words --- diff --git a/litex/soc/tools/remote/comm_uart.py b/litex/soc/tools/remote/comm_uart.py index 10fa37e8..b6a8f1c6 100644 --- a/litex/soc/tools/remote/comm_uart.py +++ b/litex/soc/tools/remote/comm_uart.py @@ -55,9 +55,14 @@ class CommUART: def write(self, addr, data): data = data if isinstance(data, list) else [data] length = len(data) - self._write([self.msg_type["write"], length]) - self._write(list((addr//4).to_bytes(4, byteorder="big"))) - for i, value in enumerate(data): - self._write(list(value.to_bytes(4, byteorder="big"))) - if self.debug: - print("write {:08x} @ {:08x}".format(value, addr + 4*i)) + offset = 0 + while length: + size = min(length, 8) + self._write([self.msg_type["write"], size]) + self._write(list(((addr+offset)//4).to_bytes(4, byteorder="big"))) + for i, value in enumerate(data[offset:offset+size]): + self._write(list(value.to_bytes(4, byteorder="big"))) + if self.debug: + print("write {:08x} @ {:08x}".format(value, addr + offset, 4*i)) + offset += size + length -= size