Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test_bulk_rx_basic_short #379

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions tests/test_bulk_rx_basic_short.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2016-2023 XMOS LIMITED.
# This Software is subject to the terms of the XMOS Public Licence: Version 1.
import pytest

from conftest import PARAMS, test_RunUsbSession # noqa F401
from usb_session import UsbSession
from usb_transaction import UsbTransaction


@pytest.fixture
def test_session(ep, address, bus_speed):

start_length = 0
end_length = 11
interEventDelay = 100

session = UsbSession(
bus_speed=bus_speed, run_enumeration=False, device_address=address
)

for pktLength in range(start_length, end_length):
session.add_event(
UsbTransaction(
session,
deviceAddress=address,
endpointNumber=ep,
endpointType="BULK",
transType="OUT",
dataLength=pktLength,
interEventDelay=interEventDelay,
)
)

return session
3 changes: 3 additions & 0 deletions tests/test_bulk_rx_basic_short/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
TEST_FLAGS = -DXUD_BYPASS_RESET=1

include ../test_makefile.mak
33 changes: 33 additions & 0 deletions tests/test_bulk_rx_basic_short/src/test.xc
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright 2016-2023 XMOS LIMITED.
// This Software is subject to the terms of the XMOS Public Licence: Version 1.

#define EP_COUNT_OUT (6)
#define EP_COUNT_IN (6)

#ifndef PKT_LENGTH_START
#define PKT_LENGTH_START (0)
#endif

#ifndef PKT_LENGTH_END
#define PKT_LENGTH_END (10)
#endif

#include "xud_shared.h"

XUD_EpType epTypeTableOut[EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL};
XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL};

unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN])
{
unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END);

/* Give some time for XUD to respond before we shutdown */
timer t;
unsigned time;
t when timerafter(time+1000000) :> void;

return fail;
}

#include "test_main.xc"