mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-31 05:52:55 +08:00
Add testcase for EP0 stall recovery to USBTMC test script.
This commit is contained in:
parent
e5f38e3e86
commit
1e193212d7
@ -1,9 +1,10 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import visa
|
||||
import time
|
||||
import sys
|
||||
|
||||
|
||||
|
||||
def test_idn():
|
||||
idn = inst.query("*idn?");
|
||||
assert (idn == "TinyUSB,ModelNumber,SerialNumber,FirmwareVer123456\r\n")
|
||||
@ -129,6 +130,18 @@ def test_multi_read():
|
||||
assert (x + "\r\n" == y)
|
||||
#inst.chunk_size = old_chunk_size
|
||||
|
||||
def test_stall_ep0():
|
||||
usb_iface = inst.get_visa_attribute(visa.constants.VI_ATTR_USB_INTFC_NUM)
|
||||
inst.read_stb()
|
||||
# This is an invalid request, should create stall.
|
||||
try:
|
||||
retv = inst.control_in(request_type_bitmap_field=0xA1, request_id=60, request_value=0x0000, index=usb_iface, length=0x0001)
|
||||
assert false
|
||||
except visa.VisaIOError:
|
||||
pass
|
||||
|
||||
assert (inst.read_stb() == 0)
|
||||
|
||||
|
||||
rm = visa.ResourceManager("/c/Windows/system32/visa64.dll")
|
||||
reslist = rm.list_resources("USB?::?*::INSTR")
|
||||
@ -171,6 +184,9 @@ test_echo(165,170)
|
||||
print("+ Read timeout (no MAV)")
|
||||
test_read_timeout()
|
||||
|
||||
print("+ Test EP0 stall recovery")
|
||||
test_stall_ep0()
|
||||
|
||||
print("+ MAV")
|
||||
test_mav()
|
||||
|
||||
|
@ -418,7 +418,7 @@ static uint16_t dcd_ep_ctr_handler(void)
|
||||
uint8_t userMemBuf[8];
|
||||
/* Get SETUP Packet*/
|
||||
count = pcd_get_ep_rx_cnt(USB, EPindex);
|
||||
if(count == 8) // Setup packet should always be 8 bits. If not, ignore it, and try again.
|
||||
if(count == 8) // Setup packet should always be 8 bytes. If not, ignore it, and try again.
|
||||
{
|
||||
// Must reset EP to NAK (in case it had been stalling) (though, maybe too late here)
|
||||
pcd_set_ep_rx_status(USB,0u,USB_EP_RX_NAK);
|
||||
|
Loading…
x
Reference in New Issue
Block a user