From b1dee774cdb9c98248dca2e7a93d7cb2183c9bac Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Sun, 22 Feb 2015 15:23:55 +0100 Subject: [PATCH] tty working --- liteeth/generic/packetizer.py | 2 +- test/config.py | 6 +++--- test/test_tty.py | 20 ++++++++++---------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/liteeth/generic/packetizer.py b/liteeth/generic/packetizer.py index d15b8515b..418da8146 100644 --- a/liteeth/generic/packetizer.py +++ b/liteeth/generic/packetizer.py @@ -67,7 +67,7 @@ class LiteEthPacketizer(Module): fsm.act("SEND_HEADER", source.stb.eq(1), source.sop.eq(0), - source.eop.eq(sink.eop & (counter.value == header_words-2)), + source.eop.eq(0), source.data.eq(header_reg[dw:2*dw]), If(source.stb & source.ack, shift.eq(1), diff --git a/test/config.py b/test/config.py index 60687bf3c..fc4a2f6ec 100644 --- a/test/config.py +++ b/test/config.py @@ -1,5 +1,5 @@ -use_uart = 0 -use_eth = 1 +use_uart = 1 +use_eth = 0 csr_csv_file = "./csr.csv" busword = 32 @@ -7,7 +7,7 @@ debug_wb = False if use_uart: from litescope.host.driver.uart import LiteScopeUARTDriver - wb = LiteScopeUART2WBDriver(2, 921600, csr_csv_file, busword, debug_wb) + wb = LiteScopeUARTDriver(2, 921600, csr_csv_file, busword, debug_wb) if use_eth: from litescope.host.driver.etherbone import LiteScopeEtherboneDriver diff --git a/test/test_tty.py b/test/test_tty.py index af0e5d087..132b72f04 100644 --- a/test/test_tty.py +++ b/test/test_tty.py @@ -1,20 +1,20 @@ import socket import threading -test_message = "LiteEth virtual TTY Hello world" - def test(fpga_ip, udp_port, test_message): tx_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) rx_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) rx_sock.bind(("", udp_port)) + rx_sock.settimeout(0.5) def receive(): - data, addr = rx_sock.recvfrom(8192) - rx_packet = [] - for byte in data: - rx_packet.append(int(byte)) - for e in rx_packet: - print(chr(e)) + while True: + try: + msg = rx_sock.recv(8192) + for byte in msg: + print(chr(byte), end="") + except: + break def send(): tx_sock.sendto(bytes(test_message, "utf-8"), (fpga_ip, udp_port)) @@ -26,8 +26,8 @@ def test(fpga_ip, udp_port, test_message): send_thread.start() try: - send_thread.join(10) - receive_thread.join(0.1) + send_thread.join(5) + send_thread.join(5) except KeyboardInterrupt: pass