tty working
This commit is contained in:
parent
2fa28c1b5d
commit
b1dee774cd
|
@ -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),
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue