From f193873bb8cfdc52e073c5a64568d1beaf8487f3 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Mon, 30 May 2016 16:16:05 +0200 Subject: [PATCH] soc/tools/remove/comm_uart: limit write bursts to 8 32bits words --- litex/soc/tools/remote/comm_uart.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/litex/soc/tools/remote/comm_uart.py b/litex/soc/tools/remote/comm_uart.py index 10fa37e8d..b6a8f1c6e 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