From 22aa678c5f158acfbd30a520382d949cb34af0e1 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 13 Jun 2019 14:09:59 +0100 Subject: [PATCH 001/520] Removed GetDone exit method/hack --- lib_xud/src/core/XUD_GetDone.c | 13 ------------- lib_xud/src/core/XUD_Main.xc | 25 ++++--------------------- 2 files changed, 4 insertions(+), 34 deletions(-) delete mode 100644 lib_xud/src/core/XUD_GetDone.c diff --git a/lib_xud/src/core/XUD_GetDone.c b/lib_xud/src/core/XUD_GetDone.c deleted file mode 100644 index de44078e..00000000 --- a/lib_xud/src/core/XUD_GetDone.c +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) 2015-2018, XMOS Ltd, All rights reserved -/** @file XUD_GetDone.c - * @author Matt Fyles, XMOS Limited - * @version 1v0 - */ - -extern int XUD_USB_Done; - -int XUD_GetDone() { - return XUD_USB_Done; -} - - diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index 4448e145..0123d391 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -58,8 +58,6 @@ extern tileref USB_TILE_REF; #error USB_MAX_NUM_EP_OUT must be 16! #endif -extern int XUD_GetDone(); - void XUD_UserSuspend(); void XUD_UserResume(); void XUD_PhyReset_User(); @@ -343,14 +341,11 @@ void XUD_UIFM_PwrSigFlags() int epStatFlagTableIn[USB_MAX_NUM_EP_IN]; int epStatFlagTableOut[USB_MAX_NUM_EP_OUT]; -/* Used for terminating XUD loop */ -int XUD_USB_Done = 0; - //extern void SetupChannelVectorsOverride(XUD_chan chans[]); //extern void SetupChannelVectors(XUD_chan chans[], int countOut, int countIn); -extern int XUD_LLD_IoLoop( +extern unsigned XUD_LLD_IoLoop( #if defined(ARCH_S) || defined(ARCH_X200) in buffered port:32 rxd_port, #else @@ -411,9 +406,6 @@ static void SendResetToEps(XUD_chan c[], XUD_chan epChans[], XUD_EpType epTypeTa XUD_Sup_outct(c[i + USB_MAX_NUM_EP_OUT], token); } } - - if (XUD_GetDone()) - return; } static void SendSpeed(XUD_chan c[], XUD_EpType epTypeTableOut[], XUD_EpType epTypeTableIn[], int nOut, int nIn, int speed) @@ -443,8 +435,6 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c const int reset_time = RESET_TIME; #endif - XUD_USB_Done = 0; - /* Make sure ports are on and reset port states */ set_port_use_on(p_usb_clk); #if !defined(ARCH_S) && !defined(ARCH_X200) @@ -519,7 +509,9 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c configure_in_port_strobed_slave(p_usb_rxd, rx_rdy, rx_usb_clk); #endif - while(!XUD_GetDone()) + unsigned noExit = 1; + + while(noExit) { #if !defined(ARCH_S) && !defined(ARCH_X200) p_usb_rxd <: 0; // Note, this is important else phy clocks in invalid data before UIFM is enabled causing @@ -726,13 +718,6 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c #ifdef ARCH_G XUD_SetCrcTableAddr(0); #endif - - /* Check for exit */ - if (XUD_GetDone()) - { - break; - } - /* Reset the OUT ep structures */ for(int i = 0; i< noEpOut; i++) { @@ -936,8 +921,6 @@ int XUD_Main(chanend c_ep_out[], int noEpOut, g_desSpeed = speed; - XUD_USB_Done = 0; - for (int i=0; i < USB_MAX_NUM_EP;i++) { epChans[i] = 0; From e627f0cbd2fcec3338bf184c34f77dd86ac0d4fc Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 13 Jun 2019 14:28:33 +0100 Subject: [PATCH 002/520] Added kill code to XUD, tidied ASM return code, removed dead code --- lib_xud/api/xud.h | 4 +-- lib_xud/src/core/XUD_IoLoop.S | 39 ++++++++--------------- lib_xud/src/core/XUD_Main.xc | 6 +++- lib_xud/src/core/included/XUD_Token_Out.S | 4 +-- 4 files changed, 22 insertions(+), 31 deletions(-) diff --git a/lib_xud/api/xud.h b/lib_xud/api/xud.h index bb6a50a6..27744b60 100644 --- a/lib_xud/api/xud.h +++ b/lib_xud/api/xud.h @@ -228,8 +228,8 @@ typedef enum XUD_Result * Valid values are XUD_PWR_SELF and XUD_PWR_BUS. * */ -int XUD_Main(/*tileref * unsafe usbtileXUD_res_t &xudres, */ chanend c_epOut[], int noEpOut, - +int XUD_Main(/*tileref * unsafe usbtileXUD_res_t &xudres, */ + chanend c_epOut[], int noEpOut, chanend c_epIn[], int noEpIn, NULLABLE_RESOURCE(chanend, c_sof), XUD_EpType epTypeTableOut[], XUD_EpType epTypeTableIn[], diff --git a/lib_xud/src/core/XUD_IoLoop.S b/lib_xud/src/core/XUD_IoLoop.S index e0213c1f..ac98f5e8 100755 --- a/lib_xud/src/core/XUD_IoLoop.S +++ b/lib_xud/src/core/XUD_IoLoop.S @@ -61,11 +61,6 @@ suspend_t_wtwrsths: #define SP_REGREAD (STACK_EXTEND + 10) #define SP_REGWRITE (STACK_EXTEND + 11) - - - - - #ifndef XUD_TEST_MODE_SUPPORT_DISABLED ////////////////////////////////////////////////////////////////////////// // void UsbTestModeHandler() @@ -86,8 +81,12 @@ UsbTestModeHandler_asm: in r0, res[r11] chkct res[r11], XS1_CT_END outct res[r11], XS1_CT_END -// in r0, res[r11] - retsp 0 + + bf r0, Return // Speical case for Exit + + bl XUD_UsbTestModeHandler + + retsp 0 .cc_bottom UsbTestModeHandler_asm.func #endif @@ -160,18 +159,8 @@ ResetIntHandler: ldw r11, sp[15] // Put RxE back to events.. setc res[r11], XS1_SETC_IE_MODE_EVENT // Set IE mode back to events - -ResetDetect: - ldc r0, 0 // Return 0 for reset - bu writesuspendvar - - -SuspendDetect: - ldc r0, 1 - -writesuspendvar: - //stw r0, dp[suspend] - bu Return // Return 1 for suspend + ldc r0, 1 // Load non-zero (zero is kill) + bu Return .cc_bottom ResetIntHandler.func @@ -257,7 +246,7 @@ TxHandShakeTimer: // Used for timeout waitin stw r10, sp[8] // Save timer resource ID to the stack #endif - +#if 0 SetupOutTimer: getr r10, XS1_RES_TYPE_TIMER ecallf r10 @@ -267,6 +256,7 @@ SetupOutTimer: setc res[r10], XS1_SETC_COND_AFTER stw r10, sp[9] +#endif #ifndef XUD_TEST_MODE_SUPPORT_DISABLED SetupUsbTestMode: @@ -274,7 +264,7 @@ SetupUsbTestMode: ldaw r9, dp[epChans0] ldw r10, r9[0] // Load channel 0 - ldap r11, XUD_UsbTestModeHandler + ldap r11, UsbTestModeHandler_asm setc res[r10], XS1_SETC_IE_MODE_INTERRUPT setv res[r10], r11 eeu res[r10] @@ -471,11 +461,8 @@ XUD_InvalidTok_waitforRXALow: .align 4 Return: - //ldw r11, sp[8] # Free timers - //freer res[r11] - ldw r11, sp[9] - freer res[r11] - ldw r11, sp[14] + ldw r11, sp[14] // Free suspend/reset timer + edu res[r11] freer res[r11] ldw r4, sp[1] # Register restore diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index 0123d391..939c77d6 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -836,7 +836,7 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c flag0: Valid token flag flag1: Rx Active flag2: Rx Error */ - XUD_LLD_IoLoop(p_usb_rxd, flag1_port, p_usb_txd, flag2_port, flag0_port, reg_read_port, + noExit = XUD_LLD_IoLoop(p_usb_rxd, flag1_port, p_usb_txd, flag2_port, flag0_port, reg_read_port, reg_write_port, 0, epTypeTableOut, epTypeTableIn, epChans, noEpOut, c_sof); set_thread_fast_mode_off(); @@ -855,6 +855,10 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c XUD_UIFM_RegWrite(reg_write_port, UIFM_REG_CTRL, UIFM_CTRL_DECODE_LS); #endif #endif + + if(!noExit) + break; + } diff --git a/lib_xud/src/core/included/XUD_Token_Out.S b/lib_xud/src/core/included/XUD_Token_Out.S index 028e7870..4ab61d1f 100755 --- a/lib_xud/src/core/included/XUD_Token_Out.S +++ b/lib_xud/src/core/included/XUD_Token_Out.S @@ -150,10 +150,10 @@ PrimaryBufferFull_NoNak: bu NextToken // Timedout waiting for data after OUT... go back to waiting for tokens -OutDataTimeOut: +//OutDataTimeOut: //clre //bl ERR_OutDataTimeout - bu NextToken + //bu NextToken From 7c7104be55f461f5005efa157ec526e1398a9fdf Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 13 Jun 2019 14:29:09 +0100 Subject: [PATCH 003/520] Fixed build of test_bulk_rx_basic and added XUD kill --- tests/test_bulk_rx_basic/Makefile | 2 +- tests/test_bulk_rx_basic/src/main.xc | 25 +++++++++++++------------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/tests/test_bulk_rx_basic/Makefile b/tests/test_bulk_rx_basic/Makefile index 83edfc42..4319e1c8 100644 --- a/tests/test_bulk_rx_basic/Makefile +++ b/tests/test_bulk_rx_basic/Makefile @@ -20,7 +20,7 @@ APP_NAME = SHARED_CODE = ../../shared_src -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L +COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L -Wno-timing XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES diff --git a/tests/test_bulk_rx_basic/src/main.xc b/tests/test_bulk_rx_basic/src/main.xc index c49255bf..b8a8e778 100644 --- a/tests/test_bulk_rx_basic/src/main.xc +++ b/tests/test_bulk_rx_basic/src/main.xc @@ -25,13 +25,14 @@ XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -int TestEp_Bulk(chanend c_out, chanend c_in, int epNum) +int TestEp_Bulk(chanend c_out[XUD_EP_COUNT_OUT], chanend c_in[XUD_EP_COUNT_IN], int epNum) { unsigned int length; XUD_Result_t res; - XUD_ep ep_out = XUD_InitEp(c_out); - XUD_ep ep_in = XUD_InitEp(c_in); + XUD_ep ep_out_0 = XUD_InitEp(c_out[0]); + XUD_ep ep_out = XUD_InitEp(c_out[epNum]); + XUD_ep ep_in = XUD_InitEp(c_in[epNum]); /* Buffer for Setup data */ unsigned char buffer[1024]; @@ -46,15 +47,17 @@ int TestEp_Bulk(chanend c_out, chanend c_in, int epNum) fail(FAIL_RX_LENERROR); } - unsafe{ - if(RxDataCheck(buffer, length, epNum)) + unsafe { - fail(FAIL_RX_DATAERROR); + if(RxDataCheck(buffer, length, epNum)) + { + fail(FAIL_RX_DATAERROR); + } } - } - } + + XUD_SetTestMode(ep_out_0, 0); exit(0); } @@ -63,17 +66,15 @@ int TestEp_Bulk(chanend c_out, chanend c_in, int epNum) int main() { chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - chan c_sync; - chan c_sync_iso; par { - XUD_Manager( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); - TestEp_Bulk(c_ep_out[1], c_ep_in[1], 1); + TestEp_Bulk(c_ep_out, c_ep_in, 1); } return 0; From 2497386acb3c12933e2a9995beb4e08a54324036 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 13 Jun 2019 14:29:23 +0100 Subject: [PATCH 004/520] Re-instated XUD tests in runtests.py --- tests/runtests.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/runtests.py b/tests/runtests.py index 30bd86cd..05c526d2 100644 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -20,10 +20,10 @@ helpers.args = xmostest.init(argparser) - # xmostest.register_group("lib_xud", - # "xud_sim_tests", - # "XUD simulator tests", - # """ + xmostest.register_group("lib_xud", + "xud_sim_tests", + "XUD simulator tests", + """ #Tests are performed by running the GPIO library connected to a simulator model #(written as a python plugin to xsim). The simulator model checks that the pins #are driven and read by the ports as expected. Tests are run to test the @@ -40,6 +40,6 @@ # * Outputting with timestamps #""") #''' - # xmostest.runtests() + xmostest.runtests() xmostest.finish() From 1387d47e0610d7d12664976fd696c3e0c9b8feaf Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 13 Jun 2019 14:29:48 +0100 Subject: [PATCH 005/520] Build fixes to (currently unused) __app_test --- __app_test/Makefile | 4 ++-- __app_test/main.xc | 2 +- tests/shared_src/shared.h | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/__app_test/Makefile b/__app_test/Makefile index 43f28994..900f5799 100644 --- a/__app_test/Makefile +++ b/__app_test/Makefile @@ -5,7 +5,7 @@ # This example runs on the XS-L1 usb audio board. It doesn't use any of # the audio functionality and just uses the USB functionality of the board -TARGET = usb_audio_s1 +TARGET = XCORE-200-EXPLORER # The APP_NAME variable determines the name of the final .xe file. It should # not include the .xe postfix. If left blank the name will default to @@ -26,7 +26,7 @@ XCC_FLAGS = -Wall -O3 -report -fsubword-select -DUSB_CORE=0 -DGLX -DTEST_MODE_SU # The USED_MODULES variable lists other module used by the application. -USED_MODULES = module_usb_shared module_xud +USED_MODULES = lib_xud MODULE_LIBRARIES = xud_u_sim diff --git a/__app_test/main.xc b/__app_test/main.xc index 69c857d4..1efc6c4a 100644 --- a/__app_test/main.xc +++ b/__app_test/main.xc @@ -11,7 +11,7 @@ #include #include "xud.h" #include "platform.h" -#include "test.h" +//#include "test.h" #include "xc_ptr.h" #define XUD_EP_COUNT_OUT 5 diff --git a/tests/shared_src/shared.h b/tests/shared_src/shared.h index 4726d3e0..3f8b64c5 100644 --- a/tests/shared_src/shared.h +++ b/tests/shared_src/shared.h @@ -34,6 +34,8 @@ XUD_Result_t SendTxPacket(XUD_ep ep, int length, int epNum) return XUD_SetBuffer(ep, buffer, length); } +#if 0 +// NEW API - WIP #pragma unsafe arrays XUD_Result_t SendControlPacket(XUD_ep ep, int length, int epNum) { @@ -46,7 +48,7 @@ XUD_Result_t SendControlPacket(XUD_ep ep, int length, int epNum) return XUD_SetControlBuffer(ep, buffer, length); } - +#endif #pragma unsafe arrays From 89004a32921cf397d4ee88a3f3483d75cf1e590d Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 13 Jun 2019 15:43:39 +0100 Subject: [PATCH 006/520] Added XUD_Kill() function to terminate XUD core from EP core --- lib_xud/api/xud.h | 6 ++++++ lib_xud/src/user/client/XUD_EpFunctions.xc | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/lib_xud/api/xud.h b/lib_xud/api/xud.h index 27744b60..8a283578 100644 --- a/lib_xud/api/xud.h +++ b/lib_xud/api/xud.h @@ -405,6 +405,12 @@ void XUD_ResetEpStateByAddr(unsigned epNum); */ void XUD_SetTestMode(XUD_ep ep, unsigned testMode); +/** + * \brief Terminate XUD core + * \param ep XUD_ep type (must be endpoint 0 in or out) + * \warning Must be run on same tile as XUD core + */ +void XUD_Kill(XUD_ep ep); /********************************************************************************************** * Below are prototypes for main assembly functions for data transfer to/from USB I/O thread diff --git a/lib_xud/src/user/client/XUD_EpFunctions.xc b/lib_xud/src/user/client/XUD_EpFunctions.xc index 1e249efb..4045324e 100644 --- a/lib_xud/src/user/client/XUD_EpFunctions.xc +++ b/lib_xud/src/user/client/XUD_EpFunctions.xc @@ -32,6 +32,11 @@ XUD_Result_t XUD_SetBuffer(XUD_ep c, unsigned char buffer[], unsigned datalength return XUD_SetData(c, buffer, datalength, 0, 0); } +void XUD_Kill(XUD_ep ep) +{ + XUD_SetTestMode(ep, 0); +} + XUD_Result_t XUD_SetBuffer_EpMax(XUD_ep ep_in, unsigned char buffer[], unsigned datalength, unsigned epMax) { int i = 0; From f2fff9d5c14173ff55c1a5c71ee79fbd759a25fd Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 13 Jun 2019 15:43:54 +0100 Subject: [PATCH 007/520] Fixes to test_bulk_loopback --- tests/test_bulk_loopback/Makefile | 2 +- tests/test_bulk_loopback/src/main.xc | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/test_bulk_loopback/Makefile b/tests/test_bulk_loopback/Makefile index 83edfc42..4319e1c8 100644 --- a/tests/test_bulk_loopback/Makefile +++ b/tests/test_bulk_loopback/Makefile @@ -20,7 +20,7 @@ APP_NAME = SHARED_CODE = ../../shared_src -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L +COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L -Wno-timing XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES diff --git a/tests/test_bulk_loopback/src/main.xc b/tests/test_bulk_loopback/src/main.xc index ed77a505..a6edb1e3 100644 --- a/tests/test_bulk_loopback/src/main.xc +++ b/tests/test_bulk_loopback/src/main.xc @@ -47,12 +47,13 @@ int TestEp_Bulk(chanend c_out1, chanend c_in1) /* Loopback packet and terminate */ #pragma unsafe arrays -int TestEp_Bulk2(chanend c_out, chanend c_in) +int TestEp_Bulk2(chanend c_out, chanend c_in, chanend c_out_0) { unsigned int length; XUD_Result_t res; XUD_ep ep_out = XUD_InitEp(c_out); + XUD_ep ep_out_0 = XUD_InitEp(c_out_0); XUD_ep ep_in = XUD_InitEp(c_in); /* Buffer for Setup data */ @@ -61,6 +62,8 @@ int TestEp_Bulk2(chanend c_out, chanend c_in) XUD_GetBuffer(ep_out, buffer, length); XUD_SetBuffer(ep_in, buffer, length); + + XUD_Kill(ep_out_0); exit(0); } @@ -79,7 +82,7 @@ int main() null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); TestEp_Bulk(c_ep_out[3], c_ep_in[3]); - TestEp_Bulk2(c_ep_out[2], c_ep_in[2]); + TestEp_Bulk2(c_ep_out[2], c_ep_in[2], c_ep_out[0]); } return 0; From a8a0f7ff0c0709699016c45f671955acc2bc3ce7 Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 14 Jun 2019 11:33:21 +0100 Subject: [PATCH 008/520] Fixes to test_bulk_rx_basic_badcrc32 --- tests/test_bulk_rx_basic_badcrc32/Makefile | 2 +- tests/test_bulk_rx_basic_badcrc32/src/main.xc | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/test_bulk_rx_basic_badcrc32/Makefile b/tests/test_bulk_rx_basic_badcrc32/Makefile index 83edfc42..4319e1c8 100644 --- a/tests/test_bulk_rx_basic_badcrc32/Makefile +++ b/tests/test_bulk_rx_basic_badcrc32/Makefile @@ -20,7 +20,7 @@ APP_NAME = SHARED_CODE = ../../shared_src -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L +COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L -Wno-timing XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES diff --git a/tests/test_bulk_rx_basic_badcrc32/src/main.xc b/tests/test_bulk_rx_basic_badcrc32/src/main.xc index db5a361e..dffb9c48 100644 --- a/tests/test_bulk_rx_basic_badcrc32/src/main.xc +++ b/tests/test_bulk_rx_basic_badcrc32/src/main.xc @@ -11,14 +11,13 @@ #include #include "xud.h" #include "platform.h" -//#include "test.h" #include "xc_ptr.h" -//#error - #define XUD_EP_COUNT_OUT 5 #define XUD_EP_COUNT_IN 5 +#define TEST_EP_NUM (1) + //extern xc_ptr char_array_to_xc_ptr(const unsigned char a[]); /* Endpoint type tables */ @@ -109,11 +108,13 @@ int RxDataCheck(unsigned char b[], int l, int epNum) return 0; } -int TestEp_Bulk(chanend c_out, chanend c_in, int epNum) + +int TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_out_0) { unsigned int length; XUD_Result_t res; + XUD_ep ep_out_0 = XUD_InitEp(c_out_0); XUD_ep ep_out = XUD_InitEp(c_out); XUD_ep ep_in = XUD_InitEp(c_in); @@ -145,6 +146,7 @@ int TestEp_Bulk(chanend c_out, chanend c_in, int epNum) } + XUD_Kill(ep_out_0); exit(0); } @@ -153,8 +155,6 @@ int TestEp_Bulk(chanend c_out, chanend c_in, int epNum) int main() { chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - chan c_sync; - chan c_sync_iso; //p_rxDataCheck = char_array_to_xc_ptr(g_rxDataCheck); //p_txDataCheck = char_array_to_xc_ptr(g_txDataCheck); @@ -163,13 +163,13 @@ int main() par { - XUD_Manager( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); //TestEp_Control(c_ep_out[0], c_ep_in[0], 0); - TestEp_Bulk(c_ep_out[1], c_ep_in[1], 1); + TestEp_Bulk(c_ep_out[TEST_EP_NUM], c_ep_in[TEST_EP_NUM], TEST_EP_NUM, c_ep_out[0]); } return 0; From ff66a6092d6086685901ece46016090aa17a1e53 Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 14 Jun 2019 11:44:19 +0100 Subject: [PATCH 009/520] Fixes to test_bulk_rx_basic_badpid --- tests/test_bulk_rx_basic_badpid/Makefile | 2 +- tests/test_bulk_rx_basic_badpid/src/main.xc | 59 +++------------------ 2 files changed, 8 insertions(+), 53 deletions(-) diff --git a/tests/test_bulk_rx_basic_badpid/Makefile b/tests/test_bulk_rx_basic_badpid/Makefile index 83edfc42..4319e1c8 100644 --- a/tests/test_bulk_rx_basic_badpid/Makefile +++ b/tests/test_bulk_rx_basic_badpid/Makefile @@ -20,7 +20,7 @@ APP_NAME = SHARED_CODE = ../../shared_src -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L +COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L -Wno-timing XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES diff --git a/tests/test_bulk_rx_basic_badpid/src/main.xc b/tests/test_bulk_rx_basic_badpid/src/main.xc index e3b55b2e..6a8388d2 100644 --- a/tests/test_bulk_rx_basic_badpid/src/main.xc +++ b/tests/test_bulk_rx_basic_badpid/src/main.xc @@ -11,14 +11,14 @@ #include #include "xud.h" #include "platform.h" -//#include "test.h" #include "xc_ptr.h" -//#error #define XUD_EP_COUNT_OUT 5 #define XUD_EP_COUNT_IN 5 +#define TEST_EP_NUMBER (1) + //extern xc_ptr char_array_to_xc_ptr(const unsigned char a[]); /* Endpoint type tables */ @@ -58,47 +58,12 @@ unsigned char g_rxDataCheck[5] = {0, 0, 0, 0, 0}; unsigned char g_txDataCheck[5] = {0,0,0,0,0,}; unsigned g_txLength[5] = {0,0,0,0,0}; - -#pragma unsafe arrays -void SendTxPacket(XUD_ep ep, int length, int epNum) -{ - unsigned char buffer[1024]; - unsigned char x; - - for (int i = 0; i < length; i++) - { - buffer[i] = g_txDataCheck[epNum]++; - - //asm("ld8u %0, %1[%2]":"=r"(x):"r"(g_txDataCheck),"r"(epNum)); - // read_byte_via_xc_ptr_indexed(x, p_txDataCheck, epNum); - - //buffer[i] = x; - //x++; - //asm("st8 %0, %1[%2]"::"r"(x),"r"(g_txDataCheck),"r"(epNum)); - //write_byte_via_xc_ptr_indexed(p_txDataCheck,epNum,x); - } - - XUD_SetBuffer(ep, buffer, length); -} - - - - - -//xc_ptr p_rxDataCheck; -//xc_ptr p_txDataCheck; -//xc_ptr p_txLength; - #pragma unsafe arrays int RxDataCheck(unsigned char b[], int l, int epNum) { - int fail = 0; - unsigned char x; - for (int i = 0; i < l; i++) { unsigned char y; - //read_byte_via_xc_ptr_indexed(y, p_rxDataCheck, epNum); if(b[i] != g_rxDataCheck[epNum]) { printstr("#### Mismatch on EP: "); @@ -107,24 +72,21 @@ int RxDataCheck(unsigned char b[], int l, int epNum) printhex(b[i]); printstr(" Expected:"); printhexln(g_rxDataCheck[epNum]); - //printintln(l); // Packet length return 1; } g_rxDataCheck[epNum]++; - //read_byte_via_xc_ptr_indexed(x, p_rxDataCheck, epNum); - //x++; - //write_byte_via_xc_ptr_indexed(p_rxDataCheck,epNum,x); } return 0; } -int TestEp_Bulk(chanend c_out, chanend c_in, int epNum) +int TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_out_0) { unsigned int length; XUD_Result_t res; + XUD_ep ep_out_0 = XUD_InitEp(c_out_0); XUD_ep ep_out = XUD_InitEp(c_out); XUD_ep ep_in = XUD_InitEp(c_in); @@ -148,31 +110,24 @@ int TestEp_Bulk(chanend c_out, chanend c_in, int epNum) } + XUD_Kill(ep_out_0); exit(0); } -#define USB_CORE 0 int main() { chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - chan c_sync; - chan c_sync_iso; - - //p_rxDataCheck = char_array_to_xc_ptr(g_rxDataCheck); - //p_txDataCheck = char_array_to_xc_ptr(g_txDataCheck); - //p_txLength = array_to_xc_ptr(g_txLength); par { - XUD_Manager( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); - //TestEp_Control(c_ep_out[0], c_ep_in[0], 0); - TestEp_Bulk(c_ep_out[1], c_ep_in[1], 1); + TestEp_Bulk(c_ep_out[TEST_EP_NUMBER], c_ep_in[TEST_EP_NUMBER], TEST_EP_NUMBER, c_ep_out[0]); } return 0; From bdf84c0e37c3577f06d1f89920e5419e49f463e4 Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 14 Jun 2019 16:23:30 +0100 Subject: [PATCH 010/520] More test fixes and tidy ups --- tests/shared_src/shared.h | 94 +++++++--- tests/test_bulk_rx_basic/src/main.xc | 42 +---- tests/test_bulk_rx_fastpacket/Makefile | 2 +- tests/test_bulk_rx_fastpacket/src/main.xc | 66 +------ .../test_bulk_rx_fastpacket_multiep/Makefile | 2 +- .../src/main.xc | 10 +- tests/test_bulk_tx_basic/Makefile | 2 +- tests/test_bulk_tx_basic/src/main.xc | 21 +-- tests/test_bulk_tx_basic_noack/Makefile | 2 +- tests/test_bulk_tx_basic_noack/src/main.xc | 16 +- tests/test_bulk_tx_fastpacket/Makefile | 2 +- tests/test_bulk_tx_fastpacket/src/main.xc | 20 +-- .../test_bulk_tx_fastpacket_multiep/Makefile | 2 +- .../src/main.xc | 2 +- tests/test_control_basic_badcrc32/src/main.xc | 38 +--- tests/test_invalidtoken/Makefile | 2 +- tests/test_invalidtoken/src/main.xc | 48 +---- tests/test_iso_loopback/Makefile | 2 +- tests/test_iso_loopback/src/main.xc | 14 +- tests/test_iso_rx_basic/Makefile | 2 +- tests/test_iso_rx_basic/src/main.xc | 124 +------------ tests/test_iso_rxtx_fastpacket.py | 2 +- tests/test_iso_rxtx_fastpacket/Makefile | 2 +- tests/test_iso_rxtx_fastpacket/src/main.xc | 166 ++---------------- tests/test_iso_tx_basic/Makefile | 2 +- tests/test_iso_tx_basic/src/main.xc | 59 ++----- tests/test_ping_rx_basic/Makefile | 2 +- tests/test_ping_rx_basic/src/main.xc | 137 +++------------ 28 files changed, 179 insertions(+), 704 deletions(-) diff --git a/tests/shared_src/shared.h b/tests/shared_src/shared.h index 3f8b64c5..0168694c 100644 --- a/tests/shared_src/shared.h +++ b/tests/shared_src/shared.h @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2016-2019, XMOS Ltd, All rights reserved unsigned char g_rxDataCheck[7] = {0, 0, 0, 0, 0, 0, 0}; unsigned char g_txDataCheck[5] = {0,0,0,0,0,}; @@ -20,6 +20,14 @@ void exit(int); #define INITIAL_PKT_LENGTH 10 #endif +#define XUD_Manager XUD_Main + +typedef enum t_runMode +{ + RUNMODE_LOOP, + RUNMODE_DIE +} t_runMode; + #pragma unsafe arrays XUD_Result_t SendTxPacket(XUD_ep ep, int length, int epNum) @@ -52,16 +60,17 @@ XUD_Result_t SendControlPacket(XUD_ep ep, int length, int epNum) #pragma unsafe arrays -int TestEp_Bulk_Tx(chanend c_in1, int epNum1, int die) +int TestEp_Tx(chanend c_in[], int epNum1, unsigned start, unsigned end, t_runMode runMode) { - XUD_ep ep_in1 = XUD_InitEp(c_in1); + XUD_ep ep_in = XUD_InitEp(c_in[epNum1]); unsigned char buffer[PKT_COUNT][1024]; int counter = 0; - int length = INITIAL_PKT_LENGTH; + int length = start; - for(int i = 0; i< PKT_COUNT; i++) + /* Prepare packets */ + for(int i = 0; i <= (end-start); i++) { for(int j = 0; j < length; j++) { @@ -70,23 +79,20 @@ int TestEp_Bulk_Tx(chanend c_in1, int epNum1, int die) length++; } - length = INITIAL_PKT_LENGTH; - #pragma loop unroll - for(int i = 0; i < PKT_COUNT; i++) + length = start; + for(int i = 0; i <= (end - start); i++) { - XUD_SetBuffer(ep_in1, buffer[i], length++); + XUD_SetBuffer(ep_in, buffer[i], length++); } - - if(die) - exit(0); + if(runMode == RUNMODE_DIE) + return 0; else while(1); } - #define FAIL_RX_DATAERROR 0 #define FAIL_RX_LENERROR 1 #define FAIL_RX_EXPECTED_CTL 2 @@ -118,58 +124,88 @@ unsigned fail(int x) } #pragma unsafe arrays -unsafe int RxDataCheck(unsigned char b[], int l, int epNum) +int RxDataCheck(unsigned char b[], int l, int epNum) { for (int i = 0; i < l; i++) { unsigned char y; //read_byte_via_xc_ptr_indexed(y, p_rxDataCheck, epNum); - if(b[i] != g_rxDataCheck_[epNum]) + if(b[i] != g_rxDataCheck[epNum]) { - printstr("#### Mismatch on EP.. \n"); - //printint(epNum); - //printstr(". Got:"); - //printhex(b[i]); - //printstr(" Expected:"); - //printhexln(g_rxDataCheck[epNum]); + printstr("#### Mismatch on EP: "); + printint(epNum); + printstr(". Got:"); + printhex(b[i]); + printstr(" Expected:"); + printhexln(g_rxDataCheck[epNum]); //printintln(l); // Packet length - printf("### Mismatch on EP: %d. Got %d, Expected %d\n", epNum, b[i], g_rxDataCheck[epNum]); return 1; - } - g_rxDataCheck_[epNum]++; + g_rxDataCheck[epNum]++; } return 0; } #pragma unsafe arrays -int TestEp_Bulk_Rx(chanend c_out1, int epNum1) +int TestEp_Rx(chanend c_out[], int epNum, int start, int end) { // TODO check rx lengths unsigned int length[PKT_COUNT]; //XUD_Result_t res; - XUD_ep ep_out1 = XUD_InitEp(c_out1); + XUD_ep ep_out1 = XUD_InitEp(c_out[epNum]); /* Buffer for Setup data */ unsigned char buffer[PKT_COUNT][1024]; /* Receive a bunch of packets quickly, then check them */ #pragma loop unroll - for(int i = 0; i < PKT_COUNT; i++) + for(int i = 0; i <= (end-start); i++) { XUD_GetBuffer(ep_out1, buffer[i], length[i]); } #pragma loop unroll - for(int i = 0; i < PKT_COUNT; i++) + for(int i = 0; i <= (end-start); i++) { unsafe { - RxDataCheck(buffer[i], length[i], epNum1); + RxDataCheck(buffer[i], length[i], epNum); } } +} + +#if 0 +int TestEp_Rx(chanend c_out[], int epNum, unsigned start, unsigned end) +{ + unsigned int length; + XUD_Result_t res; + + XUD_ep ep_out_0 = XUD_InitEp(c_out[0]); + XUD_ep ep_out = XUD_InitEp(c_out[epNum]); + /* Buffer for Setup data */ + unsigned char buffer[1024]; + + for(int i = start; i <= end; i++) + { + XUD_GetBuffer(ep_out, buffer, length); + + if(length != i) + { + printintln(length); + fail(FAIL_RX_LENERROR); + } + + if(RxDataCheck(buffer, length, epNum)) + { + fail(FAIL_RX_DATAERROR); + } + + } + + XUD_Kill(ep_out_0); exit(0); } +#endif diff --git a/tests/test_bulk_rx_basic/src/main.xc b/tests/test_bulk_rx_basic/src/main.xc index b8a8e778..1bb675f2 100644 --- a/tests/test_bulk_rx_basic/src/main.xc +++ b/tests/test_bulk_rx_basic/src/main.xc @@ -24,45 +24,6 @@ XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; - -int TestEp_Bulk(chanend c_out[XUD_EP_COUNT_OUT], chanend c_in[XUD_EP_COUNT_IN], int epNum) -{ - unsigned int length; - XUD_Result_t res; - - XUD_ep ep_out_0 = XUD_InitEp(c_out[0]); - XUD_ep ep_out = XUD_InitEp(c_out[epNum]); - XUD_ep ep_in = XUD_InitEp(c_in[epNum]); - - /* Buffer for Setup data */ - unsigned char buffer[1024]; - - for(int i = 10; i <= 14; i++) - { - XUD_GetBuffer(ep_out, buffer, length); - - if(length != i) - { - printintln(length); - fail(FAIL_RX_LENERROR); - } - - unsafe - { - if(RxDataCheck(buffer, length, epNum)) - { - fail(FAIL_RX_DATAERROR); - } - } - } - - - XUD_SetTestMode(ep_out_0, 0); - exit(0); -} - - -#define USB_CORE 0 int main() { chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; @@ -74,7 +35,8 @@ int main() null, epTypeTableOut, epTypeTableIn, null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); - TestEp_Bulk(c_ep_out, c_ep_in, 1); + TestEp_Rx(c_ep_out, c_ep_in, 1, 10, 14); + } return 0; diff --git a/tests/test_bulk_rx_fastpacket/Makefile b/tests/test_bulk_rx_fastpacket/Makefile index 83edfc42..4319e1c8 100644 --- a/tests/test_bulk_rx_fastpacket/Makefile +++ b/tests/test_bulk_rx_fastpacket/Makefile @@ -20,7 +20,7 @@ APP_NAME = SHARED_CODE = ../../shared_src -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L +COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L -Wno-timing XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES diff --git a/tests/test_bulk_rx_fastpacket/src/main.xc b/tests/test_bulk_rx_fastpacket/src/main.xc index 96bf2510..579cf0a0 100644 --- a/tests/test_bulk_rx_fastpacket/src/main.xc +++ b/tests/test_bulk_rx_fastpacket/src/main.xc @@ -30,6 +30,8 @@ void exit(int); #define PKT_COUNT 10 #define INITIAL_PKT_LENGTH 10 +#define TEST_EP_NUMBER (3) + unsigned fail(int x) { @@ -50,32 +52,6 @@ unsigned fail(int x) } unsigned char g_rxDataCheck[5] = {0, 0, 0, 0, 0}; -unsigned char g_txDataCheck[5] = {0,0,0,0,0,}; -unsigned g_txLength[5] = {0,0,0,0,0}; - - -#pragma unsafe arrays -void SendTxPacket(XUD_ep ep, int length, int epNum) -{ - unsigned char buffer[1024]; - unsigned char x; - - for (int i = 0; i < length; i++) - { - buffer[i] = g_txDataCheck[epNum]++; - - //asm("ld8u %0, %1[%2]":"=r"(x):"r"(g_txDataCheck),"r"(epNum)); - // read_byte_via_xc_ptr_indexed(x, p_txDataCheck, epNum); - - //buffer[i] = x; - //x++; - //asm("st8 %0, %1[%2]"::"r"(x),"r"(g_txDataCheck),"r"(epNum)); - //write_byte_via_xc_ptr_indexed(p_txDataCheck,epNum,x); - } - - XUD_SetBuffer(ep, buffer, length); -} - #pragma unsafe arrays int RxDataCheck(unsigned char b[], int l, int epNum) @@ -86,7 +62,6 @@ int RxDataCheck(unsigned char b[], int l, int epNum) for (int i = 0; i < l; i++) { unsigned char y; - //read_byte_via_xc_ptr_indexed(y, p_rxDataCheck, epNum); if(b[i] != g_rxDataCheck[epNum]) { printstr("#### Mismatch on EP: "); @@ -95,42 +70,17 @@ int RxDataCheck(unsigned char b[], int l, int epNum) printhex(b[i]); printstr(" Expected:"); printhexln(g_rxDataCheck[epNum]); - //printintln(l); // Packet length return 1; } g_rxDataCheck[epNum]++; - //read_byte_via_xc_ptr_indexed(x, p_rxDataCheck, epNum); - //x++; - //write_byte_via_xc_ptr_indexed(p_rxDataCheck,epNum,x); } return 0; } - #pragma unsafe arrays -int TestEp_Bulk_Tx(chanend c_in1, int epNum1) -{ - XUD_ep ep_in1 = XUD_InitEp(c_in1); - - unsigned char buffer[PKT_COUNT][1024]; - - int counter = 0; - - for(int i = 0; i< PKT_COUNT; i++) - { - //for(int j = 0; j < lengths[i]; j++) - { - // buffer[i] = counter++; - } - } - -} - - -#pragma unsafe arrays -int TestEp_Bulk_Rx(chanend c_out1, int epNum1) +int TestEp_Bulk_Rx(chanend c_out1, int epNum1, chanend c_out_0) { // TODO check rx lengths @@ -139,6 +89,7 @@ int TestEp_Bulk_Rx(chanend c_out1, int epNum1) XUD_Result_t res; XUD_ep ep_out1 = XUD_InitEp(c_out1); + XUD_ep ep_out_0 = XUD_InitEp(c_out_0); /* Buffer for Setup data */ unsigned char buffer[PKT_COUNT][1024]; @@ -163,18 +114,15 @@ int TestEp_Bulk_Rx(chanend c_out1, int epNum1) int main() { chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - chan c_sync; - chan c_sync_iso; - + par { - XUD_Manager( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); - TestEp_Bulk_Rx(c_ep_out[3], 3); - //TestEp_Bulk_Tx(c_ep_in[3], 3); + TestEp_Bulk_Rx(c_ep_out[TEST_EP_NUMBER], TEST_EP_NUMBER, c_ep_out[0]); } return 0; diff --git a/tests/test_bulk_rx_fastpacket_multiep/Makefile b/tests/test_bulk_rx_fastpacket_multiep/Makefile index 83edfc42..4319e1c8 100644 --- a/tests/test_bulk_rx_fastpacket_multiep/Makefile +++ b/tests/test_bulk_rx_fastpacket_multiep/Makefile @@ -20,7 +20,7 @@ APP_NAME = SHARED_CODE = ../../shared_src -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L +COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L -Wno-timing XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES diff --git a/tests/test_bulk_rx_fastpacket_multiep/src/main.xc b/tests/test_bulk_rx_fastpacket_multiep/src/main.xc index ecff59a1..c4d52cbf 100644 --- a/tests/test_bulk_rx_fastpacket_multiep/src/main.xc +++ b/tests/test_bulk_rx_fastpacket_multiep/src/main.xc @@ -17,6 +17,7 @@ #define XUD_EP_COUNT_OUT 7 #define XUD_EP_COUNT_IN 1 + /* Endpoint type tables */ XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL}; @@ -29,7 +30,7 @@ int main() par { - XUD_Manager( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); @@ -37,7 +38,12 @@ int main() TestEp_Bulk_Rx(c_ep_out[3], 3); TestEp_Bulk_Rx(c_ep_out[4], 4); TestEp_Bulk_Rx(c_ep_out[5], 5); - TestEp_Bulk_Rx(c_ep_out[6], 6); + { + XUD_ep ep_out_0 = XUD_InitEp(c_ep_out[0]); + TestEp_Bulk_Rx(c_ep_out[6], 6); + XUD_Kill(ep_out_0); + exit(0); + } } return 0; diff --git a/tests/test_bulk_tx_basic/Makefile b/tests/test_bulk_tx_basic/Makefile index 83edfc42..4319e1c8 100644 --- a/tests/test_bulk_tx_basic/Makefile +++ b/tests/test_bulk_tx_basic/Makefile @@ -20,7 +20,7 @@ APP_NAME = SHARED_CODE = ../../shared_src -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L +COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L -Wno-timing XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES diff --git a/tests/test_bulk_tx_basic/src/main.xc b/tests/test_bulk_tx_basic/src/main.xc index d04106f6..7b9149aa 100644 --- a/tests/test_bulk_tx_basic/src/main.xc +++ b/tests/test_bulk_tx_basic/src/main.xc @@ -66,11 +66,9 @@ void SendTxPacket(XUD_ep ep, int length, int epNum) XUD_SetBuffer(ep, buffer, length); } -int TestEp_Bulk(chanend c_out, chanend c_in, int epNum) +int TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_out_0) { - unsigned int length; - XUD_Result_t res; - + XUD_ep ep_out_0 = XUD_InitEp(c_out_0); XUD_ep ep_out = XUD_InitEp(c_out); XUD_ep ep_in = XUD_InitEp(c_in); @@ -82,31 +80,24 @@ int TestEp_Bulk(chanend c_out, chanend c_in, int epNum) SendTxPacket(ep_in, i, epNum); } + + XUD_Kill(ep_out_0); exit(0); } -#define USB_CORE 0 int main() { chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - chan c_sync; - chan c_sync_iso; - - //p_rxDataCheck = char_array_to_xc_ptr(g_rxDataCheck); - //p_txDataCheck = char_array_to_xc_ptr(g_txDataCheck); - //p_txLength = array_to_xc_ptr(g_txLength); par { - XUD_Manager( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); - //TestEp_Control(c_ep_out[0], c_ep_in[0], 0); - - TestEp_Bulk(c_ep_out[2], c_ep_in[2], 1); + TestEp_Bulk(c_ep_out[2], c_ep_in[2], 1, c_ep_out[0]); } return 0; diff --git a/tests/test_bulk_tx_basic_noack/Makefile b/tests/test_bulk_tx_basic_noack/Makefile index 83edfc42..4319e1c8 100644 --- a/tests/test_bulk_tx_basic_noack/Makefile +++ b/tests/test_bulk_tx_basic_noack/Makefile @@ -20,7 +20,7 @@ APP_NAME = SHARED_CODE = ../../shared_src -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L +COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L -Wno-timing XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES diff --git a/tests/test_bulk_tx_basic_noack/src/main.xc b/tests/test_bulk_tx_basic_noack/src/main.xc index d04106f6..0adf6bdc 100644 --- a/tests/test_bulk_tx_basic_noack/src/main.xc +++ b/tests/test_bulk_tx_basic_noack/src/main.xc @@ -66,11 +66,9 @@ void SendTxPacket(XUD_ep ep, int length, int epNum) XUD_SetBuffer(ep, buffer, length); } -int TestEp_Bulk(chanend c_out, chanend c_in, int epNum) +int TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_out_0) { - unsigned int length; - XUD_Result_t res; - + XUD_ep ep_out_0 = XUD_InitEp(c_out_0); XUD_ep ep_out = XUD_InitEp(c_out); XUD_ep ep_in = XUD_InitEp(c_in); @@ -82,6 +80,7 @@ int TestEp_Bulk(chanend c_out, chanend c_in, int epNum) SendTxPacket(ep_in, i, epNum); } + XUD_Kill(ep_out_0); exit(0); } @@ -93,20 +92,15 @@ int main() chan c_sync; chan c_sync_iso; - //p_rxDataCheck = char_array_to_xc_ptr(g_rxDataCheck); - //p_txDataCheck = char_array_to_xc_ptr(g_txDataCheck); - //p_txLength = array_to_xc_ptr(g_txLength); - par { - XUD_Manager( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); - //TestEp_Control(c_ep_out[0], c_ep_in[0], 0); - TestEp_Bulk(c_ep_out[2], c_ep_in[2], 1); + TestEp_Bulk(c_ep_out[2], c_ep_in[2], 1, c_ep_out[0]); } return 0; diff --git a/tests/test_bulk_tx_fastpacket/Makefile b/tests/test_bulk_tx_fastpacket/Makefile index 83edfc42..4319e1c8 100644 --- a/tests/test_bulk_tx_fastpacket/Makefile +++ b/tests/test_bulk_tx_fastpacket/Makefile @@ -20,7 +20,7 @@ APP_NAME = SHARED_CODE = ../../shared_src -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L +COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L -Wno-timing XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES diff --git a/tests/test_bulk_tx_fastpacket/src/main.xc b/tests/test_bulk_tx_fastpacket/src/main.xc index 53a3126e..7906875e 100644 --- a/tests/test_bulk_tx_fastpacket/src/main.xc +++ b/tests/test_bulk_tx_fastpacket/src/main.xc @@ -1,4 +1,4 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2016-2019, XMOS Ltd, All rights reserved /* * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent * in both directions between the ports. @@ -63,22 +63,15 @@ void SendTxPacket(XUD_ep ep, int length, int epNum) for (int i = 0; i < length; i++) { buffer[i] = g_txDataCheck[epNum]++; - - //asm("ld8u %0, %1[%2]":"=r"(x):"r"(g_txDataCheck),"r"(epNum)); - // read_byte_via_xc_ptr_indexed(x, p_txDataCheck, epNum); - - //buffer[i] = x; - //x++; - //asm("st8 %0, %1[%2]"::"r"(x),"r"(g_txDataCheck),"r"(epNum)); - //write_byte_via_xc_ptr_indexed(p_txDataCheck,epNum,x); } XUD_SetBuffer(ep, buffer, length); } #pragma unsafe arrays -int TestEp_Bulk_Tx(chanend c_in1, int epNum1) +int TestEp_Bulk_Tx(chanend c_in1, int epNum1, chanend c_out_0) { + XUD_ep ep_out_0 = XUD_InitEp(c_out_0); XUD_ep ep_in1 = XUD_InitEp(c_in1); unsigned char buffer[PKT_COUNT][1024]; @@ -103,6 +96,7 @@ int TestEp_Bulk_Tx(chanend c_in1, int epNum1) XUD_SetBuffer(ep_in1, buffer[i], length++); } + XUD_Kill(ep_out_0); exit(0); } @@ -113,17 +107,15 @@ int TestEp_Bulk_Tx(chanend c_in1, int epNum1) int main() { chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - chan c_sync; - chan c_sync_iso; par { - XUD_Manager( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); - TestEp_Bulk_Tx(c_ep_in[3], 3); + TestEp_Bulk_Tx(c_ep_in[3], 3, c_ep_out[0]); } return 0; diff --git a/tests/test_bulk_tx_fastpacket_multiep/Makefile b/tests/test_bulk_tx_fastpacket_multiep/Makefile index 83edfc42..4319e1c8 100644 --- a/tests/test_bulk_tx_fastpacket_multiep/Makefile +++ b/tests/test_bulk_tx_fastpacket_multiep/Makefile @@ -20,7 +20,7 @@ APP_NAME = SHARED_CODE = ../../shared_src -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L +COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L -Wno-timing XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES diff --git a/tests/test_bulk_tx_fastpacket_multiep/src/main.xc b/tests/test_bulk_tx_fastpacket_multiep/src/main.xc index 51360f33..13976d8c 100644 --- a/tests/test_bulk_tx_fastpacket_multiep/src/main.xc +++ b/tests/test_bulk_tx_fastpacket_multiep/src/main.xc @@ -23,7 +23,7 @@ int main() par { - XUD_Manager( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); diff --git a/tests/test_control_basic_badcrc32/src/main.xc b/tests/test_control_basic_badcrc32/src/main.xc index 9cf33947..b12e5388 100644 --- a/tests/test_control_basic_badcrc32/src/main.xc +++ b/tests/test_control_basic_badcrc32/src/main.xc @@ -11,15 +11,11 @@ #include #include "xud.h" #include "platform.h" -//#include "test.h" #include "xc_ptr.h" -//#error - #define XUD_EP_COUNT_OUT 5 #define XUD_EP_COUNT_IN 5 -//extern xc_ptr char_array_to_xc_ptr(const unsigned char a[]); /* Endpoint type tables */ XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, @@ -29,12 +25,6 @@ XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL}; XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -/* USB Port declarations */ -//on stdcore[0]: out port p_usb_rst = XS1_PORT_1A; -//on stdcore[0]: clock clk = XS1_CLKBLK_3; - -//on stdcore[0] : out port p_test = XS1_PORT_1I; - void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend ?c_usb_test); void exit(int); @@ -66,32 +56,15 @@ unsigned g_txLength[5] = {0,0,0,0,0}; void SendTxPacket(XUD_ep ep, int length, int epNum) { unsigned char buffer[1024]; - unsigned char x; for (int i = 0; i < length; i++) { buffer[i] = g_txDataCheck[epNum]++; - - //asm("ld8u %0, %1[%2]":"=r"(x):"r"(g_txDataCheck),"r"(epNum)); - // read_byte_via_xc_ptr_indexed(x, p_txDataCheck, epNum); - - //buffer[i] = x; - //x++; - //asm("st8 %0, %1[%2]"::"r"(x),"r"(g_txDataCheck),"r"(epNum)); - //write_byte_via_xc_ptr_indexed(p_txDataCheck,epNum,x); } XUD_SetBuffer(ep, buffer, length); } - - - - -//xc_ptr p_rxDataCheck; -//xc_ptr p_txDataCheck; -//xc_ptr p_txLength; - #pragma unsafe arrays int RxDataCheck(unsigned char b[], int l, int epNum) { @@ -115,9 +88,6 @@ int RxDataCheck(unsigned char b[], int l, int epNum) } g_rxDataCheck[epNum]++; - //read_byte_via_xc_ptr_indexed(x, p_rxDataCheck, epNum); - //x++; - //write_byte_via_xc_ptr_indexed(p_rxDataCheck,epNum,x); } return 0; @@ -217,17 +187,11 @@ int TestEp_Control(chanend c_out, chanend c_in, int epNum) int main() { chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - chan c_sync; - chan c_sync_iso; - - //p_rxDataCheck = char_array_to_xc_ptr(g_rxDataCheck); - //p_txDataCheck = char_array_to_xc_ptr(g_txDataCheck); - //p_txLength = array_to_xc_ptr(g_txLength); par { - XUD_Manager( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); diff --git a/tests/test_invalidtoken/Makefile b/tests/test_invalidtoken/Makefile index 83edfc42..4319e1c8 100644 --- a/tests/test_invalidtoken/Makefile +++ b/tests/test_invalidtoken/Makefile @@ -20,7 +20,7 @@ APP_NAME = SHARED_CODE = ../../shared_src -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L +COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L -Wno-timing XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES diff --git a/tests/test_invalidtoken/src/main.xc b/tests/test_invalidtoken/src/main.xc index e3b55b2e..ea66931c 100644 --- a/tests/test_invalidtoken/src/main.xc +++ b/tests/test_invalidtoken/src/main.xc @@ -59,36 +59,6 @@ unsigned char g_txDataCheck[5] = {0,0,0,0,0,}; unsigned g_txLength[5] = {0,0,0,0,0}; -#pragma unsafe arrays -void SendTxPacket(XUD_ep ep, int length, int epNum) -{ - unsigned char buffer[1024]; - unsigned char x; - - for (int i = 0; i < length; i++) - { - buffer[i] = g_txDataCheck[epNum]++; - - //asm("ld8u %0, %1[%2]":"=r"(x):"r"(g_txDataCheck),"r"(epNum)); - // read_byte_via_xc_ptr_indexed(x, p_txDataCheck, epNum); - - //buffer[i] = x; - //x++; - //asm("st8 %0, %1[%2]"::"r"(x),"r"(g_txDataCheck),"r"(epNum)); - //write_byte_via_xc_ptr_indexed(p_txDataCheck,epNum,x); - } - - XUD_SetBuffer(ep, buffer, length); -} - - - - - -//xc_ptr p_rxDataCheck; -//xc_ptr p_txDataCheck; -//xc_ptr p_txLength; - #pragma unsafe arrays int RxDataCheck(unsigned char b[], int l, int epNum) { @@ -112,19 +82,17 @@ int RxDataCheck(unsigned char b[], int l, int epNum) } g_rxDataCheck[epNum]++; - //read_byte_via_xc_ptr_indexed(x, p_rxDataCheck, epNum); - //x++; - //write_byte_via_xc_ptr_indexed(p_rxDataCheck,epNum,x); } return 0; } -int TestEp_Bulk(chanend c_out, chanend c_in, int epNum) +int TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_out_0) { unsigned int length; XUD_Result_t res; + XUD_ep ep_out_0 = XUD_InitEp(c_out_0); XUD_ep ep_out = XUD_InitEp(c_out); XUD_ep ep_in = XUD_InitEp(c_in); @@ -148,6 +116,7 @@ int TestEp_Bulk(chanend c_out, chanend c_in, int epNum) } + XUD_Kill(ep_out_0); exit(0); } @@ -156,23 +125,16 @@ int TestEp_Bulk(chanend c_out, chanend c_in, int epNum) int main() { chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - chan c_sync; - chan c_sync_iso; - - //p_rxDataCheck = char_array_to_xc_ptr(g_rxDataCheck); - //p_txDataCheck = char_array_to_xc_ptr(g_txDataCheck); - //p_txLength = array_to_xc_ptr(g_txLength); par { - XUD_Manager( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); - //TestEp_Control(c_ep_out[0], c_ep_in[0], 0); - TestEp_Bulk(c_ep_out[1], c_ep_in[1], 1); + TestEp_Bulk(c_ep_out[1], c_ep_in[1], 1, c_ep_out[0]); } return 0; diff --git a/tests/test_iso_loopback/Makefile b/tests/test_iso_loopback/Makefile index 83edfc42..4319e1c8 100644 --- a/tests/test_iso_loopback/Makefile +++ b/tests/test_iso_loopback/Makefile @@ -20,7 +20,7 @@ APP_NAME = SHARED_CODE = ../../shared_src -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L +COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L -Wno-timing XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES diff --git a/tests/test_iso_loopback/src/main.xc b/tests/test_iso_loopback/src/main.xc index f81f5500..4c06c0f3 100644 --- a/tests/test_iso_loopback/src/main.xc +++ b/tests/test_iso_loopback/src/main.xc @@ -27,7 +27,7 @@ void exit(int); /* Loopback packets forever */ #pragma unsafe arrays -int TestEp_Bulk(chanend c_out1, chanend c_in1) +int TestEp_LoopbackForever(chanend c_out1, chanend c_in1) { unsigned int length; XUD_Result_t res; @@ -50,11 +50,12 @@ int TestEp_Bulk(chanend c_out1, chanend c_in1) /* Loopback packet and terminate */ #pragma unsafe arrays -int TestEp_Bulk2(chanend c_out, chanend c_in) +int TestEp_LoopbackOnce(chanend c_out, chanend c_in, chanend c_out_0) { unsigned int length; XUD_Result_t res; + XUD_ep ep_out_0 = XUD_InitEp(c_out_0); XUD_ep ep_out = XUD_InitEp(c_out); XUD_ep ep_in = XUD_InitEp(c_in); @@ -64,6 +65,7 @@ int TestEp_Bulk2(chanend c_out, chanend c_in) XUD_GetBuffer(ep_out, buffer, length); XUD_SetBuffer(ep_in, buffer, length); + XUD_Kill(ep_out_0); exit(0); } @@ -71,18 +73,16 @@ int TestEp_Bulk2(chanend c_out, chanend c_in) int main() { chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - chan c_sync; - chan c_sync_iso; par { - XUD_Manager( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); - TestEp_Bulk(c_ep_out[3], c_ep_in[3]); - TestEp_Bulk2(c_ep_out[2], c_ep_in[2]); + TestEp_LoopbackForever(c_ep_out[3], c_ep_in[3]); + TestEp_LoopbackOnce(c_ep_out[2], c_ep_in[2], c_ep_out[0]); } return 0; diff --git a/tests/test_iso_rx_basic/Makefile b/tests/test_iso_rx_basic/Makefile index 83edfc42..4319e1c8 100644 --- a/tests/test_iso_rx_basic/Makefile +++ b/tests/test_iso_rx_basic/Makefile @@ -20,7 +20,7 @@ APP_NAME = SHARED_CODE = ../../shared_src -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L +COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L -Wno-timing XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES diff --git a/tests/test_iso_rx_basic/src/main.xc b/tests/test_iso_rx_basic/src/main.xc index fc1b52b8..1331e793 100644 --- a/tests/test_iso_rx_basic/src/main.xc +++ b/tests/test_iso_rx_basic/src/main.xc @@ -5,6 +5,7 @@ #include "xud.h" #include "platform.h" #include "xc_ptr.h" +#include "shared.h" #define XUD_EP_COUNT_OUT 5 #define XUD_EP_COUNT_IN 5 @@ -15,137 +16,18 @@ XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, X XUD_EPTYPE_BUL}; XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend ?c_usb_test); - -void exit(int); - -#define FAIL_RX_DATAERROR 0 -#define FAIL_RX_LENERROR 1 - -unsigned fail(int x) -{ - - printstr("\nXCORE: ### FAIL ******"); - switch(x) - { - case FAIL_RX_DATAERROR: - printstr("XCORE RX Data Error\n"); - break; - - case FAIL_RX_LENERROR: - printstr("XCORE RX Length Error\n"); - break; - - } - - exit(1); -} - -unsigned char g_rxDataCheck[5] = {0, 0, 0, 0, 0}; -unsigned char g_txDataCheck[5] = {0,0,0,0,0,}; -unsigned g_txLength[5] = {0,0,0,0,0}; - - -#pragma unsafe arrays -void SendTxPacket(XUD_ep ep, int length, int epNum) -{ - unsigned char buffer[1024]; - unsigned char x; - - for (int i = 0; i < length; i++) - { - buffer[i] = g_txDataCheck[epNum]++; - - //asm("ld8u %0, %1[%2]":"=r"(x):"r"(g_txDataCheck),"r"(epNum)); - // read_byte_via_xc_ptr_indexed(x, p_txDataCheck, epNum); - - //buffer[i] = x; - //x++; - //asm("st8 %0, %1[%2]"::"r"(x),"r"(g_txDataCheck),"r"(epNum)); - //write_byte_via_xc_ptr_indexed(p_txDataCheck,epNum,x); - } - - XUD_SetBuffer(ep, buffer, length); -} - -#pragma unsafe arrays -int RxDataCheck(unsigned char b[], int l, int epNum) -{ - int fail = 0; - unsigned char x; - - for (int i = 0; i < l; i++) - { - unsigned char y; - //read_byte_via_xc_ptr_indexed(y, p_rxDataCheck, epNum); - if(b[i] != g_rxDataCheck[epNum]) - { - printstr("#### Mismatch on EP: "); - printint(epNum); - printstr(". Got:"); - printhex(b[i]); - printstr(" Expected:"); - printhexln(g_rxDataCheck[epNum]); - //printintln(l); // Packet length - return 1; - } - - g_rxDataCheck[epNum]++; - //read_byte_via_xc_ptr_indexed(x, p_rxDataCheck, epNum); - //x++; - //write_byte_via_xc_ptr_indexed(p_rxDataCheck,epNum,x); - } - - return 0; -} - -int TestEp(chanend c_out, chanend c_in, int epNum) -{ - unsigned int length; - XUD_Result_t res; - - XUD_ep ep_out = XUD_InitEp(c_out); - XUD_ep ep_in = XUD_InitEp(c_in); - - /* Buffer for Setup data */ - unsigned char buffer[1024]; - - for(int i = 10; i <= 14; i++) - { - XUD_GetBuffer(ep_out, buffer, length); - - if(length != i) - { - printintln(length); - fail(FAIL_RX_LENERROR); - } - - if(RxDataCheck(buffer, length, epNum)) - { - fail(FAIL_RX_DATAERROR); - } - - } - - exit(0); -} - - -#define USB_CORE 0 int main() { chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - chan c_sync; - chan c_sync_iso; par { - XUD_Manager( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); - TestEp(c_ep_out[2], c_ep_in[2], 2); + TestEp_Rx(c_ep_out, c_ep_in, 2, 10, 14); } return 0; diff --git a/tests/test_iso_rxtx_fastpacket.py b/tests/test_iso_rxtx_fastpacket.py index c687e6cc..b214d940 100644 --- a/tests/test_iso_rxtx_fastpacket.py +++ b/tests/test_iso_rxtx_fastpacket.py @@ -22,7 +22,7 @@ def do_test(arch, clk, phy, seed): for pkt_length in range(10, 20): # < 17 fails - AppendOutToken(packets, ep, inter_pkt_gap=17) + AppendOutToken(packets, ep, inter_pkt_gap=20) packets.append(TxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) #DATA0 AppendInToken(packets, ep, inter_pkt_gap=37) diff --git a/tests/test_iso_rxtx_fastpacket/Makefile b/tests/test_iso_rxtx_fastpacket/Makefile index 83edfc42..4319e1c8 100644 --- a/tests/test_iso_rxtx_fastpacket/Makefile +++ b/tests/test_iso_rxtx_fastpacket/Makefile @@ -20,7 +20,7 @@ APP_NAME = SHARED_CODE = ../../shared_src -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L +COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L -Wno-timing XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES diff --git a/tests/test_iso_rxtx_fastpacket/src/main.xc b/tests/test_iso_rxtx_fastpacket/src/main.xc index 451abce9..835c671b 100644 --- a/tests/test_iso_rxtx_fastpacket/src/main.xc +++ b/tests/test_iso_rxtx_fastpacket/src/main.xc @@ -13,168 +13,28 @@ #include "platform.h" #include "xc_ptr.h" +#include "shared.h" + #define XUD_EP_COUNT_OUT 5 #define XUD_EP_COUNT_IN 5 -/* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL}; - -void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend ?c_usb_test); - -void exit(int); - -#define FAIL_RX_DATAERROR 0 -#define FAIL_RX_LENERROR 1 - -#define PKT_COUNT 10 -#define INITIAL_PKT_LENGTH 10 - -unsigned fail(int x) -{ - - printstr("\nXCORE: ### FAIL ******"); - switch(x) - { - case FAIL_RX_DATAERROR: - printstr("XCORE RX Data Error\n"); - break; - - case FAIL_RX_LENERROR: - printstr("XCORE RX Length Error\n"); - break; - - } - - exit(1); -} - -unsigned char g_rxDataCheck[5] = {0, 0, 0, 0, 0}; -unsigned char g_txDataCheck[5] = {0,0,0,0,0,}; -unsigned g_txLength[5] = {0,0,0,0,0}; - - -#pragma unsafe arrays -void SendTxPacket(XUD_ep ep, int length, int epNum) -{ - unsigned char buffer[1024]; - unsigned char x; - - for (int i = 0; i < length; i++) - { - buffer[i] = g_txDataCheck[epNum]++; - - //asm("ld8u %0, %1[%2]":"=r"(x):"r"(g_txDataCheck),"r"(epNum)); - // read_byte_via_xc_ptr_indexed(x, p_txDataCheck, epNum); - - //buffer[i] = x; - //x++; - //asm("st8 %0, %1[%2]"::"r"(x),"r"(g_txDataCheck),"r"(epNum)); - //write_byte_via_xc_ptr_indexed(p_txDataCheck,epNum,x); - } - - XUD_SetBuffer(ep, buffer, length); -} - - -#pragma unsafe arrays -int RxDataCheck(unsigned char b[], int l, int epNum) -{ - int fail = 0; - unsigned char x; - - for (int i = 0; i < l; i++) - { - unsigned char y; - //read_byte_via_xc_ptr_indexed(y, p_rxDataCheck, epNum); - if(b[i] != g_rxDataCheck[epNum]) - { - printstr("#### Mismatch on EP: "); - printint(epNum); - printstr(". Got:"); - printhex(b[i]); - printstr(" Expected:"); - printhexln(g_rxDataCheck[epNum]); - //printintln(l); // Packet length - return 1; - } - - g_rxDataCheck[epNum]++; - //read_byte_via_xc_ptr_indexed(x, p_rxDataCheck, epNum); - //x++; - //write_byte_via_xc_ptr_indexed(p_rxDataCheck,epNum,x); - } - - return 0; -} - - -#pragma unsafe arrays -int TestEp_Bulk_Tx(chanend c_in1, int epNum1) -{ - XUD_ep ep_in1 = XUD_InitEp(c_in1); - - unsigned char buffer[PKT_COUNT][1024]; - - int counter = 0; - int length = INITIAL_PKT_LENGTH; - - for(int i = 0; i< PKT_COUNT; i++) - { - for(int j = 0; j < length; j++) - { - buffer[i][j] = counter++; - } - length++; - } - - length = INITIAL_PKT_LENGTH; - -#pragma loop unroll - for(int i = 0; i < PKT_COUNT; i++) - { - XUD_SetBuffer(ep_in1, buffer[i], length++); - } - - exit(0); - -} -#pragma unsafe arrays -int TestEp_Bulk_Rx(chanend c_out1, int epNum1) -{ - // TODO check rx lengths - - unsigned int length[PKT_COUNT]; - XUD_Result_t res; - - XUD_ep ep_out1 = XUD_InitEp(c_out1); - - /* Buffer for Setup data */ - unsigned char buffer[PKT_COUNT][1024]; +#ifndef PKT_LENGTH_START +#define PKT_LENGTH_START 10 +#endif - /* Receive a bunch of packets quickly, then check them */ -#pragma loop unroll - for(int i = 0; i < PKT_COUNT; i++) - { - XUD_GetBuffer(ep_out1, buffer[i], length[i]); - } -#pragma loop unroll - for(int i = 0; i < PKT_COUNT; i++) - { - RxDataCheck(buffer[i], length[i], epNum1); - } +#ifndef PKT_LENGTH_END +#define PKT_LENGTH_END 20 +#endif - while(1); -} +/* Endpoint type tables */ +XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL}; +XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL}; -#define USB_CORE 0 int main() { chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - chan c_sync; - chan c_sync_iso; par { @@ -183,8 +43,8 @@ int main() null, epTypeTableOut, epTypeTableIn, null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); - TestEp_Bulk_Tx(c_ep_in[3], 3); - TestEp_Bulk_Rx(c_ep_out[3], 3); + TestEp_Tx(c_ep_in, 3, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_DIE); + TestEp_Rx(c_ep_out, 3, PKT_LENGTH_START, PKT_LENGTH_END); } return 0; diff --git a/tests/test_iso_tx_basic/Makefile b/tests/test_iso_tx_basic/Makefile index 83edfc42..4319e1c8 100644 --- a/tests/test_iso_tx_basic/Makefile +++ b/tests/test_iso_tx_basic/Makefile @@ -20,7 +20,7 @@ APP_NAME = SHARED_CODE = ../../shared_src -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L +COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L -Wno-timing XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES diff --git a/tests/test_iso_tx_basic/src/main.xc b/tests/test_iso_tx_basic/src/main.xc index 9a661085..fa3aa16a 100644 --- a/tests/test_iso_tx_basic/src/main.xc +++ b/tests/test_iso_tx_basic/src/main.xc @@ -11,12 +11,12 @@ #include #include "xud.h" #include "platform.h" -#include "xc_ptr.h" +#include "shared.h" + #define XUD_EP_COUNT_OUT 4 #define XUD_EP_COUNT_IN 4 - /* Endpoint type tables */ XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, @@ -27,51 +27,6 @@ XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO}; -void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend ?c_usb_test); - -void exit(int); - - -unsigned char g_rxDataCheck[5] = {0, 0, 0, 0, 0}; -unsigned char g_txDataCheck[5] = {0,0,0,0,0,}; -unsigned g_txLength[5] = {0,0,0,0,0}; - - -#pragma unsafe arrays -void SendTxPacket(XUD_ep ep, int length, int epNum) -{ - unsigned char buffer[1024]; - unsigned char x; - - for (int i = 0; i < length; i++) - { - buffer[i] = g_txDataCheck[epNum]++; - } - - XUD_SetBuffer(ep, buffer, length); -} - -int TestEp(chanend c_out, chanend c_in, int epNum) -{ - unsigned int length; - XUD_Result_t res; - - XUD_ep ep_out = XUD_InitEp(c_out); - XUD_ep ep_in = XUD_InitEp(c_in); - - /* Buffer for Setup data */ - unsigned char buffer[1024]; - - for(int i = 10; i <= 14; i++) - { - SendTxPacket(ep_in, i, epNum); - } - - exit(0); -} - - -#define USB_CORE 0 int main() { chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; @@ -79,10 +34,16 @@ int main() par { - XUD_Manager( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); - TestEp(c_ep_out[3], c_ep_in[3], 1); + + { + TestEp_Tx(c_ep_in, 3, 10, 14, RUNMODE_DIE); + XUD_ep ep_out_0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep_out_0); + exit(0); + } } return 0; diff --git a/tests/test_ping_rx_basic/Makefile b/tests/test_ping_rx_basic/Makefile index 83edfc42..4319e1c8 100644 --- a/tests/test_ping_rx_basic/Makefile +++ b/tests/test_ping_rx_basic/Makefile @@ -20,7 +20,7 @@ APP_NAME = SHARED_CODE = ../../shared_src -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L +COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L -Wno-timing XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES diff --git a/tests/test_ping_rx_basic/src/main.xc b/tests/test_ping_rx_basic/src/main.xc index 30c05196..f256f8df 100644 --- a/tests/test_ping_rx_basic/src/main.xc +++ b/tests/test_ping_rx_basic/src/main.xc @@ -13,6 +13,8 @@ #include "platform.h" #include "xc_ptr.h" +#include "shared.h" + #define XUD_EP_COUNT_OUT 5 #define XUD_EP_COUNT_IN 5 @@ -20,99 +22,13 @@ XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend ?c_usb_test); - -void exit(int); - -#define FAIL_RX_DATAERROR 0 -#define FAIL_RX_LENERROR 1 - -unsigned fail(int x) -{ - - printstr("\nXCORE: ### FAIL ******"); - switch(x) - { - case FAIL_RX_DATAERROR: - printstr("XCORE RX Data Error\n"); - break; - - case FAIL_RX_LENERROR: - printstr("XCORE RX Length Error\n"); - break; - - } - - exit(1); -} - -unsigned char g_rxDataCheck[5] = {0, 0, 0, 0, 0}; -unsigned char g_txDataCheck[5] = {0,0,0,0,0,}; -unsigned g_txLength[5] = {0,0,0,0,0}; - - -#pragma unsafe arrays -void SendTxPacket(XUD_ep ep, int length, int epNum) -{ - unsigned char buffer[1024]; - unsigned char x; - - for (int i = 0; i < length; i++) - { - buffer[i] = g_txDataCheck[epNum]++; - - //asm("ld8u %0, %1[%2]":"=r"(x):"r"(g_txDataCheck),"r"(epNum)); - // read_byte_via_xc_ptr_indexed(x, p_txDataCheck, epNum); - - //buffer[i] = x; - //x++; - //asm("st8 %0, %1[%2]"::"r"(x),"r"(g_txDataCheck),"r"(epNum)); - //write_byte_via_xc_ptr_indexed(p_txDataCheck,epNum,x); - } - - XUD_SetBuffer(ep, buffer, length); -} - -#pragma unsafe arrays -int RxDataCheck(unsigned char b[], int l, int epNum) -{ - int fail = 0; - unsigned char x; - - for (int i = 0; i < l; i++) - { - unsigned char y; - //read_byte_via_xc_ptr_indexed(y, p_rxDataCheck, epNum); - if(b[i] != g_rxDataCheck[epNum]) - { - printstr("#### Mismatch on EP: "); - printint(epNum); - printstr(". Got:"); - printhex(b[i]); - printstr(" Expected:"); - printhexln(g_rxDataCheck[epNum]); - //printintln(l); // Packet length - return 1; - } - - g_rxDataCheck[epNum]++; - //read_byte_via_xc_ptr_indexed(x, p_rxDataCheck, epNum); - //x++; - //write_byte_via_xc_ptr_indexed(p_rxDataCheck,epNum,x); - } - - return 0; -} -int TestEp_Bulk(chanend c_out1, chanend c_in1, int epNum1, chanend c_out2, chanend c_in2, int epNum2) +int TestEp_PingTest(chanend c_out[], int epNum1, int epNum2) { unsigned int length; - XUD_Result_t res; - XUD_ep ep_out1 = XUD_InitEp(c_out1); - XUD_ep ep_out2 = XUD_InitEp(c_out2); - XUD_ep ep_in1 = XUD_InitEp(c_in1); - XUD_ep ep_in2 = XUD_InitEp(c_in2); + XUD_ep ep_out1 = XUD_InitEp(c_out[epNum1]); + XUD_ep ep_out2 = XUD_InitEp(c_out[epNum2]); /* Buffer for Setup data */ unsigned char buffer[1024]; @@ -135,39 +51,40 @@ int TestEp_Bulk(chanend c_out1, chanend c_in1, int epNum1, chanend c_out2, chane } - XUD_GetBuffer(ep_out2, buffer, length); - - if(length != i) - { - printintln(length); - fail(FAIL_RX_LENERROR); - } - - if(RxDataCheck(buffer, length, epNum2)) - { - fail(FAIL_RX_DATAERROR); - } - - - exit(0); + XUD_GetBuffer(ep_out2, buffer, length); + + if(length != i) + { + printintln(length); + fail(FAIL_RX_LENERROR); + } + + if(RxDataCheck(buffer, length, epNum2)) + { + fail(FAIL_RX_DATAERROR); + } + + return 0; } -#define USB_CORE 0 int main() { chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - chan c_sync; - chan c_sync_iso; par { - - XUD_Manager( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); - TestEp_Bulk(c_ep_out[1], c_ep_in[1], 1, c_ep_out[2], c_ep_in[2], 2); + { + TestEp_PingTest(c_ep_out, 1, 2); + XUD_ep ep_out_0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep_out_0); + exit(0); + } + } return 0; From 2a6ef45adeff1798791de6b7380bd260a4b90325 Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 14 Jun 2019 16:56:38 +0100 Subject: [PATCH 011/520] Prettified packet print in log --- tests/usb_packet.py | 18 ++++++++++++++++++ tests/usb_phy.py | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/tests/usb_packet.py b/tests/usb_packet.py index 6d3a7a26..68cc9c6b 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -113,6 +113,22 @@ def __init__(self, **kwargs): def get_data_valid_count(self): return self.data_valid_count + def get_pid_pretty(self): + + if self.pid == 2: + return "ACK" + elif self.pid == 225: + return "OUT" + elif self.pid == 11: + return "DATA1" + elif self.pid == 3: + return "DATA0" + elif self.pid == 105: + return "IN" + + else: + return "UNKNOWN" + #Rx to host i.e. xCORE Tx class RxPacket(UsbPacket): @@ -182,6 +198,8 @@ def get_bytes(self): return bytes + + class RxDataPacket(RxPacket, DataPacket): diff --git a/tests/usb_phy.py b/tests/usb_phy.py index c95c2135..7030c2c9 100644 --- a/tests/usb_phy.py +++ b/tests/usb_phy.py @@ -186,7 +186,7 @@ def run(self): #print "Waiting for inter_pkt_gap: {i}".format(i=packet.inter_frame_gap) self.wait_until(xsi.get_time() + packet.inter_pkt_gap) - print "Sending packet {}".format(i) + print "Sending packet {} PID: {} ({})".format(i, packet.get_pid_pretty(), packet.pid) if self._verbose: sys.stdout.write(packet.dump()) From a5ba74bc321fc65db86e9fad9dd808eadd4cce21 Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 14 Jun 2019 16:57:02 +0100 Subject: [PATCH 012/520] Fixes for bulk_rxtx_fastpacket --- tests/helpers.py | 4 +- tests/shared_src/shared.h | 4 +- tests/test_bulk_rxtx_fastpacket/Makefile | 2 +- tests/test_bulk_rxtx_fastpacket/src/main.xc | 171 ++------------------ 4 files changed, 19 insertions(+), 162 deletions(-) diff --git a/tests/helpers.py b/tests/helpers.py index b5894ccc..6a9cd15f 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -127,8 +127,8 @@ def create_expect(packets, filename): for (i, byte) in enumerate(packet.get_bytes()): f.write("Received byte: {0:#x}\n".format(byte)) - else: - f.write("Sending packet {}\n".format(i)) + else: + f.write("Sending packet {} PID: {} ({})\n".format(i, packet.get_pid_pretty(), packet.pid)) f.write("Test done\n") diff --git a/tests/shared_src/shared.h b/tests/shared_src/shared.h index 0168694c..4c1ab297 100644 --- a/tests/shared_src/shared.h +++ b/tests/shared_src/shared.h @@ -162,12 +162,12 @@ int TestEp_Rx(chanend c_out[], int epNum, int start, int end) /* Receive a bunch of packets quickly, then check them */ #pragma loop unroll - for(int i = 0; i <= (end-start); i++) + for(int i = 0; i < (end-start); i++) { XUD_GetBuffer(ep_out1, buffer[i], length[i]); } #pragma loop unroll - for(int i = 0; i <= (end-start); i++) + for(int i = 0; i < (end-start); i++) { unsafe { diff --git a/tests/test_bulk_rxtx_fastpacket/Makefile b/tests/test_bulk_rxtx_fastpacket/Makefile index 83edfc42..4319e1c8 100644 --- a/tests/test_bulk_rxtx_fastpacket/Makefile +++ b/tests/test_bulk_rxtx_fastpacket/Makefile @@ -20,7 +20,7 @@ APP_NAME = SHARED_CODE = ../../shared_src -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L +COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L -Wno-timing XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES diff --git a/tests/test_bulk_rxtx_fastpacket/src/main.xc b/tests/test_bulk_rxtx_fastpacket/src/main.xc index 630ff410..ea2fef29 100644 --- a/tests/test_bulk_rxtx_fastpacket/src/main.xc +++ b/tests/test_bulk_rxtx_fastpacket/src/main.xc @@ -13,179 +13,36 @@ #include "platform.h" #include "xc_ptr.h" +#include "shared.h" + #define XUD_EP_COUNT_OUT 5 #define XUD_EP_COUNT_IN 5 + + /* Endpoint type tables */ XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend ?c_usb_test); - -void exit(int); - -#define FAIL_RX_DATAERROR 0 -#define FAIL_RX_LENERROR 1 - -#define PKT_COUNT 10 -#define INITIAL_PKT_LENGTH 10 - -unsigned fail(int x) -{ - - printstr("\nXCORE: ### FAIL ******"); - switch(x) - { - case FAIL_RX_DATAERROR: - printstr("XCORE RX Data Error\n"); - break; - - case FAIL_RX_LENERROR: - printstr("XCORE RX Length Error\n"); - break; - - } - - exit(1); -} - -unsigned char g_rxDataCheck[5] = {0, 0, 0, 0, 0}; -unsigned char g_txDataCheck[5] = {0,0,0,0,0,}; -unsigned g_txLength[5] = {0,0,0,0,0}; - - -#pragma unsafe arrays -void SendTxPacket(XUD_ep ep, int length, int epNum) -{ - unsigned char buffer[1024]; - unsigned char x; - - for (int i = 0; i < length; i++) - { - buffer[i] = g_txDataCheck[epNum]++; - - //asm("ld8u %0, %1[%2]":"=r"(x):"r"(g_txDataCheck),"r"(epNum)); - // read_byte_via_xc_ptr_indexed(x, p_txDataCheck, epNum); - - //buffer[i] = x; - //x++; - //asm("st8 %0, %1[%2]"::"r"(x),"r"(g_txDataCheck),"r"(epNum)); - //write_byte_via_xc_ptr_indexed(p_txDataCheck,epNum,x); - } - - XUD_SetBuffer(ep, buffer, length); -} - - -#pragma unsafe arrays -int RxDataCheck(unsigned char b[], int l, int epNum) -{ - int fail = 0; - unsigned char x; - - for (int i = 0; i < l; i++) - { - unsigned char y; - //read_byte_via_xc_ptr_indexed(y, p_rxDataCheck, epNum); - if(b[i] != g_rxDataCheck[epNum]) - { - printstr("#### Mismatch on EP: "); - printint(epNum); - printstr(". Got:"); - printhex(b[i]); - printstr(" Expected:"); - printhexln(g_rxDataCheck[epNum]); - //printintln(l); // Packet length - return 1; - } - - g_rxDataCheck[epNum]++; - //read_byte_via_xc_ptr_indexed(x, p_rxDataCheck, epNum); - //x++; - //write_byte_via_xc_ptr_indexed(p_rxDataCheck,epNum,x); - } - - return 0; -} - - -#pragma unsafe arrays -int TestEp_Bulk_Tx(chanend c_in1, int epNum1) -{ - XUD_ep ep_in1 = XUD_InitEp(c_in1); - - unsigned char buffer[PKT_COUNT][1024]; - - int counter = 0; - int length = INITIAL_PKT_LENGTH; - - for(int i = 0; i< PKT_COUNT; i++) - { - for(int j = 0; j < length; j++) - { - buffer[i][j] = counter++; - } - length++; - } - - length = INITIAL_PKT_LENGTH; - -#pragma loop unroll - for(int i = 0; i < PKT_COUNT; i++) - { - XUD_SetBuffer(ep_in1, buffer[i], length++); - } - - exit(0); - -} -#pragma unsafe arrays -int TestEp_Bulk_Rx(chanend c_out1, int epNum1) -{ - // TODO check rx lengths - - unsigned int length[PKT_COUNT]; - XUD_Result_t res; - - XUD_ep ep_out1 = XUD_InitEp(c_out1); - - /* Buffer for Setup data */ - unsigned char buffer[PKT_COUNT][1024]; - - /* Receive a bunch of packets quickly, then check them */ -#pragma loop unroll - for(int i = 0; i < PKT_COUNT; i++) - { - XUD_GetBuffer(ep_out1, buffer[i], length[i]); - } -#pragma loop unroll - for(int i = 0; i < PKT_COUNT; i++) - { - RxDataCheck(buffer[i], length[i], epNum1); - } - - while(1); - -} - - -#define USB_CORE 0 int main() { chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - chan c_sync; - chan c_sync_iso; par { - XUD_Manager( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); - TestEp_Bulk_Tx(c_ep_in[3], 3); - TestEp_Bulk_Rx(c_ep_out[3], 3); - } + TestEp_Tx(c_ep_in, 3, 10, 20, RUNMODE_DIE); + + { + TestEp_Rx(c_ep_out, 3, 10, 20); + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep0); + exit(0); // TODO should be able to move this out of the par + } + } - return 0; } From e279dbe46afc8b24a9bc0c20f7799c154b874019 Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 14 Jun 2019 17:26:00 +0100 Subject: [PATCH 013/520] Shutdown fixes to test_bulk_rx_basic --- tests/test_bulk_rx_basic/src/main.xc | 8 ++++++-- tests/test_bulk_rxtx_fastpacket/src/main.xc | 2 -- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/test_bulk_rx_basic/src/main.xc b/tests/test_bulk_rx_basic/src/main.xc index 1bb675f2..75fd09b0 100644 --- a/tests/test_bulk_rx_basic/src/main.xc +++ b/tests/test_bulk_rx_basic/src/main.xc @@ -12,7 +12,6 @@ #include "xud.h" #include "platform.h" #include "shared.h" -#include "xc_ptr.h" #define XUD_EP_COUNT_OUT 5 #define XUD_EP_COUNT_IN 5 @@ -35,7 +34,12 @@ int main() null, epTypeTableOut, epTypeTableIn, null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); - TestEp_Rx(c_ep_out, c_ep_in, 1, 10, 14); + { + TestEp_Rx(c_ep_out, 1, 10, 15); + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep0); + exit(0); + } } diff --git a/tests/test_bulk_rxtx_fastpacket/src/main.xc b/tests/test_bulk_rxtx_fastpacket/src/main.xc index ea2fef29..808bd1ca 100644 --- a/tests/test_bulk_rxtx_fastpacket/src/main.xc +++ b/tests/test_bulk_rxtx_fastpacket/src/main.xc @@ -18,8 +18,6 @@ #define XUD_EP_COUNT_OUT 5 #define XUD_EP_COUNT_IN 5 - - /* Endpoint type tables */ XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; From e466f55ae4d47ee99fefdcaea9a11a1f50bb54ef Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 17 Jun 2019 15:50:28 +0100 Subject: [PATCH 014/520] Disabled (via-rename) control tests --- ..._control_basic_badcrc32.py => test_control_basic_badcrc32.py_} | 0 tests/{test_control_basic_get.py => test_control_basic_get.py_} | 0 tests/{test_control_basic_set.py => test_control_basic_set.py_} | 0 .../{test_control_basic_short.py => test_control_basic_short.py_} | 0 ...st_control_repeatedsetup.py => test_control_repeatedsetup.py_} | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename tests/{test_control_basic_badcrc32.py => test_control_basic_badcrc32.py_} (100%) rename tests/{test_control_basic_get.py => test_control_basic_get.py_} (100%) rename tests/{test_control_basic_set.py => test_control_basic_set.py_} (100%) rename tests/{test_control_basic_short.py => test_control_basic_short.py_} (100%) rename tests/{test_control_repeatedsetup.py => test_control_repeatedsetup.py_} (100%) diff --git a/tests/test_control_basic_badcrc32.py b/tests/test_control_basic_badcrc32.py_ similarity index 100% rename from tests/test_control_basic_badcrc32.py rename to tests/test_control_basic_badcrc32.py_ diff --git a/tests/test_control_basic_get.py b/tests/test_control_basic_get.py_ similarity index 100% rename from tests/test_control_basic_get.py rename to tests/test_control_basic_get.py_ diff --git a/tests/test_control_basic_set.py b/tests/test_control_basic_set.py_ similarity index 100% rename from tests/test_control_basic_set.py rename to tests/test_control_basic_set.py_ diff --git a/tests/test_control_basic_short.py b/tests/test_control_basic_short.py_ similarity index 100% rename from tests/test_control_basic_short.py rename to tests/test_control_basic_short.py_ diff --git a/tests/test_control_repeatedsetup.py b/tests/test_control_repeatedsetup.py_ similarity index 100% rename from tests/test_control_repeatedsetup.py rename to tests/test_control_repeatedsetup.py_ From 7ef1038a80d979e6998c2c970819ae331ec5b540 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 17 Jun 2019 16:33:41 +0100 Subject: [PATCH 015/520] Futher test fixes (had to increase some inter packet gaps) --- tests/shared_src/shared.h | 51 +++++--- tests/test_bulk_rx_basic/src/main.xc | 18 ++- tests/test_bulk_rx_fastpacket/src/main.xc | 113 +++--------------- .../src/main.xc | 13 +- tests/test_bulk_rxtx_fastpacket/src/main.xc | 12 +- .../src/main.xc | 23 ++-- tests/test_iso_rx_basic/src/main.xc | 26 +++- tests/test_iso_rxtx_fastpacket.py | 2 +- tests/test_iso_rxtx_fastpacket/src/main.xc | 23 ++-- tests/test_iso_tx_basic/src/main.xc | 2 +- 10 files changed, 136 insertions(+), 147 deletions(-) diff --git a/tests/shared_src/shared.h b/tests/shared_src/shared.h index 4c1ab297..9bdc9b45 100644 --- a/tests/shared_src/shared.h +++ b/tests/shared_src/shared.h @@ -1,25 +1,30 @@ // Copyright (c) 2016-2019, XMOS Ltd, All rights reserved -unsigned char g_rxDataCheck[7] = {0, 0, 0, 0, 0, 0, 0}; -unsigned char g_txDataCheck[5] = {0,0,0,0,0,}; -unsigned g_txLength[5] = {0,0,0,0,0}; +unsigned char g_rxDataCheck_[16] = {0}; +unsigned char g_txDataCheck_[16] = {0}; +unsigned g_txLength[16] = {0}; unsafe { - unsigned char volatile * unsafe g_rxDataCheck_ = g_rxDataCheck; - unsigned char volatile * unsafe g_txDataCheck_ = g_txDataCheck; + unsigned char volatile * unsafe g_rxDataCheck = g_rxDataCheck_; + unsigned char volatile * unsafe g_txDataCheck = g_txDataCheck_; } void exit(int); -#ifndef PKT_COUNT -#define PKT_COUNT 10 +#ifndef PKT_LEN_START +#define PKT_LEN_START 10 #endif -#ifndef INITIAL_PKT_LENGTH -#define INITIAL_PKT_LENGTH 10 +#ifndef PKT_LEN_END +#define PKT_LEN_END 21 #endif +#ifndef MAX_PKT_COUNT +#define MAX_PKT_COUNT (10) +#endif + + #define XUD_Manager XUD_Main typedef enum t_runMode @@ -34,8 +39,9 @@ XUD_Result_t SendTxPacket(XUD_ep ep, int length, int epNum) { unsigned char buffer[1024]; + for (int i = 0; i < length; i++) - { + unsafe { buffer[i] = g_txDataCheck[epNum]++; } @@ -60,11 +66,11 @@ XUD_Result_t SendControlPacket(XUD_ep ep, int length, int epNum) #pragma unsafe arrays -int TestEp_Tx(chanend c_in[], int epNum1, unsigned start, unsigned end, t_runMode runMode) +int TestEp_Tx(chanend c_in, int epNum1, unsigned start, unsigned end, t_runMode runMode) { - XUD_ep ep_in = XUD_InitEp(c_in[epNum1]); + XUD_ep ep_in = XUD_InitEp(c_in); - unsigned char buffer[PKT_COUNT][1024]; + unsigned char buffer[MAX_PKT_COUNT][1024]; int counter = 0; int length = start; @@ -126,10 +132,15 @@ unsigned fail(int x) #pragma unsafe arrays int RxDataCheck(unsigned char b[], int l, int epNum) { + // TODO check lengths for (int i = 0; i < l; i++) { unsigned char y; //read_byte_via_xc_ptr_indexed(y, p_rxDataCheck, epNum); + + unsafe + { + if(b[i] != g_rxDataCheck[epNum]) { printstr("#### Mismatch on EP: "); @@ -143,31 +154,33 @@ int RxDataCheck(unsigned char b[], int l, int epNum) } g_rxDataCheck[epNum]++; + + } } return 0; } #pragma unsafe arrays -int TestEp_Rx(chanend c_out[], int epNum, int start, int end) +int TestEp_Rx(chanend c_out, int epNum, int start, int end) { // TODO check rx lengths - unsigned int length[PKT_COUNT]; + unsigned int length[MAX_PKT_COUNT]; //XUD_Result_t res; - XUD_ep ep_out1 = XUD_InitEp(c_out[epNum]); + XUD_ep ep_out1 = XUD_InitEp(c_out); /* Buffer for Setup data */ - unsigned char buffer[PKT_COUNT][1024]; + unsigned char buffer[MAX_PKT_COUNT][1024]; /* Receive a bunch of packets quickly, then check them */ #pragma loop unroll - for(int i = 0; i < (end-start); i++) + for(int i = 0; i <= (end-start); i++) { XUD_GetBuffer(ep_out1, buffer[i], length[i]); } #pragma loop unroll - for(int i = 0; i < (end-start); i++) + for(int i = 0; i <= (end-start); i++) { unsafe { diff --git a/tests/test_bulk_rx_basic/src/main.xc b/tests/test_bulk_rx_basic/src/main.xc index 75fd09b0..be6ad72d 100644 --- a/tests/test_bulk_rx_basic/src/main.xc +++ b/tests/test_bulk_rx_basic/src/main.xc @@ -16,6 +16,20 @@ #define XUD_EP_COUNT_OUT 5 #define XUD_EP_COUNT_IN 5 +#ifndef PKT_LENGTH_START +#define PKT_LENGTH_START 10 +#endif + + +#ifndef PKT_LENGTH_END +#define PKT_LENGTH_END 14 +#endif + +#ifndef TEST_EP_NUM +#define TEST_EP_NUM 1 +#endif + + /* Endpoint type tables */ XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, @@ -30,12 +44,12 @@ int main() par { - XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); { - TestEp_Rx(c_ep_out, 1, 10, 15); + TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); XUD_Kill(ep0); exit(0); diff --git a/tests/test_bulk_rx_fastpacket/src/main.xc b/tests/test_bulk_rx_fastpacket/src/main.xc index 579cf0a0..937c3fae 100644 --- a/tests/test_bulk_rx_fastpacket/src/main.xc +++ b/tests/test_bulk_rx_fastpacket/src/main.xc @@ -9,121 +9,38 @@ #include #include #include +#include + #include "xud.h" -#include "platform.h" -#include "xc_ptr.h" +#include "shared.h" #define XUD_EP_COUNT_OUT 5 #define XUD_EP_COUNT_IN 5 +#define TEST_EP_NUMBER (3) + /* Endpoint type tables */ XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend ?c_usb_test); - -void exit(int); - -#define FAIL_RX_DATAERROR 0 -#define FAIL_RX_LENERROR 1 - -#define PKT_COUNT 10 -#define INITIAL_PKT_LENGTH 10 - -#define TEST_EP_NUMBER (3) - -unsigned fail(int x) -{ - - printstr("\nXCORE: ### FAIL ******"); - switch(x) - { - case FAIL_RX_DATAERROR: - printstr("XCORE RX Data Error\n"); - break; - - case FAIL_RX_LENERROR: - printstr("XCORE RX Length Error\n"); - break; - - } - - exit(1); -} - -unsigned char g_rxDataCheck[5] = {0, 0, 0, 0, 0}; - -#pragma unsafe arrays -int RxDataCheck(unsigned char b[], int l, int epNum) -{ - int fail = 0; - unsigned char x; - - for (int i = 0; i < l; i++) - { - unsigned char y; - if(b[i] != g_rxDataCheck[epNum]) - { - printstr("#### Mismatch on EP: "); - printint(epNum); - printstr(". Got:"); - printhex(b[i]); - printstr(" Expected:"); - printhexln(g_rxDataCheck[epNum]); - return 1; - } - - g_rxDataCheck[epNum]++; - } - - return 0; -} - -#pragma unsafe arrays -int TestEp_Bulk_Rx(chanend c_out1, int epNum1, chanend c_out_0) -{ - // TODO check rx lengths - - - unsigned int length[PKT_COUNT]; - XUD_Result_t res; - - XUD_ep ep_out1 = XUD_InitEp(c_out1); - XUD_ep ep_out_0 = XUD_InitEp(c_out_0); - - /* Buffer for Setup data */ - unsigned char buffer[PKT_COUNT][1024]; - - /* Receive a bunch of packets quickly, then check them */ -#pragma loop unroll - for(int i = 0; i < PKT_COUNT; i++) - { - XUD_GetBuffer(ep_out1, buffer[i], length[i]); - } -#pragma loop unroll - for(int i = 0; i < PKT_COUNT; i++) - { - RxDataCheck(buffer[i], length[i], epNum1); - } - - exit(0); -} - - -#define USB_CORE 0 int main() { chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - par { - XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, - null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); + null, epTypeTableOut, epTypeTableIn, + null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); + - TestEp_Bulk_Rx(c_ep_out[TEST_EP_NUMBER], TEST_EP_NUMBER, c_ep_out[0]); + { + TestEp_Rx(c_ep_out[TEST_EP_NUMBER], TEST_EP_NUMBER, 10, 19); + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep0); + exit(0); // TODO should be able to move this outside of the par{} + } } + return 0; } diff --git a/tests/test_bulk_rx_fastpacket_multiep/src/main.xc b/tests/test_bulk_rx_fastpacket_multiep/src/main.xc index c4d52cbf..79cc39cb 100644 --- a/tests/test_bulk_rx_fastpacket_multiep/src/main.xc +++ b/tests/test_bulk_rx_fastpacket_multiep/src/main.xc @@ -17,12 +17,13 @@ #define XUD_EP_COUNT_OUT 7 #define XUD_EP_COUNT_IN 1 +#define PACKET_LEN_START 10 +#define PACKET_LEN_END 19 /* Endpoint type tables */ XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL}; -#define USB_CORE 0 int main() { chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; @@ -30,17 +31,17 @@ int main() par { - XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); - TestEp_Bulk_Rx(c_ep_out[3], 3); - TestEp_Bulk_Rx(c_ep_out[4], 4); - TestEp_Bulk_Rx(c_ep_out[5], 5); + TestEp_Rx(c_ep_out[3], 3, PACKET_LEN_START, PACKET_LEN_END); + TestEp_Rx(c_ep_out[4], 4, PACKET_LEN_START, PACKET_LEN_END); + TestEp_Rx(c_ep_out[5], 5, PACKET_LEN_START, PACKET_LEN_END); { XUD_ep ep_out_0 = XUD_InitEp(c_ep_out[0]); - TestEp_Bulk_Rx(c_ep_out[6], 6); + TestEp_Rx(c_ep_out[6], 6, PACKET_LEN_START, PACKET_LEN_END); XUD_Kill(ep_out_0); exit(0); } diff --git a/tests/test_bulk_rxtx_fastpacket/src/main.xc b/tests/test_bulk_rxtx_fastpacket/src/main.xc index 808bd1ca..980f208b 100644 --- a/tests/test_bulk_rxtx_fastpacket/src/main.xc +++ b/tests/test_bulk_rxtx_fastpacket/src/main.xc @@ -18,6 +18,14 @@ #define XUD_EP_COUNT_OUT 5 #define XUD_EP_COUNT_IN 5 +#ifndef PKT_LENGTH_START +#define PKT_LENGTH_START 10 +#endif + +#ifndef PKT_LENGTH_END +#define PKT_LENGTH_END 19 +#endif + /* Endpoint type tables */ XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; @@ -33,10 +41,10 @@ int main() null, epTypeTableOut, epTypeTableIn, null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); - TestEp_Tx(c_ep_in, 3, 10, 20, RUNMODE_DIE); + TestEp_Tx(c_ep_in[3], 3, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_DIE); { - TestEp_Rx(c_ep_out, 3, 10, 20); + TestEp_Rx(c_ep_out[3], 3, PKT_LENGTH_START, PKT_LENGTH_END); XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); XUD_Kill(ep0); exit(0); // TODO should be able to move this out of the par diff --git a/tests/test_bulk_tx_fastpacket_multiep/src/main.xc b/tests/test_bulk_tx_fastpacket_multiep/src/main.xc index 13976d8c..b18999a6 100644 --- a/tests/test_bulk_tx_fastpacket_multiep/src/main.xc +++ b/tests/test_bulk_tx_fastpacket_multiep/src/main.xc @@ -7,15 +7,17 @@ #include "shared.h" #define XUD_EP_COUNT_OUT 5 -#define XUD_EP_COUNT_IN 7 +#define XUD_EP_COUNT_IN 8 /* Endpoint type tables */ XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; +#define PKT_LENGTH_START 10 +#define PKT_LENGTH_END 19 + -#define USB_CORE 0 int main() { chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; @@ -23,14 +25,21 @@ int main() par { - XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); - TestEp_Bulk_Tx(c_ep_in[3], 3, 0); - TestEp_Bulk_Tx(c_ep_in[4], 4, 0); - TestEp_Bulk_Tx(c_ep_in[5], 5, 0); - TestEp_Bulk_Tx(c_ep_in[6], 6, 1); + TestEp_Tx(c_ep_in[3], 3, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_LOOP); + TestEp_Tx(c_ep_in[4], 4, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_LOOP); + TestEp_Tx(c_ep_in[5], 5, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_LOOP); + + { + TestEp_Tx(c_ep_in[6], 6, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_DIE); + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep0); + exit(0); + } + } return 0; diff --git a/tests/test_iso_rx_basic/src/main.xc b/tests/test_iso_rx_basic/src/main.xc index 1331e793..5d705979 100644 --- a/tests/test_iso_rx_basic/src/main.xc +++ b/tests/test_iso_rx_basic/src/main.xc @@ -10,6 +10,19 @@ #define XUD_EP_COUNT_OUT 5 #define XUD_EP_COUNT_IN 5 +#ifndef PKT_LENGTH_START +#define PKT_LENGTH_START 10 +#endif + + +#ifndef PKT_LENGTH_END +#define PKT_LENGTH_END 14 +#endif + +#ifndef TEST_EP_NUM +#define TEST_EP_NUM 2 +#endif + /* Endpoint type tables */ XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, @@ -27,8 +40,19 @@ int main() null, epTypeTableOut, epTypeTableIn, null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); - TestEp_Rx(c_ep_out, c_ep_in, 2, 10, 14); + { + TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep0); + + exit(0); // TODO should be able to move outside of the par{} + + } + + + } + return 0; } diff --git a/tests/test_iso_rxtx_fastpacket.py b/tests/test_iso_rxtx_fastpacket.py index b214d940..c87378a5 100644 --- a/tests/test_iso_rxtx_fastpacket.py +++ b/tests/test_iso_rxtx_fastpacket.py @@ -25,7 +25,7 @@ def do_test(arch, clk, phy, seed): AppendOutToken(packets, ep, inter_pkt_gap=20) packets.append(TxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) #DATA0 - AppendInToken(packets, ep, inter_pkt_gap=37) + AppendInToken(packets, ep, inter_pkt_gap=58) packets.append(RxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) data_val = data_val + pkt_length diff --git a/tests/test_iso_rxtx_fastpacket/src/main.xc b/tests/test_iso_rxtx_fastpacket/src/main.xc index 835c671b..c663a299 100644 --- a/tests/test_iso_rxtx_fastpacket/src/main.xc +++ b/tests/test_iso_rxtx_fastpacket/src/main.xc @@ -23,14 +23,12 @@ #endif #ifndef PKT_LENGTH_END -#define PKT_LENGTH_END 20 +#define PKT_LENGTH_END 19 #endif - /* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL}; - +XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO}; +XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO}; int main() { @@ -39,13 +37,18 @@ int main() par { - XUD_Manager( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); - TestEp_Tx(c_ep_in, 3, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_DIE); - TestEp_Rx(c_ep_out, 3, PKT_LENGTH_START, PKT_LENGTH_END); - } + TestEp_Tx(c_ep_in[3], 3, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_DIE); + + { + TestEp_Rx(c_ep_out[3], 3, PKT_LENGTH_START, PKT_LENGTH_END); + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep0); + exit(0); // TODO should be able to move this out of the par + } + } - return 0; } diff --git a/tests/test_iso_tx_basic/src/main.xc b/tests/test_iso_tx_basic/src/main.xc index fa3aa16a..cdedc347 100644 --- a/tests/test_iso_tx_basic/src/main.xc +++ b/tests/test_iso_tx_basic/src/main.xc @@ -39,7 +39,7 @@ int main() null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); { - TestEp_Tx(c_ep_in, 3, 10, 14, RUNMODE_DIE); + TestEp_Tx(c_ep_in[3], 3, 10, 14, RUNMODE_DIE); XUD_ep ep_out_0 = XUD_InitEp(c_ep_out[0]); XUD_Kill(ep_out_0); exit(0); From 0c1377ac75cb5757146989caf62096039f9722a6 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 19 Jun 2019 12:30:55 +0100 Subject: [PATCH 016/520] Re-org and tidy of test code --- tests/helpers.py | 64 ++++---- tests/runtests.py | 8 +- tests/test_bulk_rx_basic.py | 7 +- tests/usb_phy.py | 281 +----------------------------------- tests/usb_phy_shim.py | 185 ++++++++++++++++++++++++ tests/usb_phy_utmi.py | 181 +++++++++++++++++++++++ 6 files changed, 406 insertions(+), 320 deletions(-) create mode 100644 tests/usb_phy_shim.py create mode 100644 tests/usb_phy_utmi.py diff --git a/tests/helpers.py b/tests/helpers.py index 6a9cd15f..52c644d7 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -5,6 +5,8 @@ import sys from usb_clock import Clock from usb_phy import UsbPhy +from usb_phy_shim import UsbPhyShim +from usb_phy_utmi import UsbPhyUtmi from usb_packet import RxPacket args = None @@ -20,7 +22,7 @@ def get_usb_clk_phy(verbose=True, test_ctrl=None, do_timeout=True, if arch=='xs2': clk = Clock('tile[0]:XS1_PORT_1J', Clock.CLK_60MHz) - phy = UsbPhy('tile[0]:XS1_PORT_8B', + phy = UsbPhyShim('tile[0]:XS1_PORT_8B', 'tile[0]:XS1_PORT_1F', #rxa 'tile[0]:XS1_PORT_1I', #rxv 'tile[0]:XS1_PORT_1G', #rxe @@ -33,10 +35,26 @@ def get_usb_clk_phy(verbose=True, test_ctrl=None, do_timeout=True, do_timeout=do_timeout, complete_fn=complete_fn, expect_loopback=expect_loopback, dut_exit_time=dut_exit_time, initial_delay=initial_del) - - if arch=='xs1': + + elif arch=='xs3': clk = Clock('tile[0]:XS1_PORT_1J', Clock.CLK_60MHz) - phy = UsbPhy('tile[0]:XS1_PORT_8C', + phy = UsbPhyUtmi('tile[0]:XS1_PORT_8B', + 'tile[0]:XS1_PORT_1F', #rxa + 'tile[0]:XS1_PORT_1I', #rxv + 'tile[0]:XS1_PORT_1G', #rxe + 'tile[0]:XS1_PORT_8A', #txd + 'tile[0]:XS1_PORT_1K', #txv + 'tile[0]:XS1_PORT_1H', #txrdy + clk, + verbose=verbose, test_ctrl=test_ctrl, + do_timeout=do_timeout, complete_fn=complete_fn, + expect_loopback=expect_loopback, + dut_exit_time=dut_exit_time, initial_delay=initial_del) + + + elif arch=='xs1': + clk = Clock('tile[0]:XS1_PORT_1J', Clock.CLK_60MHz) + phy = UsbPhyShim('tile[0]:XS1_PORT_8C', 'tile[0]:XS1_PORT_1O', #rxa 'tile[0]:XS1_PORT_1M', #rxv 'tile[0]:XS1_PORT_1P', #rxe @@ -66,18 +84,18 @@ def run_on(**kwargs): def runall_rx(test_fn): - if run_on(arch='xs1'): - (tx_clk_60, usb_phy) = get_usb_clk_phy(verbose=False, arch='xs1') + if run_on(arch='xs3'): + (clk_60, usb_phy) = get_usb_clk_phy(verbose=False, arch='xs3') seed = args.seed if args.seed else random.randint(0, sys.maxint) - test_fn('xs1', tx_clk_60, usb_phy, seed) + test_fn('xs3', clk_60, usb_phy, seed) if run_on(arch='xs2'): - (tx_clk_60, usb_phy) = get_usb_clk_phy(verbose=False, arch='xs2') + (clk_60, usb_phy) = get_usb_clk_phy(verbose=False, arch='xs2') seed = args.seed if args.seed else random.randint(0, sys.maxint) - test_fn('xs2', tx_clk_60, usb_phy, seed) + test_fn('xs2', clk_60, usb_phy, seed) -def do_rx_test(arch, tx_clk, tx_phy, packets, test_file, seed, +def do_rx_test(arch, clk, phy, packets, test_file, seed, level='nightly', extra_tasks=[]): """ Shared test code for all RX tests using the test_rx application. @@ -93,25 +111,25 @@ def do_rx_test(arch, tx_clk, tx_phy, packets, test_file, seed, if xmostest.testlevel_is_at_least(xmostest.get_testlevel(), level): print "Running {test}: {arch} arch sending {n} packets at {clk} (seed {seed})".format( test=testname, n=len(packets), - arch=arch, clk=tx_clk.get_name(), seed=seed) + arch=arch, clk=clk.get_name(), seed=seed) - tx_phy.set_packets(packets) + phy.set_packets(packets) #rx_phy.set_expected_packets(packets) expect_folder = create_if_needed("expect") expect_filename = '{folder}/{test}_{arch}.expect'.format( - folder=expect_folder, test=testname, phy=tx_phy.get_name(), clk=tx_clk.get_name(), arch=arch) + folder=expect_folder, test=testname, phy=phy.get_name(), clk=clk.get_name(), arch=arch) create_expect(packets, expect_filename) tester = xmostest.ComparisonTester(open(expect_filename), 'lib_xud', 'xud_sim_tests', testname, - {'clk':tx_clk.get_name(), 'arch':arch}) + {'clk':clk.get_name(), 'arch':arch}) tester.set_min_testlevel(level) - simargs = get_sim_args(testname, tx_clk, tx_phy, arch) + simargs = get_sim_args(testname, clk, phy, arch) xmostest.run_on_simulator(resources['xsim'], binary, - simthreads=[tx_clk, tx_phy] + extra_tasks, + simthreads=[clk, phy] + extra_tasks, tester=tester, simargs=simargs) @@ -137,8 +155,7 @@ def get_sim_args(testname, clk, phy, arch='xs2'): if args and args.trace: log_folder = create_if_needed("logs") - #if phy.get_name() == 'rgmii': - #arch = 'xs2' + filename = "{log}/xsim_trace_{test}_{clk}_{arch}".format( log=log_folder, test=testname, clk=clk.get_name(), phy=phy.get_name(), arch=arch) @@ -149,13 +166,7 @@ def get_sim_args(testname, clk, phy, arch='xs2'): vcd_args += (' -tile tile[0] -ports -ports-detailed -instructions' ' -functions -cycles -clock-blocks -pads -cores') - # The RGMII pins are on tile[1] - #if phy.get_name() == 'rgmii': - # vcd_args += (' -tile tile[0] -ports -ports-detailed -instructions' - # ' -functions -cycles -clock-blocks -cores') - sim_args += ['--vcd-tracing', vcd_args] - # sim_args += ['--xscope', '-offline logs/xscope.xmt'] return sim_args @@ -163,12 +174,7 @@ def get_sim_args(testname, clk, phy, arch='xs2'): def packet_processing_time(phy, data_bytes): """ Returns the time it takes the DUT to process a given frame """ - #if mac == 'standard': - # return 4000 * phy.get_clock().get_bit_time() - #elif phy.get_name() == 'rgmii' and mac == 'rt': return 6000 * phy.get_clock().get_bit_time() - ##else: - # return 2000 * phy.get_clock().get_bit_time() def get_dut_address(): """ Returns the busaddress of the DUT diff --git a/tests/runtests.py b/tests/runtests.py index 05c526d2..7f6e2748 100644 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -8,15 +8,9 @@ global trace argparser = argparse.ArgumentParser(description="XMOS lib_xud tests") argparser.add_argument('--trace', action='store_true', help='Run tests with simulator and VCD traces') - argparser.add_argument('--arch', choices=['xs1', 'xs2'], type=str, help='Run tests only on specified xcore architecture') - argparser.add_argument('--clk', choices=['25Mhz', '125Mhz'], type=str, help='Run tests only at specified clock speed') - argparser.add_argument('--mac', choices=['rt', 'rt_hp', 'standard'], type=str, help='Run tests only on specified MAC') + argparser.add_argument('--arch', choices=['xs2', 'xs3'], type=str, help='Run tests only on specified xcore architecture') argparser.add_argument('--seed', type=int, help='The seed', default=None) argparser.add_argument('--verbose', action='store_true', help='Enable verbose tracing in the phys') - - argparser.add_argument('--num-packets', type=int, help='Number of packets in the test', default='100') - argparser.add_argument('--data-len-min', type=int, help='Minimum packet data bytes', default='46') - argparser.add_argument('--data-len-max', type=int, help='Maximum packet data bytes', default='500') helpers.args = xmostest.init(argparser) diff --git a/tests/test_bulk_rx_basic.py b/tests/test_bulk_rx_basic.py index ef5db331..3972dc21 100644 --- a/tests/test_bulk_rx_basic.py +++ b/tests/test_bulk_rx_basic.py @@ -9,9 +9,7 @@ from helpers import choose_small_frame_size, check_received_packet, runall_rx -# Single, setup transaction to EP 0 - -def do_test(arch, tx_clk, tx_phy, seed): +def do_test(arch, clk, phy, seed): rand = random.Random() rand.seed(seed) @@ -50,8 +48,7 @@ def do_test(arch, tx_clk, tx_phy, seed): packets.append(RxHandshakePacket()) - do_rx_test(arch, tx_clk, tx_phy, packets, __file__, seed, - level='smoke', extra_tasks=[]) + do_rx_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): random.seed(1) diff --git a/tests/usb_phy.py b/tests/usb_phy.py index 7030c2c9..8284db16 100644 --- a/tests/usb_phy.py +++ b/tests/usb_phy.py @@ -4,13 +4,13 @@ import zlib from usb_packet import RxPacket, TokenPacket -class TxPhy(xmostest.SimThread): +class UsbPhy(xmostest.SimThread): # Time in ns from the last packet being sent until the end of test is signalled to the DUT END_OF_TEST_TIME = 5000 - def __init__(self, name, rxd, rxa, rxdv, rxer, vld, txd, txv, txrdy, clock, initial_delay, verbose, + def __init__(self, name, rxd, rxa, rxdv, rxer, txd, txv, txrdy, clock, initial_delay, verbose, test_ctrl, do_timeout, complete_fn, expect_loopback, dut_exit_time): self._name = name self._test_ctrl = test_ctrl @@ -18,7 +18,6 @@ def __init__(self, name, rxd, rxa, rxdv, rxer, vld, txd, txv, txrdy, clock, init self._rxa = rxa #Rx Active self._rxdv = rxdv #Rx valid self._rxer = rxer #Rx Error - self._vld = vld self._txd = txd self._txv = txv self._txrdy = txrdy @@ -92,282 +91,6 @@ def drive_error(self, value): self.xsi.drive_port_pins(self._rxer, value) -class UsbPhy(TxPhy): - def __init__(self, rxd, rxa, rxdv, rxer, vld, txd, txv, txrdy, clock, - initial_delay=85000, verbose=False, test_ctrl=None, - do_timeout=True, complete_fn=None, expect_loopback=True, - dut_exit_time=25000): - super(UsbPhy, self).__init__('mii', rxd, rxa, rxdv, rxer, vld, txd, txv, txrdy, clock, - initial_delay, verbose, test_ctrl, - do_timeout, complete_fn, expect_loopback, - dut_exit_time) - - def run(self): - xsi = self.xsi - - self.start_test() - - for i,packet in enumerate(self._packets): - #error_nibbles = packet.get_error_nibbles() - - if isinstance(packet, RxPacket): - - timeout = packet.get_timeout() - - #print "Expecting pkt. Timeout in: {i}".format(i=timeout) - - in_rx_packet = False - rx_packet = [] - - while timeout != 0: - - self.wait(lambda x: self._clock.is_high()) - self.wait(lambda x: self._clock.is_low()) - - timeout = timeout - 1 - #print "{i}".format(i=timeout) - - #sample TXV for new packet - if xsi.sample_port_pins(self._txv) == 1: - print "Receiving packet {}".format(i) - in_rx_packet = True - break - - if in_rx_packet == False: - print "ERROR: Timed out waiting for packet" - - else: - #print "in packet" - while in_rx_packet == True: - - # TODO txrdy pulsing - xsi.drive_port_pins(self._txrdy, 1) - data = xsi.sample_port_pins(self._txd) - - print "Received byte: {0:#x}".format(data) - rx_packet.append(data) - - self.wait(lambda x: self._clock.is_high()) - self.wait(lambda x: self._clock.is_low()) - - if xsi.sample_port_pins(self._txv) == 0: - #print "TXV low, breaking out of loop" - in_rx_packet = False - - - - # End of packet - xsi.drive_port_pins(self._txrdy, 0) - - # Check packet agaist expected - expected = packet.get_bytes() - if len(expected) != len(rx_packet): - print "ERROR: Rx packet length bad. Expecting: {} actual: {}".format(len(expected), len(rx_packet)) - - # Check packet data against expected - if cmp(expected, rx_packet): - print "ERROR: Rx Packet Error. Expected:" - for item in expected: - print "{0:#x}".format(item) - - print "Received:" - for item in rx_packet: - print "{0:#x}".format(item) - else: - - - # xCore should not be trying to send if we are trying to send.. - if xsi.sample_port_pins(self._txv) == 1: - print "ERROR: Unexpected packet from xCORE" - - rxv_count = packet.get_data_valid_count(); - - #print "Waiting for inter_pkt_gap: {i}".format(i=packet.inter_frame_gap) - self.wait_until(xsi.get_time() + packet.inter_pkt_gap) - - print "Sending packet {} PID: {} ({})".format(i, packet.get_pid_pretty(), packet.pid) - if self._verbose: - sys.stdout.write(packet.dump()) - - # Set RXA high - xsi.drive_port_pins(self._rxa, 1) - - # Wait for RXA rise delay TODO, this should be configurable - self.wait(lambda x: self._clock.is_high()) - self.wait(lambda x: self._clock.is_low()) - - #if isinstance(packet, TokenPacket): - # print "Token packet, clear valid token" - xsi.drive_port_pins(self._vld, 0) - - for (i, byte) in enumerate(packet.get_bytes()): - - # xCore should not be trying to send if we are trying to send.. - if xsi.sample_port_pins(self._txv) == 1: - print "ERROR: Unexpected packet from xCORE" - - self.wait(lambda x: self._clock.is_low()) - - self.wait(lambda x: self._clock.is_high()) - self.wait(lambda x: self._clock.is_low()) - xsi.drive_port_pins(self._rxdv, 1) - xsi.drive_port_pins(self._rxd, byte) - - if (packet.rxe_assert_time != 0) and (packet.rxe_assert_time == i): - xsi.drive_port_pins(self._rxer, 1) - - while rxv_count != 0: - self.wait(lambda x: self._clock.is_high()) - self.wait(lambda x: self._clock.is_low()) - xsi.drive_port_pins(self._rxdv, 0) - rxv_count = rxv_count - 1 - - # xCore should not be trying to send if we are trying to send.. - if xsi.sample_port_pins(self._txv) == 1: - print "ERROR: Unexpected packet from xCORE" - - #print "Sending byte {0:#x}".format(byte) - - rxv_count = packet.get_data_valid_count(); - - if isinstance(packet, TokenPacket): - #print "Token packet, driving valid" - if packet.get_token_valid(): - xsi.drive_port_pins(self._vld, 1) - else: - xsi.drive_port_pins(self._vld, 0) - - # Wait for last byte - self.wait(lambda x: self._clock.is_high()) - self.wait(lambda x: self._clock.is_low()) - - xsi.drive_port_pins(self._rxdv, 0) - xsi.drive_port_pins(self._rxer, 0) - - rxa_end_delay = packet.rxa_end_delay - while rxa_end_delay != 0: - # Wait for RXA fall delay TODO, this should be configurable - self.wait(lambda x: self._clock.is_high()) - self.wait(lambda x: self._clock.is_low()) - rxa_end_delay = rxa_end_delay - 1 - - # xCore should not be trying to send if we are trying to send.. - if xsi.sample_port_pins(self._txv) == 1: - print "ERROR: Unexpected packet from xCORE" - - xsi.drive_port_pins(self._rxa, 0) - - #if self._verbose: - #print "Sent" - - print "Test done" - self.end_test() - - -class RxPhy(xmostest.SimThread): - - def __init__(self, name, txd, txen, clock, print_packets, packet_fn, verbose, test_ctrl): - self._name = name - self._txd = txd - self._txen = txen - self._clock = clock - self._print_packets = print_packets - self._verbose = verbose - self._test_ctrl = test_ctrl - self._packet_fn = packet_fn - - self.expected_packets = None - self.expect_packet_index = 0 - self.num_expected_packets = 0 - - self.expected_packets = None - self.expect_packet_index = 0 - self.num_expected_packets = 0 - - def get_name(self): - return self._name - - def get_clock(self): - return self._clock - - def set_expected_packets(self, packets): - self.expect_packet_index = 0; - self.expected_packets = packets - if self.expected_packets is None: - self.num_expected_packets = 0 - else: - self.num_expected_packets = len(self.expected_packets) - -class MiiReceiver(RxPhy): - - def __init__(self, txd, txen, clock, print_packets=False, - packet_fn=None, verbose=False, test_ctrl=None): - super(MiiReceiver, self).__init__('mii', txd, txen, clock, print_packets, - packet_fn, verbose, test_ctrl) - - def run(self): - xsi = self.xsi - self.wait(lambda x: xsi.sample_port_pins(self._txen) == 0) - - # Need a random number generator for the MiiPacket constructor but it shouldn't - # have any affect as only blank packets are being created - rand = random.Random() - - packet_count = 0 - last_frame_end_time = None - while True: - # Wait for TXEN to go high - if self._test_ctrl is None: - self.wait(lambda x: xsi.sample_port_pins(self._txen) == 1) - else: - self.wait(lambda x: xsi.sample_port_pins(self._txen) == 1 or \ - xsi.sample_port_pins(self._test_ctrl) == 1) - - if (xsi.sample_port_pins(self._txen) == 0 and - xsi.sample_port_pins(self._test_ctrl) == 1): - xsi.terminate() - - # Start with a blank packet to ensure they are filled in by the receiver - packet = MiiPacket(rand, blank=True) - - frame_start_time = self.xsi.get_time() - in_preamble = True - - if last_frame_end_time: - ifgap = frame_start_time - last_frame_end_time - packet.inter_frame_gap = ifgap - - while True: - # Wait for a falling clock edge or enable low - self.wait(lambda x: self._clock.is_low() or \ - xsi.sample_port_pins(self._txen) == 0) - - if xsi.sample_port_pins(self._txen) == 0: - last_frame_end_time = self.xsi.get_time() - break - - nibble = xsi.sample_port_pins(self._txd) - if in_preamble: - if nibble == 0xd: - packet.set_sfd_nibble(nibble) - in_preamble = False - else: - packet.append_preamble_nibble(nibble) - else: - packet.append_data_nibble(nibble) - - self.wait(lambda x: self._clock.is_high()) - - packet.complete() - - if self._print_packets: - sys.stdout.write(packet.dump()) - - if self._packet_fn: - self._packet_fn(packet, self) - - # Perform packet checks - packet.check(self._clock) diff --git a/tests/usb_phy_shim.py b/tests/usb_phy_shim.py new file mode 100644 index 00000000..8b4e7a82 --- /dev/null +++ b/tests/usb_phy_shim.py @@ -0,0 +1,185 @@ +import random +import xmostest +import sys +import zlib +from usb_packet import RxPacket, TokenPacket +from usb_phy import UsbPhy + +class UsbPhyShim(UsbPhy): + + def __init__(self, rxd, rxa, rxdv, rxer, vld, txd, txv, txrdy, clock, + initial_delay=85000, verbose=False, test_ctrl=None, + do_timeout=True, complete_fn=None, expect_loopback=True, + dut_exit_time=25000): + + # Shim adds a valid token line + self._vld = vld + + super(UsbPhyShim, self).__init__('mii', rxd, rxa, rxdv, rxer, txd, txv, txrdy, clock, + initial_delay, verbose, test_ctrl, + do_timeout, complete_fn, expect_loopback, + dut_exit_time) + + def run(self): + xsi = self.xsi + + self.start_test() + + for i,packet in enumerate(self._packets): + #error_nibbles = packet.get_error_nibbles() + + if isinstance(packet, RxPacket): + + timeout = packet.get_timeout() + + #print "Expecting pkt. Timeout in: {i}".format(i=timeout) + + in_rx_packet = False + rx_packet = [] + + while timeout != 0: + + self.wait(lambda x: self._clock.is_high()) + self.wait(lambda x: self._clock.is_low()) + + timeout = timeout - 1 + #print "{i}".format(i=timeout) + + #sample TXV for new packet + if xsi.sample_port_pins(self._txv) == 1: + print "Receiving packet {}".format(i) + in_rx_packet = True + break + + if in_rx_packet == False: + print "ERROR: Timed out waiting for packet" + + else: + #print "in packet" + while in_rx_packet == True: + + # TODO txrdy pulsing + xsi.drive_port_pins(self._txrdy, 1) + data = xsi.sample_port_pins(self._txd) + + print "Received byte: {0:#x}".format(data) + rx_packet.append(data) + + self.wait(lambda x: self._clock.is_high()) + self.wait(lambda x: self._clock.is_low()) + + if xsi.sample_port_pins(self._txv) == 0: + #print "TXV low, breaking out of loop" + in_rx_packet = False + + + + # End of packet + xsi.drive_port_pins(self._txrdy, 0) + + # Check packet agaist expected + expected = packet.get_bytes() + if len(expected) != len(rx_packet): + print "ERROR: Rx packet length bad. Expecting: {} actual: {}".format(len(expected), len(rx_packet)) + + # Check packet data against expected + if cmp(expected, rx_packet): + print "ERROR: Rx Packet Error. Expected:" + for item in expected: + print "{0:#x}".format(item) + + print "Received:" + for item in rx_packet: + print "{0:#x}".format(item) + else: + + + # xCore should not be trying to send if we are trying to send.. + if xsi.sample_port_pins(self._txv) == 1: + print "ERROR: Unexpected packet from xCORE" + + rxv_count = packet.get_data_valid_count(); + + #print "Waiting for inter_pkt_gap: {i}".format(i=packet.inter_frame_gap) + self.wait_until(xsi.get_time() + packet.inter_pkt_gap) + + print "Sending packet {} PID: {} ({})".format(i, packet.get_pid_pretty(), packet.pid) + if self._verbose: + sys.stdout.write(packet.dump()) + + # Set RXA high + xsi.drive_port_pins(self._rxa, 1) + + # Wait for RXA rise delay TODO, this should be configurable + self.wait(lambda x: self._clock.is_high()) + self.wait(lambda x: self._clock.is_low()) + + #if isinstance(packet, TokenPacket): + # print "Token packet, clear valid token" + xsi.drive_port_pins(self._vld, 0) + + for (i, byte) in enumerate(packet.get_bytes()): + + # xCore should not be trying to send if we are trying to send.. + if xsi.sample_port_pins(self._txv) == 1: + print "ERROR: Unexpected packet from xCORE" + + self.wait(lambda x: self._clock.is_low()) + + self.wait(lambda x: self._clock.is_high()) + self.wait(lambda x: self._clock.is_low()) + xsi.drive_port_pins(self._rxdv, 1) + xsi.drive_port_pins(self._rxd, byte) + + if (packet.rxe_assert_time != 0) and (packet.rxe_assert_time == i): + xsi.drive_port_pins(self._rxer, 1) + + while rxv_count != 0: + self.wait(lambda x: self._clock.is_high()) + self.wait(lambda x: self._clock.is_low()) + xsi.drive_port_pins(self._rxdv, 0) + rxv_count = rxv_count - 1 + + # xCore should not be trying to send if we are trying to send.. + if xsi.sample_port_pins(self._txv) == 1: + print "ERROR: Unexpected packet from xCORE" + + #print "Sending byte {0:#x}".format(byte) + + rxv_count = packet.get_data_valid_count(); + + if isinstance(packet, TokenPacket): + #print "Token packet, driving valid" + if packet.get_token_valid(): + xsi.drive_port_pins(self._vld, 1) + else: + xsi.drive_port_pins(self._vld, 0) + + # Wait for last byte + self.wait(lambda x: self._clock.is_high()) + self.wait(lambda x: self._clock.is_low()) + + xsi.drive_port_pins(self._rxdv, 0) + xsi.drive_port_pins(self._rxer, 0) + + rxa_end_delay = packet.rxa_end_delay + while rxa_end_delay != 0: + # Wait for RXA fall delay TODO, this should be configurable + self.wait(lambda x: self._clock.is_high()) + self.wait(lambda x: self._clock.is_low()) + rxa_end_delay = rxa_end_delay - 1 + + # xCore should not be trying to send if we are trying to send.. + if xsi.sample_port_pins(self._txv) == 1: + print "ERROR: Unexpected packet from xCORE" + + xsi.drive_port_pins(self._rxa, 0) + + #if self._verbose: + #print "Sent" + + print "Test done" + self.end_test() + + + diff --git a/tests/usb_phy_utmi.py b/tests/usb_phy_utmi.py new file mode 100644 index 00000000..bedabeca --- /dev/null +++ b/tests/usb_phy_utmi.py @@ -0,0 +1,181 @@ +import random +import xmostest +import sys +import zlib +from usb_packet import RxPacket, TokenPacket +from usb_phy import UsbPhy + +class UsbPhyUtmi(UsbPhy): + + def __init__(self, rxd, rxa, rxdv, rxer, txd, txv, txrdy, clock, + initial_delay=85000, verbose=False, test_ctrl=None, + do_timeout=True, complete_fn=None, expect_loopback=True, + dut_exit_time=25000): + super(UsbPhy, self).__init__('mii', rxd, rxa, rxdv, rxer, vld, txd, txv, txrdy, clock, + initial_delay, verbose, test_ctrl, + do_timeout, complete_fn, expect_loopback, + dut_exit_time) + + def run(self): + xsi = self.xsi + + self.start_test() + + for i,packet in enumerate(self._packets): + #error_nibbles = packet.get_error_nibbles() + + if isinstance(packet, RxPacket): + + timeout = packet.get_timeout() + + #print "Expecting pkt. Timeout in: {i}".format(i=timeout) + + in_rx_packet = False + rx_packet = [] + + while timeout != 0: + + self.wait(lambda x: self._clock.is_high()) + self.wait(lambda x: self._clock.is_low()) + + timeout = timeout - 1 + #print "{i}".format(i=timeout) + + #sample TXV for new packet + if xsi.sample_port_pins(self._txv) == 1: + print "Receiving packet {}".format(i) + in_rx_packet = True + break + + if in_rx_packet == False: + print "ERROR: Timed out waiting for packet" + + else: + #print "in packet" + while in_rx_packet == True: + + # TODO txrdy pulsing + xsi.drive_port_pins(self._txrdy, 1) + data = xsi.sample_port_pins(self._txd) + + print "Received byte: {0:#x}".format(data) + rx_packet.append(data) + + self.wait(lambda x: self._clock.is_high()) + self.wait(lambda x: self._clock.is_low()) + + if xsi.sample_port_pins(self._txv) == 0: + #print "TXV low, breaking out of loop" + in_rx_packet = False + + + + # End of packet + xsi.drive_port_pins(self._txrdy, 0) + + # Check packet agaist expected + expected = packet.get_bytes() + if len(expected) != len(rx_packet): + print "ERROR: Rx packet length bad. Expecting: {} actual: {}".format(len(expected), len(rx_packet)) + + # Check packet data against expected + if cmp(expected, rx_packet): + print "ERROR: Rx Packet Error. Expected:" + for item in expected: + print "{0:#x}".format(item) + + print "Received:" + for item in rx_packet: + print "{0:#x}".format(item) + else: + + + # xCore should not be trying to send if we are trying to send.. + if xsi.sample_port_pins(self._txv) == 1: + print "ERROR: Unexpected packet from xCORE" + + rxv_count = packet.get_data_valid_count(); + + #print "Waiting for inter_pkt_gap: {i}".format(i=packet.inter_frame_gap) + self.wait_until(xsi.get_time() + packet.inter_pkt_gap) + + print "Sending packet {} PID: {} ({})".format(i, packet.get_pid_pretty(), packet.pid) + if self._verbose: + sys.stdout.write(packet.dump()) + + # Set RXA high + xsi.drive_port_pins(self._rxa, 1) + + # Wait for RXA rise delay TODO, this should be configurable + self.wait(lambda x: self._clock.is_high()) + self.wait(lambda x: self._clock.is_low()) + + #if isinstance(packet, TokenPacket): + # print "Token packet, clear valid token" + xsi.drive_port_pins(self._vld, 0) + + for (i, byte) in enumerate(packet.get_bytes()): + + # xCore should not be trying to send if we are trying to send.. + if xsi.sample_port_pins(self._txv) == 1: + print "ERROR: Unexpected packet from xCORE" + + self.wait(lambda x: self._clock.is_low()) + + self.wait(lambda x: self._clock.is_high()) + self.wait(lambda x: self._clock.is_low()) + xsi.drive_port_pins(self._rxdv, 1) + xsi.drive_port_pins(self._rxd, byte) + + if (packet.rxe_assert_time != 0) and (packet.rxe_assert_time == i): + xsi.drive_port_pins(self._rxer, 1) + + while rxv_count != 0: + self.wait(lambda x: self._clock.is_high()) + self.wait(lambda x: self._clock.is_low()) + xsi.drive_port_pins(self._rxdv, 0) + rxv_count = rxv_count - 1 + + # xCore should not be trying to send if we are trying to send.. + if xsi.sample_port_pins(self._txv) == 1: + print "ERROR: Unexpected packet from xCORE" + + #print "Sending byte {0:#x}".format(byte) + + rxv_count = packet.get_data_valid_count(); + + if isinstance(packet, TokenPacket): + #print "Token packet, driving valid" + if packet.get_token_valid(): + xsi.drive_port_pins(self._vld, 1) + else: + xsi.drive_port_pins(self._vld, 0) + + # Wait for last byte + self.wait(lambda x: self._clock.is_high()) + self.wait(lambda x: self._clock.is_low()) + + xsi.drive_port_pins(self._rxdv, 0) + xsi.drive_port_pins(self._rxer, 0) + + rxa_end_delay = packet.rxa_end_delay + while rxa_end_delay != 0: + # Wait for RXA fall delay TODO, this should be configurable + self.wait(lambda x: self._clock.is_high()) + self.wait(lambda x: self._clock.is_low()) + rxa_end_delay = rxa_end_delay - 1 + + # xCore should not be trying to send if we are trying to send.. + if xsi.sample_port_pins(self._txv) == 1: + print "ERROR: Unexpected packet from xCORE" + + xsi.drive_port_pins(self._rxa, 0) + + #if self._verbose: + #print "Sent" + + print "Test done" + self.end_test() + + + From 35bee4f1b285491264f5e00bd7cefd01c3aa2766 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 24 Jun 2019 11:29:40 +0100 Subject: [PATCH 017/520] Tidy up port dec, extra file removed. --- lib_xud/src/core/XUD_Main.xc | 71 ++++++++++++++++++++++++----------- lib_xud/src/core/XUD_Ports.xc | 55 --------------------------- 2 files changed, 49 insertions(+), 77 deletions(-) delete mode 100644 lib_xud/src/core/XUD_Ports.xc diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index 939c77d6..e0b45368 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -269,32 +269,59 @@ unsigned g_txHandshakeTimeout; unsigned g_prevPid=0xbadf00d; unsigned int data_pid=0xbadf00d; -#if defined(ARCH_S) || defined (ARCH_X200) /* USB Port declarations - for Zevious with Galaxion */ -extern out port tx_readyout; // aka txvalid -extern in port tx_readyin; -extern out buffered port:32 p_usb_txd; -extern in buffered port:32 p_usb_rxd; -extern in port rx_rdy; -extern in port flag0_port; -extern in port flag1_port; -extern in port flag2_port; -extern in buffered port:32 p_usb_clk; -extern clock tx_usb_clk; -extern clock rx_usb_clk; -#define reg_write_port null -#define reg_read_port null +//extern out port tx_readyout; // aka txvalid +//extern in port tx_readyin; +//extern out buffered port:32 p_usb_txd; +//extern in buffered port:32 p_usb_rxd; +//extern in port rx_rdy; +//extern in port flag0_port; +//extern in port flag1_port; +//#if !defined(__XS3A__) +//extern in port flag2_port; +//#else +//#define flag2_port null +//#endif +//extern in buffered port:32 p_usb_clk; +//extern clock tx_usb_clk; +//extern clock rx_usb_clk; + +in port flag0_port = PORT_USB_FLAG0; /* For XS3: Mission: RXA */ +in port flag1_port = PORT_USB_FLAG1; /* For XS3: Mission: RXE */ + +#if !defined (__XS3A__) +in port flag2_port = PORT_USB_FLAG2; +#else +#define flag2_port null +#endif + +#if defined(ARCH_S) || defined(ARCH_X200) || defined(__XS3A__) +in buffered port:32 p_usb_clk = PORT_USB_CLK; +out buffered port:32 p_usb_txd = PORT_USB_TXD; +in buffered port:32 p_usb_rxd = PORT_USB_RXD; +out port tx_readyout = PORT_USB_TX_READYOUT; +in port tx_readyin = PORT_USB_TX_READYIN; +in port rx_rdy = PORT_USB_RX_READY; + +on USB_TILE: clock tx_usb_clk = XS1_CLKBLK_2; +on USB_TILE: clock rx_usb_clk = XS1_CLKBLK_3; + +#elif defined(ARCH_L) || defined(ARCH_G) + +in port p_usb_clk = PORT_USB_CLK; +out port reg_write_port = PORT_USB_REG_WRITE; +in port reg_read_port = PORT_USB_REG_READ; +out port p_usb_txd = PORT_USB_TXD; +port p_usb_rxd = PORT_USB_RXD; +in port p_usb_stp = PORT_USB_STP_SUS; #else -extern in buffered port:32 p_usb_clk; -extern out port reg_write_port; -extern in port reg_read_port; -extern in port flag0_port; -extern in port flag1_port; -extern in port flag2_port; -extern out port p_usb_txd; -extern port p_usb_rxd; +#error XUD_SERIES_SUPPORT not equal to XUD_U_SERIES, XUD_G_SERIES or XUD_L_SERIES #endif +// TODO RM ME +#define reg_read_port null +#define reg_write_port null + #ifdef XUD_ISO_OUT_COUNTER int xud_counter = 0; #endif diff --git a/lib_xud/src/core/XUD_Ports.xc b/lib_xud/src/core/XUD_Ports.xc deleted file mode 100644 index 61569b83..00000000 --- a/lib_xud/src/core/XUD_Ports.xc +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2015-2018, XMOS Ltd, All rights reserved -#include "xud.h" - -#if 0 -in port flag0_port = PORT_USB_FLAG0; -in port flag1_port = PORT_USB_FLAG1; -in port flag2_port = PORT_USB_FLAG2; - -in buffered port:32 p_usb_clk = PORT_USB_CLK; -out buffered port:32 p_usb_txd = PORT_USB_TXD; -in buffered port:32 p_usb_rxd = PORT_USB_RXD; -out port tx_readyout = PORT_USB_TX_READYOUT; -in port tx_readyin = PORT_USB_TX_READYIN; -in port rx_rdy = PORT_USB_RX_READY; - -// TODO - clockblocks should not be hard coded here */ -on USB_TILE: clock tx_usb_clk = XS1_CLKBLK_5; -on USB_TILE: clock rx_usb_clk = XS1_CLKBLK_4; - - - -#else -in port flag0_port = PORT_USB_FLAG0; -in port flag1_port = PORT_USB_FLAG1; -in port flag2_port = PORT_USB_FLAG2; - -//#if (XUD_SERIES_SUPPORT == XUD_U_SERIES) -#if defined(ARCH_S) || defined(ARCH_X200) - in buffered port:32 p_usb_clk = PORT_USB_CLK; - out buffered port:32 p_usb_txd = PORT_USB_TXD; - in buffered port:32 p_usb_rxd = PORT_USB_RXD; - out port tx_readyout = PORT_USB_TX_READYOUT; - in port tx_readyin = PORT_USB_TX_READYIN; - in port rx_rdy = PORT_USB_RX_READY; - - on USB_TILE: clock tx_usb_clk = XS1_CLKBLK_5; - on USB_TILE: clock rx_usb_clk = XS1_CLKBLK_4; - -//#elif (XUD_SERIES_SUPPORT == XUD_L_SERIES) || (XUD_SERIES_SUPPORT == XUD_G_SERIES) -#elif defined(ARCH_L) || defined(ARCH_G) - - in port p_usb_clk = PORT_USB_CLK; - out port reg_write_port = PORT_USB_REG_WRITE; - in port reg_read_port = PORT_USB_REG_READ; - out port p_usb_txd = PORT_USB_TXD; - port p_usb_rxd = PORT_USB_RXD; - in port p_usb_stp = PORT_USB_STP_SUS; -#else - #error XUD_SERIES_SUPPORT not equal to XUD_U_SERIES, XUD_G_SERIES or XUD_L_SERIES -#endif -#endif - - - - From b47007da0fcf152c7b7b2f8d9932d1982d437f02 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 24 Jun 2019 12:14:16 +0100 Subject: [PATCH 018/520] Added test xn files explicitly for each arch in test_bulk_rx_basic --- .../src/{test.xn => test_xs2.xn} | 0 tests/test_bulk_rx_basic/src/test_xs3.xn | 24 +++++++++++++++++++ tests/test_bulk_tx_basic/src/test_xs3.xn | 24 +++++++++++++++++++ 3 files changed, 48 insertions(+) rename tests/test_bulk_rx_basic/src/{test.xn => test_xs2.xn} (100%) create mode 100644 tests/test_bulk_rx_basic/src/test_xs3.xn create mode 100644 tests/test_bulk_tx_basic/src/test_xs3.xn diff --git a/tests/test_bulk_rx_basic/src/test.xn b/tests/test_bulk_rx_basic/src/test_xs2.xn similarity index 100% rename from tests/test_bulk_rx_basic/src/test.xn rename to tests/test_bulk_rx_basic/src/test_xs2.xn diff --git a/tests/test_bulk_rx_basic/src/test_xs3.xn b/tests/test_bulk_rx_basic/src/test_xs3.xn new file mode 100644 index 00000000..ab436573 --- /dev/null +++ b/tests/test_bulk_rx_basic/src/test_xs3.xn @@ -0,0 +1,24 @@ + + + + tileref tile[2] + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_tx_basic/src/test_xs3.xn b/tests/test_bulk_tx_basic/src/test_xs3.xn new file mode 100644 index 00000000..ab436573 --- /dev/null +++ b/tests/test_bulk_tx_basic/src/test_xs3.xn @@ -0,0 +1,24 @@ + + + + tileref tile[2] + + + + + + + + + + + + + + + + + + From 3e05e327e57117c63eee855ce902aab18db0e7ac Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 24 Jun 2019 12:18:28 +0100 Subject: [PATCH 019/520] - Mods to shim for xs3 - bulk_rx_basic now passes on xs3 - SetDevAddr modded for xs3 - Fixes to EP functions for xs3 - Removed L-series UIFM reg access functions --- lib_xud/api/xud.h | 29 +-- lib_xud/src/core/XUD_IoLoop.S | 29 +-- lib_xud/src/core/XUD_Main.xc | 233 +++++++------------ lib_xud/src/core/XUD_PowerSig.xc | 5 +- lib_xud/src/core/XUD_TestMode.xc | 39 +++- lib_xud/src/core/XUD_UIFM_RegAccess.S | 95 -------- lib_xud/src/core/included/XUD_PidJumpTable.S | 4 +- lib_xud/src/core/included/XUD_Token_Out.S | 2 +- lib_xud/src/user/client/XUD_EpFuncs.S | 21 +- lib_xud/src/user/client/XUD_SetDevAddr.xc | 43 ++-- tests/helpers.py | 27 +-- tests/test_bulk_rx_basic.py | 23 +- tests/test_bulk_rx_basic/Makefile | 16 +- tests/test_bulk_tx_basic.py | 21 +- tests/test_bulk_tx_basic/Makefile | 16 +- tests/usb_packet.py | 81 +++++-- tests/usb_phy_shim.py | 2 +- tests/usb_phy_utmi.py | 30 +-- 18 files changed, 295 insertions(+), 421 deletions(-) diff --git a/lib_xud/api/xud.h b/lib_xud/api/xud.h index 8a283578..9b0c7a71 100644 --- a/lib_xud/api/xud.h +++ b/lib_xud/api/xud.h @@ -6,6 +6,18 @@ #ifndef __xud_h__ #define __xud_h__ +#include + +#if defined(__XS1A__) || defined(__XS3A__) +#define XUD_OPT_SOFTCRC5 (1) +#else +#define XUD_OPT_SOFTCRC5 (0) +#endif + +#ifndef XUD_STARTUP_ADDRESS +#define XUD_STARTUP_ADDRESS (0) +#endif + #ifndef XUD_U_SERIES #define XUD_U_SERIES 1 @@ -69,7 +81,6 @@ #endif #if defined(PORT_USB_CLK) - /* Ports declared in the .xn file. Automatically detect device series */ #if defined(PORT_USB_RX_READY) #if !defined(XUD_SERIES_SUPPORT) @@ -99,8 +110,8 @@ #endif /* Ports have not been defined in the .xn file */ - - #if (XUD_SERIES_SUPPORT == XUD_U_SERIES) + #if defined (__XS1B__) +#error #define PORT_USB_CLK on USB_TILE: XS1_PORT_1J #define PORT_USB_TXD on USB_TILE: XS1_PORT_8A #define PORT_USB_RXD on USB_TILE: XS1_PORT_8C @@ -110,7 +121,7 @@ #define PORT_USB_FLAG0 on USB_TILE: XS1_PORT_1N #define PORT_USB_FLAG1 on USB_TILE: XS1_PORT_1O #define PORT_USB_FLAG2 on USB_TILE: XS1_PORT_1P - #elif (XUD_SERIES_SUPPORT == XUD_X200_SERIES) + #else // __XS3A__ and __XS2A__ #define PORT_USB_CLK on USB_TILE: XS1_PORT_1J #define PORT_USB_TXD on USB_TILE: XS1_PORT_8A #define PORT_USB_RXD on USB_TILE: XS1_PORT_8B @@ -120,16 +131,6 @@ #define PORT_USB_FLAG0 on USB_TILE: XS1_PORT_1E #define PORT_USB_FLAG1 on USB_TILE: XS1_PORT_1F #define PORT_USB_FLAG2 on USB_TILE: XS1_PORT_1G - #else - #define PORT_USB_CLK on USB_TILE: XS1_PORT_1H - #define PORT_USB_REG_WRITE on USB_TILE: XS1_PORT_8C - #define PORT_USB_REG_READ on USB_TILE: XS1_PORT_8D - #define PORT_USB_TXD on USB_TILE: XS1_PORT_8A - #define PORT_USB_RXD on USB_TILE: XS1_PORT_8B - #define PORT_USB_STP_SUS on USB_TILE: XS1_PORT_1E - #define PORT_USB_FLAG0 on USB_TILE: XS1_PORT_1N - #define PORT_USB_FLAG1 on USB_TILE: XS1_PORT_1O - #define PORT_USB_FLAG2 on USB_TILE: XS1_PORT_1P #endif #endif // PORT_USB_CLK diff --git a/lib_xud/src/core/XUD_IoLoop.S b/lib_xud/src/core/XUD_IoLoop.S index ac98f5e8..fd8603b0 100755 --- a/lib_xud/src/core/XUD_IoLoop.S +++ b/lib_xud/src/core/XUD_IoLoop.S @@ -191,7 +191,7 @@ ResetIntHandler: .align 4 XUD_LLD_IoLoop: -#if defined(__XS2A__) +#if defined(__XS2A__) || defined(__XS3A__) .issue_mode single ENTSP_lu6 STACK_EXTEND #else @@ -302,6 +302,7 @@ ConfigSofJump: ConfigSofJump_Done: +#if !defined (__XS3A__) ConfigRxErrEventVector: setc res[r3], XS1_SETC_COND_EQ setc res[r3], XS1_SETC_IE_MODE_INTERRUPT @@ -311,7 +312,7 @@ ConfigRxErrEventVector: setd res[r3], r11 // Set event cond data to 1 stw r3, sp[15] // Store flag port to stack eeu res[r3] - +#endif SetupSuspendResetTimer: @@ -363,7 +364,7 @@ NextTokenAfterPing: //------------------------------------------------------------------------------------------------ -#ifdef ARCH_L +#if defined(__XS2A__) || defined(__XS1B__) //ldw r1, sp[11] // Load Valid Token port ldaw r10, dp[PidJumpTable] // TODO Could load from sp here // Original USB Token: | CRC | EP | ADDR | PID | junk @@ -375,28 +376,13 @@ XUD_TokenRx_Pid: ldw r10, r10[r11] // Load relevant branch address -#if 1 BranchOnTokenPid: .xtabranch Pid_Out, Pid_Sof, Pid_In, Pid_Setup, Pid_Sof_NoChan bau r10 -#else -XUD_TokenRx_Ep: - inpw r10, res[RXD], 8 // Read EP Number - shr r10, r10, 24 // Shift off junk - -CheckValidToken: - in r1, res[r1] - bt r1, InvalidToken // If VALID_TOKEN not high, ignore token - // REMEMBER VALID TOKEN NOW INVERTED! +#else // XS3A -BranchOnTokenPid: -.xtabranch Pid_Out, Pid_Sof, Pid_In, Pid_Setup, Pid_Sof_NoChan - bau r11 // Branch on PID to relevant token handing code - // (e.g. in utmi_out.S etc). When done branchs back to NextToken -#endif -#else // ARCH_G ldc r4, 16 ReadToken: @@ -429,18 +415,13 @@ waitforRXALow0: // Un-implemented PID list Pid_Reserved: // Should never get here -//Pid_Out: Pid_Ack: -//Pid_Ping: -//Pid_Sof: // Should never get here: (G4) hardware swallows SOF Pid_NYet: Pid_Nyet: Pid_Data2: Pid_Split: -//Pid_In: Pid_Nak: Pid_Pre: -//Pid_Setup: Pid_Stall: Pid_MData: Pid_Datam: diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index e0b45368..70caa62a 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -28,17 +28,16 @@ void XUD_Error_hex(char errString[], int i_err); #include "XUD_DeviceAttach.h" #include "XUD_PowerSig.h" -#ifdef ARCH_L -#elif ARCH_G -#else -#error ARCH_L or ARCH_G must be defined +#if defined __XS3A__ +#undef __XS2A__ +#warning Building for XS3 #endif -#ifdef ARCH_S +#ifdef __XS1B__ #include "xs1_su_registers.h" #endif -#ifdef ARCH_X200 +#ifdef __XS2A__ #include "xs1_to_glx.h" #include "xs2_su_registers.h" #endif @@ -351,16 +350,14 @@ XUD_ep_info ep_info[USB_MAX_NUM_EP]; /* Sets the UIFM flags into a mode suitable for power signalling */ void XUD_UIFM_PwrSigFlags() { -#if defined(ARCH_X200) +#if defined(__XS2A__) write_periph_word(USB_TILE_REF, XS1_GLX_PER_UIFM_CHANEND_NUM, XS1_GLX_PER_UIFM_MASK_NUM, ((1< int _; @@ -602,23 +560,23 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c p_usb_clk when pinseq(1) :> int _; p_usb_clk when pinseq(0) :> int _; -#if !defined(ARCH_S) && !defined(ARCH_X200) - /* Configure ports and clock blocks for use with UIFM */ - XUD_UIFM_PortConfig(p_usb_clk, reg_write_port, reg_read_port, flag0_port, flag1_port, flag2_port, p_usb_txd, p_usb_rxd) ; - - //set_pad_delay(flag1_port, 5); - set_port_inv(flag0_port); - -#endif +//#if !defined(ARCH_S) && !defined(__XS2A__) && !defined(__XS3A__) +// /* Configure ports and clock blocks for use with UIFM */ +// XUD_UIFM_PortConfig(p_usb_clk, reg_write_port, reg_read_port, flag0_port, flag1_port, flag2_port, p_usb_txd, p_usb_rxd) ; +// +// //set_pad_delay(flag1_port, 5); +// set_port_inv(flag0_port); +// +// #endif #if (defined(ARCH_L) && !defined(ARCH_X200) && !defined(ARCH_S)) || defined(ARCH_G) /* For L/G series we wait for clock from phy, then enable UIFM logic */ // 3 u series, else 2 -#if defined (ARCH_S) + #if defined (ARCH_S) XUD_UIFM_Enable(3); //setps(XS1_PS_XCORE_CTRL0, UIFM_MODE); -#else + #else XUD_UIFM_Enable(2); //setps(XS1_PS_XCORE_CTRL0, UIFM_MODE); -#endif + #endif #endif #if defined(ARCH_X200) @@ -646,12 +604,12 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c write_periph_word(USB_TILE_REF, XS1_GLX_PER_UIFM_CHANEND_NUM, XS1_UIFM_USB_PHY_TUNE_REG, PHYTUNEREGVAL); #endif -#if defined(ARCH_S) || defined(ARCH_X200) #ifndef SIMULATION + #if defined(ARCH_S) || defined(ARCH_X200) write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_CONTROL_NUM, (1< reset; /* SE0 Line */ } -#endif /* Inspect for suspend or reset */ if(!reset) { @@ -732,7 +688,7 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c /* Run user resume code */ XUD_UserResume(); } - +#endif /* Test if coming back from reset or suspend */ if(reset==1) { @@ -742,8 +698,8 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c SendResetToEps(epChans0, epChans, epTypeTableOut, epTypeTableIn, noEpOut, noEpIn, USB_RESET_TOKEN); sentReset = 1; } -#ifdef ARCH_G - XUD_SetCrcTableAddr(0); +#ifdef __XS3A__ + XUD_SetCrcTableAddr(XUD_STARTUP_ADDRESS); #endif /* Reset the OUT ep structures */ for(int i = 0; i< noEpOut; i++) @@ -762,13 +718,13 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c ep_info[USB_MAX_NUM_EP_OUT+i].pid = USB_PIDn_DATA0; } - /* Set default device address */ -#if defined(ARCH_S) || defined(ARCH_X200) #ifndef SIMULATION + /* Set default device address */ + #if defined(__XS1B__) || defined(__XS2A__) write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_DEVICE_ADDRESS_NUM, 0); -#endif -#else - XUD_UIFM_RegWrite(reg_write_port, UIFM_REG_ADDRESS, 0x0); + #elif defined(__XS3A__) + // TODO + #endif #endif #ifdef SIMULATION @@ -821,67 +777,51 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c /* Set UIFM to CHECK TOKENS mode and enable LINESTATE_DECODE NOTE: Need to do this every iteration since CHKTOK would break power signaling */ -#ifdef ARCH_L -#if defined(ARCH_S) || defined(ARCH_X200) #ifndef SIMULATION + #if defined(__XS1B__) || defined(__XS2A__) write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_CONTROL_NUM, (1< #include @@ -49,7 +50,9 @@ extern buffered in port:32 p_usb_clk; extern in port reg_read_port; extern in port flag0_port; extern in port flag1_port; + extern in port flag2_port; + extern out port p_usb_txd; #if defined(ARCH_S) || defined(ARCH_X200) extern in buffered port:32 p_usb_rxd; @@ -455,4 +458,4 @@ int XUD_Suspend(XUD_PwrConfig pwrConfig) #endif } - +#endif diff --git a/lib_xud/src/core/XUD_TestMode.xc b/lib_xud/src/core/XUD_TestMode.xc index 1fbf73b7..2a8df8bb 100644 --- a/lib_xud/src/core/XUD_TestMode.xc +++ b/lib_xud/src/core/XUD_TestMode.xc @@ -25,7 +25,10 @@ extern tileref USB_TILE_REF; extern in port flag0_port; extern in port flag1_port; +#if !defined(__XS3A__) extern in port flag2_port; +#endif + #if defined(ARCH_S) || defined(ARCH_X200) extern out buffered port:32 p_usb_txd; #define reg_write_port null @@ -35,8 +38,8 @@ extern out port reg_write_port; extern in port reg_read_port; extern out port p_usb_txd; extern port p_usb_rxd; - #endif + #define TEST_PACKET_LEN 14 #define T_INTER_TEST_PACKET_us 2 #define T_INTER_TEST_PACKET (T_INTER_TEST_PACKET_us * REF_CLK_FREQ) @@ -60,11 +63,11 @@ unsigned int test_packet[TEST_PACKET_LEN] = 0xceb67efd }; - - int XUD_TestMode_TestJ () { -#if defined(ARCH_L) || defined(ARCH_X200) +#if defined (__XS3A__) + +#elif defined(ARCH_L) || defined(ARCH_X200) #else XUD_UIFM_RegWrite(reg_write_port, UIFM_REG_PHYCON, 0x15); @@ -82,7 +85,9 @@ int XUD_TestMode_TestJ () int XUD_TestMode_TestK () { -#if defined(ARCH_L) || defined(ARCH_X200) +#if defined(__XS3A__) + +#elif defined(ARCH_L) || defined(ARCH_X200) #else XUD_UIFM_RegWrite(reg_write_port, UIFM_REG_PHYCON, 0x15); @@ -130,14 +135,20 @@ int XUD_UsbTestModeHandler() { case USB_WINDEX_TEST_J: //Function Control Reg. Suspend: 1 Opmode 10 -#if defined(ARCH_X200) + +#if defined(__XS3A__) +#warning TODO +#elif defined(__XS2A__) write_periph_word(USB_TILE_REF, XS1_GLX_PER_UIFM_CHANEND_NUM, XS1_GLX_PER_UIFM_FUNC_CONTROL_NUM, 0b1000); -#elif defined(ARCH_S) +#elif defined (__XS1B__) + #if defined(ARCH_S) + /* U-series */ write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_FUNC_CONTROL_NUM, 0b1000); -#else + #else + /* L-series */ XUD_UIFM_RegWrite(reg_write_port, UIFM_REG_PHYCON, 0x11); + #endif #endif - while(1) { p_usb_txd <: 0xffffffff; @@ -146,12 +157,16 @@ int XUD_UsbTestModeHandler() case USB_WINDEX_TEST_K: //Function Control Reg. Suspend: 1 Opmode 10 -#if defined(ARCH_X200) +#if defined(__XS3A__) +#warning TODO +#elif defined(__XS2A__) write_periph_word(USB_TILE_REF, XS1_GLX_PER_UIFM_CHANEND_NUM, XS1_GLX_PER_UIFM_FUNC_CONTROL_NUM, 0b1000); -#elif defined(ARCH_S) +#elif defined(__XS1B__) + #if defined(ARCH_S) write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_FUNC_CONTROL_NUM, 0b1000); -#else + #else XUD_UIFM_RegWrite(reg_write_port, UIFM_REG_PHYCON, 0x11); + #endif #endif while(1) diff --git a/lib_xud/src/core/XUD_UIFM_RegAccess.S b/lib_xud/src/core/XUD_UIFM_RegAccess.S index 1bd39811..abaca586 100644 --- a/lib_xud/src/core/XUD_UIFM_RegAccess.S +++ b/lib_xud/src/core/XUD_UIFM_RegAccess.S @@ -42,99 +42,4 @@ XUD_UIFM_Enable: .set XUD_UIFM_Enable.maxcores, 1 .set XUD_UIFM_Enable.locnochandec, 1 -#if !defined (ARCH_S) && !defined (ARCH_X200) - -///////////////////////////////////////////////////////////////////////////////////////////// -// unsigned XUD_UIFM_RegRead(out port reg_write_port, in port reg_read_port, unsigned regNo); -.globl XUD_UIFM_RegRead -.type XUD_UIFM_RegRead, @function -.text - -.cc_top XUD_UIFM_RegRead.function -.align 4 -XUD_UIFM_RegRead: - - setc res[r1], XS1_SETC_RUN_CLRBUF - ldc r11, UIFM_CMD_READ // make register ID - or r3, r11, r2 - - out res[r0], r3 - syncr res[r0]; - in r0, res[r1] - - retsp 0 -.size XUD_UIFM_RegRead, .-XUD_UIFM_RegRead -.cc_bottom XUD_UIFM_RegRead.function -.globl XUD_UIFM_RegRead.nstackwords -.globl XUD_UIFM_RegRead.maxtimers -.globl XUD_UIFM_RegRead.maxchanends -.globl XUD_UIFM_RegRead.maxcores -.set XUD_UIFM_RegRead.nstackwords, 0 -.set XUD_UIFM_RegRead.maxtimers, 0 -.set XUD_UIFM_RegRead.maxchanends, 0 -.set XUD_UIFM_RegRead.maxcores, 1 - - -//////////////////////////////////////////////////////////////////////////////////////// -// void UifmWriteRead(out port reg_write_port, unsigned regNo, unsigned val); -.globl XUD_UIFM_RegWrite -.type XUD_UIFM_RegWrite, @function - -.text - -.cc_top XUD_UIFM_RegWrite.function -.align 4 -XUD_UIFM_RegWrite: - ldc r11, UIFM_CMD_WRITE - or r3, r11, r1 - - out res[r0], r3 - syncr res[r0]; - out res[r0], r2 - syncr res[r0]; - - retsp 0 -.size XUD_UIFM_RegWrite, .-XUD_UIFM_RegWrite -.cc_bottom XUD_UIFM_RegWrite.function -.globl XUD_UIFM_RegWrite.nstackwords -.globl XUD_UIFM_RegWrite.maxtimers -.globl XUD_UIFM_RegWrite.maxchanends -.globl XUD_UIFM_RegWrite.maxcores -.set XUD_UIFM_RegWrite.nstackwords, 0 -.set XUD_UIFM_RegWrite.maxtimers, 0 -.set XUD_UIFM_RegWrite.maxchanends, 0 -.set XUD_UIFM_RegWrite.maxcores, 1 - -// void XUD_UIFM_RegWrite_(unsigned regNo, unsigned val); -.globl XUD_UIFM_RegWrite_ -.type XUD_UIFM_RegWrite_, @function - -.text - -.cc_top XUD_UIFM_RegWrite_.function -.align 4 -XUD_UIFM_RegWrite_: - ldc r11, UIFM_CMD_WRITE - or r3, r11, r0 - ldw r2, dp[reg_write_port] - - out res[r2], r3 - syncr res[r2]; - out res[r2], r1 - syncr res[r2]; - - retsp 0 -.size XUD_UIFM_RegWrite_, .-XUD_UIFM_RegWrite_ -.cc_bottom XUD_UIFM_RegWrite_.function -.globl XUD_UIFM_RegWrite_.nstackwords -.globl XUD_UIFM_RegWrite_.maxtimers -.globl XUD_UIFM_RegWrite_.maxchanends -.globl XUD_UIFM_RegWrite_.maxcores -.set XUD_UIFM_RegWrite_.nstackwords, 0 -.set XUD_UIFM_RegWrite_.maxtimers, 0 -.set XUD_UIFM_RegWrite_.maxchanends, 0 -.set XUD_UIFM_RegWrite_.maxcores, 1 - - -#endif #endif diff --git a/lib_xud/src/core/included/XUD_PidJumpTable.S b/lib_xud/src/core/included/XUD_PidJumpTable.S index 418198ef..9d5ff042 100755 --- a/lib_xud/src/core/included/XUD_PidJumpTable.S +++ b/lib_xud/src/core/included/XUD_PidJumpTable.S @@ -1,5 +1,5 @@ // Copyright (c) 2011-2018, XMOS Ltd, All rights reserved -#ifdef ARCH_L +#if defined (__XS2A__) || defined(__XS1B__) // PID jump table .section .dp.data, "adw", @progbits @@ -282,7 +282,7 @@ PidJumpTable: #endif -#ifdef ARCH_G +#if defined(__XS1A__) || defined(__XS3A__) // Generated using genpidtable.c .section .dp.data, "adw", @progbits .globl PidJumpTable diff --git a/lib_xud/src/core/included/XUD_Token_Out.S b/lib_xud/src/core/included/XUD_Token_Out.S index 4ab61d1f..ec76c82b 100755 --- a/lib_xud/src/core/included/XUD_Token_Out.S +++ b/lib_xud/src/core/included/XUD_Token_Out.S @@ -83,7 +83,7 @@ DoOutNonIso: doRXDataReturn_NonIso: bf r1, NextTokenAfterOut // Check for bad crc - ldc r11, USB_PIDn_ACK // Data CRC good and EP not Iso: Send Ack + ldc r11, USB_PIDn_ACK // Data CRC good and EP not Iso: Send Ack outpw res[TXD], r11, 8 syncr res[TXD] diff --git a/lib_xud/src/user/client/XUD_EpFuncs.S b/lib_xud/src/user/client/XUD_EpFuncs.S index eebc6cca..a4987daa 100644 --- a/lib_xud/src/user/client/XUD_EpFuncs.S +++ b/lib_xud/src/user/client/XUD_EpFuncs.S @@ -17,7 +17,7 @@ .cc_top XUD_GetSetupData.func .align 4 XUD_GetSetupData: -#if defined(__XS2A__) +#if defined(__XS2A__) || defined(__XS3A__) .issue_mode single ENTSP_lu6 4 #else @@ -136,7 +136,7 @@ XUD_GetSetupData_Reset: .cc_top XUD_GetData.func .align 4 XUD_GetData: -#if defined(__XS2A__) +#if defined(__XS2A__) || defined(__XS3A__) .issue_mode single ENTSP_lu6 4 #else @@ -273,7 +273,7 @@ XUD_GetDataSetupData_ResetPid: // We must reset PID togglin .cc_top XUD_SetData.func .align 4 XUD_SetData: -#if defined(__XS2A__) +#if defined(__XS2A__) || defined(__XS3A__) .issue_mode single ENTSP_lu6 8 #else @@ -371,7 +371,7 @@ XUD_SetData_Reset: .cc_top XUD_GetData_Select.func .align 4 XUD_GetData_Select: -#if defined(__XS2A__) +#if defined(__XS2A__) || defined(__XS3A__) .issue_mode single ENTSP_lu6 0 #endif @@ -462,7 +462,7 @@ XUD_GetData_Select_Return_Reset: .cc_top XUD_SetData_Select.func .align 4 XUD_SetData_Select: -#if defined(__XS2A__) +#if defined(__XS2A__) || defined(__XS3A__) .issue_mode single ENTSP_lu6 0 #endif @@ -520,7 +520,7 @@ XUD_SetData_Select_Reset: .cc_top XUD_SetStallByAddr.func .align 4 XUD_SetStallByAddr: -#if defined(__XS2A__) +#if defined(__XS2A__) || defined(__XS3A__) .issue_mode single ENTSP_lu6 0 #endif @@ -566,7 +566,7 @@ XUD_SetStallByAddr_OUT: .cc_top XUD_ClearStallByAddr.func .align 4 XUD_ClearStallByAddr: -#if defined(__XS2A__) +#if defined(__XS2A__) || defined (__XS3A__) .issue_mode single ENTSP_lu6 0 #endif @@ -632,7 +632,7 @@ XUD_ClearStallByAddr_ResetDataPid: // Reset DATA PID to DATA0 .cc_top XUD_ResetEpStateByAddr.func .align 4 XUD_ResetEpStateByAddr: -#if defined(__XS2A__) +#if defined(__XS2A__) || defined(__XS3A__) .issue_mode single ENTSP_lu6 0 #endif @@ -642,7 +642,8 @@ XUD_ResetEpStateByAddr: ldc r1, USB_PIDn_DATA0 bu XUD_ResetEpStateByAddr_ XUD_ResetEpStateByAddr_OUT: -#if(XUD_SERIES_SUPPORT==3) +//#if(XUD_SERIES_SUPPORT==3) +#if defined(__XS1A__) //G-series ldc r1, USB_PIDn_DATA0 #else ldc r1, USB_PID_DATA0 @@ -687,7 +688,7 @@ NoOffset: .cc_top XUD_SetTestMode.func .align 4 XUD_SetTestMode: -#if defined(__XS2A__) +#if defined(__XS2A__) || defined(__XS3A__) .issue_mode single ENTSP_lu6 0 #endif diff --git a/lib_xud/src/user/client/XUD_SetDevAddr.xc b/lib_xud/src/user/client/XUD_SetDevAddr.xc index 98681a49..3e7e7a67 100644 --- a/lib_xud/src/user/client/XUD_SetDevAddr.xc +++ b/lib_xud/src/user/client/XUD_SetDevAddr.xc @@ -5,21 +5,24 @@ #include "XUD_UIFM_Defines.h" #include "xud.h" -#ifdef ARCH_S -#include +#if defined(ARCH_S) + #if !defined(__XS1B__) + #error + #else + #include + #endif #endif -#ifdef ARCH_X200 +#if defined(__XS2A__) #include "xs2_su_registers.h" #endif -#if defined(ARCH_S) || defined(ARCH_X200) +#if defined(ARCH_S) || defined(__XS2A__) #include "XUD_USBTile_Support.h" extern unsigned get_tile_id(tileref ref); extern tileref USB_TILE_REF; #endif - void XUD_SetCrcTableAddr(unsigned addr); /** @brief Sets the device addres in XUD @@ -27,23 +30,23 @@ void XUD_SetCrcTableAddr(unsigned addr); */ XUD_Result_t XUD_SetDevAddr(unsigned addr) { -#ifdef ARCH_L /* Set device address in UIFM */ -#if defined(ARCH_X200) - write_periph_word(USB_TILE_REF, XS1_GLX_PER_UIFM_CHANEND_NUM, XS1_GLX_PER_UIFM_DEVICE_ADDRESS_NUM, addr); -#elif defined(ARCH_S) - write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_DEVICE_ADDRESS_NUM, addr); -#else - /* RegWrite_ loads write port from dp to avoid parallel usage checks */ - /* TODO this should really be locked for mutual exclusion */ - XUD_UIFM_RegWrite_(UIFM_REG_ADDRESS, addr); -#endif - -#elif ARCH_G - /* Modify CRC table for current address */ - XUD_SetCrcTableAddr(addr); +#if defined(__XS2A__) + write_periph_word(USB_TILE_REF, XS1_GLX_PER_UIFM_CHANEND_NUM, XS1_GLX_PER_UIFM_DEVICE_ADDRESS_NUM, addr); +#elif defined(__XS1B__) + #if defined(ARCH_S) + write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_DEVICE_ADDRESS_NUM, addr); + #else + /* Vanilla XS1B/XS1-L */ + /* RegWrite_ loads write port from dp to avoid parallel usage checks */ + /* TODO this should really be locked for mutual exclusion */ + XUD_UIFM_RegWrite_(UIFM_REG_ADDRESS, addr); + #endif + #elif defined(__XS1A__) || defined (__XS3A__) + /* XS1A (XS1-G) and XS3: Modify CRC table for current address */ + XUD_SetCrcTableAddr(addr); #else -#error ARCH_L or ARCH_G MUST be defined + #error ARCH define error #endif return XUD_RES_OKAY; diff --git a/tests/helpers.py b/tests/helpers.py index 52c644d7..49e08b93 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -16,9 +16,12 @@ def create_if_needed(folder): os.makedirs(folder) return folder +#todo +dut_address = 1 + def get_usb_clk_phy(verbose=True, test_ctrl=None, do_timeout=True, complete_fn=None, expect_loopback=False, - dut_exit_time=350000, initial_del=40000, arch='xs2'): + dut_exit_time=350000, arch='xs2'): if arch=='xs2': clk = Clock('tile[0]:XS1_PORT_1J', Clock.CLK_60MHz) @@ -34,7 +37,7 @@ def get_usb_clk_phy(verbose=True, test_ctrl=None, do_timeout=True, verbose=verbose, test_ctrl=test_ctrl, do_timeout=do_timeout, complete_fn=complete_fn, expect_loopback=expect_loopback, - dut_exit_time=dut_exit_time, initial_delay=initial_del) + dut_exit_time=dut_exit_time) elif arch=='xs3': clk = Clock('tile[0]:XS1_PORT_1J', Clock.CLK_60MHz) @@ -49,7 +52,7 @@ def get_usb_clk_phy(verbose=True, test_ctrl=None, do_timeout=True, verbose=verbose, test_ctrl=test_ctrl, do_timeout=do_timeout, complete_fn=complete_fn, expect_loopback=expect_loopback, - dut_exit_time=dut_exit_time, initial_delay=initial_del) + dut_exit_time=dut_exit_time) elif arch=='xs1': @@ -66,7 +69,7 @@ def get_usb_clk_phy(verbose=True, test_ctrl=None, do_timeout=True, verbose=verbose, test_ctrl=test_ctrl, do_timeout=do_timeout, complete_fn=complete_fn, expect_loopback=expect_loopback, - dut_exit_time=dut_exit_time, initial_delay=initial_del) + dut_exit_time=dut_exit_time) return (clk, phy) @@ -82,7 +85,6 @@ def run_on(**kwargs): return True def runall_rx(test_fn): - if run_on(arch='xs3'): (clk_60, usb_phy) = get_usb_clk_phy(verbose=False, arch='xs3') @@ -95,7 +97,7 @@ def runall_rx(test_fn): test_fn('xs2', clk_60, usb_phy, seed) -def do_rx_test(arch, clk, phy, packets, test_file, seed, +def do_usb_test(arch, clk, phy, packets, test_file, seed, level='nightly', extra_tasks=[]): """ Shared test code for all RX tests using the test_rx application. @@ -114,7 +116,6 @@ def do_rx_test(arch, clk, phy, packets, test_file, seed, arch=arch, clk=clk.get_name(), seed=seed) phy.set_packets(packets) - #rx_phy.set_expected_packets(packets) expect_folder = create_if_needed("expect") expect_filename = '{folder}/{test}_{arch}.expect'.format( @@ -146,7 +147,7 @@ def create_expect(packets, filename): f.write("Received byte: {0:#x}\n".format(byte)) else: - f.write("Sending packet {} PID: {} ({})\n".format(i, packet.get_pid_pretty(), packet.pid)) + f.write("Phy transmitting packet {} PID: {} ({})\n".format(i, packet.get_pid_pretty(), packet.pid)) f.write("Test done\n") @@ -176,11 +177,11 @@ def packet_processing_time(phy, data_bytes): """ return 6000 * phy.get_clock().get_bit_time() -def get_dut_address(): - """ Returns the busaddress of the DUT - """ - #todo, we need the ability to config this - return 1 +#def get_dut_address(): +# """ Returns the busaddress of the DUT +# """ +# #TODO, we need the ability to config this +# return 1 def choose_small_frame_size(rand): """ Choose the size of a frame near the minimum size frame (46 data bytes) diff --git a/tests/test_bulk_rx_basic.py b/tests/test_bulk_rx_basic.py index 3972dc21..338a24fb 100644 --- a/tests/test_bulk_rx_basic.py +++ b/tests/test_bulk_rx_basic.py @@ -3,52 +3,49 @@ import random import xmostest from usb_packet import * -#import * AppendSetupToken, TxDataPacket, RxDataPacket, TokenPacket, RxHandshakePacket, TxHandshakePacket from usb_clock import Clock -from helpers import do_rx_test, packet_processing_time, get_dut_address -from helpers import choose_small_frame_size, check_received_packet, runall_rx - +from helpers import do_usb_test, runall_rx def do_test(arch, clk, phy, seed): rand = random.Random() rand.seed(seed) - dev_address = get_dut_address() ep = 1 + address = 1 # The inter-frame gap is to give the DUT time to print its output packets = [] dataval = 0; - AppendOutToken(packets, ep) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=10, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket()) + AppendOutToken(packets, ep, address) + packets.append(TxDataPacket(rand, data_start_val=dataval, length=10, pid=0x3, inter_pkt_gap = 400)) #DATA0 + packets.append(RxHandshakePacket(timeout=100)) # Note, quite big gap to allow checking. dataval += 10 - AppendOutToken(packets, ep, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, length=11, pid=0xb)) #DATA1 packets.append(RxHandshakePacket()) dataval += 11 - AppendOutToken(packets, ep, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, length=12, pid=0x3)) #DATA0 packets.append(RxHandshakePacket()) dataval += 12 - AppendOutToken(packets, ep, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, length=13, pid=0xb)) #DATA1 packets.append(RxHandshakePacket(timeout=9)) dataval += 13 - AppendOutToken(packets, ep, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, length=14, pid=0x3)) #DATA0 packets.append(RxHandshakePacket()) - do_rx_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): random.seed(1) diff --git a/tests/test_bulk_rx_basic/Makefile b/tests/test_bulk_rx_basic/Makefile index 4319e1c8..5270dfbe 100644 --- a/tests/test_bulk_rx_basic/Makefile +++ b/tests/test_bulk_rx_basic/Makefile @@ -20,20 +20,26 @@ APP_NAME = SHARED_CODE = ../../shared_src -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L -Wno-timing +COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -Wno-timing -XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES +XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -DARCH_L -XCC_FLAGS_xs1 = $(COMMON_FLAGS) -DARCH_S -DXUD_SERIES_SUPPORT=XUD_U_SERIES +XCC_FLAGS_xs1 = $(COMMON_FLAGS) -DARCH_S -DXUD_SERIES_SUPPORT=XUD_U_SERIES -DARCH_L + +XCC_FLAGS_xs3 = $(COMMON_FLAGS) -DXUD_STARTUP_ADDRESS=1 ifeq ($(CONFIG),$(filter $(CONFIG),xs1)) - TARGET = test_xs1.xn + TARGET = ../shared_src/test_xs1.xn endif ifeq ($(CONFIG),$(filter $(CONFIG),xs2)) - TARGET = test.xn + TARGET = test_xs2.xn +endif + +ifeq ($(CONFIG),$(filter $(CONFIG),xs3)) + TARGET = test_xs3.xn endif diff --git a/tests/test_bulk_tx_basic.py b/tests/test_bulk_tx_basic.py index 712ebe3f..298debe7 100644 --- a/tests/test_bulk_tx_basic.py +++ b/tests/test_bulk_tx_basic.py @@ -1,54 +1,49 @@ #!/usr/bin/env python - import random import xmostest from usb_packet import * -#import * AppendSetupToken, TxDataPacket, RxDataPacket, TokenPacket, RxHandshakePacket, TxHandshakePacket from usb_clock import Clock -from helpers import do_rx_test, packet_processing_time, get_dut_address -from helpers import choose_small_frame_size, check_received_packet, runall_rx - +from helpers import do_usb_test, runall_rx -# Single, setup transaction to EP 0 def do_test(arch, tx_clk, tx_phy, seed): rand = random.Random() rand.seed(seed) - dev_address = get_dut_address() ep = 2 + address = 1 # The inter-frame gap is to give the DUT time to print its output packets = [] dataval = 0; - AppendInToken(packets, ep) + AppendInToken(packets, ep, address) packets.append(RxDataPacket(rand, data_start_val=dataval, length=10, pid=0x3)) #DATA0 packets.append(TxHandshakePacket()) dataval += 10 - AppendInToken(packets, ep, inter_pkt_gap=4000) + AppendInToken(packets, ep, address, inter_pkt_gap=4000) packets.append(RxDataPacket(rand, data_start_val=dataval, length=11, pid=0xb)) #DATA1 packets.append(TxHandshakePacket()) dataval += 11 - AppendInToken(packets, ep, inter_pkt_gap=4000) + AppendInToken(packets, ep, address, inter_pkt_gap=4000) packets.append(RxDataPacket(rand, data_start_val=dataval, length=12, pid=0x3)) #DATA0 packets.append(TxHandshakePacket()) dataval += 12 - AppendInToken(packets, ep, inter_pkt_gap=4000) + AppendInToken(packets, ep, address, inter_pkt_gap=4000) packets.append(RxDataPacket(rand, data_start_val=dataval, length=13, pid=0xb)) #DATA1 packets.append(TxHandshakePacket()) dataval += 13 - AppendInToken(packets, ep, inter_pkt_gap=4000) + AppendInToken(packets, ep, address, inter_pkt_gap=4000) packets.append(RxDataPacket(rand, data_start_val=dataval, length=14, pid=0x3)) #DATA0 packets.append(TxHandshakePacket()) # Note, quite big gap to allow checking. - do_rx_test(arch, tx_clk, tx_phy, packets, __file__, seed, + do_usb_test(arch, tx_clk, tx_phy, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): diff --git a/tests/test_bulk_tx_basic/Makefile b/tests/test_bulk_tx_basic/Makefile index 4319e1c8..5270dfbe 100644 --- a/tests/test_bulk_tx_basic/Makefile +++ b/tests/test_bulk_tx_basic/Makefile @@ -20,20 +20,26 @@ APP_NAME = SHARED_CODE = ../../shared_src -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L -Wno-timing +COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -Wno-timing -XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES +XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -DARCH_L -XCC_FLAGS_xs1 = $(COMMON_FLAGS) -DARCH_S -DXUD_SERIES_SUPPORT=XUD_U_SERIES +XCC_FLAGS_xs1 = $(COMMON_FLAGS) -DARCH_S -DXUD_SERIES_SUPPORT=XUD_U_SERIES -DARCH_L + +XCC_FLAGS_xs3 = $(COMMON_FLAGS) -DXUD_STARTUP_ADDRESS=1 ifeq ($(CONFIG),$(filter $(CONFIG),xs1)) - TARGET = test_xs1.xn + TARGET = ../shared_src/test_xs1.xn endif ifeq ($(CONFIG),$(filter $(CONFIG),xs2)) - TARGET = test.xn + TARGET = test_xs2.xn +endif + +ifeq ($(CONFIG),$(filter $(CONFIG),xs3)) + TARGET = test_xs3.xn endif diff --git a/tests/usb_packet.py b/tests/usb_packet.py index 68cc9c6b..db4e53d9 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -3,32 +3,33 @@ import zlib import random -def AppendSetupToken(packets, ep, **kwargs): - ipg = kwargs.pop('inter_pkt_gap', 500) - AppendTokenPacket(packets, 0x2d, ep, ipg) +def AppendSetupToken(packets, ep, address, **kwargs): + ipg = kwargs.pop('inter_pkt_gap', 500) + address = kwargs.pop('address', 0) + AppendTokenPacket(packets, 0x2d, ep, ipg, address) -def AppendOutToken(packets, ep, **kwargs): +def AppendOutToken(packets, ep, address, **kwargs): ipg = kwargs.pop('inter_pkt_gap', 500) - AppendTokenPacket(packets, 0xe1, ep, ipg) + AppendTokenPacket(packets, 0xe1, ep, ipg, address) -def AppendPingToken(packets, ep, **kwargs): +def AppendPingToken(packets, ep, address, *kwargs): ipg = kwargs.pop('inter_pkt_gap', 500) - AppendTokenPacket(packets, 0xb4, ep, ipg) + AppendTokenPacket(packets, 0xb4, ep, ipg, address) -def AppendInToken(packets, ep, **kwargs): +def AppendInToken(packets, ep, address, **kwargs): #357 was min IPG supported on bulk loopback to not nak #lower values mean the loopback NAKs ipg = kwargs.pop('inter_pkt_gap', 10) - AppendTokenPacket(packets, 0x69, ep, ipg) + AppendTokenPacket(packets, 0x69, ep, ipg, address) -def AppendTokenPacket(packets, _pid, ep, ipg): +def AppendTokenPacket(packets, _pid, ep, ipg, addr=0): packets.append(TokenPacket( inter_pkt_gap=ipg, pid=_pid, - address=0, + address=addr, endpoint=ep)) def reflect(val, numBits): @@ -68,6 +69,35 @@ def GenCrc16(args): #print "CRC: : {0:#x}".format(crc) return crc; +def GenCrc5(args): + intSize = 32; + elevenBits = args + + poly5 = (0x05 << (intSize - 5)); + crc5 = (0x1F << (intSize - 5)); + udata = (elevenBits << (intSize - 11)); #crc over 11 bits + + iBitcnt = 11; + + while iBitcnt > 0: + if ((udata ^ crc5) & (0x1 << (intSize - 1))): #bit4 != bit4? + crc5 <<= 1; + crc5 ^= poly5; + else: + crc5 <<= 1; + udata <<= 1; + iBitcnt = iBitcnt-1 + + #Shift back into position + crc5 >>= intSize - 5; + + #Invert contents to generate crc field + crc5 ^= 0x1f; + + crc5 = reflect(crc5, 5); + return crc5; + + # Functions for creating the data contents of packets def create_data(args): f_name,f_args = args @@ -178,7 +208,7 @@ def get_crc(self, packet_bytes): crc = GenCrc16(packet_bytes) return crc - def get_bytes(self): + def get_bytes(self, do_tokens=False): bytes = [] bytes.append(self.pid) @@ -198,9 +228,6 @@ def get_bytes(self): return bytes - - - class RxDataPacket(RxPacket, DataPacket): def __init__(self, rand, **kwargs): @@ -223,14 +250,28 @@ def __init__(self, **kwargs): super(TokenPacket, self).__init__(**kwargs) self.endpoint = kwargs.pop('endpoint', 0) self.valid = kwargs.pop('valid', 1) - + self.address = kwargs.pop('address', 0) + self.crc5 = GenCrc5(reflect(((self.endpoint & 0xf)<<7) | ((self.address & 0x7f)<<0), 11)) + + # Always override to match IFM self.data_valid_count = 4 #todo - def get_bytes(self): + def get_bytes(self, do_tokens=False): bytes = [] - bytes.append(self.pid & 0xf) - bytes.append(self.endpoint) + + if do_tokens: + bytes.append(self.pid & 0xf) + bytes.append(self.endpoint) + else: + bytes.append(self.pid) + + tokenbyte0 = self.address | ((self.endpoint & 1) << 7); + tokenbyte1 = (self.endpoint >> 1) | (self.crc5 << 3) + + bytes.append(tokenbyte0); + bytes.append(tokenbyte1); + return bytes # Token valid @@ -243,7 +284,7 @@ def __init__(self, **kwargs): super(HandshakePacket, self).__init__(**kwargs) self.pid = kwargs.pop('pid', 0x2) #Default to ACK - def get_bytes(self): + def get_bytes(self, do_tokens=False): bytes = [] bytes.append(self.pid) return bytes diff --git a/tests/usb_phy_shim.py b/tests/usb_phy_shim.py index 8b4e7a82..6d60729c 100644 --- a/tests/usb_phy_shim.py +++ b/tests/usb_phy_shim.py @@ -118,7 +118,7 @@ def run(self): # print "Token packet, clear valid token" xsi.drive_port_pins(self._vld, 0) - for (i, byte) in enumerate(packet.get_bytes()): + for (i, byte) in enumerate(packet.get_bytes(do_tokens=True)): # xCore should not be trying to send if we are trying to send.. if xsi.sample_port_pins(self._txv) == 1: diff --git a/tests/usb_phy_utmi.py b/tests/usb_phy_utmi.py index bedabeca..66cb1d8d 100644 --- a/tests/usb_phy_utmi.py +++ b/tests/usb_phy_utmi.py @@ -8,13 +8,13 @@ class UsbPhyUtmi(UsbPhy): def __init__(self, rxd, rxa, rxdv, rxer, txd, txv, txrdy, clock, - initial_delay=85000, verbose=False, test_ctrl=None, + initial_delay=60000, verbose=False, test_ctrl=None, do_timeout=True, complete_fn=None, expect_loopback=True, dut_exit_time=25000): - super(UsbPhy, self).__init__('mii', rxd, rxa, rxdv, rxer, vld, txd, txv, txrdy, clock, + + super(UsbPhyUtmi, self).__init__('mii', rxd, rxa, rxdv, rxer, txd, txv, txrdy, clock, initial_delay, verbose, test_ctrl, - do_timeout, complete_fn, expect_loopback, - dut_exit_time) + do_timeout, complete_fn, expect_loopback, dut_exit_time) def run(self): xsi = self.xsi @@ -22,7 +22,6 @@ def run(self): self.start_test() for i,packet in enumerate(self._packets): - #error_nibbles = packet.get_error_nibbles() if isinstance(packet, RxPacket): @@ -49,9 +48,7 @@ def run(self): if in_rx_packet == False: print "ERROR: Timed out waiting for packet" - else: - #print "in packet" while in_rx_packet == True: # TODO txrdy pulsing @@ -67,9 +64,7 @@ def run(self): if xsi.sample_port_pins(self._txv) == 0: #print "TXV low, breaking out of loop" in_rx_packet = False - - - + # End of packet xsi.drive_port_pins(self._txrdy, 0) @@ -87,8 +82,10 @@ def run(self): print "Received:" for item in rx_packet: print "{0:#x}".format(item) + else: + #TokenPacket or TxPacket # xCore should not be trying to send if we are trying to send.. if xsi.sample_port_pins(self._txv) == 1: @@ -99,7 +96,7 @@ def run(self): #print "Waiting for inter_pkt_gap: {i}".format(i=packet.inter_frame_gap) self.wait_until(xsi.get_time() + packet.inter_pkt_gap) - print "Sending packet {} PID: {} ({})".format(i, packet.get_pid_pretty(), packet.pid) + print "Phy transmitting packet {} PID: {} ({})".format(i, packet.get_pid_pretty(), packet.pid) if self._verbose: sys.stdout.write(packet.dump()) @@ -110,10 +107,6 @@ def run(self): self.wait(lambda x: self._clock.is_high()) self.wait(lambda x: self._clock.is_low()) - #if isinstance(packet, TokenPacket): - # print "Token packet, clear valid token" - xsi.drive_port_pins(self._vld, 0) - for (i, byte) in enumerate(packet.get_bytes()): # xCore should not be trying to send if we are trying to send.. @@ -144,13 +137,6 @@ def run(self): rxv_count = packet.get_data_valid_count(); - if isinstance(packet, TokenPacket): - #print "Token packet, driving valid" - if packet.get_token_valid(): - xsi.drive_port_pins(self._vld, 1) - else: - xsi.drive_port_pins(self._vld, 0) - # Wait for last byte self.wait(lambda x: self._clock.is_high()) self.wait(lambda x: self._clock.is_low()) From c55a4932e51ae60b45a599263df011a72434b1d7 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 24 Jun 2019 12:19:01 +0100 Subject: [PATCH 020/520] Optimised SetCrcTableAddr() - much faster now! --- lib_xud/src/core/XUD_SetCrcTableAddr.c | 27 ++++++++------------------ 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/lib_xud/src/core/XUD_SetCrcTableAddr.c b/lib_xud/src/core/XUD_SetCrcTableAddr.c index c81e3497..fe62275e 100644 --- a/lib_xud/src/core/XUD_SetCrcTableAddr.c +++ b/lib_xud/src/core/XUD_SetCrcTableAddr.c @@ -3,7 +3,6 @@ * @author Ross Owen, XMOS Limited */ -#ifdef ARCH_G /* Global table used to store complete valid CRC5 table */ /* TODO Should be char */ @@ -20,25 +19,15 @@ extern unsigned char crc5Table_Addr[2048]; */ void XUD_SetCrcTableAddr(unsigned addr) { - int index, i, j; + unsigned index; - /* Addresses 0 - 0x7F */ - for (i = 0; i <= 0x7F; i++) + /* Set whole table to invalid CRC */ + memset(crc5Table_Addr, 0xff, 2048); + + /* Copy over relevant entries */ + for(unsigned ep = 0; ep <= 0xF; ep++) { - /* EPs 0 - 0xF */ - for(j = 0; j <= 0xF; j++) - { - index = i + (j<<7); - if(i == addr) - { - crc5Table_Addr[index] = crc5Table[index]; - } - else - { - /* Invalid CRC */ - crc5Table_Addr[index] = 0xff; - } - } + index = addr + (ep << 7); + crc5Table_Addr[index] = crc5Table[index]; } } -#endif From 4631e9f26d1f12fbfad96e9d463a7afca0a0e005 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 24 Jun 2019 14:48:15 +0100 Subject: [PATCH 021/520] Resolved issue with expect generation for xs3 (relating to handshake packets) --- tests/helpers.py | 8 +++++--- tests/usb_packet.py | 13 +++++++++++-- tests/usb_phy_shim.py | 4 ++-- tests/usb_phy_utmi.py | 2 +- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/tests/helpers.py b/tests/helpers.py index 49e08b93..1fc7f57f 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -120,7 +120,7 @@ def do_usb_test(arch, clk, phy, packets, test_file, seed, expect_folder = create_if_needed("expect") expect_filename = '{folder}/{test}_{arch}.expect'.format( folder=expect_folder, test=testname, phy=phy.get_name(), clk=clk.get_name(), arch=arch) - create_expect(packets, expect_filename) + create_expect(arch, packets, expect_filename) tester = xmostest.ComparisonTester(open(expect_filename), 'lib_xud', 'xud_sim_tests', testname, @@ -134,7 +134,9 @@ def do_usb_test(arch, clk, phy, packets, test_file, seed, tester=tester, simargs=simargs) -def create_expect(packets, filename): +def create_expect(arch, packets, filename): + do_tokens = (arch == "xs2") + """ Create the expect file for what packets should be reported by the DUT """ with open(filename, 'w') as f: @@ -143,7 +145,7 @@ def create_expect(packets, filename): if isinstance(packet, RxPacket): f.write("Receiving packet {}\n".format(i)) - for (i, byte) in enumerate(packet.get_bytes()): + for (i, byte) in enumerate(packet.get_bytes(do_tokens=do_tokens)): f.write("Received byte: {0:#x}\n".format(byte)) else: diff --git a/tests/usb_packet.py b/tests/usb_packet.py index db4e53d9..e0efdf8a 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -283,7 +283,7 @@ class HandshakePacket(UsbPacket): def __init__(self, **kwargs): super(HandshakePacket, self).__init__(**kwargs) self.pid = kwargs.pop('pid', 0x2) #Default to ACK - + def get_bytes(self, do_tokens=False): bytes = [] bytes.append(self.pid) @@ -295,9 +295,18 @@ def __init__(self, **kwargs): super(RxHandshakePacket, self).__init__(**kwargs) self.pid = kwargs.pop('pid', 0xd2) #Default to ACK (not expect inverted bits on Rx) self.timeout = kwargs.pop('timeout', 9) - + + class TxHandshakePacket(HandshakePacket, TxPacket): def __init__(self, **kwargs): super(TxHandshakePacket, self).__init__(**kwargs) + + def get_bytes(self, do_tokens=False): + bytes = [] + if do_tokens: + bytes.append(self.pid) + else: + bytes.append(self.pid | ((~self.pid) << 4)) + return bytes diff --git a/tests/usb_phy_shim.py b/tests/usb_phy_shim.py index 6d60729c..bd8e629a 100644 --- a/tests/usb_phy_shim.py +++ b/tests/usb_phy_shim.py @@ -78,7 +78,7 @@ def run(self): xsi.drive_port_pins(self._txrdy, 0) # Check packet agaist expected - expected = packet.get_bytes() + expected = packet.get_bytes(do_tokens=True) if len(expected) != len(rx_packet): print "ERROR: Rx packet length bad. Expecting: {} actual: {}".format(len(expected), len(rx_packet)) @@ -103,7 +103,7 @@ def run(self): #print "Waiting for inter_pkt_gap: {i}".format(i=packet.inter_frame_gap) self.wait_until(xsi.get_time() + packet.inter_pkt_gap) - print "Sending packet {} PID: {} ({})".format(i, packet.get_pid_pretty(), packet.pid) + print "Phy transmitting packet {} PID: {} ({})".format(i, packet.get_pid_pretty(), packet.pid) if self._verbose: sys.stdout.write(packet.dump()) diff --git a/tests/usb_phy_utmi.py b/tests/usb_phy_utmi.py index 66cb1d8d..07de2b4c 100644 --- a/tests/usb_phy_utmi.py +++ b/tests/usb_phy_utmi.py @@ -69,7 +69,7 @@ def run(self): xsi.drive_port_pins(self._txrdy, 0) # Check packet agaist expected - expected = packet.get_bytes() + expected = packet.get_bytes(do_tokens=False) if len(expected) != len(rx_packet): print "ERROR: Rx packet length bad. Expecting: {} actual: {}".format(len(expected), len(rx_packet)) From 70e336df200489fcb7013f0714f9a0b043692b8a Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 24 Jun 2019 15:35:28 +0100 Subject: [PATCH 022/520] Moved clearing RXA event data to RxALow - First packet was waiting for RXA to go low as no event data. --- lib_xud/src/core/included/XUD_Token_Setup.S | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib_xud/src/core/included/XUD_Token_Setup.S b/lib_xud/src/core/included/XUD_Token_Setup.S index d011c62c..5f7785e1 100644 --- a/lib_xud/src/core/included/XUD_Token_Setup.S +++ b/lib_xud/src/core/included/XUD_Token_Setup.S @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved .text @@ -20,13 +20,14 @@ WaitForEndDataPacket: .align 4 .skip 0 doRXData: - ldw r11, sp[10] // Load RxA Port ID (r1) - in r8, res[r11] // Doing an IN to clear any previous event data + ldw r10, sp[10] // Load RxA Port ID (r1) + //in r8, res[r10] // Doing an IN to clear any previous event data // - saves us havin to reload the port ID later... + // NOW MOVED TO RxALow inpw r8, res[r0], 8 // Input PID GotRxPid: stw r8, r3[6] // Store (NON-SHIFTED) PID into EP structure - eeu res[r11] + eeu res[r10] .syntax architectural SETSR_lu6 1 // Enable thread events. Note long inst to align loop .syntax default @@ -41,8 +42,9 @@ NextRxWord: // RXD port has event vector here ///////////////////////////////////////////////////////////////////////////// .align 16 -.skip 10 +.skip 8 RxALow: + in r11, res[r10] // Clear event data on RXA endin r8, res[r0] XUD_OUT_RxTail: in r11, res[r0] From fccf414e49ef9438cac5ee05edc70ee848d8b0b6 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 24 Jun 2019 15:36:39 +0100 Subject: [PATCH 023/520] Added shared test makefile --- tests/test_bulk_rx_basic/Makefile | 57 +------------------------- tests/test_bulk_rx_fastpacket/Makefile | 51 +---------------------- tests/test_bulk_tx_basic/Makefile | 57 +------------------------- tests/test_makefile.mak | 43 +++++++++++++++++++ 4 files changed, 46 insertions(+), 162 deletions(-) create mode 100644 tests/test_makefile.mak diff --git a/tests/test_bulk_rx_basic/Makefile b/tests/test_bulk_rx_basic/Makefile index 5270dfbe..6aed3e76 100644 --- a/tests/test_bulk_rx_basic/Makefile +++ b/tests/test_bulk_rx_basic/Makefile @@ -1,56 +1 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. - -TARGET = test.xn - -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name - -APP_NAME = - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. - -SHARED_CODE = ../../shared_src - -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -Wno-timing - -XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -DARCH_L - -XCC_FLAGS_xs1 = $(COMMON_FLAGS) -DARCH_S -DXUD_SERIES_SUPPORT=XUD_U_SERIES -DARCH_L - -XCC_FLAGS_xs3 = $(COMMON_FLAGS) -DXUD_STARTUP_ADDRESS=1 - - - -ifeq ($(CONFIG),$(filter $(CONFIG),xs1)) - TARGET = ../shared_src/test_xs1.xn -endif - -ifeq ($(CONFIG),$(filter $(CONFIG),xs2)) - TARGET = test_xs2.xn -endif - -ifeq ($(CONFIG),$(filter $(CONFIG),xs3)) - TARGET = test_xs3.xn -endif - - - -# The USED_MODULES variable lists other module used by the application. -USED_MODULES = lib_xud - - -#============================================================================= -# The following part of the Makefile includes the common build infrastructure -# for compiling XMOS applications. You should not need to edit below here. - -XMOS_MAKE_PATH ?= ../.. -include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common +include ../test_makefile.mak diff --git a/tests/test_bulk_rx_fastpacket/Makefile b/tests/test_bulk_rx_fastpacket/Makefile index 4319e1c8..6aed3e76 100644 --- a/tests/test_bulk_rx_fastpacket/Makefile +++ b/tests/test_bulk_rx_fastpacket/Makefile @@ -1,50 +1 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. - -TARGET = test.xn - -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name - -APP_NAME = - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. - -SHARED_CODE = ../../shared_src - -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L -Wno-timing - -XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES - -XCC_FLAGS_xs1 = $(COMMON_FLAGS) -DARCH_S -DXUD_SERIES_SUPPORT=XUD_U_SERIES - - - -ifeq ($(CONFIG),$(filter $(CONFIG),xs1)) - TARGET = test_xs1.xn -endif - -ifeq ($(CONFIG),$(filter $(CONFIG),xs2)) - TARGET = test.xn -endif - - - -# The USED_MODULES variable lists other module used by the application. -USED_MODULES = lib_xud - - -#============================================================================= -# The following part of the Makefile includes the common build infrastructure -# for compiling XMOS applications. You should not need to edit below here. - -XMOS_MAKE_PATH ?= ../.. -include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common +include ../test_makefile.mak diff --git a/tests/test_bulk_tx_basic/Makefile b/tests/test_bulk_tx_basic/Makefile index 5270dfbe..6aed3e76 100644 --- a/tests/test_bulk_tx_basic/Makefile +++ b/tests/test_bulk_tx_basic/Makefile @@ -1,56 +1 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. - -TARGET = test.xn - -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name - -APP_NAME = - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. - -SHARED_CODE = ../../shared_src - -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -Wno-timing - -XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -DARCH_L - -XCC_FLAGS_xs1 = $(COMMON_FLAGS) -DARCH_S -DXUD_SERIES_SUPPORT=XUD_U_SERIES -DARCH_L - -XCC_FLAGS_xs3 = $(COMMON_FLAGS) -DXUD_STARTUP_ADDRESS=1 - - - -ifeq ($(CONFIG),$(filter $(CONFIG),xs1)) - TARGET = ../shared_src/test_xs1.xn -endif - -ifeq ($(CONFIG),$(filter $(CONFIG),xs2)) - TARGET = test_xs2.xn -endif - -ifeq ($(CONFIG),$(filter $(CONFIG),xs3)) - TARGET = test_xs3.xn -endif - - - -# The USED_MODULES variable lists other module used by the application. -USED_MODULES = lib_xud - - -#============================================================================= -# The following part of the Makefile includes the common build infrastructure -# for compiling XMOS applications. You should not need to edit below here. - -XMOS_MAKE_PATH ?= ../.. -include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common +include ../test_makefile.mak diff --git a/tests/test_makefile.mak b/tests/test_makefile.mak new file mode 100644 index 00000000..a95d0141 --- /dev/null +++ b/tests/test_makefile.mak @@ -0,0 +1,43 @@ +# The TARGET variable determines what target system the application is +# compiled for. It either refers to an XN file in the source directories +# or a valid argument for the --target option when compiling. + +TARGET = test.xn + +# The APP_NAME variable determines the name of the final .xe file. It should +# not include the .xe postfix. If left blank the name will default to +# the project name + +APP_NAME = + +# The flags passed to xcc when building the application +# You can also set the following to override flags for a particular language: +# +# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS +# +# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to +# xcc for the final link (mapping) stage. + +SHARED_CODE = ../../shared_src + +COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -Wno-timing + +XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -DARCH_L + +XCC_FLAGS_xs1 = $(COMMON_FLAGS) -DARCH_S -DXUD_SERIES_SUPPORT=XUD_U_SERIES -DARCH_L + +XCC_FLAGS_xs3 = $(COMMON_FLAGS) -DXUD_STARTUP_ADDRESS=1 + + +TARGET = test_$(CONFIG).xn + +# The USED_MODULES variable lists other module used by the application. +USED_MODULES = lib_xud + + +#============================================================================= +# The following part of the Makefile includes the common build infrastructure +# for compiling XMOS applications. You should not need to edit below here. + +XMOS_MAKE_PATH ?= ../.. +include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common From ed98727a311127531e09ee836f2ddd707c191f75 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 24 Jun 2019 15:37:09 +0100 Subject: [PATCH 024/520] Fixes for xs3 test_bulk_rx_fastpacket test --- tests/test_bulk_rx_fastpacket.py | 9 ++- tests/test_bulk_rx_fastpacket/src/test_xs2.xn | 72 +++++++++++++++++++ tests/test_bulk_rx_fastpacket/src/test_xs3.xn | 24 +++++++ tests/test_bulk_tx_basic/src/test_xs2.xn | 72 +++++++++++++++++++ 4 files changed, 172 insertions(+), 5 deletions(-) create mode 100644 tests/test_bulk_rx_fastpacket/src/test_xs2.xn create mode 100644 tests/test_bulk_rx_fastpacket/src/test_xs3.xn create mode 100644 tests/test_bulk_tx_basic/src/test_xs2.xn diff --git a/tests/test_bulk_rx_fastpacket.py b/tests/test_bulk_rx_fastpacket.py index e3ea2691..7e45b97b 100644 --- a/tests/test_bulk_rx_fastpacket.py +++ b/tests/test_bulk_rx_fastpacket.py @@ -4,14 +4,13 @@ import xmostest from usb_packet import * from usb_clock import Clock -from helpers import do_rx_test, packet_processing_time, get_dut_address -from helpers import choose_small_frame_size, check_received_packet, runall_rx +from helpers import do_usb_test, runall_rx def do_test(arch, clk, phy, seed): rand = random.Random() rand.seed(seed) - dev_address = get_dut_address() + dev_address = 1 ep_loopback = 3 # The inter-frame gap is to give the DUT time to print its output @@ -25,14 +24,14 @@ def do_test(arch, clk, phy, seed): # min 237 # increased to 277 when SETUP/OUT checking added - AppendOutToken(packets, ep_loopback, inter_pkt_gap=277) + AppendOutToken(packets, ep_loopback, dev_address, inter_pkt_gap=277) packets.append(TxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) #DATA0 packets.append(RxHandshakePacket(timeout=9)) data_val = data_val + pkt_length data_pid = data_pid ^ 8 - do_rx_test(arch, clk, phy, packets, __file__, seed, + do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): diff --git a/tests/test_bulk_rx_fastpacket/src/test_xs2.xn b/tests/test_bulk_rx_fastpacket/src/test_xs2.xn new file mode 100644 index 00000000..d0ee86b8 --- /dev/null +++ b/tests/test_bulk_rx_fastpacket/src/test_xs2.xn @@ -0,0 +1,72 @@ + + + Board + XS2 MC Audio + + tileref tile[2] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_rx_fastpacket/src/test_xs3.xn b/tests/test_bulk_rx_fastpacket/src/test_xs3.xn new file mode 100644 index 00000000..ab436573 --- /dev/null +++ b/tests/test_bulk_rx_fastpacket/src/test_xs3.xn @@ -0,0 +1,24 @@ + + + + tileref tile[2] + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_tx_basic/src/test_xs2.xn b/tests/test_bulk_tx_basic/src/test_xs2.xn new file mode 100644 index 00000000..d0ee86b8 --- /dev/null +++ b/tests/test_bulk_tx_basic/src/test_xs2.xn @@ -0,0 +1,72 @@ + + + Board + XS2 MC Audio + + tileref tile[2] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From a387eeb26cfb87f043bbe19592f5ba86eb10f7ad Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 24 Jun 2019 15:52:55 +0100 Subject: [PATCH 025/520] Fix to moving RxA event data read. May effect inter packet delay after rx (one instruction added) --- lib_xud/src/core/XUD_IoLoop.S | 2 +- lib_xud/src/core/included/XUD_Token_Setup.S | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/lib_xud/src/core/XUD_IoLoop.S b/lib_xud/src/core/XUD_IoLoop.S index fd8603b0..8d48ee89 100755 --- a/lib_xud/src/core/XUD_IoLoop.S +++ b/lib_xud/src/core/XUD_IoLoop.S @@ -346,9 +346,9 @@ SetupSuspendResetTimer: NextToken: ldc r9, 0xa001 // CRC16 poly, used in doRxData ldw r5, sp[(STACK_EXTEND+7)] // EP structures array - pointers to EP tables or 0 - ldc r7, 0xf335 // TX Crc init NextTokenAfterOut: + ldc r7, 0xf335 // TX Crc init ldc r6, 0x3334 // CRC16 init (out) - Needs reseting after an out #ifndef ARCH_G ldw r1, sp[STACK_FLAG0_PORT] diff --git a/lib_xud/src/core/included/XUD_Token_Setup.S b/lib_xud/src/core/included/XUD_Token_Setup.S index 5f7785e1..6bcd7963 100644 --- a/lib_xud/src/core/included/XUD_Token_Setup.S +++ b/lib_xud/src/core/included/XUD_Token_Setup.S @@ -11,23 +11,27 @@ WaitForEndDataPacket: bu NextTokenAfterOut #endif -// Expects +// r3: Ep structure // r5: buffer address // RXD: Rx Data port // r4: zero -// r7: crc init +// r5: ep structures array +// r6: crc rx init +// r7: crc tx init // r9: crc poly +// r10: ep number +// r11: scratch .align 4 .skip 0 doRXData: - ldw r10, sp[10] // Load RxA Port ID (r1) - //in r8, res[r10] // Doing an IN to clear any previous event data + ldw r7, sp[10] // Load RxA Port ID (r1) + //in r8, res[r10] // Doing an IN to clear any previous event data // - saves us havin to reload the port ID later... // NOW MOVED TO RxALow inpw r8, res[r0], 8 // Input PID GotRxPid: stw r8, r3[6] // Store (NON-SHIFTED) PID into EP structure - eeu res[r10] + eeu res[r7] .syntax architectural SETSR_lu6 1 // Enable thread events. Note long inst to align loop .syntax default @@ -44,7 +48,7 @@ NextRxWord: // RXD port has event vector here .align 16 .skip 8 RxALow: - in r11, res[r10] // Clear event data on RXA + in r7, res[r7] // Clear event data on RXA endin r8, res[r0] XUD_OUT_RxTail: in r11, res[r0] From 732859e0ce5d2a42d89469f9ace3edc7cff37795 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 24 Jun 2019 16:36:33 +0100 Subject: [PATCH 026/520] Minor opt of transmit small packet with tail size 2 (TxTail2s). --- lib_xud/src/core/included/XUD_Token_In.S | 39 ++++++++---------------- 1 file changed, 13 insertions(+), 26 deletions(-) diff --git a/lib_xud/src/core/included/XUD_Token_In.S b/lib_xud/src/core/included/XUD_Token_In.S index ae672075..5c878fb1 100755 --- a/lib_xud/src/core/included/XUD_Token_In.S +++ b/lib_xud/src/core/included/XUD_Token_In.S @@ -271,15 +271,8 @@ BadHandShake: // Received a bad (or no)handshake .skip 28 SmallTxPacket: ldw r8, r8[r4] // Load first data word -// inct r8, res[r5] // Input tail length + 10 - //inct r6, res[r5] // get end of packet token - //sub r8, r8, 10 - //in r6, res[r5] // Input tail data - //shl r8, r8, 4 // Tail length bytes to bits *2 - -// shr r8, r8, 1 - - .xtabranch TxTail0s, TxTail1s, TxTail2s, TxTail3s + +.xtabranch TxTail0s, TxTail1s, TxTail2s, TxTail3s bru r6 // branch taillength //-------------------------------------------------------------------------- @@ -320,29 +313,23 @@ XUD_IN_TxCrc_TailS1: .align 64 .skip 0 TxTail2s: - ldc r6, 0 + ldc r6, 0 + // Two tail byte shl r8, r8, 8 - or r11, r11, r8 + or r11, r11, r8 // r11: D1 | D0 | PID shr r8, r8, 8 - //outpw res[TXD], r11, 8 // PID - //outpw res[TXD], r6, 16 - - crc8 r7, r8, r8, r9 - crc8 r7, r8, r8, r9 - crc32 r7, r6, r9 // r5: 0 - not r7, r7 - shr r6, r7, 8 - - shl r7, r7, 24 - zext r11, 24 - or r11, r11, r7 + XUD_IN_TxPid_TailS2: - out res[TXD], r11 -// outpw res[TXD], r7, 16 + outpw res[TXD], r11, 24 + + crc8 r7, r8, r8, r9 + crc8 r7, r8, r8, r9 + crc32 r7, r6, r9 // r6: 0 + not r7, r7 XUD_IN_TxCrc_TailS2: - outpw res[TXD], r6, 8 + outpw res[TXD], r7, 16 bu DoneTail .align 64 From 0da64652aca2b5865e1d5c159ea08d9ffd37bfee Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 24 Jun 2019 16:36:53 +0100 Subject: [PATCH 027/520] Fixes to test_bulk_loopback.py --- tests/test_bulk_loopback.py | 15 ++-- tests/test_bulk_loopback/Makefile | 51 +---------- tests/test_bulk_loopback/test_xs1.xn | 89 +++++++++++++++++++ tests/test_bulk_loopback/test_xs2.xn | 72 +++++++++++++++ tests/test_bulk_loopback/test_xs3.xn | 24 +++++ tests/test_bulk_tx_fastpacket.py | 8 +- tests/test_bulk_tx_fastpacket/Makefile | 51 +---------- tests/test_bulk_tx_fastpacket/src/test_xs2.xn | 72 +++++++++++++++ tests/test_bulk_tx_fastpacket/src/test_xs3.xn | 24 +++++ 9 files changed, 294 insertions(+), 112 deletions(-) create mode 100755 tests/test_bulk_loopback/test_xs1.xn create mode 100644 tests/test_bulk_loopback/test_xs2.xn create mode 100644 tests/test_bulk_loopback/test_xs3.xn create mode 100644 tests/test_bulk_tx_fastpacket/src/test_xs2.xn create mode 100644 tests/test_bulk_tx_fastpacket/src/test_xs3.xn diff --git a/tests/test_bulk_loopback.py b/tests/test_bulk_loopback.py index 99dcbdd4..e272645b 100644 --- a/tests/test_bulk_loopback.py +++ b/tests/test_bulk_loopback.py @@ -4,8 +4,7 @@ import xmostest from usb_packet import * from usb_clock import Clock -from helpers import do_rx_test, packet_processing_time, get_dut_address -from helpers import choose_small_frame_size, check_received_packet, runall_rx +from helpers import do_usb_test, runall_rx def do_test(arch, clk, phy, seed): @@ -14,6 +13,7 @@ def do_test(arch, clk, phy, seed): ep_loopback = 3 ep_loopback_kill = 2 + address = 1 # The inter-frame gap is to give the DUT time to print its output packets = [] @@ -23,14 +23,14 @@ def do_test(arch, clk, phy, seed): for pkt_length in range(0, 20): - AppendOutToken(packets, ep_loopback) + AppendOutToken(packets, ep_loopback, address) packets.append(TxDataPacket(rand, data_start_val=dataval, length=pkt_length, pid=data_pid)) #DATA0 packets.append(RxHandshakePacket(timeout=9)) # 357 was min IPG supported on bulk loopback to not nak # For move from sc_xud to lib_xud (14.1.2 tools) had to increase this to 377 # Increased again due to setup/out checking - AppendInToken(packets, ep_loopback, inter_pkt_gap=417) + AppendInToken(packets, ep_loopback, address, inter_pkt_gap=417) packets.append(RxDataPacket(rand, data_start_val=dataval, length=pkt_length, pid=data_pid, timeout=9)) #DATA0 packets.append(TxHandshakePacket()) @@ -39,16 +39,15 @@ def do_test(arch, clk, phy, seed): pkt_length = 10 #Loopback and die.. - AppendOutToken(packets, ep_loopback_kill) + AppendOutToken(packets, ep_loopback_kill, address) packets.append(TxDataPacket(rand, length=pkt_length, pid=3)) #DATA0 packets.append(RxHandshakePacket()) - AppendInToken(packets, ep_loopback_kill, inter_pkt_gap=400) + AppendInToken(packets, ep_loopback_kill, address, inter_pkt_gap=400) packets.append(RxDataPacket(rand, length=pkt_length, pid=3)) #DATA0 packets.append(TxHandshakePacket()) - - do_rx_test(arch, clk, phy, packets, __file__, seed, + do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): diff --git a/tests/test_bulk_loopback/Makefile b/tests/test_bulk_loopback/Makefile index 4319e1c8..6aed3e76 100644 --- a/tests/test_bulk_loopback/Makefile +++ b/tests/test_bulk_loopback/Makefile @@ -1,50 +1 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. - -TARGET = test.xn - -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name - -APP_NAME = - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. - -SHARED_CODE = ../../shared_src - -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L -Wno-timing - -XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES - -XCC_FLAGS_xs1 = $(COMMON_FLAGS) -DARCH_S -DXUD_SERIES_SUPPORT=XUD_U_SERIES - - - -ifeq ($(CONFIG),$(filter $(CONFIG),xs1)) - TARGET = test_xs1.xn -endif - -ifeq ($(CONFIG),$(filter $(CONFIG),xs2)) - TARGET = test.xn -endif - - - -# The USED_MODULES variable lists other module used by the application. -USED_MODULES = lib_xud - - -#============================================================================= -# The following part of the Makefile includes the common build infrastructure -# for compiling XMOS applications. You should not need to edit below here. - -XMOS_MAKE_PATH ?= ../.. -include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common +include ../test_makefile.mak diff --git a/tests/test_bulk_loopback/test_xs1.xn b/tests/test_bulk_loopback/test_xs1.xn new file mode 100755 index 00000000..573aef45 --- /dev/null +++ b/tests/test_bulk_loopback/test_xs1.xn @@ -0,0 +1,89 @@ + + + + + tileref tile[1] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_loopback/test_xs2.xn b/tests/test_bulk_loopback/test_xs2.xn new file mode 100644 index 00000000..d0ee86b8 --- /dev/null +++ b/tests/test_bulk_loopback/test_xs2.xn @@ -0,0 +1,72 @@ + + + Board + XS2 MC Audio + + tileref tile[2] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_loopback/test_xs3.xn b/tests/test_bulk_loopback/test_xs3.xn new file mode 100644 index 00000000..ab436573 --- /dev/null +++ b/tests/test_bulk_loopback/test_xs3.xn @@ -0,0 +1,24 @@ + + + + tileref tile[2] + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_tx_fastpacket.py b/tests/test_bulk_tx_fastpacket.py index 4f7e736d..3f8fc242 100644 --- a/tests/test_bulk_tx_fastpacket.py +++ b/tests/test_bulk_tx_fastpacket.py @@ -4,13 +4,13 @@ import xmostest from usb_packet import * from usb_clock import Clock -from helpers import do_rx_test, packet_processing_time, get_dut_address -from helpers import choose_small_frame_size, check_received_packet, runall_rx +from helpers import do_usb_test, runall_rx def do_test(arch, clk, phy, seed): rand = random.Random() rand.seed(seed) + address = 1 ep = 3 # The inter-frame gap is to give the DUT time to print its output @@ -24,14 +24,14 @@ def do_test(arch, clk, phy, seed): #317 lowest for valid data (non-dual issue version) #337 for initial dual-issue version - AppendInToken(packets, ep, inter_pkt_gap=337) + AppendInToken(packets, ep, address, inter_pkt_gap=337) packets.append(RxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) packets.append(TxHandshakePacket()) data_val = data_val + pkt_length data_pid = data_pid ^ 8 - do_rx_test(arch, clk, phy, packets, __file__, seed, + do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): diff --git a/tests/test_bulk_tx_fastpacket/Makefile b/tests/test_bulk_tx_fastpacket/Makefile index 4319e1c8..6aed3e76 100644 --- a/tests/test_bulk_tx_fastpacket/Makefile +++ b/tests/test_bulk_tx_fastpacket/Makefile @@ -1,50 +1 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. - -TARGET = test.xn - -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name - -APP_NAME = - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. - -SHARED_CODE = ../../shared_src - -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L -Wno-timing - -XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES - -XCC_FLAGS_xs1 = $(COMMON_FLAGS) -DARCH_S -DXUD_SERIES_SUPPORT=XUD_U_SERIES - - - -ifeq ($(CONFIG),$(filter $(CONFIG),xs1)) - TARGET = test_xs1.xn -endif - -ifeq ($(CONFIG),$(filter $(CONFIG),xs2)) - TARGET = test.xn -endif - - - -# The USED_MODULES variable lists other module used by the application. -USED_MODULES = lib_xud - - -#============================================================================= -# The following part of the Makefile includes the common build infrastructure -# for compiling XMOS applications. You should not need to edit below here. - -XMOS_MAKE_PATH ?= ../.. -include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common +include ../test_makefile.mak diff --git a/tests/test_bulk_tx_fastpacket/src/test_xs2.xn b/tests/test_bulk_tx_fastpacket/src/test_xs2.xn new file mode 100644 index 00000000..d0ee86b8 --- /dev/null +++ b/tests/test_bulk_tx_fastpacket/src/test_xs2.xn @@ -0,0 +1,72 @@ + + + Board + XS2 MC Audio + + tileref tile[2] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_tx_fastpacket/src/test_xs3.xn b/tests/test_bulk_tx_fastpacket/src/test_xs3.xn new file mode 100644 index 00000000..ab436573 --- /dev/null +++ b/tests/test_bulk_tx_fastpacket/src/test_xs3.xn @@ -0,0 +1,24 @@ + + + + tileref tile[2] + + + + + + + + + + + + + + + + + + From 92da3d37a54ab6d47daefe54f52f19339cc1b121 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 25 Jun 2019 23:26:35 +0100 Subject: [PATCH 028/520] - Fixed issue with CRC get for iso IN after OUT - Various test fixes, all active tests run (28/36 pass) --- lib_xud/src/core/included/XUD_Token_Out.S | 3 +- tests/test_bulk_rx_basic_badcrc32.py | 24 +++---- tests/test_bulk_rx_basic_badcrc32/Makefile | 51 +------------ .../src/test_xs2.xn | 72 +++++++++++++++++++ .../src/test_xs3.xn | 24 +++++++ tests/test_bulk_rx_basic_badpid.py | 21 +++--- tests/test_bulk_rx_basic_badpid/Makefile | 51 +------------ .../test_bulk_rx_basic_badpid/src/test_xs2.xn | 72 +++++++++++++++++++ .../test_bulk_rx_basic_badpid/src/test_xs3.xn | 24 +++++++ tests/test_bulk_rx_basic_rxerror.py | 28 +++----- tests/test_bulk_rx_basic_rxerror/Makefile | 51 +------------ .../src/test_xs2.xn | 72 +++++++++++++++++++ .../src/test_xs3.xn | 24 +++++++ tests/test_bulk_rx_fastpacket_multiep.py | 14 ++-- .../test_bulk_rx_fastpacket_multiep/Makefile | 51 +------------ .../src/test_xs2.xn | 72 +++++++++++++++++++ .../src/test_xs3.xn | 24 +++++++ tests/test_bulk_rxtx_fastpacket.py | 11 ++- tests/test_bulk_rxtx_fastpacket/Makefile | 51 +------------ .../test_bulk_rxtx_fastpacket/src/test_xs2.xn | 72 +++++++++++++++++++ .../test_bulk_rxtx_fastpacket/src/test_xs3.xn | 24 +++++++ tests/test_bulk_tx_basic_noack.py | 20 +++--- tests/test_bulk_tx_basic_noack/Makefile | 51 +------------ .../test_bulk_tx_basic_noack/src/test_xs2.xn | 72 +++++++++++++++++++ .../test_bulk_tx_basic_noack/src/test_xs3.xn | 24 +++++++ tests/test_bulk_tx_fastpacket_multiep.py | 15 ++-- .../test_bulk_tx_fastpacket_multiep/Makefile | 51 +------------ .../src/test_xs2.xn | 72 +++++++++++++++++++ .../src/test_xs3.xn | 24 +++++++ tests/test_invalidtoken.py | 34 ++++----- tests/test_invalidtoken/Makefile | 51 +------------ tests/test_invalidtoken/src/test_xs2.xn | 72 +++++++++++++++++++ tests/test_invalidtoken/src/test_xs3.xn | 24 +++++++ tests/test_iso_loopback.py | 16 +++-- tests/test_iso_loopback/Makefile | 51 +------------ tests/test_iso_loopback/src/test_xs2.xn | 72 +++++++++++++++++++ tests/test_iso_loopback/src/test_xs3.xn | 24 +++++++ tests/test_iso_rx_basic.py | 16 ++--- tests/test_iso_rx_basic/Makefile | 51 +------------ tests/test_iso_rx_basic/src/test_xs2.xn | 72 +++++++++++++++++++ tests/test_iso_rx_basic/src/test_xs3.xn | 24 +++++++ tests/test_iso_rxtx_fastpacket.py | 11 ++- tests/test_iso_rxtx_fastpacket/Makefile | 51 +------------ .../test_iso_rxtx_fastpacket/src/test_xs2.xn | 72 +++++++++++++++++++ .../test_iso_rxtx_fastpacket/src/test_xs3.xn | 24 +++++++ tests/test_iso_tx_basic.py | 19 +++-- tests/test_ping_rx_basic.py | 33 ++++----- tests/test_ping_rx_basic/Makefile | 51 +------------ tests/test_ping_rx_basic/src/test_xs2.xn | 72 +++++++++++++++++++ tests/test_ping_rx_basic/src/test_xs3.xn | 24 +++++++ tests/usb_packet.py | 2 +- 51 files changed, 1283 insertions(+), 748 deletions(-) create mode 100644 tests/test_bulk_rx_basic_badcrc32/src/test_xs2.xn create mode 100644 tests/test_bulk_rx_basic_badcrc32/src/test_xs3.xn create mode 100644 tests/test_bulk_rx_basic_badpid/src/test_xs2.xn create mode 100644 tests/test_bulk_rx_basic_badpid/src/test_xs3.xn create mode 100644 tests/test_bulk_rx_basic_rxerror/src/test_xs2.xn create mode 100644 tests/test_bulk_rx_basic_rxerror/src/test_xs3.xn create mode 100644 tests/test_bulk_rx_fastpacket_multiep/src/test_xs2.xn create mode 100644 tests/test_bulk_rx_fastpacket_multiep/src/test_xs3.xn create mode 100644 tests/test_bulk_rxtx_fastpacket/src/test_xs2.xn create mode 100644 tests/test_bulk_rxtx_fastpacket/src/test_xs3.xn create mode 100644 tests/test_bulk_tx_basic_noack/src/test_xs2.xn create mode 100644 tests/test_bulk_tx_basic_noack/src/test_xs3.xn create mode 100644 tests/test_bulk_tx_fastpacket_multiep/src/test_xs2.xn create mode 100644 tests/test_bulk_tx_fastpacket_multiep/src/test_xs3.xn create mode 100644 tests/test_invalidtoken/src/test_xs2.xn create mode 100644 tests/test_invalidtoken/src/test_xs3.xn create mode 100644 tests/test_iso_loopback/src/test_xs2.xn create mode 100644 tests/test_iso_loopback/src/test_xs3.xn create mode 100644 tests/test_iso_rx_basic/src/test_xs2.xn create mode 100644 tests/test_iso_rx_basic/src/test_xs3.xn create mode 100644 tests/test_iso_rxtx_fastpacket/src/test_xs2.xn create mode 100644 tests/test_iso_rxtx_fastpacket/src/test_xs3.xn create mode 100644 tests/test_ping_rx_basic/src/test_xs2.xn create mode 100644 tests/test_ping_rx_basic/src/test_xs3.xn diff --git a/lib_xud/src/core/included/XUD_Token_Out.S b/lib_xud/src/core/included/XUD_Token_Out.S index ec76c82b..298cce42 100755 --- a/lib_xud/src/core/included/XUD_Token_Out.S +++ b/lib_xud/src/core/included/XUD_Token_Out.S @@ -36,7 +36,8 @@ InformEP_Iso: // Iso EP - no handshake ldw r11, r3[1] // Load EP chanend out res[r11], r4 // Output datalength (words) outt res[r11], r8 // Send tail length - + + ldc r7, 0xf335 // CRC16 init (in) ldc r6, 0x3334 // CRC16 init (out) - Needs reseting after an out #ifndef ARCH_G ldw r1, sp[STACK_FLAG0_PORT] diff --git a/tests/test_bulk_rx_basic_badcrc32.py b/tests/test_bulk_rx_basic_badcrc32.py index 881e8bf0..cc5fd8d3 100644 --- a/tests/test_bulk_rx_basic_badcrc32.py +++ b/tests/test_bulk_rx_basic_badcrc32.py @@ -3,10 +3,8 @@ import random import xmostest from usb_packet import * -#import * AppendSetupToken, TxDataPacket, RxDataPacket, TokenPacket, RxHandshakePacket, TxHandshakePacket from usb_clock import Clock -from helpers import do_rx_test, packet_processing_time, get_dut_address -from helpers import choose_small_frame_size, check_received_packet, runall_rx +from helpers import do_usb_test, runall_rx # Single, setup transaction to EP 0 @@ -15,45 +13,47 @@ def do_test(arch, tx_clk, tx_phy, seed): rand = random.Random() rand.seed(seed) - dev_address = get_dut_address() + dev_address = 1 ep = 1 # The inter-frame gap is to give the DUT time to print its output packets = [] dataval = 0; - - AppendOutToken(packets, ep) + + # Good OUT transaction + AppendOutToken(packets, ep, dev_address) packets.append(TxDataPacket(rand, data_start_val=dataval, length=10, pid=0x3)) #DATA0 packets.append(RxHandshakePacket()) # Note, quite big gap to allow checking. + # Another good OUT transaction dataval += 10 - AppendOutToken(packets, ep, inter_pkt_gap=6000) + AppendOutToken(packets, ep, dev_address, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, length=11, pid=0xb)) #DATA1 packets.append(RxHandshakePacket()) dataval += 11 - AppendOutToken(packets, ep, inter_pkt_gap=6000) + AppendOutToken(packets, ep, dev_address, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, length=12, bad_crc=True, pid=0x3)) #DATA0 # Bad CRC - dont expect ACK #packets.append(RxHandshakePacket()) #Due to bad CRC, XUD will not ACK and expect a resend of the same packet - so dont change PID dataval += 12 - AppendOutToken(packets, ep, inter_pkt_gap=6000) + AppendOutToken(packets, ep, dev_address, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, length=13, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket(timeout=9)) + packets.append(RxHandshakePacket(timeout=10)) # PID toggle as normal dataval += 13 - AppendOutToken(packets, ep, inter_pkt_gap=6000) + AppendOutToken(packets, ep, dev_address, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, length=14, pid=0xb)) #DATA1 packets.append(RxHandshakePacket()) - do_rx_test(arch, tx_clk, tx_phy, packets, __file__, seed, + do_usb_test(arch, tx_clk, tx_phy, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): diff --git a/tests/test_bulk_rx_basic_badcrc32/Makefile b/tests/test_bulk_rx_basic_badcrc32/Makefile index 4319e1c8..6aed3e76 100644 --- a/tests/test_bulk_rx_basic_badcrc32/Makefile +++ b/tests/test_bulk_rx_basic_badcrc32/Makefile @@ -1,50 +1 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. - -TARGET = test.xn - -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name - -APP_NAME = - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. - -SHARED_CODE = ../../shared_src - -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L -Wno-timing - -XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES - -XCC_FLAGS_xs1 = $(COMMON_FLAGS) -DARCH_S -DXUD_SERIES_SUPPORT=XUD_U_SERIES - - - -ifeq ($(CONFIG),$(filter $(CONFIG),xs1)) - TARGET = test_xs1.xn -endif - -ifeq ($(CONFIG),$(filter $(CONFIG),xs2)) - TARGET = test.xn -endif - - - -# The USED_MODULES variable lists other module used by the application. -USED_MODULES = lib_xud - - -#============================================================================= -# The following part of the Makefile includes the common build infrastructure -# for compiling XMOS applications. You should not need to edit below here. - -XMOS_MAKE_PATH ?= ../.. -include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common +include ../test_makefile.mak diff --git a/tests/test_bulk_rx_basic_badcrc32/src/test_xs2.xn b/tests/test_bulk_rx_basic_badcrc32/src/test_xs2.xn new file mode 100644 index 00000000..d0ee86b8 --- /dev/null +++ b/tests/test_bulk_rx_basic_badcrc32/src/test_xs2.xn @@ -0,0 +1,72 @@ + + + Board + XS2 MC Audio + + tileref tile[2] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_rx_basic_badcrc32/src/test_xs3.xn b/tests/test_bulk_rx_basic_badcrc32/src/test_xs3.xn new file mode 100644 index 00000000..ab436573 --- /dev/null +++ b/tests/test_bulk_rx_basic_badcrc32/src/test_xs3.xn @@ -0,0 +1,24 @@ + + + + tileref tile[2] + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_rx_basic_badpid.py b/tests/test_bulk_rx_basic_badpid.py index a8b397e2..f300d72e 100644 --- a/tests/test_bulk_rx_basic_badpid.py +++ b/tests/test_bulk_rx_basic_badpid.py @@ -5,10 +5,8 @@ import random import xmostest from usb_packet import * -#import * AppendSetupToken, TxDataPacket, RxDataPacket, TokenPacket, RxHandshakePacket, TxHandshakePacket from usb_clock import Clock -from helpers import do_rx_test, packet_processing_time, get_dut_address -from helpers import choose_small_frame_size, check_received_packet, runall_rx +from helpers import do_usb_test, runall_rx # Single, setup transaction to EP 0 @@ -17,7 +15,7 @@ def do_test(arch, clk, phy, seed): rand = random.Random() rand.seed(seed) - dev_address = get_dut_address() + address = 1 ep = 1 # The inter-frame gap is to give the DUT time to print its output @@ -25,40 +23,39 @@ def do_test(arch, clk, phy, seed): dataval = 0; - AppendOutToken(packets, ep) + AppendOutToken(packets, ep, address) packets.append(TxDataPacket(rand, data_start_val=dataval, length=10, pid=0x3)) #DATA0 packets.append(RxHandshakePacket()) # Note, quite big gap to allow checking. dataval += 10 - AppendOutToken(packets, ep, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, length=11, pid=0xb)) #DATA1 packets.append(RxHandshakePacket()) #Pretend the ACK went missing. Re-send same packet. xCORE should ACK but throw pkt away - AppendOutToken(packets, ep, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, length=11, pid=0xb)) #DATA1 packets.append(RxHandshakePacket()) dataval += 11 - AppendOutToken(packets, ep, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, length=12, pid=0x3)) #DATA0 packets.append(RxHandshakePacket()) dataval += 12 - AppendOutToken(packets, ep, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, length=13, pid=0xb)) #DATA1 packets.append(RxHandshakePacket(timeout=9)) dataval += 13 - AppendOutToken(packets, ep, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, length=14, pid=0x3)) #DATA0 packets.append(RxHandshakePacket()) - do_rx_test(arch, clk, phy, packets, __file__, seed, - level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): random.seed(1) diff --git a/tests/test_bulk_rx_basic_badpid/Makefile b/tests/test_bulk_rx_basic_badpid/Makefile index 4319e1c8..6aed3e76 100644 --- a/tests/test_bulk_rx_basic_badpid/Makefile +++ b/tests/test_bulk_rx_basic_badpid/Makefile @@ -1,50 +1 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. - -TARGET = test.xn - -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name - -APP_NAME = - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. - -SHARED_CODE = ../../shared_src - -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L -Wno-timing - -XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES - -XCC_FLAGS_xs1 = $(COMMON_FLAGS) -DARCH_S -DXUD_SERIES_SUPPORT=XUD_U_SERIES - - - -ifeq ($(CONFIG),$(filter $(CONFIG),xs1)) - TARGET = test_xs1.xn -endif - -ifeq ($(CONFIG),$(filter $(CONFIG),xs2)) - TARGET = test.xn -endif - - - -# The USED_MODULES variable lists other module used by the application. -USED_MODULES = lib_xud - - -#============================================================================= -# The following part of the Makefile includes the common build infrastructure -# for compiling XMOS applications. You should not need to edit below here. - -XMOS_MAKE_PATH ?= ../.. -include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common +include ../test_makefile.mak diff --git a/tests/test_bulk_rx_basic_badpid/src/test_xs2.xn b/tests/test_bulk_rx_basic_badpid/src/test_xs2.xn new file mode 100644 index 00000000..d0ee86b8 --- /dev/null +++ b/tests/test_bulk_rx_basic_badpid/src/test_xs2.xn @@ -0,0 +1,72 @@ + + + Board + XS2 MC Audio + + tileref tile[2] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_rx_basic_badpid/src/test_xs3.xn b/tests/test_bulk_rx_basic_badpid/src/test_xs3.xn new file mode 100644 index 00000000..ab436573 --- /dev/null +++ b/tests/test_bulk_rx_basic_badpid/src/test_xs3.xn @@ -0,0 +1,24 @@ + + + + tileref tile[2] + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_rx_basic_rxerror.py b/tests/test_bulk_rx_basic_rxerror.py index 87b2dd3f..d28dee29 100644 --- a/tests/test_bulk_rx_basic_rxerror.py +++ b/tests/test_bulk_rx_basic_rxerror.py @@ -3,19 +3,16 @@ import random import xmostest from usb_packet import * -#import * AppendSetupToken, TxDataPacket, RxDataPacket, TokenPacket, RxHandshakePacket, TxHandshakePacket from usb_clock import Clock -from helpers import do_rx_test, packet_processing_time, get_dut_address -from helpers import choose_small_frame_size, check_received_packet, runall_rx - +from helpers import do_usb_test, runall_rx # Single, setup transaction to EP 0 -def do_test(arch, tx_clk, tx_phy, seed): +def do_test(arch, clk, phy, seed): rand = random.Random() rand.seed(seed) - dev_address = get_dut_address() + address = 1 ep = 1 # The inter-frame gap is to give the DUT time to print its output @@ -23,47 +20,44 @@ def do_test(arch, tx_clk, tx_phy, seed): dataval = 0; - AppendOutToken(packets, ep) + AppendOutToken(packets, ep, address) packets.append(TxDataPacket(rand, data_start_val=dataval, length=10, pid=0x3)) #DATA0 packets.append(RxHandshakePacket()) # Assert RxError during packet dataval += 10 - AppendOutToken(packets, ep, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, length=11, pid=0xb, rxe_assert_time=5)) #DATA1 # xCORE should ignore the packet and not handshake... #packets.append(RxHandshakePacket()) # Re-send.. - AppendOutToken(packets, ep, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, length=11, pid=0xb, rxe_assert_time=0)) #DATA1 packets.append(RxHandshakePacket()) dataval += 11 - AppendOutToken(packets, ep, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, length=12, pid=0x3)) #DATA0 packets.append(RxHandshakePacket(timeout=9)) dataval += 12 - AppendOutToken(packets, ep, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, length=13, pid=0xb, rxe_assert_time=1)) #DATA1 #packets.append(RxHandshakePacket()) #resend - AppendOutToken(packets, ep, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, length=13, pid=0xb)) #DATA1 packets.append(RxHandshakePacket()) - dataval += 13 - AppendOutToken(packets, ep, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, length=14, pid=0x3)) #DATA0 packets.append(RxHandshakePacket()) - - do_rx_test(arch, tx_clk, tx_phy, packets, __file__, seed, - level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): random.seed(1) diff --git a/tests/test_bulk_rx_basic_rxerror/Makefile b/tests/test_bulk_rx_basic_rxerror/Makefile index 83edfc42..6aed3e76 100644 --- a/tests/test_bulk_rx_basic_rxerror/Makefile +++ b/tests/test_bulk_rx_basic_rxerror/Makefile @@ -1,50 +1 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. - -TARGET = test.xn - -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name - -APP_NAME = - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. - -SHARED_CODE = ../../shared_src - -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L - -XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES - -XCC_FLAGS_xs1 = $(COMMON_FLAGS) -DARCH_S -DXUD_SERIES_SUPPORT=XUD_U_SERIES - - - -ifeq ($(CONFIG),$(filter $(CONFIG),xs1)) - TARGET = test_xs1.xn -endif - -ifeq ($(CONFIG),$(filter $(CONFIG),xs2)) - TARGET = test.xn -endif - - - -# The USED_MODULES variable lists other module used by the application. -USED_MODULES = lib_xud - - -#============================================================================= -# The following part of the Makefile includes the common build infrastructure -# for compiling XMOS applications. You should not need to edit below here. - -XMOS_MAKE_PATH ?= ../.. -include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common +include ../test_makefile.mak diff --git a/tests/test_bulk_rx_basic_rxerror/src/test_xs2.xn b/tests/test_bulk_rx_basic_rxerror/src/test_xs2.xn new file mode 100644 index 00000000..d0ee86b8 --- /dev/null +++ b/tests/test_bulk_rx_basic_rxerror/src/test_xs2.xn @@ -0,0 +1,72 @@ + + + Board + XS2 MC Audio + + tileref tile[2] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_rx_basic_rxerror/src/test_xs3.xn b/tests/test_bulk_rx_basic_rxerror/src/test_xs3.xn new file mode 100644 index 00000000..ab436573 --- /dev/null +++ b/tests/test_bulk_rx_basic_rxerror/src/test_xs3.xn @@ -0,0 +1,24 @@ + + + + tileref tile[2] + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_rx_fastpacket_multiep.py b/tests/test_bulk_rx_fastpacket_multiep.py index bdeeb55f..fb0cb6f6 100644 --- a/tests/test_bulk_rx_fastpacket_multiep.py +++ b/tests/test_bulk_rx_fastpacket_multiep.py @@ -4,8 +4,7 @@ import xmostest from usb_packet import * from usb_clock import Clock -from helpers import do_rx_test, packet_processing_time, get_dut_address -from helpers import choose_small_frame_size, check_received_packet, runall_rx +from helpers import do_usb_test, runall_rx def do_test(arch, clk, phy, seed): rand = random.Random() @@ -14,6 +13,7 @@ def do_test(arch, clk, phy, seed): # The inter-frame gap is to give the DUT time to print its output packets = [] + address = 1 data_val = 0; pkt_length = 20 data_pid = 0x3 #DATA0 @@ -21,26 +21,26 @@ def do_test(arch, clk, phy, seed): for pkt_length in range(10, 20): #min 237 - AppendOutToken(packets, 3, inter_pkt_gap=1) + AppendOutToken(packets, 3, address, inter_pkt_gap=1) packets.append(TxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) #DATA0 packets.append(RxHandshakePacket(timeout=9)) - AppendOutToken(packets, 4, inter_pkt_gap=1) + AppendOutToken(packets, 4, address, inter_pkt_gap=1) packets.append(TxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) #DATA0 packets.append(RxHandshakePacket(timeout=9)) - AppendOutToken(packets, 5, inter_pkt_gap=0) + AppendOutToken(packets, 5, address, inter_pkt_gap=0) packets.append(TxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) #DATA0 packets.append(RxHandshakePacket(timeout=9)) - AppendOutToken(packets, 6, inter_pkt_gap=0) + AppendOutToken(packets, 6, address, inter_pkt_gap=0) packets.append(TxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) #DATA0 packets.append(RxHandshakePacket(timeout=9)) data_val = data_val + pkt_length data_pid = data_pid ^ 8 - do_rx_test(arch, clk, phy, packets, __file__, seed, + do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): diff --git a/tests/test_bulk_rx_fastpacket_multiep/Makefile b/tests/test_bulk_rx_fastpacket_multiep/Makefile index 4319e1c8..6aed3e76 100644 --- a/tests/test_bulk_rx_fastpacket_multiep/Makefile +++ b/tests/test_bulk_rx_fastpacket_multiep/Makefile @@ -1,50 +1 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. - -TARGET = test.xn - -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name - -APP_NAME = - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. - -SHARED_CODE = ../../shared_src - -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L -Wno-timing - -XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES - -XCC_FLAGS_xs1 = $(COMMON_FLAGS) -DARCH_S -DXUD_SERIES_SUPPORT=XUD_U_SERIES - - - -ifeq ($(CONFIG),$(filter $(CONFIG),xs1)) - TARGET = test_xs1.xn -endif - -ifeq ($(CONFIG),$(filter $(CONFIG),xs2)) - TARGET = test.xn -endif - - - -# The USED_MODULES variable lists other module used by the application. -USED_MODULES = lib_xud - - -#============================================================================= -# The following part of the Makefile includes the common build infrastructure -# for compiling XMOS applications. You should not need to edit below here. - -XMOS_MAKE_PATH ?= ../.. -include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common +include ../test_makefile.mak diff --git a/tests/test_bulk_rx_fastpacket_multiep/src/test_xs2.xn b/tests/test_bulk_rx_fastpacket_multiep/src/test_xs2.xn new file mode 100644 index 00000000..d0ee86b8 --- /dev/null +++ b/tests/test_bulk_rx_fastpacket_multiep/src/test_xs2.xn @@ -0,0 +1,72 @@ + + + Board + XS2 MC Audio + + tileref tile[2] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_rx_fastpacket_multiep/src/test_xs3.xn b/tests/test_bulk_rx_fastpacket_multiep/src/test_xs3.xn new file mode 100644 index 00000000..ab436573 --- /dev/null +++ b/tests/test_bulk_rx_fastpacket_multiep/src/test_xs3.xn @@ -0,0 +1,24 @@ + + + + tileref tile[2] + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_rxtx_fastpacket.py b/tests/test_bulk_rxtx_fastpacket.py index 25a0f016..7b8472c9 100644 --- a/tests/test_bulk_rxtx_fastpacket.py +++ b/tests/test_bulk_rxtx_fastpacket.py @@ -4,14 +4,14 @@ import xmostest from usb_packet import * from usb_clock import Clock -from helpers import do_rx_test, packet_processing_time, get_dut_address -from helpers import choose_small_frame_size, check_received_packet, runall_rx +from helpers import do_usb_test, runall_rx def do_test(arch, clk, phy, seed): rand = random.Random() rand.seed(seed) ep = 3 + address = 1 packets = [] @@ -23,20 +23,19 @@ def do_test(arch, clk, phy, seed): # < 17 fails for SI # < 37 fails for DI - AppendOutToken(packets, ep, inter_pkt_gap=37) + AppendOutToken(packets, ep, address, inter_pkt_gap=37) packets.append(TxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) #DATA0 # 9 works for SI packets.append(RxHandshakePacket(timeout=10)) - AppendInToken(packets, ep, inter_pkt_gap=0) + AppendInToken(packets, ep, address, inter_pkt_gap=0) packets.append(RxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) packets.append(TxHandshakePacket()) data_val = data_val + pkt_length data_pid = data_pid ^ 8 - do_rx_test(arch, clk, phy, packets, __file__, seed, - level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): random.seed(1) diff --git a/tests/test_bulk_rxtx_fastpacket/Makefile b/tests/test_bulk_rxtx_fastpacket/Makefile index 4319e1c8..6aed3e76 100644 --- a/tests/test_bulk_rxtx_fastpacket/Makefile +++ b/tests/test_bulk_rxtx_fastpacket/Makefile @@ -1,50 +1 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. - -TARGET = test.xn - -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name - -APP_NAME = - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. - -SHARED_CODE = ../../shared_src - -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L -Wno-timing - -XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES - -XCC_FLAGS_xs1 = $(COMMON_FLAGS) -DARCH_S -DXUD_SERIES_SUPPORT=XUD_U_SERIES - - - -ifeq ($(CONFIG),$(filter $(CONFIG),xs1)) - TARGET = test_xs1.xn -endif - -ifeq ($(CONFIG),$(filter $(CONFIG),xs2)) - TARGET = test.xn -endif - - - -# The USED_MODULES variable lists other module used by the application. -USED_MODULES = lib_xud - - -#============================================================================= -# The following part of the Makefile includes the common build infrastructure -# for compiling XMOS applications. You should not need to edit below here. - -XMOS_MAKE_PATH ?= ../.. -include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common +include ../test_makefile.mak diff --git a/tests/test_bulk_rxtx_fastpacket/src/test_xs2.xn b/tests/test_bulk_rxtx_fastpacket/src/test_xs2.xn new file mode 100644 index 00000000..d0ee86b8 --- /dev/null +++ b/tests/test_bulk_rxtx_fastpacket/src/test_xs2.xn @@ -0,0 +1,72 @@ + + + Board + XS2 MC Audio + + tileref tile[2] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_rxtx_fastpacket/src/test_xs3.xn b/tests/test_bulk_rxtx_fastpacket/src/test_xs3.xn new file mode 100644 index 00000000..ab436573 --- /dev/null +++ b/tests/test_bulk_rxtx_fastpacket/src/test_xs3.xn @@ -0,0 +1,24 @@ + + + + tileref tile[2] + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_tx_basic_noack.py b/tests/test_bulk_tx_basic_noack.py index 238a8a4c..09244c52 100644 --- a/tests/test_bulk_tx_basic_noack.py +++ b/tests/test_bulk_tx_basic_noack.py @@ -3,10 +3,8 @@ import random import xmostest from usb_packet import * -#import * AppendSetupToken, TxDataPacket, RxDataPacket, TokenPacket, RxHandshakePacket, TxHandshakePacket from usb_clock import Clock -from helpers import do_rx_test, packet_processing_time, get_dut_address -from helpers import choose_small_frame_size, check_received_packet, runall_rx +from helpers import do_usb_test, runall_rx # Single, setup transaction to EP 0 @@ -15,7 +13,7 @@ def do_test(arch, tx_clk, tx_phy, seed): rand = random.Random() rand.seed(seed) - dev_address = get_dut_address() + address = 1 ep = 2 # The inter-frame gap is to give the DUT time to print its output @@ -23,38 +21,38 @@ def do_test(arch, tx_clk, tx_phy, seed): dataval = 0; - AppendInToken(packets, ep) + AppendInToken(packets, ep, address) packets.append(RxDataPacket(rand, data_start_val=dataval, length=10, pid=0x3)) #DATA0 packets.append(TxHandshakePacket()) dataval += 10 - AppendInToken(packets, ep, inter_pkt_gap=5000) + AppendInToken(packets, ep, address, inter_pkt_gap=5000) packets.append(RxDataPacket(rand, data_start_val=dataval, length=11, pid=0xb)) #DATA1 packets.append(TxHandshakePacket()) #pretend CRC got broken on way to host and dont send ACK dataval += 11 - AppendInToken(packets, ep, inter_pkt_gap=5000) + AppendInToken(packets, ep, address, inter_pkt_gap=5000) packets.append(RxDataPacket(rand, data_start_val=dataval, length=12, pid=0x3)) #DATA0 #packets.append(TxHandshakePacket()) #xCore should resend same packet again.. - AppendInToken(packets, ep, inter_pkt_gap=5000) + AppendInToken(packets, ep, address, inter_pkt_gap=5000) packets.append(RxDataPacket(rand, data_start_val=dataval, length=12, pid=0x3)) #DATA0 packets.append(TxHandshakePacket()) dataval += 12 - AppendInToken(packets, ep, inter_pkt_gap=5000) + AppendInToken(packets, ep, address, inter_pkt_gap=5000) packets.append(RxDataPacket(rand, data_start_val=dataval, length=13, pid=0xb)) #DATA1 packets.append(TxHandshakePacket()) dataval += 13 - AppendInToken(packets, ep, inter_pkt_gap=5000) + AppendInToken(packets, ep, address, inter_pkt_gap=5000) packets.append(RxDataPacket(rand, data_start_val=dataval, length=14, pid=0x3)) #DATA0 packets.append(TxHandshakePacket()) # Note, quite big gap to allow checking. - do_rx_test(arch, tx_clk, tx_phy, packets, __file__, seed, + do_usb_test(arch, tx_clk, tx_phy, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): diff --git a/tests/test_bulk_tx_basic_noack/Makefile b/tests/test_bulk_tx_basic_noack/Makefile index 4319e1c8..6aed3e76 100644 --- a/tests/test_bulk_tx_basic_noack/Makefile +++ b/tests/test_bulk_tx_basic_noack/Makefile @@ -1,50 +1 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. - -TARGET = test.xn - -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name - -APP_NAME = - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. - -SHARED_CODE = ../../shared_src - -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L -Wno-timing - -XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES - -XCC_FLAGS_xs1 = $(COMMON_FLAGS) -DARCH_S -DXUD_SERIES_SUPPORT=XUD_U_SERIES - - - -ifeq ($(CONFIG),$(filter $(CONFIG),xs1)) - TARGET = test_xs1.xn -endif - -ifeq ($(CONFIG),$(filter $(CONFIG),xs2)) - TARGET = test.xn -endif - - - -# The USED_MODULES variable lists other module used by the application. -USED_MODULES = lib_xud - - -#============================================================================= -# The following part of the Makefile includes the common build infrastructure -# for compiling XMOS applications. You should not need to edit below here. - -XMOS_MAKE_PATH ?= ../.. -include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common +include ../test_makefile.mak diff --git a/tests/test_bulk_tx_basic_noack/src/test_xs2.xn b/tests/test_bulk_tx_basic_noack/src/test_xs2.xn new file mode 100644 index 00000000..d0ee86b8 --- /dev/null +++ b/tests/test_bulk_tx_basic_noack/src/test_xs2.xn @@ -0,0 +1,72 @@ + + + Board + XS2 MC Audio + + tileref tile[2] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_tx_basic_noack/src/test_xs3.xn b/tests/test_bulk_tx_basic_noack/src/test_xs3.xn new file mode 100644 index 00000000..ab436573 --- /dev/null +++ b/tests/test_bulk_tx_basic_noack/src/test_xs3.xn @@ -0,0 +1,24 @@ + + + + tileref tile[2] + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_tx_fastpacket_multiep.py b/tests/test_bulk_tx_fastpacket_multiep.py index d18abbe8..87b7a8f3 100644 --- a/tests/test_bulk_tx_fastpacket_multiep.py +++ b/tests/test_bulk_tx_fastpacket_multiep.py @@ -4,8 +4,7 @@ import xmostest from usb_packet import * from usb_clock import Clock -from helpers import do_rx_test, packet_processing_time, get_dut_address -from helpers import choose_small_frame_size, check_received_packet, runall_rx +from helpers import do_usb_test, runall_rx def do_test(arch, clk, phy, seed): rand = random.Random() @@ -15,6 +14,7 @@ def do_test(arch, clk, phy, seed): # The inter-frame gap is to give the DUT time to print its output packets = [] + address = 1 data_val = 0; pkt_length = 20 @@ -28,27 +28,26 @@ def do_test(arch, clk, phy, seed): #Multi EP: #177 lowest for valid data (DI) - AppendInToken(packets, start_ep, inter_pkt_gap=177) + AppendInToken(packets, start_ep, address, inter_pkt_gap=177) packets.append(RxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) packets.append(TxHandshakePacket()) - AppendInToken(packets, start_ep+1, inter_pkt_gap=177) + AppendInToken(packets, start_ep+1, address, inter_pkt_gap=177) packets.append(RxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) packets.append(TxHandshakePacket()) - AppendInToken(packets, start_ep+2, inter_pkt_gap=177) + AppendInToken(packets, start_ep+2, address, inter_pkt_gap=177) packets.append(RxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) packets.append(TxHandshakePacket()) - AppendInToken(packets, start_ep+3, inter_pkt_gap=177) + AppendInToken(packets, start_ep+3, address, inter_pkt_gap=177) packets.append(RxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) packets.append(TxHandshakePacket()) data_val = data_val + pkt_length data_pid = data_pid ^ 8 - do_rx_test(arch, clk, phy, packets, __file__, seed, - level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): random.seed(1) diff --git a/tests/test_bulk_tx_fastpacket_multiep/Makefile b/tests/test_bulk_tx_fastpacket_multiep/Makefile index 4319e1c8..6aed3e76 100644 --- a/tests/test_bulk_tx_fastpacket_multiep/Makefile +++ b/tests/test_bulk_tx_fastpacket_multiep/Makefile @@ -1,50 +1 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. - -TARGET = test.xn - -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name - -APP_NAME = - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. - -SHARED_CODE = ../../shared_src - -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L -Wno-timing - -XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES - -XCC_FLAGS_xs1 = $(COMMON_FLAGS) -DARCH_S -DXUD_SERIES_SUPPORT=XUD_U_SERIES - - - -ifeq ($(CONFIG),$(filter $(CONFIG),xs1)) - TARGET = test_xs1.xn -endif - -ifeq ($(CONFIG),$(filter $(CONFIG),xs2)) - TARGET = test.xn -endif - - - -# The USED_MODULES variable lists other module used by the application. -USED_MODULES = lib_xud - - -#============================================================================= -# The following part of the Makefile includes the common build infrastructure -# for compiling XMOS applications. You should not need to edit below here. - -XMOS_MAKE_PATH ?= ../.. -include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common +include ../test_makefile.mak diff --git a/tests/test_bulk_tx_fastpacket_multiep/src/test_xs2.xn b/tests/test_bulk_tx_fastpacket_multiep/src/test_xs2.xn new file mode 100644 index 00000000..d0ee86b8 --- /dev/null +++ b/tests/test_bulk_tx_fastpacket_multiep/src/test_xs2.xn @@ -0,0 +1,72 @@ + + + Board + XS2 MC Audio + + tileref tile[2] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_tx_fastpacket_multiep/src/test_xs3.xn b/tests/test_bulk_tx_fastpacket_multiep/src/test_xs3.xn new file mode 100644 index 00000000..ab436573 --- /dev/null +++ b/tests/test_bulk_tx_fastpacket_multiep/src/test_xs3.xn @@ -0,0 +1,24 @@ + + + + tileref tile[2] + + + + + + + + + + + + + + + + + + diff --git a/tests/test_invalidtoken.py b/tests/test_invalidtoken.py index eab769d5..11b19bd9 100644 --- a/tests/test_invalidtoken.py +++ b/tests/test_invalidtoken.py @@ -6,17 +6,16 @@ import xmostest from usb_packet import * from usb_clock import Clock -from helpers import do_rx_test, packet_processing_time, get_dut_address -from helpers import choose_small_frame_size, check_received_packet, runall_rx +from helpers import do_usb_test, runall_rx # Single, setup transaction to EP 0 -def do_test(arch, tx_clk, tx_phy, seed): +def do_test(arch, clk, phy, seed): rand = random.Random() rand.seed(seed) - dev_address = get_dut_address() + address = 1 ep = 1 # The inter-frame gap is to give the DUT time to print its output @@ -28,14 +27,14 @@ def do_test(arch, tx_clk, tx_phy, seed): packets.append(TokenPacket( inter_pkt_gap=2000, pid=0x0, - address=dev_address, + address=address, endpoint=ep)) # Valid IN but not for us.. packets.append(TokenPacket( inter_pkt_gap=200, pid=0x69, - address=dev_address, + address=address, endpoint=ep, valid=False)) @@ -43,11 +42,11 @@ def do_test(arch, tx_clk, tx_phy, seed): packets.append(TokenPacket( inter_pkt_gap=200, pid=0xe1, - address=dev_address, + address=address, endpoint=ep, valid=False)) - AppendOutToken(packets, ep) + AppendOutToken(packets, ep, address) packets.append(TxDataPacket(rand, data_start_val=dataval, length=10, pid=0x3)) #DATA0 packets.append(RxHandshakePacket()) @@ -55,16 +54,14 @@ def do_test(arch, tx_clk, tx_phy, seed): packets.append(TokenPacket( inter_pkt_gap=200, pid=0x2d, - address=dev_address, + address=address, endpoint=ep, valid=False)) - - # Note, quite big gap to allow checking. dataval += 10 - AppendOutToken(packets, ep, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, length=11, pid=0xb)) #DATA1 packets.append(RxHandshakePacket()) @@ -72,30 +69,27 @@ def do_test(arch, tx_clk, tx_phy, seed): packets.append(TokenPacket( inter_pkt_gap=200, pid=0xb4, - address=dev_address, + address=address, endpoint=ep, valid=False)) - - dataval += 11 - AppendOutToken(packets, ep, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, length=12, pid=0x3)) #DATA0 packets.append(RxHandshakePacket()) dataval += 12 - AppendOutToken(packets, ep, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, length=13, pid=0xb)) #DATA1 packets.append(RxHandshakePacket()) dataval += 13 - AppendOutToken(packets, ep, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, length=14, pid=0x3)) #DATA0 packets.append(RxHandshakePacket()) - do_rx_test(arch, tx_clk, tx_phy, packets, __file__, seed, - level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): random.seed(1) diff --git a/tests/test_invalidtoken/Makefile b/tests/test_invalidtoken/Makefile index 4319e1c8..6aed3e76 100644 --- a/tests/test_invalidtoken/Makefile +++ b/tests/test_invalidtoken/Makefile @@ -1,50 +1 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. - -TARGET = test.xn - -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name - -APP_NAME = - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. - -SHARED_CODE = ../../shared_src - -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L -Wno-timing - -XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES - -XCC_FLAGS_xs1 = $(COMMON_FLAGS) -DARCH_S -DXUD_SERIES_SUPPORT=XUD_U_SERIES - - - -ifeq ($(CONFIG),$(filter $(CONFIG),xs1)) - TARGET = test_xs1.xn -endif - -ifeq ($(CONFIG),$(filter $(CONFIG),xs2)) - TARGET = test.xn -endif - - - -# The USED_MODULES variable lists other module used by the application. -USED_MODULES = lib_xud - - -#============================================================================= -# The following part of the Makefile includes the common build infrastructure -# for compiling XMOS applications. You should not need to edit below here. - -XMOS_MAKE_PATH ?= ../.. -include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common +include ../test_makefile.mak diff --git a/tests/test_invalidtoken/src/test_xs2.xn b/tests/test_invalidtoken/src/test_xs2.xn new file mode 100644 index 00000000..d0ee86b8 --- /dev/null +++ b/tests/test_invalidtoken/src/test_xs2.xn @@ -0,0 +1,72 @@ + + + Board + XS2 MC Audio + + tileref tile[2] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_invalidtoken/src/test_xs3.xn b/tests/test_invalidtoken/src/test_xs3.xn new file mode 100644 index 00000000..ab436573 --- /dev/null +++ b/tests/test_invalidtoken/src/test_xs3.xn @@ -0,0 +1,24 @@ + + + + tileref tile[2] + + + + + + + + + + + + + + + + + + diff --git a/tests/test_iso_loopback.py b/tests/test_iso_loopback.py index 5583334d..8b90ba59 100644 --- a/tests/test_iso_loopback.py +++ b/tests/test_iso_loopback.py @@ -4,14 +4,15 @@ import xmostest from usb_packet import * from usb_clock import Clock -from helpers import do_rx_test, packet_processing_time, get_dut_address -from helpers import choose_small_frame_size, check_received_packet, runall_rx +from helpers import do_usb_test, runall_rx def do_test(arch, clk, phy, seed): rand = random.Random() rand.seed(seed) + address = 1 + ep_loopback = 3 ep_loopback_kill = 2 @@ -23,13 +24,14 @@ def do_test(arch, clk, phy, seed): for pkt_length in range(200, 204): - AppendOutToken(packets, ep_loopback) + AppendOutToken(packets, ep_loopback, address) packets.append(TxDataPacket(rand, data_start_val=dataval, length=pkt_length, pid=data_pid)) #DATA0 #XXwas min IPG supported on iso loopback to not nak #This was 420, had to increase when moved to lib_xud (14.1.2 tools) # increased again from 437 when SETUP/OUT checking added - AppendInToken(packets, ep_loopback, inter_pkt_gap=477) + # increaed from 477 when adding xs3 + AppendInToken(packets, ep_loopback, address, inter_pkt_gap=498) packets.append(RxDataPacket(rand, data_start_val=dataval, length=pkt_length, pid=data_pid, timeout=9)) #DATA0 #No toggle for Iso @@ -37,16 +39,16 @@ def do_test(arch, clk, phy, seed): pkt_length = 10 #Loopback and die.. - AppendOutToken(packets, ep_loopback_kill) + AppendOutToken(packets, ep_loopback_kill, address) packets.append(TxDataPacket(rand, length=pkt_length, pid=3)) #DATA0 packets.append(RxHandshakePacket()) - AppendInToken(packets, ep_loopback_kill, inter_pkt_gap=397) + AppendInToken(packets, ep_loopback_kill, address, inter_pkt_gap=397) packets.append(RxDataPacket(rand, length=pkt_length, pid=3)) #DATA0 packets.append(TxHandshakePacket()) - do_rx_test(arch, clk, phy, packets, __file__, seed, + do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): diff --git a/tests/test_iso_loopback/Makefile b/tests/test_iso_loopback/Makefile index 4319e1c8..6aed3e76 100644 --- a/tests/test_iso_loopback/Makefile +++ b/tests/test_iso_loopback/Makefile @@ -1,50 +1 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. - -TARGET = test.xn - -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name - -APP_NAME = - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. - -SHARED_CODE = ../../shared_src - -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L -Wno-timing - -XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES - -XCC_FLAGS_xs1 = $(COMMON_FLAGS) -DARCH_S -DXUD_SERIES_SUPPORT=XUD_U_SERIES - - - -ifeq ($(CONFIG),$(filter $(CONFIG),xs1)) - TARGET = test_xs1.xn -endif - -ifeq ($(CONFIG),$(filter $(CONFIG),xs2)) - TARGET = test.xn -endif - - - -# The USED_MODULES variable lists other module used by the application. -USED_MODULES = lib_xud - - -#============================================================================= -# The following part of the Makefile includes the common build infrastructure -# for compiling XMOS applications. You should not need to edit below here. - -XMOS_MAKE_PATH ?= ../.. -include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common +include ../test_makefile.mak diff --git a/tests/test_iso_loopback/src/test_xs2.xn b/tests/test_iso_loopback/src/test_xs2.xn new file mode 100644 index 00000000..d0ee86b8 --- /dev/null +++ b/tests/test_iso_loopback/src/test_xs2.xn @@ -0,0 +1,72 @@ + + + Board + XS2 MC Audio + + tileref tile[2] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_iso_loopback/src/test_xs3.xn b/tests/test_iso_loopback/src/test_xs3.xn new file mode 100644 index 00000000..ab436573 --- /dev/null +++ b/tests/test_iso_loopback/src/test_xs3.xn @@ -0,0 +1,24 @@ + + + + tileref tile[2] + + + + + + + + + + + + + + + + + + diff --git a/tests/test_iso_rx_basic.py b/tests/test_iso_rx_basic.py index f8b14f4d..98ba3ed9 100644 --- a/tests/test_iso_rx_basic.py +++ b/tests/test_iso_rx_basic.py @@ -5,43 +5,43 @@ from usb_packet import * #import * AppendSetupToken, TxDataPacket, RxDataPacket, TokenPacket, RxHandshakePacket, TxHandshakePacket from usb_clock import Clock -from helpers import do_rx_test, packet_processing_time, get_dut_address -from helpers import choose_small_frame_size, check_received_packet, runall_rx +from helpers import do_usb_test, runall_rx def do_test(arch, clk, phy, seed): rand = random.Random() rand.seed(seed) ep = 2 + address = 1 # The inter-frame gap is to give the DUT time to print its output packets = [] dataval = 0; - AppendOutToken(packets, ep) + AppendOutToken(packets, ep, address) packets.append(TxDataPacket(rand, data_start_val=dataval, length=10, pid=0x3)) #DATA0 # Note, quite big gap to allow checking. dataval += 10 - AppendOutToken(packets, ep, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, length=11, pid=0x3)) #DATA0 dataval += 11 - AppendOutToken(packets, ep, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, length=12, pid=0x3)) #DATA0 dataval += 12 - AppendOutToken(packets, ep, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, length=13, pid=0x3)) #DATA0 dataval += 13 - AppendOutToken(packets, ep, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, length=14, pid=0x3)) #DATA0 - do_rx_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): random.seed(1) diff --git a/tests/test_iso_rx_basic/Makefile b/tests/test_iso_rx_basic/Makefile index 4319e1c8..6aed3e76 100644 --- a/tests/test_iso_rx_basic/Makefile +++ b/tests/test_iso_rx_basic/Makefile @@ -1,50 +1 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. - -TARGET = test.xn - -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name - -APP_NAME = - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. - -SHARED_CODE = ../../shared_src - -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L -Wno-timing - -XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES - -XCC_FLAGS_xs1 = $(COMMON_FLAGS) -DARCH_S -DXUD_SERIES_SUPPORT=XUD_U_SERIES - - - -ifeq ($(CONFIG),$(filter $(CONFIG),xs1)) - TARGET = test_xs1.xn -endif - -ifeq ($(CONFIG),$(filter $(CONFIG),xs2)) - TARGET = test.xn -endif - - - -# The USED_MODULES variable lists other module used by the application. -USED_MODULES = lib_xud - - -#============================================================================= -# The following part of the Makefile includes the common build infrastructure -# for compiling XMOS applications. You should not need to edit below here. - -XMOS_MAKE_PATH ?= ../.. -include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common +include ../test_makefile.mak diff --git a/tests/test_iso_rx_basic/src/test_xs2.xn b/tests/test_iso_rx_basic/src/test_xs2.xn new file mode 100644 index 00000000..d0ee86b8 --- /dev/null +++ b/tests/test_iso_rx_basic/src/test_xs2.xn @@ -0,0 +1,72 @@ + + + Board + XS2 MC Audio + + tileref tile[2] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_iso_rx_basic/src/test_xs3.xn b/tests/test_iso_rx_basic/src/test_xs3.xn new file mode 100644 index 00000000..ab436573 --- /dev/null +++ b/tests/test_iso_rx_basic/src/test_xs3.xn @@ -0,0 +1,24 @@ + + + + tileref tile[2] + + + + + + + + + + + + + + + + + + diff --git a/tests/test_iso_rxtx_fastpacket.py b/tests/test_iso_rxtx_fastpacket.py index c87378a5..1c2adc29 100644 --- a/tests/test_iso_rxtx_fastpacket.py +++ b/tests/test_iso_rxtx_fastpacket.py @@ -4,14 +4,14 @@ import xmostest from usb_packet import * from usb_clock import Clock -from helpers import do_rx_test, packet_processing_time, get_dut_address -from helpers import choose_small_frame_size, check_received_packet, runall_rx +from helpers import do_usb_test, runall_rx def do_test(arch, clk, phy, seed): rand = random.Random() rand.seed(seed) ep = 3 + address = 1 packets = [] @@ -22,17 +22,16 @@ def do_test(arch, clk, phy, seed): for pkt_length in range(10, 20): # < 17 fails - AppendOutToken(packets, ep, inter_pkt_gap=20) + AppendOutToken(packets, ep, address, inter_pkt_gap=20) packets.append(TxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) #DATA0 - AppendInToken(packets, ep, inter_pkt_gap=58) + AppendInToken(packets, ep, address, inter_pkt_gap=58) packets.append(RxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) data_val = data_val + pkt_length #data_pid = data_pid ^ 8 - do_rx_test(arch, clk, phy, packets, __file__, seed, - level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): random.seed(1) diff --git a/tests/test_iso_rxtx_fastpacket/Makefile b/tests/test_iso_rxtx_fastpacket/Makefile index 4319e1c8..6aed3e76 100644 --- a/tests/test_iso_rxtx_fastpacket/Makefile +++ b/tests/test_iso_rxtx_fastpacket/Makefile @@ -1,50 +1 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. - -TARGET = test.xn - -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name - -APP_NAME = - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. - -SHARED_CODE = ../../shared_src - -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L -Wno-timing - -XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES - -XCC_FLAGS_xs1 = $(COMMON_FLAGS) -DARCH_S -DXUD_SERIES_SUPPORT=XUD_U_SERIES - - - -ifeq ($(CONFIG),$(filter $(CONFIG),xs1)) - TARGET = test_xs1.xn -endif - -ifeq ($(CONFIG),$(filter $(CONFIG),xs2)) - TARGET = test.xn -endif - - - -# The USED_MODULES variable lists other module used by the application. -USED_MODULES = lib_xud - - -#============================================================================= -# The following part of the Makefile includes the common build infrastructure -# for compiling XMOS applications. You should not need to edit below here. - -XMOS_MAKE_PATH ?= ../.. -include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common +include ../test_makefile.mak diff --git a/tests/test_iso_rxtx_fastpacket/src/test_xs2.xn b/tests/test_iso_rxtx_fastpacket/src/test_xs2.xn new file mode 100644 index 00000000..d0ee86b8 --- /dev/null +++ b/tests/test_iso_rxtx_fastpacket/src/test_xs2.xn @@ -0,0 +1,72 @@ + + + Board + XS2 MC Audio + + tileref tile[2] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_iso_rxtx_fastpacket/src/test_xs3.xn b/tests/test_iso_rxtx_fastpacket/src/test_xs3.xn new file mode 100644 index 00000000..ab436573 --- /dev/null +++ b/tests/test_iso_rxtx_fastpacket/src/test_xs3.xn @@ -0,0 +1,24 @@ + + + + tileref tile[2] + + + + + + + + + + + + + + + + + + diff --git a/tests/test_iso_tx_basic.py b/tests/test_iso_tx_basic.py index 445a9adc..c8afc6a5 100644 --- a/tests/test_iso_tx_basic.py +++ b/tests/test_iso_tx_basic.py @@ -3,10 +3,8 @@ import random import xmostest from usb_packet import * -#import * AppendSetupToken, TxDataPacket, RxDataPacket, TokenPacket, RxHandshakePacket, TxHandshakePacket from usb_clock import Clock -from helpers import do_rx_test, packet_processing_time, get_dut_address -from helpers import choose_small_frame_size, check_received_packet, runall_rx +from helpers import do_usb_test, runall_rx # Single, setup transaction to EP 0 @@ -16,34 +14,33 @@ def do_test(arch, tx_clk, tx_phy, seed): rand.seed(seed) ep = 3 + address = 1 # The inter-frame gap is to give the DUT time to print its output packets = [] dataval = 0; - AppendInToken(packets, ep) + AppendInToken(packets, ep, address) packets.append(RxDataPacket(rand, data_start_val=dataval, length=10, pid=0x3)) #DATA0 dataval += 10 - AppendInToken(packets, ep, inter_pkt_gap=2000) + AppendInToken(packets, ep, address, inter_pkt_gap=2000) packets.append(RxDataPacket(rand, data_start_val=dataval, length=11, pid=0x3)) #DATA0 dataval += 11 - AppendInToken(packets, ep, inter_pkt_gap=2000) + AppendInToken(packets, ep, address, inter_pkt_gap=2000) packets.append(RxDataPacket(rand, data_start_val=dataval, length=12, pid=0x3)) #DATA0 dataval += 12 - AppendInToken(packets, ep, inter_pkt_gap=2000) + AppendInToken(packets, ep, address, inter_pkt_gap=2000) packets.append(RxDataPacket(rand, data_start_val=dataval, length=13, pid=0x3)) #DATA0 dataval += 13 - AppendInToken(packets, ep, inter_pkt_gap=2000) + AppendInToken(packets, ep, address, inter_pkt_gap=2000) packets.append(RxDataPacket(rand, data_start_val=dataval, length=14, pid=0x3)) #DATA0 - # Note, quite big gap to allow checking. - do_rx_test(arch, tx_clk, tx_phy, packets, __file__, seed, - level='smoke', extra_tasks=[]) + do_usb_test(arch, tx_clk, tx_phy, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): random.seed(1) diff --git a/tests/test_ping_rx_basic.py b/tests/test_ping_rx_basic.py index c98418b6..b2671eba 100644 --- a/tests/test_ping_rx_basic.py +++ b/tests/test_ping_rx_basic.py @@ -5,19 +5,14 @@ import random import xmostest from usb_packet import * -#import * AppendSetupToken, TxDataPacket, RxDataPacket, TokenPacket, RxHandshakePacket, TxHandshakePacket from usb_clock import Clock -from helpers import do_rx_test, packet_processing_time, get_dut_address -from helpers import choose_small_frame_size, check_received_packet, runall_rx - - -# Single, setup transaction to EP 0 +from helpers import do_usb_test, runall_rx def do_test(arch, clk, phy, seed): rand = random.Random() rand.seed(seed) - dev_address = get_dut_address() + address = 1 ep = 1 # The inter-frame gap is to give the DUT time to print its output @@ -26,44 +21,40 @@ def do_test(arch, clk, phy, seed): dataval = 0; # Ping EP 2, expect NAK - AppendPingToken(packets, 2) + AppendPingToken(packets, 2, address) packets.append(RxHandshakePacket(pid=0x5a)) # And again - AppendPingToken(packets, 2) + AppendPingToken(packets, 2, address) packets.append(RxHandshakePacket(pid=0x5a)) - # Send packet to EP 1, xCORE should mark EP 2 as ready - AppendOutToken(packets, ep) + AppendOutToken(packets, ep, address) packets.append(TxDataPacket(rand, data_start_val=dataval, length=10, pid=0x3)) #DATA0 packets.append(RxHandshakePacket()) # Ping EP 2 again - expect ACK - AppendPingToken(packets, 2, inter_pkt_gap=6000) + AppendPingToken(packets, 2, address, inter_pkt_gap=6000) packets.append(RxHandshakePacket()) # And again.. - AppendPingToken(packets, 2) + AppendPingToken(packets, 2, address) packets.append(RxHandshakePacket()) # Send out to EP 2.. expect ack - AppendOutToken(packets, 2, inter_pkt_gap=6000) + AppendOutToken(packets, 2,address, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, length=10, pid=0x3)) #DATA0 packets.append(RxHandshakePacket()) - # Re-Ping EP 2, expect NAK - AppendPingToken(packets, 2) + # Re-Ping EP 2, expect NAK + AppendPingToken(packets, 2, address) packets.append(RxHandshakePacket(pid=0x5a)) # And again - AppendPingToken(packets, 2) + AppendPingToken(packets, 2, address) packets.append(RxHandshakePacket(pid=0x5a)) - - - do_rx_test(arch, clk, phy, packets, __file__, seed, - level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, packets, __file__, seed,level='smoke', extra_tasks=[]) def runtest(): random.seed(1) diff --git a/tests/test_ping_rx_basic/Makefile b/tests/test_ping_rx_basic/Makefile index 4319e1c8..6aed3e76 100644 --- a/tests/test_ping_rx_basic/Makefile +++ b/tests/test_ping_rx_basic/Makefile @@ -1,50 +1 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. - -TARGET = test.xn - -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name - -APP_NAME = - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. - -SHARED_CODE = ../../shared_src - -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L -Wno-timing - -XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES - -XCC_FLAGS_xs1 = $(COMMON_FLAGS) -DARCH_S -DXUD_SERIES_SUPPORT=XUD_U_SERIES - - - -ifeq ($(CONFIG),$(filter $(CONFIG),xs1)) - TARGET = test_xs1.xn -endif - -ifeq ($(CONFIG),$(filter $(CONFIG),xs2)) - TARGET = test.xn -endif - - - -# The USED_MODULES variable lists other module used by the application. -USED_MODULES = lib_xud - - -#============================================================================= -# The following part of the Makefile includes the common build infrastructure -# for compiling XMOS applications. You should not need to edit below here. - -XMOS_MAKE_PATH ?= ../.. -include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common +include ../test_makefile.mak diff --git a/tests/test_ping_rx_basic/src/test_xs2.xn b/tests/test_ping_rx_basic/src/test_xs2.xn new file mode 100644 index 00000000..d0ee86b8 --- /dev/null +++ b/tests/test_ping_rx_basic/src/test_xs2.xn @@ -0,0 +1,72 @@ + + + Board + XS2 MC Audio + + tileref tile[2] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_ping_rx_basic/src/test_xs3.xn b/tests/test_ping_rx_basic/src/test_xs3.xn new file mode 100644 index 00000000..ab436573 --- /dev/null +++ b/tests/test_ping_rx_basic/src/test_xs3.xn @@ -0,0 +1,24 @@ + + + + tileref tile[2] + + + + + + + + + + + + + + + + + + diff --git a/tests/usb_packet.py b/tests/usb_packet.py index e0efdf8a..77aa77a8 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -12,7 +12,7 @@ def AppendOutToken(packets, ep, address, **kwargs): ipg = kwargs.pop('inter_pkt_gap', 500) AppendTokenPacket(packets, 0xe1, ep, ipg, address) -def AppendPingToken(packets, ep, address, *kwargs): +def AppendPingToken(packets, ep, address, **kwargs): ipg = kwargs.pop('inter_pkt_gap', 500) AppendTokenPacket(packets, 0xb4, ep, ipg, address) From bb90f17544688f5fc63173c000694d9f97b272bd Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 25 Jun 2019 23:44:58 +0100 Subject: [PATCH 029/520] test_ping_rx_basic now robust to DUT exiting --- tests/test_ping_rx_basic.py | 5 ++++ tests/test_ping_rx_basic/src/main.xc | 15 +++++++++- tests/testsummary.txt | 43 ++++++++++++++++++++++++++++ tests/usb_packet.py | 3 +- 4 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 tests/testsummary.txt diff --git a/tests/test_ping_rx_basic.py b/tests/test_ping_rx_basic.py index b2671eba..cbc0f463 100644 --- a/tests/test_ping_rx_basic.py +++ b/tests/test_ping_rx_basic.py @@ -54,6 +54,11 @@ def do_test(arch, clk, phy, seed): AppendPingToken(packets, 2, address) packets.append(RxHandshakePacket(pid=0x5a)) + # Send a packet to EP 1 so the DUT knows it can exit. + AppendOutToken(packets, ep, address) + packets.append(TxDataPacket(rand, data_start_val=dataval+10, length=10, pid=0x3^8)) #DATA1 + packets.append(RxHandshakePacket()) + do_usb_test(arch, clk, phy, packets, __file__, seed,level='smoke', extra_tasks=[]) def runtest(): diff --git a/tests/test_ping_rx_basic/src/main.xc b/tests/test_ping_rx_basic/src/main.xc index f256f8df..f9b873ed 100644 --- a/tests/test_ping_rx_basic/src/main.xc +++ b/tests/test_ping_rx_basic/src/main.xc @@ -49,7 +49,6 @@ int TestEp_PingTest(chanend c_out[], int epNum1, int epNum2) } } - XUD_GetBuffer(ep_out2, buffer, length); @@ -63,6 +62,20 @@ int TestEp_PingTest(chanend c_out[], int epNum1, int epNum2) { fail(FAIL_RX_DATAERROR); } + + // Another packet to EP 1 means we can exit + XUD_GetBuffer(ep_out1, buffer, length); + + if(length != i) + { + printintln(length); + fail(FAIL_RX_LENERROR); + } + + if(RxDataCheck(buffer, length, epNum1)) + { + fail(FAIL_RX_DATAERROR); + } return 0; } diff --git a/tests/testsummary.txt b/tests/testsummary.txt new file mode 100644 index 00000000..add12904 --- /dev/null +++ b/tests/testsummary.txt @@ -0,0 +1,43 @@ +------------ +TEST SUMMARY +------------ +lib_xud::xud_sim_tests::test_bulk_loopback[arch=xs3;clk=60Mhz] PASS +lib_xud::xud_sim_tests::test_bulk_loopback[arch=xs2;clk=60Mhz] PASS +lib_xud::xud_sim_tests::test_bulk_rx_basic[arch=xs3;clk=60Mhz] PASS +lib_xud::xud_sim_tests::test_bulk_rx_basic[arch=xs2;clk=60Mhz] PASS +lib_xud::xud_sim_tests::test_bulk_rx_basic_badcrc32[arch=xs3;clk=60Mhz] PASS +lib_xud::xud_sim_tests::test_bulk_rx_basic_badcrc32[arch=xs2;clk=60Mhz] PASS +lib_xud::xud_sim_tests::test_bulk_rx_basic_badpid[arch=xs3;clk=60Mhz] PASS +lib_xud::xud_sim_tests::test_bulk_rx_basic_badpid[arch=xs2;clk=60Mhz] PASS +lib_xud::xud_sim_tests::test_bulk_rx_basic_rxerror[arch=xs3;clk=60Mhz] FAIL +lib_xud::xud_sim_tests::test_bulk_rx_basic_rxerror[arch=xs2;clk=60Mhz] FAIL +lib_xud::xud_sim_tests::test_bulk_rx_fastpacket[arch=xs3;clk=60Mhz] PASS +lib_xud::xud_sim_tests::test_bulk_rx_fastpacket[arch=xs2;clk=60Mhz] PASS +lib_xud::xud_sim_tests::test_bulk_rx_fastpacket_multiep[arch=xs3;clk=60Mhz] PASS +lib_xud::xud_sim_tests::test_bulk_rx_fastpacket_multiep[arch=xs2;clk=60Mhz] FAIL +lib_xud::xud_sim_tests::test_bulk_rxtx_fastpacket[arch=xs3;clk=60Mhz] PASS +lib_xud::xud_sim_tests::test_bulk_rxtx_fastpacket[arch=xs2;clk=60Mhz] PASS +lib_xud::xud_sim_tests::test_bulk_tx_basic[arch=xs3;clk=60Mhz] PASS +lib_xud::xud_sim_tests::test_bulk_tx_basic[arch=xs2;clk=60Mhz] PASS +lib_xud::xud_sim_tests::test_bulk_tx_basic_noack[arch=xs3;clk=60Mhz] PASS +lib_xud::xud_sim_tests::test_bulk_tx_basic_noack[arch=xs2;clk=60Mhz] PASS +lib_xud::xud_sim_tests::test_bulk_tx_fastpacket[arch=xs3;clk=60Mhz] PASS +lib_xud::xud_sim_tests::test_bulk_tx_fastpacket[arch=xs2;clk=60Mhz] PASS +lib_xud::xud_sim_tests::test_bulk_tx_fastpacket_multiep[arch=xs3;clk=60Mhz] PASS +lib_xud::xud_sim_tests::test_bulk_tx_fastpacket_multiep[arch=xs2;clk=60Mhz] PASS +lib_xud::xud_sim_tests::test_invalidtoken[arch=xs3;clk=60Mhz] FAIL +lib_xud::xud_sim_tests::test_invalidtoken[arch=xs2;clk=60Mhz] PASS +lib_xud::xud_sim_tests::test_iso_loopback[arch=xs3;clk=60Mhz] PASS +lib_xud::xud_sim_tests::test_iso_loopback[arch=xs2;clk=60Mhz] PASS +lib_xud::xud_sim_tests::test_iso_rx_basic[arch=xs3;clk=60Mhz] PASS +lib_xud::xud_sim_tests::test_iso_rx_basic[arch=xs2;clk=60Mhz] PASS +lib_xud::xud_sim_tests::test_iso_rxtx_fastpacket[arch=xs3;clk=60Mhz] FAIL +lib_xud::xud_sim_tests::test_iso_rxtx_fastpacket[arch=xs2;clk=60Mhz] FAIL +lib_xud::xud_sim_tests::test_iso_tx_basic[arch=xs3;clk=60Mhz] FAIL +lib_xud::xud_sim_tests::test_iso_tx_basic[arch=xs2;clk=60Mhz] PASS +lib_xud::xud_sim_tests::test_ping_rx_basic[arch=xs3;clk=60Mhz] PASS +lib_xud::xud_sim_tests::test_ping_rx_basic[arch=xs2;clk=60Mhz] PASS +------------ +28/36 PASSED +------------ + diff --git a/tests/usb_packet.py b/tests/usb_packet.py index 77aa77a8..bc13d3a4 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -155,7 +155,8 @@ def get_pid_pretty(self): return "DATA0" elif self.pid == 105: return "IN" - + elif self.pid == 180: + return "PING" else: return "UNKNOWN" From 8a21888db873977ebb99bc888d49551c77801af5 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 25 Jun 2019 23:52:37 +0100 Subject: [PATCH 030/520] Timings tweaks on test_bulk_rx_fastpacket_multiep for xs2 pass --- tests/test_bulk_rx_fastpacket_multiep.py | 8 ++++---- tests/testsummary.txt | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_bulk_rx_fastpacket_multiep.py b/tests/test_bulk_rx_fastpacket_multiep.py index fb0cb6f6..21994853 100644 --- a/tests/test_bulk_rx_fastpacket_multiep.py +++ b/tests/test_bulk_rx_fastpacket_multiep.py @@ -23,19 +23,19 @@ def do_test(arch, clk, phy, seed): #min 237 AppendOutToken(packets, 3, address, inter_pkt_gap=1) packets.append(TxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) #DATA0 - packets.append(RxHandshakePacket(timeout=9)) + packets.append(RxHandshakePacket(timeout=10)) AppendOutToken(packets, 4, address, inter_pkt_gap=1) packets.append(TxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) #DATA0 - packets.append(RxHandshakePacket(timeout=9)) + packets.append(RxHandshakePacket(timeout=10)) AppendOutToken(packets, 5, address, inter_pkt_gap=0) packets.append(TxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) #DATA0 - packets.append(RxHandshakePacket(timeout=9)) + packets.append(RxHandshakePacket(timeout=10)) AppendOutToken(packets, 6, address, inter_pkt_gap=0) packets.append(TxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) #DATA0 - packets.append(RxHandshakePacket(timeout=9)) + packets.append(RxHandshakePacket(timeout=10)) data_val = data_val + pkt_length data_pid = data_pid ^ 8 diff --git a/tests/testsummary.txt b/tests/testsummary.txt index add12904..be048cba 100644 --- a/tests/testsummary.txt +++ b/tests/testsummary.txt @@ -14,7 +14,7 @@ lib_xud::xud_sim_tests::test_bulk_rx_basic_rxerror[arch=xs2;clk=60Mhz] FAIL lib_xud::xud_sim_tests::test_bulk_rx_fastpacket[arch=xs3;clk=60Mhz] PASS lib_xud::xud_sim_tests::test_bulk_rx_fastpacket[arch=xs2;clk=60Mhz] PASS lib_xud::xud_sim_tests::test_bulk_rx_fastpacket_multiep[arch=xs3;clk=60Mhz] PASS -lib_xud::xud_sim_tests::test_bulk_rx_fastpacket_multiep[arch=xs2;clk=60Mhz] FAIL +lib_xud::xud_sim_tests::test_bulk_rx_fastpacket_multiep[arch=xs2;clk=60Mhz] PASS lib_xud::xud_sim_tests::test_bulk_rxtx_fastpacket[arch=xs3;clk=60Mhz] PASS lib_xud::xud_sim_tests::test_bulk_rxtx_fastpacket[arch=xs2;clk=60Mhz] PASS lib_xud::xud_sim_tests::test_bulk_tx_basic[arch=xs3;clk=60Mhz] PASS From 0262877ca49554aac9fa50eb3c10caa5dd3b2312 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 25 Jun 2019 23:58:00 +0100 Subject: [PATCH 031/520] Fixed test_invalidtoken for xs3 --- tests/test_invalidtoken.py | 10 +++++----- tests/testsummary.txt | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/test_invalidtoken.py b/tests/test_invalidtoken.py index 11b19bd9..4b2466dd 100644 --- a/tests/test_invalidtoken.py +++ b/tests/test_invalidtoken.py @@ -34,15 +34,15 @@ def do_test(arch, clk, phy, seed): packets.append(TokenPacket( inter_pkt_gap=200, pid=0x69, - address=address, + address=address+1, endpoint=ep, - valid=False)) + valid=False)) #Note, the valid is the valid flag for xs2 # Valid OUT but not for us.. packets.append(TokenPacket( inter_pkt_gap=200, pid=0xe1, - address=address, + address=address+1, endpoint=ep, valid=False)) @@ -54,7 +54,7 @@ def do_test(arch, clk, phy, seed): packets.append(TokenPacket( inter_pkt_gap=200, pid=0x2d, - address=address, + address=address+2, endpoint=ep, valid=False)) @@ -69,7 +69,7 @@ def do_test(arch, clk, phy, seed): packets.append(TokenPacket( inter_pkt_gap=200, pid=0xb4, - address=address, + address=address+3, endpoint=ep, valid=False)) diff --git a/tests/testsummary.txt b/tests/testsummary.txt index be048cba..e6ae2c4c 100644 --- a/tests/testsummary.txt +++ b/tests/testsummary.txt @@ -25,7 +25,7 @@ lib_xud::xud_sim_tests::test_bulk_tx_fastpacket[arch=xs3;clk=60Mhz] PASS lib_xud::xud_sim_tests::test_bulk_tx_fastpacket[arch=xs2;clk=60Mhz] PASS lib_xud::xud_sim_tests::test_bulk_tx_fastpacket_multiep[arch=xs3;clk=60Mhz] PASS lib_xud::xud_sim_tests::test_bulk_tx_fastpacket_multiep[arch=xs2;clk=60Mhz] PASS -lib_xud::xud_sim_tests::test_invalidtoken[arch=xs3;clk=60Mhz] FAIL +lib_xud::xud_sim_tests::test_invalidtoken[arch=xs3;clk=60Mhz] PASS lib_xud::xud_sim_tests::test_invalidtoken[arch=xs2;clk=60Mhz] PASS lib_xud::xud_sim_tests::test_iso_loopback[arch=xs3;clk=60Mhz] PASS lib_xud::xud_sim_tests::test_iso_loopback[arch=xs2;clk=60Mhz] PASS From 3600ce6938671d25e7f28fb8ce4b08e532f7c914 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 26 Jun 2019 10:42:17 +0100 Subject: [PATCH 032/520] Fixed test_iso_rxtx_fastpacket for XS3 (timing). XS2 still fails. --- lib_xud/src/core/included/XUD_Token_Out.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xud/src/core/included/XUD_Token_Out.S b/lib_xud/src/core/included/XUD_Token_Out.S index 298cce42..8c512981 100755 --- a/lib_xud/src/core/included/XUD_Token_Out.S +++ b/lib_xud/src/core/included/XUD_Token_Out.S @@ -39,7 +39,7 @@ InformEP_Iso: // Iso EP - no handshake ldc r7, 0xf335 // CRC16 init (in) ldc r6, 0x3334 // CRC16 init (out) - Needs reseting after an out -#ifndef ARCH_G +#ifndef __XS3A__ ldw r1, sp[STACK_FLAG0_PORT] #endif //ldc r4, XUD_MAX_NUM_EP_OUT // This could be shaved if XUD_MAX_NUM_EP's < 12. Now use an LDAW to at 16. From 24688d1e1dc4249b8f22c05c1ec55ac77cef8fb1 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 26 Jun 2019 10:47:25 +0100 Subject: [PATCH 033/520] Updated testsummary.txt --- tests/testsummary.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/testsummary.txt b/tests/testsummary.txt index e6ae2c4c..3cf8dd60 100644 --- a/tests/testsummary.txt +++ b/tests/testsummary.txt @@ -31,13 +31,13 @@ lib_xud::xud_sim_tests::test_iso_loopback[arch=xs3;clk=60Mhz] PASS lib_xud::xud_sim_tests::test_iso_loopback[arch=xs2;clk=60Mhz] PASS lib_xud::xud_sim_tests::test_iso_rx_basic[arch=xs3;clk=60Mhz] PASS lib_xud::xud_sim_tests::test_iso_rx_basic[arch=xs2;clk=60Mhz] PASS -lib_xud::xud_sim_tests::test_iso_rxtx_fastpacket[arch=xs3;clk=60Mhz] FAIL +lib_xud::xud_sim_tests::test_iso_rxtx_fastpacket[arch=xs3;clk=60Mhz] PASS lib_xud::xud_sim_tests::test_iso_rxtx_fastpacket[arch=xs2;clk=60Mhz] FAIL lib_xud::xud_sim_tests::test_iso_tx_basic[arch=xs3;clk=60Mhz] FAIL lib_xud::xud_sim_tests::test_iso_tx_basic[arch=xs2;clk=60Mhz] PASS lib_xud::xud_sim_tests::test_ping_rx_basic[arch=xs3;clk=60Mhz] PASS lib_xud::xud_sim_tests::test_ping_rx_basic[arch=xs2;clk=60Mhz] PASS ------------ -28/36 PASSED +32/36 PASSED ------------ From b0345c0e1e712a81afb54e979894060845c6fe3e Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 26 Jun 2019 11:00:27 +0100 Subject: [PATCH 034/520] Fixes for test_iso_tx_basic for xs3 --- tests/test_iso_tx_basic/Makefile | 51 +----------------- tests/test_iso_tx_basic/src/test_xs2.xn | 72 +++++++++++++++++++++++++ tests/test_iso_tx_basic/src/test_xs3.xn | 24 +++++++++ tests/testsummary.txt | 5 +- 4 files changed, 99 insertions(+), 53 deletions(-) create mode 100644 tests/test_iso_tx_basic/src/test_xs2.xn create mode 100644 tests/test_iso_tx_basic/src/test_xs3.xn diff --git a/tests/test_iso_tx_basic/Makefile b/tests/test_iso_tx_basic/Makefile index 4319e1c8..6aed3e76 100644 --- a/tests/test_iso_tx_basic/Makefile +++ b/tests/test_iso_tx_basic/Makefile @@ -1,50 +1 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. - -TARGET = test.xn - -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name - -APP_NAME = - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. - -SHARED_CODE = ../../shared_src - -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L -Wno-timing - -XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES - -XCC_FLAGS_xs1 = $(COMMON_FLAGS) -DARCH_S -DXUD_SERIES_SUPPORT=XUD_U_SERIES - - - -ifeq ($(CONFIG),$(filter $(CONFIG),xs1)) - TARGET = test_xs1.xn -endif - -ifeq ($(CONFIG),$(filter $(CONFIG),xs2)) - TARGET = test.xn -endif - - - -# The USED_MODULES variable lists other module used by the application. -USED_MODULES = lib_xud - - -#============================================================================= -# The following part of the Makefile includes the common build infrastructure -# for compiling XMOS applications. You should not need to edit below here. - -XMOS_MAKE_PATH ?= ../.. -include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common +include ../test_makefile.mak diff --git a/tests/test_iso_tx_basic/src/test_xs2.xn b/tests/test_iso_tx_basic/src/test_xs2.xn new file mode 100644 index 00000000..d0ee86b8 --- /dev/null +++ b/tests/test_iso_tx_basic/src/test_xs2.xn @@ -0,0 +1,72 @@ + + + Board + XS2 MC Audio + + tileref tile[2] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_iso_tx_basic/src/test_xs3.xn b/tests/test_iso_tx_basic/src/test_xs3.xn new file mode 100644 index 00000000..ab436573 --- /dev/null +++ b/tests/test_iso_tx_basic/src/test_xs3.xn @@ -0,0 +1,24 @@ + + + + tileref tile[2] + + + + + + + + + + + + + + + + + + diff --git a/tests/testsummary.txt b/tests/testsummary.txt index 3cf8dd60..16603e22 100644 --- a/tests/testsummary.txt +++ b/tests/testsummary.txt @@ -33,11 +33,10 @@ lib_xud::xud_sim_tests::test_iso_rx_basic[arch=xs3;clk=60Mhz] PASS lib_xud::xud_sim_tests::test_iso_rx_basic[arch=xs2;clk=60Mhz] PASS lib_xud::xud_sim_tests::test_iso_rxtx_fastpacket[arch=xs3;clk=60Mhz] PASS lib_xud::xud_sim_tests::test_iso_rxtx_fastpacket[arch=xs2;clk=60Mhz] FAIL -lib_xud::xud_sim_tests::test_iso_tx_basic[arch=xs3;clk=60Mhz] FAIL +lib_xud::xud_sim_tests::test_iso_tx_basic[arch=xs3;clk=60Mhz] PASS lib_xud::xud_sim_tests::test_iso_tx_basic[arch=xs2;clk=60Mhz] PASS lib_xud::xud_sim_tests::test_ping_rx_basic[arch=xs3;clk=60Mhz] PASS lib_xud::xud_sim_tests::test_ping_rx_basic[arch=xs2;clk=60Mhz] PASS ------------ -32/36 PASSED +33/36 PASSED ------------ - From 3003b61371104bad793fc627a21760770d2ac15b Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 26 Jun 2019 14:23:33 +0100 Subject: [PATCH 035/520] Implemented get_bytes in TxPacket such that arbitrary (invalid) packets can be sent (fixed order of inheritance in TxDataPacket --- tests/usb_packet.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/usb_packet.py b/tests/usb_packet.py index bc13d3a4..d3225be3 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -135,8 +135,8 @@ class UsbPacket(object): def __init__(self, **kwargs): self.pid = kwargs.pop('pid', 0xc3) + self.data_bytes = kwargs.pop('data_bytes', None) self.num_data_bytes = kwargs.pop('length', 0) - self.data_bytes = None self.data_valid_count = kwargs.pop('data_valid_count', 0) self.bad_crc = kwargs.pop('bad_crc', False) @@ -186,6 +186,18 @@ def __init__(self, **kwargs): def get_inter_pkt_gap(self): return self.inter_pkt_gap +# Implemented such that we can generate broken or bad packets + def get_bytes(self, do_tokens=False): + bytes = [] + if do_tokens: + bytes.append(self.pid) + else: + bytes.append(self.pid | ((~self.pid) << 4)) + for x in range(len(self.data_bytes)): + bytes.append(self.data_bytes[x]) + return bytes + + # DataPacket class, inherits from Usb Packet class DataPacket(UsbPacket): @@ -237,7 +249,7 @@ def __init__(self, rand, **kwargs): #Re-construct full PID - xCORE sends out full PIDn | PID on Tx super(RxDataPacket, self).__init__(pid = (_pid & 0xf) | (((~_pid)&0xf) << 4), **kwargs) -class TxDataPacket(TxPacket, DataPacket): +class TxDataPacket(DataPacket, TxPacket): def __init__(self, rand, **kwargs): super(TxDataPacket, self).__init__(**kwargs) From 3599f86b05e1da52730bc0cee5b8806d0e53196d Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 26 Jun 2019 14:23:41 +0100 Subject: [PATCH 036/520] Added test_shorttoken --- tests/test_shorttoken.py | 47 +++++++++ tests/test_shorttoken/LICENSE.txt | 135 ++++++++++++++++++++++++++ tests/test_shorttoken/Makefile | 1 + tests/test_shorttoken/src/main.xc | 68 +++++++++++++ tests/test_shorttoken/src/test.xn | 72 ++++++++++++++ tests/test_shorttoken/src/test_xs1.xn | 89 +++++++++++++++++ tests/test_shorttoken/src/test_xs2.xn | 72 ++++++++++++++ tests/test_shorttoken/src/test_xs3.xn | 24 +++++ 8 files changed, 508 insertions(+) create mode 100644 tests/test_shorttoken.py create mode 100644 tests/test_shorttoken/LICENSE.txt create mode 100644 tests/test_shorttoken/Makefile create mode 100644 tests/test_shorttoken/src/main.xc create mode 100644 tests/test_shorttoken/src/test.xn create mode 100755 tests/test_shorttoken/src/test_xs1.xn create mode 100644 tests/test_shorttoken/src/test_xs2.xn create mode 100644 tests/test_shorttoken/src/test_xs3.xn diff --git a/tests/test_shorttoken.py b/tests/test_shorttoken.py new file mode 100644 index 00000000..bbe11547 --- /dev/null +++ b/tests/test_shorttoken.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python + +# Same as simple RX bulk test but some invalid tokens also included + +import random +import xmostest +from usb_packet import * +from usb_clock import Clock +from helpers import do_usb_test, runall_rx + + +# Single, setup transaction to EP 0 + +def do_test(arch, clk, phy, seed): + rand = random.Random() + rand.seed(seed) + + address = 1 + ep = 1 + + packets = [] + dataval = 0; + + + # Start with a valid transaction */ + AppendOutToken(packets, ep, address) + packets.append(TxDataPacket(rand, data_start_val=dataval, length=10, pid=0x3)) #DATA0 + packets.append(RxHandshakePacket()) + + # tmp hack for xs2 - for xs2 the shim will throw away the short token and it will never be seen by the xCORE + + if arch == 'xs3': + # Create a short token, only PID and 2nd byte + shorttoken = TxPacket(pid=0xe1, data_bytes = [0x81], inter_pkt_gap=100) + packets.append(shorttoken) + + #Finish with valid transaction + dataval += 10 + AppendOutToken(packets, ep, address, inter_pkt_gap=6000) + packets.append(TxDataPacket(rand, data_start_val=dataval, length=11, pid=0xb)) #DATA1 + packets.append(RxHandshakePacket()) + + do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) + +def runtest(): + random.seed(1) + runall_rx(do_test) diff --git a/tests/test_shorttoken/LICENSE.txt b/tests/test_shorttoken/LICENSE.txt new file mode 100644 index 00000000..994856c9 --- /dev/null +++ b/tests/test_shorttoken/LICENSE.txt @@ -0,0 +1,135 @@ +Software Release License Agreement + +Copyright (c) 2015-2018, XMOS, All rights reserved. + +BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. + +Parties: + +(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). + +(2) An individual or legal entity exercising permissions granted by this License (Customer). + +If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. + +1. Definitions + +"License" means this Software License and any schedules or annexes to it. + +"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License + +"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. + +"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. + +"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. + +"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. + +The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. + +Unless the context otherwise requires: + +- references to XMOS and the Customer include their permitted successors and assigns; +- references to statutory provisions include those statutory provisions as amended or re-enacted; and +- references to any gender include all genders. + +Words in the singular include the plural and in the plural include the singular. + +2. License + +XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. + +Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. + +3. Consideration + +In consideration of the mutual obligations contained in this License, the parties agree to its terms. + +4. Term + +Subject to clause 12 below, this License shall be perpetual. + +5. Restrictions on Use + +The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. + +6. Modifications + +The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. + +XMOS will own all intellectual property rights in the XMOS Modifications. +The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. + +7. Support + +Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. + +8. Warranty and Disclaimer + +The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). + +Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. + +XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. + +9. High Risk Activities + +The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. + +10. Liability + +TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. + +Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. + +11. Ownership + +The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. + +12. Termination + +Either party may terminate this License at any time on written notice to the other if the other: + +- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or + +- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. + +Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. + +On termination for any reason: + +- all rights granted to the Customer under this License shall cease; +- the Customer shall cease all activities authorised by this License; +- the Customer shall immediately pay any sums due to XMOS under this License; and +- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. + +Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. + +13. Third party rights + +No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. + +14. Confidentiality and publicity + +Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. + +The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. +The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. + +15. Entire agreement + +This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. + +16. Assignment + +The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. + +17. Governing law and jurisdiction + +This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. + +This License has been entered into on the date stated at the beginning of it. + +Schedule +XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_shorttoken/Makefile b/tests/test_shorttoken/Makefile new file mode 100644 index 00000000..6aed3e76 --- /dev/null +++ b/tests/test_shorttoken/Makefile @@ -0,0 +1 @@ +include ../test_makefile.mak diff --git a/tests/test_shorttoken/src/main.xc b/tests/test_shorttoken/src/main.xc new file mode 100644 index 00000000..a9678307 --- /dev/null +++ b/tests/test_shorttoken/src/main.xc @@ -0,0 +1,68 @@ +// Copyright (c) 2016-2019, XMOS Ltd, All rights reserved +#include +#include +#include +#include "xud.h" +#include "platform.h" +#include "shared.h" + +#define XUD_EP_COUNT_OUT 5 +#define XUD_EP_COUNT_IN 5 + +/* Endpoint type tables */ +XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL,XUD_EPTYPE_BUL}; +XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; + +void exit(int); + +int TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_out_0) +{ + unsigned int length; + XUD_Result_t res; + + XUD_ep ep_out_0 = XUD_InitEp(c_out_0); + XUD_ep ep_out = XUD_InitEp(c_out); + XUD_ep ep_in = XUD_InitEp(c_in); + + /* Buffer for Setup data */ + unsigned char buffer[1024]; + + for(int i = 10; i <= 11; i++) + { + XUD_GetBuffer(ep_out, buffer, length); + + if(length != i) + { + printintln(length); + fail(FAIL_RX_LENERROR); + } + + if(RxDataCheck(buffer, length, epNum)) + { + fail(FAIL_RX_DATAERROR); + } + + } + + XUD_Kill(ep_out_0); + exit(0); +} + + +int main() +{ + chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + + par + { + + XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + null, epTypeTableOut, epTypeTableIn, + null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); + + + TestEp_Bulk(c_ep_out[1], c_ep_in[1], 1, c_ep_out[0]); + } + + return 0; +} diff --git a/tests/test_shorttoken/src/test.xn b/tests/test_shorttoken/src/test.xn new file mode 100644 index 00000000..d0ee86b8 --- /dev/null +++ b/tests/test_shorttoken/src/test.xn @@ -0,0 +1,72 @@ + + + Board + XS2 MC Audio + + tileref tile[2] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_shorttoken/src/test_xs1.xn b/tests/test_shorttoken/src/test_xs1.xn new file mode 100755 index 00000000..573aef45 --- /dev/null +++ b/tests/test_shorttoken/src/test_xs1.xn @@ -0,0 +1,89 @@ + + + + + tileref tile[1] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_shorttoken/src/test_xs2.xn b/tests/test_shorttoken/src/test_xs2.xn new file mode 100644 index 00000000..d0ee86b8 --- /dev/null +++ b/tests/test_shorttoken/src/test_xs2.xn @@ -0,0 +1,72 @@ + + + Board + XS2 MC Audio + + tileref tile[2] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_shorttoken/src/test_xs3.xn b/tests/test_shorttoken/src/test_xs3.xn new file mode 100644 index 00000000..ab436573 --- /dev/null +++ b/tests/test_shorttoken/src/test_xs3.xn @@ -0,0 +1,24 @@ + + + + tileref tile[2] + + + + + + + + + + + + + + + + + + From 4e3b9cd646f92bdd424b27c269bfde151fc8727f Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 26 Jun 2019 16:49:55 +0100 Subject: [PATCH 037/520] Uodated test summary --- tests/testsummary.txt | 4 +++- tests/usb_packet.py | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/testsummary.txt b/tests/testsummary.txt index 16603e22..9905b0a2 100644 --- a/tests/testsummary.txt +++ b/tests/testsummary.txt @@ -37,6 +37,8 @@ lib_xud::xud_sim_tests::test_iso_tx_basic[arch=xs3;clk=60Mhz] PASS lib_xud::xud_sim_tests::test_iso_tx_basic[arch=xs2;clk=60Mhz] PASS lib_xud::xud_sim_tests::test_ping_rx_basic[arch=xs3;clk=60Mhz] PASS lib_xud::xud_sim_tests::test_ping_rx_basic[arch=xs2;clk=60Mhz] PASS +lib_xud::xud_sim_tests::test_shorttoken[arch=xs3;clk=60Mhz] FAIL +lib_xud::xud_sim_tests::test_shorttoken[arch=xs2;clk=60Mhz] PASS ------------ -33/36 PASSED +34/38 PASSED ------------ diff --git a/tests/usb_packet.py b/tests/usb_packet.py index d3225be3..b9676407 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -168,7 +168,6 @@ def __init__(self, **kwargs): self.timeout = kwargs.pop('timeout', 8) super(RxPacket, self).__init__(**kwargs) - def get_timeout(self): return self.timeout From 52d0e24c9bd2b8b4f35875738b0b82ea06b45367 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 26 Jun 2019 16:50:10 +0100 Subject: [PATCH 038/520] Fixed some ARCH defines. --- lib_xud/src/core/included/XUD_Token_In.S | 8 ++------ lib_xud/src/core/included/XUD_Token_Out.S | 4 +--- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/lib_xud/src/core/included/XUD_Token_In.S b/lib_xud/src/core/included/XUD_Token_In.S index 5c878fb1..bee2eefc 100755 --- a/lib_xud/src/core/included/XUD_Token_In.S +++ b/lib_xud/src/core/included/XUD_Token_In.S @@ -226,10 +226,6 @@ TxHandshakeTimeOut: edu res[RXD] bu BadHandShake - //ldc r11, 1 - //out res[r5], r11 - //bu NextToken - // Transmitted data, and got something back within the timeout. Check for valid handshake... .align 4 TxHandShakeReceived: @@ -238,8 +234,8 @@ XUD_IN_RxAck: clrpt res[r1] // Clear port time on valid token port edu res[RXD] shr r11, r11, 24 // Shift off junk data to leave ACK -#ifdef ARCH_L - ldc r9, USB_PID_ACK // Check for good ACK (L series strips of negated bits from PID) +#if defined(__XS2A__) || defined(__XS1B__) + ldc r9, USB_PID_ACK // Check for good ACK (L series strips of negated bits from PID) #else ldc r9, USB_PIDn_ACK #endif diff --git a/lib_xud/src/core/included/XUD_Token_Out.S b/lib_xud/src/core/included/XUD_Token_Out.S index 8c512981..3b544f60 100755 --- a/lib_xud/src/core/included/XUD_Token_Out.S +++ b/lib_xud/src/core/included/XUD_Token_Out.S @@ -7,7 +7,6 @@ .align 4 .skip 0 -//.cc_top Pid_Out.func, Pid_Out Pid_Out: #ifdef ARCH_L inpw r10, res[RXD], 8; // Read EP Number */ @@ -45,7 +44,7 @@ InformEP_Iso: // Iso EP - no handshake //ldc r4, XUD_MAX_NUM_EP_OUT // This could be shaved if XUD_MAX_NUM_EP's < 12. Now use an LDAW to at 16. //------------------------------------------------------------------------------------------------ -#ifdef ARCH_L +#if defined(__XS2A__) || defined(__XS1B__) ldaw r10, dp[PidJumpTable] // Original USB Token: | CRC | EP | ADDR | PID | junk // Received token is address and CRC checked. @@ -158,4 +157,3 @@ PrimaryBufferFull_NoNak: -//.cc_bottom Pid_Out.func From 626b4ac0afad9fe80c6ced812f342a92d8b94122 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 27 Jun 2019 19:09:36 +0100 Subject: [PATCH 039/520] Added test_sof_basic --- tests/test_sof_basic.py | 46 +++++++++ tests/test_sof_basic/LICENSE.txt | 135 +++++++++++++++++++++++++++ tests/test_sof_basic/Makefile | 1 + tests/test_sof_basic/src/main.xc | 97 +++++++++++++++++++ tests/test_sof_basic/src/test.xn | 72 ++++++++++++++ tests/test_sof_basic/src/test_xs1.xn | 89 ++++++++++++++++++ tests/test_sof_basic/src/test_xs2.xn | 72 ++++++++++++++ tests/test_sof_basic/src/test_xs3.xn | 24 +++++ 8 files changed, 536 insertions(+) create mode 100644 tests/test_sof_basic.py create mode 100644 tests/test_sof_basic/LICENSE.txt create mode 100644 tests/test_sof_basic/Makefile create mode 100644 tests/test_sof_basic/src/main.xc create mode 100644 tests/test_sof_basic/src/test.xn create mode 100755 tests/test_sof_basic/src/test_xs1.xn create mode 100644 tests/test_sof_basic/src/test_xs2.xn create mode 100644 tests/test_sof_basic/src/test_xs3.xn diff --git a/tests/test_sof_basic.py b/tests/test_sof_basic.py new file mode 100644 index 00000000..cb098928 --- /dev/null +++ b/tests/test_sof_basic.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python + +# Same as simple RX bulk test but some invalid tokens also included + +import random +import xmostest +from usb_packet import * +from usb_clock import Clock +from helpers import do_usb_test, runall_rx + + +# Single, setup transaction to EP 0 + +def do_test(arch, clk, phy, seed): + rand = random.Random() + rand.seed(seed) + + address = 1 + ep = 1 + framenumber = 52 # Note, for frame number 52 we expect A5 34 40 on the bus + + packets = [] + dataval = 0; + + # Start with a valid transaction */ + AppendOutToken(packets, ep, address) + packets.append(TxDataPacket(rand, data_start_val=dataval, length=10, pid=0x3)) #DATA0 + packets.append(RxHandshakePacket()) + + AppendSofToken(packets, framenumber) + AppendSofToken(packets, framenumber+1) + AppendSofToken(packets, framenumber+2) + AppendSofToken(packets, framenumber+3) + AppendSofToken(packets, framenumber+4) + + #Finish with valid transaction + dataval += 10 + AppendOutToken(packets, ep, address, inter_pkt_gap=6000) + packets.append(TxDataPacket(rand, data_start_val=dataval, length=11, pid=0xb)) #DATA1 + packets.append(RxHandshakePacket()) + + do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) + +def runtest(): + random.seed(1) + runall_rx(do_test) diff --git a/tests/test_sof_basic/LICENSE.txt b/tests/test_sof_basic/LICENSE.txt new file mode 100644 index 00000000..994856c9 --- /dev/null +++ b/tests/test_sof_basic/LICENSE.txt @@ -0,0 +1,135 @@ +Software Release License Agreement + +Copyright (c) 2015-2018, XMOS, All rights reserved. + +BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. + +Parties: + +(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). + +(2) An individual or legal entity exercising permissions granted by this License (Customer). + +If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. + +1. Definitions + +"License" means this Software License and any schedules or annexes to it. + +"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License + +"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. + +"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. + +"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. + +"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. + +The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. + +Unless the context otherwise requires: + +- references to XMOS and the Customer include their permitted successors and assigns; +- references to statutory provisions include those statutory provisions as amended or re-enacted; and +- references to any gender include all genders. + +Words in the singular include the plural and in the plural include the singular. + +2. License + +XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. + +Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. + +3. Consideration + +In consideration of the mutual obligations contained in this License, the parties agree to its terms. + +4. Term + +Subject to clause 12 below, this License shall be perpetual. + +5. Restrictions on Use + +The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. + +6. Modifications + +The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. + +XMOS will own all intellectual property rights in the XMOS Modifications. +The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. + +7. Support + +Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. + +8. Warranty and Disclaimer + +The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). + +Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. + +XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. + +9. High Risk Activities + +The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. + +10. Liability + +TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. + +Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. + +11. Ownership + +The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. + +12. Termination + +Either party may terminate this License at any time on written notice to the other if the other: + +- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or + +- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. + +Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. + +On termination for any reason: + +- all rights granted to the Customer under this License shall cease; +- the Customer shall cease all activities authorised by this License; +- the Customer shall immediately pay any sums due to XMOS under this License; and +- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. + +Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. + +13. Third party rights + +No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. + +14. Confidentiality and publicity + +Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. + +The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. +The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. + +15. Entire agreement + +This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. + +16. Assignment + +The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. + +17. Governing law and jurisdiction + +This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. + +This License has been entered into on the date stated at the beginning of it. + +Schedule +XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_sof_basic/Makefile b/tests/test_sof_basic/Makefile new file mode 100644 index 00000000..6aed3e76 --- /dev/null +++ b/tests/test_sof_basic/Makefile @@ -0,0 +1 @@ +include ../test_makefile.mak diff --git a/tests/test_sof_basic/src/main.xc b/tests/test_sof_basic/src/main.xc new file mode 100644 index 00000000..d6122e76 --- /dev/null +++ b/tests/test_sof_basic/src/main.xc @@ -0,0 +1,97 @@ +// Copyright (c) 2016-2019, XMOS Ltd, All rights reserved +#include +#include +#include +#include "xud.h" +#include "platform.h" +#include "shared.h" + +#define XUD_EP_COUNT_OUT 5 +#define XUD_EP_COUNT_IN 5 + +/* Endpoint type tables */ +XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL,XUD_EPTYPE_BUL}; +XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; + +void exit(int); + +int TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_out_0, chanend c_sof) +{ + unsigned int length; + XUD_Result_t res; + + XUD_ep ep_out_0 = XUD_InitEp(c_out_0); + XUD_ep ep_out = XUD_InitEp(c_out); + XUD_ep ep_in = XUD_InitEp(c_in); + + unsigned frames[10]; + + /* Buffer for Setup data */ + unsigned char buffer[1024]; + + XUD_GetBuffer(ep_out, buffer, length); + + if(length != 10) + { + printintln(length); + fail(FAIL_RX_LENERROR); + } + + if(RxDataCheck(buffer, length, epNum)) + { + fail(FAIL_RX_DATAERROR); + } + + /* Receive SOFs */ + for (int i = 0; i< 5; i++) + frames[i] = inuint(c_sof); + + XUD_GetBuffer(ep_out, buffer, length); + + if(length != 11) + { + printintln(length); + fail(FAIL_RX_LENERROR); + } + + if(RxDataCheck(buffer, length, epNum)) + { + fail(FAIL_RX_DATAERROR); + } + + unsigned expectedFrame = 52; + + /* Check frame numbers */ + for (int i = 0 ; i < 5; i++) + { + if(frames[i] != i+expectedFrame) + { + printhexln(i); + printhexln(frames[i]); + fail(FAIL_RX_FRAMENUMBER); + } + } + + XUD_Kill(ep_out_0); + exit(0); +} + + +int main() +{ + chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + chan c_sof; + + par + { + + XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + c_sof, epTypeTableOut, epTypeTableIn, + null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); + + + TestEp_Bulk(c_ep_out[1], c_ep_in[1], 1, c_ep_out[0], c_sof); + } + + return 0; +} diff --git a/tests/test_sof_basic/src/test.xn b/tests/test_sof_basic/src/test.xn new file mode 100644 index 00000000..d0ee86b8 --- /dev/null +++ b/tests/test_sof_basic/src/test.xn @@ -0,0 +1,72 @@ + + + Board + XS2 MC Audio + + tileref tile[2] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_sof_basic/src/test_xs1.xn b/tests/test_sof_basic/src/test_xs1.xn new file mode 100755 index 00000000..573aef45 --- /dev/null +++ b/tests/test_sof_basic/src/test_xs1.xn @@ -0,0 +1,89 @@ + + + + + tileref tile[1] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_sof_basic/src/test_xs2.xn b/tests/test_sof_basic/src/test_xs2.xn new file mode 100644 index 00000000..d0ee86b8 --- /dev/null +++ b/tests/test_sof_basic/src/test_xs2.xn @@ -0,0 +1,72 @@ + + + Board + XS2 MC Audio + + tileref tile[2] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_sof_basic/src/test_xs3.xn b/tests/test_sof_basic/src/test_xs3.xn new file mode 100644 index 00000000..ab436573 --- /dev/null +++ b/tests/test_sof_basic/src/test_xs3.xn @@ -0,0 +1,24 @@ + + + + tileref tile[2] + + + + + + + + + + + + + + + + + + From 258ecd9a658d2b5466659bcc54931a40946879c4 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 27 Jun 2019 19:11:36 +0100 Subject: [PATCH 040/520] - Added ability for test bench to send SOF packets - Added ability for test bench to send TOKEN packets with invalidated CRC - Added FAIL_RX_FRAMENUMBER - XS3 can now pass through valid SOF frame numbers --- lib_xud/src/core/included/XUD_Token_SOF.S | 18 +++++++----------- tests/shared_src/shared.h | 4 ++++ tests/usb_packet.py | 18 +++++++++++++++--- tests/usb_phy_utmi.py | 2 +- 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/lib_xud/src/core/included/XUD_Token_SOF.S b/lib_xud/src/core/included/XUD_Token_SOF.S index 4bcd946a..d8b86a51 100644 --- a/lib_xud/src/core/included/XUD_Token_SOF.S +++ b/lib_xud/src/core/included/XUD_Token_SOF.S @@ -1,7 +1,6 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved -//.cc_top Pid_Sof.func, Pid_Sof -// Received SOF token: Reset suspend/reset detection timer +// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved +// Received SOF token: Reset suspend/reset detection timer .align 4 Pid_Sof: #ifdef ARCH_L @@ -12,8 +11,12 @@ Pid_Sof: bt r11, InvalidToken; // If VALID_TOKEN not high, ignore token #else -//#include "XUD_G_Crc.S" + // NOTE: we are not CRC checking SOF's in r10, res[RXD] // Input Frame number + shr r10 , r10, 16 // Shift off port junk + ldc r11, 0x7ff // Remove CRC5 + and r10, r10, r11 + #endif clrsr 0x3 ldw r11, sp[(STACK_EXTEND+9)] @@ -33,11 +36,6 @@ Pid_Sof: bu Loop_BadPid -//.cc_bottom Pid_Sof.func - - -//.cc_top Pid_Sof_NoChan.func, Pid_Sof_NoChan - // Received SOF token: Reset suspend/reset detection timer .align 4 Pid_Sof_NoChan: @@ -48,7 +46,6 @@ Pid_Sof_NoChan: in r11, res[r1]; bt r11, InvalidToken; /* If VALID_TOKEN not high, ignore token */ -//bl printintln #else //#include "XUD_G_Crc.S" in r10, res[RXD] // Input Frame number @@ -66,7 +63,6 @@ Pid_Sof_NoChan: bu Loop_BadPid -//.cc_bottom Pid_Sof_NoChan.func diff --git a/tests/shared_src/shared.h b/tests/shared_src/shared.h index 9bdc9b45..7a9a31f1 100644 --- a/tests/shared_src/shared.h +++ b/tests/shared_src/shared.h @@ -103,6 +103,7 @@ int TestEp_Tx(chanend c_in, int epNum1, unsigned start, unsigned end, t_runMode #define FAIL_RX_LENERROR 1 #define FAIL_RX_EXPECTED_CTL 2 #define FAIL_RX_BAD_RETURN_CODE 3 +#define FAIL_RX_FRAMENUMBER 4 unsigned fail(int x) { @@ -124,6 +125,9 @@ unsigned fail(int x) printstr("\nXCORE: ### FAIL ### : Unexpcected return code\n"); break; + case FAIL_RX_FRAMENUMBER: + printstr("\nXCORE: ### FAIL ### : Received bad frame number\n"); + break; } exit(1); diff --git a/tests/usb_packet.py b/tests/usb_packet.py index b9676407..89fc5b46 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -17,13 +17,19 @@ def AppendPingToken(packets, ep, address, **kwargs): AppendTokenPacket(packets, 0xb4, ep, ipg, address) def AppendInToken(packets, ep, address, **kwargs): - #357 was min IPG supported on bulk loopback to not nak #lower values mean the loopback NAKs ipg = kwargs.pop('inter_pkt_gap', 10) AppendTokenPacket(packets, 0x69, ep, ipg, address) +def AppendSofToken(packets, framenumber, **kwargs): + ipg = kwargs.pop('inter_pkt_gap', 500) + # Override EP and Address + ep = (framenumber >> 7) & 0xf + address = (framenumber) & 0x7f + AppendTokenPacket(packets, 0xa5, ep, ipg, address) + def AppendTokenPacket(packets, _pid, ep, ipg, addr=0): packets.append(TokenPacket( @@ -157,6 +163,8 @@ def get_pid_pretty(self): return "IN" elif self.pid == 180: return "PING" + elif self.pid == 165: + return "SOF" else: return "UNKNOWN" @@ -263,8 +271,12 @@ def __init__(self, **kwargs): self.endpoint = kwargs.pop('endpoint', 0) self.valid = kwargs.pop('valid', 1) self.address = kwargs.pop('address', 0) - self.crc5 = GenCrc5(reflect(((self.endpoint & 0xf)<<7) | ((self.address & 0x7f)<<0), 11)) - + + # Generate correct crc5 + crc5 = GenCrc5(reflect(((self.endpoint & 0xf)<<7) | ((self.address & 0x7f)<<0), 11)) + + # Correct crc5 can be overridden + self.crc5 = kwargs.pop('crc5', crc5) # Always override to match IFM self.data_valid_count = 4 #todo diff --git a/tests/usb_phy_utmi.py b/tests/usb_phy_utmi.py index 07de2b4c..c50160cd 100644 --- a/tests/usb_phy_utmi.py +++ b/tests/usb_phy_utmi.py @@ -85,7 +85,7 @@ def run(self): else: - #TokenPacket or TxPacket + #TxPacket (which could be a TxToken or TxDataPacket) # xCore should not be trying to send if we are trying to send.. if xsi.sample_port_pins(self._txv) == 1: From c236e9faf192731c262b9e597446fc70b6c433e7 Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 13 Sep 2019 11:58:57 +0100 Subject: [PATCH 041/520] Updates for xs3 --- lib_xud/src/core/XUD_Main.xc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index 70caa62a..6675c7b4 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -496,7 +496,7 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c set_clock_fall_delay(rx_usb_clk, RX_FALL_DELAY); #endif -#ifndef __XS3__ +#ifndef __XS3A__ /* Invert valid token port */ set_port_inv(flag0_port); #endif @@ -521,13 +521,14 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c #endif -#ifndef SIMULATION unsigned settings[] = {0}; - #if defined (ARCH_X200) + #if defined(__XS2A__) || defined(__XS3A__) /* For xCORE-200 enable USB port muxing before enabling phy etc */ XUD_EnableUsbPortMux(); //setps(XS1_PS_XCORE_CTRL0, UIFM_MODE); #endif + +#ifndef SIMULATION /* Enable the USB clock */ write_sswitch_reg(get_tile_id(USB_TILE_REF), XS1_SU_CFG_RST_MISC_NUM, ( 1 << XS1_SU_CFG_USB_CLK_EN_SHIFT)); @@ -801,11 +802,11 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c /* Run main IO loop */ /* TODO re-order flag ports such that this check is not required */ -#if defined (__XS3__) +#if defined (__XS3A__) /* flag0: Rx Error flag1: Rx Active flag2: Null */ - noExit = XUD_LLD_IoLoop(p_usb_rxd, flag1_port, p_usb_txd, flag0_port, flag2_port, reg_read_port, reg_write_port, 0, epTypeTableOut, epTypeTableIn, epChans, noEpOut, c_sof); + noExit = XUD_LLD_IoLoop(p_usb_rxd, flag1_port, p_usb_txd, flag2_port, flag0_port, reg_read_port, reg_write_port, 0, epTypeTableOut, epTypeTableIn, epChans, noEpOut, c_sof); #else /* flag0: Valid token flag flag1: Rx Active From d4ade58912e904589ebc43644e4da8227768ea1b Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Fri, 13 Sep 2019 12:00:48 +0100 Subject: [PATCH 042/520] Updates for xs3 rtl --- lib_xud/src/core/XUD_Main.xc | 42 ++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index 70caa62a..47bfc027 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -28,6 +28,10 @@ void XUD_Error_hex(char errString[], int i_err); #include "XUD_DeviceAttach.h" #include "XUD_PowerSig.h" +#include "xs3a_registers.h" +#include "XUD_HAL.h" + + #if defined __XS3A__ #undef __XS2A__ #warning Building for XS3 @@ -543,31 +547,30 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c /* Clear OTG control reg - incase we were running as host previously.. */ write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_OTG_CONTROL_NUM, 0); -#ifdef GLX_PWRDWN - /* Setup sleep timers and supplies */ - write_periph_word(USB_TILE_REF, XS1_GLX_PERIPH_PWR_ID, XS1_GLX_PWR_STATE_ASLEEP_ADRS, 0x00007f); // 32KHz sleep requires reset - write_periph_word(USB_TILE_REF, XS1_GLX_PERIPH_PWR_ID, XS1_GLX_PWR_STATE_WAKING1_ADRS, 0x00007f); - write_periph_word(USB_TILE_REF, XS1_GLX_PERIPH_PWR_ID, XS1_GLX_PWR_STATE_WAKING2_ADRS, 0x00007f); - write_periph_word(USB_TILE_REF, XS1_GLX_PERIPH_PWR_ID, XS1_GLX_PWR_STATE_AWAKE_ADRS, 0x00007f); - write_periph_word(USB_TILE_REF, XS1_GLX_PERIPH_PWR_ID, XS1_GLX_PWR_STATE_SLEEPING1_ADRS, 0x00007f); - write_periph_word(USB_TILE_REF, XS1_GLX_PERIPH_PWR_ID, XS1_GLX_PWR_STATE_SLEEPING2_ADRS, 0x00007f); // 32KHz transition done in SLEEPING2, PLL goes x unless reset here -#endif // GLX_PWRDWN #endif // SIMILATION +#ifdef __XS3A__ + XUD_EnableUsbPortMux(); + + unsigned d = 0; + + read_sswitch_reg(0, XS1_SSWITCH_USB_PHY_CFG2_NUM, d); + d = XS1_USB_PHY_CFG2_PONRST_SET(d, 1); + d = XS1_USB_PHY_CFG2_UTMI_RESET_SET(d, 0); + write_sswitch_reg(0, XS1_SSWITCH_USB_PHY_CFG2_NUM, d); + + read_sswitch_reg(0, XS1_SSWITCH_USB_PHY_CFG0_NUM, d); + d = XS1_USB_PHY_CFG0_PLL_EN_SET(d,1); + write_sswitch_reg(0, XS1_SSWITCH_USB_PHY_CFG0_NUM, d); +#endif /* Wait for USB clock (typically 1ms after reset) */ p_usb_clk when pinseq(1) :> int _; p_usb_clk when pinseq(0) :> int _; p_usb_clk when pinseq(1) :> int _; p_usb_clk when pinseq(0) :> int _; - -//#if !defined(ARCH_S) && !defined(__XS2A__) && !defined(__XS3A__) -// /* Configure ports and clock blocks for use with UIFM */ -// XUD_UIFM_PortConfig(p_usb_clk, reg_write_port, reg_read_port, flag0_port, flag1_port, flag2_port, p_usb_txd, p_usb_rxd) ; -// -// //set_pad_delay(flag1_port, 5); -// set_port_inv(flag0_port); -// -// #endif + + // TODO MOVE ME + XUD_HAL_EnterMode_PeripheralFullSpeed(); #if (defined(ARCH_L) && !defined(ARCH_X200) && !defined(ARCH_S)) || defined(ARCH_G) /* For L/G series we wait for clock from phy, then enable UIFM logic */ @@ -648,6 +651,7 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c | (1< Date: Thu, 19 Sep 2019 19:02:13 +0100 Subject: [PATCH 043/520] Mods for XS3 RTL tests --- lib_xud/src/core/XUD_Main.xc | 7 ++- lib_xud/src/core/XUD_TestMode.xc | 2 +- lib_xud/src/core/XUD_USBTile_Support.S | 11 ++++- lib_xud/src/core/included/XUD_Token_Out.S | 5 ++ lib_xud/src/user/client/XUD_EpFuncs.S | 3 +- tests/shared_src/shared.h | 4 +- tests/test_bulk_rx_basic/src/main.xc | 60 ++++++++++++++++++++--- 7 files changed, 77 insertions(+), 15 deletions(-) diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index fd50bad7..818744b4 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -507,6 +507,8 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c #ifndef SIMULATION set_pad_delay(flag1_port, 2); +#else + set_pad_delay(flag1_port, 4); #endif start_clock(tx_usb_clk); @@ -562,6 +564,7 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c read_sswitch_reg(0, XS1_SSWITCH_USB_PHY_CFG0_NUM, d); d = XS1_USB_PHY_CFG0_PLL_EN_SET(d,1); + d = XS1_USB_PHY_CFG0_XTLSEL_SET(d, 0b101); write_sswitch_reg(0, XS1_SSWITCH_USB_PHY_CFG0_NUM, d); #endif /* Wait for USB clock (typically 1ms after reset) */ @@ -709,7 +712,7 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c /* Reset the OUT ep structures */ for(int i = 0; i< noEpOut; i++) { -#ifdef ARCH_G +#ifdef __XS3A__ ep_info[i].pid = USB_PIDn_DATA0; #else ep_info[i].pid = USB_PID_DATA0; @@ -932,7 +935,7 @@ int XUD_Main(chanend c_ep_out[], int noEpOut, ep_info[i].epType = epTypeTableOut[i]; -#ifdef ARCH_G +#ifdef __XS3A__ ep_info[i].pid = USB_PIDn_DATA0; #else ep_info[i].pid = USB_PID_DATA0; diff --git a/lib_xud/src/core/XUD_TestMode.xc b/lib_xud/src/core/XUD_TestMode.xc index 2a8df8bb..9ce0e7c5 100644 --- a/lib_xud/src/core/XUD_TestMode.xc +++ b/lib_xud/src/core/XUD_TestMode.xc @@ -29,7 +29,7 @@ extern in port flag1_port; extern in port flag2_port; #endif -#if defined(ARCH_S) || defined(ARCH_X200) +#if defined(ARCH_S) || defined(ARCH_X200) || defined(__XS3A__) extern out buffered port:32 p_usb_txd; #define reg_write_port null #define reg_read_port null diff --git a/lib_xud/src/core/XUD_USBTile_Support.S b/lib_xud/src/core/XUD_USBTile_Support.S index 80b869fe..0e738e8c 100644 --- a/lib_xud/src/core/XUD_USBTile_Support.S +++ b/lib_xud/src/core/XUD_USBTile_Support.S @@ -4,7 +4,12 @@ * @author Ross Owen, XMOS Limited */ +#ifdef __XS2A__ #include +#endif +#ifdef __XS3A__ +#include +#endif .text .globl XUD_EnableUsbPortMux, "f{ui}()" @@ -13,8 +18,12 @@ .align 4 // void XUD_EnableUsbPortMux (unsigned mode); XUD_EnableUsbPortMux: +.issue_mode single + ENTSP_lu6 0 ldc r1, XS1_PS_XCORE_CTRL0 - ldc r0, 2 + get r0, ps[r1] + ldc r2, 2 + or r0, r0, r2 set ps[r1], r0 //Sanity check, read back and check diff --git a/lib_xud/src/core/included/XUD_Token_Out.S b/lib_xud/src/core/included/XUD_Token_Out.S index 3b544f60..6324c442 100755 --- a/lib_xud/src/core/included/XUD_Token_Out.S +++ b/lib_xud/src/core/included/XUD_Token_Out.S @@ -84,6 +84,11 @@ DoOutNonIso: doRXDataReturn_NonIso: bf r1, NextTokenAfterOut // Check for bad crc ldc r11, USB_PIDn_ACK // Data CRC good and EP not Iso: Send Ack + nop + nop + nop + nop + nop outpw res[TXD], r11, 8 syncr res[TXD] diff --git a/lib_xud/src/user/client/XUD_EpFuncs.S b/lib_xud/src/user/client/XUD_EpFuncs.S index a4987daa..a12acbef 100644 --- a/lib_xud/src/user/client/XUD_EpFuncs.S +++ b/lib_xud/src/user/client/XUD_EpFuncs.S @@ -187,7 +187,8 @@ XUD_GetData_PidOkay: bf r11, XUD_GetData_ReturnOk // Jump over PID toggle for ISO XUD_GetData_PidToggle: -#if (XUD_SERIES_SUPPORT==3) +//#if (XUD_SERIES_SUPPORT==3) +#ifdef __XS3A__ ldc r11, 0x88 #else ldc r11, 8 diff --git a/tests/shared_src/shared.h b/tests/shared_src/shared.h index 7a9a31f1..77090115 100644 --- a/tests/shared_src/shared.h +++ b/tests/shared_src/shared.h @@ -145,7 +145,7 @@ int RxDataCheck(unsigned char b[], int l, int epNum) unsafe { - if(b[i] != g_rxDataCheck[epNum]) + if(b[i] != i)//g_rxDataCheck[epNum]) { printstr("#### Mismatch on EP: "); printint(epNum); @@ -188,7 +188,7 @@ int TestEp_Rx(chanend c_out, int epNum, int start, int end) { unsafe { - RxDataCheck(buffer[i], length[i], epNum); + return RxDataCheck(buffer[i], length[i], epNum); } } } diff --git a/tests/test_bulk_rx_basic/src/main.xc b/tests/test_bulk_rx_basic/src/main.xc index be6ad72d..94620e9e 100644 --- a/tests/test_bulk_rx_basic/src/main.xc +++ b/tests/test_bulk_rx_basic/src/main.xc @@ -37,24 +37,68 @@ XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; + +#define NLOCK (1<<30) +#define NRESET (1<<31) + +#define PLL_VAL_1000 (NRESET | (0 << 23) | (79 << 8) | (0 << 0)) +#define PLL_VAL_800 (NRESET | (0 << 23) |(127 << 8) | (0 << 0)) +#define PLL_VAL_500 (NRESET | (1 << 23) | (79 << 8) | (0 << 0)) + +void default_main(); + +void enable(int node) +{ + write_pswitch_reg(node, XS1_PSWITCH_PLL_CLK_DIVIDER_NUM, 0); + setps(XS1_PS_XCORE_CTRL0, XS1_XCORE_CTRL0_CLK_DIVIDER_EN_SET(0,1)); +} + +void makePllGoAt800MHz() +{ + enable(1); + write_sswitch_reg(0, XS1_SSWITCH_CLK_DIVIDER_NUM, 2); + + write_sswitch_reg(0, XS1_SSWITCH_REF_CLK_DIVIDER_NUM, 15); + write_sswitch_reg(0, XS1_SSWITCH_CLK_DIVIDER_NUM, 2); + + int pllValue = PLL_VAL_800 ; // output 1GHz + write_node_config_reg_no_ack(tile[0], XS1_SSWITCH_PLL_CTL_NUM, pllValue); + +} int main() { chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; par { + on stdcore[0]: + { + //makePllGoAt800MHz(); + unsigned fail; + + par + { - XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, - null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); + XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + null, epTypeTableOut, epTypeTableIn, + null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); - { - TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); - XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); - XUD_Kill(ep0); - exit(0); + { + fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); + + if(fail) + TerminateFail(fail); + else + TerminatePass(fail); + + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep0); + //exit(0); + } + } } + on stdcore[1]: default_main(); } return 0; From 6ec551db818ab9c21cee32d26664ed42d1874f8b Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Thu, 19 Sep 2019 19:30:24 +0100 Subject: [PATCH 044/520] Added XUD_HAL files --- lib_xud/src/core/XUD_HAL.h | 2 ++ lib_xud/src/core/XUD_HAL.xc | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 lib_xud/src/core/XUD_HAL.h create mode 100644 lib_xud/src/core/XUD_HAL.xc diff --git a/lib_xud/src/core/XUD_HAL.h b/lib_xud/src/core/XUD_HAL.h new file mode 100644 index 00000000..ac717f1a --- /dev/null +++ b/lib_xud/src/core/XUD_HAL.h @@ -0,0 +1,2 @@ + +void XUD_HAL_EnterMode_PeripheralFullSpeed(); diff --git a/lib_xud/src/core/XUD_HAL.xc b/lib_xud/src/core/XUD_HAL.xc new file mode 100644 index 00000000..c55ef804 --- /dev/null +++ b/lib_xud/src/core/XUD_HAL.xc @@ -0,0 +1,27 @@ + +#include "XUD_HAL.h" +#include + +#ifdef __XS3A__ + +#include + +void XUD_HAL_EnterMode_PeripheralFullSpeed() +{ + unsigned d = 0; + d = XS1_USB_PHY_CFG0_UTMI_XCVRSELECT_SET(d, 1); + d = XS1_USB_PHY_CFG0_UTMI_TERMSELECT_SET(d, 1); + d = XS1_USB_PHY_CFG0_UTMI_OPMODE_SET(d, 0); + d = XS1_USB_PHY_CFG0_DMPULLDOWN_SET(d, 0); + d = XS1_USB_PHY_CFG0_DPPULLDOWN_SET(d, 0); + + d = XS1_USB_PHY_CFG0_UTMI_SUSPENDM_SET(d, 1); + d = XS1_USB_PHY_CFG0_TXBITSTUFF_EN_SET(d, 1); + d = XS1_USB_PHY_CFG0_PLL_EN_SET(d, 1); + d = XS1_USB_PHY_CFG0_LPM_ALIVE_SET(d, 0); + d = XS1_USB_PHY_CFG0_IDPAD_EN_SET(d, 0); + d = XS1_USB_PHY_CFG0_XTLSEL_SET(d, 0b101); + + write_sswitch_reg(0, XS1_SSWITCH_USB_PHY_CFG0_NUM, d); +} +#endif From 070a760a042bb92422a895ed01ba431f9804780b Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 20 Sep 2019 10:22:20 +0100 Subject: [PATCH 045/520] Fixes for XS3 xsim tests --- lib_xud/src/core/XUD_Main.xc | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index 818744b4..776a139f 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved /** XUD_Manager.xc * @brief XMOS USB Device(XUD) Layer @@ -28,15 +28,6 @@ void XUD_Error_hex(char errString[], int i_err); #include "XUD_DeviceAttach.h" #include "XUD_PowerSig.h" -#include "xs3a_registers.h" -#include "XUD_HAL.h" - - -#if defined __XS3A__ -#undef __XS2A__ -#warning Building for XS3 -#endif - #ifdef __XS1B__ #include "xs1_su_registers.h" #endif @@ -46,6 +37,11 @@ void XUD_Error_hex(char errString[], int i_err); #include "xs2_su_registers.h" #endif +#ifdef __XS3A__ +#include "XUD_HAL.h" +#include "xs3a_registers.h" +#endif + #if defined(ARCH_X200) || defined(ARCH_S) #include "XUD_USBTile_Support.h" //#include @@ -550,7 +546,6 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c /* Clear OTG control reg - incase we were running as host previously.. */ write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_OTG_CONTROL_NUM, 0); -#endif // SIMILATION #ifdef __XS3A__ XUD_EnableUsbPortMux(); @@ -567,14 +562,19 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c d = XS1_USB_PHY_CFG0_XTLSEL_SET(d, 0b101); write_sswitch_reg(0, XS1_SSWITCH_USB_PHY_CFG0_NUM, d); #endif + +#endif // SIMILATION + /* Wait for USB clock (typically 1ms after reset) */ p_usb_clk when pinseq(1) :> int _; p_usb_clk when pinseq(0) :> int _; p_usb_clk when pinseq(1) :> int _; p_usb_clk when pinseq(0) :> int _; - + +#if defined (__XS3A__) && !defined(SIMULATION) // TODO MOVE ME XUD_HAL_EnterMode_PeripheralFullSpeed(); +#endif #if (defined(ARCH_L) && !defined(ARCH_X200) && !defined(ARCH_S)) || defined(ARCH_G) /* For L/G series we wait for clock from phy, then enable UIFM logic */ From ad18ddf32b1aac8530d5782093a0d8adce1cae14 Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Thu, 26 Sep 2019 13:07:26 +0100 Subject: [PATCH 046/520] Updated for XS3 tests --- lib_xud/src/core/XUD_Main.xc | 21 +++--- tests/shared_src/shared.h | 12 ++- tests/test_bulk_rx_basic/src/main.xc | 89 ++++++---------------- tests/test_bulk_tx_basic/src/main.xc | 108 ++++++++++----------------- 4 files changed, 81 insertions(+), 149 deletions(-) diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index 776a139f..97ebbd07 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -253,7 +253,7 @@ void XUD_PhyReset_User(); #endif /* Timeout differences due to using 60MHz vs 100MHz */ -#if !defined(ARCH_S) && !defined(ARCH_X200) +#if !defined(ARCH_S) && !defined(__XS2A__) && !defined(__XS3A__) #define HS_TX_HANDSHAKE_TIMEOUT 100 #define FS_TX_HANDSHAKE_TIMEOUT 3000 #else @@ -504,7 +504,7 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c #ifndef SIMULATION set_pad_delay(flag1_port, 2); #else - set_pad_delay(flag1_port, 4); + set_pad_delay(flag1_port, 5); #endif start_clock(tx_usb_clk); @@ -546,10 +546,10 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c /* Clear OTG control reg - incase we were running as host previously.. */ write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_OTG_CONTROL_NUM, 0); +#endif // SIMULATION #ifdef __XS3A__ XUD_EnableUsbPortMux(); - unsigned d = 0; read_sswitch_reg(0, XS1_SSWITCH_USB_PHY_CFG2_NUM, d); @@ -563,7 +563,6 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c write_sswitch_reg(0, XS1_SSWITCH_USB_PHY_CFG0_NUM, d); #endif -#endif // SIMILATION /* Wait for USB clock (typically 1ms after reset) */ p_usb_clk when pinseq(1) :> int _; @@ -571,7 +570,7 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c p_usb_clk when pinseq(1) :> int _; p_usb_clk when pinseq(0) :> int _; -#if defined (__XS3A__) && !defined(SIMULATION) +#if defined (__XS3A__) //&& !defined(SIMULATION) // TODO MOVE ME XUD_HAL_EnterMode_PeripheralFullSpeed(); #endif @@ -736,16 +735,16 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c #endif #ifdef SIMULATION - if(g_desSpeed == XUD_SPEED_HS) - { + #if defined(XUD_TEST_SPEED_HS) g_curSpeed = XUD_SPEED_HS; g_txHandshakeTimeout = HS_TX_HANDSHAKE_TIMEOUT; - } - else - { + #elif defined(XUD_TEST_SPEED_FS) g_curSpeed = XUD_SPEED_FS; g_txHandshakeTimeout = FS_TX_HANDSHAKE_TIMEOUT; - } + #else + #error + #endif + #else if(g_desSpeed == XUD_SPEED_HS) { diff --git a/tests/shared_src/shared.h b/tests/shared_src/shared.h index 77090115..acc225ff 100644 --- a/tests/shared_src/shared.h +++ b/tests/shared_src/shared.h @@ -145,8 +145,10 @@ int RxDataCheck(unsigned char b[], int l, int epNum) unsafe { - if(b[i] != i)//g_rxDataCheck[epNum]) + if(b[i] != g_rxDataCheck[epNum]) { +//#ifndef XUD_TEST_RTL +#if 0 printstr("#### Mismatch on EP: "); printint(epNum); printstr(". Got:"); @@ -154,6 +156,7 @@ int RxDataCheck(unsigned char b[], int l, int epNum) printstr(" Expected:"); printhexln(g_rxDataCheck[epNum]); //printintln(l); // Packet length +#endif return 1; } @@ -188,9 +191,14 @@ int TestEp_Rx(chanend c_out, int epNum, int start, int end) { unsafe { - return RxDataCheck(buffer[i], length[i], epNum); + unsigned fail = RxDataCheck(buffer[i], length[i], epNum); + if (fail) + return fail; + } } + + return 0; } #if 0 diff --git a/tests/test_bulk_rx_basic/src/main.xc b/tests/test_bulk_rx_basic/src/main.xc index 94620e9e..f0f6b1d3 100644 --- a/tests/test_bulk_rx_basic/src/main.xc +++ b/tests/test_bulk_rx_basic/src/main.xc @@ -1,11 +1,4 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved -/* - * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent - * in both directions between the ports. - * - * NOTE: The src/testbenches/ExampleTestbench must have been compiled for this to run without error. - * - */ +// Copyright (c) 2018-2019, XMOS Ltd, All rights reserved #include #include #include @@ -20,7 +13,6 @@ #define PKT_LENGTH_START 10 #endif - #ifndef PKT_LENGTH_END #define PKT_LENGTH_END 14 #endif @@ -29,76 +21,37 @@ #define TEST_EP_NUM 1 #endif - /* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, - XUD_EPTYPE_ISO, - XUD_EPTYPE_BUL, - XUD_EPTYPE_BUL}; +XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; - -#define NLOCK (1<<30) -#define NRESET (1<<31) - -#define PLL_VAL_1000 (NRESET | (0 << 23) | (79 << 8) | (0 << 0)) -#define PLL_VAL_800 (NRESET | (0 << 23) |(127 << 8) | (0 << 0)) -#define PLL_VAL_500 (NRESET | (1 << 23) | (79 << 8) | (0 << 0)) - -void default_main(); - -void enable(int node) -{ - write_pswitch_reg(node, XS1_PSWITCH_PLL_CLK_DIVIDER_NUM, 0); - setps(XS1_PS_XCORE_CTRL0, XS1_XCORE_CTRL0_CLK_DIVIDER_EN_SET(0,1)); -} - -void makePllGoAt800MHz() -{ - enable(1); - write_sswitch_reg(0, XS1_SSWITCH_CLK_DIVIDER_NUM, 2); - - write_sswitch_reg(0, XS1_SSWITCH_REF_CLK_DIVIDER_NUM, 15); - write_sswitch_reg(0, XS1_SSWITCH_CLK_DIVIDER_NUM, 2); - - int pllValue = PLL_VAL_800 ; // output 1GHz - write_node_config_reg_no_ack(tile[0], XS1_SSWITCH_PLL_CTL_NUM, pllValue); - -} +#ifdef XUD_TEST_RTL +int testmain() +#else int main() +#endif { chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - + par { - on stdcore[0]: - { - //makePllGoAt800MHz(); - unsigned fail; - - par - { + XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + null, epTypeTableOut, epTypeTableIn, + null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); - XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, - null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); + { + unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); - { - fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); - - if(fail) - TerminateFail(fail); - else - TerminatePass(fail); - - XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); - XUD_Kill(ep0); - //exit(0); - } - } +#ifdef XUD_TEST_RTL + if(fail) + TerminateFail(fail); + else + TerminatePass(fail); +#endif + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep0); + exit(0); } - - on stdcore[1]: default_main(); } return 0; diff --git a/tests/test_bulk_tx_basic/src/main.xc b/tests/test_bulk_tx_basic/src/main.xc index 7b9149aa..a676b29f 100644 --- a/tests/test_bulk_tx_basic/src/main.xc +++ b/tests/test_bulk_tx_basic/src/main.xc @@ -12,92 +12,64 @@ #include "xud.h" #include "platform.h" #include "xc_ptr.h" +#include "shared.h" -#define XUD_EP_COUNT_OUT 3 -#define XUD_EP_COUNT_IN 3 +#ifndef TEST_EP_NUM +#define TEST_EP_NUM 1 +#endif +#ifndef PKT_LENGTH_START +#define PKT_LENGTH_START 10 +#endif + +#ifndef PKT_LENGTH_END +#define PKT_LENGTH_END 14 +#endif + +#define XUD_EP_COUNT_OUT 4 +#define XUD_EP_COUNT_IN 4 /* Endpoint type tables */ XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, + XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, - XUD_EPTYPE_BUL}; - -void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend ?c_usb_test); - -void exit(int); - -#define FAIL_RX_DATAERROR 0 - -unsigned fail(int x) -{ - - printstr("\nXCORE: ### FAIL ******"); - switch(x) - { - case FAIL_RX_DATAERROR: - printstr("XCORE RX Data Error\n"); - - break; - - } - - exit(1); -} - -unsigned char g_rxDataCheck[5] = {0, 0, 0, 0, 0}; -unsigned char g_txDataCheck[5] = {0,0,0,0,0,}; -unsigned g_txLength[5] = {0,0,0,0,0}; - - -#pragma unsafe arrays -void SendTxPacket(XUD_ep ep, int length, int epNum) -{ - unsigned char buffer[1024]; - unsigned char x; - - for (int i = 0; i < length; i++) - { - buffer[i] = g_txDataCheck[epNum]++; - } - - XUD_SetBuffer(ep, buffer, length); -} - -int TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_out_0) -{ - XUD_ep ep_out_0 = XUD_InitEp(c_out_0); - XUD_ep ep_out = XUD_InitEp(c_out); - XUD_ep ep_in = XUD_InitEp(c_in); - - /* Buffer for Setup data */ - unsigned char buffer[1024]; - - for(int i = 10; i <= 14; i++) - { - SendTxPacket(ep_in, i, epNum); - } - - - XUD_Kill(ep_out_0); - exit(0); -} - + XUD_EPTYPE_BUL, + XUD_EPTYPE_ISO}; +#ifdef XUD_TEST_RTL +int testmain() +#else int main() +#endif { chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; par { - - XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + // TODO test is running at 400MHz + XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); - - TestEp_Bulk(c_ep_out[2], c_ep_in[2], 1, c_ep_out[0]); + + { + unsigned fail = TestEp_Tx(c_ep_in[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_DIE); + +#ifdef XUD_TEST_RTL + /* Note, this test relies on checking at the host side */ + + if(fail) + TerminateFail(fail); + else + TerminatePass(fail); +#endif + + XUD_ep ep_out_0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep_out_0); + exit(0); + } } return 0; From 0deffdc547a3297e45ae6185cd37814849133f53 Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Mon, 30 Sep 2019 16:57:35 +0100 Subject: [PATCH 047/520] Updates for XS3 tests --- lib_xud/api/xud.h | 5 + lib_xud/src/core/XUD_DeviceAttach.xc | 86 ++++--- lib_xud/src/core/XUD_HAL.h | 27 +++ lib_xud/src/core/XUD_HAL.xc | 86 ++++++- lib_xud/src/core/XUD_Main.xc | 87 +++---- lib_xud/src/core/XUD_PowerSig.xc | 329 +++++---------------------- lib_xud/src/core/XUD_Support.xc | 9 - tests/test_bulk_rx_basic/src/main.xc | 4 +- 8 files changed, 279 insertions(+), 354 deletions(-) diff --git a/lib_xud/api/xud.h b/lib_xud/api/xud.h index 9b0c7a71..6e48c70a 100644 --- a/lib_xud/api/xud.h +++ b/lib_xud/api/xud.h @@ -599,6 +599,11 @@ void XUD_SetData_Select(chanend c, XUD_ep ep, REFERENCE_PARAM(XUD_Result_t, resu /* Control token defines - used to inform EPs of bus-state types */ #define USB_RESET_TOKEN 8 /* Control token value that signals RESET */ +#ifndef XUD_OSC_MHZ +#define XUD_OSC_MHZ (24) +#endif + + #endif //__XC__ || __STDC__ #endif // __xud_h__ diff --git a/lib_xud/src/core/XUD_DeviceAttach.xc b/lib_xud/src/core/XUD_DeviceAttach.xc index cb602b82..296693ab 100755 --- a/lib_xud/src/core/XUD_DeviceAttach.xc +++ b/lib_xud/src/core/XUD_DeviceAttach.xc @@ -1,5 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved -#ifndef SIMULATION +// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved +#ifndef XUD_BYPASS_RESET #include #include #include @@ -10,6 +10,8 @@ #include "XUD_Support.h" #include "xud.h" +#include "XUD_HAL.h" + #ifdef ARCH_S #include "xs1_su_registers.h" #endif @@ -28,7 +30,7 @@ extern tileref USB_TILE_REF; extern in port flag0_port; extern in port flag1_port; extern in port flag2_port; -#if defined(ARCH_S) || defined(ARCH_X200) +#if defined(ARCH_S) || defined(__XS2A__) || defined(__XS3A__) extern out buffered port:32 p_usb_txd; #define reg_write_port null #define reg_read_port null @@ -62,47 +64,52 @@ int XUD_DeviceAttachHS(XUD_PwrConfig pwrConfig) chirpCount = 0; clearbuf(p_usb_txd); -#ifndef ARCH_X200 -#ifndef ARCH_S - clearbuf(reg_write_port); -#endif -#endif + // On detecting the SE0: // De-assert XCVRSelect and set opmode=2 // DEBUG - write to ulpi reg 0x54. This is: // opmode = 0b10, termsel = 1, xcvrsel = 0b00; - -#if defined(ARCH_S) || defined(ARCH_X200) +#if defined(__XS3A__) + XUD_HAL_EnterMode_PeripheralChirp(); +#elif defined(ARCH_S) || defined(ARCH_X200) write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_FUNC_CONTROL_NUM, 0b1010); #else XUD_UIFM_RegWrite(reg_write_port, UIFM_REG_PHYCON, 0x15); #endif - XUD_Sup_Delay(50); -//#ifdef ARCH_S - /* Added a bit of a delay before chirp to match an example HS device */ - t :> start_time; - t when timerafter(start_time+10000):> void; -//#endif - // output k-chirp for required time - - for (int i = 0; i < 16000; i++) { // 16000 words @ 480 MBit = 1.066 ms - p_usb_txd <: 0; + //t :> start_time; + //t when timerafter(start_time+50):> void; - } + /* Added a bit of a delay before chirp to match an example HS device */ + //t :> start_time; + //t when timerafter(start_time+10000):> void; - //XUD_UIFM_RegWrite(reg_write_port, UIFM_REG_CTRL, 0x04); - // J, K, SE0 on flag ports 0, 1, 2 respectively + // output k-chirp for required time +#ifdef SIMULATION + for (int i = 0; i < 4000; i++) +#else + for (int i = 0; i < 16000; i++) // 16000 words @ 480 MBit = 1.066 ms +#endif + { + p_usb_txd <: 0; + } + + // J, K, SE0 on flag ports 0, 1, 2 respectively (on XS2) // Wait for fs chirp k (i.e. HS chirp j) flag1_port when pinseq(0) :> tmp; // Wait for out k to go - t :> start_time; - while(1) { - select { - case t when timerafter(start_time + INVALID_DELAY) :> void: + t :> start_time; + while(1) + { + select + { + case t when timerafter(start_time + INVALID_DELAY) :> void: /* Go into full speed mode: XcvrSelect and Term Select (and suspend) high */ -#if defined(ARCH_S) || defined(ARCH_X200) +#ifdef __XS3A__ +#warning TODO FOR XS3 + +#elif defined(ARCH_S) || defined(ARCH_X200) write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_FUNC_CONTROL_NUM, (1< tmp; +#endif if(!tmp) { return 0; /* SE0 gone, return 0 to indicate FULL SPEED */ @@ -142,12 +155,14 @@ int XUD_DeviceAttachHS(XUD_PwrConfig pwrConfig) } } break; + case detecting_k => flag1_port when pinseq(1):> void @ tx: // K Chirp flag1_port @ tx + T_FILT :> tmp; if (tmp) { detecting_k = 0; } break; + case !detecting_k => flag0_port when pinseq(0) :> void @ tx: // J Chirp, inverted! flag0_port @ tx + T_FILT :> tmp; if (tmp == 0) { // inverted! @@ -157,15 +172,26 @@ int XUD_DeviceAttachHS(XUD_PwrConfig pwrConfig) // Three pairs of KJ received... de-assert TermSelect... // (and opmode = 0, suspendm = 1) -#if defined(ARCH_S) || defined(ARCH_X200) +#ifdef __XS3A__ +#warning TODO FOR XS3 + +#elif defined(ARCH_S) || defined(ARCH_X200) write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_FUNC_CONTROL_NUM, 0b0000); #else XUD_UIFM_RegWrite(reg_write_port, UIFM_REG_PHYCON, 0x1); #endif + +#ifdef __XS3A__ + +#warning TODO for XS3 +#else //wait for SE0 (TODO consume other chirps?) flag2_port when pinseq(1) :> tmp; +#endif + return 1; // Return 1 for HS + } } break; diff --git a/lib_xud/src/core/XUD_HAL.h b/lib_xud/src/core/XUD_HAL.h index ac717f1a..6f47d6df 100644 --- a/lib_xud/src/core/XUD_HAL.h +++ b/lib_xud/src/core/XUD_HAL.h @@ -1,2 +1,29 @@ +#include "xud.h" + void XUD_HAL_EnterMode_PeripheralFullSpeed(); +void XUD_HAL_EnterMode_PeripheralChirp(); + + +typedef struct XUD_HAL_t +{ + in port p_usb_fl0; + in port p_usb_fl1; + + +} XUD_HAL_t; + +typedef enum XUD_LineState_t +{ + XUD_LINESTATE_SE0, + XUD_LINESTATE_J, + XUD_LINESTATE_K, + XUD_LINESTATE_INVALID +} XUD_LineState_t; + + +int XUD_HAL_GetLineState(/*XUD_HAL_t &xudHal*/); + + +void XUD_HAL_Mode_PowerSig(); +void XUD_HAL_Mode_DataTransfer(); diff --git a/lib_xud/src/core/XUD_HAL.xc b/lib_xud/src/core/XUD_HAL.xc index c55ef804..7bd8150e 100644 --- a/lib_xud/src/core/XUD_HAL.xc +++ b/lib_xud/src/core/XUD_HAL.xc @@ -6,6 +6,8 @@ #include +extern in port flag0_port; /* For XS3: RXA or DP */ +extern in port flag1_port; /* For XS3: RXE or DM */ void XUD_HAL_EnterMode_PeripheralFullSpeed() { unsigned d = 0; @@ -20,8 +22,90 @@ void XUD_HAL_EnterMode_PeripheralFullSpeed() d = XS1_USB_PHY_CFG0_PLL_EN_SET(d, 1); d = XS1_USB_PHY_CFG0_LPM_ALIVE_SET(d, 0); d = XS1_USB_PHY_CFG0_IDPAD_EN_SET(d, 0); - d = XS1_USB_PHY_CFG0_XTLSEL_SET(d, 0b101); + if(XUD_OSC_MHZ == 24) + d = XS1_USB_PHY_CFG0_XTLSEL_SET(d, 0b101); + else if(XUD_OSC_MHZ == 12) + d = XS1_USB_PHY_CFG0_XTLSEL_SET(d, 0b001); + else + // PANIC + while(1); write_sswitch_reg(0, XS1_SSWITCH_USB_PHY_CFG0_NUM, d); } + +void XUD_HAL_EnterMode_PeripheralChirp() +{ + unsigned d = 0; + d = XS1_USB_PHY_CFG0_UTMI_XCVRSELECT_SET(d, 0); + d = XS1_USB_PHY_CFG0_UTMI_TERMSELECT_SET(d, 1); + d = XS1_USB_PHY_CFG0_UTMI_OPMODE_SET(d, 0b10); + d = XS1_USB_PHY_CFG0_DMPULLDOWN_SET(d, 0); + d = XS1_USB_PHY_CFG0_DPPULLDOWN_SET(d, 0); + + d = XS1_USB_PHY_CFG0_UTMI_SUSPENDM_SET(d, 1); + d = XS1_USB_PHY_CFG0_TXBITSTUFF_EN_SET(d, 1); + d = XS1_USB_PHY_CFG0_PLL_EN_SET(d, 1); + d = XS1_USB_PHY_CFG0_LPM_ALIVE_SET(d, 0); + d = XS1_USB_PHY_CFG0_IDPAD_EN_SET(d, 0); + + if(XUD_OSC_MHZ == 24) + d = XS1_USB_PHY_CFG0_XTLSEL_SET(d, 0b101); + else if(XUD_OSC_MHZ == 12) + d = XS1_USB_PHY_CFG0_XTLSEL_SET(d, 0b001); + else + // PANIC + while(1); + write_sswitch_reg(0, XS1_SSWITCH_USB_PHY_CFG0_NUM, d); +} + +/* TODO pass structure */ +int XUD_HAL_GetLineState(/*XUD_HAL_t &xudHal*/) +{ + unsigned dm, dp; + // xudHal.p_usb_fl0 :> dp; + // xudHal.p_usb_fl1 :> dm; + +#ifdef __XS3A__ + flag0_port :> dp; + flag1_port :> dm; + + if(dp && !dm) + return XUD_LINESTATE_J; + else if(dm && !dp) + return XUD_LINESTATE_K; + else if(!dm && !dp) + return XUD_LINESTATE_SE0; + else + return XUD_LINESTATE_INVALID; +#else + + unsigned j, k, se0; + flag0_port :> j; + flag1_port :> k; + flag2_port :> se0; + + if(j) + return XUD_LINESTATE_J; + if(k) + return XUD_LINESTATE_K; + if(se0) + return XUD_LINESTATE_SE0; + +#endif +} + +void XUD_HAL_Mode_PowerSig() +{ + unsigned d = 0; + d = XS1_USB_SHIM_CFG_FLAG_MODE_SET(d, 1); + write_sswitch_reg(0, XS1_SSWITCH_USB_SHIM_CFG_NUM, d); +} + +void XUD_HAL_Mode_DataTransfer() +{ + unsigned d = 0; + d = XS1_USB_SHIM_CFG_FLAG_MODE_SET(d, 0); + write_sswitch_reg(0, XS1_SSWITCH_USB_SHIM_CFG_NUM, d); +} + #endif diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index 97ebbd07..a87dba21 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -314,6 +314,7 @@ out port p_usb_txd = PORT_USB_TXD; port p_usb_rxd = PORT_USB_RXD; in port p_usb_stp = PORT_USB_STP_SUS; #else + #error XUD_SERIES_SUPPORT not equal to XUD_U_SERIES, XUD_G_SERIES or XUD_L_SERIES #endif @@ -482,7 +483,7 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c set_port_inv(p_usb_clk); set_port_sample_delay(p_usb_clk); -#ifdef SIMULATION +#if defined(XUD_SIM_RTL) || defined(XUD_SIM_XSIM) set_clock_fall_delay(tx_usb_clk, TX_FALL_DELAY+5); #else //This delay controls the capture of rdy @@ -501,12 +502,12 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c set_port_inv(flag0_port); #endif -#ifndef SIMULATION - set_pad_delay(flag1_port, 2); +#if defined (XUD_SIM_RTL) || defined (XUD_SIM_XSIM) + set_pad_delay(flag1_port, 5); #else - set_pad_delay(flag1_port, 5); + set_pad_delay(flag1_port, 2); #endif - + start_clock(tx_usb_clk); start_clock(rx_usb_clk); @@ -518,21 +519,21 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c while(noExit) { #if !defined(ARCH_S) && !defined(__XS2A__) && !defined(__XS3A__) + /* L-series */ p_usb_rxd <: 0; // Note, this is important else phy clocks in invalid data before UIFM is enabled causing clearbuf(p_usb_rxd); // connection issues #endif - unsigned settings[] = {0}; - #if defined(__XS2A__) || defined(__XS3A__) +#if defined(__XS2A__) || defined(__XS3A__) /* For xCORE-200 enable USB port muxing before enabling phy etc */ XUD_EnableUsbPortMux(); //setps(XS1_PS_XCORE_CTRL0, UIFM_MODE); - #endif +#endif -#ifndef SIMULATION - /* Enable the USB clock */ - write_sswitch_reg(get_tile_id(USB_TILE_REF), XS1_SU_CFG_RST_MISC_NUM, ( 1 << XS1_SU_CFG_USB_CLK_EN_SHIFT)); +#if !defined(XUD_SIM_XSIM) && (defined(ARCH_S) || defined (__XS2A__)) + /* Enable the USB clock */ + write_sswitch_reg(get_tile_id(USB_TILE_REF), XS1_SU_CFG_RST_MISC_NUM, ( 1 << XS1_SU_CFG_USB_CLK_EN_SHIFT)); #ifdef ARCH_S /* Now reset the phy */ @@ -545,36 +546,29 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c /* Clear OTG control reg - incase we were running as host previously.. */ write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_OTG_CONTROL_NUM, 0); - -#endif // SIMULATION - -#ifdef __XS3A__ - XUD_EnableUsbPortMux(); + +#elif !(defined XUD_SIM_XSIM) && defined(__XS3A__) unsigned d = 0; + /* Enable wphy and take out of reset */ read_sswitch_reg(0, XS1_SSWITCH_USB_PHY_CFG2_NUM, d); d = XS1_USB_PHY_CFG2_PONRST_SET(d, 1); d = XS1_USB_PHY_CFG2_UTMI_RESET_SET(d, 0); write_sswitch_reg(0, XS1_SSWITCH_USB_PHY_CFG2_NUM, d); - + + /* Setup clocking appropriately */ read_sswitch_reg(0, XS1_SSWITCH_USB_PHY_CFG0_NUM, d); d = XS1_USB_PHY_CFG0_PLL_EN_SET(d,1); d = XS1_USB_PHY_CFG0_XTLSEL_SET(d, 0b101); write_sswitch_reg(0, XS1_SSWITCH_USB_PHY_CFG0_NUM, d); #endif - /* Wait for USB clock (typically 1ms after reset) */ p_usb_clk when pinseq(1) :> int _; p_usb_clk when pinseq(0) :> int _; p_usb_clk when pinseq(1) :> int _; p_usb_clk when pinseq(0) :> int _; -#if defined (__XS3A__) //&& !defined(SIMULATION) - // TODO MOVE ME - XUD_HAL_EnterMode_PeripheralFullSpeed(); -#endif - #if (defined(ARCH_L) && !defined(ARCH_X200) && !defined(ARCH_S)) || defined(ARCH_G) /* For L/G series we wait for clock from phy, then enable UIFM logic */ // 3 u series, else 2 @@ -585,7 +579,7 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c #endif #endif -#if defined(ARCH_X200) +#if defined(__XS2A__) #define XS1_UIFM_USB_PHY_EXT_CTRL_REG 0x50 #define XS1_UIFM_USB_PHY_EXT_CTRL_VBUSVLDEXT_MASK 0x4 /* Remove requirement for VBUS in bus-powered mode */ @@ -610,10 +604,10 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c write_periph_word(USB_TILE_REF, XS1_GLX_PER_UIFM_CHANEND_NUM, XS1_UIFM_USB_PHY_TUNE_REG, PHYTUNEREGVAL); #endif -#ifndef SIMULATION +#if !defined(XUD_SIM_XSIM) #if defined(ARCH_S) || defined(ARCH_X200) write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_CONTROL_NUM, (1< void; } } -#ifndef SIMULATION +#if !defined(XUD_SIM_XSIM) #if defined(__XS1B__) || defined(__XS2A__) /* Go into full speed mode: XcvrSelect and Term Select (and suspend) high */ - write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_FUNC_CONTROL_NUM, - (1< time; + t when timerafter(time + 20000) :> int _;// T_WTRSTHS: 100-875us /* Sample line state and check for reset (or suspend) */ - flag2_port :> reset; /* SE0 Line */ + XUD_LineState_t ls = XUD_HAL_GetLineState(); + if(ls == XUD_LINESTATE_SE0) + reset == 1; + else + reset = 0; } /* Inspect for suspend or reset */ if(!reset) @@ -697,7 +699,7 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c } #endif /* Test if coming back from reset or suspend */ - if(reset==1) + if(reset == 1) { if(!sentReset) @@ -725,7 +727,7 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c ep_info[USB_MAX_NUM_EP_OUT+i].pid = USB_PIDn_DATA0; } -#ifndef SIMULATION +#if !defined (XUD_SIM_XSIM) /* Set default device address */ #if defined(__XS1B__) || defined(__XS2A__) write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_DEVICE_ADDRESS_NUM, 0); @@ -734,7 +736,7 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c #endif #endif -#ifdef SIMULATION +#ifdef XUD_BYPASS_RESET #if defined(XUD_TEST_SPEED_HS) g_curSpeed = XUD_SPEED_HS; g_txHandshakeTimeout = HS_TX_HANDSHAKE_TIMEOUT; @@ -744,7 +746,6 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c #else #error #endif - #else if(g_desSpeed == XUD_SPEED_HS) { diff --git a/lib_xud/src/core/XUD_PowerSig.xc b/lib_xud/src/core/XUD_PowerSig.xc index 566353d2..e721e62b 100755 --- a/lib_xud/src/core/XUD_PowerSig.xc +++ b/lib_xud/src/core/XUD_PowerSig.xc @@ -1,10 +1,9 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved /** @file XUD_PowerSig.xc * @brief Functions for USB power signaling * @author Ross Owen, XMOS Limited **/ -#ifndef __XS3A__ #include #include @@ -13,8 +12,10 @@ #include "XUD_UIFM_Functions.h" #include "XUD_USB_Defines.h" #include "XUD_UIFM_Defines.h" +#include "XUD_HAL.h" + -#ifdef ARCH_X200 +#ifdef __XS2A__ #include "xs1_to_glx.h" #include "xs2_su_registers.h" #endif @@ -91,286 +92,69 @@ int XUD_Init() #endif /* Wait for host */ - while (1) - { - select - { - /* SE0 State */ - case flag2_port when pinseq(1) :> void: - SE0_timer :> SE0_start_time; - select - { - case flag2_port when pinseq(0) :> void: - break; - - case SE0_timer when timerafter(SE0_start_time + T_WTRSTFS) :> int: - return 1; - break; - } - break; - - /* J State */ - case flag0_port when pinseq(0) :> void: // Inverted! - SE0_timer :> SE0_start_time; - select - { - case flag0_port when pinseq(1) :> void: // Inverted! - break; - - case SE0_timer when timerafter(SE0_start_time + STATE_START_TO) :> int: - return 0; - break; - } - break; - } - } - __builtin_trap(); - return -1; -} - -/** XUD_DoSuspend - * @brief Function called when device is suspended. This should include any clock down code etc. - * @return True if reset detected during resume */ -int XUD_Suspend(XUD_PwrConfig pwrConfig) -{ - unsigned tmp; - timer t; - unsigned time; - - /* Suspend can be handled in multiple ways: - - Poll flags registers for resume/reset - - Suspend phy and poll line status in test status reg for resume/reset - - Power down zevious and use the suspend controller to wake zevious up - */ -#if defined(ARCH_L) && defined(GLX_SUSPHY) -#ifdef GLX_PWRDWN - unsigned devAddr; - unsigned before; - /* Power suspend phy, power down zevious and used suspend controller to wake up */ - - /* NOTE CURRENTLY XEV DOES NOT GET TURNED OFF, WE JUST ARE USING SUSPEND CONTROLLER TO - * VERIFY FUNCTIONALITY */ - - /* Wait for suspend J to make its way through filter */ - read_periph_word(USB_TILE_REF, XS1_GLX_PERIPH_USB_ID, XS1_UIFM_PHY_CONTROL_REG, before); - - while(1) - { - unsigned x; - read_periph_word(USB_TILE_REF, XS1_GLX_PERIPH_USB_ID, XS1_UIFM_PHY_TESTSTATUS_REG, x); - x >>= 9; - x &= 0x3; - if(x == 1) - { - break; - } - } - - /* Save device address to Glx scratch*/ - { - char wData[] = {0}; - read_periph_word(USB_TILE_REF, XS1_GLX_PERIPH_USB_ID, XS1_UIFM_DEVICE_ADDRESS_REG, devAddr); - wData[0] = (char) devAddr; - - write_periph_reg_8(USB_TILE_REF, XS1_GLX_PERIPH_SCTH_ID, 0x0, 1, wData); - } - - /* Suspend Phy etc - * SEOFILTBASE sets a bit in a counter for anti-glitch (i.e 2 looks for change in 0b10) - * This is a simple counter with check from wrap in this bit, so worst case could be x2 off - * Counter runs at 32kHz by (31.25uS period). So setting 2 is about 63-125uS - */ - write_periph_word(USB_TILE_REF, XS1_GLX_PERIPH_USB_ID, XS1_UIFM_PHY_CONTROL_REG, - (1 << XS1_UIFM_PHY_CONTROL_AUTORESUME) | - (0x2 << XS1_UIFM_PHY_CONTROL_SE0FILTVAL_BASE) - | (1 << XS1_UIFM_PHY_CONTROL_FORCESUSPEND) - ); - - /* Mark scratch reg */ - { - char x[] = {1}; - write_periph_reg_8(USB_TILE_REF, XS1_GLX_PERIPH_SCTH_ID, 0xff, 1, x); - } - - /* Finally power down Xevious, keep sysclk running, keep USB enabled. */ - write_periph_word(USB_TILE_REF, XS1_GLX_PERIPH_PWR_ID, XS1_GLX_PWR_MISC_CTRL_ADRS, - (1 << XS1_GLX_PWR_SLEEP_INIT_BASE) /* Sleep */ - | (1 << XS1_GLX_PWR_SLEEP_CLK_SEL_BASE) /* Default clock */ - | (0x3 << XS1_GLX_PWR_USB_PD_EN_BASE ) ); /* Enable usb power up/down */ - - /* Normally XCore will now be off and will reboot on resume/reset - * However, all supplies enabled to test suspend controller so we'll poll resume reason reg.. */ - - while(1) + while (1) { - unsigned wakeReason = 0; - read_periph_word(USB_TILE_REF, XS1_GLX_PERIPH_USB_ID, XS1_UIFM_PHY_CONTROL_REG, wakeReason); +#ifdef __XS3A__ + + XUD_LineState_t ls = XUD_HAL_GetLineState(); + + if(ls == XUD_LINESTATE_SE0) + return 1; + else if(ls == XUD_LINESTATE_J) + return 0; - if(wakeReason & (1< int _; - p_usb_clk when pinseq(0) :> int _; - p_usb_clk when pinseq(1) :> int _; - p_usb_clk when pinseq(0) :> int _; - - /* Func control reg will be default of 0x4 here term: 0 xcvSel: 0, opmode: 0b01 (non-driving) */ - write_periph_word(USB_TILE_REF, XS1_GLX_PERIPH_USB_ID, XS1_UIFM_FUNC_CONTROL_REG, - (1< void: + SE0_timer :> SE0_start_time; + select + { + case flag2_port when pinseq(0) :> void: + break; - /* Wait for end of resume */ - while(1) - { - /* Wait for se0 */ - flag2_port when pinseq(1) :> void; + case SE0_timer when timerafter(SE0_start_time + T_WTRSTFS) :> int: + return 1; + break; + } + break; - if(g_curSpeed == XUD_SPEED_HS) + /* J State */ + case flag0_port when pinseq(0) :> void: // Inverted! + SE0_timer :> SE0_start_time; + select { - /* Back to high-speed */ - write_periph_word(USB_TILE_REF, XS1_GLX_PERIPH_USB_ID, XS1_UIFM_FUNC_CONTROL_REG, 0); + case flag0_port when pinseq(1) :> void: // Inverted! + break; + + case SE0_timer when timerafter(SE0_start_time + STATE_START_TO) :> int: + return 0; + break; } - return 0; - } + break; } - else if(wakeReason & (1< int _; - p_usb_clk when pinseq(0) :> int _; - p_usb_clk when pinseq(1) :> int _; - p_usb_clk when pinseq(0) :> int _; - - /* Set IFM to decoding linestate.. IFM regs reset when phy suspended */ - write_periph_word(USB_TILE_REF, XS1_GLX_PERIPH_USB_ID, XS1_UIFM_IFM_CONTROL_REG, - (1< time; - t when timerafter(time+250000) :> void; - } - return 1; - } +#ifndef __XS3A__ +/** XUD_DoSuspend + * @brief Function called when device is suspended. This should include any clock down code etc. + * @return True if reset detected during resume */ +int XUD_Suspend(XUD_PwrConfig pwrConfig) +{ + unsigned tmp; + timer t; + unsigned time; -#else /* GLX_PWRDWN */ unsigned rdata = 0; - /* TODO Wait for suspend (j) to come through filter */ - while(1) - { - unsigned x; - read_periph_word(USB_TILE_REF, XS1_GLX_PERIPH_USB_ID, XS1_UIFM_PHY_TESTSTATUS_REG, x); - x >>= 9; - x &= 0x3; - if(x == 1) - { - break; - } - } - - while(1) - { - read_periph_word(USB_TILE_REF, XS1_GLX_PERIPH_USB_ID, XS1_UIFM_PHY_TESTSTATUS_REG, rdata); - rdata >>= 9; - rdata &= 0x3; - - if(rdata == 2) - { - /* Resume */ - - /* Un-suspend phy */ - write_periph_word(USB_TILE_REF, XS1_GLX_PERIPH_USB_ID, XS1_UIFM_PHY_CONTROL_REG, 0); - - /* Wait for usb clock */ - set_thread_fast_mode_on(); - p_usb_clk when pinseq(1) :> int _; - p_usb_clk when pinseq(0) :> int _; - p_usb_clk when pinseq(1) :> int _; - p_usb_clk when pinseq(0) :> int _; - set_thread_fast_mode_off(); - if(g_curSpeed == XUD_SPEED_HS) - { - /* Back to high-speed */ - write_periph_word(USB_TILE_REF, XS1_GLX_PERIPH_USB_ID, XS1_UIFM_FUNC_CONTROL_REG, 0); - } - - /* Wait for end of resume */ - while(1) - { - read_periph_word(USB_TILE_REF, XS1_GLX_PERIPH_USB_ID, XS1_UIFM_PHY_TESTSTATUS_REG, rdata); - rdata >>= 9; - rdata &= 0x3; - - if(rdata == 0) - { - /* SE0 */ - return 0; - } - else if(rdata == 1) - { - /* Glitch */ - break; - } - } - } - else if(rdata == 0) - { -#if 0 - /* Reset */ - while(1) - { - int count = 0; - read_periph_word(USB_TILE_REF, XS1_GLX_PERIPH_USB_ID, XS1_UIFM_PHY_TESTSTATUS_REG, rdata); - rdata >>= 9; - rdata &= 0x3; - - if(rdata != 0) - { - /* Se0 gone away...*/ - break; - } - else - { - count++; - if(count>0) - { -#endif - /* Un-suspend phy */ - write_periph_word(USB_TILE_REF, XS1_GLX_PERIPH_USB_ID, XS1_UIFM_PHY_CONTROL_REG, 0); - return 1; -#if 0 - } - } -#endif - } - } - } -#endif - - -#elif defined ARCH_S || defined ARCH_X200 /* "Normal" polling suspend for L or S series */ while (1) { t :> time; @@ -455,7 +239,14 @@ int XUD_Suspend(XUD_PwrConfig pwrConfig) } __builtin_trap(); return -1; -#endif +} + +#else +int XUD_Suspend(XUD_PwrConfig pwrConfig) +{ + + while(1); + // TODO } #endif diff --git a/lib_xud/src/core/XUD_Support.xc b/lib_xud/src/core/XUD_Support.xc index 22920c88..cb495fb9 100755 --- a/lib_xud/src/core/XUD_Support.xc +++ b/lib_xud/src/core/XUD_Support.xc @@ -10,12 +10,3 @@ extern inline unsigned char XUD_Sup_testct(XUD_chan c); extern inline void XUD_Sup_outuint(XUD_chan c, unsigned x); extern inline void XUD_Sup_outct(XUD_chan c, unsigned char x); -void XUD_Sup_Delay(unsigned delay) -{ - timer t; - unsigned time; - - t :> time; - time += delay; - t when timerafter(time) :> void; -} diff --git a/tests/test_bulk_rx_basic/src/main.xc b/tests/test_bulk_rx_basic/src/main.xc index f0f6b1d3..d7d58ccf 100644 --- a/tests/test_bulk_rx_basic/src/main.xc +++ b/tests/test_bulk_rx_basic/src/main.xc @@ -25,7 +25,7 @@ XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -#ifdef XUD_TEST_RTL +#ifdef XUD_SIM_RTL int testmain() #else int main() @@ -42,7 +42,7 @@ int main() { unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); -#ifdef XUD_TEST_RTL +#ifdef XUD_SIM_RTL if(fail) TerminateFail(fail); else From 071d49ffefd26938e9b7b74a8e82fc88ab0cb2c4 Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Wed, 2 Oct 2019 14:54:54 +0100 Subject: [PATCH 048/520] Further updates for XS3 tests --- lib_xud/src/core/XUD_DeviceAttach.xc | 26 ++++++++++++++++++-------- lib_xud/src/core/XUD_HAL.h | 1 + lib_xud/src/core/XUD_HAL.xc | 25 +++++++++++++++++++++++++ lib_xud/src/core/XUD_Main.xc | 11 +++++------ lib_xud/src/core/XUD_TimingDefines.h | 6 ++++++ tests/test_bulk_rx_basic/src/main.xc | 12 ++++++++++-- 6 files changed, 65 insertions(+), 16 deletions(-) diff --git a/lib_xud/src/core/XUD_DeviceAttach.xc b/lib_xud/src/core/XUD_DeviceAttach.xc index 296693ab..e36eaa1e 100755 --- a/lib_xud/src/core/XUD_DeviceAttach.xc +++ b/lib_xud/src/core/XUD_DeviceAttach.xc @@ -85,8 +85,8 @@ int XUD_DeviceAttachHS(XUD_PwrConfig pwrConfig) //t when timerafter(start_time+10000):> void; // output k-chirp for required time -#ifdef SIMULATION - for (int i = 0; i < 4000; i++) +#if defined(XUD_SIM_RTL) || (XUD_SIM_XSIM) + for (int i = 0; i < 800; i++) #else for (int i = 0; i < 16000; i++) // 16000 words @ 480 MBit = 1.066 ms #endif @@ -95,8 +95,11 @@ int XUD_DeviceAttachHS(XUD_PwrConfig pwrConfig) } // J, K, SE0 on flag ports 0, 1, 2 respectively (on XS2) + // XS3 has raw linestate on flag port 0 and 1 // Wait for fs chirp k (i.e. HS chirp j) +#ifndef __XS3A flag1_port when pinseq(0) :> tmp; // Wait for out k to go +#endif t :> start_time; while(1) @@ -107,8 +110,8 @@ int XUD_DeviceAttachHS(XUD_PwrConfig pwrConfig) /* Go into full speed mode: XcvrSelect and Term Select (and suspend) high */ #ifdef __XS3A__ -#warning TODO FOR XS3 - + + XUD_HAL_EnterMode_PeripheralFullSpeed(); #elif defined(ARCH_S) || defined(ARCH_X200) write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_FUNC_CONTROL_NUM, @@ -124,14 +127,22 @@ int XUD_DeviceAttachHS(XUD_PwrConfig pwrConfig) /* TODO Use a timer to save some juice...*/ #ifdef __XS3A__ - + while(1) + { + unsigned dp, dm; + flag0_port :> dm; + flag1_port :> dp; + + if(dp || dm) + return 0; + } #else flag2_port :> tmp; -#endif if(!tmp) { return 0; /* SE0 gone, return 0 to indicate FULL SPEED */ } +#endif if(pwrConfig == XUD_PWR_SELF) { unsigned x; @@ -173,8 +184,7 @@ int XUD_DeviceAttachHS(XUD_PwrConfig pwrConfig) // Three pairs of KJ received... de-assert TermSelect... // (and opmode = 0, suspendm = 1) #ifdef __XS3A__ -#warning TODO FOR XS3 - + XUD_HAL_EnterMode_PeripheralHighSpeed(); #elif defined(ARCH_S) || defined(ARCH_X200) write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_FUNC_CONTROL_NUM, 0b0000); diff --git a/lib_xud/src/core/XUD_HAL.h b/lib_xud/src/core/XUD_HAL.h index 6f47d6df..76b1f0da 100644 --- a/lib_xud/src/core/XUD_HAL.h +++ b/lib_xud/src/core/XUD_HAL.h @@ -3,6 +3,7 @@ void XUD_HAL_EnterMode_PeripheralFullSpeed(); void XUD_HAL_EnterMode_PeripheralChirp(); +void XUD_HAL_EnterMode_PeripheralHighSpeed(); typedef struct XUD_HAL_t diff --git a/lib_xud/src/core/XUD_HAL.xc b/lib_xud/src/core/XUD_HAL.xc index 7bd8150e..d3849adc 100644 --- a/lib_xud/src/core/XUD_HAL.xc +++ b/lib_xud/src/core/XUD_HAL.xc @@ -58,6 +58,31 @@ void XUD_HAL_EnterMode_PeripheralChirp() write_sswitch_reg(0, XS1_SSWITCH_USB_PHY_CFG0_NUM, d); } +void XUD_HAL_EnterMode_PeripheralHighSpeed() +{ + unsigned d = 0; + d = XS1_USB_PHY_CFG0_UTMI_XCVRSELECT_SET(d, 0); // HS + d = XS1_USB_PHY_CFG0_UTMI_TERMSELECT_SET(d, 0); // HS + d = XS1_USB_PHY_CFG0_UTMI_OPMODE_SET(d, 0b00); // Normal operation + d = XS1_USB_PHY_CFG0_DMPULLDOWN_SET(d, 0); + d = XS1_USB_PHY_CFG0_DPPULLDOWN_SET(d, 0); + + d = XS1_USB_PHY_CFG0_UTMI_SUSPENDM_SET(d, 1); + d = XS1_USB_PHY_CFG0_TXBITSTUFF_EN_SET(d, 1); + d = XS1_USB_PHY_CFG0_PLL_EN_SET(d, 1); + d = XS1_USB_PHY_CFG0_LPM_ALIVE_SET(d, 0); + d = XS1_USB_PHY_CFG0_IDPAD_EN_SET(d, 0); + + if(XUD_OSC_MHZ == 24) + d = XS1_USB_PHY_CFG0_XTLSEL_SET(d, 0b101); + else if(XUD_OSC_MHZ == 12) + d = XS1_USB_PHY_CFG0_XTLSEL_SET(d, 0b001); + else + // PANIC + while(1); + write_sswitch_reg(0, XS1_SSWITCH_USB_PHY_CFG0_NUM, d); +} + /* TODO pass structure */ int XUD_HAL_GetLineState(/*XUD_HAL_t &xudHal*/) { diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index a87dba21..b7ee9e57 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -545,8 +545,7 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c write_sswitch_reg(get_tile_id(USB_TILE_REF), XS1_SU_CFG_RST_MISC_NUM, (1 << XS1_SU_CFG_USB_CLK_EN_SHIFT) | (1< int _; p_usb_clk when pinseq(1) :> int _; p_usb_clk when pinseq(0) :> int _; - + #if (defined(ARCH_L) && !defined(ARCH_X200) && !defined(ARCH_S)) || defined(ARCH_G) /* For L/G series we wait for clock from phy, then enable UIFM logic */ // 3 u series, else 2 @@ -737,14 +736,14 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c #endif #ifdef XUD_BYPASS_RESET - #if defined(XUD_TEST_SPEED_HS) + #if defined(XUD_SIM_SPEED_HS) g_curSpeed = XUD_SPEED_HS; g_txHandshakeTimeout = HS_TX_HANDSHAKE_TIMEOUT; - #elif defined(XUD_TEST_SPEED_FS) + #elif defined(XUD_SIM_SPEED_FS) g_curSpeed = XUD_SPEED_FS; g_txHandshakeTimeout = FS_TX_HANDSHAKE_TIMEOUT; #else - #error + #error XUD_SIM_SPEED_ must be defined if using XUD_BYPASS_RESET! #endif #else if(g_desSpeed == XUD_SPEED_HS) diff --git a/lib_xud/src/core/XUD_TimingDefines.h b/lib_xud/src/core/XUD_TimingDefines.h index 78436af5..55358b3c 100755 --- a/lib_xud/src/core/XUD_TimingDefines.h +++ b/lib_xud/src/core/XUD_TimingDefines.h @@ -16,8 +16,14 @@ #define T_UCHEND_T_UCH (T_UCHEND_T_UCH_us * REF_CLK_FREQ) #define T_UCHEND_T_UCH_ULPI_us 2000 // 2ms #define T_UCHEND_T_UCH_ULPI (T_UCHEND_T_UCH_us * REF_CLK_FREQ) + +#ifdef XUD_TIMING_SHORT +#define T_FILT 100 +#else #define T_FILT_us 3 // 2.5us #define T_FILT (T_FILT_us * REF_CLK_FREQ) +#endif + #define SUSPEND_T_WTWRSTHS_us 200 // 200us Time beforechecking for J after asserting XcvrSelect and Termselect #define SUSPEND_T_WTWRSTHS (SUSPEND_T_WTWRSTHS_us * REF_CLK_FREQ) diff --git a/tests/test_bulk_rx_basic/src/main.xc b/tests/test_bulk_rx_basic/src/main.xc index d7d58ccf..c2079dfa 100644 --- a/tests/test_bulk_rx_basic/src/main.xc +++ b/tests/test_bulk_rx_basic/src/main.xc @@ -35,9 +35,17 @@ int main() par { - XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + { + #if defined(XUD_TEST_SPEED_FS) + unsigned speed = XUD_SPEED_FS; + #elif defined(XUD_TEST_SPEED_HS) + unsigned speed = XUD_SPEED_HS; + #endif + + XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, - null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); + null, null, -1, speed, XUD_PWR_BUS); + } { unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); From 55ca3be08f4138a9200f5d8a49a7e7d8a5039953 Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Wed, 2 Oct 2019 17:06:58 +0100 Subject: [PATCH 049/520] Fixed FS test by enable DataTransfer mode in shim --- lib_xud/src/core/XUD_Main.xc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index b7ee9e57..1f883c44 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -483,7 +483,7 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c set_port_inv(p_usb_clk); set_port_sample_delay(p_usb_clk); -#if defined(XUD_SIM_RTL) || defined(XUD_SIM_XSIM) +#if defined(XUD_SIM_XSIM) set_clock_fall_delay(tx_usb_clk, TX_FALL_DELAY+5); #else //This delay controls the capture of rdy @@ -800,7 +800,7 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c | ((1< Date: Thu, 3 Oct 2019 13:57:35 +0100 Subject: [PATCH 050/520] Small optimisation in Rx Loop --- lib_xud/src/core/included/XUD_Token_Setup.S | 4 ++-- tests/test_bulk_tx_basic/src/main.xc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_xud/src/core/included/XUD_Token_Setup.S b/lib_xud/src/core/included/XUD_Token_Setup.S index 6bcd7963..106a63dc 100644 --- a/lib_xud/src/core/included/XUD_Token_Setup.S +++ b/lib_xud/src/core/included/XUD_Token_Setup.S @@ -38,9 +38,9 @@ GotRxPid: NextRxWord: // RXD port has event vector here in r11, res[r0] - crc32 r6, r11, r9 stw r11, r1[r4] - add r4, r4, 1 + crc32_inc r6, r11, r9, r4, 1 + //add r4, r4, 1 .xtabranch NextRxWord, RxALow bu NextRxWord diff --git a/tests/test_bulk_tx_basic/src/main.xc b/tests/test_bulk_tx_basic/src/main.xc index a676b29f..297584ae 100644 --- a/tests/test_bulk_tx_basic/src/main.xc +++ b/tests/test_bulk_tx_basic/src/main.xc @@ -39,7 +39,7 @@ XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO}; -#ifdef XUD_TEST_RTL +#ifdef XUD_SIM_RTL int testmain() #else int main() @@ -57,7 +57,7 @@ int main() { unsigned fail = TestEp_Tx(c_ep_in[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_DIE); -#ifdef XUD_TEST_RTL +#ifdef XUD_SIM_RTL /* Note, this test relies on checking at the host side */ if(fail) From a8c888844c560d114cea1376c023708d92192470 Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Thu, 3 Oct 2019 14:57:33 +0100 Subject: [PATCH 051/520] Fixed rtl build of test_bulk_tx_basic --- tests/test_bulk_tx_basic/src/main.xc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/test_bulk_tx_basic/src/main.xc b/tests/test_bulk_tx_basic/src/main.xc index 297584ae..86dbeb62 100644 --- a/tests/test_bulk_tx_basic/src/main.xc +++ b/tests/test_bulk_tx_basic/src/main.xc @@ -49,11 +49,19 @@ int main() par { - // TODO test is running at 400MHz - XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + { + #if defined(XUD_TEST_SPEED_FS) + unsigned speed = XUD_SPEED_FS; + #elif defined(XUD_TEST_SPEED_HS) + unsigned speed = XUD_SPEED_HS; + #endif + + // TODO test is running at 400MHz + XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, - null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); - + null, null, -1, speed, XUD_PWR_BUS); + } + { unsigned fail = TestEp_Tx(c_ep_in[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_DIE); From 6d8f9d2f9d4b47ebe63ebd1813c805be10a547bb Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Thu, 3 Oct 2019 16:32:52 +0100 Subject: [PATCH 052/520] Fixed usage of XUD_OSC_MHZ --- lib_xud/src/core/XUD_Main.xc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index 1f883c44..3e26ab6b 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -558,7 +558,13 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c /* Setup clocking appropriately */ read_sswitch_reg(0, XS1_SSWITCH_USB_PHY_CFG0_NUM, d); d = XS1_USB_PHY_CFG0_PLL_EN_SET(d,1); - d = XS1_USB_PHY_CFG0_XTLSEL_SET(d, 0b101); + if(XUD_OSC_MHZ == 24) + d = XS1_USB_PHY_CFG0_XTLSEL_SET(d, 0b101); + else if(XUD_OSC_MHZ == 12) + d = XS1_USB_PHY_CFG0_XTLSEL_SET(d, 0b001); + else + // PANIC + while(1); write_sswitch_reg(0, XS1_SSWITCH_USB_PHY_CFG0_NUM, d); #endif From d9e479d8da5714239b8eee1011fa76bfa3ecd743 Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Fri, 4 Oct 2019 12:17:28 +0100 Subject: [PATCH 053/520] Tidy xs3 xtl settings --- lib_xud/src/core/XUD_HAL.xc | 57 +++++++++++++++++++++++------------- lib_xud/src/core/XUD_Main.xc | 11 ++----- 2 files changed, 39 insertions(+), 29 deletions(-) diff --git a/lib_xud/src/core/XUD_HAL.xc b/lib_xud/src/core/XUD_HAL.xc index d3849adc..3ff534a3 100644 --- a/lib_xud/src/core/XUD_HAL.xc +++ b/lib_xud/src/core/XUD_HAL.xc @@ -8,6 +8,35 @@ extern in port flag0_port; /* For XS3: RXA or DP */ extern in port flag1_port; /* For XS3: RXE or DM */ + + +unsigned XtlSelFromMhz(unsigned m) +{ + switch(m) + { + case 10: + return 0b000; + case 12: + return 0b001; + case 25: + return 0b010; + case 30: + return 0b011; + case 19: /*.2*/ + return 0b100; + case 24: + return 0b101; + case 27: + return 0b110; + case 40: + return 0b111; + default: + /* Panic */ + while(1) + break; + } +} + void XUD_HAL_EnterMode_PeripheralFullSpeed() { unsigned d = 0; @@ -23,13 +52,9 @@ void XUD_HAL_EnterMode_PeripheralFullSpeed() d = XS1_USB_PHY_CFG0_LPM_ALIVE_SET(d, 0); d = XS1_USB_PHY_CFG0_IDPAD_EN_SET(d, 0); - if(XUD_OSC_MHZ == 24) - d = XS1_USB_PHY_CFG0_XTLSEL_SET(d, 0b101); - else if(XUD_OSC_MHZ == 12) - d = XS1_USB_PHY_CFG0_XTLSEL_SET(d, 0b001); - else - // PANIC - while(1); + unsigned xtlSelVal = XtlSelFromMhz(XUD_OSC_MHZ); + d = XS1_USB_PHY_CFG0_XTLSEL_SET(d, xtlSelVal); + write_sswitch_reg(0, XS1_SSWITCH_USB_PHY_CFG0_NUM, d); } @@ -48,13 +73,8 @@ void XUD_HAL_EnterMode_PeripheralChirp() d = XS1_USB_PHY_CFG0_LPM_ALIVE_SET(d, 0); d = XS1_USB_PHY_CFG0_IDPAD_EN_SET(d, 0); - if(XUD_OSC_MHZ == 24) - d = XS1_USB_PHY_CFG0_XTLSEL_SET(d, 0b101); - else if(XUD_OSC_MHZ == 12) - d = XS1_USB_PHY_CFG0_XTLSEL_SET(d, 0b001); - else - // PANIC - while(1); + unsigned xtlselVal = XtlSelFromMhz(XUD_OSC_MHZ); + d = XS1_USB_PHY_CFG0_XTLSEL_SET(d, xtlselVal); write_sswitch_reg(0, XS1_SSWITCH_USB_PHY_CFG0_NUM, d); } @@ -73,13 +93,8 @@ void XUD_HAL_EnterMode_PeripheralHighSpeed() d = XS1_USB_PHY_CFG0_LPM_ALIVE_SET(d, 0); d = XS1_USB_PHY_CFG0_IDPAD_EN_SET(d, 0); - if(XUD_OSC_MHZ == 24) - d = XS1_USB_PHY_CFG0_XTLSEL_SET(d, 0b101); - else if(XUD_OSC_MHZ == 12) - d = XS1_USB_PHY_CFG0_XTLSEL_SET(d, 0b001); - else - // PANIC - while(1); + unsigned xtlselVal = XtlSelFromMhz(XUD_OSC_MHZ); + d = XS1_USB_PHY_CFG0_XTLSEL_SET(d, xtlselVal); write_sswitch_reg(0, XS1_SSWITCH_USB_PHY_CFG0_NUM, d); } diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index 3e26ab6b..e97dcc23 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -40,6 +40,7 @@ void XUD_Error_hex(char errString[], int i_err); #ifdef __XS3A__ #include "XUD_HAL.h" #include "xs3a_registers.h" +unsigned XtlSelFromMhz(unsigned m); #endif #if defined(ARCH_X200) || defined(ARCH_S) @@ -557,14 +558,8 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c /* Setup clocking appropriately */ read_sswitch_reg(0, XS1_SSWITCH_USB_PHY_CFG0_NUM, d); - d = XS1_USB_PHY_CFG0_PLL_EN_SET(d,1); - if(XUD_OSC_MHZ == 24) - d = XS1_USB_PHY_CFG0_XTLSEL_SET(d, 0b101); - else if(XUD_OSC_MHZ == 12) - d = XS1_USB_PHY_CFG0_XTLSEL_SET(d, 0b001); - else - // PANIC - while(1); + unsigned xtlselVal = XtlSelFromMhz(XUD_OSC_MHZ); + d = XS1_USB_PHY_CFG0_XTLSEL_SET(d, xtlselVal); write_sswitch_reg(0, XS1_SSWITCH_USB_PHY_CFG0_NUM, d); #endif From a99ca45210d946ebf15e96be9ce8fcad78c85a11 Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Mon, 7 Oct 2019 14:14:47 +0100 Subject: [PATCH 054/520] Fixed build issue relating to HAL, increased pkt count in basic bulk tests --- lib_xud/src/core/XUD_Main.xc | 1 + tests/test_bulk_rx_basic/src/main.xc | 2 +- tests/test_bulk_tx_basic/src/main.xc | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index e97dcc23..8ead2ee9 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -40,6 +40,7 @@ void XUD_Error_hex(char errString[], int i_err); #ifdef __XS3A__ #include "XUD_HAL.h" #include "xs3a_registers.h" +/* TODO should not be expose here, should be in HAL */ unsigned XtlSelFromMhz(unsigned m); #endif diff --git a/tests/test_bulk_rx_basic/src/main.xc b/tests/test_bulk_rx_basic/src/main.xc index c2079dfa..adcd63ee 100644 --- a/tests/test_bulk_rx_basic/src/main.xc +++ b/tests/test_bulk_rx_basic/src/main.xc @@ -14,7 +14,7 @@ #endif #ifndef PKT_LENGTH_END -#define PKT_LENGTH_END 14 +#define PKT_LENGTH_END 19 #endif #ifndef TEST_EP_NUM diff --git a/tests/test_bulk_tx_basic/src/main.xc b/tests/test_bulk_tx_basic/src/main.xc index 86dbeb62..a3c3155d 100644 --- a/tests/test_bulk_tx_basic/src/main.xc +++ b/tests/test_bulk_tx_basic/src/main.xc @@ -23,7 +23,7 @@ #endif #ifndef PKT_LENGTH_END -#define PKT_LENGTH_END 14 +#define PKT_LENGTH_END 19 #endif #define XUD_EP_COUNT_OUT 4 From 78129082f23156242ab846a70d0696998c51065d Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Tue, 8 Oct 2019 15:59:20 +0100 Subject: [PATCH 055/520] Added timing defines for running xs3 at various core freqs --- lib_xud/src/core/XUD_Main.xc | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index 8ead2ee9..8dc297fc 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -461,15 +461,36 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c #endif #define TX_RISE_DELAY 5 + #if defined(ARCH_S) + #define RX_RISE_DELAY 5 + #define RX_FALL_DELAY 5 + #define TX_RISE_DELAY 5 #define TX_FALL_DELAY 2 +#elif defined(__XS3A__) + #if (XUD_CORE_CLOCK > 500) + #define RX_RISE_DELAY 2 + #define RX_FALL_DELAY 5 + #define TX_RISE_DELAY 2 + #define TX_FALL_DELAY 3 + #elif (XUD_CORE_CLOCK > 400) + #define RX_RISE_DELAY 5 + #define RX_FALL_DELAY 5 + #define TX_RISE_DELAY 2 + #define TX_FALL_DELAY 3 + #else /* 400 */ + #define RX_RISE_DELAY 4 + #define RX_FALL_DELAY 5 + #define TX_RISE_DELAY 2 + #define TX_FALL_DELAY 3 + #endif #else + #define RX_RISE_DELAY 5 + #define RX_FALL_DELAY 5 + #define TX_RISE_DELAY 5 #define TX_FALL_DELAY 1 #endif -#define RX_RISE_DELAY 5 -#define RX_FALL_DELAY 5 - // Set up USB ports. Done in ASM as read port used in both directions initially. // Main difference from xevious is IFM not enabled. // GLX_UIFM_PortConfig (p_usb_clk, txd, rxd, flag0_port, flag1_port, flag2_port); From b23bd3dacf03645f967fa3ffcad01f08426745c6 Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Wed, 9 Oct 2019 14:42:06 +0100 Subject: [PATCH 056/520] Timing tweaks for xs3 @ 400 --- lib_xud/src/core/XUD_Main.xc | 4 ++-- lib_xud/src/core/included/XUD_Token_Ping.S | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index 8dc297fc..8d10c2b1 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -479,9 +479,9 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c #define TX_RISE_DELAY 2 #define TX_FALL_DELAY 3 #else /* 400 */ - #define RX_RISE_DELAY 4 + #define RX_RISE_DELAY 3 #define RX_FALL_DELAY 5 - #define TX_RISE_DELAY 2 + #define TX_RISE_DELAY 3 #define TX_FALL_DELAY 3 #endif #else diff --git a/lib_xud/src/core/included/XUD_Token_Ping.S b/lib_xud/src/core/included/XUD_Token_Ping.S index 65d24b9a..d1ae1cbe 100755 --- a/lib_xud/src/core/included/XUD_Token_Ping.S +++ b/lib_xud/src/core/included/XUD_Token_Ping.S @@ -17,9 +17,11 @@ LoadStatTablePing: .scheduling off PrimaryBufferEmpty_PING: // Send ACK +#if (XUD_CORE_CLOCK > 400) nop nop nop +#endif nop nop nop @@ -29,9 +31,11 @@ PrimaryBufferEmpty_PING: // Send ACK bu NextTokenAfterPing PrimaryBufferFull_PING: // Send NAK +#if (XUD_CORE_CLOCK > 400) nop nop nop +#endif nop nop nop From 84a8e04323b74bdadf11670a068c5633fe123dcd Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Wed, 9 Oct 2019 15:53:01 +0100 Subject: [PATCH 057/520] rxa flag port now clocked from rx usb clock block. Fixed flag port comments --- lib_xud/src/core/XUD_Main.xc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index 8d10c2b1..c5966a99 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -287,8 +287,8 @@ unsigned int data_pid=0xbadf00d; //extern clock tx_usb_clk; //extern clock rx_usb_clk; -in port flag0_port = PORT_USB_FLAG0; /* For XS3: Mission: RXA */ -in port flag1_port = PORT_USB_FLAG1; /* For XS3: Mission: RXE */ +in port flag0_port = PORT_USB_FLAG0; /* For XS3: Mission: RXE */ +in port flag1_port = PORT_USB_FLAG1; /* For XS3: Mission: RXA */ #if !defined (__XS3A__) in port flag2_port = PORT_USB_FLAG2; @@ -460,8 +460,6 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c XUD_SetCrcTableAddr(XUD_STARTUP_ADDRESS); #endif -#define TX_RISE_DELAY 5 - #if defined(ARCH_S) #define RX_RISE_DELAY 5 #define RX_FALL_DELAY 5 @@ -525,8 +523,8 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c set_port_inv(flag0_port); #endif -#if defined (XUD_SIM_RTL) || defined (XUD_SIM_XSIM) - set_pad_delay(flag1_port, 5); +#ifdef __XS3A__ + set_pad_delay(flag1_port, 3); #else set_pad_delay(flag1_port, 2); #endif @@ -537,6 +535,8 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c configure_out_port_handshake(p_usb_txd, tx_readyin, tx_readyout, tx_usb_clk, 0); configure_in_port_strobed_slave(p_usb_rxd, rx_rdy, rx_usb_clk); + configure_in_port(flag1_port, rx_usb_clk); + unsigned noExit = 1; while(noExit) From 8a9164dc8da63ca0b5ca2f2ca9bc67abee2abe23 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 14 Oct 2019 14:27:49 +0100 Subject: [PATCH 058/520] Test_bulk_rx_basic xsim test fixes --- lib_xud/src/core/XUD_DeviceAttach.xc | 2 +- lib_xud/src/core/XUD_HAL.xc | 11 +++++++++ lib_xud/src/core/XUD_Main.xc | 15 +++++++----- lib_xud/src/core/XUD_PowerSig.xc | 3 +++ tests/helpers.py | 12 ++++++---- tests/test_bulk_rx_basic.py | 35 +++++++++++---------------- tests/test_bulk_rx_basic/src/main.xc | 2 ++ tests/test_bulk_rx_basic_badpid.py | 4 ++-- tests/test_makefile.mak | 8 +++---- tests/usb_clock.py | 3 ++- tests/usb_packet.py | 36 +++++++++++++++++++++------- tests/usb_phy.py | 4 +++- tests/usb_phy_utmi.py | 29 +++++++++++++--------- 13 files changed, 104 insertions(+), 60 deletions(-) diff --git a/lib_xud/src/core/XUD_DeviceAttach.xc b/lib_xud/src/core/XUD_DeviceAttach.xc index e36eaa1e..d76cefa1 100755 --- a/lib_xud/src/core/XUD_DeviceAttach.xc +++ b/lib_xud/src/core/XUD_DeviceAttach.xc @@ -1,5 +1,5 @@ // Copyright (c) 2011-2019, XMOS Ltd, All rights reserved -#ifndef XUD_BYPASS_RESET +#if !defined(XUD_BYPASS_RESET) && !defined(XUD_SIM_XSIM) #include #include #include diff --git a/lib_xud/src/core/XUD_HAL.xc b/lib_xud/src/core/XUD_HAL.xc index 3ff534a3..5ff66d73 100644 --- a/lib_xud/src/core/XUD_HAL.xc +++ b/lib_xud/src/core/XUD_HAL.xc @@ -39,6 +39,7 @@ unsigned XtlSelFromMhz(unsigned m) void XUD_HAL_EnterMode_PeripheralFullSpeed() { +#ifndef XUD_SIM_XSIM unsigned d = 0; d = XS1_USB_PHY_CFG0_UTMI_XCVRSELECT_SET(d, 1); d = XS1_USB_PHY_CFG0_UTMI_TERMSELECT_SET(d, 1); @@ -56,10 +57,12 @@ void XUD_HAL_EnterMode_PeripheralFullSpeed() d = XS1_USB_PHY_CFG0_XTLSEL_SET(d, xtlSelVal); write_sswitch_reg(0, XS1_SSWITCH_USB_PHY_CFG0_NUM, d); +#endif } void XUD_HAL_EnterMode_PeripheralChirp() { +#ifndef XUD_SIM_XSIM unsigned d = 0; d = XS1_USB_PHY_CFG0_UTMI_XCVRSELECT_SET(d, 0); d = XS1_USB_PHY_CFG0_UTMI_TERMSELECT_SET(d, 1); @@ -76,10 +79,12 @@ void XUD_HAL_EnterMode_PeripheralChirp() unsigned xtlselVal = XtlSelFromMhz(XUD_OSC_MHZ); d = XS1_USB_PHY_CFG0_XTLSEL_SET(d, xtlselVal); write_sswitch_reg(0, XS1_SSWITCH_USB_PHY_CFG0_NUM, d); +#endif } void XUD_HAL_EnterMode_PeripheralHighSpeed() { +#ifndef XUD_SIM_XSIM unsigned d = 0; d = XS1_USB_PHY_CFG0_UTMI_XCVRSELECT_SET(d, 0); // HS d = XS1_USB_PHY_CFG0_UTMI_TERMSELECT_SET(d, 0); // HS @@ -96,6 +101,8 @@ void XUD_HAL_EnterMode_PeripheralHighSpeed() unsigned xtlselVal = XtlSelFromMhz(XUD_OSC_MHZ); d = XS1_USB_PHY_CFG0_XTLSEL_SET(d, xtlselVal); write_sswitch_reg(0, XS1_SSWITCH_USB_PHY_CFG0_NUM, d); + +#endif } /* TODO pass structure */ @@ -136,16 +143,20 @@ int XUD_HAL_GetLineState(/*XUD_HAL_t &xudHal*/) void XUD_HAL_Mode_PowerSig() { +#ifndef XUD_SIM_XSIM unsigned d = 0; d = XS1_USB_SHIM_CFG_FLAG_MODE_SET(d, 1); write_sswitch_reg(0, XS1_SSWITCH_USB_SHIM_CFG_NUM, d); +#endif } void XUD_HAL_Mode_DataTransfer() { +#ifndef XUD_SIM_XSIM unsigned d = 0; d = XS1_USB_SHIM_CFG_FLAG_MODE_SET(d, 0); write_sswitch_reg(0, XS1_SSWITCH_USB_SHIM_CFG_NUM, d); +#endif } #endif diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index c5966a99..03893ad7 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -13,6 +13,9 @@ void XUD_Error_hex(char errString[], int i_err); #define XUD_Error_hex(a, b) /* */ #endif +#undef __XS2A__ +#define __XS3A__ + #include #include #include @@ -350,6 +353,7 @@ typedef struct XUD_ep_info XUD_ep_info ep_info[USB_MAX_NUM_EP]; +#ifndef XUD_SIM_XSIM /* Sets the UIFM flags into a mode suitable for power signalling */ void XUD_UIFM_PwrSigFlags() { @@ -360,9 +364,10 @@ void XUD_UIFM_PwrSigFlags() write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_MASK_NUM, ((1< void; } } -#if !defined(XUD_SIM_XSIM) #if defined(__XS1B__) || defined(__XS2A__) /* Go into full speed mode: XcvrSelect and Term Select (and suspend) high */ write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_FUNC_CONTROL_NUM, (1< #include @@ -250,3 +252,4 @@ int XUD_Suspend(XUD_PwrConfig pwrConfig) } #endif +#endif diff --git a/tests/helpers.py b/tests/helpers.py index 1fc7f57f..58686feb 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -8,6 +8,7 @@ from usb_phy_shim import UsbPhyShim from usb_phy_utmi import UsbPhyUtmi from usb_packet import RxPacket +from usb_packet import BusReset args = None @@ -40,14 +41,17 @@ def get_usb_clk_phy(verbose=True, test_ctrl=None, do_timeout=True, dut_exit_time=dut_exit_time) elif arch=='xs3': - clk = Clock('tile[0]:XS1_PORT_1J', Clock.CLK_60MHz) - phy = UsbPhyUtmi('tile[0]:XS1_PORT_8B', - 'tile[0]:XS1_PORT_1F', #rxa - 'tile[0]:XS1_PORT_1I', #rxv + #clk = Clock('tile[0]:XS1_PORT_1J', Clock.CLK_60MHz) + clk = Clock('XS1_USB_CLK', Clock.CLK_60MHz) + phy = UsbPhyUtmi('XS1_USB_RXD', + 'XS1_USB_RXA', #rxa + 'XS1_USB_RXV', #rxv 'tile[0]:XS1_PORT_1G', #rxe 'tile[0]:XS1_PORT_8A', #txd 'tile[0]:XS1_PORT_1K', #txv 'tile[0]:XS1_PORT_1H', #txrdy + 'XS1_USB_LS0', + 'XS1_USB_LS1', clk, verbose=verbose, test_ctrl=test_ctrl, do_timeout=do_timeout, complete_fn=complete_fn, diff --git a/tests/test_bulk_rx_basic.py b/tests/test_bulk_rx_basic.py index 338a24fb..ec3c3e5f 100644 --- a/tests/test_bulk_rx_basic.py +++ b/tests/test_bulk_rx_basic.py @@ -3,6 +3,7 @@ import random import xmostest from usb_packet import * +import usb_packet from usb_clock import Clock from helpers import do_usb_test, runall_rx @@ -23,27 +24,19 @@ def do_test(arch, clk, phy, seed): packets.append(RxHandshakePacket(timeout=100)) # Note, quite big gap to allow checking. - - dataval += 10 - AppendOutToken(packets, ep, address, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=11, pid=0xb)) #DATA1 - packets.append(RxHandshakePacket()) - - dataval += 11 - AppendOutToken(packets, ep, address, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=12, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket()) - - dataval += 12 - AppendOutToken(packets, ep, address, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=13, pid=0xb)) #DATA1 - packets.append(RxHandshakePacket(timeout=9)) - - dataval += 13 - AppendOutToken(packets, ep, address, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=14, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket()) - + + pid = PID_DATA1; #DATA1 + + for pktlength in range(10, 19): + + AppendOutToken(packets, ep, address, inter_pkt_gap=6000) + packets.append(TxDataPacket(rand, data_start_val=dataval, length=pktlength, pid=pid)) + packets.append(RxHandshakePacket()) + + if(pid == usb_packet.PID_DATA1): + pid = usb_packet.PID_DATA0; + else: + pid = usb_packet.PID_DATA1; do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) diff --git a/tests/test_bulk_rx_basic/src/main.xc b/tests/test_bulk_rx_basic/src/main.xc index adcd63ee..eccf7e63 100644 --- a/tests/test_bulk_rx_basic/src/main.xc +++ b/tests/test_bulk_rx_basic/src/main.xc @@ -40,6 +40,8 @@ int main() unsigned speed = XUD_SPEED_FS; #elif defined(XUD_TEST_SPEED_HS) unsigned speed = XUD_SPEED_HS; + #else + #error XUD_TEST_SPEED_XX not defined #endif XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, diff --git a/tests/test_bulk_rx_basic_badpid.py b/tests/test_bulk_rx_basic_badpid.py index f300d72e..79b47230 100644 --- a/tests/test_bulk_rx_basic_badpid.py +++ b/tests/test_bulk_rx_basic_badpid.py @@ -47,12 +47,12 @@ def do_test(arch, clk, phy, seed): dataval += 12 AppendOutToken(packets, ep, address, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, length=13, pid=0xb)) #DATA1 - packets.append(RxHandshakePacket(timeout=9)) + packets.append(RxHandshakePacket(timeout=10)) dataval += 13 AppendOutToken(packets, ep, address, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, length=14, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket()) + packets.append(RxHandshakePacket(timeout=10)) do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) diff --git a/tests/test_makefile.mak b/tests/test_makefile.mak index a95d0141..e5f8b489 100644 --- a/tests/test_makefile.mak +++ b/tests/test_makefile.mak @@ -2,7 +2,7 @@ # compiled for. It either refers to an XN file in the source directories # or a valid argument for the --target option when compiling. -TARGET = test.xn +#TARGET = test.xn # The APP_NAME variable determines the name of the final .xe file. It should # not include the .xe postfix. If left blank the name will default to @@ -20,11 +20,11 @@ APP_NAME = SHARED_CODE = ../../shared_src -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -Wno-timing +COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -Wno-timing -DXUD_SIM_XSIM=1 -DXUD_TEST_SPEED_HS=1 -DXUD_BYPASS_RESET=1 -XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -DARCH_L +#XCC_FLAGS_xs1 = $(COMMON_FLAGS) -DARCH_S -DXUD_SERIES_SUPPORT=XUD_U_SERIES -DARCH_L -XCC_FLAGS_xs1 = $(COMMON_FLAGS) -DARCH_S -DXUD_SERIES_SUPPORT=XUD_U_SERIES -DARCH_L +#XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -DARCH_L XCC_FLAGS_xs3 = $(COMMON_FLAGS) -DXUD_STARTUP_ADDRESS=1 diff --git a/tests/usb_clock.py b/tests/usb_clock.py index 89d7740e..7df64602 100644 --- a/tests/usb_clock.py +++ b/tests/usb_clock.py @@ -33,7 +33,8 @@ def run(self): if self._running: #print "{}".format(self._val) - self.xsi.drive_port_pins(self._port, self._val) + #self.xsi.drive_port_pins(self._port, self._val) + self.xsi.drive_periph_pin(self._port, self._val) def is_high(self): return (self._val == 1) diff --git a/tests/usb_packet.py b/tests/usb_packet.py index 89fc5b46..76670f50 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -3,6 +3,12 @@ import zlib import random +# In USB clocks +RX_TX_DELAY = 12 + +PID_DATA1 = 0xb +PID_DATA0 = 0x3 + def AppendSetupToken(packets, ep, address, **kwargs): ipg = kwargs.pop('inter_pkt_gap', 500) address = kwargs.pop('address', 0) @@ -134,6 +140,13 @@ def create_data_expect_same(args): value,num_data_bytes = args return "Value = {0}\n".format(value) +class BusReset(object): + + def __init__(self, **kwargs): + self.duration_ms = kwargs.pop('duraton', 10) #Duration of reset + self.bus_speed = kwargs.pop('bus_speed', 'high') #Bus speed to reset into + + # Lowest base class for all packets. All USB packets have: # - a PID # - some (or none) data bytes @@ -195,13 +208,14 @@ def get_inter_pkt_gap(self): # Implemented such that we can generate broken or bad packets def get_bytes(self, do_tokens=False): + print "GET BYTES\n" bytes = [] - if do_tokens: - bytes.append(self.pid) - else: - bytes.append(self.pid | ((~self.pid) << 4)) - for x in range(len(self.data_bytes)): - bytes.append(self.data_bytes[x]) + #if do_tokens: + # bytes.append(self.pid) + #else: + # bytes.append(self.pid | ((~self.pid) << 4)) + # for x in range(len(self.data_bytes)): + # bytes.append(self.data_bytes[x]) return bytes @@ -229,9 +243,13 @@ def get_crc(self, packet_bytes): return crc def get_bytes(self, do_tokens=False): + bytes = [] - bytes.append(self.pid) + if do_tokens: + bytes.append(self.pid) + else: + bytes.append(self.pid | ((~self.pid) << 4)) packet_bytes = self.get_packet_bytes() for byte in packet_bytes: @@ -242,7 +260,7 @@ def get_bytes(self, do_tokens=False): else: crc = self.get_crc(packet_bytes) - # Append the 2 bytes of CRC onto the packet + #Append the 2 bytes of CRC onto the packet for i in range(0, 2): bytes.append((crc >> (8*i)) & 0xff) @@ -318,7 +336,7 @@ class RxHandshakePacket(HandshakePacket, RxPacket): def __init__(self, **kwargs): super(RxHandshakePacket, self).__init__(**kwargs) self.pid = kwargs.pop('pid', 0xd2) #Default to ACK (not expect inverted bits on Rx) - self.timeout = kwargs.pop('timeout', 9) + self.timeout = kwargs.pop('timeout', RX_TX_DELAY) class TxHandshakePacket(HandshakePacket, TxPacket): diff --git a/tests/usb_phy.py b/tests/usb_phy.py index 8284db16..1c45faab 100644 --- a/tests/usb_phy.py +++ b/tests/usb_phy.py @@ -10,7 +10,7 @@ class UsbPhy(xmostest.SimThread): # Time in ns from the last packet being sent until the end of test is signalled to the DUT END_OF_TEST_TIME = 5000 - def __init__(self, name, rxd, rxa, rxdv, rxer, txd, txv, txrdy, clock, initial_delay, verbose, + def __init__(self, name, rxd, rxa, rxdv, rxer, txd, txv, txrdy, ls0, ls1, clock, initial_delay, verbose, test_ctrl, do_timeout, complete_fn, expect_loopback, dut_exit_time): self._name = name self._test_ctrl = test_ctrl @@ -21,6 +21,8 @@ def __init__(self, name, rxd, rxa, rxdv, rxer, txd, txv, txrdy, clock, initial_d self._txd = txd self._txv = txv self._txrdy = txrdy + self.ls0 = ls0 + self.ls1 = ls1 self._packets = [] self._clock = clock self._initial_delay = initial_delay diff --git a/tests/usb_phy_utmi.py b/tests/usb_phy_utmi.py index c50160cd..77706b1f 100644 --- a/tests/usb_phy_utmi.py +++ b/tests/usb_phy_utmi.py @@ -7,15 +7,14 @@ class UsbPhyUtmi(UsbPhy): - def __init__(self, rxd, rxa, rxdv, rxer, txd, txv, txrdy, clock, + def __init__(self, rxd, rxa, rxdv, rxer, txd, txv, txrdy, ls0, ls1, clock, initial_delay=60000, verbose=False, test_ctrl=None, do_timeout=True, complete_fn=None, expect_loopback=True, dut_exit_time=25000): - super(UsbPhyUtmi, self).__init__('mii', rxd, rxa, rxdv, rxer, txd, txv, txrdy, clock, + super(UsbPhyUtmi, self).__init__('mii', rxd, rxa, rxdv, rxer, txd, txv, txrdy, ls0, ls1, clock, initial_delay, verbose, test_ctrl, do_timeout, complete_fn, expect_loopback, dut_exit_time) - def run(self): xsi = self.xsi @@ -23,6 +22,11 @@ def run(self): for i,packet in enumerate(self._packets): + #if isinstance(packet, BusReset): + + # print "BUS RESET" + + if isinstance(packet, RxPacket): timeout = packet.get_timeout() @@ -101,7 +105,8 @@ def run(self): sys.stdout.write(packet.dump()) # Set RXA high - xsi.drive_port_pins(self._rxa, 1) + #xsi.drive_port_pins(self._rxa, 1) + xsi.drive_periph_pin(self._rxa, 1) # Wait for RXA rise delay TODO, this should be configurable self.wait(lambda x: self._clock.is_high()) @@ -117,16 +122,17 @@ def run(self): self.wait(lambda x: self._clock.is_high()) self.wait(lambda x: self._clock.is_low()) - xsi.drive_port_pins(self._rxdv, 1) - xsi.drive_port_pins(self._rxd, byte) + xsi.drive_periph_pin(self._rxdv, 1) + xsi.drive_periph_pin(self._rxd, byte) if (packet.rxe_assert_time != 0) and (packet.rxe_assert_time == i): - xsi.drive_port_pins(self._rxer, 1) + #xsi.drive_port_pins(self._rxer, 1) + xsi.drive_periph_pin(self._rxer, 1) while rxv_count != 0: self.wait(lambda x: self._clock.is_high()) self.wait(lambda x: self._clock.is_low()) - xsi.drive_port_pins(self._rxdv, 0) + xsi.drive_periph_pin(self._rxdv, 0) rxv_count = rxv_count - 1 # xCore should not be trying to send if we are trying to send.. @@ -141,8 +147,8 @@ def run(self): self.wait(lambda x: self._clock.is_high()) self.wait(lambda x: self._clock.is_low()) - xsi.drive_port_pins(self._rxdv, 0) - xsi.drive_port_pins(self._rxer, 0) + xsi.drive_periph_pin(self._rxdv, 0) + xsi.drive_periph_pin(self._rxer, 0) rxa_end_delay = packet.rxa_end_delay while rxa_end_delay != 0: @@ -155,7 +161,8 @@ def run(self): if xsi.sample_port_pins(self._txv) == 1: print "ERROR: Unexpected packet from xCORE" - xsi.drive_port_pins(self._rxa, 0) + #xsi.drive_port_pins(self._rxa, 0) + xsi.drive_periph_pin(self._rxa, 0) #if self._verbose: #print "Sent" From ec80024e5e4102b89d9779ffa96a0617d55c3ea2 Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 18 Oct 2019 11:08:37 +0100 Subject: [PATCH 059/520] Initial fixes for XS3 xsim tests --- lib_xud/module_build_info | 2 +- lib_xud/src/core/XUD_CRC5_Table.S | 4 +- lib_xud/src/core/XUD_IoLoop.S | 36 +-- lib_xud/src/core/XUD_TokenJmp.S | 9 +- lib_xud/src/core/included/XUD_Token_In_DI.S | 333 ++++++++++++++++++++ lib_xud/src/core/included/XUD_Token_Out.S | 2 +- lib_xud/src/core/included/XUD_Token_Setup.S | 80 +++++ tests/shared_src/shared.h | 35 +- tests/test_bulk_rx_basic.py | 14 +- tests/test_bulk_rx_basic/src/main.xc | 3 +- tests/test_bulk_tx_basic.py | 42 ++- tests/usb_packet.py | 13 +- tests/usb_phy_utmi.py | 11 +- 13 files changed, 491 insertions(+), 93 deletions(-) create mode 100755 lib_xud/src/core/included/XUD_Token_In_DI.S diff --git a/lib_xud/module_build_info b/lib_xud/module_build_info index 5de29d22..d5342549 100644 --- a/lib_xud/module_build_info +++ b/lib_xud/module_build_info @@ -13,7 +13,7 @@ MODULE_XCC_FLAGS = $(XCC_FLAGS) -O3 -DREF_CLK_FREQ=100 -fasm-linenum -fcomment-a XCC_FLAGS_XUD_IoLoop.S = $(MODULE_XCC_FLAGS) -fschedule -g0 -EXCLUDE_FILES += XUD_Token_In.S XUD_Token_Ping.S XUD_Token_SOF.S XUD_Token_Out.S XUD_Token_Setup.S XUD_G_Crc.S XUD_TokenJmp.S XUD_PidJumpTable.S +EXCLUDE_FILES += XUD_Token_In.S XUD_Token_Ping.S XUD_Token_SOF.S XUD_Token_Out.S XUD_Token_Setup.S XUD_G_Crc.S XUD_TokenJmp.S XUD_PidJumpTable.S XUD_Token_In_DI.S OPTIONAL_HEADERS += xud_conf.h diff --git a/lib_xud/src/core/XUD_CRC5_Table.S b/lib_xud/src/core/XUD_CRC5_Table.S index bbe0f141..758efec7 100755 --- a/lib_xud/src/core/XUD_CRC5_Table.S +++ b/lib_xud/src/core/XUD_CRC5_Table.S @@ -1,8 +1,7 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved /** XUD_CRC5_Table.S * @brief Full USB CRC5 table * @author Ross Owen, XMOS Limited - * @version 0v9 */ .section .dp.data, "adw", @progbits @@ -10,6 +9,7 @@ .type crc5Table, @object .cc_top crc5Table.func, crc5Table .align 4 +.skip 0 crc5Table: .byte 0x2 .byte 0x1d diff --git a/lib_xud/src/core/XUD_IoLoop.S b/lib_xud/src/core/XUD_IoLoop.S index 8d48ee89..35c8996b 100755 --- a/lib_xud/src/core/XUD_IoLoop.S +++ b/lib_xud/src/core/XUD_IoLoop.S @@ -182,18 +182,26 @@ ResetIntHandler: .cc_top XUD_LLD_IoLoop.func, XUD_LLD_IoLoop .text +#if defined(__XS2A__) +.issue_mode single +#include "./included/XUD_Token_In.S" +#elif defined(__XS3A__) +.issue_mode dual +#include "./included/XUD_Token_In_DI.S" +#endif + // Note, included here so in same elimination blocks to avoid long jumps #include "./included/XUD_Token_Out.S" #include "./included/XUD_Token_Ping.S" -#include "./included/XUD_Token_In.S" #include "./included/XUD_Token_Setup.S" #include "./included/XUD_Token_SOF.S" .align 4 XUD_LLD_IoLoop: -#if defined(__XS2A__) || defined(__XS3A__) -.issue_mode single +#if defined(__XS2A__) ENTSP_lu6 STACK_EXTEND +#elif defined(__XS3A__) + DUALENTSP_lu6 STACK_EXTEND #else entsp STACK_EXTEND #endif @@ -341,7 +349,7 @@ SetupSuspendResetTimer: bu NextToken // Main IO Loop -.align 4 +.align 8 .skip 0 NextToken: ldc r9, 0xa001 // CRC16 poly, used in doRxData @@ -383,24 +391,14 @@ BranchOnTokenPid: #else // XS3A - ldc r4, 16 - -ReadToken: - inpw r11, res[RXD], 8 // Read 3 byte token from data port | CRC[5] | EP[4] | ADDR[7] | PID[8] | junk - ldaw r10, dp[PidJumpTable] - setpsc res[RXD], r4 - shr r11, r11, 24 + #include "XUD_TokenJmp.S" -JumpOnPid: - ldw r11, r10[r11] -.xtabranch Pid_Out, Pid_Sof, Pid_In, Pid_Setup - bau r11 BadCrcAddr: - // zext r11, 8 - // ldc r10, PIDn_SOF - // eq r11, r11, r10 - //ecallt r11 + // zext r11, 8 + // ldc r10, PIDn_SOF + // eq r11, r11, r10 + //ecallt r11 //bt r11, Pid_Sof_NoChan // TODO we should really CRC SOFs ldw r11, sp[10] diff --git a/lib_xud/src/core/XUD_TokenJmp.S b/lib_xud/src/core/XUD_TokenJmp.S index 4067cf90..5538f253 100644 --- a/lib_xud/src/core/XUD_TokenJmp.S +++ b/lib_xud/src/core/XUD_TokenJmp.S @@ -1,6 +1,6 @@ // Copyright (c) 2013-2018, XMOS Ltd, All rights reserved -#ifdef ARCH_L +#ifndef __XS3A__ ldaw r10, dp[PidJumpTable] // TODO Could load from sp here // We receive: | 0000 4-bit EP | 0000 4-bit PID | inpw r11, res[RXD], 8 // Read 8 bit PID @@ -10,15 +10,12 @@ .xtabranch Pid_Out, Pid_Sof, Pid_In, Pid_Setup, Pid_Sof_NoChan bau r10 -#else // ARCH_G - //ldaw r8, dp[crc5Table_Addr] +#else //__XS3A__ ldaw r10, dp[PidJumpTable] - //ldw r6, dp[crcmask] ldc r8, 16 inpw r11, res[RXD], 8 // Read 3 byte token from data port | CRC[5] | EP[4] | ADDR[7] | PID[8] | junk - setpsc res[RXD], r8 - shr r11, r11, 24 + {setpsc res[RXD], r8; shr r11, r11, 24} ldw r11, r10[r11] .xtabranch Pid_Out, Pid_Sof, Pid_In, Pid_Setup diff --git a/lib_xud/src/core/included/XUD_Token_In_DI.S b/lib_xud/src/core/included/XUD_Token_In_DI.S new file mode 100755 index 00000000..28f3777e --- /dev/null +++ b/lib_xud/src/core/included/XUD_Token_In_DI.S @@ -0,0 +1,333 @@ +// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +#include + +// Ports +#define RXD r0 +#define RXA r1 +#define TXD r2 + +//.text +// On entry: +// R11: Branch address (now free) +// R10: EP number (used here) +// R9 : CRC16 Poly (used here) +// R8 : +// R7 : +// R6 : ep_pid_sequence_table_IN_A +// R5 : Channel Array +// R4 : +// R3 : 0 +// R2 : TXD +// R1 : Valid Token Port +// R0 : RXD +.align 4 +InNotReady: + ldw r11, sp[SP_EPTYPES_OUT] + ldw r11, r11[r10] // Load EP Type + bt r11, XUD_IN_TxNak + ldc r11, 0xc3 // Create 0-length packet + outpw res[TXD], r11, 24 + #include "XUD_TokenJmp.S" + +XUD_IN_TxNak: // Non-Iso + ldaw r11, dp[handshakeTable_IN] // Load handshake table + ldw r11, r11[r10] // Load handshake PID + outpw res[TXD], r11, 8 + #include "XUD_TokenJmp.S" + + + +.align 256 +.skip 156 +Pid_In: + #include "XUD_G_Crc.S" + ldaw r3, r10[4] // R3 = R10 + 16 + ldw r4, r5[r3] // Load EP structure address + bf r4, InNotReady // If 0 then not ready... + +In_LoadPid: + ldw r11, r4[4] // Load PID from structure + +InReady: + ldw r8, r4[3] // Load buffer + + ldw r6, r4[7] // Load tail length (bytes) + + ldw r4, r4[6] // Load buffer index + bf r4, SmallTxPacket // Check for Short packet + +.xtabranch TxTail0, TxTail1, TxTail2, TxTail3 + bru r6 // Branch on tail length + +//-------------------------------------------------------------------------- +.align 128 +.skip 0 +TxTail0: + ldw r6, r8[r4] // Load first data word + add r4, r4, 1 // Buffer index increment +XUD_IN_TxPid_Tail0: + outpw res[TXD], r11, 8 // Output PID to port + out res[TXD], r6 // Output first data word + crc32 r7, r6, r9 // Run CRC + bf r4, TxLoop0End +TxLoop0: + ldw r6, r8[r4] // Load last data word + add r4, r4, 1 +TxLoop0_Out: + out res[TXD], r6 // Output last data word + crc32 r7, r6, r9 + bt r4, TxLoop0 +TxLoop0End: // Word aligned data (just output CRC) + crc32 r7, r4, r9 // R4: 0 (from bt) + not r7, r7 + +XUD_IN_TxCrc_Tail0: + outpw res[TXD], r7, 16 // Output CRC + bu DoneTail + +.align 128 +.skip 0 +TxTail1: + ldw r6, r8[r4] // Load first data word + add r4, r4, 1 // Buffer index increment +XUD_IN_TxPid_Tail1: + outpw res[TXD], r11, 8 // Out PID + out res[TXD], r6 + crc32 r7, r6, r9 + bf r4, TxLoop1End +TxLoop1: + ldw r6, r8[r4] // Load last data word + add r4, r4, 1 + out res[TXD], r6 + crc32 r7, r6, r9 + bt r4, TxLoop1 +TxLoop1End: + ldw r6, r8[r4] // Load last data word + outpw res[TXD], r6, 8 + crc8 r7, r6, r6, r9 + crc32 r7, r4, r9 // r4: 0 (from bf) + not r7, r7 + +XUD_IN_TxCrc_Tail1: + outpw res[TXD], r7, 16 + bu DoneTail + +.scheduling off +.align 128 +.skip 0 +TxTail2: + ldw r6, r8[r4] // Load first data word + crc32 r7, r6, r9 +XUD_IN_TxPid_Tail2: + outpw res[TXD], r11, 8 // Out PID + out res[TXD], r6 + add r4, r4, 1 + bf r4, TxLoop2End +TxLoop2: + ldw r6, r8[r4] // Load first data word + add r4, r4, 1 + crc32 r7, r6, r9 + out res[TXD], r6 + bt r4, TxLoop2 + +TxLoop2End: + ldw r6, r8[r4] // Load tail + crc8 r7, r11, r6, r9 + outpw res[TXD], r6, 16 + crc8 r7, r11, r11, r9 + crc32 r7, r4, r9 // r4: 0 (from bf) + not r7, r7 + +XUD_IN_TxCrc_Tail2: + outpw res[TXD], r7, 16 + bu DoneTail + +.align 128 +.skip 0 +TxTail3: + ldw r6, r8[r4] // Load first data word + add r4, r4, 1 +XUD_IN_TxPid_Tail3: + outpw res[TXD], r11, 8 // Out PID + out res[TXD], r6 + crc32 r7, r6, r9 + bf r4, TxLoop3End +TxLoop3: + ldw r6, r8[r4] // Load first data word + add r4, r4, 1 + crc32 r7, r6, r9 + out res[TXD], r6 + bt r4, TxLoop3 +TxLoop3End: + ldw r6, r8[r4] // Load tail + crc8 r7, r11, r6, r9 + outpw res[TXD], r6, 24 + crc8 r7, r11, r11, r9 + crc8 r7, r11, r11, r9 + crc32 r7, r4, r9 // r4: 0 (from bf) + not r7, r7 +XUD_IN_TxCrc_Tail3: + outpw res[TXD], r7, 16 + +.scheduling default +// Wait for handshake... or timeout +DoneTail: + ldw r11, sp[SP_EPTYPES_OUT] + ldw r11, r11[r10] // Load EP Type + bt r11, SetupReceiveHandShake + +InISO: + ldc r9, 0 //TODO + bu DoneTx + +InNonISO: +SetupReceiveHandShake: + ldc r11, 8 + setpsc res[RXD], r11 // Set port shift count (expect 8 bit handshake) + //ldap r11, TxHandShakeReceived + //setv res[RXD], r11 + eeu res[RXD] // Events on RXD always enabled - Can;t be any more due to using events on channels + +SetupTimeout: // Timeout done using another port off same clock block we dont happen to already be using events on. Cunning. + ldw r1, sp[STACK_FLAG0_PORT] // Load saved ValidToken port. Event vector already set. + in r11, res[r1] // Do input and get port time/timestamps + getts r11, res[r1] + ldw r9, dp[g_txHandshakeTimeout] + add r11, r11, r9 + setpt res[r1], r11 // Set port time and enable events + eeu res[r1] + +WaitForHandshake: // Wait for timeout or handshake + .xtabranch TxHandshakeTimeOut, TxHandShakeReceived + waiteu + + +// We sent some data but the host didn't handshake in time. Needs a re-send. +.align 4 +TxHandshakeTimeOut: + in r11, res[r1] // This will clear port time + edu res[r1] + edu res[RXD] + bu BadHandShake + +// Transmitted data, and got something back within the timeout. Check for valid handshake... +.align 4 +TxHandShakeReceived: +XUD_IN_RxAck: + in r11, res[RXD] // Input data from RXD port + clrpt res[r1] // Clear port time on valid token port + edu res[RXD] + shr r11, r11, 24 // Shift off junk data to leave ACK +#if defined(__XS2A__) || defined(__XS1B__) + ldc r9, USB_PID_ACK // Check for good ACK (L series strips of negated bits from PID) +#else + ldc r9, USB_PIDn_ACK +#endif + xor r9, r11, r9 + edu res[r1] // Disable events on ValidToken port + bt r9, BadHandShake // Invalid handshake received from host. we need to resend... + +DoneTx: + //ldap r11, NextRxWord // Restore RXD event vector + //setv res[RXD], r11 + +ClearInEpReady: // TODO Tidy this up + //ldw r4, sp[(STACK_EXTEND+8)] / Load num out EPs + //add r11, r4, r10 // IN channel offset (R10: EP number) + + ldw r10, r5[r3] // Load the EP struct + stw r9, r5[r3] // Clear the ready + ldw r11, r10[1] // Load channel + out res[r11], r11 // Output word to signal packet sent okay + + bu NextToken + +BadHandShake: // Received a bad (or no)handshake + //ldap r11, NextRxWord // Restore RXD event vector + //setv res[RXD], r11 + bu NextToken + +.align 64 +.skip 56 +SmallTxPacket: + ldw r8, r8[r4] // Load first data word + +.xtabranch TxTail0s, TxTail1s, TxTail2s, TxTail3s + bru r6 // branch taillength + +//-------------------------------------------------------------------------- +.align 128 +.skip 0 +TxTail0s: // We know this is a < 4 byte packet, so is 0 length packet + // So crc = 0. Note our normal crc calculation works for this, it is + //not a special CRC case, but helps with timing. + ldc r8, 0 +XUD_IN_TxPid_TailS0: + outpw res[TXD], r11, 8 // PID + //crc32 r7, r11, r9 // r11: 0 + //not r7, r7 + +XUD_IN_TxCrc_TailS0: + outpw res[TXD], r8, 16 // r5: 0 + bu DoneTail + +.align 128 +.skip 0 +TxTail1s: + ldc r6, 0 + // One tail byte + shl r8, r8, 8 // Concat PID and Data + or r11, r11, r8 + shr r8, r8, 8 + crc8 r7, r4, r8, r9 + crc32 r7, r6, r9 // r5: 0 + not r7, r7 + +XUD_IN_TxPid_TailS1: + outpw res[TXD], r11, 16 // PID + ///outpw res[TXD], r6, 16 +XUD_IN_TxCrc_TailS1: + outpw res[TXD], r7, 16 + bu DoneTail + +.align 128 +.skip 0 +TxTail2s: + ldc r6, 0 + + // Two tail byte + shl r8, r8, 8 + or r11, r11, r8 // r11: D1 | D0 | PID + shr r8, r8, 8 + +XUD_IN_TxPid_TailS2: + outpw res[TXD], r11, 24 + + crc8 r7, r8, r8, r9 + crc8 r7, r8, r8, r9 + crc32 r7, r6, r9 // r6: 0 + not r7, r7 + +XUD_IN_TxCrc_TailS2: + outpw res[TXD], r7, 16 + bu DoneTail + +.align 128 +.skip 0 +TxTail3s: + ldc r6, 0 + // Two tail byte +XUD_IN_TxPid_TailS3: + outpw res[TXD], r11, 8 // PID + outpw res[TXD], r8, 24 + crc8 r7, r8, r8, r9 + crc8 r7, r8, r8, r9 + crc8 r7, r8, r8, r9 + + crc32 r7, r6, r9 // r5: 0 + not r7, r7 + +XUD_IN_TxCrc_TailS3: + outpw res[TXD], r7, 16 + bu DoneTail + diff --git a/lib_xud/src/core/included/XUD_Token_Out.S b/lib_xud/src/core/included/XUD_Token_Out.S index 6324c442..4de45be0 100755 --- a/lib_xud/src/core/included/XUD_Token_Out.S +++ b/lib_xud/src/core/included/XUD_Token_Out.S @@ -5,7 +5,7 @@ #define RXD r0 #define TXD r2 -.align 4 +.align 8 .skip 0 Pid_Out: #ifdef ARCH_L diff --git a/lib_xud/src/core/included/XUD_Token_Setup.S b/lib_xud/src/core/included/XUD_Token_Setup.S index 106a63dc..b7c694e9 100644 --- a/lib_xud/src/core/included/XUD_Token_Setup.S +++ b/lib_xud/src/core/included/XUD_Token_Setup.S @@ -21,6 +21,84 @@ WaitForEndDataPacket: // r9: crc poly // r10: ep number // r11: scratch +#if defined(__XS2A__) || defined(__XS3A__) +.align 4 +.skip 0 +doRXData: + ldw r7, sp[10] // Load RxA Port ID (r1) + inpw r8, res[r0], 8 // Input PID +GotRxPid: + stw r8, r3[6] // Store (NON-SHIFTED) PID into EP structure + eeu res[r7] +.syntax architectural + SETSR_lu6 1 // Enable thread events. Note long inst to align loop +.syntax default + +NextRxWord: // RXD port has event vector here + in r11, res[r0] + stw r11, r1[r4] + crc32_inc r6, r11, r9, r4, 1 + bu NextRxWord + +///////////////////////////////////////////////////////////////////////////// +.align 32 +.skip 16 +RxALow: + in r7, res[r7] // Clear event data on RXA + endin r8, res[r0] +XUD_OUT_RxTail: + in r11, res[r0] + +.xtabranch OutTail0, OutTail1, OutTail2, OutTail3, OutTail4, OutTail5 + bru r8 + +// Word aligned data (0 byte tail) +.align 32 +OutTail0: + crc32 r6, r8, r9 // CRC zero step + ldc r11, 0x7000 // Load relevant CRC magic number + retsp 0 + +// 1 Tail Byte +.align 32 +OutTail1: + shr r11, r11, 24 // Shift off junk + crc32 r6, r11, r9 + stw r11, r1[r4] // Store last data + ldc r11, 0x80be // Load CRC magic number + retsp 0 + +// Two Tail Bytes +.align 32 +OutTail2: + shr r11, r11, 16 + crc32 r6, r11, r9 + stw r11, r1[r4] // Store last data + ldc r11, 0x3ffe + retsp 0 + +// Three Tail Bytes +.align 32 +OutTail3: + shr r11, r11, 8 + stw r11, r1[r4] // Store last data + crc32 r6, r11, r9 + ldw r11, sp[12] + crc8 r6, r1, r2, r9 // Use the fact the the bottom byte of port id is 0.. saves us an ldc + retsp 0 + +// Four Tail Bytes +.align 32 +OutTail4: + bu ERR_EndIn4 + + +// Five Tail Bytes +.align 32 +OutTail5: + bu ERR_EndIn5 + +#else .align 4 .skip 0 doRXData: @@ -100,6 +178,8 @@ OutTail4: .align 16 OutTail5: bu ERR_EndIn5 +#endif + // We received a setup token. This is much the same as out token, apart from: diff --git a/tests/shared_src/shared.h b/tests/shared_src/shared.h index acc225ff..a03b6a5a 100644 --- a/tests/shared_src/shared.h +++ b/tests/shared_src/shared.h @@ -12,6 +12,16 @@ unsafe void exit(int); +#ifdef XUD_SIM_XSIM +void TerminateFail(unsigned x) +{ + printstr("FAIL\n"); +} +void TerminatePass(unsigned x) +{ +} +#endif + #ifndef PKT_LEN_START #define PKT_LEN_START 10 #endif @@ -48,23 +58,6 @@ XUD_Result_t SendTxPacket(XUD_ep ep, int length, int epNum) return XUD_SetBuffer(ep, buffer, length); } -#if 0 -// NEW API - WIP -#pragma unsafe arrays -XUD_Result_t SendControlPacket(XUD_ep ep, int length, int epNum) -{ - unsigned char buffer[1024]; - - for (int i = 0; i < length; i++) - { - buffer[i] = g_txDataCheck[epNum]++; - } - - return XUD_SetControlBuffer(ep, buffer, length); -} -#endif - - #pragma unsafe arrays int TestEp_Tx(chanend c_in, int epNum1, unsigned start, unsigned end, t_runMode runMode) { @@ -147,15 +140,15 @@ int RxDataCheck(unsigned char b[], int l, int epNum) if(b[i] != g_rxDataCheck[epNum]) { -//#ifndef XUD_TEST_RTL -#if 0 +#ifdef XUD_SIM_XSIM printstr("#### Mismatch on EP: "); printint(epNum); printstr(". Got:"); printhex(b[i]); printstr(" Expected:"); - printhexln(g_rxDataCheck[epNum]); - //printintln(l); // Packet length + printhex(g_rxDataCheck[epNum]); + printstr(" Pkt len: "); + printintln(l); // Packet length #endif return 1; } diff --git a/tests/test_bulk_rx_basic.py b/tests/test_bulk_rx_basic.py index ec3c3e5f..4e4c8d90 100644 --- a/tests/test_bulk_rx_basic.py +++ b/tests/test_bulk_rx_basic.py @@ -19,17 +19,11 @@ def do_test(arch, clk, phy, seed): dataval = 0; - AppendOutToken(packets, ep, address) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=10, pid=0x3, inter_pkt_gap = 400)) #DATA0 - packets.append(RxHandshakePacket(timeout=100)) + pid = PID_DATA0; - # Note, quite big gap to allow checking. - - pid = PID_DATA1; #DATA1 - - for pktlength in range(10, 19): + for pktlength in range(10, 20): - AppendOutToken(packets, ep, address, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, inter_pkt_gap=500) packets.append(TxDataPacket(rand, data_start_val=dataval, length=pktlength, pid=pid)) packets.append(RxHandshakePacket()) @@ -38,6 +32,8 @@ def do_test(arch, clk, phy, seed): else: pid = usb_packet.PID_DATA1; + dataval += pktlength + do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): diff --git a/tests/test_bulk_rx_basic/src/main.xc b/tests/test_bulk_rx_basic/src/main.xc index eccf7e63..cc82ad96 100644 --- a/tests/test_bulk_rx_basic/src/main.xc +++ b/tests/test_bulk_rx_basic/src/main.xc @@ -52,12 +52,11 @@ int main() { unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); -#ifdef XUD_SIM_RTL if(fail) TerminateFail(fail); else TerminatePass(fail); -#endif + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); XUD_Kill(ep0); exit(0); diff --git a/tests/test_bulk_tx_basic.py b/tests/test_bulk_tx_basic.py index 298debe7..f1edcb95 100644 --- a/tests/test_bulk_tx_basic.py +++ b/tests/test_bulk_tx_basic.py @@ -2,6 +2,7 @@ import random import xmostest from usb_packet import * +import usb_packet from usb_clock import Clock from helpers import do_usb_test, runall_rx @@ -10,7 +11,7 @@ def do_test(arch, tx_clk, tx_phy, seed): rand = random.Random() rand.seed(seed) - ep = 2 + ep = 1 address = 1 # The inter-frame gap is to give the DUT time to print its output @@ -18,29 +19,22 @@ def do_test(arch, tx_clk, tx_phy, seed): dataval = 0; - AppendInToken(packets, ep, address) - packets.append(RxDataPacket(rand, data_start_val=dataval, length=10, pid=0x3)) #DATA0 - packets.append(TxHandshakePacket()) - - dataval += 10 - AppendInToken(packets, ep, address, inter_pkt_gap=4000) - packets.append(RxDataPacket(rand, data_start_val=dataval, length=11, pid=0xb)) #DATA1 - packets.append(TxHandshakePacket()) - - dataval += 11 - AppendInToken(packets, ep, address, inter_pkt_gap=4000) - packets.append(RxDataPacket(rand, data_start_val=dataval, length=12, pid=0x3)) #DATA0 - packets.append(TxHandshakePacket()) - - dataval += 12 - AppendInToken(packets, ep, address, inter_pkt_gap=4000) - packets.append(RxDataPacket(rand, data_start_val=dataval, length=13, pid=0xb)) #DATA1 - packets.append(TxHandshakePacket()) - - dataval += 13 - AppendInToken(packets, ep, address, inter_pkt_gap=4000) - packets.append(RxDataPacket(rand, data_start_val=dataval, length=14, pid=0x3)) #DATA0 - packets.append(TxHandshakePacket()) + pid = PID_DATA0; + + for pktlength in range(10, 20): + + AppendInToken(packets, ep, address, inter_pkt_gap=4000) + + packets.append(RxDataPacket(rand, data_start_val=dataval, length=pktlength, pid=pid)) #DATA1 + packets.append(TxHandshakePacket()) + + + if(pid == usb_packet.PID_DATA1): + pid = usb_packet.PID_DATA0; + else: + pid = usb_packet.PID_DATA1; + + dataval += pktlength # Note, quite big gap to allow checking. do_usb_test(arch, tx_clk, tx_phy, packets, __file__, seed, diff --git a/tests/usb_packet.py b/tests/usb_packet.py index 76670f50..6b4669fe 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -4,7 +4,9 @@ import random # In USB clocks -RX_TX_DELAY = 12 +RX_TX_DELAY = 20 +RXA_END_DELAY = 2 # Pad delay not currently simulated in xsim for USB or OTP, so add this delay here +RXA_START_DELAY = 5 #Taken from RTL sim PID_DATA1 = 0xb PID_DATA0 = 0x3 @@ -186,7 +188,7 @@ def get_pid_pretty(self): class RxPacket(UsbPacket): def __init__(self, **kwargs): - self.timeout = kwargs.pop('timeout', 8) + self.timeout = kwargs.pop('timeout', 25) super(RxPacket, self).__init__(**kwargs) def get_timeout(self): @@ -198,7 +200,7 @@ class TxPacket(UsbPacket): def __init__(self, **kwargs): self.inter_pkt_gap = kwargs.pop('inter_pkt_gap', 13) #13 lowest working for single issue loopback self.rxa_start_delay = kwargs.pop('rxa_start_delay', 2) - self.rxa_end_delay = kwargs.pop('rxa_end_delay', 2) + self.rxa_end_delay = kwargs.pop('rxa_end_delay', RXA_END_DELAY) self.rxe_assert_time = kwargs.pop('rxe_assert_time', 0) self.rxe_assert_length = kwargs.pop('rxe_assert_length', 1) super(TxPacket, self).__init__(**kwargs) @@ -249,7 +251,7 @@ def get_bytes(self, do_tokens=False): if do_tokens: bytes.append(self.pid) else: - bytes.append(self.pid | ((~self.pid) << 4)) + bytes.append(self.pid | (((~self.pid)&0xf) << 4)) packet_bytes = self.get_packet_bytes() for byte in packet_bytes: @@ -297,7 +299,8 @@ def __init__(self, **kwargs): self.crc5 = kwargs.pop('crc5', crc5) # Always override to match IFM - self.data_valid_count = 4 #todo + #self.data_valid_count = 4 #todo + self.data_valid_count = 0 def get_bytes(self, do_tokens=False): bytes = [] diff --git a/tests/usb_phy_utmi.py b/tests/usb_phy_utmi.py index 77706b1f..f450b699 100644 --- a/tests/usb_phy_utmi.py +++ b/tests/usb_phy_utmi.py @@ -3,6 +3,7 @@ import sys import zlib from usb_packet import RxPacket, TokenPacket +import usb_packet from usb_phy import UsbPhy class UsbPhyUtmi(UsbPhy): @@ -108,9 +109,13 @@ def run(self): #xsi.drive_port_pins(self._rxa, 1) xsi.drive_periph_pin(self._rxa, 1) - # Wait for RXA rise delay TODO, this should be configurable - self.wait(lambda x: self._clock.is_high()) - self.wait(lambda x: self._clock.is_low()) + # Wait for RXA start delay + rxa_start_delay = usb_packet.RXA_START_DELAY; + + while rxa_start_delay != 0: + self.wait(lambda x: self._clock.is_high()) + self.wait(lambda x: self._clock.is_low()) + rxa_start_delay = rxa_start_delay- 1; for (i, byte) in enumerate(packet.get_bytes()): From 894f4c1963881701551bc9e3d043ed25a410eb54 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 22 Apr 2020 15:25:10 +0100 Subject: [PATCH 060/520] Repaired XS2 build and operation (verified with HID example) --- lib_xud/src/core/XUD_HAL.xc | 39 +++++++++++++++++++++ lib_xud/src/core/XUD_Main.xc | 5 +-- lib_xud/src/core/included/XUD_Token_Setup.S | 2 +- 3 files changed, 41 insertions(+), 5 deletions(-) diff --git a/lib_xud/src/core/XUD_HAL.xc b/lib_xud/src/core/XUD_HAL.xc index 5ff66d73..8f1f3dd0 100644 --- a/lib_xud/src/core/XUD_HAL.xc +++ b/lib_xud/src/core/XUD_HAL.xc @@ -160,3 +160,42 @@ void XUD_HAL_Mode_DataTransfer() } #endif + +extern in port flag0_port; +extern in port flag1_port; +extern in port flag2_port; + +/* TODO pass structure */ +int XUD_HAL_GetLineState(/*XUD_HAL_t &xudHal*/) +{ + unsigned dm, dp; + // xudHal.p_usb_fl0 :> dp; + // xudHal.p_usb_fl1 :> dm; + +#ifdef __XS3A__ + flag0_port :> dp; + flag1_port :> dm; + + if(dp && !dm) + return XUD_LINESTATE_J; + else if(dm && !dp) + return XUD_LINESTATE_K; + else if(!dm && !dp) + return XUD_LINESTATE_SE0; + else + return XUD_LINESTATE_INVALID; +#else + + unsigned j, k, se0; + flag0_port :> j; + flag1_port :> k; + flag2_port :> se0; + + if(j) + return XUD_LINESTATE_J; + if(k) + return XUD_LINESTATE_K; + if(se0) + return XUD_LINESTATE_SE0; +#endif + } diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index 03893ad7..2b01dcc3 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -13,9 +13,6 @@ void XUD_Error_hex(char errString[], int i_err); #define XUD_Error_hex(a, b) /* */ #endif -#undef __XS2A__ -#define __XS3A__ - #include #include #include @@ -41,11 +38,11 @@ void XUD_Error_hex(char errString[], int i_err); #endif #ifdef __XS3A__ -#include "XUD_HAL.h" #include "xs3a_registers.h" /* TODO should not be expose here, should be in HAL */ unsigned XtlSelFromMhz(unsigned m); #endif +#include "XUD_HAL.h" #if defined(ARCH_X200) || defined(ARCH_S) #include "XUD_USBTile_Support.h" diff --git a/lib_xud/src/core/included/XUD_Token_Setup.S b/lib_xud/src/core/included/XUD_Token_Setup.S index b7c694e9..54f3e921 100644 --- a/lib_xud/src/core/included/XUD_Token_Setup.S +++ b/lib_xud/src/core/included/XUD_Token_Setup.S @@ -21,7 +21,7 @@ WaitForEndDataPacket: // r9: crc poly // r10: ep number // r11: scratch -#if defined(__XS2A__) || defined(__XS3A__) +#if defined(__XS3A__) .align 4 .skip 0 doRXData: From 700e746f2c6c2e76c776e1366f688fafe48791fe Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 18 Oct 2019 11:09:18 +0100 Subject: [PATCH 061/520] Added test_bulk_tx_basic_short --- tests/test_bulk_tx_basic_short.py | 45 ++++++ tests/test_bulk_tx_basic_short/LICENSE.txt | 135 ++++++++++++++++++ tests/test_bulk_tx_basic_short/Makefile | 1 + tests/test_bulk_tx_basic_short/src/main.xc | 84 +++++++++++ tests/test_bulk_tx_basic_short/src/test.xn | 72 ++++++++++ .../test_bulk_tx_basic_short/src/test_xs1.xn | 89 ++++++++++++ .../test_bulk_tx_basic_short/src/test_xs2.xn | 72 ++++++++++ .../test_bulk_tx_basic_short/src/test_xs3.xn | 24 ++++ 8 files changed, 522 insertions(+) create mode 100644 tests/test_bulk_tx_basic_short.py create mode 100644 tests/test_bulk_tx_basic_short/LICENSE.txt create mode 100644 tests/test_bulk_tx_basic_short/Makefile create mode 100644 tests/test_bulk_tx_basic_short/src/main.xc create mode 100644 tests/test_bulk_tx_basic_short/src/test.xn create mode 100755 tests/test_bulk_tx_basic_short/src/test_xs1.xn create mode 100644 tests/test_bulk_tx_basic_short/src/test_xs2.xn create mode 100644 tests/test_bulk_tx_basic_short/src/test_xs3.xn diff --git a/tests/test_bulk_tx_basic_short.py b/tests/test_bulk_tx_basic_short.py new file mode 100644 index 00000000..e1996fe1 --- /dev/null +++ b/tests/test_bulk_tx_basic_short.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +import random +import xmostest +from usb_packet import * +import usb_packet +from usb_clock import Clock +from helpers import do_usb_test, runall_rx + + +def do_test(arch, tx_clk, tx_phy, seed): + rand = random.Random() + rand.seed(seed) + + ep = 1 + address = 1 + + # The inter-frame gap is to give the DUT time to print its output + packets = [] + + dataval = 0; + + pid = PID_DATA0; + + for pktlength in range(0, 8): + + AppendInToken(packets, ep, address, inter_pkt_gap=4000) + + packets.append(RxDataPacket(rand, data_start_val=dataval, length=pktlength, pid=pid)) #DATA1 + packets.append(TxHandshakePacket()) + + + if(pid == usb_packet.PID_DATA1): + pid = usb_packet.PID_DATA0; + else: + pid = usb_packet.PID_DATA1; + + dataval += pktlength + + # Note, quite big gap to allow checking. + do_usb_test(arch, tx_clk, tx_phy, packets, __file__, seed, + level='smoke', extra_tasks=[]) + +def runtest(): + random.seed(1) + runall_rx(do_test) diff --git a/tests/test_bulk_tx_basic_short/LICENSE.txt b/tests/test_bulk_tx_basic_short/LICENSE.txt new file mode 100644 index 00000000..994856c9 --- /dev/null +++ b/tests/test_bulk_tx_basic_short/LICENSE.txt @@ -0,0 +1,135 @@ +Software Release License Agreement + +Copyright (c) 2015-2018, XMOS, All rights reserved. + +BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. + +Parties: + +(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). + +(2) An individual or legal entity exercising permissions granted by this License (Customer). + +If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. + +1. Definitions + +"License" means this Software License and any schedules or annexes to it. + +"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License + +"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. + +"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. + +"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. + +"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. + +The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. + +Unless the context otherwise requires: + +- references to XMOS and the Customer include their permitted successors and assigns; +- references to statutory provisions include those statutory provisions as amended or re-enacted; and +- references to any gender include all genders. + +Words in the singular include the plural and in the plural include the singular. + +2. License + +XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. + +Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. + +3. Consideration + +In consideration of the mutual obligations contained in this License, the parties agree to its terms. + +4. Term + +Subject to clause 12 below, this License shall be perpetual. + +5. Restrictions on Use + +The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. + +6. Modifications + +The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. + +XMOS will own all intellectual property rights in the XMOS Modifications. +The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. + +7. Support + +Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. + +8. Warranty and Disclaimer + +The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). + +Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. + +XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. + +9. High Risk Activities + +The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. + +10. Liability + +TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. + +Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. + +11. Ownership + +The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. + +12. Termination + +Either party may terminate this License at any time on written notice to the other if the other: + +- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or + +- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. + +Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. + +On termination for any reason: + +- all rights granted to the Customer under this License shall cease; +- the Customer shall cease all activities authorised by this License; +- the Customer shall immediately pay any sums due to XMOS under this License; and +- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. + +Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. + +13. Third party rights + +No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. + +14. Confidentiality and publicity + +Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. + +The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. +The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. + +15. Entire agreement + +This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. + +16. Assignment + +The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. + +17. Governing law and jurisdiction + +This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. + +This License has been entered into on the date stated at the beginning of it. + +Schedule +XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_bulk_tx_basic_short/Makefile b/tests/test_bulk_tx_basic_short/Makefile new file mode 100644 index 00000000..6aed3e76 --- /dev/null +++ b/tests/test_bulk_tx_basic_short/Makefile @@ -0,0 +1 @@ +include ../test_makefile.mak diff --git a/tests/test_bulk_tx_basic_short/src/main.xc b/tests/test_bulk_tx_basic_short/src/main.xc new file mode 100644 index 00000000..c06d5c19 --- /dev/null +++ b/tests/test_bulk_tx_basic_short/src/main.xc @@ -0,0 +1,84 @@ +// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +/* + * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent + * in both directions between the ports. + * + * NOTE: The src/testbenches/ExampleTestbench must have been compiled for this to run without error. + * + */ +#include +#include +#include +#include "xud.h" +#include "platform.h" +#include "xc_ptr.h" +#include "shared.h" + +#ifndef TEST_EP_NUM +#define TEST_EP_NUM 1 +#endif + +#ifndef PKT_LENGTH_START +#define PKT_LENGTH_START 0 +#endif + +#ifndef PKT_LENGTH_END +#define PKT_LENGTH_END 7 +#endif + +#define XUD_EP_COUNT_OUT 4 +#define XUD_EP_COUNT_IN 4 + +/* Endpoint type tables */ +XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, + XUD_EPTYPE_BUL, + XUD_EPTYPE_BUL, + XUD_EPTYPE_BUL}; +XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, + XUD_EPTYPE_BUL, + XUD_EPTYPE_BUL, + XUD_EPTYPE_ISO}; + +#ifdef XUD_SIM_RTL +int testmain() +#else +int main() +#endif +{ + chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + + par + { + { + #if defined(XUD_TEST_SPEED_FS) + unsigned speed = XUD_SPEED_FS; + #elif defined(XUD_TEST_SPEED_HS) + unsigned speed = XUD_SPEED_HS; + #endif + + // TODO test is running at 400MHz + XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + null, epTypeTableOut, epTypeTableIn, + null, null, -1, speed, XUD_PWR_BUS); + } + + { + unsigned fail = TestEp_Tx(c_ep_in[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_DIE); + +#ifdef XUD_SIM_RTL + /* Note, this test relies on checking at the host side */ + + if(fail) + TerminateFail(fail); + else + TerminatePass(fail); +#endif + + XUD_ep ep_out_0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep_out_0); + exit(0); + } + } + + return 0; +} diff --git a/tests/test_bulk_tx_basic_short/src/test.xn b/tests/test_bulk_tx_basic_short/src/test.xn new file mode 100644 index 00000000..d0ee86b8 --- /dev/null +++ b/tests/test_bulk_tx_basic_short/src/test.xn @@ -0,0 +1,72 @@ + + + Board + XS2 MC Audio + + tileref tile[2] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_tx_basic_short/src/test_xs1.xn b/tests/test_bulk_tx_basic_short/src/test_xs1.xn new file mode 100755 index 00000000..573aef45 --- /dev/null +++ b/tests/test_bulk_tx_basic_short/src/test_xs1.xn @@ -0,0 +1,89 @@ + + + + + tileref tile[1] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_tx_basic_short/src/test_xs2.xn b/tests/test_bulk_tx_basic_short/src/test_xs2.xn new file mode 100644 index 00000000..d0ee86b8 --- /dev/null +++ b/tests/test_bulk_tx_basic_short/src/test_xs2.xn @@ -0,0 +1,72 @@ + + + Board + XS2 MC Audio + + tileref tile[2] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_tx_basic_short/src/test_xs3.xn b/tests/test_bulk_tx_basic_short/src/test_xs3.xn new file mode 100644 index 00000000..ab436573 --- /dev/null +++ b/tests/test_bulk_tx_basic_short/src/test_xs3.xn @@ -0,0 +1,24 @@ + + + + tileref tile[2] + + + + + + + + + + + + + + + + + + From 23d8cbfbb75b9435adfa3e6a0343eba2c9e2b3e0 Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 18 Oct 2019 14:26:40 +0100 Subject: [PATCH 062/520] Fixes to xs3 tests, loopback, badcrc32, badpid --- tests/test_bulk_loopback.py | 10 ++++++---- tests/test_bulk_rx_basic_badcrc32.py | 9 +++++---- tests/test_bulk_rx_basic_badpid.py | 19 +++++++++---------- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/tests/test_bulk_loopback.py b/tests/test_bulk_loopback.py index e272645b..cfe97ac5 100644 --- a/tests/test_bulk_loopback.py +++ b/tests/test_bulk_loopback.py @@ -3,6 +3,7 @@ import random import xmostest from usb_packet import * +import usb_packet from usb_clock import Clock from helpers import do_usb_test, runall_rx @@ -19,19 +20,20 @@ def do_test(arch, clk, phy, seed): packets = [] dataval = 0; - data_pid = 0x3 #DATA0 + data_pid = usb_packet.PID_DATA0 + # TODO randomise packet lengths and data for pkt_length in range(0, 20): AppendOutToken(packets, ep_loopback, address) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=pkt_length, pid=data_pid)) #DATA0 - packets.append(RxHandshakePacket(timeout=9)) + packets.append(TxDataPacket(rand, data_start_val=dataval, length=pkt_length, pid=data_pid)) + packets.append(RxHandshakePacket()) # 357 was min IPG supported on bulk loopback to not nak # For move from sc_xud to lib_xud (14.1.2 tools) had to increase this to 377 # Increased again due to setup/out checking AppendInToken(packets, ep_loopback, address, inter_pkt_gap=417) - packets.append(RxDataPacket(rand, data_start_val=dataval, length=pkt_length, pid=data_pid, timeout=9)) #DATA0 + packets.append(RxDataPacket(rand, data_start_val=dataval, length=pkt_length, pid=data_pid)) packets.append(TxHandshakePacket()) data_pid = data_pid ^ 8 diff --git a/tests/test_bulk_rx_basic_badcrc32.py b/tests/test_bulk_rx_basic_badcrc32.py index cc5fd8d3..d1e14789 100644 --- a/tests/test_bulk_rx_basic_badcrc32.py +++ b/tests/test_bulk_rx_basic_badcrc32.py @@ -3,6 +3,7 @@ import random import xmostest from usb_packet import * +import usb_packet from usb_clock import Clock from helpers import do_usb_test, runall_rx @@ -23,7 +24,7 @@ def do_test(arch, tx_clk, tx_phy, seed): # Good OUT transaction AppendOutToken(packets, ep, dev_address) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=10, pid=0x3)) #DATA0 + packets.append(TxDataPacket(rand, data_start_val=dataval, length=10, pid=usb_packet.PID_DATA0)) packets.append(RxHandshakePacket()) # Note, quite big gap to allow checking. @@ -31,12 +32,12 @@ def do_test(arch, tx_clk, tx_phy, seed): # Another good OUT transaction dataval += 10 AppendOutToken(packets, ep, dev_address, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=11, pid=0xb)) #DATA1 + packets.append(TxDataPacket(rand, data_start_val=dataval, length=11, pid=usb_packet.PID_DATA1)) packets.append(RxHandshakePacket()) dataval += 11 AppendOutToken(packets, ep, dev_address, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=12, bad_crc=True, pid=0x3)) #DATA0 + packets.append(TxDataPacket(rand, data_start_val=dataval, length=12, bad_crc=True, pid=usb_packet.PID_DATA0)) # Bad CRC - dont expect ACK #packets.append(RxHandshakePacket()) @@ -44,7 +45,7 @@ def do_test(arch, tx_clk, tx_phy, seed): dataval += 12 AppendOutToken(packets, ep, dev_address, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, length=13, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket(timeout=10)) + packets.append(RxHandshakePacket()) # PID toggle as normal dataval += 13 diff --git a/tests/test_bulk_rx_basic_badpid.py b/tests/test_bulk_rx_basic_badpid.py index 79b47230..065bee5c 100644 --- a/tests/test_bulk_rx_basic_badpid.py +++ b/tests/test_bulk_rx_basic_badpid.py @@ -23,37 +23,36 @@ def do_test(arch, clk, phy, seed): dataval = 0; + ipg = 500 + AppendOutToken(packets, ep, address) packets.append(TxDataPacket(rand, data_start_val=dataval, length=10, pid=0x3)) #DATA0 packets.append(RxHandshakePacket()) - - # Note, quite big gap to allow checking. dataval += 10 - AppendOutToken(packets, ep, address, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, inter_pkt_gap=ipg) packets.append(TxDataPacket(rand, data_start_val=dataval, length=11, pid=0xb)) #DATA1 packets.append(RxHandshakePacket()) #Pretend the ACK went missing. Re-send same packet. xCORE should ACK but throw pkt away - AppendOutToken(packets, ep, address, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, inter_pkt_gap=ipg) packets.append(TxDataPacket(rand, data_start_val=dataval, length=11, pid=0xb)) #DATA1 packets.append(RxHandshakePacket()) dataval += 11 - AppendOutToken(packets, ep, address, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, inter_pkt_gap=ipg) packets.append(TxDataPacket(rand, data_start_val=dataval, length=12, pid=0x3)) #DATA0 packets.append(RxHandshakePacket()) dataval += 12 - AppendOutToken(packets, ep, address, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, inter_pkt_gap=ipg) packets.append(TxDataPacket(rand, data_start_val=dataval, length=13, pid=0xb)) #DATA1 - packets.append(RxHandshakePacket(timeout=10)) + packets.append(RxHandshakePacket()) dataval += 13 - AppendOutToken(packets, ep, address, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, inter_pkt_gap=ipg) packets.append(TxDataPacket(rand, data_start_val=dataval, length=14, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket(timeout=10)) - + packets.append(RxHandshakePacket()) do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) From 21966487755bf57b66e2c0d725022907703b893a Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Tue, 15 Oct 2019 11:09:19 +0100 Subject: [PATCH 063/520] Fixed build issue --- lib_xud/src/core/XUD_HAL.xc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xud/src/core/XUD_HAL.xc b/lib_xud/src/core/XUD_HAL.xc index 8f1f3dd0..41376ce7 100644 --- a/lib_xud/src/core/XUD_HAL.xc +++ b/lib_xud/src/core/XUD_HAL.xc @@ -32,7 +32,7 @@ unsigned XtlSelFromMhz(unsigned m) return 0b111; default: /* Panic */ - while(1) + while(1); break; } } From f121ea433952eed31eb8080317bbaeb157db1948 Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 18 Oct 2019 16:05:25 +0100 Subject: [PATCH 064/520] Removed fast packet tests - they should be a variant of the other tests with minimal timings --- tests/test_bulk_rx_fastpacket.py | 39 --------------------------- tests/test_bulk_rxtx_fastpacket.py | 42 ------------------------------ tests/test_bulk_tx_fastpacket.py | 39 --------------------------- 3 files changed, 120 deletions(-) delete mode 100644 tests/test_bulk_rx_fastpacket.py delete mode 100644 tests/test_bulk_rxtx_fastpacket.py delete mode 100644 tests/test_bulk_tx_fastpacket.py diff --git a/tests/test_bulk_rx_fastpacket.py b/tests/test_bulk_rx_fastpacket.py deleted file mode 100644 index 7e45b97b..00000000 --- a/tests/test_bulk_rx_fastpacket.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env python - -import random -import xmostest -from usb_packet import * -from usb_clock import Clock -from helpers import do_usb_test, runall_rx - -def do_test(arch, clk, phy, seed): - rand = random.Random() - rand.seed(seed) - - dev_address = 1 - ep_loopback = 3 - - # The inter-frame gap is to give the DUT time to print its output - packets = [] - - data_val = 0; - pkt_length = 20 - data_pid = 0x3 #DATA0 - - for pkt_length in range(10, 20): - - # min 237 - # increased to 277 when SETUP/OUT checking added - AppendOutToken(packets, ep_loopback, dev_address, inter_pkt_gap=277) - packets.append(TxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) #DATA0 - packets.append(RxHandshakePacket(timeout=9)) - - data_val = data_val + pkt_length - data_pid = data_pid ^ 8 - - do_usb_test(arch, clk, phy, packets, __file__, seed, - level='smoke', extra_tasks=[]) - -def runtest(): - random.seed(1) - runall_rx(do_test) diff --git a/tests/test_bulk_rxtx_fastpacket.py b/tests/test_bulk_rxtx_fastpacket.py deleted file mode 100644 index 7b8472c9..00000000 --- a/tests/test_bulk_rxtx_fastpacket.py +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env python - -import random -import xmostest -from usb_packet import * -from usb_clock import Clock -from helpers import do_usb_test, runall_rx - -def do_test(arch, clk, phy, seed): - rand = random.Random() - rand.seed(seed) - - ep = 3 - address = 1 - - packets = [] - - data_val = 0; - pkt_length = 20 - data_pid = 0x3 #DATA0 - - for pkt_length in range(10, 20): - - # < 17 fails for SI - # < 37 fails for DI - AppendOutToken(packets, ep, address, inter_pkt_gap=37) - packets.append(TxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) #DATA0 - # 9 works for SI - packets.append(RxHandshakePacket(timeout=10)) - - AppendInToken(packets, ep, address, inter_pkt_gap=0) - packets.append(RxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) - packets.append(TxHandshakePacket()) - - data_val = data_val + pkt_length - data_pid = data_pid ^ 8 - - do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) - -def runtest(): - random.seed(1) - runall_rx(do_test) diff --git a/tests/test_bulk_tx_fastpacket.py b/tests/test_bulk_tx_fastpacket.py deleted file mode 100644 index 3f8fc242..00000000 --- a/tests/test_bulk_tx_fastpacket.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env python - -import random -import xmostest -from usb_packet import * -from usb_clock import Clock -from helpers import do_usb_test, runall_rx - -def do_test(arch, clk, phy, seed): - rand = random.Random() - rand.seed(seed) - - address = 1 - ep = 3 - - # The inter-frame gap is to give the DUT time to print its output - packets = [] - - data_val = 0; - pkt_length = 20 - data_pid = 0x3 #DATA0 - - for pkt_length in range(10, 20): - - #317 lowest for valid data (non-dual issue version) - #337 for initial dual-issue version - AppendInToken(packets, ep, address, inter_pkt_gap=337) - packets.append(RxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) - packets.append(TxHandshakePacket()) - - data_val = data_val + pkt_length - data_pid = data_pid ^ 8 - - do_usb_test(arch, clk, phy, packets, __file__, seed, - level='smoke', extra_tasks=[]) - -def runtest(): - random.seed(1) - runall_rx(do_test) From ed5ad0227744919a5904bf27ea6007c911d3ee96 Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 18 Oct 2019 16:05:44 +0100 Subject: [PATCH 065/520] Fixed some XS3 issues in ep functions --- lib_xud/src/user/client/XUD_EpFuncs.S | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib_xud/src/user/client/XUD_EpFuncs.S b/lib_xud/src/user/client/XUD_EpFuncs.S index a12acbef..fff0451e 100644 --- a/lib_xud/src/user/client/XUD_EpFuncs.S +++ b/lib_xud/src/user/client/XUD_EpFuncs.S @@ -138,9 +138,9 @@ XUD_GetSetupData_Reset: XUD_GetData: #if defined(__XS2A__) || defined(__XS3A__) .issue_mode single - ENTSP_lu6 4 + ENTSP_lu6 4 #else - entsp 4 + entsp 4 #endif stw r10, sp[1] mov r11, r1 @@ -408,7 +408,8 @@ XUD_GetData_Select_CheckPid: // Check PID bt r11, XUD_GetData_Select_BadPkt XUD_GetData_Select_PidToggle: -#if (XUD_SERIES_SUPPORT==3) +//#if (XUD_SERIES_SUPPORT==3) +#ifdef __XS3A__ ldc r2, 0x88 #else ldc r2, 8 @@ -588,7 +589,8 @@ XUD_ClearStallByAddr_OUT: ldaw r1, dp[handshakeTable_OUT] stw r2, r1[r0] -#if(XUD_SERIES_SUPPORT==3) +//#if(XUD_SERIES_SUPPORT==3) +#ifdef __XS3A__ ldc r1, USB_PIDn_DATA0 #else ldc r1, USB_PID_DATA0 From d512a45faedbd010705f0520fd598e9518f48dbf Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 18 Oct 2019 16:06:08 +0100 Subject: [PATCH 066/520] Fixed iso rx test for xs3 --- tests/test_iso_rx_basic.py | 24 ++++----------- tests/test_iso_rx_basic/src/main.xc | 46 ++++++++++++++++++----------- tests/usb_packet.py | 5 +++- 3 files changed, 38 insertions(+), 37 deletions(-) diff --git a/tests/test_iso_rx_basic.py b/tests/test_iso_rx_basic.py index 98ba3ed9..67419966 100644 --- a/tests/test_iso_rx_basic.py +++ b/tests/test_iso_rx_basic.py @@ -19,27 +19,13 @@ def do_test(arch, clk, phy, seed): dataval = 0; - AppendOutToken(packets, ep, address) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=10, pid=0x3)) #DATA0 - # Note, quite big gap to allow checking. - - dataval += 10 - AppendOutToken(packets, ep, address, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=11, pid=0x3)) #DATA0 - - dataval += 11 - AppendOutToken(packets, ep, address, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=12, pid=0x3)) #DATA0 - - dataval += 12 - AppendOutToken(packets, ep, address, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=13, pid=0x3)) #DATA0 - - dataval += 13 - AppendOutToken(packets, ep, address, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=14, pid=0x3)) #DATA0 + pid = PID_DATA0; + for pktlength in range(10, 15): + AppendOutToken(packets, ep, address, inter_pkt_gap=500) + packets.append(TxDataPacket(rand, data_start_val=dataval, length=pktlength, pid=pid)) + dataval += pktlength do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) diff --git a/tests/test_iso_rx_basic/src/main.xc b/tests/test_iso_rx_basic/src/main.xc index 5d705979..4faa1ac2 100644 --- a/tests/test_iso_rx_basic/src/main.xc +++ b/tests/test_iso_rx_basic/src/main.xc @@ -11,16 +11,15 @@ #define XUD_EP_COUNT_IN 5 #ifndef PKT_LENGTH_START -#define PKT_LENGTH_START 10 +#define PKT_LENGTH_START 10 #endif - #ifndef PKT_LENGTH_END -#define PKT_LENGTH_END 14 +#define PKT_LENGTH_END 14 #endif #ifndef TEST_EP_NUM -#define TEST_EP_NUM 2 +#define TEST_EP_NUM 2 #endif /* Endpoint type tables */ @@ -29,30 +28,43 @@ XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, X XUD_EPTYPE_BUL}; XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; +#ifdef XUD_SIM_RTL +int testmain() +#else int main() +#endif { chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - + par { - - XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, - null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); + { + #if defined(XUD_TEST_SPEED_FS) + unsigned speed = XUD_SPEED_FS; + #elif defined(XUD_TEST_SPEED_HS) + unsigned speed = XUD_SPEED_HS; + #else + #error XUD_TEST_SPEED_XX not defined + #endif + + XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + null, epTypeTableOut, epTypeTableIn, + null, null, -1, speed, XUD_PWR_BUS); + } { - TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); + unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); + + if(fail) + TerminateFail(fail); + else + TerminatePass(fail); + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); XUD_Kill(ep0); - - exit(0); // TODO should be able to move outside of the par{} - + exit(0); } - - - } - return 0; } diff --git a/tests/usb_packet.py b/tests/usb_packet.py index 6b4669fe..d14e4c99 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -7,10 +7,13 @@ RX_TX_DELAY = 20 RXA_END_DELAY = 2 # Pad delay not currently simulated in xsim for USB or OTP, so add this delay here RXA_START_DELAY = 5 #Taken from RTL sim +RX_RX_DELAY = 40 PID_DATA1 = 0xb PID_DATA0 = 0x3 + + def AppendSetupToken(packets, ep, address, **kwargs): ipg = kwargs.pop('inter_pkt_gap', 500) address = kwargs.pop('address', 0) @@ -198,7 +201,7 @@ def get_timeout(self): class TxPacket(UsbPacket): def __init__(self, **kwargs): - self.inter_pkt_gap = kwargs.pop('inter_pkt_gap', 13) #13 lowest working for single issue loopback + self.inter_pkt_gap = kwargs.pop('inter_pkt_gap', RX_RX_DELAY) #13 lowest working for single issue loopback self.rxa_start_delay = kwargs.pop('rxa_start_delay', 2) self.rxa_end_delay = kwargs.pop('rxa_end_delay', RXA_END_DELAY) self.rxe_assert_time = kwargs.pop('rxe_assert_time', 0) From a349c24b70624ebdf364fc17d2934c0975e5de38 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 21 Oct 2019 12:09:36 +0100 Subject: [PATCH 067/520] Renamed bulk_tx_fastpacket_multiep test, modded to pass. --- .../src/xc_ptr.h | 47 ------------------- ...ket_multiep.py => test_bulk_tx_multiep.py} | 10 ++-- .../LICENSE.txt | 0 .../Makefile | 0 .../src/main.xc | 0 .../src/test.xn | 0 .../src/test_xs1.xn | 0 .../src/test_xs2.xn | 0 .../src/test_xs3.xn | 0 9 files changed, 6 insertions(+), 51 deletions(-) delete mode 100644 tests/test_bulk_tx_fastpacket_multiep/src/xc_ptr.h rename tests/{test_bulk_tx_fastpacket_multiep.py => test_bulk_tx_multiep.py} (97%) rename tests/{test_bulk_tx_fastpacket_multiep => test_bulk_tx_multiep}/LICENSE.txt (100%) rename tests/{test_bulk_tx_fastpacket_multiep => test_bulk_tx_multiep}/Makefile (100%) rename tests/{test_bulk_tx_fastpacket_multiep => test_bulk_tx_multiep}/src/main.xc (100%) rename tests/{test_bulk_tx_fastpacket_multiep => test_bulk_tx_multiep}/src/test.xn (100%) rename tests/{test_bulk_tx_fastpacket_multiep => test_bulk_tx_multiep}/src/test_xs1.xn (100%) rename tests/{test_bulk_tx_fastpacket_multiep => test_bulk_tx_multiep}/src/test_xs2.xn (100%) rename tests/{test_bulk_tx_fastpacket_multiep => test_bulk_tx_multiep}/src/test_xs3.xn (100%) diff --git a/tests/test_bulk_tx_fastpacket_multiep/src/xc_ptr.h b/tests/test_bulk_tx_fastpacket_multiep/src/xc_ptr.h deleted file mode 100644 index 28fa6b8b..00000000 --- a/tests/test_bulk_tx_fastpacket_multiep/src/xc_ptr.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved -#ifndef __xc_ptr__ -#define __xc_ptr__ - -typedef unsigned int xc_ptr; - -// Note that this function is marked as const to avoid the XC -// parallel usage checks, this is only really going to work if this -// is the *only* way the array a is accessed (and everything else uses -// the xc_ptr) -inline xc_ptr array_to_xc_ptr(const unsigned a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -inline xc_ptr char_array_to_xc_ptr(const unsigned char a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -#define write_via_xc_ptr_indexed(p,i,x) asm volatile("stw %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_short_via_xc_ptr_indexed(p,i,x) asm volatile("st16 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) - -#define write_via_xc_ptr(p,x) asm volatile("stw %0, %1[0]"::"r"(x),"r"(p)) -// No immediate st8 format -#define write_byte_via_xc_ptr(p,x) write_byte_via_xc_ptr_indexed(p, 0, x) -#define write_short_via_xc_ptr(p,x) write_short_via_xc_ptr_indexed(p, 0, x) - -#define read_via_xc_ptr_indexed(x,p,i) asm("ldw %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_byte_via_xc_ptr_indexed(x,p,i) asm("ld8u %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_short_via_xc_ptr_indexed(x,p,i) asm("ld16s %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); - -#define read_via_xc_ptr(x,p) asm("ldw %0, %1[0]":"=r"(x):"r"(p)); -// No immediate ld8u format -#define read_byte_via_xc_ptr(x,p) read_byte_via_xc_ptr_indexed(x, p, 0) -#define read_short_via_xc_ptr(x,p) read_short_via_xc_ptr_indexed(x, p, 0) - -#define GET_SHARED_GLOBAL(x, g) asm volatile("ldw %0, dp[" #g "]":"=r"(x)::"memory") -#define SET_SHARED_GLOBAL(g, v) asm volatile("stw %0, dp[" #g "]"::"r"(v):"memory") - -#endif diff --git a/tests/test_bulk_tx_fastpacket_multiep.py b/tests/test_bulk_tx_multiep.py similarity index 97% rename from tests/test_bulk_tx_fastpacket_multiep.py rename to tests/test_bulk_tx_multiep.py index 87b7a8f3..c3e39713 100644 --- a/tests/test_bulk_tx_fastpacket_multiep.py +++ b/tests/test_bulk_tx_multiep.py @@ -20,6 +20,8 @@ def do_test(arch, clk, phy, seed): pkt_length = 20 data_pid = 0x3 #DATA0 + ipg = 200 + for pkt_length in range(10, 20): #Single EP: @@ -28,19 +30,19 @@ def do_test(arch, clk, phy, seed): #Multi EP: #177 lowest for valid data (DI) - AppendInToken(packets, start_ep, address, inter_pkt_gap=177) + AppendInToken(packets, start_ep, address, inter_pkt_gap=ipg) packets.append(RxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) packets.append(TxHandshakePacket()) - AppendInToken(packets, start_ep+1, address, inter_pkt_gap=177) + AppendInToken(packets, start_ep+1, address, inter_pkt_gap=ipg) packets.append(RxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) packets.append(TxHandshakePacket()) - AppendInToken(packets, start_ep+2, address, inter_pkt_gap=177) + AppendInToken(packets, start_ep+2, address, inter_pkt_gap=ipg) packets.append(RxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) packets.append(TxHandshakePacket()) - AppendInToken(packets, start_ep+3, address, inter_pkt_gap=177) + AppendInToken(packets, start_ep+3, address, inter_pkt_gap=ipg) packets.append(RxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) packets.append(TxHandshakePacket()) diff --git a/tests/test_bulk_tx_fastpacket_multiep/LICENSE.txt b/tests/test_bulk_tx_multiep/LICENSE.txt similarity index 100% rename from tests/test_bulk_tx_fastpacket_multiep/LICENSE.txt rename to tests/test_bulk_tx_multiep/LICENSE.txt diff --git a/tests/test_bulk_tx_fastpacket_multiep/Makefile b/tests/test_bulk_tx_multiep/Makefile similarity index 100% rename from tests/test_bulk_tx_fastpacket_multiep/Makefile rename to tests/test_bulk_tx_multiep/Makefile diff --git a/tests/test_bulk_tx_fastpacket_multiep/src/main.xc b/tests/test_bulk_tx_multiep/src/main.xc similarity index 100% rename from tests/test_bulk_tx_fastpacket_multiep/src/main.xc rename to tests/test_bulk_tx_multiep/src/main.xc diff --git a/tests/test_bulk_tx_fastpacket_multiep/src/test.xn b/tests/test_bulk_tx_multiep/src/test.xn similarity index 100% rename from tests/test_bulk_tx_fastpacket_multiep/src/test.xn rename to tests/test_bulk_tx_multiep/src/test.xn diff --git a/tests/test_bulk_tx_fastpacket_multiep/src/test_xs1.xn b/tests/test_bulk_tx_multiep/src/test_xs1.xn similarity index 100% rename from tests/test_bulk_tx_fastpacket_multiep/src/test_xs1.xn rename to tests/test_bulk_tx_multiep/src/test_xs1.xn diff --git a/tests/test_bulk_tx_fastpacket_multiep/src/test_xs2.xn b/tests/test_bulk_tx_multiep/src/test_xs2.xn similarity index 100% rename from tests/test_bulk_tx_fastpacket_multiep/src/test_xs2.xn rename to tests/test_bulk_tx_multiep/src/test_xs2.xn diff --git a/tests/test_bulk_tx_fastpacket_multiep/src/test_xs3.xn b/tests/test_bulk_tx_multiep/src/test_xs3.xn similarity index 100% rename from tests/test_bulk_tx_fastpacket_multiep/src/test_xs3.xn rename to tests/test_bulk_tx_multiep/src/test_xs3.xn From 350129997e01eed56b9b73636f7ca8c668104b93 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 21 Oct 2019 13:42:16 +0100 Subject: [PATCH 068/520] Iso loopback test fixes --- tests/test_iso_loopback.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_iso_loopback.py b/tests/test_iso_loopback.py index 8b90ba59..59c1f75c 100644 --- a/tests/test_iso_loopback.py +++ b/tests/test_iso_loopback.py @@ -22,6 +22,8 @@ def do_test(arch, clk, phy, seed): dataval = 0; data_pid = 0x3 #DATA0 + ipg = 6000 + for pkt_length in range(200, 204): AppendOutToken(packets, ep_loopback, address) @@ -32,7 +34,7 @@ def do_test(arch, clk, phy, seed): # increased again from 437 when SETUP/OUT checking added # increaed from 477 when adding xs3 AppendInToken(packets, ep_loopback, address, inter_pkt_gap=498) - packets.append(RxDataPacket(rand, data_start_val=dataval, length=pkt_length, pid=data_pid, timeout=9)) #DATA0 + packets.append(RxDataPacket(rand, data_start_val=dataval, length=pkt_length, pid=data_pid)) #DATA0 #No toggle for Iso @@ -43,7 +45,7 @@ def do_test(arch, clk, phy, seed): packets.append(TxDataPacket(rand, length=pkt_length, pid=3)) #DATA0 packets.append(RxHandshakePacket()) - AppendInToken(packets, ep_loopback_kill, address, inter_pkt_gap=397) + AppendInToken(packets, ep_loopback_kill, address, inter_pkt_gap=ipg) packets.append(RxDataPacket(rand, length=pkt_length, pid=3)) #DATA0 packets.append(TxHandshakePacket()) From 4de951e4a9bb9d16bcf912bf433457f67f8ec59b Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 22 Oct 2019 13:25:58 +0100 Subject: [PATCH 069/520] Added test_bulk_rx_traffic test --- tests/test_bulk_rx_traffic.py | 61 ++++++++++ tests/test_bulk_rx_traffic/LICENSE.txt | 135 +++++++++++++++++++++ tests/test_bulk_rx_traffic/Makefile | 1 + tests/test_bulk_rx_traffic/src/main.xc | 67 ++++++++++ tests/test_bulk_rx_traffic/src/test_xs1.xn | 89 ++++++++++++++ tests/test_bulk_rx_traffic/src/test_xs2.xn | 72 +++++++++++ tests/test_bulk_rx_traffic/src/test_xs3.xn | 24 ++++ tests/test_bulk_rx_traffic/src/xc_ptr.h | 47 +++++++ 8 files changed, 496 insertions(+) create mode 100644 tests/test_bulk_rx_traffic.py create mode 100644 tests/test_bulk_rx_traffic/LICENSE.txt create mode 100644 tests/test_bulk_rx_traffic/Makefile create mode 100644 tests/test_bulk_rx_traffic/src/main.xc create mode 100755 tests/test_bulk_rx_traffic/src/test_xs1.xn create mode 100644 tests/test_bulk_rx_traffic/src/test_xs2.xn create mode 100644 tests/test_bulk_rx_traffic/src/test_xs3.xn create mode 100644 tests/test_bulk_rx_traffic/src/xc_ptr.h diff --git a/tests/test_bulk_rx_traffic.py b/tests/test_bulk_rx_traffic.py new file mode 100644 index 00000000..a73afdf7 --- /dev/null +++ b/tests/test_bulk_rx_traffic.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python + +import random +import xmostest +from usb_packet import * +import usb_packet +from usb_clock import Clock +from helpers import do_usb_test, runall_rx + +def do_test(arch, clk, phy, seed): + rand = random.Random() + rand.seed(seed) + + ep = 1 + address = 1 + + # The inter-frame gap is to give the DUT time to print its output + packets = [] + + dataval = 0; + + pid = PID_DATA0; + + trafficAddress1 = 0; + trafficAddress2 = 127; + + trafficEp1 = 15; + trafficEp2 = 0; + + for pktlength in range(10, 20): + + AppendOutToken(packets, trafficEp1, trafficAddress1, inter_pkt_gap=500) + packets.append(TxDataPacket(rand, data_start_val=dataval, length=pktlength, pid=pid)) + + AppendOutToken(packets, ep, address, inter_pkt_gap=500) + packets.append(TxDataPacket(rand, data_start_val=dataval, length=pktlength, pid=pid)) + packets.append(RxHandshakePacket()) + + AppendOutToken(packets, trafficEp2, trafficAddress2, inter_pkt_gap=500) + packets.append(TxDataPacket(rand, data_start_val=dataval, length=pktlength, pid=pid)) + + if(pid == usb_packet.PID_DATA1): + pid = usb_packet.PID_DATA0; + else: + pid = usb_packet.PID_DATA1; + + dataval += pktlength + + trafficEp1 = trafficEp1 - 1 + if(trafficEp1 < 0): + trafficEp1 = 15 + + trafficEp2 + trafficEp2 + 1 + if(trafficEp1 > 15): + trafficEp1 = 0 + + do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) + +def runtest(): + random.seed(1) + runall_rx(do_test) diff --git a/tests/test_bulk_rx_traffic/LICENSE.txt b/tests/test_bulk_rx_traffic/LICENSE.txt new file mode 100644 index 00000000..994856c9 --- /dev/null +++ b/tests/test_bulk_rx_traffic/LICENSE.txt @@ -0,0 +1,135 @@ +Software Release License Agreement + +Copyright (c) 2015-2018, XMOS, All rights reserved. + +BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. + +Parties: + +(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). + +(2) An individual or legal entity exercising permissions granted by this License (Customer). + +If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. + +1. Definitions + +"License" means this Software License and any schedules or annexes to it. + +"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License + +"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. + +"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. + +"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. + +"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. + +The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. + +Unless the context otherwise requires: + +- references to XMOS and the Customer include their permitted successors and assigns; +- references to statutory provisions include those statutory provisions as amended or re-enacted; and +- references to any gender include all genders. + +Words in the singular include the plural and in the plural include the singular. + +2. License + +XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. + +Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. + +3. Consideration + +In consideration of the mutual obligations contained in this License, the parties agree to its terms. + +4. Term + +Subject to clause 12 below, this License shall be perpetual. + +5. Restrictions on Use + +The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. + +6. Modifications + +The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. + +XMOS will own all intellectual property rights in the XMOS Modifications. +The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. + +7. Support + +Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. + +8. Warranty and Disclaimer + +The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). + +Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. + +XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. + +9. High Risk Activities + +The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. + +10. Liability + +TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. + +Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. + +11. Ownership + +The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. + +12. Termination + +Either party may terminate this License at any time on written notice to the other if the other: + +- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or + +- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. + +Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. + +On termination for any reason: + +- all rights granted to the Customer under this License shall cease; +- the Customer shall cease all activities authorised by this License; +- the Customer shall immediately pay any sums due to XMOS under this License; and +- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. + +Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. + +13. Third party rights + +No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. + +14. Confidentiality and publicity + +Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. + +The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. +The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. + +15. Entire agreement + +This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. + +16. Assignment + +The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. + +17. Governing law and jurisdiction + +This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. + +This License has been entered into on the date stated at the beginning of it. + +Schedule +XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_bulk_rx_traffic/Makefile b/tests/test_bulk_rx_traffic/Makefile new file mode 100644 index 00000000..6aed3e76 --- /dev/null +++ b/tests/test_bulk_rx_traffic/Makefile @@ -0,0 +1 @@ +include ../test_makefile.mak diff --git a/tests/test_bulk_rx_traffic/src/main.xc b/tests/test_bulk_rx_traffic/src/main.xc new file mode 100644 index 00000000..cc82ad96 --- /dev/null +++ b/tests/test_bulk_rx_traffic/src/main.xc @@ -0,0 +1,67 @@ +// Copyright (c) 2018-2019, XMOS Ltd, All rights reserved +#include +#include +#include +#include "xud.h" +#include "platform.h" +#include "shared.h" + +#define XUD_EP_COUNT_OUT 5 +#define XUD_EP_COUNT_IN 5 + +#ifndef PKT_LENGTH_START +#define PKT_LENGTH_START 10 +#endif + +#ifndef PKT_LENGTH_END +#define PKT_LENGTH_END 19 +#endif + +#ifndef TEST_EP_NUM +#define TEST_EP_NUM 1 +#endif + +/* Endpoint type tables */ +XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; +XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; + +#ifdef XUD_SIM_RTL +int testmain() +#else +int main() +#endif +{ + chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + + par + { + { + #if defined(XUD_TEST_SPEED_FS) + unsigned speed = XUD_SPEED_FS; + #elif defined(XUD_TEST_SPEED_HS) + unsigned speed = XUD_SPEED_HS; + #else + #error XUD_TEST_SPEED_XX not defined + #endif + + XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + null, epTypeTableOut, epTypeTableIn, + null, null, -1, speed, XUD_PWR_BUS); + } + + { + unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); + + if(fail) + TerminateFail(fail); + else + TerminatePass(fail); + + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep0); + exit(0); + } + } + + return 0; +} diff --git a/tests/test_bulk_rx_traffic/src/test_xs1.xn b/tests/test_bulk_rx_traffic/src/test_xs1.xn new file mode 100755 index 00000000..573aef45 --- /dev/null +++ b/tests/test_bulk_rx_traffic/src/test_xs1.xn @@ -0,0 +1,89 @@ + + + + + tileref tile[1] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_rx_traffic/src/test_xs2.xn b/tests/test_bulk_rx_traffic/src/test_xs2.xn new file mode 100644 index 00000000..d0ee86b8 --- /dev/null +++ b/tests/test_bulk_rx_traffic/src/test_xs2.xn @@ -0,0 +1,72 @@ + + + Board + XS2 MC Audio + + tileref tile[2] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_rx_traffic/src/test_xs3.xn b/tests/test_bulk_rx_traffic/src/test_xs3.xn new file mode 100644 index 00000000..ab436573 --- /dev/null +++ b/tests/test_bulk_rx_traffic/src/test_xs3.xn @@ -0,0 +1,24 @@ + + + + tileref tile[2] + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_rx_traffic/src/xc_ptr.h b/tests/test_bulk_rx_traffic/src/xc_ptr.h new file mode 100644 index 00000000..28fa6b8b --- /dev/null +++ b/tests/test_bulk_rx_traffic/src/xc_ptr.h @@ -0,0 +1,47 @@ +// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +#ifndef __xc_ptr__ +#define __xc_ptr__ + +typedef unsigned int xc_ptr; + +// Note that this function is marked as const to avoid the XC +// parallel usage checks, this is only really going to work if this +// is the *only* way the array a is accessed (and everything else uses +// the xc_ptr) +inline xc_ptr array_to_xc_ptr(const unsigned a[]) +{ + xc_ptr x; + asm("mov %0, %1":"=r"(x):"r"(a)); + return x; +} + +inline xc_ptr char_array_to_xc_ptr(const unsigned char a[]) +{ + xc_ptr x; + asm("mov %0, %1":"=r"(x):"r"(a)); + return x; +} + +#define write_via_xc_ptr_indexed(p,i,x) asm volatile("stw %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) +#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) +#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) +#define write_short_via_xc_ptr_indexed(p,i,x) asm volatile("st16 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) + +#define write_via_xc_ptr(p,x) asm volatile("stw %0, %1[0]"::"r"(x),"r"(p)) +// No immediate st8 format +#define write_byte_via_xc_ptr(p,x) write_byte_via_xc_ptr_indexed(p, 0, x) +#define write_short_via_xc_ptr(p,x) write_short_via_xc_ptr_indexed(p, 0, x) + +#define read_via_xc_ptr_indexed(x,p,i) asm("ldw %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); +#define read_byte_via_xc_ptr_indexed(x,p,i) asm("ld8u %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); +#define read_short_via_xc_ptr_indexed(x,p,i) asm("ld16s %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); + +#define read_via_xc_ptr(x,p) asm("ldw %0, %1[0]":"=r"(x):"r"(p)); +// No immediate ld8u format +#define read_byte_via_xc_ptr(x,p) read_byte_via_xc_ptr_indexed(x, p, 0) +#define read_short_via_xc_ptr(x,p) read_short_via_xc_ptr_indexed(x, p, 0) + +#define GET_SHARED_GLOBAL(x, g) asm volatile("ldw %0, dp[" #g "]":"=r"(x)::"memory") +#define SET_SHARED_GLOBAL(g, v) asm volatile("stw %0, dp[" #g "]"::"r"(v):"memory") + +#endif From f880046025733eec6dcf83bfc4eaf248a943cb07 Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 25 Oct 2019 11:50:48 +0100 Subject: [PATCH 070/520] Remaned XUD_G_Crc.S --- lib_xud/src/core/XUD_CrcAddrCheck.S | 60 +++++++++++++++++++++++++++++ lib_xud/src/core/XUD_G_Crc.S | 39 ------------------- 2 files changed, 60 insertions(+), 39 deletions(-) create mode 100644 lib_xud/src/core/XUD_CrcAddrCheck.S delete mode 100644 lib_xud/src/core/XUD_G_Crc.S diff --git a/lib_xud/src/core/XUD_CrcAddrCheck.S b/lib_xud/src/core/XUD_CrcAddrCheck.S new file mode 100644 index 00000000..4719bcb8 --- /dev/null +++ b/lib_xud/src/core/XUD_CrcAddrCheck.S @@ -0,0 +1,60 @@ +// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// On Entry: +#if 0 +//CrcAddrCheck: // Extract 11 bits for CRC5: | EP(4) | ADDR(7) | + ldw r1, dp[crcmask] + in r10, res[RXD] + shr r10, r10, 16 + and r11, r10, r1 + + ldaw r8, dp[crc5Table_Addr] + ld8u r8, r8[r11] // Correct CRC + + shr r4, r10, 5 + shr r4, r4, 6 // Received CRC + + xor r4, r4, r8 // R4 set to 0 in L code with in from valid tok port + bt r4, BadCrcAddr + +//ExtractEP: + shr r10, r11, 7 + +#elif 1 +//CrcAddrCheck: // Extract 11 bits for CRC5: | EP(4) | ADDR(7) | + ldc r1, 11 + in r10, res[RXD] + {shr r10, r10, 16; mkmsk r11, r1} + {and r11, r10, r11; shr r4, r10, r1} // r4: Received CRC + + ldaw r8, dp[crc5Table_Addr] + ld8u r8, r8[r11] // Correct CRC + + xor r4, r4, r8 // R4 set to 0 in L code with in from valid tok port + {BRFF_ru6 r4, 5; shr r10, r11, 7} // Extract EP number + +//waitforRXALow0: + ldw r11, sp[10] + in r10, res[r11] + bt r10, waitforRXALow0 + setc res[RXD], XS1_SETC_RUN_CLRBUF + bu Loop_BadPid + + +#else + in r10, res[RXD] + ldaw r1, dp[crc5Table_Addr] + ldc r8, 30 + lmul r11, r10, r10, r8, r10, r10 // r11 is CRC5, r10 is EP(4):ADDR(7):CRAP(16):0(5) + shr r10, r10, 16 // r10 is 0(16):EP(4):ADDR(7):CRAP(5) + shr r10, r10, 5 // r10 is 0(21):EP(4):ADDR(7) + ld8u r8, r1[r10] // r8 is CRC of r10 + sub r4, r11, r8 // R4 set to 0 in L code with in from valid tok port + //bt r4, BadCrcAddr +//ExtractEP: + shr r10, r10, 7 + +#endif + +// Required on exit: +// r4: 0 +// r10: Extracted EP number diff --git a/lib_xud/src/core/XUD_G_Crc.S b/lib_xud/src/core/XUD_G_Crc.S deleted file mode 100644 index e4a7c3c5..00000000 --- a/lib_xud/src/core/XUD_G_Crc.S +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved -// On Entry: -// ldw r1, dp[crcmask] -#if 0 -//CrcAddrCheck: // Extract 11 bits for CRC5: | EP(4) | ADDR(7) | - in r10, res[RXD] - shr r10, r10, 16 - and r11, r10, r1 - - ldaw r8, dp[crc5Table_Addr] - ld8u r8, r8[r11] // Correct CRC - - shr r4, r10, 5 - shr r4, r4, 6 // Received CRC - //eq r6, r6, r8 - xor r4, r4, r8 // R4 set to 0 in L code with in from valid tok port - bt r4, BadCrcAddr - -//ExtractEP: - shr r10, r11, 7 - -#else - in r10, res[RXD] - ldaw r1, dp[crc5Table_Addr] - ldc r8, 30 - lmul r11, r10, r10, r8, r10, r10 // r11 is CRC5, r10 is EP(4):ADDR(7):CRAP(16):0(5) - shr r10, r10, 16 // r10 is 0(16):EP(4):ADDR(7):CRAP(5) - shr r10, r10, 5 // r10 is 0(21):EP(4):ADDR(7) - ld8u r8, r1[r10] // r8 is CRC of r10 - sub r4, r11, r8 // R4 set to 0 in L code with in from valid tok port - bt r4, BadCrcAddr -//ExtractEP: - shr r10, r10, 7 - -#endif - -// Required on exit: -// r4: 0 -// r10: Extracted EP number From dff8bca6cdb37e741ef7a64cdd1f50e3104c60c0 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 22 Apr 2020 15:33:42 +0100 Subject: [PATCH 071/520] Fix to XS2 build. Verified with HID example --- lib_xud/module_build_info | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xud/module_build_info b/lib_xud/module_build_info index d5342549..ebe895e9 100644 --- a/lib_xud/module_build_info +++ b/lib_xud/module_build_info @@ -13,7 +13,7 @@ MODULE_XCC_FLAGS = $(XCC_FLAGS) -O3 -DREF_CLK_FREQ=100 -fasm-linenum -fcomment-a XCC_FLAGS_XUD_IoLoop.S = $(MODULE_XCC_FLAGS) -fschedule -g0 -EXCLUDE_FILES += XUD_Token_In.S XUD_Token_Ping.S XUD_Token_SOF.S XUD_Token_Out.S XUD_Token_Setup.S XUD_G_Crc.S XUD_TokenJmp.S XUD_PidJumpTable.S XUD_Token_In_DI.S +EXCLUDE_FILES += XUD_Token_In.S XUD_Token_Ping.S XUD_Token_SOF.S XUD_Token_Out.S XUD_Token_Setup.S XUD_G_Crc.S XUD_TokenJmp.S XUD_PidJumpTable.S XUD_Token_In_DI.S XUD_CrcAddrCheck.S OPTIONAL_HEADERS += xud_conf.h From 7b271719919ee38126b20dfc026ef80a393fddc5 Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 25 Oct 2019 11:53:07 +0100 Subject: [PATCH 072/520] Conficted merge --- lib_xud/module_build_info | 2 +- lib_xud/src/core/XUD_IoLoop.S | 34 ++--- lib_xud/src/core/included/XUD_Token_In_DI.S | 2 +- lib_xud/src/core/included/XUD_Token_Out.S | 13 +- lib_xud/src/core/included/XUD_Token_Ping.S | 12 +- lib_xud/src/core/included/XUD_Token_Setup.S | 4 +- .../src/core/included/XUD_Token_Setup_DI.S | 136 ++++++++++++++++++ lib_xud/src/user/client/XUD_EpFuncs.S | 10 +- tests/test_control_basic_get.py | 44 ++++++ tests/test_control_basic_get.py_ | 54 ------- tests/test_control_basic_get/Makefile | 50 +------ tests/test_control_basic_get/src/main.xc | 57 ++++---- tests/test_control_basic_get/src/test_xs3.xn | 24 ++++ tests/test_control_basic_set.py | 37 +++++ tests/test_control_basic_set.py_ | 54 ------- tests/test_control_basic_set/Makefile | 50 +------ tests/test_control_basic_set/src/main.xc | 73 +++++----- tests/test_control_basic_set/src/test_xs3.xn | 24 ++++ tests/usb_packet.py | 18 +-- 19 files changed, 370 insertions(+), 328 deletions(-) create mode 100644 lib_xud/src/core/included/XUD_Token_Setup_DI.S create mode 100644 tests/test_control_basic_get.py delete mode 100644 tests/test_control_basic_get.py_ create mode 100644 tests/test_control_basic_get/src/test_xs3.xn create mode 100644 tests/test_control_basic_set.py delete mode 100644 tests/test_control_basic_set.py_ create mode 100644 tests/test_control_basic_set/src/test_xs3.xn diff --git a/lib_xud/module_build_info b/lib_xud/module_build_info index ebe895e9..d9aadbce 100644 --- a/lib_xud/module_build_info +++ b/lib_xud/module_build_info @@ -13,7 +13,7 @@ MODULE_XCC_FLAGS = $(XCC_FLAGS) -O3 -DREF_CLK_FREQ=100 -fasm-linenum -fcomment-a XCC_FLAGS_XUD_IoLoop.S = $(MODULE_XCC_FLAGS) -fschedule -g0 -EXCLUDE_FILES += XUD_Token_In.S XUD_Token_Ping.S XUD_Token_SOF.S XUD_Token_Out.S XUD_Token_Setup.S XUD_G_Crc.S XUD_TokenJmp.S XUD_PidJumpTable.S XUD_Token_In_DI.S XUD_CrcAddrCheck.S +EXCLUDE_FILES += XUD_Token_In.S XUD_Token_Ping.S XUD_Token_SOF.S XUD_Token_Out.S XUD_Token_Setup.S XUD_CrcAddrCheck.S XUD_TokenJmp.S XUD_PidJumpTable.S XUD_Token_In_DI.S XUD_Token_Setup_DI.S OPTIONAL_HEADERS += xud_conf.h diff --git a/lib_xud/src/core/XUD_IoLoop.S b/lib_xud/src/core/XUD_IoLoop.S index 35c8996b..610e13b0 100755 --- a/lib_xud/src/core/XUD_IoLoop.S +++ b/lib_xud/src/core/XUD_IoLoop.S @@ -185,17 +185,34 @@ ResetIntHandler: #if defined(__XS2A__) .issue_mode single #include "./included/XUD_Token_In.S" +#include "./included/XUD_Token_Setup.S" #elif defined(__XS3A__) .issue_mode dual #include "./included/XUD_Token_In_DI.S" +#include "./included/XUD_Token_Setup_DI.S" #endif // Note, included here so in same elimination blocks to avoid long jumps #include "./included/XUD_Token_Out.S" #include "./included/XUD_Token_Ping.S" -#include "./included/XUD_Token_Setup.S" #include "./included/XUD_Token_SOF.S" +BadCrcAddr: + // zext r11, 8 + // ldc r10, PIDn_SOF + // eq r11, r11, r10 + //ecallt r11 + //bt r11, Pid_Sof_NoChan // TODO we should really CRC SOFs + + ldw r11, sp[10] +waitforRXALow0: + in r10, res[r11] + bt r10, waitforRXALow0 + setc res[RXD], XS1_SETC_RUN_CLRBUF + bu Loop_BadPid + + + .align 4 XUD_LLD_IoLoop: #if defined(__XS2A__) @@ -226,8 +243,6 @@ ConfigRxDEventVector: // Configure events ldap r11, TxHandShakeReceived setv res[RXD], r11 - - ConfigRxA: setc res[RXA], XS1_SETC_COND_EQ setc res[RXA], XS1_SETC_IE_MODE_EVENT @@ -394,19 +409,6 @@ BranchOnTokenPid: #include "XUD_TokenJmp.S" -BadCrcAddr: - // zext r11, 8 - // ldc r10, PIDn_SOF - // eq r11, r11, r10 - //ecallt r11 - //bt r11, Pid_Sof_NoChan // TODO we should really CRC SOFs - - ldw r11, sp[10] -waitforRXALow0: - in r10, res[r11] - bt r10, waitforRXALow0 - setc res[RXD], XS1_SETC_RUN_CLRBUF - bu Loop_BadPid #endif diff --git a/lib_xud/src/core/included/XUD_Token_In_DI.S b/lib_xud/src/core/included/XUD_Token_In_DI.S index 28f3777e..7f5885dd 100755 --- a/lib_xud/src/core/included/XUD_Token_In_DI.S +++ b/lib_xud/src/core/included/XUD_Token_In_DI.S @@ -40,7 +40,7 @@ XUD_IN_TxNak: // Non-Iso .align 256 .skip 156 Pid_In: - #include "XUD_G_Crc.S" + #include "XUD_CrcAddrCheck.S" ldaw r3, r10[4] // R3 = R10 + 16 ldw r4, r5[r3] // Load EP structure address bf r4, InNotReady // If 0 then not ready... diff --git a/lib_xud/src/core/included/XUD_Token_Out.S b/lib_xud/src/core/included/XUD_Token_Out.S index 4de45be0..99007bf6 100755 --- a/lib_xud/src/core/included/XUD_Token_Out.S +++ b/lib_xud/src/core/included/XUD_Token_Out.S @@ -8,23 +8,14 @@ .align 8 .skip 0 Pid_Out: -#ifdef ARCH_L - inpw r10, res[RXD], 8; // Read EP Number */ - shr r10, r10, 24; // Shift off junk */ - - in r4, res[r1]; - bt r4, InvalidToken; // If VALID_TOKEN not high, ignore token */ -#else - // ARCH_G - #include "XUD_G_Crc.S" -#endif + #include "XUD_CrcAddrCheck.S" ldw r3, r5[r10] // Load relevant EP pointer bf r3, XUD_TokenOut_BufferFull ldw r1, r3[3] // Load buffer from EP structure CheckEpTypeOut: ldw r11, r3[5] // Load EP type - bt r11, DoOutNonIso // ISO endpoint + BRFT_ru6 r11, DoOutNonIso // ISO endpoint OutReady: stw r11, r5[r10] // Clear ready straight away - we don't to CRC checking on Iso - else we would have to wait for end of packet diff --git a/lib_xud/src/core/included/XUD_Token_Ping.S b/lib_xud/src/core/included/XUD_Token_Ping.S index d1ae1cbe..0e23153c 100755 --- a/lib_xud/src/core/included/XUD_Token_Ping.S +++ b/lib_xud/src/core/included/XUD_Token_Ping.S @@ -1,15 +1,7 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved .align 4 Pid_Ping: -#ifdef ARCH_L - inpw r10, res[RXD], 8; // Read EP Number - shr r10, r10, 24; // Shift off junk - - in r11, res[r1]; - bt r11, InvalidToken; // VALID_TOKEN not high, ignore token -#else - #include "XUD_G_Crc.S" -#endif + #include "XUD_CrcAddrCheck.S" LoadStatTablePing: ldw r11, r5[r10] // Load relevant EP chanend diff --git a/lib_xud/src/core/included/XUD_Token_Setup.S b/lib_xud/src/core/included/XUD_Token_Setup.S index 54f3e921..3cbce33b 100644 --- a/lib_xud/src/core/included/XUD_Token_Setup.S +++ b/lib_xud/src/core/included/XUD_Token_Setup.S @@ -37,7 +37,7 @@ GotRxPid: NextRxWord: // RXD port has event vector here in r11, res[r0] stw r11, r1[r4] - crc32_inc r6, r11, r9, r4, 1 + crc32_inc r6, r11, r9, r4, 1 bu NextRxWord ///////////////////////////////////////////////////////////////////////////// @@ -126,7 +126,7 @@ NextRxWord: // RXD port has event vector here .align 16 .skip 8 RxALow: - in r7, res[r7] // Clear event data on RXA + in r7, res[r7] // Clear event data on RXA endin r8, res[r0] XUD_OUT_RxTail: in r11, res[r0] diff --git a/lib_xud/src/core/included/XUD_Token_Setup_DI.S b/lib_xud/src/core/included/XUD_Token_Setup_DI.S new file mode 100644 index 00000000..d2dbdec0 --- /dev/null +++ b/lib_xud/src/core/included/XUD_Token_Setup_DI.S @@ -0,0 +1,136 @@ +// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved + +.text + +// r3: Ep structure +// r5: buffer address +// RXD: Rx Data port +// r4: zero +// r5: ep structures array +// r6: crc rx init +// r7: crc tx init +// r9: crc poly +// r10: ep number +// r11: scratch +.align 4 +.skip 0 +doRXData: + ldw r7, sp[10] // Load RxA Port ID (r1) + inpw r8, res[r0], 8 // Input PID +GotRxPid: + {stw r8, r3[6]; eeu res[r7]} // Store (NON-SHIFTED) PID into EP structure + setsr 1 // Enable thread events + +NextRxWord: // RXD port has event vector here + in r11, res[r0] + stw r11, r1[r4] + crc32_inc r6, r11, r9, r4, 1 + bu NextRxWord + +///////////////////////////////////////////////////////////////////////////// +.align 32 +.skip 16 +RxALow: + in r7, res[r7] // Clear event data on RXA + endin r8, res[r0] +XUD_OUT_RxTail: + {in r11, res[r0]; bru r8} + +// Word aligned data (0 byte tail) +.align 32 +OutTail0: + crc32 r6, r8, r9 // CRC zero step + ldc r11, 0x7000 // Load relevant CRC magic number + retsp 0 + +// 1 Tail Byte +.align 32 +OutTail1: + shr r11, r11, 24 // Shift off junk + crc32 r6, r11, r9 + stw r11, r1[r4] // Store last data + ldc r11, 0x80be // Load CRC magic number + retsp 0 + +// Two Tail Bytes +.align 32 +OutTail2: + shr r11, r11, 16 + crc32 r6, r11, r9 + stw r11, r1[r4] // Store last data + ldc r11, 0x3ffe + retsp 0 + +// Three Tail Bytes +.align 32 +OutTail3: + shr r11, r11, 8 + stw r11, r1[r4] // Store last data + crc32 r6, r11, r9 + ldw r11, sp[12] + crc8 r6, r1, r2, r9 // Use the fact the the bottom byte of port id is 0.. saves us an ldc + retsp 0 + +// Four Tail Bytes +.align 32 +OutTail4: + bu ERR_EndIn4 + +// Five Tail Bytes +.align 32 +OutTail5: + bu ERR_EndIn5 + + +// We received a setup token. This is much the same as out token, apart from: +// - Can't NAK a setup +// - Data PID will always be DATA0 +// - Payload will always be 8 bytes +.align 4 +Pid_Setup: + #include "XUD_CrcAddrCheck.S" + ldw r3, r5[r10] // Load relevant EP pointer + bf r3, SBuffFull + ldw r1, r3[3] // Load buffer + +LoadSetupBuffer: + bl doRXData // RXData writes available data to buffer and does crc check. + // r8: Data tail size (bytes) + {clre; eq r1, r6, r11} // Check for good CRC16 + bf r1, NextTokenAfterOut // Check for bad crc + +ClearStall: // CRC OK + // Have received a SETUP so clear any STALL condition on IN/OUT endpoint. + ldaw r11, dp[handshakeTable_OUT] // Note, we can speed this up by assuming SETUP only received on EP 0 + ldc r6, USB_PIDn_NAK + stw r6, r11[r10] + ldaw r11, dp[handshakeTable_IN] + stw r6, r11[r10] + +SendSetupAck: + ldc r11, USB_PIDn_ACK + outpw res[TXD], r11, 8 + +StoreTailData: // TODO: don't assume setups are 8 bytes + crc + ldc r11, 0 + stw r11, r5[r10] // Clear ready + ldw r11, r3[1] // Load chanend + + out res[r11], r4 + outct res[r11], 0 // Send zero control token for SETUP. Tail ignored since always expect 8 bytes + bu NextTokenAfterOut // Go to next wait for next token + +SBuffFull: + ldc r11, 0 + ldw r10, sp[10] // Load RxA Port ID (r1) + in r11, res[r10] // RXA event cond = 0 TODO: Wait for RXA high first? + endin r11, res[RXD] + in r11, res[RXD] + bu NextTokenAfterOut + +BadDataCrcSetup: + mov r0, r1 + bl ERR_BadCrc + outct res[r5], 9 + in r11, res[r5] // TODO should only need CT + bu NextToken diff --git a/lib_xud/src/user/client/XUD_EpFuncs.S b/lib_xud/src/user/client/XUD_EpFuncs.S index fff0451e..4df51807 100644 --- a/lib_xud/src/user/client/XUD_EpFuncs.S +++ b/lib_xud/src/user/client/XUD_EpFuncs.S @@ -51,7 +51,7 @@ XUD_GetSetupData_NoReq: // Entry for _NoReq // TODO.. XUD_GetSetupData_ResetPid: // We must reset PID toggling on SETUP (both IN AND OUT) -#if (XUD_SERIES_SUPPORT==3) +#ifdef __XS3A__ ldc r11, USB_PIDn_DATA1 #else ldc r11, USB_PID_DATA1 @@ -220,8 +220,8 @@ XUD_GetData_GotSetup: // We expect data0 else something gone wrong... // TODO.. -XUD_GetDataSetupData_ResetPid: // We must reset PID toggling on SETUP (both IN AND OUT) -#if (XUD_SERIES_SUPPORT==3) +XUD_GetDataSetupData_ResetPid: // We must reset PID toggling on SETUP (both IN AND OUT) +#ifdef __XS3A__ ldc r11, USB_PIDn_DATA1 #else ldc r11, USB_PID_DATA1 @@ -589,7 +589,6 @@ XUD_ClearStallByAddr_OUT: ldaw r1, dp[handshakeTable_OUT] stw r2, r1[r0] -//#if(XUD_SERIES_SUPPORT==3) #ifdef __XS3A__ ldc r1, USB_PIDn_DATA0 #else @@ -645,8 +644,7 @@ XUD_ResetEpStateByAddr: ldc r1, USB_PIDn_DATA0 bu XUD_ResetEpStateByAddr_ XUD_ResetEpStateByAddr_OUT: -//#if(XUD_SERIES_SUPPORT==3) -#if defined(__XS1A__) //G-series +#if defined(__XS3A__) ldc r1, USB_PIDn_DATA0 #else ldc r1, USB_PID_DATA0 diff --git a/tests/test_control_basic_get.py b/tests/test_control_basic_get.py new file mode 100644 index 00000000..f8137d85 --- /dev/null +++ b/tests/test_control_basic_get.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python + +import random +import xmostest +from usb_packet import * +import usb_packet +from usb_clock import Clock +from helpers import do_usb_test, runall_rx + +# Single, setup transaction to EP 0 + +def do_test(arch, clk, phy, seed): + rand = random.Random() + rand.seed(seed) + + + ep = 0 + address = 1 + + # The inter-frame gap is to give the DUT time to print its output + packets = [] + + # SETUP transaction + AppendSetupToken(packets, ep, address) + packets.append(TxDataPacket(rand, length=8, pid=3)) + packets.append(RxHandshakePacket()) + + # IN transaction + # Note, quite big gap to avoid nak + AppendInToken(packets, ep, address, inter_pkt_gap = 10000) + packets.append(RxDataPacket(rand, length=10, pid=0xb)) + packets.append(TxHandshakePacket()) + + # Send 0 length OUT transaction + AppendOutToken(packets, ep, address) + packets.append(TxDataPacket(rand, length=0, pid=PID_DATA1)) + packets.append(RxHandshakePacket()) + + do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) + + +def runtest(): + random.seed(1) + runall_rx(do_test) diff --git a/tests/test_control_basic_get.py_ b/tests/test_control_basic_get.py_ deleted file mode 100644 index 811b9de7..00000000 --- a/tests/test_control_basic_get.py_ +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env python - -import random -import xmostest -from usb_packet import AppendSetupToken, TxDataPacket, RxDataPacket, TokenPacket, RxHandshakePacket, TxHandshakePacket -from usb_clock import Clock -from helpers import do_rx_test, packet_processing_time, get_dut_address -from helpers import choose_small_frame_size, check_received_packet, runall_rx - - -# Single, setup transaction to EP 0 - -def do_test(arch, tx_clk, tx_phy, seed): - rand = random.Random() - rand.seed(seed) - - ep = 0 - - # The inter-frame gap is to give the DUT time to print its output - packets = [] - - # SETUP transaction - AppendSetupToken(packets, ep) - packets.append(TxDataPacket(rand, length=8, pid=3)) - packets.append(RxHandshakePacket(timeout=11)) - - # IN transaction - # Note, quite big gap to allow checking. - packets.append(TokenPacket( - inter_pkt_gap=2000, - pid=0x69, #IN - endpoint=ep)) - packets.append(RxDataPacket(rand, length=10, pid=0x4b)) - packets.append(TxHandshakePacket()) - - # Send 0 length OUT transaction - packets.append(TokenPacket( - inter_pkt_gap=2000, - pid=0xe1, #OUT - endpoint=ep)) - packets.append(TxDataPacket(rand, length=0, pid=0xb)) - packets.append(RxHandshakePacket()) - - - - # Send ACK - packets.append(TxHandshakePacket()) - - do_rx_test(arch, tx_clk, tx_phy, packets, __file__, seed, - level='smoke', extra_tasks=[]) - -def runtest(): - random.seed(1) - runall_rx(do_test) diff --git a/tests/test_control_basic_get/Makefile b/tests/test_control_basic_get/Makefile index 83edfc42..1dcd7b5d 100644 --- a/tests/test_control_basic_get/Makefile +++ b/tests/test_control_basic_get/Makefile @@ -1,50 +1,2 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. +include ../test_makefile.mak -TARGET = test.xn - -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name - -APP_NAME = - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. - -SHARED_CODE = ../../shared_src - -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L - -XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES - -XCC_FLAGS_xs1 = $(COMMON_FLAGS) -DARCH_S -DXUD_SERIES_SUPPORT=XUD_U_SERIES - - - -ifeq ($(CONFIG),$(filter $(CONFIG),xs1)) - TARGET = test_xs1.xn -endif - -ifeq ($(CONFIG),$(filter $(CONFIG),xs2)) - TARGET = test.xn -endif - - - -# The USED_MODULES variable lists other module used by the application. -USED_MODULES = lib_xud - - -#============================================================================= -# The following part of the Makefile includes the common build infrastructure -# for compiling XMOS applications. You should not need to edit below here. - -XMOS_MAKE_PATH ?= ../.. -include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common diff --git a/tests/test_control_basic_get/src/main.xc b/tests/test_control_basic_get/src/main.xc index c0e614ee..e087b894 100644 --- a/tests/test_control_basic_get/src/main.xc +++ b/tests/test_control_basic_get/src/main.xc @@ -33,65 +33,53 @@ int TestEp_Control(chanend c_out, chanend c_in, int epNum) { unsigned int slength; unsigned int length; + XUD_Result_t sres; XUD_Result_t res; XUD_ep c_ep0_out = XUD_InitEp(c_out); XUD_ep c_ep0_in = XUD_InitEp(c_in); /* Buffer for Setup data */ + unsigned char sbuffer[120]; unsigned char buffer[120]; unsafe { /* Wait for Setup data */ - res = XUD_GetControlBuffer(c_ep0_out, buffer, slength); + sres = XUD_GetSetupBuffer(c_ep0_out, sbuffer, slength); - if(slength != 8) - { - printintln(length); - fail(FAIL_RX_DATAERROR); - } - - if(res != XUD_RES_CTL) - { - fail(FAIL_RX_EXPECTED_CTL); - } + res = SendTxPacket(c_ep0_in, 10, epNum); + + res = XUD_GetBuffer(c_ep0_out, buffer, length); - if(RxDataCheck(buffer, slength, epNum)) + if(length != 0) { fail(FAIL_RX_DATAERROR); } - - /* Send 0 length back */ - res = SendControlPacket(c_ep0_in, 10, epNum); - + + /* Do some checking */ if(res != XUD_RES_OKAY) { fail(FAIL_RX_BAD_RETURN_CODE); } - res = XUD_GetControlBuffer(c_ep0_out, buffer, slength); - - if(slength != 0) + if(slength != 8) { + printintln(length); fail(FAIL_RX_DATAERROR); } - - if(RxDataCheck(buffer, length, epNum)) + + if(RxDataCheck(sbuffer, slength, epNum)) { fail(FAIL_RX_DATAERROR); } + + XUD_Kill(c_ep0_out); - if(res != XUD_RES_OKAY) - { - fail(FAIL_RX_BAD_RETURN_CODE); - } - - exit(0); + return 0; } } -#define USB_CORE 0 int main() { chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; @@ -102,8 +90,17 @@ int main() XUD_Manager( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); - - TestEp_Control(c_ep_out[0], c_ep_in[0], 0); + + { + int fail = TestEp_Control(c_ep_out[0], c_ep_in[0], 0); + + if(fail) + TerminateFail(fail); + else + TerminatePass(fail); + + exit(0); + } } return 0; diff --git a/tests/test_control_basic_get/src/test_xs3.xn b/tests/test_control_basic_get/src/test_xs3.xn new file mode 100644 index 00000000..ab436573 --- /dev/null +++ b/tests/test_control_basic_get/src/test_xs3.xn @@ -0,0 +1,24 @@ + + + + tileref tile[2] + + + + + + + + + + + + + + + + + + diff --git a/tests/test_control_basic_set.py b/tests/test_control_basic_set.py new file mode 100644 index 00000000..1909a03d --- /dev/null +++ b/tests/test_control_basic_set.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python + +import random +import xmostest +from usb_packet import * +import usb_packet +from usb_clock import Clock +from helpers import do_usb_test, runall_rx + +def do_test(arch, tx_clk, tx_phy, seed): + rand = random.Random() + rand.seed(seed) + + ep = 0 + address = 1 + + packets = [] + + AppendSetupToken(packets, ep, address) + packets.append(TxDataPacket(rand, length=8, pid=3)) + packets.append(RxHandshakePacket(timeout=11)) + + # Note, quite big gap to avoid NAL + AppendOutToken(packets, ep, address, inter_pkt_gap = 10000) + packets.append(TxDataPacket(rand, length=10, pid=0xb, data_start_val=8)) + packets.append(RxHandshakePacket()) + + #Expect 0-length + AppendInToken(packets, ep, address, inter_pkt_gap = 10000) + packets.append(RxDataPacket(rand, length=0, pid=0xb)) + packets.append(TxHandshakePacket()) + + do_usb_test(arch, tx_clk, tx_phy, packets, __file__, seed, level='smoke', extra_tasks=[]) + +def runtest(): + random.seed(1) + runall_rx(do_test) diff --git a/tests/test_control_basic_set.py_ b/tests/test_control_basic_set.py_ deleted file mode 100644 index 468e398b..00000000 --- a/tests/test_control_basic_set.py_ +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/env python - -import random -import xmostest -from usb_packet import AppendSetupToken, TxDataPacket, RxDataPacket, TokenPacket, RxHandshakePacket, TxHandshakePacket -from usb_clock import Clock -from helpers import do_rx_test, packet_processing_time, get_dut_address -from helpers import choose_small_frame_size, check_received_packet, runall_rx - - -# Single, setup transaction to EP 0 - -def do_test(arch, tx_clk, tx_phy, seed): - rand = random.Random() - rand.seed(seed) - - ep = 0 - - # The inter-frame gap is to give the DUT time to print its output - packets = [] - - AppendSetupToken(packets, ep) - - packets.append(TxDataPacket(rand, length=8, pid=3)) - packets.append(RxHandshakePacket(timeout=11)) - - # Note, quite big gap to allow checking. - - packets.append(TokenPacket( - inter_pkt_gap=2000, - pid=0xe1, #OUT - endpoint=ep)) - - packets.append(TxDataPacket(rand, length=10, pid=0xb)) - - packets.append(RxHandshakePacket()) - - packets.append(TokenPacket( - inter_pkt_gap=2000, - pid=0x69, #IN - endpoint=ep)) - - #Expect 0-length - packets.append(RxDataPacket(rand, length=0, pid=0x4b)) - - # Send ACK - packets.append(TxHandshakePacket()) - - do_rx_test(arch, tx_clk, tx_phy, packets, __file__, seed, - level='smoke', extra_tasks=[]) - -def runtest(): - random.seed(1) - runall_rx(do_test) diff --git a/tests/test_control_basic_set/Makefile b/tests/test_control_basic_set/Makefile index 83edfc42..1dcd7b5d 100644 --- a/tests/test_control_basic_set/Makefile +++ b/tests/test_control_basic_set/Makefile @@ -1,50 +1,2 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. +include ../test_makefile.mak -TARGET = test.xn - -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name - -APP_NAME = - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. - -SHARED_CODE = ../../shared_src - -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L - -XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES - -XCC_FLAGS_xs1 = $(COMMON_FLAGS) -DARCH_S -DXUD_SERIES_SUPPORT=XUD_U_SERIES - - - -ifeq ($(CONFIG),$(filter $(CONFIG),xs1)) - TARGET = test_xs1.xn -endif - -ifeq ($(CONFIG),$(filter $(CONFIG),xs2)) - TARGET = test.xn -endif - - - -# The USED_MODULES variable lists other module used by the application. -USED_MODULES = lib_xud - - -#============================================================================= -# The following part of the Makefile includes the common build infrastructure -# for compiling XMOS applications. You should not need to edit below here. - -XMOS_MAKE_PATH ?= ../.. -include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common diff --git a/tests/test_control_basic_set/src/main.xc b/tests/test_control_basic_set/src/main.xc index 792eef52..64bb03a5 100644 --- a/tests/test_control_basic_set/src/main.xc +++ b/tests/test_control_basic_set/src/main.xc @@ -18,11 +18,7 @@ #define XUD_EP_COUNT_IN 5 /* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, - XUD_EPTYPE_BUL, - XUD_EPTYPE_ISO, - XUD_EPTYPE_BUL, - XUD_EPTYPE_BUL}; +XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; @@ -33,65 +29,63 @@ int TestEp_Control(chanend c_out, chanend c_in, int epNum) { unsigned int slength; unsigned int length; + + XUD_Result_t sres; XUD_Result_t res; XUD_ep c_ep0_out = XUD_InitEp(c_out); XUD_ep c_ep0_in = XUD_InitEp(c_in); - /* Buffer for Setup data */ + unsigned char sbuffer[120]; unsigned char buffer[120]; unsafe { /* Wait for Setup data */ - res = XUD_GetControlBuffer(c_ep0_out, buffer, slength); + sres = XUD_GetSetupBuffer(c_ep0_out, sbuffer, slength); - if(slength != 8) + res = XUD_GetBuffer(c_ep0_out, buffer, length); + + res = SendTxPacket(c_ep0_in, 0, epNum); + + /* Checking for the Setup */ + if(sres != XUD_RES_OKAY) { - printintln(length); - fail(FAIL_RX_DATAERROR); + return 1; } - - if(res != XUD_RES_CTL) + + if(slength != 8) { - fail(FAIL_RX_EXPECTED_CTL); + return 1; } - if(RxDataCheck(buffer, slength, epNum)) + if(RxDataCheck(sbuffer, slength, epNum)) { - fail(FAIL_RX_DATAERROR); + return 1; } - res = XUD_GetControlBuffer(c_ep0_out, buffer, slength); - - if(slength != 10) + /* Checking for the OUT buffer */ + if(res != XUD_RES_OKAY) { - fail(FAIL_RX_DATAERROR); + return 1; } - if(RxDataCheck(buffer, length, epNum)) + if(length != 10) { - fail(FAIL_RX_DATAERROR); + return 1; } - - if(res != XUD_RES_OKAY) + + if(RxDataCheck(buffer, length, epNum)) { - fail(FAIL_RX_BAD_RETURN_CODE); + return 1; } - /* Send 0 length back */ - res = SendControlPacket(c_ep0_in, 0, epNum); - - if(res != XUD_RES_OKAY) - { - fail(FAIL_RX_BAD_RETURN_CODE); - } + XUD_Kill(c_ep0_out); - exit(0); + return 0; } } -#define USB_CORE 0 int main() { chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; @@ -103,8 +97,15 @@ int main() null, epTypeTableOut, epTypeTableIn, null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); - TestEp_Control(c_ep_out[0], c_ep_in[0], 0); - } + { + int fail = TestEp_Control(c_ep_out[0], c_ep_in[0], 0); + + if (fail) + TerminateFail(fail); + else + TerminatePass(fail); - return 0; + exit(0); + } + } } diff --git a/tests/test_control_basic_set/src/test_xs3.xn b/tests/test_control_basic_set/src/test_xs3.xn new file mode 100644 index 00000000..ab436573 --- /dev/null +++ b/tests/test_control_basic_set/src/test_xs3.xn @@ -0,0 +1,24 @@ + + + + tileref tile[2] + + + + + + + + + + + + + + + + + + diff --git a/tests/usb_packet.py b/tests/usb_packet.py index d14e4c99..867fab38 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -16,7 +16,6 @@ def AppendSetupToken(packets, ep, address, **kwargs): ipg = kwargs.pop('inter_pkt_gap', 500) - address = kwargs.pop('address', 0) AppendTokenPacket(packets, 0x2d, ep, ipg, address) def AppendOutToken(packets, ep, address, **kwargs): @@ -183,6 +182,8 @@ def get_pid_pretty(self): return "PING" elif self.pid == 165: return "SOF" + elif self.pid == 45: + return "SETUP" else: return "UNKNOWN" @@ -211,16 +212,15 @@ def __init__(self, **kwargs): def get_inter_pkt_gap(self): return self.inter_pkt_gap -# Implemented such that we can generate broken or bad packets +# Implemented such that we can generate malformed packets def get_bytes(self, do_tokens=False): - print "GET BYTES\n" bytes = [] - #if do_tokens: - # bytes.append(self.pid) - #else: - # bytes.append(self.pid | ((~self.pid) << 4)) - # for x in range(len(self.data_bytes)): - # bytes.append(self.data_bytes[x]) + if do_tokens: + bytes.append(self.pid) + else: + bytes.append(self.pid | ((~self.pid) << 4)) + for x in range(len(self.data_bytes)): + bytes.append(self.data_bytes[x]) return bytes From ebad8ce8e3c087c52dd7af40ef41f6abcf36de20 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 22 Apr 2020 15:46:21 +0100 Subject: [PATCH 073/520] Fix to XS2 build. Verified with HID example --- lib_xud/src/core/XUD_CrcAddrCheck.S | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib_xud/src/core/XUD_CrcAddrCheck.S b/lib_xud/src/core/XUD_CrcAddrCheck.S index 4719bcb8..a323cb8d 100644 --- a/lib_xud/src/core/XUD_CrcAddrCheck.S +++ b/lib_xud/src/core/XUD_CrcAddrCheck.S @@ -1,5 +1,7 @@ // Copyright (c) 2011-2018, XMOS Ltd, All rights reserved // On Entry: +#ifdef __XS3A__ + #if 0 //CrcAddrCheck: // Extract 11 bits for CRC5: | EP(4) | ADDR(7) | ldw r1, dp[crcmask] @@ -52,7 +54,15 @@ //bt r4, BadCrcAddr //ExtractEP: shr r10, r10, 7 +#endif + + +#else // XS2 + inpw r10, res[RXD], 8; // Read EP Number + shr r10, r10, 24; // Shift off junk + in r11, res[r1]; + bt r11, InvalidToken; // If VALID_TOKEN not high, ignore token - PORT INVERTED! */ #endif // Required on exit: From a75cf9818f3cac72cf67cea8c06ff238515eeee4 Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 25 Oct 2019 11:53:43 +0100 Subject: [PATCH 074/520] Added test_sof_badcrc --- tests/test_sof_badcrc.py | 46 +++++++++ tests/test_sof_badcrc/LICENSE.txt | 135 ++++++++++++++++++++++++++ tests/test_sof_badcrc/Makefile | 1 + tests/test_sof_badcrc/src/main.xc | 108 +++++++++++++++++++++ tests/test_sof_badcrc/src/test.xn | 72 ++++++++++++++ tests/test_sof_badcrc/src/test_xs1.xn | 89 +++++++++++++++++ tests/test_sof_badcrc/src/test_xs2.xn | 72 ++++++++++++++ tests/test_sof_badcrc/src/test_xs3.xn | 24 +++++ 8 files changed, 547 insertions(+) create mode 100644 tests/test_sof_badcrc.py create mode 100644 tests/test_sof_badcrc/LICENSE.txt create mode 100644 tests/test_sof_badcrc/Makefile create mode 100644 tests/test_sof_badcrc/src/main.xc create mode 100644 tests/test_sof_badcrc/src/test.xn create mode 100755 tests/test_sof_badcrc/src/test_xs1.xn create mode 100644 tests/test_sof_badcrc/src/test_xs2.xn create mode 100644 tests/test_sof_badcrc/src/test_xs3.xn diff --git a/tests/test_sof_badcrc.py b/tests/test_sof_badcrc.py new file mode 100644 index 00000000..81c47deb --- /dev/null +++ b/tests/test_sof_badcrc.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python + +# Same as simple RX bulk test but some invalid tokens also included + +import random +import xmostest +from usb_packet import * +from usb_clock import Clock +from helpers import do_usb_test, runall_rx + + +# Single, setup transaction to EP 0 + +def do_test(arch, clk, phy, seed): + rand = random.Random() + rand.seed(seed) + + address = 1 + ep = 1 + framenumber = 52 # Note, for frame number 52 we expect A5 34 40 on the bus + + packets = [] + dataval = 0; + + # Start with a valid transaction */ + AppendOutToken(packets, ep, address) + packets.append(TxDataPacket(rand, data_start_val=dataval, length=10, pid=0x3)) #DATA0 + packets.append(RxHandshakePacket()) + + AppendSofToken(packets, framenumber) + AppendSofToken(packets, framenumber+1) + AppendSofToken(packets, framenumber+2) + AppendSofToken(packets, framenumber+3, crc5=0xff) # Invalidate the CRC + AppendSofToken(packets, framenumber+4) + + #Finish with valid transaction + dataval += 10 + AppendOutToken(packets, ep, address, inter_pkt_gap=6000) + packets.append(TxDataPacket(rand, data_start_val=dataval, length=11, pid=0xb)) #DATA1 + packets.append(RxHandshakePacket()) + + do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) + +def runtest(): + random.seed(1) + runall_rx(do_test) diff --git a/tests/test_sof_badcrc/LICENSE.txt b/tests/test_sof_badcrc/LICENSE.txt new file mode 100644 index 00000000..994856c9 --- /dev/null +++ b/tests/test_sof_badcrc/LICENSE.txt @@ -0,0 +1,135 @@ +Software Release License Agreement + +Copyright (c) 2015-2018, XMOS, All rights reserved. + +BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. + +Parties: + +(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). + +(2) An individual or legal entity exercising permissions granted by this License (Customer). + +If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. + +1. Definitions + +"License" means this Software License and any schedules or annexes to it. + +"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License + +"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. + +"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. + +"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. + +"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. + +The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. + +Unless the context otherwise requires: + +- references to XMOS and the Customer include their permitted successors and assigns; +- references to statutory provisions include those statutory provisions as amended or re-enacted; and +- references to any gender include all genders. + +Words in the singular include the plural and in the plural include the singular. + +2. License + +XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. + +Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. + +3. Consideration + +In consideration of the mutual obligations contained in this License, the parties agree to its terms. + +4. Term + +Subject to clause 12 below, this License shall be perpetual. + +5. Restrictions on Use + +The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. + +6. Modifications + +The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. + +XMOS will own all intellectual property rights in the XMOS Modifications. +The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. + +7. Support + +Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. + +8. Warranty and Disclaimer + +The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). + +Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. + +XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. + +9. High Risk Activities + +The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. + +10. Liability + +TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. + +Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. + +11. Ownership + +The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. + +12. Termination + +Either party may terminate this License at any time on written notice to the other if the other: + +- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or + +- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. + +Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. + +On termination for any reason: + +- all rights granted to the Customer under this License shall cease; +- the Customer shall cease all activities authorised by this License; +- the Customer shall immediately pay any sums due to XMOS under this License; and +- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. + +Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. + +13. Third party rights + +No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. + +14. Confidentiality and publicity + +Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. + +The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. +The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. + +15. Entire agreement + +This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. + +16. Assignment + +The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. + +17. Governing law and jurisdiction + +This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. + +This License has been entered into on the date stated at the beginning of it. + +Schedule +XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_sof_badcrc/Makefile b/tests/test_sof_badcrc/Makefile new file mode 100644 index 00000000..6aed3e76 --- /dev/null +++ b/tests/test_sof_badcrc/Makefile @@ -0,0 +1 @@ +include ../test_makefile.mak diff --git a/tests/test_sof_badcrc/src/main.xc b/tests/test_sof_badcrc/src/main.xc new file mode 100644 index 00000000..ff4bbb89 --- /dev/null +++ b/tests/test_sof_badcrc/src/main.xc @@ -0,0 +1,108 @@ +// Copyright (c) 2016-2019, XMOS Ltd, All rights reserved +#include +#include +#include +#include "xud.h" +#include "platform.h" +#include "shared.h" + +#define XUD_EP_COUNT_OUT 5 +#define XUD_EP_COUNT_IN 5 + +/* Endpoint type tables */ +XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL,XUD_EPTYPE_BUL}; +XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; + +void exit(int); + +int TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_out_0, chanend c_sof) +{ + unsigned int length; + XUD_Result_t res; + + XUD_ep ep_out_0 = XUD_InitEp(c_out_0); + XUD_ep ep_out = XUD_InitEp(c_out); + XUD_ep ep_in = XUD_InitEp(c_in); + + unsigned frames[10]; + + /* Buffer for Setup data */ + unsigned char buffer[1024]; + + XUD_GetBuffer(ep_out, buffer, length); + + if(length != 10) + { + printintln(length); + fail(FAIL_RX_LENERROR); + } + + if(RxDataCheck(buffer, length, epNum)) + { + fail(FAIL_RX_DATAERROR); + } + + /* Receive SOFs */ + /* Host sends 5 SOFs, but one has its CRC nobbled so we should only see 4. */ + for (int i = 0; i< 5; i++) + { + if(i == 3) + continue; + + frames[i] = inuint(c_sof); + } + + XUD_GetBuffer(ep_out, buffer, length); + + if(length != 11) + { + printintln(length); + fail(FAIL_RX_LENERROR); + } + + if(RxDataCheck(buffer, length, epNum)) + { + fail(FAIL_RX_DATAERROR); + } + + unsigned expectedFrame = 52; + + /* Check frame numbers */ + for (int i = 0 ; i < 5; i++) + { + if(i == 3) + continue; + + if(frames[i] != i+expectedFrame) + { + printstr("Expected: "); + printintln(i+expectedFrame); + printstr("Received: "); + printintln(frames[i]); + fail(FAIL_RX_FRAMENUMBER); + } + } + + XUD_Kill(ep_out_0); + exit(0); +} + + +int main() +{ + chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + chan c_sof; + + par + { + + XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + c_sof, epTypeTableOut, epTypeTableIn, + null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); + + + TestEp_Bulk(c_ep_out[1], c_ep_in[1], 1, c_ep_out[0], c_sof); + } + + return 0; +} diff --git a/tests/test_sof_badcrc/src/test.xn b/tests/test_sof_badcrc/src/test.xn new file mode 100644 index 00000000..d0ee86b8 --- /dev/null +++ b/tests/test_sof_badcrc/src/test.xn @@ -0,0 +1,72 @@ + + + Board + XS2 MC Audio + + tileref tile[2] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_sof_badcrc/src/test_xs1.xn b/tests/test_sof_badcrc/src/test_xs1.xn new file mode 100755 index 00000000..573aef45 --- /dev/null +++ b/tests/test_sof_badcrc/src/test_xs1.xn @@ -0,0 +1,89 @@ + + + + + tileref tile[1] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_sof_badcrc/src/test_xs2.xn b/tests/test_sof_badcrc/src/test_xs2.xn new file mode 100644 index 00000000..d0ee86b8 --- /dev/null +++ b/tests/test_sof_badcrc/src/test_xs2.xn @@ -0,0 +1,72 @@ + + + Board + XS2 MC Audio + + tileref tile[2] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_sof_badcrc/src/test_xs3.xn b/tests/test_sof_badcrc/src/test_xs3.xn new file mode 100644 index 00000000..ab436573 --- /dev/null +++ b/tests/test_sof_badcrc/src/test_xs3.xn @@ -0,0 +1,24 @@ + + + + tileref tile[2] + + + + + + + + + + + + + + + + + + From 885a3856f9d6ea238c0ecbbcd38af08956469023 Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 25 Oct 2019 11:54:11 +0100 Subject: [PATCH 075/520] Removed bulk_rx_fastpacket_multiep test --- tests/test_bulk_rx_fastpacket_multiep.py | 48 ------- .../LICENSE.txt | 135 ------------------ .../test_bulk_rx_fastpacket_multiep/Makefile | 1 - .../src/main.xc | 51 ------- .../src/test.xn | 72 ---------- .../src/test_xs1.xn | 89 ------------ .../src/test_xs2.xn | 72 ---------- .../src/test_xs3.xn | 24 ---- .../src/xc_ptr.h | 47 ------ 9 files changed, 539 deletions(-) delete mode 100644 tests/test_bulk_rx_fastpacket_multiep.py delete mode 100644 tests/test_bulk_rx_fastpacket_multiep/LICENSE.txt delete mode 100644 tests/test_bulk_rx_fastpacket_multiep/Makefile delete mode 100644 tests/test_bulk_rx_fastpacket_multiep/src/main.xc delete mode 100644 tests/test_bulk_rx_fastpacket_multiep/src/test.xn delete mode 100755 tests/test_bulk_rx_fastpacket_multiep/src/test_xs1.xn delete mode 100644 tests/test_bulk_rx_fastpacket_multiep/src/test_xs2.xn delete mode 100644 tests/test_bulk_rx_fastpacket_multiep/src/test_xs3.xn delete mode 100644 tests/test_bulk_rx_fastpacket_multiep/src/xc_ptr.h diff --git a/tests/test_bulk_rx_fastpacket_multiep.py b/tests/test_bulk_rx_fastpacket_multiep.py deleted file mode 100644 index 21994853..00000000 --- a/tests/test_bulk_rx_fastpacket_multiep.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env python - -import random -import xmostest -from usb_packet import * -from usb_clock import Clock -from helpers import do_usb_test, runall_rx - -def do_test(arch, clk, phy, seed): - rand = random.Random() - rand.seed(seed) - - # The inter-frame gap is to give the DUT time to print its output - packets = [] - - address = 1 - data_val = 0; - pkt_length = 20 - data_pid = 0x3 #DATA0 - - for pkt_length in range(10, 20): - - #min 237 - AppendOutToken(packets, 3, address, inter_pkt_gap=1) - packets.append(TxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) #DATA0 - packets.append(RxHandshakePacket(timeout=10)) - - AppendOutToken(packets, 4, address, inter_pkt_gap=1) - packets.append(TxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) #DATA0 - packets.append(RxHandshakePacket(timeout=10)) - - AppendOutToken(packets, 5, address, inter_pkt_gap=0) - packets.append(TxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) #DATA0 - packets.append(RxHandshakePacket(timeout=10)) - - AppendOutToken(packets, 6, address, inter_pkt_gap=0) - packets.append(TxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) #DATA0 - packets.append(RxHandshakePacket(timeout=10)) - - data_val = data_val + pkt_length - data_pid = data_pid ^ 8 - - do_usb_test(arch, clk, phy, packets, __file__, seed, - level='smoke', extra_tasks=[]) - -def runtest(): - random.seed(1) - runall_rx(do_test) diff --git a/tests/test_bulk_rx_fastpacket_multiep/LICENSE.txt b/tests/test_bulk_rx_fastpacket_multiep/LICENSE.txt deleted file mode 100644 index 994856c9..00000000 --- a/tests/test_bulk_rx_fastpacket_multiep/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_bulk_rx_fastpacket_multiep/Makefile b/tests/test_bulk_rx_fastpacket_multiep/Makefile deleted file mode 100644 index 6aed3e76..00000000 --- a/tests/test_bulk_rx_fastpacket_multiep/Makefile +++ /dev/null @@ -1 +0,0 @@ -include ../test_makefile.mak diff --git a/tests/test_bulk_rx_fastpacket_multiep/src/main.xc b/tests/test_bulk_rx_fastpacket_multiep/src/main.xc deleted file mode 100644 index 79cc39cb..00000000 --- a/tests/test_bulk_rx_fastpacket_multiep/src/main.xc +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved -/* - * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent - * in both directions between the ports. - * - * NOTE: The src/testbenches/ExampleTestbench must have been compiled for this to run without error. - * - */ -#include -#include -#include -#include "xud.h" -#include "platform.h" -#include "shared.h" - - -#define XUD_EP_COUNT_OUT 7 -#define XUD_EP_COUNT_IN 1 - -#define PACKET_LEN_START 10 -#define PACKET_LEN_END 19 - -/* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL}; - -int main() -{ - chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - - par - { - - XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, - null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); - - - TestEp_Rx(c_ep_out[3], 3, PACKET_LEN_START, PACKET_LEN_END); - TestEp_Rx(c_ep_out[4], 4, PACKET_LEN_START, PACKET_LEN_END); - TestEp_Rx(c_ep_out[5], 5, PACKET_LEN_START, PACKET_LEN_END); - { - XUD_ep ep_out_0 = XUD_InitEp(c_ep_out[0]); - TestEp_Rx(c_ep_out[6], 6, PACKET_LEN_START, PACKET_LEN_END); - XUD_Kill(ep_out_0); - exit(0); - } - } - - return 0; -} diff --git a/tests/test_bulk_rx_fastpacket_multiep/src/test.xn b/tests/test_bulk_rx_fastpacket_multiep/src/test.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_bulk_rx_fastpacket_multiep/src/test.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rx_fastpacket_multiep/src/test_xs1.xn b/tests/test_bulk_rx_fastpacket_multiep/src/test_xs1.xn deleted file mode 100755 index 573aef45..00000000 --- a/tests/test_bulk_rx_fastpacket_multiep/src/test_xs1.xn +++ /dev/null @@ -1,89 +0,0 @@ - - - - - tileref tile[1] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rx_fastpacket_multiep/src/test_xs2.xn b/tests/test_bulk_rx_fastpacket_multiep/src/test_xs2.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_bulk_rx_fastpacket_multiep/src/test_xs2.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rx_fastpacket_multiep/src/test_xs3.xn b/tests/test_bulk_rx_fastpacket_multiep/src/test_xs3.xn deleted file mode 100644 index ab436573..00000000 --- a/tests/test_bulk_rx_fastpacket_multiep/src/test_xs3.xn +++ /dev/null @@ -1,24 +0,0 @@ - - - - tileref tile[2] - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rx_fastpacket_multiep/src/xc_ptr.h b/tests/test_bulk_rx_fastpacket_multiep/src/xc_ptr.h deleted file mode 100644 index 28fa6b8b..00000000 --- a/tests/test_bulk_rx_fastpacket_multiep/src/xc_ptr.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved -#ifndef __xc_ptr__ -#define __xc_ptr__ - -typedef unsigned int xc_ptr; - -// Note that this function is marked as const to avoid the XC -// parallel usage checks, this is only really going to work if this -// is the *only* way the array a is accessed (and everything else uses -// the xc_ptr) -inline xc_ptr array_to_xc_ptr(const unsigned a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -inline xc_ptr char_array_to_xc_ptr(const unsigned char a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -#define write_via_xc_ptr_indexed(p,i,x) asm volatile("stw %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_short_via_xc_ptr_indexed(p,i,x) asm volatile("st16 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) - -#define write_via_xc_ptr(p,x) asm volatile("stw %0, %1[0]"::"r"(x),"r"(p)) -// No immediate st8 format -#define write_byte_via_xc_ptr(p,x) write_byte_via_xc_ptr_indexed(p, 0, x) -#define write_short_via_xc_ptr(p,x) write_short_via_xc_ptr_indexed(p, 0, x) - -#define read_via_xc_ptr_indexed(x,p,i) asm("ldw %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_byte_via_xc_ptr_indexed(x,p,i) asm("ld8u %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_short_via_xc_ptr_indexed(x,p,i) asm("ld16s %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); - -#define read_via_xc_ptr(x,p) asm("ldw %0, %1[0]":"=r"(x):"r"(p)); -// No immediate ld8u format -#define read_byte_via_xc_ptr(x,p) read_byte_via_xc_ptr_indexed(x, p, 0) -#define read_short_via_xc_ptr(x,p) read_short_via_xc_ptr_indexed(x, p, 0) - -#define GET_SHARED_GLOBAL(x, g) asm volatile("ldw %0, dp[" #g "]":"=r"(x)::"memory") -#define SET_SHARED_GLOBAL(g, v) asm volatile("stw %0, dp[" #g "]"::"r"(v):"memory") - -#endif From db5b9846c10dae6c07c98fcf2053892add0712d1 Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 25 Oct 2019 11:55:06 +0100 Subject: [PATCH 076/520] Added another bulk test --- tests/test_bulk_rx_basic_badpid/src/main.xc | 153 ++++++-------------- tests/test_bulk_rx_multiep.py | 48 ++++++ tests/test_bulk_rx_multiep/LICENSE.txt | 135 +++++++++++++++++ tests/test_bulk_rx_multiep/Makefile | 1 + tests/test_bulk_rx_multiep/src/main.xc | 51 +++++++ tests/test_bulk_rx_multiep/src/test.xn | 72 +++++++++ tests/test_bulk_rx_multiep/src/test_xs1.xn | 89 ++++++++++++ tests/test_bulk_rx_multiep/src/test_xs2.xn | 72 +++++++++ tests/test_bulk_rx_multiep/src/test_xs3.xn | 24 +++ 9 files changed, 535 insertions(+), 110 deletions(-) create mode 100644 tests/test_bulk_rx_multiep.py create mode 100644 tests/test_bulk_rx_multiep/LICENSE.txt create mode 100644 tests/test_bulk_rx_multiep/Makefile create mode 100644 tests/test_bulk_rx_multiep/src/main.xc create mode 100644 tests/test_bulk_rx_multiep/src/test.xn create mode 100755 tests/test_bulk_rx_multiep/src/test_xs1.xn create mode 100644 tests/test_bulk_rx_multiep/src/test_xs2.xn create mode 100644 tests/test_bulk_rx_multiep/src/test_xs3.xn diff --git a/tests/test_bulk_rx_basic_badpid/src/main.xc b/tests/test_bulk_rx_basic_badpid/src/main.xc index 6a8388d2..92dcbde0 100644 --- a/tests/test_bulk_rx_basic_badpid/src/main.xc +++ b/tests/test_bulk_rx_basic_badpid/src/main.xc @@ -1,133 +1,66 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved -/* - * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent - * in both directions between the ports. - * - * NOTE: The src/testbenches/ExampleTestbench must have been compiled for this to run without error. - * - */ +// Copyright (c) 2018-2019, XMOS Ltd, All rights reserved #include #include #include #include "xud.h" #include "platform.h" -#include "xc_ptr.h" - +#include "shared.h" #define XUD_EP_COUNT_OUT 5 #define XUD_EP_COUNT_IN 5 -#define TEST_EP_NUMBER (1) +#ifndef PKT_LENGTH_START +#define PKT_LENGTH_START 10 +#endif + +#ifndef PKT_LENGTH_END +#define PKT_LENGTH_END 14 +#endif -//extern xc_ptr char_array_to_xc_ptr(const unsigned char a[]); +#ifndef TEST_EP_NUM +#define TEST_EP_NUM 1 +#endif /* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, - XUD_EPTYPE_ISO, - XUD_EPTYPE_BUL, - XUD_EPTYPE_BUL}; +XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend ?c_usb_test); - -void exit(int); - -#define FAIL_RX_DATAERROR 0 -#define FAIL_RX_LENERROR 1 - -unsigned fail(int x) -{ - - printstr("\nXCORE: ### FAIL ******"); - switch(x) - { - case FAIL_RX_DATAERROR: - printstr("XCORE RX Data Error\n"); - break; - - case FAIL_RX_LENERROR: - printstr("XCORE RX Length Error\n"); - break; - - } - - exit(1); -} - -unsigned char g_rxDataCheck[5] = {0, 0, 0, 0, 0}; -unsigned char g_txDataCheck[5] = {0,0,0,0,0,}; -unsigned g_txLength[5] = {0,0,0,0,0}; - -#pragma unsafe arrays -int RxDataCheck(unsigned char b[], int l, int epNum) -{ - for (int i = 0; i < l; i++) - { - unsigned char y; - if(b[i] != g_rxDataCheck[epNum]) - { - printstr("#### Mismatch on EP: "); - printint(epNum); - printstr(". Got:"); - printhex(b[i]); - printstr(" Expected:"); - printhexln(g_rxDataCheck[epNum]); - return 1; - } - - g_rxDataCheck[epNum]++; - } - - return 0; -} - -int TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_out_0) -{ - unsigned int length; - XUD_Result_t res; - - XUD_ep ep_out_0 = XUD_InitEp(c_out_0); - XUD_ep ep_out = XUD_InitEp(c_out); - XUD_ep ep_in = XUD_InitEp(c_in); - - /* Buffer for Setup data */ - unsigned char buffer[1024]; - - for(int i = 10; i <= 14; i++) - { - XUD_GetBuffer(ep_out, buffer, length); - - if(length != i) - { - printintln(length); - fail(FAIL_RX_LENERROR); - } - - if(RxDataCheck(buffer, length, epNum)) - { - fail(FAIL_RX_DATAERROR); - } - - } - - XUD_Kill(ep_out_0); - exit(0); -} - - +#ifdef XUD_SIM_RTL +int testmain() +#else int main() +#endif { chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - + par { - - XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, - null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); - + { + #if defined(XUD_TEST_SPEED_FS) + unsigned speed = XUD_SPEED_FS; + #elif defined(XUD_TEST_SPEED_HS) + unsigned speed = XUD_SPEED_HS; + #else + #error XUD_TEST_SPEED_XX not defined + #endif + + XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + null, epTypeTableOut, epTypeTableIn, + null, null, -1, speed, XUD_PWR_BUS); + } - TestEp_Bulk(c_ep_out[TEST_EP_NUMBER], c_ep_in[TEST_EP_NUMBER], TEST_EP_NUMBER, c_ep_out[0]); + { + unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); + + if(fail) + TerminateFail(fail); + else + TerminatePass(fail); + + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep0); + exit(0); + } } return 0; diff --git a/tests/test_bulk_rx_multiep.py b/tests/test_bulk_rx_multiep.py new file mode 100644 index 00000000..45b8fefc --- /dev/null +++ b/tests/test_bulk_rx_multiep.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python + +import random +import xmostest +from usb_packet import * +from usb_clock import Clock +from helpers import do_usb_test, runall_rx + +def do_test(arch, clk, phy, seed): + rand = random.Random() + rand.seed(seed) + + # The inter-frame gap is to give the DUT time to print its output + packets = [] + + address = 1 + data_val = 0; + pkt_length = 20 + data_pid = 0x3 #DATA0 + + for pkt_length in range(10, 20): + + #min 237 + AppendOutToken(packets, 3, address, inter_pkt_gap=1) + packets.append(TxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) #DATA0 + packets.append(RxHandshakePacket()) + + AppendOutToken(packets, 4, address, inter_pkt_gap=1) + packets.append(TxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) #DATA0 + packets.append(RxHandshakePacket()) + + AppendOutToken(packets, 5, address, inter_pkt_gap=0) + packets.append(TxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) #DATA0 + packets.append(RxHandshakePacket()) + + AppendOutToken(packets, 6, address, inter_pkt_gap=0) + packets.append(TxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) #DATA0 + packets.append(RxHandshakePacket()) + + data_val = data_val + pkt_length + data_pid = data_pid ^ 8 + + do_usb_test(arch, clk, phy, packets, __file__, seed, + level='smoke', extra_tasks=[]) + +def runtest(): + random.seed(1) + runall_rx(do_test) diff --git a/tests/test_bulk_rx_multiep/LICENSE.txt b/tests/test_bulk_rx_multiep/LICENSE.txt new file mode 100644 index 00000000..994856c9 --- /dev/null +++ b/tests/test_bulk_rx_multiep/LICENSE.txt @@ -0,0 +1,135 @@ +Software Release License Agreement + +Copyright (c) 2015-2018, XMOS, All rights reserved. + +BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. + +Parties: + +(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). + +(2) An individual or legal entity exercising permissions granted by this License (Customer). + +If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. + +1. Definitions + +"License" means this Software License and any schedules or annexes to it. + +"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License + +"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. + +"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. + +"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. + +"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. + +The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. + +Unless the context otherwise requires: + +- references to XMOS and the Customer include their permitted successors and assigns; +- references to statutory provisions include those statutory provisions as amended or re-enacted; and +- references to any gender include all genders. + +Words in the singular include the plural and in the plural include the singular. + +2. License + +XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. + +Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. + +3. Consideration + +In consideration of the mutual obligations contained in this License, the parties agree to its terms. + +4. Term + +Subject to clause 12 below, this License shall be perpetual. + +5. Restrictions on Use + +The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. + +6. Modifications + +The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. + +XMOS will own all intellectual property rights in the XMOS Modifications. +The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. + +7. Support + +Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. + +8. Warranty and Disclaimer + +The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). + +Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. + +XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. + +9. High Risk Activities + +The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. + +10. Liability + +TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. + +Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. + +11. Ownership + +The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. + +12. Termination + +Either party may terminate this License at any time on written notice to the other if the other: + +- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or + +- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. + +Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. + +On termination for any reason: + +- all rights granted to the Customer under this License shall cease; +- the Customer shall cease all activities authorised by this License; +- the Customer shall immediately pay any sums due to XMOS under this License; and +- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. + +Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. + +13. Third party rights + +No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. + +14. Confidentiality and publicity + +Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. + +The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. +The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. + +15. Entire agreement + +This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. + +16. Assignment + +The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. + +17. Governing law and jurisdiction + +This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. + +This License has been entered into on the date stated at the beginning of it. + +Schedule +XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_bulk_rx_multiep/Makefile b/tests/test_bulk_rx_multiep/Makefile new file mode 100644 index 00000000..6aed3e76 --- /dev/null +++ b/tests/test_bulk_rx_multiep/Makefile @@ -0,0 +1 @@ +include ../test_makefile.mak diff --git a/tests/test_bulk_rx_multiep/src/main.xc b/tests/test_bulk_rx_multiep/src/main.xc new file mode 100644 index 00000000..79cc39cb --- /dev/null +++ b/tests/test_bulk_rx_multiep/src/main.xc @@ -0,0 +1,51 @@ +// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +/* + * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent + * in both directions between the ports. + * + * NOTE: The src/testbenches/ExampleTestbench must have been compiled for this to run without error. + * + */ +#include +#include +#include +#include "xud.h" +#include "platform.h" +#include "shared.h" + + +#define XUD_EP_COUNT_OUT 7 +#define XUD_EP_COUNT_IN 1 + +#define PACKET_LEN_START 10 +#define PACKET_LEN_END 19 + +/* Endpoint type tables */ +XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; +XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL}; + +int main() +{ + chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + + par + { + + XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + null, epTypeTableOut, epTypeTableIn, + null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); + + + TestEp_Rx(c_ep_out[3], 3, PACKET_LEN_START, PACKET_LEN_END); + TestEp_Rx(c_ep_out[4], 4, PACKET_LEN_START, PACKET_LEN_END); + TestEp_Rx(c_ep_out[5], 5, PACKET_LEN_START, PACKET_LEN_END); + { + XUD_ep ep_out_0 = XUD_InitEp(c_ep_out[0]); + TestEp_Rx(c_ep_out[6], 6, PACKET_LEN_START, PACKET_LEN_END); + XUD_Kill(ep_out_0); + exit(0); + } + } + + return 0; +} diff --git a/tests/test_bulk_rx_multiep/src/test.xn b/tests/test_bulk_rx_multiep/src/test.xn new file mode 100644 index 00000000..d0ee86b8 --- /dev/null +++ b/tests/test_bulk_rx_multiep/src/test.xn @@ -0,0 +1,72 @@ + + + Board + XS2 MC Audio + + tileref tile[2] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_rx_multiep/src/test_xs1.xn b/tests/test_bulk_rx_multiep/src/test_xs1.xn new file mode 100755 index 00000000..573aef45 --- /dev/null +++ b/tests/test_bulk_rx_multiep/src/test_xs1.xn @@ -0,0 +1,89 @@ + + + + + tileref tile[1] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_rx_multiep/src/test_xs2.xn b/tests/test_bulk_rx_multiep/src/test_xs2.xn new file mode 100644 index 00000000..d0ee86b8 --- /dev/null +++ b/tests/test_bulk_rx_multiep/src/test_xs2.xn @@ -0,0 +1,72 @@ + + + Board + XS2 MC Audio + + tileref tile[2] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_rx_multiep/src/test_xs3.xn b/tests/test_bulk_rx_multiep/src/test_xs3.xn new file mode 100644 index 00000000..ab436573 --- /dev/null +++ b/tests/test_bulk_rx_multiep/src/test_xs3.xn @@ -0,0 +1,24 @@ + + + + tileref tile[2] + + + + + + + + + + + + + + + + + + From d268c58afd75f73d2c292881e006fa2874be92ef Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 25 Oct 2019 13:20:42 +0100 Subject: [PATCH 077/520] Fixed build issue in test_bulk_rx_short --- tests/test_bulk_tx_basic_short/src/main.xc | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/test_bulk_tx_basic_short/src/main.xc b/tests/test_bulk_tx_basic_short/src/main.xc index c06d5c19..9678d23a 100644 --- a/tests/test_bulk_tx_basic_short/src/main.xc +++ b/tests/test_bulk_tx_basic_short/src/main.xc @@ -11,7 +11,6 @@ #include #include "xud.h" #include "platform.h" -#include "xc_ptr.h" #include "shared.h" #ifndef TEST_EP_NUM @@ -56,7 +55,6 @@ int main() unsigned speed = XUD_SPEED_HS; #endif - // TODO test is running at 400MHz XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, null, null, -1, speed, XUD_PWR_BUS); From 0142af4188456bed62708cada39460ad96ad0ee8 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 28 Oct 2019 14:32:09 +0000 Subject: [PATCH 078/520] Initial Dual issue of Tx and some other opts. --- lib_xud/src/core/XUD_IoLoop.S | 76 ++++------ lib_xud/src/core/included/XUD_Token_In_DI.S | 133 +++--------------- lib_xud/src/core/included/XUD_Token_Out.S | 67 +-------- .../src/core/included/XUD_Token_Setup_DI.S | 25 ++-- lib_xud/src/user/client/XUD_EpFuncs.S | 13 +- tests/test_bulk_tx_basic_short/src/main.xc | 10 +- 6 files changed, 84 insertions(+), 240 deletions(-) diff --git a/lib_xud/src/core/XUD_IoLoop.S b/lib_xud/src/core/XUD_IoLoop.S index 610e13b0..6cd84450 100755 --- a/lib_xud/src/core/XUD_IoLoop.S +++ b/lib_xud/src/core/XUD_IoLoop.S @@ -38,12 +38,18 @@ suspend_t_wtwrsths: // 1..7: : Reg save // 8 : TX handshake timer // 9 : Out timer -#define STACK_FLAG1_PORT (STACK_EXTEND-12)// 10 : RXA_port -#define STACK_FLAG0_PORT (STACK_EXTEND-11)// 11 : Valid token port +#define STACK_FLAG1_PORT (10) //RXA_port +#define STACK_FLAG0_PORT (11) // Valid token port // 12 : ? // 13 : Suspend timeout // 14 : Suspend/Reset timer // 15 : RxError port (flag 2) +#define STACK_RXCRC_TAIL0 (16) +#define STACK_RXCRC_TAIL1 (17) +#define STACK_RXCRC_TAIL2 (18) +#define STACK_RXCRC_TAIL3 (19) +#define STACK_TXCRC_INIT (20) +#define STACK_RXCRC_INIT (21) #define STACK_PID_JUMP_TABLE (STACK_EXTEND-3) @@ -53,8 +59,7 @@ suspend_t_wtwrsths: // STACK_EXTEND + 3 : reg_write_port // STACK_EXTEND + 4 : 0 // STACK_EXTEND + 5 : c_ctl_buf - -#define SP_EPTYPES_OUT (STACK_EXTEND +6) // STACK_EXTEND + 6 : EP Type table (out) +#define SP_EPTYPES_OUT (STACK_EXTEND + 6) // STACK_EXTEND + 6 : EP Type table (out) #define SP_EPTYPES_IN (STACK_EXTEND + 7) // EP Type table (in) #define SP_EPCHANS (STACK_EXTEND + 7) #define SP_EPCOUNT (STACK_EXTEND + 9) @@ -305,9 +310,23 @@ PortsOnStack: // Put ports on stack (loads the stw r11, sp[10] ldw r11, dp[flag0_port] // Valid token port stw r11, sp[STACK_FLAG0_PORT] + +CrcRxResidualsOnStack: + ldc r11, 0x7000 + stw r11, sp[STACK_RXCRC_TAIL0] + ldc r11, 0x80be + stw r11, sp[STACK_RXCRC_TAIL1] ldc r11, 0x3ffe - stw r11, sp[12] - + stw r11, sp[STACK_RXCRC_TAIL2] + ldc r11, 0x3ffe + stw r11, sp[STACK_RXCRC_TAIL3] + + ldc r11, 0xf335 // CRC16 init (in) + stw r11, sp[STACK_TXCRC_INIT] + + ldc r11, 0x3334 // CRC16 init (out) + stw r11, sp[STACK_RXCRC_INIT] + ldw r11, sp[(STACK_EXTEND+7)] stw r11, dp[chanArray] @@ -373,48 +392,15 @@ NextToken: NextTokenAfterOut: ldc r7, 0xf335 // TX Crc init ldc r6, 0x3334 // CRC16 init (out) - Needs reseting after an out -#ifndef ARCH_G - ldw r1, sp[STACK_FLAG0_PORT] -#else - //ldaw r1, dp[crc5Table_Addr] -#endif NextTokenAfterInNak: Loop_BadPid: - //ldc r4, XUD_MAX_NUM_EP_OUT // Number of OUT endpoints NextTokenAfterPing: setsr 1 // Enable thread events - - -//------------------------------------------------------------------------------------------------ -#if defined(__XS2A__) || defined(__XS1B__) - //ldw r1, sp[11] // Load Valid Token port - ldaw r10, dp[PidJumpTable] // TODO Could load from sp here - // Original USB Token: | CRC | EP | ADDR | PID | junk - // Received token is address and CRC checked. - // We receive: | 0000 4-bit EP | 0000 4-bit PID | -XUD_TokenRx_Pid: - inpw r11, res[RXD], 8 // Read 8 bit PID - shr r11, r11, 24 // Shift off junk - - ldw r10, r10[r11] // Load relevant branch address - -BranchOnTokenPid: -.xtabranch Pid_Out, Pid_Sof, Pid_In, Pid_Setup, Pid_Sof_NoChan - - bau r10 - -#else // XS3A - #include "XUD_TokenJmp.S" - - -#endif - - // Un-implemented PID list -Pid_Reserved: // Should never get here +Pid_Reserved: Pid_Ack: Pid_NYet: Pid_Nyet: @@ -429,24 +415,21 @@ Pid_Data0: Pid_Data1: Pid_Bad: // Bad PID received, ignore -InvalidToken: XUD_InvalidToken: ldw r10, sp[10] // Load RxA Port ID (r1) -waitforRXALow: XUD_InvalidTok_waitforRXALow: in r11, res[r10] - bt r11, waitforRXALow + bt r11, XUD_InvalidTok_waitforRXALow setc res[RXD], XS1_SETC_RUN_CLRBUF bu Loop_BadPid // Invalid token received Ignore unknown toks - .align 4 Return: ldw r11, sp[14] // Free suspend/reset timer edu res[r11] freer res[r11] - ldw r4, sp[1] # Register restore + ldw r4, sp[1] // Register restore ldw r5, sp[2] ldw r6, sp[3] ldw r7, sp[4] @@ -459,7 +442,6 @@ Return: .cc_bottom XUD_LLD_IoLoop.func - - // Tables of tables... #include "./included/XUD_PidJumpTable.S" + diff --git a/lib_xud/src/core/included/XUD_Token_In_DI.S b/lib_xud/src/core/included/XUD_Token_In_DI.S index 7f5885dd..b383deac 100755 --- a/lib_xud/src/core/included/XUD_Token_In_DI.S +++ b/lib_xud/src/core/included/XUD_Token_In_DI.S @@ -56,120 +56,33 @@ InReady: ldw r4, r4[6] // Load buffer index bf r4, SmallTxPacket // Check for Short packet -.xtabranch TxTail0, TxTail1, TxTail2, TxTail3 - bru r6 // Branch on tail length - -//-------------------------------------------------------------------------- -.align 128 -.skip 0 -TxTail0: - ldw r6, r8[r4] // Load first data word - add r4, r4, 1 // Buffer index increment -XUD_IN_TxPid_Tail0: - outpw res[TXD], r11, 8 // Output PID to port - out res[TXD], r6 // Output first data word - crc32 r7, r6, r9 // Run CRC - bf r4, TxLoop0End -TxLoop0: - ldw r6, r8[r4] // Load last data word - add r4, r4, 1 -TxLoop0_Out: - out res[TXD], r6 // Output last data word - crc32 r7, r6, r9 - bt r4, TxLoop0 -TxLoop0End: // Word aligned data (just output CRC) - crc32 r7, r4, r9 // R4: 0 (from bt) - not r7, r7 - -XUD_IN_TxCrc_Tail0: - outpw res[TXD], r7, 16 // Output CRC - bu DoneTail - -.align 128 -.skip 0 -TxTail1: - ldw r6, r8[r4] // Load first data word - add r4, r4, 1 // Buffer index increment -XUD_IN_TxPid_Tail1: - outpw res[TXD], r11, 8 // Out PID - out res[TXD], r6 - crc32 r7, r6, r9 - bf r4, TxLoop1End -TxLoop1: - ldw r6, r8[r4] // Load last data word - add r4, r4, 1 - out res[TXD], r6 - crc32 r7, r6, r9 - bt r4, TxLoop1 -TxLoop1End: - ldw r6, r8[r4] // Load last data word - outpw res[TXD], r6, 8 - crc8 r7, r6, r6, r9 +XUD_IN_Tx: + outpw res[TXD], r11, 8 // Out PID + ldw r11, r8[r4] // Load first data word + +XUD_IN_TxPid: + out res[TXD], r11 + crc32_inc r7, r11, r9, r4, 1 + bf r4, XUD_IN_TxLoopEnd + +XUD_IN_TxLoop: + ldw r11, r8[r4] // Load first data word + crc32_inc r7, r11, r9, r4, 1 + {out res[TXD], r11; bt r4, XUD_IN_TxLoop} + +XUD_IN_TxLoopEnd: + ldw r11, r8[r4] // Load tail + crcn r7, r11, r9, r6 + outpw res[TXD], r11, r6 + +XUD_IN_TxLoopEnd_CrcCalc: crc32 r7, r4, r9 // r4: 0 (from bf) not r7, r7 - -XUD_IN_TxCrc_Tail1: - outpw res[TXD], r7, 16 - bu DoneTail - -.scheduling off -.align 128 -.skip 0 -TxTail2: - ldw r6, r8[r4] // Load first data word - crc32 r7, r6, r9 -XUD_IN_TxPid_Tail2: - outpw res[TXD], r11, 8 // Out PID - out res[TXD], r6 - add r4, r4, 1 - bf r4, TxLoop2End -TxLoop2: - ldw r6, r8[r4] // Load first data word - add r4, r4, 1 - crc32 r7, r6, r9 - out res[TXD], r6 - bt r4, TxLoop2 - -TxLoop2End: - ldw r6, r8[r4] // Load tail - crc8 r7, r11, r6, r9 - outpw res[TXD], r6, 16 - crc8 r7, r11, r11, r9 - crc32 r7, r4, r9 // r4: 0 (from bf) - not r7, r7 - -XUD_IN_TxCrc_Tail2: - outpw res[TXD], r7, 16 - bu DoneTail - -.align 128 -.skip 0 -TxTail3: - ldw r6, r8[r4] // Load first data word - add r4, r4, 1 -XUD_IN_TxPid_Tail3: - outpw res[TXD], r11, 8 // Out PID - out res[TXD], r6 - crc32 r7, r6, r9 - bf r4, TxLoop3End -TxLoop3: - ldw r6, r8[r4] // Load first data word - add r4, r4, 1 - crc32 r7, r6, r9 - out res[TXD], r6 - bt r4, TxLoop3 -TxLoop3End: - ldw r6, r8[r4] // Load tail - crc8 r7, r11, r6, r9 - outpw res[TXD], r6, 24 - crc8 r7, r11, r11, r9 - crc8 r7, r11, r11, r9 - crc32 r7, r4, r9 // r4: 0 (from bf) - not r7, r7 -XUD_IN_TxCrc_Tail3: - outpw res[TXD], r7, 16 +XUD_IN_TxCrc: + outpw res[TXD], r7, 16 // Output 16-bit CRC .scheduling default + // Wait for handshake... or timeout DoneTail: ldw r11, sp[SP_EPTYPES_OUT] diff --git a/lib_xud/src/core/included/XUD_Token_Out.S b/lib_xud/src/core/included/XUD_Token_Out.S index 99007bf6..696d3119 100755 --- a/lib_xud/src/core/included/XUD_Token_Out.S +++ b/lib_xud/src/core/included/XUD_Token_Out.S @@ -15,7 +15,7 @@ Pid_Out: CheckEpTypeOut: ldw r11, r3[5] // Load EP type - BRFT_ru6 r11, DoOutNonIso // ISO endpoint + BRFT_ru6 r11, DoOutNonIso // ISO endpoint OutReady: stw r11, r5[r10] // Clear ready straight away - we don't to CRC checking on Iso - else we would have to wait for end of packet @@ -23,54 +23,16 @@ OutReady: clre InformEP_Iso: // Iso EP - no handshake - ldw r11, r3[1] // Load EP chanend - out res[r11], r4 // Output datalength (words) - outt res[r11], r8 // Send tail length - - ldc r7, 0xf335 // CRC16 init (in) - ldc r6, 0x3334 // CRC16 init (out) - Needs reseting after an out -#ifndef __XS3A__ - ldw r1, sp[STACK_FLAG0_PORT] -#endif - //ldc r4, XUD_MAX_NUM_EP_OUT // This could be shaved if XUD_MAX_NUM_EP's < 12. Now use an LDAW to at 16. - -//------------------------------------------------------------------------------------------------ -#if defined(__XS2A__) || defined(__XS1B__) - ldaw r10, dp[PidJumpTable] - // Original USB Token: | CRC | EP | ADDR | PID | junk - // Received token is address and CRC checked. - // We receive: | 0000 4-bit EP | 0000 4-bit PID | -XUD_TokenRx_Pid_: - inpw r11, res[RXD], 8 // Read 8 bit PID - shr r11, r11, 24 // Shift off junk - - ldw r10, r10[r11] // Load relevant branch address - -BranchOnTokenPid_: -.xtabranch Pid_Out, Pid_Sof, Pid_In, Pid_Setup, Pid_Sof_NoChan - bau r10 -#else - ldc r4, 16 - -ReadToken_: - inpw r11, res[RXD], 8 // Read 3 byte token from data port | CRC[5] | EP[4] | ADDR[7] | PID[8] | junk - ldaw r10, dp[PidJumpTable] - setpsc res[RXD], r4 - shr r11, r11, 24 - -JumpOnPid_: - ldw r11, r10[r11] - .xtabranch Pid_Out, Pid_Sof, Pid_In, Pid_Setup - bau r11 -#endif + ldw r11, r3[1] // Load EP chanend + {out res[r11], r4; ldw r7, sp[STACK_TXCRC_INIT]} // Output datalength (words) & CRC 16 Init (IN) + {outt res[r11], r8; ldw r6, sp[STACK_RXCRC_INIT]} // CRC16 init (out) - Needs reseting after an out & Send tail length + #include "XUD_TokenJmp.S" .align 4 .skip 0 DoOutNonIso: bl doRXData - clre - - eq r1, r6, r11 // Check for good CRC16 + {clre; eq r1, r6, r11} // Check for good CRC16 doRXDataReturn_NonIso: bf r1, NextTokenAfterOut // Check for bad crc @@ -84,8 +46,6 @@ doRXDataReturn_NonIso: syncr res[TXD] StoreTailDataOut: - //shr r8, r8, 3 // r8: number of tail bits, convert to bytes - // This is now done on the other side ldc r11, 0 stw r11, r5[r10] // Clear ready ldw r11, r3[1] // Load EP chanend @@ -107,16 +67,6 @@ Err_RxErr: // RxError signal high during da setsr 3 // Re-enable thread interrupts bu NextToken -Err_EndpointProblem: - // TODO:Endpoint in trouble (send STALL) or disabled (ignore?)... - bu NextToken - -//Err_BadDataCrc: // Data packet received with bad crc: Ignore; wait for timeout (host will re-send) - //bu NextToken - -Err_BadPidSeq: // Bad pid sequencing (already ACKed good data). Ignore data - bu NextToken - XUD_TokenOut_BufferFull: ldw r9, dp[flag1_port] setc res[r9], XS1_SETC_RUN_CLRBUF @@ -132,16 +82,13 @@ XUD_TokenOut_WaitForPacketEnd: // Wait for end of data then sen bf r4, PrimaryBufferFull_NoNak #endif - // LOAD HANDSHAKE PID or STALL + // Load handshake (ACK or STALL) ldaw r5, dp[handshakeTable_OUT] // Load handshake table ldw r11, r5[r10] - //ldc r11, 0x5a outpw res[TXD], r11, 8 syncr res[TXD] PrimaryBufferFull_NoNak: - //endin r11, res[RXD] - //in r11, res[RXD] setc res[RXD], XS1_SETC_RUN_CLRBUF bu NextToken diff --git a/lib_xud/src/core/included/XUD_Token_Setup_DI.S b/lib_xud/src/core/included/XUD_Token_Setup_DI.S index d2dbdec0..54909d57 100644 --- a/lib_xud/src/core/included/XUD_Token_Setup_DI.S +++ b/lib_xud/src/core/included/XUD_Token_Setup_DI.S @@ -40,8 +40,8 @@ XUD_OUT_RxTail: .align 32 OutTail0: crc32 r6, r8, r9 // CRC zero step - ldc r11, 0x7000 // Load relevant CRC magic number - retsp 0 + ldw r11, sp[STACK_RXCRC_TAIL0] + RETSP_u6 0 // 1 Tail Byte .align 32 @@ -49,8 +49,8 @@ OutTail1: shr r11, r11, 24 // Shift off junk crc32 r6, r11, r9 stw r11, r1[r4] // Store last data - ldc r11, 0x80be // Load CRC magic number - retsp 0 + LDWSP_ru6 r11, sp[STACK_RXCRC_TAIL1] + RETSP_u6 0 // Two Tail Bytes .align 32 @@ -58,8 +58,8 @@ OutTail2: shr r11, r11, 16 crc32 r6, r11, r9 stw r11, r1[r4] // Store last data - ldc r11, 0x3ffe - retsp 0 + ldw r11, sp[STACK_RXCRC_TAIL2] + RETSP_u6 0 // Three Tail Bytes .align 32 @@ -67,9 +67,9 @@ OutTail3: shr r11, r11, 8 stw r11, r1[r4] // Store last data crc32 r6, r11, r9 - ldw r11, sp[12] + LDWSP_ru6 r11, sp[STACK_RXCRC_TAIL3] crc8 r6, r1, r2, r9 // Use the fact the the bottom byte of port id is 0.. saves us an ldc - retsp 0 + RETSP_u6 0 // Four Tail Bytes .align 32 @@ -96,7 +96,7 @@ Pid_Setup: LoadSetupBuffer: bl doRXData // RXData writes available data to buffer and does crc check. // r8: Data tail size (bytes) - {clre; eq r1, r6, r11} // Check for good CRC16 + {clre; eq r1, r6, r11} // Check for good CRC16 bf r1, NextTokenAfterOut // Check for bad crc ClearStall: // CRC OK @@ -127,10 +127,3 @@ SBuffFull: endin r11, res[RXD] in r11, res[RXD] bu NextTokenAfterOut - -BadDataCrcSetup: - mov r0, r1 - bl ERR_BadCrc - outct res[r5], 9 - in r11, res[r5] // TODO should only need CT - bu NextToken diff --git a/lib_xud/src/user/client/XUD_EpFuncs.S b/lib_xud/src/user/client/XUD_EpFuncs.S index 4df51807..dd906220 100644 --- a/lib_xud/src/user/client/XUD_EpFuncs.S +++ b/lib_xud/src/user/client/XUD_EpFuncs.S @@ -293,15 +293,24 @@ XUD_SetData_NoReq: add r1, r1, r3 // Add start index to buffer address CalcTailLength: - shl r3, r2, 5 // Taillength: bytes to bits * 2 - zext r3, 7 + shl r3, r2, 3 // Taillength: bytes to bits + zext r3, 5 SetupLoopTerm: shr r2, r2, 2 // r2: datalength (bytes) ---> r2: datalength (words) + // TODO do this a bit more effciently.. + // If tail is 0 and word-length not 0. Make tail-length 32 and word-length-- + bt r3, AdjustBufferPointer + bf r2, AdjustBufferPointer + + sub r2, r2, 1 + ldc r3, 32 + AdjustBufferPointer: shl r5, r2, 2 // Get end off buffer address add r1, r1, r5 + NegativeIndex: // Produce negtive offset from end of buffer neg r2, r2 diff --git a/tests/test_bulk_tx_basic_short/src/main.xc b/tests/test_bulk_tx_basic_short/src/main.xc index 9678d23a..0b8e759a 100644 --- a/tests/test_bulk_tx_basic_short/src/main.xc +++ b/tests/test_bulk_tx_basic_short/src/main.xc @@ -14,19 +14,19 @@ #include "shared.h" #ifndef TEST_EP_NUM -#define TEST_EP_NUM 1 +#define TEST_EP_NUM (1) #endif #ifndef PKT_LENGTH_START -#define PKT_LENGTH_START 0 +#define PKT_LENGTH_START (0) #endif #ifndef PKT_LENGTH_END -#define PKT_LENGTH_END 7 +#define PKT_LENGTH_END (7) #endif -#define XUD_EP_COUNT_OUT 4 -#define XUD_EP_COUNT_IN 4 +#define XUD_EP_COUNT_OUT (4) +#define XUD_EP_COUNT_IN (4) /* Endpoint type tables */ XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, From af4a50054e4a99d152d69dbb872b714bcfd7eca7 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 22 Apr 2020 16:50:28 +0100 Subject: [PATCH 079/520] Fix to XS2 build. Verified with HID example --- lib_xud/module_build_info | 2 +- lib_xud/src/core/XUD_CrcAddrCheck.S | 2 +- lib_xud/src/core/XUD_IoLoop.S | 4 ++ lib_xud/src/core/included/XUD_Token_In.S | 2 +- lib_xud/src/core/included/XUD_Token_Out.S | 67 ++++++++++++++++++--- lib_xud/src/core/included/XUD_Token_SOF.S | 4 +- lib_xud/src/core/included/XUD_Token_Setup.S | 2 +- lib_xud/src/user/client/XUD_EpFuncs.S | 8 +++ 8 files changed, 78 insertions(+), 13 deletions(-) diff --git a/lib_xud/module_build_info b/lib_xud/module_build_info index d9aadbce..5add335b 100644 --- a/lib_xud/module_build_info +++ b/lib_xud/module_build_info @@ -13,7 +13,7 @@ MODULE_XCC_FLAGS = $(XCC_FLAGS) -O3 -DREF_CLK_FREQ=100 -fasm-linenum -fcomment-a XCC_FLAGS_XUD_IoLoop.S = $(MODULE_XCC_FLAGS) -fschedule -g0 -EXCLUDE_FILES += XUD_Token_In.S XUD_Token_Ping.S XUD_Token_SOF.S XUD_Token_Out.S XUD_Token_Setup.S XUD_CrcAddrCheck.S XUD_TokenJmp.S XUD_PidJumpTable.S XUD_Token_In_DI.S XUD_Token_Setup_DI.S +EXCLUDE_FILES += XUD_Token_In.S XUD_Token_Ping.S XUD_Token_SOF.S XUD_Token_Out.S XUD_Token_Out_DI.S XUD_Token_Setup.S XUD_CrcAddrCheck.S XUD_TokenJmp.S XUD_PidJumpTable.S XUD_Token_In_DI.S XUD_Token_Setup_DI.S OPTIONAL_HEADERS += xud_conf.h diff --git a/lib_xud/src/core/XUD_CrcAddrCheck.S b/lib_xud/src/core/XUD_CrcAddrCheck.S index a323cb8d..9b086053 100644 --- a/lib_xud/src/core/XUD_CrcAddrCheck.S +++ b/lib_xud/src/core/XUD_CrcAddrCheck.S @@ -62,7 +62,7 @@ shr r10, r10, 24; // Shift off junk in r11, res[r1]; - bt r11, InvalidToken; // If VALID_TOKEN not high, ignore token - PORT INVERTED! */ + bt r11, XUD_InvalidToken; // If VALID_TOKEN not high, ignore token - PORT INVERTED! */ #endif // Required on exit: diff --git a/lib_xud/src/core/XUD_IoLoop.S b/lib_xud/src/core/XUD_IoLoop.S index 6cd84450..1eaba035 100755 --- a/lib_xud/src/core/XUD_IoLoop.S +++ b/lib_xud/src/core/XUD_IoLoop.S @@ -392,6 +392,10 @@ NextToken: NextTokenAfterOut: ldc r7, 0xf335 // TX Crc init ldc r6, 0x3334 // CRC16 init (out) - Needs reseting after an out +#ifdef __XS2A__ + ldw r1, sp[STACK_FLAG0_PORT] +#endif + NextTokenAfterInNak: Loop_BadPid: NextTokenAfterPing: diff --git a/lib_xud/src/core/included/XUD_Token_In.S b/lib_xud/src/core/included/XUD_Token_In.S index bee2eefc..030d9d98 100755 --- a/lib_xud/src/core/included/XUD_Token_In.S +++ b/lib_xud/src/core/included/XUD_Token_In.S @@ -52,7 +52,7 @@ Pid_In: shr r10, r10, 24; // Shift off junk in r11, res[r1]; - bt r11, InvalidToken; // If VALID_TOKEN not high, ignore token - PORT INVERTED! */ + bt r11, XUD_InvalidToken; // If VALID_TOKEN not high, ignore token - PORT INVERTED! */ #else #include "XUD_G_Crc.S" #endif diff --git a/lib_xud/src/core/included/XUD_Token_Out.S b/lib_xud/src/core/included/XUD_Token_Out.S index 696d3119..99007bf6 100755 --- a/lib_xud/src/core/included/XUD_Token_Out.S +++ b/lib_xud/src/core/included/XUD_Token_Out.S @@ -15,7 +15,7 @@ Pid_Out: CheckEpTypeOut: ldw r11, r3[5] // Load EP type - BRFT_ru6 r11, DoOutNonIso // ISO endpoint + BRFT_ru6 r11, DoOutNonIso // ISO endpoint OutReady: stw r11, r5[r10] // Clear ready straight away - we don't to CRC checking on Iso - else we would have to wait for end of packet @@ -23,16 +23,54 @@ OutReady: clre InformEP_Iso: // Iso EP - no handshake - ldw r11, r3[1] // Load EP chanend - {out res[r11], r4; ldw r7, sp[STACK_TXCRC_INIT]} // Output datalength (words) & CRC 16 Init (IN) - {outt res[r11], r8; ldw r6, sp[STACK_RXCRC_INIT]} // CRC16 init (out) - Needs reseting after an out & Send tail length - #include "XUD_TokenJmp.S" + ldw r11, r3[1] // Load EP chanend + out res[r11], r4 // Output datalength (words) + outt res[r11], r8 // Send tail length + + ldc r7, 0xf335 // CRC16 init (in) + ldc r6, 0x3334 // CRC16 init (out) - Needs reseting after an out +#ifndef __XS3A__ + ldw r1, sp[STACK_FLAG0_PORT] +#endif + //ldc r4, XUD_MAX_NUM_EP_OUT // This could be shaved if XUD_MAX_NUM_EP's < 12. Now use an LDAW to at 16. + +//------------------------------------------------------------------------------------------------ +#if defined(__XS2A__) || defined(__XS1B__) + ldaw r10, dp[PidJumpTable] + // Original USB Token: | CRC | EP | ADDR | PID | junk + // Received token is address and CRC checked. + // We receive: | 0000 4-bit EP | 0000 4-bit PID | +XUD_TokenRx_Pid_: + inpw r11, res[RXD], 8 // Read 8 bit PID + shr r11, r11, 24 // Shift off junk + + ldw r10, r10[r11] // Load relevant branch address + +BranchOnTokenPid_: +.xtabranch Pid_Out, Pid_Sof, Pid_In, Pid_Setup, Pid_Sof_NoChan + bau r10 +#else + ldc r4, 16 + +ReadToken_: + inpw r11, res[RXD], 8 // Read 3 byte token from data port | CRC[5] | EP[4] | ADDR[7] | PID[8] | junk + ldaw r10, dp[PidJumpTable] + setpsc res[RXD], r4 + shr r11, r11, 24 + +JumpOnPid_: + ldw r11, r10[r11] + .xtabranch Pid_Out, Pid_Sof, Pid_In, Pid_Setup + bau r11 +#endif .align 4 .skip 0 DoOutNonIso: bl doRXData - {clre; eq r1, r6, r11} // Check for good CRC16 + clre + + eq r1, r6, r11 // Check for good CRC16 doRXDataReturn_NonIso: bf r1, NextTokenAfterOut // Check for bad crc @@ -46,6 +84,8 @@ doRXDataReturn_NonIso: syncr res[TXD] StoreTailDataOut: + //shr r8, r8, 3 // r8: number of tail bits, convert to bytes + // This is now done on the other side ldc r11, 0 stw r11, r5[r10] // Clear ready ldw r11, r3[1] // Load EP chanend @@ -67,6 +107,16 @@ Err_RxErr: // RxError signal high during da setsr 3 // Re-enable thread interrupts bu NextToken +Err_EndpointProblem: + // TODO:Endpoint in trouble (send STALL) or disabled (ignore?)... + bu NextToken + +//Err_BadDataCrc: // Data packet received with bad crc: Ignore; wait for timeout (host will re-send) + //bu NextToken + +Err_BadPidSeq: // Bad pid sequencing (already ACKed good data). Ignore data + bu NextToken + XUD_TokenOut_BufferFull: ldw r9, dp[flag1_port] setc res[r9], XS1_SETC_RUN_CLRBUF @@ -82,13 +132,16 @@ XUD_TokenOut_WaitForPacketEnd: // Wait for end of data then sen bf r4, PrimaryBufferFull_NoNak #endif - // Load handshake (ACK or STALL) + // LOAD HANDSHAKE PID or STALL ldaw r5, dp[handshakeTable_OUT] // Load handshake table ldw r11, r5[r10] + //ldc r11, 0x5a outpw res[TXD], r11, 8 syncr res[TXD] PrimaryBufferFull_NoNak: + //endin r11, res[RXD] + //in r11, res[RXD] setc res[RXD], XS1_SETC_RUN_CLRBUF bu NextToken diff --git a/lib_xud/src/core/included/XUD_Token_SOF.S b/lib_xud/src/core/included/XUD_Token_SOF.S index d8b86a51..7348de38 100644 --- a/lib_xud/src/core/included/XUD_Token_SOF.S +++ b/lib_xud/src/core/included/XUD_Token_SOF.S @@ -8,7 +8,7 @@ Pid_Sof: shr r10, r10, 24; // Shift off junk in r11, res[r1]; - bt r11, InvalidToken; // If VALID_TOKEN not high, ignore token + bt r11, XUD_InvalidToken; // If VALID_TOKEN not high, ignore token #else // NOTE: we are not CRC checking SOF's @@ -44,7 +44,7 @@ Pid_Sof_NoChan: shr r10, r10, 24; /* Shift off junk */ in r11, res[r1]; - bt r11, InvalidToken; /* If VALID_TOKEN not high, ignore token */ + bt r11, XUD_InvalidToken; /* If VALID_TOKEN not high, ignore token */ #else //#include "XUD_G_Crc.S" diff --git a/lib_xud/src/core/included/XUD_Token_Setup.S b/lib_xud/src/core/included/XUD_Token_Setup.S index 3cbce33b..61a1e0c6 100644 --- a/lib_xud/src/core/included/XUD_Token_Setup.S +++ b/lib_xud/src/core/included/XUD_Token_Setup.S @@ -194,7 +194,7 @@ Pid_Setup: shr r10, r10, 24; // Shift off junk in r4, res[r1]; - bt r4, InvalidToken; // If VALID_TOKEN not high, ignore token - PORT INVERTED + bt r4, XUD_InvalidToken; // If VALID_TOKEN not high, ignore token - PORT INVERTED #else #include "XUD_G_Crc.S" #endif diff --git a/lib_xud/src/user/client/XUD_EpFuncs.S b/lib_xud/src/user/client/XUD_EpFuncs.S index dd906220..09b230ac 100644 --- a/lib_xud/src/user/client/XUD_EpFuncs.S +++ b/lib_xud/src/user/client/XUD_EpFuncs.S @@ -293,12 +293,19 @@ XUD_SetData_NoReq: add r1, r1, r3 // Add start index to buffer address CalcTailLength: +#ifdef __XS2A__ + shl r3, r2, 5 // Taillength: bytes to bits * 2 + zext r3, 7 +#else shl r3, r2, 3 // Taillength: bytes to bits zext r3, 5 +#endif + SetupLoopTerm: shr r2, r2, 2 // r2: datalength (bytes) ---> r2: datalength (words) +#ifdef __XS3A__ // TODO do this a bit more effciently.. // If tail is 0 and word-length not 0. Make tail-length 32 and word-length-- bt r3, AdjustBufferPointer @@ -306,6 +313,7 @@ SetupLoopTerm: sub r2, r2, 1 ldc r3, 32 +#endif AdjustBufferPointer: shl r5, r2, 2 // Get end off buffer address From 13976a2423d06511eb96c7bb9136f1080eb016ce Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 30 Oct 2019 10:49:58 +0000 Subject: [PATCH 080/520] Fixed TX Short test --- lib_xud/src/core/included/XUD_Token_In_DI.S | 94 +++++++++------------ 1 file changed, 40 insertions(+), 54 deletions(-) diff --git a/lib_xud/src/core/included/XUD_Token_In_DI.S b/lib_xud/src/core/included/XUD_Token_In_DI.S index b383deac..4a37d01c 100755 --- a/lib_xud/src/core/included/XUD_Token_In_DI.S +++ b/lib_xud/src/core/included/XUD_Token_In_DI.S @@ -35,10 +35,7 @@ XUD_IN_TxNak: // Non-Iso outpw res[TXD], r11, 8 #include "XUD_TokenJmp.S" - - -.align 256 -.skip 156 +.align 8 Pid_In: #include "XUD_CrcAddrCheck.S" ldaw r3, r10[4] // R3 = R10 + 16 @@ -145,9 +142,6 @@ DoneTx: //setv res[RXD], r11 ClearInEpReady: // TODO Tidy this up - //ldw r4, sp[(STACK_EXTEND+8)] / Load num out EPs - //add r11, r4, r10 // IN channel offset (R10: EP number) - ldw r10, r5[r3] // Load the EP struct stw r9, r5[r3] // Clear the ready ldw r11, r10[1] // Load channel @@ -169,7 +163,7 @@ SmallTxPacket: bru r6 // branch taillength //-------------------------------------------------------------------------- -.align 128 +.align 32 .skip 0 TxTail0s: // We know this is a < 4 byte packet, so is 0 length packet // So crc = 0. Note our normal crc calculation works for this, it is @@ -177,70 +171,62 @@ TxTail0s: // We know this is a < 4 byte pa ldc r8, 0 XUD_IN_TxPid_TailS0: outpw res[TXD], r11, 8 // PID - //crc32 r7, r11, r9 // r11: 0 - //not r7, r7 - XUD_IN_TxCrc_TailS0: outpw res[TXD], r8, 16 // r5: 0 bu DoneTail -.align 128 +.align 32 .skip 0 -TxTail1s: - ldc r6, 0 - // One tail byte - shl r8, r8, 8 // Concat PID and Data - or r11, r11, r8 - shr r8, r8, 8 - crc8 r7, r4, r8, r9 - crc32 r7, r6, r9 // r5: 0 +TxTail1s: // One tail byte + shl r6, r8, 8 // Concat PID and Data + or r11, r11, r6 + crc8 r7, r8, r8, r9 + crc32 r7, r4, r9 // r4: 0 not r7, r7 - XUD_IN_TxPid_TailS1: outpw res[TXD], r11, 16 // PID - ///outpw res[TXD], r6, 16 XUD_IN_TxCrc_TailS1: outpw res[TXD], r7, 16 bu DoneTail -.align 128 +.align 32 .skip 0 -TxTail2s: - ldc r6, 0 - - // Two tail byte - shl r8, r8, 8 - or r11, r11, r8 // r11: D1 | D0 | PID - shr r8, r8, 8 - +TxTail2s: // Two tail byte + crcn r7, r8, r9, r6 + shl r6, r8, 8 + crc32 r7, r4, r9 // r4: 0 + {not r7, r7; or r11, r11, r6} XUD_IN_TxPid_TailS2: - outpw res[TXD], r11, 24 - - crc8 r7, r8, r8, r9 - crc8 r7, r8, r8, r9 - crc32 r7, r6, r9 // r6: 0 - not r7, r7 - + outpw res[TXD], r11, 24 // Output PID and 2 bytes of data XUD_IN_TxCrc_TailS2: - outpw res[TXD], r7, 16 - bu DoneTail + outpw res[TXD], r7, 16 // Output CRC16 + bu DoneTail -.align 128 +.align 32 .skip 0 -TxTail3s: - ldc r6, 0 - // Two tail byte +TxTail3s: // Three tail byte XUD_IN_TxPid_TailS3: - outpw res[TXD], r11, 8 // PID - outpw res[TXD], r8, 24 - crc8 r7, r8, r8, r9 - crc8 r7, r8, r8, r9 - crc8 r7, r8, r8, r9 + outpw res[TXD], r11, 8 // PID + outpw res[TXD], r8, 24 + crcn r7, r8, r9, r6 + crc32 r7, r4, r9 // r4: 0 + not r7, r7 +XUD_IN_TxCrc_TailS3: + outpw res[TXD], r7, 16 + bu DoneTail + +.align 32 +.skip 0 +TxTail4s: // Four tail byte +XUD_IN_TxPid_TailS4: + outpw res[TXD], r11, 8 // PID + out res[TXD], r8 + crc32 r7, r8, r9 + crc32 r7, r4, r9 // r4: 0 + not r7, r7 +XUD_IN_TxCrc_TailS4: + outpw res[TXD], r7, 16 + bu DoneTail - crc32 r7, r6, r9 // r5: 0 - not r7, r7 -XUD_IN_TxCrc_TailS3: - outpw res[TXD], r7, 16 - bu DoneTail From 5e803aeda153af596144721c13fd68a28600f2f4 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 30 Oct 2019 11:46:46 +0000 Subject: [PATCH 081/520] Added test_bulk_tx_badack --- .gitignore | 2 + tests/test_bulk_tx_badack.py | 51 ++++++++ tests/test_bulk_tx_badack/LICENSE.txt | 135 ++++++++++++++++++++++ tests/test_bulk_tx_badack/Makefile | 1 + tests/test_bulk_tx_badack/src/main.xc | 84 ++++++++++++++ tests/test_bulk_tx_badack/src/test.xn | 72 ++++++++++++ tests/test_bulk_tx_badack/src/test_xs1.xn | 89 ++++++++++++++ tests/test_bulk_tx_badack/src/test_xs2.xn | 72 ++++++++++++ tests/test_bulk_tx_badack/src/test_xs3.xn | 24 ++++ 9 files changed, 530 insertions(+) create mode 100644 tests/test_bulk_tx_badack.py create mode 100644 tests/test_bulk_tx_badack/LICENSE.txt create mode 100644 tests/test_bulk_tx_badack/Makefile create mode 100644 tests/test_bulk_tx_badack/src/main.xc create mode 100644 tests/test_bulk_tx_badack/src/test.xn create mode 100755 tests/test_bulk_tx_badack/src/test_xs1.xn create mode 100644 tests/test_bulk_tx_badack/src/test_xs2.xn create mode 100644 tests/test_bulk_tx_badack/src/test_xs3.xn diff --git a/.gitignore b/.gitignore index adf022fc..5fe6751c 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,5 @@ _README/** sphinx.output Installs/ .settings +tests/bin.txt +tests/log \ No newline at end of file diff --git a/tests/test_bulk_tx_badack.py b/tests/test_bulk_tx_badack.py new file mode 100644 index 00000000..0ee6a531 --- /dev/null +++ b/tests/test_bulk_tx_badack.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +import random +import xmostest +from usb_packet import * +import usb_packet +from usb_clock import Clock +from helpers import do_usb_test, runall_rx + + +def do_test(arch, tx_clk, tx_phy, seed): + rand = random.Random() + rand.seed(seed) + + ep = 1 + address = 1 + + # The inter-frame gap is to give the DUT time to print its output + packets = [] + + dataval = 0; + + pid = PID_DATA0; + + pktlength = 10 + + for i in range(0, 4): + + if(i == 2): + AppendInToken(packets, ep, address, inter_pkt_gap=4000) + packets.append(RxDataPacket(rand, data_start_val=dataval, length=pktlength, pid=pid)) #DATA1 + packets.append(TxHandshakePacket(pid=0xff)) + + AppendInToken(packets, ep, address, inter_pkt_gap=4000) + packets.append(RxDataPacket(rand, data_start_val=dataval, length=pktlength, pid=pid)) #DATA1 + packets.append(TxHandshakePacket()) + + if(pid == usb_packet.PID_DATA1): + pid = usb_packet.PID_DATA0; + else: + pid = usb_packet.PID_DATA1; + + dataval += pktlength + pktlength += 1 + + # Note, quite big gap to allow checking. + do_usb_test(arch, tx_clk, tx_phy, packets, __file__, seed, + level='smoke', extra_tasks=[]) + +def runtest(): + random.seed(1) + runall_rx(do_test) diff --git a/tests/test_bulk_tx_badack/LICENSE.txt b/tests/test_bulk_tx_badack/LICENSE.txt new file mode 100644 index 00000000..994856c9 --- /dev/null +++ b/tests/test_bulk_tx_badack/LICENSE.txt @@ -0,0 +1,135 @@ +Software Release License Agreement + +Copyright (c) 2015-2018, XMOS, All rights reserved. + +BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. + +Parties: + +(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). + +(2) An individual or legal entity exercising permissions granted by this License (Customer). + +If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. + +1. Definitions + +"License" means this Software License and any schedules or annexes to it. + +"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License + +"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. + +"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. + +"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. + +"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. + +The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. + +Unless the context otherwise requires: + +- references to XMOS and the Customer include their permitted successors and assigns; +- references to statutory provisions include those statutory provisions as amended or re-enacted; and +- references to any gender include all genders. + +Words in the singular include the plural and in the plural include the singular. + +2. License + +XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. + +Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. + +3. Consideration + +In consideration of the mutual obligations contained in this License, the parties agree to its terms. + +4. Term + +Subject to clause 12 below, this License shall be perpetual. + +5. Restrictions on Use + +The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. + +6. Modifications + +The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. + +XMOS will own all intellectual property rights in the XMOS Modifications. +The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. + +7. Support + +Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. + +8. Warranty and Disclaimer + +The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). + +Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. + +XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. + +9. High Risk Activities + +The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. + +10. Liability + +TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. + +Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. + +11. Ownership + +The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. + +12. Termination + +Either party may terminate this License at any time on written notice to the other if the other: + +- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or + +- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. + +Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. + +On termination for any reason: + +- all rights granted to the Customer under this License shall cease; +- the Customer shall cease all activities authorised by this License; +- the Customer shall immediately pay any sums due to XMOS under this License; and +- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. + +Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. + +13. Third party rights + +No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. + +14. Confidentiality and publicity + +Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. + +The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. +The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. + +15. Entire agreement + +This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. + +16. Assignment + +The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. + +17. Governing law and jurisdiction + +This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. + +This License has been entered into on the date stated at the beginning of it. + +Schedule +XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_bulk_tx_badack/Makefile b/tests/test_bulk_tx_badack/Makefile new file mode 100644 index 00000000..6aed3e76 --- /dev/null +++ b/tests/test_bulk_tx_badack/Makefile @@ -0,0 +1 @@ +include ../test_makefile.mak diff --git a/tests/test_bulk_tx_badack/src/main.xc b/tests/test_bulk_tx_badack/src/main.xc new file mode 100644 index 00000000..de39caeb --- /dev/null +++ b/tests/test_bulk_tx_badack/src/main.xc @@ -0,0 +1,84 @@ +// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +/* + * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent + * in both directions between the ports. + * + * NOTE: The src/testbenches/ExampleTestbench must have been compiled for this to run without error. + * + */ +#include +#include +#include +#include "xud.h" +#include "platform.h" +#include "xc_ptr.h" +#include "shared.h" + +#ifndef TEST_EP_NUM +#define TEST_EP_NUM 1 +#endif + +#ifndef PKT_LENGTH_START +#define PKT_LENGTH_START 10 +#endif + +#ifndef PKT_LENGTH_END +#define PKT_LENGTH_END 13 +#endif + +#define XUD_EP_COUNT_OUT 4 +#define XUD_EP_COUNT_IN 4 + +/* Endpoint type tables */ +XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, + XUD_EPTYPE_BUL, + XUD_EPTYPE_BUL, + XUD_EPTYPE_BUL}; +XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, + XUD_EPTYPE_BUL, + XUD_EPTYPE_BUL, + XUD_EPTYPE_ISO}; + +#ifdef XUD_SIM_RTL +int testmain() +#else +int main() +#endif +{ + chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + + par + { + { + #if defined(XUD_TEST_SPEED_FS) + unsigned speed = XUD_SPEED_FS; + #elif defined(XUD_TEST_SPEED_HS) + unsigned speed = XUD_SPEED_HS; + #endif + + // TODO test is running at 400MHz + XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + null, epTypeTableOut, epTypeTableIn, + null, null, -1, speed, XUD_PWR_BUS); + } + + { + unsigned fail = TestEp_Tx(c_ep_in[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_DIE); + +#ifdef XUD_SIM_RTL + /* Note, this test relies on checking at the host side */ + + if(fail) + TerminateFail(fail); + else + TerminatePass(fail); +#endif + + XUD_ep ep_out_0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep_out_0); + exit(0); + } + } + + return 0; +} diff --git a/tests/test_bulk_tx_badack/src/test.xn b/tests/test_bulk_tx_badack/src/test.xn new file mode 100644 index 00000000..d0ee86b8 --- /dev/null +++ b/tests/test_bulk_tx_badack/src/test.xn @@ -0,0 +1,72 @@ + + + Board + XS2 MC Audio + + tileref tile[2] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_tx_badack/src/test_xs1.xn b/tests/test_bulk_tx_badack/src/test_xs1.xn new file mode 100755 index 00000000..573aef45 --- /dev/null +++ b/tests/test_bulk_tx_badack/src/test_xs1.xn @@ -0,0 +1,89 @@ + + + + + tileref tile[1] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_tx_badack/src/test_xs2.xn b/tests/test_bulk_tx_badack/src/test_xs2.xn new file mode 100644 index 00000000..d0ee86b8 --- /dev/null +++ b/tests/test_bulk_tx_badack/src/test_xs2.xn @@ -0,0 +1,72 @@ + + + Board + XS2 MC Audio + + tileref tile[2] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_tx_badack/src/test_xs3.xn b/tests/test_bulk_tx_badack/src/test_xs3.xn new file mode 100644 index 00000000..ab436573 --- /dev/null +++ b/tests/test_bulk_tx_badack/src/test_xs3.xn @@ -0,0 +1,24 @@ + + + + tileref tile[2] + + + + + + + + + + + + + + + + + + From f7bbacf2e9683e917e50328bc52721b1d736187b Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 31 Oct 2019 10:48:17 +0000 Subject: [PATCH 082/520] Dead code re-arrange only --- lib_xud/src/core/XUD_IoLoop.S | 37 +++++++++++++---------------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/lib_xud/src/core/XUD_IoLoop.S b/lib_xud/src/core/XUD_IoLoop.S index 1eaba035..0f521a96 100755 --- a/lib_xud/src/core/XUD_IoLoop.S +++ b/lib_xud/src/core/XUD_IoLoop.S @@ -36,8 +36,8 @@ suspend_t_wtwrsths: // Stack frame: // 0 // 1..7: : Reg save -// 8 : TX handshake timer -// 9 : Out timer +// 8 : // Unused +#define STACK_OUT_TIMER (9) // Used for out data timeout #define STACK_FLAG1_PORT (10) //RXA_port #define STACK_FLAG0_PORT (11) // Valid token port // 12 : ? @@ -262,29 +262,8 @@ ConfigValidToken: setc res[r10], XS1_SETC_COND_NONE ldap r11, TxHandshakeTimeOut // ValidToken is used for timing timeout period when expecting an ack after tx setv res[r10], r11 -#if 0 - // Port counter used instead -TxHandShakeTimer: // Used for timeout waiting for handshake after tx - getr r10, XS1_RES_TYPE_TIMER - ecallf r10 - - ldap r11, TxHandshakeTimeOut - setv res[r10], r11 - setc res[r10], XS1_SETC_COND_AFTER - - stw r10, sp[8] // Save timer resource ID to the stack -#endif -#if 0 -SetupOutTimer: - getr r10, XS1_RES_TYPE_TIMER - ecallf r10 - ldap r11, OutDataTimeOut - setv res[r10], r11 - setc res[r10], XS1_SETC_COND_AFTER - stw r10, sp[9] -#endif #ifndef XUD_TEST_MODE_SUPPORT_DISABLED SetupUsbTestMode: @@ -356,6 +335,18 @@ ConfigRxErrEventVector: eeu res[r3] #endif +#if 0 +SetupOutTimer: + getr r1, XS1_RES_TYPE_TIMER + ecallf r1 + + ldap r11, OutDataTimeOut + setv res[r1], r11 + setc res[r1], XS1_SETC_COND_AFTER + + stw r1, sp[STACK_OUT_TIMER] +#endif + SetupSuspendResetTimer: getr r10, XS1_RES_TYPE_TIMER From 57e6f6aa103f5edf238cc2cf3cce3a1bc8ecccb6 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 31 Oct 2019 10:49:03 +0000 Subject: [PATCH 083/520] Whitespace tidy and some DI --- lib_xud/src/core/included/XUD_Token_In_DI.S | 94 +++++++++------------ 1 file changed, 38 insertions(+), 56 deletions(-) diff --git a/lib_xud/src/core/included/XUD_Token_In_DI.S b/lib_xud/src/core/included/XUD_Token_In_DI.S index 4a37d01c..14917334 100755 --- a/lib_xud/src/core/included/XUD_Token_In_DI.S +++ b/lib_xud/src/core/included/XUD_Token_In_DI.S @@ -38,24 +38,24 @@ XUD_IN_TxNak: // Non-Iso .align 8 Pid_In: #include "XUD_CrcAddrCheck.S" - ldaw r3, r10[4] // R3 = R10 + 16 - ldw r4, r5[r3] // Load EP structure address - bf r4, InNotReady // If 0 then not ready... + ldaw r3, r10[4] // R3 = R10 + 16 + ldw r4, r5[r3] // Load EP structure address + bf r4, InNotReady // If 0 then not ready... In_LoadPid: - ldw r11, r4[4] // Load PID from structure + ldw r11, r4[4] // Load PID from structure InReady: - ldw r8, r4[3] // Load buffer + ldw r8, r4[3] // Load buffer - ldw r6, r4[7] // Load tail length (bytes) + ldw r6, r4[7] // Load tail length (bytes) - ldw r4, r4[6] // Load buffer index - bf r4, SmallTxPacket // Check for Short packet + ldw r4, r4[6] // Load buffer index + bf r4, SmallTxPacket // Check for Short packet XUD_IN_Tx: - outpw res[TXD], r11, 8 // Out PID - ldw r11, r8[r4] // Load first data word + outpw res[TXD], r11, 8 // Out PID + ldw r11, r8[r4] // Load first data word XUD_IN_TxPid: out res[TXD], r11 @@ -63,103 +63,87 @@ XUD_IN_TxPid: bf r4, XUD_IN_TxLoopEnd XUD_IN_TxLoop: - ldw r11, r8[r4] // Load first data word + ldw r11, r8[r4] // Load first data word crc32_inc r7, r11, r9, r4, 1 - {out res[TXD], r11; bt r4, XUD_IN_TxLoop} + {out res[TXD], r11; bt r4, XUD_IN_TxLoop} XUD_IN_TxLoopEnd: - ldw r11, r8[r4] // Load tail + ldw r11, r8[r4] // Load tail crcn r7, r11, r9, r6 outpw res[TXD], r11, r6 XUD_IN_TxLoopEnd_CrcCalc: - crc32 r7, r4, r9 // r4: 0 (from bf) + crc32 r7, r4, r9 // r4: 0 (from bf) not r7, r7 XUD_IN_TxCrc: - outpw res[TXD], r7, 16 // Output 16-bit CRC + outpw res[TXD], r7, 16 // Output 16-bit CRC .scheduling default // Wait for handshake... or timeout DoneTail: ldw r11, sp[SP_EPTYPES_OUT] - ldw r11, r11[r10] // Load EP Type + ldw r11, r11[r10] // Load EP Type bt r11, SetupReceiveHandShake + bu DoneTx -InISO: - ldc r9, 0 //TODO - bu DoneTx - -InNonISO: SetupReceiveHandShake: ldc r11, 8 - setpsc res[RXD], r11 // Set port shift count (expect 8 bit handshake) - //ldap r11, TxHandShakeReceived - //setv res[RXD], r11 - eeu res[RXD] // Events on RXD always enabled - Can;t be any more due to using events on channels - -SetupTimeout: // Timeout done using another port off same clock block we dont happen to already be using events on. Cunning. - ldw r1, sp[STACK_FLAG0_PORT] // Load saved ValidToken port. Event vector already set. - in r11, res[r1] // Do input and get port time/timestamps + setpsc res[RXD], r11 // Set port shift count (expect 8 bit handshake) + eeu res[RXD] // Events on RXD always enabled - Can;t be any more due to using events on channels + +SetupTimeout: // Timeout done using another port off same clock block we dont happen to already be using events on. Cunning. + ldw r1, sp[STACK_FLAG0_PORT] // Load saved ValidToken port. Event vector already set. + in r11, res[r1] // Do input and get port time/timestamps getts r11, res[r1] ldw r9, dp[g_txHandshakeTimeout] add r11, r11, r9 - setpt res[r1], r11 // Set port time and enable events + setpt res[r1], r11 // Set port time and enable events eeu res[r1] -WaitForHandshake: // Wait for timeout or handshake +WaitForHandshake: // Wait for timeout or handshake .xtabranch TxHandshakeTimeOut, TxHandShakeReceived waiteu - // We sent some data but the host didn't handshake in time. Needs a re-send. .align 4 TxHandshakeTimeOut: - in r11, res[r1] // This will clear port time + in r11, res[r1] // This will clear port time edu res[r1] - edu res[RXD] - bu BadHandShake + {edu res[RXD]; bu BadHandshake} // Transmitted data, and got something back within the timeout. Check for valid handshake... .align 4 TxHandShakeReceived: XUD_IN_RxAck: - in r11, res[RXD] // Input data from RXD port - clrpt res[r1] // Clear port time on valid token port - edu res[RXD] - shr r11, r11, 24 // Shift off junk data to leave ACK + in r11, res[RXD] // Input data from RXD port + clrpt res[r1] // Clear port time on valid token port + {edu res[RXD]; shr r11, r11, 24} // Shift off junk data to leave ACK #if defined(__XS2A__) || defined(__XS1B__) - ldc r9, USB_PID_ACK // Check for good ACK (L series strips of negated bits from PID) + ldc r9, USB_PID_ACK // Check for good ACK (L series strips of negated bits from PID) #else ldc r9, USB_PIDn_ACK #endif xor r9, r11, r9 - edu res[r1] // Disable events on ValidToken port - bt r9, BadHandShake // Invalid handshake received from host. we need to resend... + {edu res[r1]; bt r9, BadHandshake} // Disable events on ValidToken port DoneTx: - //ldap r11, NextRxWord // Restore RXD event vector - //setv res[RXD], r11 ClearInEpReady: // TODO Tidy this up + ldc r9, 0 // TODO ldw r10, r5[r3] // Load the EP struct stw r9, r5[r3] // Clear the ready ldw r11, r10[1] // Load channel out res[r11], r11 // Output word to signal packet sent okay - bu NextToken -BadHandShake: // Received a bad (or no)handshake - //ldap r11, NextRxWord // Restore RXD event vector - //setv res[RXD], r11 - bu NextToken +BadHandshake: + bu NextToken .align 64 .skip 56 SmallTxPacket: - ldw r8, r8[r4] // Load first data word - -.xtabranch TxTail0s, TxTail1s, TxTail2s, TxTail3s + ldw r8, r8[r4] // Load first data word bru r6 // branch taillength //-------------------------------------------------------------------------- @@ -167,12 +151,12 @@ SmallTxPacket: .skip 0 TxTail0s: // We know this is a < 4 byte packet, so is 0 length packet // So crc = 0. Note our normal crc calculation works for this, it is - //not a special CRC case, but helps with timing. + // Not a special CRC case, but helps with timing. ldc r8, 0 XUD_IN_TxPid_TailS0: outpw res[TXD], r11, 8 // PID XUD_IN_TxCrc_TailS0: - outpw res[TXD], r8, 16 // r5: 0 + outpw res[TXD], r8, 16 // Output CRC bu DoneTail .align 32 @@ -228,5 +212,3 @@ XUD_IN_TxCrc_TailS4: outpw res[TXD], r7, 16 bu DoneTail - - From 5b5cd9ddcb755c2a671c513b960a4c480d5dfe91 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 31 Oct 2019 10:50:13 +0000 Subject: [PATCH 084/520] Added test_bulk_tx_noack --- tests/test_bulk_tx_noack.py | 51 +++++++++ tests/test_bulk_tx_noack/LICENSE.txt | 135 +++++++++++++++++++++++ tests/test_bulk_tx_noack/Makefile | 1 + tests/test_bulk_tx_noack/src/main.xc | 83 ++++++++++++++ tests/test_bulk_tx_noack/src/test.xn | 72 ++++++++++++ tests/test_bulk_tx_noack/src/test_xs1.xn | 89 +++++++++++++++ tests/test_bulk_tx_noack/src/test_xs2.xn | 72 ++++++++++++ tests/test_bulk_tx_noack/src/test_xs3.xn | 24 ++++ 8 files changed, 527 insertions(+) create mode 100644 tests/test_bulk_tx_noack.py create mode 100644 tests/test_bulk_tx_noack/LICENSE.txt create mode 100644 tests/test_bulk_tx_noack/Makefile create mode 100644 tests/test_bulk_tx_noack/src/main.xc create mode 100644 tests/test_bulk_tx_noack/src/test.xn create mode 100755 tests/test_bulk_tx_noack/src/test_xs1.xn create mode 100644 tests/test_bulk_tx_noack/src/test_xs2.xn create mode 100644 tests/test_bulk_tx_noack/src/test_xs3.xn diff --git a/tests/test_bulk_tx_noack.py b/tests/test_bulk_tx_noack.py new file mode 100644 index 00000000..3dcb256a --- /dev/null +++ b/tests/test_bulk_tx_noack.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +import random +import xmostest +from usb_packet import * +import usb_packet +from usb_clock import Clock +from helpers import do_usb_test, runall_rx + + +def do_test(arch, tx_clk, tx_phy, seed): + rand = random.Random() + rand.seed(seed) + + ep = 1 + address = 1 + + # The inter-frame gap is to give the DUT time to print its output + packets = [] + + dataval = 0; + + pid = PID_DATA0; + + pktlength = 10 + + for i in range(0, 4): + + if(i == 2): + AppendInToken(packets, ep, address, inter_pkt_gap=4000) + packets.append(RxDataPacket(rand, data_start_val=dataval, length=pktlength, pid=pid)) + # Missing ACK - simulate CRC fail at host + + AppendInToken(packets, ep, address, inter_pkt_gap=4000) + packets.append(RxDataPacket(rand, data_start_val=dataval, length=pktlength, pid=pid)) + packets.append(TxHandshakePacket()) + + if(pid == usb_packet.PID_DATA1): + pid = usb_packet.PID_DATA0; + else: + pid = usb_packet.PID_DATA1; + + dataval += pktlength + pktlength += 1 + + # Note, quite big gap to allow checking. + do_usb_test(arch, tx_clk, tx_phy, packets, __file__, seed, + level='smoke', extra_tasks=[]) + +def runtest(): + random.seed(1) + runall_rx(do_test) diff --git a/tests/test_bulk_tx_noack/LICENSE.txt b/tests/test_bulk_tx_noack/LICENSE.txt new file mode 100644 index 00000000..994856c9 --- /dev/null +++ b/tests/test_bulk_tx_noack/LICENSE.txt @@ -0,0 +1,135 @@ +Software Release License Agreement + +Copyright (c) 2015-2018, XMOS, All rights reserved. + +BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. + +Parties: + +(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). + +(2) An individual or legal entity exercising permissions granted by this License (Customer). + +If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. + +1. Definitions + +"License" means this Software License and any schedules or annexes to it. + +"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License + +"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. + +"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. + +"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. + +"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. + +The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. + +Unless the context otherwise requires: + +- references to XMOS and the Customer include their permitted successors and assigns; +- references to statutory provisions include those statutory provisions as amended or re-enacted; and +- references to any gender include all genders. + +Words in the singular include the plural and in the plural include the singular. + +2. License + +XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. + +Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. + +3. Consideration + +In consideration of the mutual obligations contained in this License, the parties agree to its terms. + +4. Term + +Subject to clause 12 below, this License shall be perpetual. + +5. Restrictions on Use + +The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. + +6. Modifications + +The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. + +XMOS will own all intellectual property rights in the XMOS Modifications. +The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. + +7. Support + +Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. + +8. Warranty and Disclaimer + +The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). + +Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. + +XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. + +9. High Risk Activities + +The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. + +10. Liability + +TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. + +Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. + +11. Ownership + +The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. + +12. Termination + +Either party may terminate this License at any time on written notice to the other if the other: + +- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or + +- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. + +Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. + +On termination for any reason: + +- all rights granted to the Customer under this License shall cease; +- the Customer shall cease all activities authorised by this License; +- the Customer shall immediately pay any sums due to XMOS under this License; and +- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. + +Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. + +13. Third party rights + +No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. + +14. Confidentiality and publicity + +Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. + +The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. +The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. + +15. Entire agreement + +This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. + +16. Assignment + +The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. + +17. Governing law and jurisdiction + +This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. + +This License has been entered into on the date stated at the beginning of it. + +Schedule +XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_bulk_tx_noack/Makefile b/tests/test_bulk_tx_noack/Makefile new file mode 100644 index 00000000..6aed3e76 --- /dev/null +++ b/tests/test_bulk_tx_noack/Makefile @@ -0,0 +1 @@ +include ../test_makefile.mak diff --git a/tests/test_bulk_tx_noack/src/main.xc b/tests/test_bulk_tx_noack/src/main.xc new file mode 100644 index 00000000..8ad51c10 --- /dev/null +++ b/tests/test_bulk_tx_noack/src/main.xc @@ -0,0 +1,83 @@ +// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +/* + * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent + * in both directions between the ports. + * + * NOTE: The src/testbenches/ExampleTestbench must have been compiled for this to run without error. + * + */ +#include +#include +#include +#include "xud.h" +#include "platform.h" +#include "shared.h" + +#ifndef TEST_EP_NUM +#define TEST_EP_NUM 1 +#endif + +#ifndef PKT_LENGTH_START +#define PKT_LENGTH_START 10 +#endif + +#ifndef PKT_LENGTH_END +#define PKT_LENGTH_END 13 +#endif + +#define XUD_EP_COUNT_OUT 4 +#define XUD_EP_COUNT_IN 4 + +/* Endpoint type tables */ +XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, + XUD_EPTYPE_BUL, + XUD_EPTYPE_BUL, + XUD_EPTYPE_BUL}; +XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, + XUD_EPTYPE_BUL, + XUD_EPTYPE_BUL, + XUD_EPTYPE_ISO}; + +#ifdef XUD_SIM_RTL +int testmain() +#else +int main() +#endif +{ + chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + + par + { + { + #if defined(XUD_TEST_SPEED_FS) + unsigned speed = XUD_SPEED_FS; + #elif defined(XUD_TEST_SPEED_HS) + unsigned speed = XUD_SPEED_HS; + #endif + + // TODO test is running at 400MHz + XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + null, epTypeTableOut, epTypeTableIn, + null, null, -1, speed, XUD_PWR_BUS); + } + + { + unsigned fail = TestEp_Tx(c_ep_in[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_DIE); + +#ifdef XUD_SIM_RTL + /* Note, this test relies on checking at the host side */ + + if(fail) + TerminateFail(fail); + else + TerminatePass(fail); +#endif + + XUD_ep ep_out_0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep_out_0); + exit(0); + } + } + + return 0; +} diff --git a/tests/test_bulk_tx_noack/src/test.xn b/tests/test_bulk_tx_noack/src/test.xn new file mode 100644 index 00000000..d0ee86b8 --- /dev/null +++ b/tests/test_bulk_tx_noack/src/test.xn @@ -0,0 +1,72 @@ + + + Board + XS2 MC Audio + + tileref tile[2] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_tx_noack/src/test_xs1.xn b/tests/test_bulk_tx_noack/src/test_xs1.xn new file mode 100755 index 00000000..573aef45 --- /dev/null +++ b/tests/test_bulk_tx_noack/src/test_xs1.xn @@ -0,0 +1,89 @@ + + + + + tileref tile[1] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_tx_noack/src/test_xs2.xn b/tests/test_bulk_tx_noack/src/test_xs2.xn new file mode 100644 index 00000000..d0ee86b8 --- /dev/null +++ b/tests/test_bulk_tx_noack/src/test_xs2.xn @@ -0,0 +1,72 @@ + + + Board + XS2 MC Audio + + tileref tile[2] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_tx_noack/src/test_xs3.xn b/tests/test_bulk_tx_noack/src/test_xs3.xn new file mode 100644 index 00000000..ab436573 --- /dev/null +++ b/tests/test_bulk_tx_noack/src/test_xs3.xn @@ -0,0 +1,24 @@ + + + + tileref tile[2] + + + + + + + + + + + + + + + + + + From 57ced8c766aabef4fb915f969fba8a578aacf532 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 31 Oct 2019 10:50:59 +0000 Subject: [PATCH 085/520] Removed unused header --- tests/test_bulk_tx_badack/src/main.xc | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_bulk_tx_badack/src/main.xc b/tests/test_bulk_tx_badack/src/main.xc index de39caeb..8ad51c10 100644 --- a/tests/test_bulk_tx_badack/src/main.xc +++ b/tests/test_bulk_tx_badack/src/main.xc @@ -11,7 +11,6 @@ #include #include "xud.h" #include "platform.h" -#include "xc_ptr.h" #include "shared.h" #ifndef TEST_EP_NUM From 1b853a674336da2da9fd2f36468715c0423e2573 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 5 Nov 2019 11:13:14 +0000 Subject: [PATCH 086/520] merge ? --- lib_xud/src/core/included/XUD_RxData.S | 102 ++++++++++++++++++ .../src/core/included/XUD_Token_Setup_DI.S | 82 -------------- 2 files changed, 102 insertions(+), 82 deletions(-) create mode 100644 lib_xud/src/core/included/XUD_RxData.S diff --git a/lib_xud/src/core/included/XUD_RxData.S b/lib_xud/src/core/included/XUD_RxData.S new file mode 100644 index 00000000..c1323b8d --- /dev/null +++ b/lib_xud/src/core/included/XUD_RxData.S @@ -0,0 +1,102 @@ + + +#define PASTER(x,y) x ## _ ## y +#define EVALUATOR(x,y) PASTER(x,y) +//#define LABEL(fun) EVALUATOR(fun, LABELNO) +#define LABEL(fun) fun + +// r0: RXD: Rx Data port +// r1: Buffer +// r2: Tx Port +// r3: Ep structure +// r4: zero +// r5: buffer address +// r5: ep structures array +// r6: crc rx init +// r7: crc tx init +// r9: crc poly +// r8: +// r10: ep number +// r11: scratch + +doRXData_badPid: + ldc r8, 16 // Note, this is a cut-down version of XUD_TokenJump.S + ldaw r10, dp[PidJumpTable] + ldw r11, r10[r7] + {bau r11; setpsc res[RXD], r8} + +LABEL(doRXData): + + inpw r8, res[r0], 8 // Input PID + + // If pid != DATAx then jump and handle as a token. DATA0, DATA1, DATA2 & MDATA all of the form 0bxx11. + // This is a fast alternative to a "timeout" + {shr r7, r8, 24; mkmsk r11, 2} + and r11, r11, r7 + eq r11, r11, 3 + bf r11, doRXData_badPid + {setsr 1; ldw r7, sp[10]} // Load RxA Port ID + +LABEL(GotRxPid): + eeu res[r7] // Enable events on RxA + +LABEL(NextRxWord): + in r11, res[r0] + stw r11, r1[r4] + crc32_inc r6, r11, r9, r4, 1 + in r11, res[r0] + stw r11, r1[r4] + crc32_inc r6, r11, r9, r4, 1 + in r11, res[r0] + stw r11, r1[r4] + crc32_inc r6, r11, r9, r4, 1 + in r11, res[r0] + stw r11, r1[r4] + crc32_inc r6, r11, r9, r4, 1 + bu LABEL(NextRxWord) + +///////////////////////////////////////////////////////////////////////////// +.align 32 +.skip 20 +RxALow: + {stw r8, r3[6]; in r7, res[r7]} // Store (NON-SHIFTED) PID into EP structure, + // Clear event data on RXA + endin r8, res[r0] +LABEL(RxTail): + {in r11, res[r0]; bru r8} + +// Word aligned data (0 byte tail) +.align 32 +OutTail0: + crc32 r6, r8, r9 // CRC zero step + ldw r11, sp[STACK_RXCRC_TAIL0] + RETSP_u6 0 + +// 1 Tail Byte +.align 32 +OutTail1: + shr r11, r11, 24 // Shift off junk + crc32 r6, r11, r9 + stw r11, r1[r4] // Store last data + LDWSP_ru6 r11, sp[STACK_RXCRC_TAIL1] + RETSP_u6 0 + +// Two Tail Bytes +.align 32 +OutTail2: + shr r11, r11, 16 + crc32 r6, r11, r9 + stw r11, r1[r4] // Store last data + ldw r11, sp[STACK_RXCRC_TAIL2] + RETSP_u6 0 + +// Three Tail Bytes +.align 32 +OutTail3: + shr r11, r11, 8 + stw r11, r1[r4] // Store last data + crc32 r6, r11, r9 + LDWSP_ru6 r11, sp[STACK_RXCRC_TAIL3] + crc8 r6, r1, r2, r9 // Use the fact the the bottom byte of port id is 0.. saves us an ldc + RETSP_u6 0 + diff --git a/lib_xud/src/core/included/XUD_Token_Setup_DI.S b/lib_xud/src/core/included/XUD_Token_Setup_DI.S index 54909d57..3192682c 100644 --- a/lib_xud/src/core/included/XUD_Token_Setup_DI.S +++ b/lib_xud/src/core/included/XUD_Token_Setup_DI.S @@ -1,87 +1,5 @@ // Copyright (c) 2011-2019, XMOS Ltd, All rights reserved -.text - -// r3: Ep structure -// r5: buffer address -// RXD: Rx Data port -// r4: zero -// r5: ep structures array -// r6: crc rx init -// r7: crc tx init -// r9: crc poly -// r10: ep number -// r11: scratch -.align 4 -.skip 0 -doRXData: - ldw r7, sp[10] // Load RxA Port ID (r1) - inpw r8, res[r0], 8 // Input PID -GotRxPid: - {stw r8, r3[6]; eeu res[r7]} // Store (NON-SHIFTED) PID into EP structure - setsr 1 // Enable thread events - -NextRxWord: // RXD port has event vector here - in r11, res[r0] - stw r11, r1[r4] - crc32_inc r6, r11, r9, r4, 1 - bu NextRxWord - -///////////////////////////////////////////////////////////////////////////// -.align 32 -.skip 16 -RxALow: - in r7, res[r7] // Clear event data on RXA - endin r8, res[r0] -XUD_OUT_RxTail: - {in r11, res[r0]; bru r8} - -// Word aligned data (0 byte tail) -.align 32 -OutTail0: - crc32 r6, r8, r9 // CRC zero step - ldw r11, sp[STACK_RXCRC_TAIL0] - RETSP_u6 0 - -// 1 Tail Byte -.align 32 -OutTail1: - shr r11, r11, 24 // Shift off junk - crc32 r6, r11, r9 - stw r11, r1[r4] // Store last data - LDWSP_ru6 r11, sp[STACK_RXCRC_TAIL1] - RETSP_u6 0 - -// Two Tail Bytes -.align 32 -OutTail2: - shr r11, r11, 16 - crc32 r6, r11, r9 - stw r11, r1[r4] // Store last data - ldw r11, sp[STACK_RXCRC_TAIL2] - RETSP_u6 0 - -// Three Tail Bytes -.align 32 -OutTail3: - shr r11, r11, 8 - stw r11, r1[r4] // Store last data - crc32 r6, r11, r9 - LDWSP_ru6 r11, sp[STACK_RXCRC_TAIL3] - crc8 r6, r1, r2, r9 // Use the fact the the bottom byte of port id is 0.. saves us an ldc - RETSP_u6 0 - -// Four Tail Bytes -.align 32 -OutTail4: - bu ERR_EndIn4 - -// Five Tail Bytes -.align 32 -OutTail5: - bu ERR_EndIn5 - - // We received a setup token. This is much the same as out token, apart from: // - Can't NAK a setup // - Data PID will always be DATA0 From b18bf4e789693112c328183d87c4c9257c15bd97 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 5 Nov 2019 11:14:01 +0000 Subject: [PATCH 087/520] Added test_bulk_rx_basic_nodata --- tests/test_bulk_rx_basic_nodata.py | 60 ++++++++ tests/test_bulk_rx_basic_nodata/LICENSE.txt | 135 ++++++++++++++++++ tests/test_bulk_rx_basic_nodata/Makefile | 1 + tests/test_bulk_rx_basic_nodata/src/main.xc | 67 +++++++++ tests/test_bulk_rx_basic_nodata/src/test.xn | 72 ++++++++++ .../test_bulk_rx_basic_nodata/src/test_xs1.xn | 89 ++++++++++++ .../test_bulk_rx_basic_nodata/src/test_xs2.xn | 72 ++++++++++ .../test_bulk_rx_basic_nodata/src/test_xs3.xn | 24 ++++ 8 files changed, 520 insertions(+) create mode 100644 tests/test_bulk_rx_basic_nodata.py create mode 100644 tests/test_bulk_rx_basic_nodata/LICENSE.txt create mode 100644 tests/test_bulk_rx_basic_nodata/Makefile create mode 100644 tests/test_bulk_rx_basic_nodata/src/main.xc create mode 100644 tests/test_bulk_rx_basic_nodata/src/test.xn create mode 100755 tests/test_bulk_rx_basic_nodata/src/test_xs1.xn create mode 100644 tests/test_bulk_rx_basic_nodata/src/test_xs2.xn create mode 100644 tests/test_bulk_rx_basic_nodata/src/test_xs3.xn diff --git a/tests/test_bulk_rx_basic_nodata.py b/tests/test_bulk_rx_basic_nodata.py new file mode 100644 index 00000000..eed7eb7e --- /dev/null +++ b/tests/test_bulk_rx_basic_nodata.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python + +# Rx out of seq (but valid.. ) data PID + +import random +import xmostest +from usb_packet import * +from usb_clock import Clock +from helpers import do_usb_test, runall_rx + + +# Single, setup transaction to EP 0 + +def do_test(arch, clk, phy, seed): + rand = random.Random() + rand.seed(seed) + + address = 1 + ep = 1 + + # The inter-frame gap is to give the DUT time to print its output + packets = [] + + dataval = 0; + + ipg = 500 + + AppendOutToken(packets, ep, address) + packets.append(TxDataPacket(rand, data_start_val=dataval, length=10, pid=0x3)) #DATA0 + packets.append(RxHandshakePacket()) + + dataval += 10 + AppendOutToken(packets, ep, address, inter_pkt_gap=ipg) + packets.append(TxDataPacket(rand, data_start_val=dataval, length=11, pid=0xb)) #DATA1 + packets.append(RxHandshakePacket()) + + AppendOutToken(packets, ep, address, inter_pkt_gap=ipg) + # MISSING DATA PAYLOAD + + + dataval += 11 + AppendOutToken(packets, ep, address, inter_pkt_gap=ipg) + packets.append(TxDataPacket(rand, data_start_val=dataval, length=12, pid=0x3)) #DATA0 + packets.append(RxHandshakePacket()) + + dataval += 12 + AppendOutToken(packets, ep, address, inter_pkt_gap=ipg) + packets.append(TxDataPacket(rand, data_start_val=dataval, length=13, pid=0xb)) #DATA1 + packets.append(RxHandshakePacket()) + + dataval += 13 + AppendOutToken(packets, ep, address, inter_pkt_gap=ipg) + packets.append(TxDataPacket(rand, data_start_val=dataval, length=14, pid=0x3)) #DATA0 + packets.append(RxHandshakePacket()) + + do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) + +def runtest(): + random.seed(1) + runall_rx(do_test) diff --git a/tests/test_bulk_rx_basic_nodata/LICENSE.txt b/tests/test_bulk_rx_basic_nodata/LICENSE.txt new file mode 100644 index 00000000..994856c9 --- /dev/null +++ b/tests/test_bulk_rx_basic_nodata/LICENSE.txt @@ -0,0 +1,135 @@ +Software Release License Agreement + +Copyright (c) 2015-2018, XMOS, All rights reserved. + +BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. + +Parties: + +(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). + +(2) An individual or legal entity exercising permissions granted by this License (Customer). + +If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. + +1. Definitions + +"License" means this Software License and any schedules or annexes to it. + +"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License + +"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. + +"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. + +"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. + +"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. + +The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. + +Unless the context otherwise requires: + +- references to XMOS and the Customer include their permitted successors and assigns; +- references to statutory provisions include those statutory provisions as amended or re-enacted; and +- references to any gender include all genders. + +Words in the singular include the plural and in the plural include the singular. + +2. License + +XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. + +Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. + +3. Consideration + +In consideration of the mutual obligations contained in this License, the parties agree to its terms. + +4. Term + +Subject to clause 12 below, this License shall be perpetual. + +5. Restrictions on Use + +The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. + +6. Modifications + +The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. + +XMOS will own all intellectual property rights in the XMOS Modifications. +The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. + +7. Support + +Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. + +8. Warranty and Disclaimer + +The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). + +Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. + +XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. + +9. High Risk Activities + +The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. + +10. Liability + +TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. + +Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. + +11. Ownership + +The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. + +12. Termination + +Either party may terminate this License at any time on written notice to the other if the other: + +- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or + +- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. + +Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. + +On termination for any reason: + +- all rights granted to the Customer under this License shall cease; +- the Customer shall cease all activities authorised by this License; +- the Customer shall immediately pay any sums due to XMOS under this License; and +- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. + +Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. + +13. Third party rights + +No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. + +14. Confidentiality and publicity + +Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. + +The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. +The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. + +15. Entire agreement + +This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. + +16. Assignment + +The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. + +17. Governing law and jurisdiction + +This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. + +This License has been entered into on the date stated at the beginning of it. + +Schedule +XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_bulk_rx_basic_nodata/Makefile b/tests/test_bulk_rx_basic_nodata/Makefile new file mode 100644 index 00000000..6aed3e76 --- /dev/null +++ b/tests/test_bulk_rx_basic_nodata/Makefile @@ -0,0 +1 @@ +include ../test_makefile.mak diff --git a/tests/test_bulk_rx_basic_nodata/src/main.xc b/tests/test_bulk_rx_basic_nodata/src/main.xc new file mode 100644 index 00000000..92dcbde0 --- /dev/null +++ b/tests/test_bulk_rx_basic_nodata/src/main.xc @@ -0,0 +1,67 @@ +// Copyright (c) 2018-2019, XMOS Ltd, All rights reserved +#include +#include +#include +#include "xud.h" +#include "platform.h" +#include "shared.h" + +#define XUD_EP_COUNT_OUT 5 +#define XUD_EP_COUNT_IN 5 + +#ifndef PKT_LENGTH_START +#define PKT_LENGTH_START 10 +#endif + +#ifndef PKT_LENGTH_END +#define PKT_LENGTH_END 14 +#endif + +#ifndef TEST_EP_NUM +#define TEST_EP_NUM 1 +#endif + +/* Endpoint type tables */ +XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; +XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; + +#ifdef XUD_SIM_RTL +int testmain() +#else +int main() +#endif +{ + chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + + par + { + { + #if defined(XUD_TEST_SPEED_FS) + unsigned speed = XUD_SPEED_FS; + #elif defined(XUD_TEST_SPEED_HS) + unsigned speed = XUD_SPEED_HS; + #else + #error XUD_TEST_SPEED_XX not defined + #endif + + XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + null, epTypeTableOut, epTypeTableIn, + null, null, -1, speed, XUD_PWR_BUS); + } + + { + unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); + + if(fail) + TerminateFail(fail); + else + TerminatePass(fail); + + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep0); + exit(0); + } + } + + return 0; +} diff --git a/tests/test_bulk_rx_basic_nodata/src/test.xn b/tests/test_bulk_rx_basic_nodata/src/test.xn new file mode 100644 index 00000000..d0ee86b8 --- /dev/null +++ b/tests/test_bulk_rx_basic_nodata/src/test.xn @@ -0,0 +1,72 @@ + + + Board + XS2 MC Audio + + tileref tile[2] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_rx_basic_nodata/src/test_xs1.xn b/tests/test_bulk_rx_basic_nodata/src/test_xs1.xn new file mode 100755 index 00000000..573aef45 --- /dev/null +++ b/tests/test_bulk_rx_basic_nodata/src/test_xs1.xn @@ -0,0 +1,89 @@ + + + + + tileref tile[1] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_rx_basic_nodata/src/test_xs2.xn b/tests/test_bulk_rx_basic_nodata/src/test_xs2.xn new file mode 100644 index 00000000..d0ee86b8 --- /dev/null +++ b/tests/test_bulk_rx_basic_nodata/src/test_xs2.xn @@ -0,0 +1,72 @@ + + + Board + XS2 MC Audio + + tileref tile[2] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test_bulk_rx_basic_nodata/src/test_xs3.xn b/tests/test_bulk_rx_basic_nodata/src/test_xs3.xn new file mode 100644 index 00000000..ab436573 --- /dev/null +++ b/tests/test_bulk_rx_basic_nodata/src/test_xs3.xn @@ -0,0 +1,24 @@ + + + + tileref tile[2] + + + + + + + + + + + + + + + + + + From 40527c1382d1b18bb17f3ac3281d21541226ff92 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 5 Nov 2019 11:14:29 +0000 Subject: [PATCH 088/520] Fixed XS3 RXE in testbench --- tests/helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/helpers.py b/tests/helpers.py index 58686feb..61c9f406 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -46,7 +46,7 @@ def get_usb_clk_phy(verbose=True, test_ctrl=None, do_timeout=True, phy = UsbPhyUtmi('XS1_USB_RXD', 'XS1_USB_RXA', #rxa 'XS1_USB_RXV', #rxv - 'tile[0]:XS1_PORT_1G', #rxe + 'XS1_USB_RXE', #rxe 'tile[0]:XS1_PORT_8A', #txd 'tile[0]:XS1_PORT_1K', #txv 'tile[0]:XS1_PORT_1H', #txrdy From 34fb0939606305aab73bef45a32695f711a27664 Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Thu, 19 Dec 2019 14:24:55 +0000 Subject: [PATCH 089/520] RTL test build fix --- lib_xud/src/core/XUD_IoLoop.S | 1 + 1 file changed, 1 insertion(+) diff --git a/lib_xud/src/core/XUD_IoLoop.S b/lib_xud/src/core/XUD_IoLoop.S index 0f521a96..1e4a1ec5 100755 --- a/lib_xud/src/core/XUD_IoLoop.S +++ b/lib_xud/src/core/XUD_IoLoop.S @@ -201,6 +201,7 @@ ResetIntHandler: #include "./included/XUD_Token_Out.S" #include "./included/XUD_Token_Ping.S" #include "./included/XUD_Token_SOF.S" +#include "./included/XUD_RxData.S" BadCrcAddr: // zext r11, 8 From 0b8e2e82b01416b80a8a02a6f65a124f99027241 Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Thu, 19 Dec 2019 14:46:09 +0000 Subject: [PATCH 090/520] Added packet size checks to shared test code --- tests/shared_src/shared.h | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/tests/shared_src/shared.h b/tests/shared_src/shared.h index a03b6a5a..f9886baf 100644 --- a/tests/shared_src/shared.h +++ b/tests/shared_src/shared.h @@ -127,34 +127,33 @@ unsigned fail(int x) } #pragma unsafe arrays -int RxDataCheck(unsigned char b[], int l, int epNum) +int RxDataCheck(unsigned char b[], int l, int epNum, unsigned expectedLength) { - // TODO check lengths + if (l != expectedLength) + return 2; + for (int i = 0; i < l; i++) { unsigned char y; - //read_byte_via_xc_ptr_indexed(y, p_rxDataCheck, epNum); unsafe { - - if(b[i] != g_rxDataCheck[epNum]) - { + if(b[i] != g_rxDataCheck[epNum]) + { #ifdef XUD_SIM_XSIM - printstr("#### Mismatch on EP: "); - printint(epNum); - printstr(". Got:"); - printhex(b[i]); - printstr(" Expected:"); - printhex(g_rxDataCheck[epNum]); - printstr(" Pkt len: "); - printintln(l); // Packet length + printstr("#### Mismatch on EP: "); + printint(epNum); + printstr(". Got:"); + printhex(b[i]); + printstr(" Expected:"); + printhex(g_rxDataCheck[epNum]); + printstr(" Pkt len: "); + printintln(l); // Packet length #endif - return 1; - } - - g_rxDataCheck[epNum]++; + return 1; + } + g_rxDataCheck[epNum]++; } } @@ -184,7 +183,8 @@ int TestEp_Rx(chanend c_out, int epNum, int start, int end) { unsafe { - unsigned fail = RxDataCheck(buffer[i], length[i], epNum); + unsigned expectedLength = start+i; + unsigned fail = RxDataCheck(buffer[i], length[i], epNum, expectedLength); if (fail) return fail; From baec9292d546d65b9720a1e1ab77d528d0f9975c Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Thu, 19 Dec 2019 14:57:32 +0000 Subject: [PATCH 091/520] Comment update --- lib_xud/src/core/XUD_UIFM_PConfig.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xud/src/core/XUD_UIFM_PConfig.S b/lib_xud/src/core/XUD_UIFM_PConfig.S index 56fe1dc7..c54d5ac7 100755 --- a/lib_xud/src/core/XUD_UIFM_PConfig.S +++ b/lib_xud/src/core/XUD_UIFM_PConfig.S @@ -52,7 +52,7 @@ InvertUsbClock: setc res[r0], XS1_SETC_COND_NONE ConfigClockBlock: - ldc r10, XS1_CLKBLK_REF // TODO Don't use clock block 0 + ldc r10, XS1_CLKBLK_REF // Ideally we don't use clock block 0 but its hardwired setc res[r10], XS1_SETC_INUSE_ON //setc res[r10], XS1_SETC_RUN_STOPR setclk res[r10], r0 // Clock clockblock from usb clock From 17b8c1205f9498a7ccf0c6f12a9cad718997d9aa Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Thu, 19 Dec 2019 15:01:38 +0000 Subject: [PATCH 092/520] Comment only --- tests/shared_src/shared.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/shared_src/shared.h b/tests/shared_src/shared.h index f9886baf..75d4b243 100644 --- a/tests/shared_src/shared.h +++ b/tests/shared_src/shared.h @@ -163,9 +163,7 @@ int RxDataCheck(unsigned char b[], int l, int epNum, unsigned expectedLength) #pragma unsafe arrays int TestEp_Rx(chanend c_out, int epNum, int start, int end) { - // TODO check rx lengths unsigned int length[MAX_PKT_COUNT]; - //XUD_Result_t res; XUD_ep ep_out1 = XUD_InitEp(c_out); From 7a9f42e42bd7d2ac78ad7c1fb71dae5815ed1d94 Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Thu, 19 Dec 2019 15:01:38 +0000 Subject: [PATCH 093/520] XS2 HID demo working (in Single Issue) --- lib_xud/module_build_info | 2 +- lib_xud/src/core/XUD_IoLoop.S | 2 +- lib_xud/src/core/included/XUD_Token_Out_DI.S | 102 +++++++++++++++++++ 3 files changed, 104 insertions(+), 2 deletions(-) create mode 100755 lib_xud/src/core/included/XUD_Token_Out_DI.S diff --git a/lib_xud/module_build_info b/lib_xud/module_build_info index 5add335b..c0d7d20f 100644 --- a/lib_xud/module_build_info +++ b/lib_xud/module_build_info @@ -13,7 +13,7 @@ MODULE_XCC_FLAGS = $(XCC_FLAGS) -O3 -DREF_CLK_FREQ=100 -fasm-linenum -fcomment-a XCC_FLAGS_XUD_IoLoop.S = $(MODULE_XCC_FLAGS) -fschedule -g0 -EXCLUDE_FILES += XUD_Token_In.S XUD_Token_Ping.S XUD_Token_SOF.S XUD_Token_Out.S XUD_Token_Out_DI.S XUD_Token_Setup.S XUD_CrcAddrCheck.S XUD_TokenJmp.S XUD_PidJumpTable.S XUD_Token_In_DI.S XUD_Token_Setup_DI.S +EXCLUDE_FILES += XUD_Token_In.S XUD_Token_Ping.S XUD_Token_SOF.S XUD_Token_Out.S XUD_Token_Out_DI.S XUD_Token_Setup.S XUD_CrcAddrCheck.S XUD_TokenJmp.S XUD_PidJumpTable.S XUD_Token_In_DI.S XUD_Token_Setup_DI.S XUD_RxData.S OPTIONAL_HEADERS += xud_conf.h diff --git a/lib_xud/src/core/XUD_IoLoop.S b/lib_xud/src/core/XUD_IoLoop.S index 1e4a1ec5..efb69409 100755 --- a/lib_xud/src/core/XUD_IoLoop.S +++ b/lib_xud/src/core/XUD_IoLoop.S @@ -195,13 +195,13 @@ ResetIntHandler: .issue_mode dual #include "./included/XUD_Token_In_DI.S" #include "./included/XUD_Token_Setup_DI.S" +#include "./included/XUD_RxData.S" #endif // Note, included here so in same elimination blocks to avoid long jumps #include "./included/XUD_Token_Out.S" #include "./included/XUD_Token_Ping.S" #include "./included/XUD_Token_SOF.S" -#include "./included/XUD_RxData.S" BadCrcAddr: // zext r11, 8 diff --git a/lib_xud/src/core/included/XUD_Token_Out_DI.S b/lib_xud/src/core/included/XUD_Token_Out_DI.S new file mode 100755 index 00000000..696d3119 --- /dev/null +++ b/lib_xud/src/core/included/XUD_Token_Out_DI.S @@ -0,0 +1,102 @@ +// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// r10: EP number +// OUT Token Packet ----------------------------------------------------------------------------- +// Ports +#define RXD r0 +#define TXD r2 + +.align 8 +.skip 0 +Pid_Out: + #include "XUD_CrcAddrCheck.S" + ldw r3, r5[r10] // Load relevant EP pointer + bf r3, XUD_TokenOut_BufferFull + ldw r1, r3[3] // Load buffer from EP structure + +CheckEpTypeOut: + ldw r11, r3[5] // Load EP type + BRFT_ru6 r11, DoOutNonIso // ISO endpoint + +OutReady: + stw r11, r5[r10] // Clear ready straight away - we don't to CRC checking on Iso - else we would have to wait for end of packet + bl doRXData + clre + +InformEP_Iso: // Iso EP - no handshake + ldw r11, r3[1] // Load EP chanend + {out res[r11], r4; ldw r7, sp[STACK_TXCRC_INIT]} // Output datalength (words) & CRC 16 Init (IN) + {outt res[r11], r8; ldw r6, sp[STACK_RXCRC_INIT]} // CRC16 init (out) - Needs reseting after an out & Send tail length + #include "XUD_TokenJmp.S" + +.align 4 +.skip 0 +DoOutNonIso: + bl doRXData + {clre; eq r1, r6, r11} // Check for good CRC16 + +doRXDataReturn_NonIso: + bf r1, NextTokenAfterOut // Check for bad crc + ldc r11, USB_PIDn_ACK // Data CRC good and EP not Iso: Send Ack + nop + nop + nop + nop + nop + outpw res[TXD], r11, 8 + syncr res[TXD] + +StoreTailDataOut: + ldc r11, 0 + stw r11, r5[r10] // Clear ready + ldw r11, r3[1] // Load EP chanend + + out res[r11], r4 // Output datalength (words) + outt res[r11], r8 // Send tail length + + bu NextTokenAfterOut + +// Various Error handling functions ------------------------------------------------------------------- +Err_RxErr: // RxError signal high during data packet receive: + clrsr 3 + clre + ldw r10, sp[15] // Read out data from RxE port + in r11, res[r10] + eeu res[r10] + ldw r10, sp[10] + in r11, res[r10] // Wait for rxa low and ignore packet (let transaction timout) + setsr 3 // Re-enable thread interrupts + bu NextToken + +XUD_TokenOut_BufferFull: + ldw r9, dp[flag1_port] + setc res[r9], XS1_SETC_RUN_CLRBUF + setc res[r9], XS1_SETC_COND_NEQ +XUD_TokenOut_WaitForPacketEnd: // Wait for end of data then send NAK + in r11, res[r9] + setc res[r9], XS1_SETC_COND_EQ + in r11, res[r9] + // TODO: Observe interpacket delay +#ifndef XUD_NAK_ISO_OUT + ldw r4, sp[(STACK_EXTEND+5)] // Load ep type table + ldw r4, r4[r10] // load EP type + bf r4, PrimaryBufferFull_NoNak +#endif + + // Load handshake (ACK or STALL) + ldaw r5, dp[handshakeTable_OUT] // Load handshake table + ldw r11, r5[r10] + outpw res[TXD], r11, 8 + syncr res[TXD] + +PrimaryBufferFull_NoNak: + setc res[RXD], XS1_SETC_RUN_CLRBUF + bu NextToken + +// Timedout waiting for data after OUT... go back to waiting for tokens +//OutDataTimeOut: + //clre + //bl ERR_OutDataTimeout + //bu NextToken + + + From 16316cb4e80ce7efe1a29ac9181ee1d1927cbeb8 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 22 Apr 2020 17:33:09 +0100 Subject: [PATCH 094/520] XS2 operates with partial DI --- lib_xud/src/core/XUD_IoLoop.S | 17 ++--- lib_xud/src/core/included/XUD_Token_Setup.S | 85 --------------------- lib_xud/src/user/client/XUD_EpFuncs.S | 8 -- 3 files changed, 8 insertions(+), 102 deletions(-) diff --git a/lib_xud/src/core/XUD_IoLoop.S b/lib_xud/src/core/XUD_IoLoop.S index efb69409..da407906 100755 --- a/lib_xud/src/core/XUD_IoLoop.S +++ b/lib_xud/src/core/XUD_IoLoop.S @@ -188,18 +188,20 @@ ResetIntHandler: .text #if defined(__XS2A__) -.issue_mode single -#include "./included/XUD_Token_In.S" +//.issue_mode single +.issue_mode dual +#include "./included/XUD_Token_In_DI.S" #include "./included/XUD_Token_Setup.S" +#include "./included/XUD_Token_Out.S" #elif defined(__XS3A__) .issue_mode dual #include "./included/XUD_Token_In_DI.S" #include "./included/XUD_Token_Setup_DI.S" +#include "./included/XUD_Token_Out_DI.S" #include "./included/XUD_RxData.S" #endif // Note, included here so in same elimination blocks to avoid long jumps -#include "./included/XUD_Token_Out.S" #include "./included/XUD_Token_Ping.S" #include "./included/XUD_Token_SOF.S" @@ -209,24 +211,21 @@ BadCrcAddr: // eq r11, r11, r10 //ecallt r11 //bt r11, Pid_Sof_NoChan // TODO we should really CRC SOFs - ldw r11, sp[10] + waitforRXALow0: in r10, res[r11] bt r10, waitforRXALow0 setc res[RXD], XS1_SETC_RUN_CLRBUF bu Loop_BadPid - - .align 4 XUD_LLD_IoLoop: #if defined(__XS2A__) - ENTSP_lu6 STACK_EXTEND + //ENTSP_lu6 STACK_EXTEND + DUALENTSP_lu6 STACK_EXTEND #elif defined(__XS3A__) DUALENTSP_lu6 STACK_EXTEND -#else - entsp STACK_EXTEND #endif stw r4, sp[1] stw r5, sp[2] diff --git a/lib_xud/src/core/included/XUD_Token_Setup.S b/lib_xud/src/core/included/XUD_Token_Setup.S index 61a1e0c6..fa6c4f64 100644 --- a/lib_xud/src/core/included/XUD_Token_Setup.S +++ b/lib_xud/src/core/included/XUD_Token_Setup.S @@ -21,7 +21,6 @@ WaitForEndDataPacket: // r9: crc poly // r10: ep number // r11: scratch -#if defined(__XS3A__) .align 4 .skip 0 doRXData: @@ -92,95 +91,11 @@ OutTail3: OutTail4: bu ERR_EndIn4 - // Five Tail Bytes .align 32 OutTail5: bu ERR_EndIn5 -#else -.align 4 -.skip 0 -doRXData: - ldw r7, sp[10] // Load RxA Port ID (r1) - //in r8, res[r10] // Doing an IN to clear any previous event data - // - saves us havin to reload the port ID later... - // NOW MOVED TO RxALow - inpw r8, res[r0], 8 // Input PID -GotRxPid: - stw r8, r3[6] // Store (NON-SHIFTED) PID into EP structure - eeu res[r7] -.syntax architectural - SETSR_lu6 1 // Enable thread events. Note long inst to align loop -.syntax default - -NextRxWord: // RXD port has event vector here - in r11, res[r0] - stw r11, r1[r4] - crc32_inc r6, r11, r9, r4, 1 - //add r4, r4, 1 -.xtabranch NextRxWord, RxALow - bu NextRxWord - -///////////////////////////////////////////////////////////////////////////// -.align 16 -.skip 8 -RxALow: - in r7, res[r7] // Clear event data on RXA - endin r8, res[r0] -XUD_OUT_RxTail: - in r11, res[r0] - -.xtabranch OutTail0, OutTail1, OutTail2, OutTail3, OutTail4, OutTail5 - bru r8 - -// Word aligned data (0 byte tail) -.align 16 -OutTail0: - crc32 r6, r8, r9 // CRC zero step - ldc r11, 0x7000 // Load relevant CRC magic number - retsp 0 - -// 1 Tail Byte -.align 16 -OutTail1: - shr r11, r11, 24 // Shift off junk - crc32 r6, r11, r9 - stw r11, r1[r4] // Store last data - ldc r11, 0x80be // Load CRC magic number - retsp 0 - -// Two Tail Bytes -.align 16 -OutTail2: - shr r11, r11, 16 - crc32 r6, r11, r9 - stw r11, r1[r4] // Store last data - ldc r11, 0x3ffe - retsp 0 - -// Three Tail Bytes -.align 16 -OutTail3: - shr r11, r11, 8 - stw r11, r1[r4] // Store last data - crc32 r6, r11, r9 - ldw r11, sp[12] - crc8 r6, r1, r2, r9 // Use the fact the the bottom byte of port id is 0.. saves us an ldc - retsp 0 - -// Four Tail Bytes -OutTail4: - bu ERR_EndIn4 - - -// Five Tail Bytes -.align 16 -OutTail5: - bu ERR_EndIn5 -#endif - - // We received a setup token. This is much the same as out token, apart from: // - Can't NAK a setup diff --git a/lib_xud/src/user/client/XUD_EpFuncs.S b/lib_xud/src/user/client/XUD_EpFuncs.S index 09b230ac..dd906220 100644 --- a/lib_xud/src/user/client/XUD_EpFuncs.S +++ b/lib_xud/src/user/client/XUD_EpFuncs.S @@ -293,19 +293,12 @@ XUD_SetData_NoReq: add r1, r1, r3 // Add start index to buffer address CalcTailLength: -#ifdef __XS2A__ - shl r3, r2, 5 // Taillength: bytes to bits * 2 - zext r3, 7 -#else shl r3, r2, 3 // Taillength: bytes to bits zext r3, 5 -#endif - SetupLoopTerm: shr r2, r2, 2 // r2: datalength (bytes) ---> r2: datalength (words) -#ifdef __XS3A__ // TODO do this a bit more effciently.. // If tail is 0 and word-length not 0. Make tail-length 32 and word-length-- bt r3, AdjustBufferPointer @@ -313,7 +306,6 @@ SetupLoopTerm: sub r2, r2, 1 ldc r3, 32 -#endif AdjustBufferPointer: shl r5, r2, 2 // Get end off buffer address From 4e073b93307ec64e609cd1c5ed59ef3645c70254 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 23 Apr 2020 18:21:18 +0100 Subject: [PATCH 095/520] Added XS3 config to HID example makefile --- examples/AN00129_hid_class/Makefile | 4 +- .../src/XCORE-AI-EXPLORER-NO-DDR.xn | 60 +++++++++++++++++++ 2 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 examples/AN00129_hid_class/src/XCORE-AI-EXPLORER-NO-DDR.xn diff --git a/examples/AN00129_hid_class/Makefile b/examples/AN00129_hid_class/Makefile index 8583bc54..5d8ac82e 100644 --- a/examples/AN00129_hid_class/Makefile +++ b/examples/AN00129_hid_class/Makefile @@ -6,7 +6,7 @@ ifeq ($(CONFIG),X200) TARGET = XCORE-200-EXPLORER else -TARGET = SLICEKIT-U16 +TARGET = XCORE-AI-EXPLORER-NO-DDR.xn endif # The APP_NAME variable determines the name of the final .xe file. It should @@ -25,8 +25,8 @@ APP_NAME = app_hid_mouse_demo # These flags define two build configurations - one for U-series and one for # the xCORE-200 series. -XCC_FLAGS_U = -O3 -report -DXUD_SERIES_SUPPORT=XUD_U_SERIES XCC_FLAGS_X200 = -O3 -report -DXUD_SERIES_SUPPORT=XUD_X200_SERIES +XCC_FLAGS_AI = -O3 -report # The USED_MODULES variable lists other module used by the application. USED_MODULES = lib_xud diff --git a/examples/AN00129_hid_class/src/XCORE-AI-EXPLORER-NO-DDR.xn b/examples/AN00129_hid_class/src/XCORE-AI-EXPLORER-NO-DDR.xn new file mode 100644 index 00000000..b39d5abe --- /dev/null +++ b/examples/AN00129_hid_class/src/XCORE-AI-EXPLORER-NO-DDR.xn @@ -0,0 +1,60 @@ + + + Board + xcore.ai Explorer Kit + + + tileref tile[2] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From c7e3b6d83add2d8a31bf5b6d566b867e26a2ba26 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 23 Apr 2020 18:21:54 +0100 Subject: [PATCH 096/520] Fix in crcaddrcheck --- lib_xud/src/core/XUD_CrcAddrCheck.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_xud/src/core/XUD_CrcAddrCheck.S b/lib_xud/src/core/XUD_CrcAddrCheck.S index 9b086053..78dee120 100644 --- a/lib_xud/src/core/XUD_CrcAddrCheck.S +++ b/lib_xud/src/core/XUD_CrcAddrCheck.S @@ -61,8 +61,8 @@ inpw r10, res[RXD], 8; // Read EP Number shr r10, r10, 24; // Shift off junk - in r11, res[r1]; - bt r11, XUD_InvalidToken; // If VALID_TOKEN not high, ignore token - PORT INVERTED! */ + in r4, res[r1]; + bt r4, XUD_InvalidToken; // If VALID_TOKEN not high, ignore token - PORT INVERTED! */ #endif // Required on exit: From 1201f5abe5d40ddb6a9acb10ef35d4dea979beb0 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 23 Apr 2020 18:22:08 +0100 Subject: [PATCH 097/520] Added xn --- .../src/XCORE-AI-EXPLORER.xn | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 examples/AN00129_hid_class/src/XCORE-AI-EXPLORER.xn diff --git a/examples/AN00129_hid_class/src/XCORE-AI-EXPLORER.xn b/examples/AN00129_hid_class/src/XCORE-AI-EXPLORER.xn new file mode 100644 index 00000000..0cc287dd --- /dev/null +++ b/examples/AN00129_hid_class/src/XCORE-AI-EXPLORER.xn @@ -0,0 +1,60 @@ + + + Board + xcore.ai Explorer Kit + + + tileref tile[2] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 25d7144b9cd2a22199980b329e3aada75729d3e3 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 23 Apr 2020 18:22:50 +0100 Subject: [PATCH 098/520] XS2 runs dual issue code --- lib_xud/src/core/XUD_IoLoop.S | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/lib_xud/src/core/XUD_IoLoop.S b/lib_xud/src/core/XUD_IoLoop.S index da407906..e68de479 100755 --- a/lib_xud/src/core/XUD_IoLoop.S +++ b/lib_xud/src/core/XUD_IoLoop.S @@ -187,21 +187,12 @@ ResetIntHandler: .cc_top XUD_LLD_IoLoop.func, XUD_LLD_IoLoop .text -#if defined(__XS2A__) -//.issue_mode single -.issue_mode dual -#include "./included/XUD_Token_In_DI.S" -#include "./included/XUD_Token_Setup.S" -#include "./included/XUD_Token_Out.S" -#elif defined(__XS3A__) .issue_mode dual +// Note, included here so in same elimination blocks to avoid long jumps #include "./included/XUD_Token_In_DI.S" #include "./included/XUD_Token_Setup_DI.S" #include "./included/XUD_Token_Out_DI.S" #include "./included/XUD_RxData.S" -#endif - -// Note, included here so in same elimination blocks to avoid long jumps #include "./included/XUD_Token_Ping.S" #include "./included/XUD_Token_SOF.S" @@ -221,12 +212,7 @@ waitforRXALow0: .align 4 XUD_LLD_IoLoop: -#if defined(__XS2A__) - //ENTSP_lu6 STACK_EXTEND - DUALENTSP_lu6 STACK_EXTEND -#elif defined(__XS3A__) DUALENTSP_lu6 STACK_EXTEND -#endif stw r4, sp[1] stw r5, sp[2] stw r6, sp[3] @@ -314,7 +300,7 @@ ConfigSofJump: bt r11, ConfigSofJump_Done ldap r11, Pid_Sof_NoChan ldaw r10, dp[PidJumpTable] -#ifdef ARCH_L +#ifdef __XS2A__ stw r11, r10[5] #else ldc r9, 0xa5 From f121697f75b221c61061385da794868fb4aa76d2 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 23 Apr 2020 18:23:12 +0100 Subject: [PATCH 099/520] Removed old doRxData --- lib_xud/src/core/included/XUD_Token_Setup.S | 86 --------------------- 1 file changed, 86 deletions(-) diff --git a/lib_xud/src/core/included/XUD_Token_Setup.S b/lib_xud/src/core/included/XUD_Token_Setup.S index fa6c4f64..057dd0f0 100644 --- a/lib_xud/src/core/included/XUD_Token_Setup.S +++ b/lib_xud/src/core/included/XUD_Token_Setup.S @@ -11,92 +11,6 @@ WaitForEndDataPacket: bu NextTokenAfterOut #endif -// r3: Ep structure -// r5: buffer address -// RXD: Rx Data port -// r4: zero -// r5: ep structures array -// r6: crc rx init -// r7: crc tx init -// r9: crc poly -// r10: ep number -// r11: scratch -.align 4 -.skip 0 -doRXData: - ldw r7, sp[10] // Load RxA Port ID (r1) - inpw r8, res[r0], 8 // Input PID -GotRxPid: - stw r8, r3[6] // Store (NON-SHIFTED) PID into EP structure - eeu res[r7] -.syntax architectural - SETSR_lu6 1 // Enable thread events. Note long inst to align loop -.syntax default - -NextRxWord: // RXD port has event vector here - in r11, res[r0] - stw r11, r1[r4] - crc32_inc r6, r11, r9, r4, 1 - bu NextRxWord - -///////////////////////////////////////////////////////////////////////////// -.align 32 -.skip 16 -RxALow: - in r7, res[r7] // Clear event data on RXA - endin r8, res[r0] -XUD_OUT_RxTail: - in r11, res[r0] - -.xtabranch OutTail0, OutTail1, OutTail2, OutTail3, OutTail4, OutTail5 - bru r8 - -// Word aligned data (0 byte tail) -.align 32 -OutTail0: - crc32 r6, r8, r9 // CRC zero step - ldc r11, 0x7000 // Load relevant CRC magic number - retsp 0 - -// 1 Tail Byte -.align 32 -OutTail1: - shr r11, r11, 24 // Shift off junk - crc32 r6, r11, r9 - stw r11, r1[r4] // Store last data - ldc r11, 0x80be // Load CRC magic number - retsp 0 - -// Two Tail Bytes -.align 32 -OutTail2: - shr r11, r11, 16 - crc32 r6, r11, r9 - stw r11, r1[r4] // Store last data - ldc r11, 0x3ffe - retsp 0 - -// Three Tail Bytes -.align 32 -OutTail3: - shr r11, r11, 8 - stw r11, r1[r4] // Store last data - crc32 r6, r11, r9 - ldw r11, sp[12] - crc8 r6, r1, r2, r9 // Use the fact the the bottom byte of port id is 0.. saves us an ldc - retsp 0 - -// Four Tail Bytes -.align 32 -OutTail4: - bu ERR_EndIn4 - -// Five Tail Bytes -.align 32 -OutTail5: - bu ERR_EndIn5 - - // We received a setup token. This is much the same as out token, apart from: // - Can't NAK a setup // - Data PID will always be DATA0 From 8a64b576f937bb9bed6aacc26fe51562cc848567 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 23 Apr 2020 18:23:48 +0100 Subject: [PATCH 100/520] Fixes for xs3 reg writes --- lib_xud/src/core/XUD_HAL.xc | 58 ++++++++---------------------------- lib_xud/src/core/XUD_Main.xc | 8 ++--- 2 files changed, 16 insertions(+), 50 deletions(-) diff --git a/lib_xud/src/core/XUD_HAL.xc b/lib_xud/src/core/XUD_HAL.xc index 41376ce7..25f04e77 100644 --- a/lib_xud/src/core/XUD_HAL.xc +++ b/lib_xud/src/core/XUD_HAL.xc @@ -2,14 +2,17 @@ #include "XUD_HAL.h" #include -#ifdef __XS3A__ +#ifdef __XS2A__ +extern in port flag0_port; +extern in port flag1_port; +extern in port flag2_port; +#else #include extern in port flag0_port; /* For XS3: RXA or DP */ extern in port flag1_port; /* For XS3: RXE or DM */ - unsigned XtlSelFromMhz(unsigned m) { switch(m) @@ -56,7 +59,7 @@ void XUD_HAL_EnterMode_PeripheralFullSpeed() unsigned xtlSelVal = XtlSelFromMhz(XUD_OSC_MHZ); d = XS1_USB_PHY_CFG0_XTLSEL_SET(d, xtlSelVal); - write_sswitch_reg(0, XS1_SSWITCH_USB_PHY_CFG0_NUM, d); + write_sswitch_reg(get_local_tile_id(), XS1_SSWITCH_USB_PHY_CFG0_NUM, d); #endif } @@ -78,7 +81,7 @@ void XUD_HAL_EnterMode_PeripheralChirp() unsigned xtlselVal = XtlSelFromMhz(XUD_OSC_MHZ); d = XS1_USB_PHY_CFG0_XTLSEL_SET(d, xtlselVal); - write_sswitch_reg(0, XS1_SSWITCH_USB_PHY_CFG0_NUM, d); + write_sswitch_reg(get_local_tile_id(), XS1_SSWITCH_USB_PHY_CFG0_NUM, d); #endif } @@ -100,53 +103,19 @@ void XUD_HAL_EnterMode_PeripheralHighSpeed() unsigned xtlselVal = XtlSelFromMhz(XUD_OSC_MHZ); d = XS1_USB_PHY_CFG0_XTLSEL_SET(d, xtlselVal); - write_sswitch_reg(0, XS1_SSWITCH_USB_PHY_CFG0_NUM, d); + write_sswitch_reg(get_local_tile_id(), XS1_SSWITCH_USB_PHY_CFG0_NUM, d); #endif } -/* TODO pass structure */ -int XUD_HAL_GetLineState(/*XUD_HAL_t &xudHal*/) -{ - unsigned dm, dp; - // xudHal.p_usb_fl0 :> dp; - // xudHal.p_usb_fl1 :> dm; - -#ifdef __XS3A__ - flag0_port :> dp; - flag1_port :> dm; - - if(dp && !dm) - return XUD_LINESTATE_J; - else if(dm && !dp) - return XUD_LINESTATE_K; - else if(!dm && !dp) - return XUD_LINESTATE_SE0; - else - return XUD_LINESTATE_INVALID; -#else - - unsigned j, k, se0; - flag0_port :> j; - flag1_port :> k; - flag2_port :> se0; - if(j) - return XUD_LINESTATE_J; - if(k) - return XUD_LINESTATE_K; - if(se0) - return XUD_LINESTATE_SE0; - -#endif -} void XUD_HAL_Mode_PowerSig() { #ifndef XUD_SIM_XSIM unsigned d = 0; d = XS1_USB_SHIM_CFG_FLAG_MODE_SET(d, 1); - write_sswitch_reg(0, XS1_SSWITCH_USB_SHIM_CFG_NUM, d); + write_sswitch_reg(get_local_tile_id(), XS1_SSWITCH_USB_SHIM_CFG_NUM, d); #endif } @@ -155,16 +124,12 @@ void XUD_HAL_Mode_DataTransfer() #ifndef XUD_SIM_XSIM unsigned d = 0; d = XS1_USB_SHIM_CFG_FLAG_MODE_SET(d, 0); - write_sswitch_reg(0, XS1_SSWITCH_USB_SHIM_CFG_NUM, d); + write_sswitch_reg(get_local_tile_id(), XS1_SSWITCH_USB_SHIM_CFG_NUM, d); #endif } #endif -extern in port flag0_port; -extern in port flag1_port; -extern in port flag2_port; - /* TODO pass structure */ int XUD_HAL_GetLineState(/*XUD_HAL_t &xudHal*/) { @@ -197,5 +162,6 @@ int XUD_HAL_GetLineState(/*XUD_HAL_t &xudHal*/) return XUD_LINESTATE_K; if(se0) return XUD_LINESTATE_SE0; + #endif - } +} diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index 2b01dcc3..8b62998f 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -575,16 +575,16 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c unsigned d = 0; /* Enable wphy and take out of reset */ - read_sswitch_reg(0, XS1_SSWITCH_USB_PHY_CFG2_NUM, d); + read_sswitch_reg(get_local_tile_id(), XS1_SSWITCH_USB_PHY_CFG2_NUM, d); d = XS1_USB_PHY_CFG2_PONRST_SET(d, 1); d = XS1_USB_PHY_CFG2_UTMI_RESET_SET(d, 0); - write_sswitch_reg(0, XS1_SSWITCH_USB_PHY_CFG2_NUM, d); + write_sswitch_reg(get_local_tile_id(), XS1_SSWITCH_USB_PHY_CFG2_NUM, d); /* Setup clocking appropriately */ - read_sswitch_reg(0, XS1_SSWITCH_USB_PHY_CFG0_NUM, d); + read_sswitch_reg(get_local_tile_id(), XS1_SSWITCH_USB_PHY_CFG0_NUM, d); unsigned xtlselVal = XtlSelFromMhz(XUD_OSC_MHZ); d = XS1_USB_PHY_CFG0_XTLSEL_SET(d, xtlselVal); - write_sswitch_reg(0, XS1_SSWITCH_USB_PHY_CFG0_NUM, d); + write_sswitch_reg(get_local_tile_id(), XS1_SSWITCH_USB_PHY_CFG0_NUM, d); #endif /* Wait for USB clock (typically 1ms after reset) */ From 56dfeaee83fe622c0920c670b08b963f59ddbc7c Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 23 Apr 2020 19:58:40 +0100 Subject: [PATCH 101/520] Stack tidy up, re-ordered flag port usage in XS2 to match XS3. Tidied flag port inversion in XS2. Tidy IoLoop call --- lib_xud/src/core/XUD_CrcAddrCheck.S | 2 +- lib_xud/src/core/XUD_DeviceAttach.xc | 2 +- lib_xud/src/core/XUD_IoLoop.S | 66 ++++++++----------- lib_xud/src/core/XUD_Main.xc | 28 ++++---- lib_xud/src/core/XUD_PowerSig.xc | 6 +- lib_xud/src/core/included/XUD_RxData.S | 2 +- lib_xud/src/core/included/XUD_Token_In_DI.S | 2 +- lib_xud/src/core/included/XUD_Token_Out_DI.S | 11 ++-- lib_xud/src/core/included/XUD_Token_SOF.S | 10 +-- .../src/core/included/XUD_Token_Setup_DI.S | 2 +- 10 files changed, 62 insertions(+), 69 deletions(-) diff --git a/lib_xud/src/core/XUD_CrcAddrCheck.S b/lib_xud/src/core/XUD_CrcAddrCheck.S index 78dee120..4d56521e 100644 --- a/lib_xud/src/core/XUD_CrcAddrCheck.S +++ b/lib_xud/src/core/XUD_CrcAddrCheck.S @@ -35,7 +35,7 @@ {BRFF_ru6 r4, 5; shr r10, r11, 7} // Extract EP number //waitforRXALow0: - ldw r11, sp[10] + ldw r11, sp[STACK_RXA_PORT] in r10, res[r11] bt r10, waitforRXALow0 setc res[RXD], XS1_SETC_RUN_CLRBUF diff --git a/lib_xud/src/core/XUD_DeviceAttach.xc b/lib_xud/src/core/XUD_DeviceAttach.xc index d76cefa1..09e04618 100755 --- a/lib_xud/src/core/XUD_DeviceAttach.xc +++ b/lib_xud/src/core/XUD_DeviceAttach.xc @@ -174,7 +174,7 @@ int XUD_DeviceAttachHS(XUD_PwrConfig pwrConfig) } break; - case !detecting_k => flag0_port when pinseq(0) :> void @ tx: // J Chirp, inverted! + case !detecting_k => flag0_port when pinseq(1) :> void @ tx: // J Chirp flag0_port @ tx + T_FILT :> tmp; if (tmp == 0) { // inverted! chirpCount ++; // Seen an extra K-J pair diff --git a/lib_xud/src/core/XUD_IoLoop.S b/lib_xud/src/core/XUD_IoLoop.S index e68de479..734f23b2 100755 --- a/lib_xud/src/core/XUD_IoLoop.S +++ b/lib_xud/src/core/XUD_IoLoop.S @@ -36,14 +36,14 @@ suspend_t_wtwrsths: // Stack frame: // 0 // 1..7: : Reg save -// 8 : // Unused +// 8 : Unused #define STACK_OUT_TIMER (9) // Used for out data timeout -#define STACK_FLAG1_PORT (10) //RXA_port -#define STACK_FLAG0_PORT (11) // Valid token port -// 12 : ? -// 13 : Suspend timeout -// 14 : Suspend/Reset timer -// 15 : RxError port (flag 2) +#define STACK_RXA_PORT (10) // RXA_port +// 11 : Unused +// 12 : Unused +#define STACK_SUSPEND_TIMEOUT (13) +#define STACK_SUSPEND_TIMER (14) +#define STACK_RXE_PORT (15) #define STACK_RXCRC_TAIL0 (16) #define STACK_RXCRC_TAIL1 (17) #define STACK_RXCRC_TAIL2 (18) @@ -51,20 +51,14 @@ suspend_t_wtwrsths: #define STACK_TXCRC_INIT (20) #define STACK_RXCRC_INIT (21) -#define STACK_PID_JUMP_TABLE (STACK_EXTEND-3) // Params -// STACK_EXTEND + 1 : Flag0_port -// STACK_EXTEND + 2 : reg_read_port -// STACK_EXTEND + 3 : reg_write_port -// STACK_EXTEND + 4 : 0 -// STACK_EXTEND + 5 : c_ctl_buf -#define SP_EPTYPES_OUT (STACK_EXTEND + 6) // STACK_EXTEND + 6 : EP Type table (out) -#define SP_EPTYPES_IN (STACK_EXTEND + 7) // EP Type table (in) -#define SP_EPCHANS (STACK_EXTEND + 7) -#define SP_EPCOUNT (STACK_EXTEND + 9) -#define SP_REGREAD (STACK_EXTEND + 10) -#define SP_REGWRITE (STACK_EXTEND + 11) +#define STACK_VTOK_PORT (STACK_EXTEND + 1) +#define SP_EPTYPES_OUT (STACK_EXTEND + 2) // STACK_EXTEND + 6 : EP Type table (out) +#define SP_EPTYPES_IN (STACK_EXTEND + 3) // EP Type table (in) +#define STACK_EPCHANS (STACK_EXTEND + 4) +#define SP_EPCOUNT (STACK_EXTEND + 5) +#define STACK_SOFCHAN (STACK_EXTEND + 6) #ifndef XUD_TEST_MODE_SUPPORT_DISABLED ////////////////////////////////////////////////////////////////////////// @@ -161,7 +155,7 @@ ResetIntHandler: ldw r10, dp[SavedSp] // Restore stack pointer set sp, r10 - ldw r11, sp[15] // Put RxE back to events.. + ldw r11, sp[STACK_RXE_PORT] // Put RxE back to events.. setc res[r11], XS1_SETC_IE_MODE_EVENT // Set IE mode back to events ldc r0, 1 // Load non-zero (zero is kill) @@ -202,7 +196,7 @@ BadCrcAddr: // eq r11, r11, r10 //ecallt r11 //bt r11, Pid_Sof_NoChan // TODO we should really CRC SOFs - ldw r11, sp[10] + ldw r11, sp[STACK_RXA_PORT] waitforRXALow0: in r10, res[r11] @@ -220,6 +214,9 @@ XUD_LLD_IoLoop: stw r8, sp[5] stw r9, sp[6] stw r10, sp[7] +PortsOnStack: // Put ports on stack (loads therefore short insts) + stw r1, sp[STACK_RXA_PORT] + stw r3, sp[STACK_RXE_PORT] SaveStackPointer: ldaw r11, sp[0] @@ -227,7 +224,7 @@ SaveStackPointer: ldw r11, cp[suspendTimeout] - stw r11, sp[13] + stw r11, sp[STACK_SUSPEND_TIMEOUT] ConfigRxDEventVector: // Configure events setc res[RXD], XS1_SETC_IE_MODE_EVENT @@ -244,13 +241,11 @@ ConfigRxA: eeu res[RXA] ConfigValidToken: - ldw r10, dp[flag0_port] // Valid token port + ldw r10, sp[STACK_VTOK_PORT] setc res[r10], XS1_SETC_COND_NONE - ldap r11, TxHandshakeTimeOut // ValidToken is used for timing timeout period when expecting an ack after tx + ldap r11, TxHandshakeTimeOut // ValidToken is used for timing timeout period when expecting an ack after tx setv res[r10], r11 - - #ifndef XUD_TEST_MODE_SUPPORT_DISABLED SetupUsbTestMode: // Enable test mode interrupt on Endpoint 0 chanends. IN + OUT @@ -270,11 +265,7 @@ SetupUsbTestMode: eeu res[r10] #endif -PortsOnStack: // Put ports on stack (loads therefore short insts) - ldw r11, dp[flag1_port] // RxA - stw r11, sp[10] - ldw r11, dp[flag0_port] // Valid token port - stw r11, sp[STACK_FLAG0_PORT] + CrcRxResidualsOnStack: ldc r11, 0x7000 @@ -292,11 +283,11 @@ CrcRxResidualsOnStack: ldc r11, 0x3334 // CRC16 init (out) stw r11, sp[STACK_RXCRC_INIT] - ldw r11, sp[(STACK_EXTEND+7)] + ldw r11, sp[STACK_EPCHANS] stw r11, dp[chanArray] ConfigSofJump: - ldw r11, sp[(STACK_EXTEND+9)] + ldw r11, sp[STACK_SOFCHAN] bt r11, ConfigSofJump_Done ldap r11, Pid_Sof_NoChan ldaw r10, dp[PidJumpTable] @@ -317,7 +308,6 @@ ConfigRxErrEventVector: setv res[r3], r11 ldc r11, 1 setd res[r3], r11 // Set event cond data to 1 - stw r3, sp[15] // Store flag port to stack eeu res[r3] #endif @@ -338,7 +328,7 @@ SetupSuspendResetTimer: getr r10, XS1_RES_TYPE_TIMER ecallf r10 - stw r10, sp[14] + stw r10, sp[STACK_SUSPEND_TIMER] ldap r11, ResetIntHandler setv res[r10], r11 @@ -364,13 +354,13 @@ SetupSuspendResetTimer: .skip 0 NextToken: ldc r9, 0xa001 // CRC16 poly, used in doRxData - ldw r5, sp[(STACK_EXTEND+7)] // EP structures array - pointers to EP tables or 0 + ldw r5, sp[(STACK_EXTEND+4)] // EP structures array - pointers to EP tables or 0 NextTokenAfterOut: ldc r7, 0xf335 // TX Crc init ldc r6, 0x3334 // CRC16 init (out) - Needs reseting after an out #ifdef __XS2A__ - ldw r1, sp[STACK_FLAG0_PORT] + ldw r1, sp[STACK_VTOK_PORT] #endif NextTokenAfterInNak: @@ -397,7 +387,7 @@ Pid_Data1: Pid_Bad: // Bad PID received, ignore XUD_InvalidToken: - ldw r10, sp[10] // Load RxA Port ID (r1) + ldw r10, sp[STACK_RXA_PORT] // Load RxA Port ID (r1) XUD_InvalidTok_waitforRXALow: in r11, res[r10] bt r11, XUD_InvalidTok_waitforRXALow diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index 8b62998f..7c654f56 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -375,7 +375,6 @@ extern unsigned XUD_LLD_IoLoop( in port rxa_port, out buffered port:32 txd_port, in port ?rxe_port, in port newtok_port, - in port ?read, out port ?write, int x, XUD_EpType epTypeTableOut[], XUD_EpType epTypeTableIn[], XUD_chan epChans[], int epCount, chanend? c_sof) ; @@ -519,11 +518,6 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c set_clock_rise_delay(rx_usb_clk, RX_RISE_DELAY); set_clock_fall_delay(rx_usb_clk, RX_FALL_DELAY); #endif - -#ifndef __XS3A__ - /* Invert valid token port */ - set_port_inv(flag0_port); -#endif #ifdef __XS3A__ set_pad_delay(flag1_port, 3); @@ -819,28 +813,32 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c #ifndef SIMULATION #if defined(__XS1B__) || defined (__XS2A__) write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_MASK_NUM, - ((1< void: // Inverted! + case flag0_port when pinseq(1) :> void: SE0_timer :> SE0_start_time; select { - case flag0_port when pinseq(1) :> void: // Inverted! + case flag0_port when pinseq(0) :> void: break; case SE0_timer when timerafter(SE0_start_time + STATE_START_TO) :> int: @@ -194,7 +194,7 @@ int XUD_Suspend(XUD_PwrConfig pwrConfig) break; // K, start of resume - case flag0_port when pinseq(0) :> void: // inverted port + case flag0_port when pinseq(1) :> void: // TODO debounce? unsafe chanend c; asm("getr %0, 2" : "=r"(c)); // XS1_RES_TYPE_CHANEND=2 (no inline assembly immediate operands in xC) diff --git a/lib_xud/src/core/included/XUD_RxData.S b/lib_xud/src/core/included/XUD_RxData.S index c1323b8d..540bb060 100644 --- a/lib_xud/src/core/included/XUD_RxData.S +++ b/lib_xud/src/core/included/XUD_RxData.S @@ -35,7 +35,7 @@ LABEL(doRXData): and r11, r11, r7 eq r11, r11, 3 bf r11, doRXData_badPid - {setsr 1; ldw r7, sp[10]} // Load RxA Port ID + {setsr 1; ldw r7, sp[STACK_RXA_PORT]} // Load RxA Port ID LABEL(GotRxPid): eeu res[r7] // Enable events on RxA diff --git a/lib_xud/src/core/included/XUD_Token_In_DI.S b/lib_xud/src/core/included/XUD_Token_In_DI.S index 14917334..0bb05503 100755 --- a/lib_xud/src/core/included/XUD_Token_In_DI.S +++ b/lib_xud/src/core/included/XUD_Token_In_DI.S @@ -93,7 +93,7 @@ SetupReceiveHandShake: eeu res[RXD] // Events on RXD always enabled - Can;t be any more due to using events on channels SetupTimeout: // Timeout done using another port off same clock block we dont happen to already be using events on. Cunning. - ldw r1, sp[STACK_FLAG0_PORT] // Load saved ValidToken port. Event vector already set. + ldw r1, sp[STACK_VTOK_PORT] // Load saved ValidToken port. Event vector already set. in r11, res[r1] // Do input and get port time/timestamps getts r11, res[r1] ldw r9, dp[g_txHandshakeTimeout] diff --git a/lib_xud/src/core/included/XUD_Token_Out_DI.S b/lib_xud/src/core/included/XUD_Token_Out_DI.S index 696d3119..fe24239b 100755 --- a/lib_xud/src/core/included/XUD_Token_Out_DI.S +++ b/lib_xud/src/core/included/XUD_Token_Out_DI.S @@ -1,9 +1,6 @@ // Copyright (c) 2011-2018, XMOS Ltd, All rights reserved // r10: EP number // OUT Token Packet ----------------------------------------------------------------------------- -// Ports -#define RXD r0 -#define TXD r2 .align 8 .skip 0 @@ -59,10 +56,14 @@ StoreTailDataOut: Err_RxErr: // RxError signal high during data packet receive: clrsr 3 clre - ldw r10, sp[15] // Read out data from RxE port +#ifdef __XS2A__ + ldw r10, sp[STACK_RXE_PORT] // Read out data from RxE port +#else + ldw r10,sp[STACK_FLAG0_PORT] +#endif in r11, res[r10] eeu res[r10] - ldw r10, sp[10] + ldw r10, sp[STACK_RXA_PORT] in r11, res[r10] // Wait for rxa low and ignore packet (let transaction timout) setsr 3 // Re-enable thread interrupts bu NextToken diff --git a/lib_xud/src/core/included/XUD_Token_SOF.S b/lib_xud/src/core/included/XUD_Token_SOF.S index 7348de38..95cd8453 100644 --- a/lib_xud/src/core/included/XUD_Token_SOF.S +++ b/lib_xud/src/core/included/XUD_Token_SOF.S @@ -23,10 +23,10 @@ Pid_Sof: out res[r11], r10 - ldw r10, sp[14] // Load timer from stack + ldw r10, sp[STACK_SUSPEND_TIMER] // Load timer from stack setc res[r10], XS1_SETC_COND_NONE // Read current time - ldw r8, sp[13] // Add suspend timeout to current time + ldw r8, sp[STACK_SUSPEND_TIMEOUT] // Add suspend timeout to current time in r11, res[r10] add r11, r11, r8 setd res[r10], r11 @@ -51,13 +51,13 @@ Pid_Sof_NoChan: in r10, res[RXD] // Input Frame number #endif clrsr 0x3 - ldw r10, sp[14] // Load timer from stack + ldw r10, sp[STACK_SUSPEND_TIMER] // Load timer from stack setc res[r10], XS1_SETC_COND_NONE // Read current time - ldw r8, sp[13] + ldw r8, sp[STACK_SUSPEND_TIMEOUT] in r11, res[r10] add r11, r11, r8 setd res[r10], r11 - ldw r8, sp[13] + ldw r8, sp[STACK_SUSPEND_TIMEOUT] setc res[r10], XS1_SETC_COND_AFTER // Re-enable thread interrupts setsr 0x3 bu Loop_BadPid diff --git a/lib_xud/src/core/included/XUD_Token_Setup_DI.S b/lib_xud/src/core/included/XUD_Token_Setup_DI.S index 3192682c..1faa238c 100644 --- a/lib_xud/src/core/included/XUD_Token_Setup_DI.S +++ b/lib_xud/src/core/included/XUD_Token_Setup_DI.S @@ -40,7 +40,7 @@ StoreTailData: // TODO: don't assume setups are SBuffFull: ldc r11, 0 - ldw r10, sp[10] // Load RxA Port ID (r1) + ldw r10, sp[STACK_RXA_PORT] // Load RxA Port ID (r1) in r11, res[r10] // RXA event cond = 0 TODO: Wait for RXA high first? endin r11, res[RXD] in r11, res[RXD] From a2c5fd0fb9847fcd7ac049a82f504c25f23432e6 Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 24 Apr 2020 10:11:31 +0100 Subject: [PATCH 102/520] - More ARCH define tidy (removed ARCH_ defines) - Removed L series UIFM_Defines header file - Added some warnings for XS3A missing features - Removed many remaining references to L/G & U series - Added some temp fixes to allow basic XS3 USB bring up (e.g. disabled handshake timeout for XS3 etc) - Passed in ports now used, previously was reading from DP --- lib_xud/api/xud.h | 49 +----- lib_xud/src/core/XUD_DeviceAttach.xc | 47 ++--- lib_xud/src/core/XUD_IoLoop.S | 9 +- lib_xud/src/core/XUD_Main.xc | 176 +++---------------- lib_xud/src/core/XUD_PowerSig.xc | 19 +- lib_xud/src/core/XUD_TestMode.h | 3 +- lib_xud/src/core/XUD_TestMode.xc | 77 +------- lib_xud/src/core/XUD_UIFM_Defines.h | 165 ----------------- lib_xud/src/core/XUD_UIFM_RegAccess.S | 1 - lib_xud/src/core/included/XUD_Token_In_DI.S | 12 ++ lib_xud/src/core/included/XUD_Token_Out_DI.S | 4 - lib_xud/src/core/included/XUD_Token_SOF.S | 4 +- lib_xud/src/user/client/XUD_SetDevAddr.xc | 12 -- 13 files changed, 60 insertions(+), 518 deletions(-) delete mode 100755 lib_xud/src/core/XUD_UIFM_Defines.h diff --git a/lib_xud/api/xud.h b/lib_xud/api/xud.h index 6e48c70a..98a0b7b5 100644 --- a/lib_xud/api/xud.h +++ b/lib_xud/api/xud.h @@ -8,7 +8,7 @@ #include -#if defined(__XS1A__) || defined(__XS3A__) +#if defined(__XS3A__) #define XUD_OPT_SOFTCRC5 (1) #else #define XUD_OPT_SOFTCRC5 (0) @@ -17,53 +17,6 @@ #ifndef XUD_STARTUP_ADDRESS #define XUD_STARTUP_ADDRESS (0) #endif - - -#ifndef XUD_U_SERIES -#define XUD_U_SERIES 1 -#endif - -#ifndef XUD_L_SERIES -#define XUD_L_SERIES 2 -#endif - -#ifndef XUD_G_SERIES -#define XUD_G_SERIES 3 -#endif - -#ifndef XUD_X200_SERIES -#define XUD_X200_SERIES 4 -#endif - -#if XUD_SERIES_SUPPORT==1 -#ifndef ARCH_S -#define ARCH_S 1 -#endif -#ifndef ARCH_L -#define ARCH_L 1 -#endif -#endif - -#if XUD_SERIES_SUPPORT==2 -#ifndef ARCH_L -#define ARCH_L 1 -#endif -#endif - -#if XUD_SERIES_SUPPORT==3 -#ifndef ARCH_G -#define ARCH_G 1 -#endif -#endif - -#if XUD_SERIES_SUPPORT==4 -#ifndef ARCH_L -#define ARCH_L 1 -#endif -#ifndef ARCH_X200 -#define ARCH_X200 1 -#endif -#endif #ifdef __xud_conf_h_exists__ #include "xud_conf.h" diff --git a/lib_xud/src/core/XUD_DeviceAttach.xc b/lib_xud/src/core/XUD_DeviceAttach.xc index 09e04618..483e83bb 100755 --- a/lib_xud/src/core/XUD_DeviceAttach.xc +++ b/lib_xud/src/core/XUD_DeviceAttach.xc @@ -3,8 +3,6 @@ #include #include #include -#include "XUD_UIFM_Functions.h" -#include "XUD_UIFM_Defines.h" #include "XUD_USB_Defines.h" #include "XUD_TimingDefines.h" #include "XUD_Support.h" @@ -12,16 +10,12 @@ #include "XUD_HAL.h" -#ifdef ARCH_S -#include "xs1_su_registers.h" -#endif - -#ifdef ARCH_X200 +#ifdef __XS2A__ #include "xs1_to_glx.h" #include "xs2_su_registers.h" #endif -#if defined(ARCH_S) || defined(ARCH_X200) +#ifdef __XS2A__ #include "XUD_USBTile_Support.h" extern unsigned get_tile_id(tileref ref); extern tileref USB_TILE_REF; @@ -30,15 +24,7 @@ extern tileref USB_TILE_REF; extern in port flag0_port; extern in port flag1_port; extern in port flag2_port; -#if defined(ARCH_S) || defined(__XS2A__) || defined(__XS3A__) extern out buffered port:32 p_usb_txd; -#define reg_write_port null -#define reg_read_port null -#else -extern out port reg_write_port; -extern in port reg_read_port; -extern out port p_usb_txd; -#endif #define TUCHEND_DELAY_us 1500 // 1.5ms #define TUCHEND_DELAY (TUCHEND_DELAY_us * REF_CLK_FREQ) @@ -71,10 +57,8 @@ int XUD_DeviceAttachHS(XUD_PwrConfig pwrConfig) // opmode = 0b10, termsel = 1, xcvrsel = 0b00; #if defined(__XS3A__) XUD_HAL_EnterMode_PeripheralChirp(); -#elif defined(ARCH_S) || defined(ARCH_X200) +#elif defined(__XS2A__) write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_FUNC_CONTROL_NUM, 0b1010); -#else - XUD_UIFM_RegWrite(reg_write_port, UIFM_REG_PHYCON, 0x15); #endif //t :> start_time; @@ -97,7 +81,7 @@ int XUD_DeviceAttachHS(XUD_PwrConfig pwrConfig) // J, K, SE0 on flag ports 0, 1, 2 respectively (on XS2) // XS3 has raw linestate on flag port 0 and 1 // Wait for fs chirp k (i.e. HS chirp j) -#ifndef __XS3A +#if defined(__XS2A__) flag1_port when pinseq(0) :> tmp; // Wait for out k to go #endif @@ -109,10 +93,10 @@ int XUD_DeviceAttachHS(XUD_PwrConfig pwrConfig) case t when timerafter(start_time + INVALID_DELAY) :> void: /* Go into full speed mode: XcvrSelect and Term Select (and suspend) high */ -#ifdef __XS3A__ +#if defined(__XS3A__) XUD_HAL_EnterMode_PeripheralFullSpeed(); -#elif defined(ARCH_S) || defined(ARCH_X200) +#elif defined(__XS2A__) write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_FUNC_CONTROL_NUM, (1< tmp; - if(!tmp) { + if(!tmp) + { return 0; /* SE0 gone, return 0 to indicate FULL SPEED */ } #endif if(pwrConfig == XUD_PWR_SELF) { unsigned x; -#if defined(ARCH_S) || defined(ARCH_X200) +#if defined(__XS2A__) read_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_OTG_FLAGS_NUM, x); if(!(x&(1< #include "xud.h" #include "XUD_USB_Defines.h" -#include "XUD_UIFM_Defines.h" #include "XUD_TimingDefines.h" .section .cp.const4,"aMc",@progbits,4 @@ -51,7 +50,6 @@ suspend_t_wtwrsths: #define STACK_TXCRC_INIT (20) #define STACK_RXCRC_INIT (21) - // Params #define STACK_VTOK_PORT (STACK_EXTEND + 1) #define SP_EPTYPES_OUT (STACK_EXTEND + 2) // STACK_EXTEND + 6 : EP Type table (out) @@ -222,7 +220,6 @@ SaveStackPointer: ldaw r11, sp[0] stw r11, dp[SavedSp] - ldw r11, cp[suspendTimeout] stw r11, sp[STACK_SUSPEND_TIMEOUT] @@ -240,11 +237,13 @@ ConfigRxA: setv res[r1], r11 eeu res[RXA] +#ifdef __XS2A__ ConfigValidToken: ldw r10, sp[STACK_VTOK_PORT] setc res[r10], XS1_SETC_COND_NONE ldap r11, TxHandshakeTimeOut // ValidToken is used for timing timeout period when expecting an ack after tx setv res[r10], r11 +#endif #ifndef XUD_TEST_MODE_SUPPORT_DISABLED SetupUsbTestMode: @@ -346,7 +345,11 @@ SetupSuspendResetTimer: setc res[RXD], XS1_SETC_RUN_CLRBUF clre +#ifdef __XS2A__ setsr 0x2 // Enable thread interrupts +#else + #warning no suspend functionalty currently implemented for XS3 +#endif bu NextToken // Main IO Loop diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index 7c654f56..865bbc51 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved /** XUD_Manager.xc * @brief XMOS USB Device(XUD) Layer @@ -19,7 +19,6 @@ void XUD_Error_hex(char errString[], int i_err); #include #include "xud.h" /* External user include file */ -#include "XUD_UIFM_Defines.h" #include "XUD_USB_Defines.h" #include "XUD_USBTile_Support.h" #include "XUD_Support.h" @@ -28,10 +27,6 @@ void XUD_Error_hex(char errString[], int i_err); #include "XUD_DeviceAttach.h" #include "XUD_PowerSig.h" -#ifdef __XS1B__ -#include "xs1_su_registers.h" -#endif - #ifdef __XS2A__ #include "xs1_to_glx.h" #include "xs2_su_registers.h" @@ -44,13 +39,6 @@ unsigned XtlSelFromMhz(unsigned m); #endif #include "XUD_HAL.h" -#if defined(ARCH_X200) || defined(ARCH_S) -#include "XUD_USBTile_Support.h" -//#include -extern unsigned get_tile_id(tileref ref); -extern tileref USB_TILE_REF; -#endif - #if (USB_MAX_NUM_EP_IN != 16) #error USB_MAX_NUM_EP_IN must be 16! #endif @@ -254,50 +242,25 @@ void XUD_PhyReset_User(); #pragma xta command "set required - 83 ns" #endif -/* Timeout differences due to using 60MHz vs 100MHz */ -#if !defined(ARCH_S) && !defined(__XS2A__) && !defined(__XS3A__) -#define HS_TX_HANDSHAKE_TIMEOUT 100 -#define FS_TX_HANDSHAKE_TIMEOUT 3000 -#else #define HS_TX_HANDSHAKE_TIMEOUT (167) #define FS_TX_HANDSHAKE_TIMEOUT (5000) -#endif /* Global vars for current and desired USB speed */ unsigned g_curSpeed; unsigned g_desSpeed; unsigned g_txHandshakeTimeout; -unsigned g_prevPid=0xbadf00d; -unsigned int data_pid=0xbadf00d; - -/* USB Port declarations - for Zevious with Galaxion */ -//extern out port tx_readyout; // aka txvalid -//extern in port tx_readyin; -//extern out buffered port:32 p_usb_txd; -//extern in buffered port:32 p_usb_rxd; -//extern in port rx_rdy; -//extern in port flag0_port; -//extern in port flag1_port; -//#if !defined(__XS3A__) -//extern in port flag2_port; -//#else -//#define flag2_port null -//#endif -//extern in buffered port:32 p_usb_clk; -//extern clock tx_usb_clk; -//extern clock rx_usb_clk; - -in port flag0_port = PORT_USB_FLAG0; /* For XS3: Mission: RXE */ -in port flag1_port = PORT_USB_FLAG1; /* For XS3: Mission: RXA */ - -#if !defined (__XS3A__) + +in port flag0_port = PORT_USB_FLAG0; /* For XS3: Mission: RXE, XS2 is configurable and set to RXE in mission mode */ +in port flag1_port = PORT_USB_FLAG1; /* For XS3: Mission: RXA, XS2 is configuratble and set to RXA in mission mode*/ + +/* XS2A has an additonal flag port. In Mission mode this is set to VALID_TOKEN */ +#ifdef __XS2A__ in port flag2_port = PORT_USB_FLAG2; #else #define flag2_port null #endif -#if defined(ARCH_S) || defined(ARCH_X200) || defined(__XS3A__) -in buffered port:32 p_usb_clk = PORT_USB_CLK; +in buffered port:32 p_usb_clk = PORT_USB_CLK; out buffered port:32 p_usb_txd = PORT_USB_TXD; in buffered port:32 p_usb_rxd = PORT_USB_RXD; out port tx_readyout = PORT_USB_TX_READYOUT; @@ -307,27 +270,6 @@ in port rx_rdy = PORT_USB_RX_READY; on USB_TILE: clock tx_usb_clk = XS1_CLKBLK_2; on USB_TILE: clock rx_usb_clk = XS1_CLKBLK_3; -#elif defined(ARCH_L) || defined(ARCH_G) - -in port p_usb_clk = PORT_USB_CLK; -out port reg_write_port = PORT_USB_REG_WRITE; -in port reg_read_port = PORT_USB_REG_READ; -out port p_usb_txd = PORT_USB_TXD; -port p_usb_rxd = PORT_USB_RXD; -in port p_usb_stp = PORT_USB_STP_SUS; -#else - -#error XUD_SERIES_SUPPORT not equal to XUD_U_SERIES, XUD_G_SERIES or XUD_L_SERIES -#endif - -// TODO RM ME -#define reg_read_port null -#define reg_write_port null - -#ifdef XUD_ISO_OUT_COUNTER -int xud_counter = 0; -#endif - XUD_chan epChans[USB_MAX_NUM_EP]; XUD_chan epChans0[USB_MAX_NUM_EP]; @@ -357,9 +299,6 @@ void XUD_UIFM_PwrSigFlags() #if defined(__XS2A__) write_periph_word(USB_TILE_REF, XS1_GLX_PER_UIFM_CHANEND_NUM, XS1_GLX_PER_UIFM_MASK_NUM, ((1< 500) #define RX_RISE_DELAY 2 #define RX_FALL_DELAY 5 @@ -537,12 +471,6 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c while(noExit) { -#if !defined(ARCH_S) && !defined(__XS2A__) && !defined(__XS3A__) - /* L-series */ - p_usb_rxd <: 0; // Note, this is important else phy clocks in invalid data before UIFM is enabled causing - clearbuf(p_usb_rxd); // connection issues -#endif - unsigned settings[] = {0}; #if defined(__XS2A__) || defined(__XS3A__) @@ -550,16 +478,13 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c XUD_EnableUsbPortMux(); //setps(XS1_PS_XCORE_CTRL0, UIFM_MODE); #endif -#if !defined(XUD_SIM_XSIM) && (defined(ARCH_S) || defined (__XS2A__)) +#if !defined(XUD_SIM_XSIM) && defined (__XS2A__) /* Enable the USB clock */ write_sswitch_reg(get_tile_id(USB_TILE_REF), XS1_SU_CFG_RST_MISC_NUM, ( 1 << XS1_SU_CFG_USB_CLK_EN_SHIFT)); - #ifdef ARCH_S /* Now reset the phy */ - write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_PHY_CONTROL_NUM, 1); //(1< int _; p_usb_clk when pinseq(0) :> int _; -#if (defined(ARCH_L) && !defined(ARCH_X200) && !defined(ARCH_S)) || defined(ARCH_G) - /* For L/G series we wait for clock from phy, then enable UIFM logic */ - // 3 u series, else 2 - #if defined (ARCH_S) - XUD_UIFM_Enable(3); //setps(XS1_PS_XCORE_CTRL0, UIFM_MODE); - #else - XUD_UIFM_Enable(2); //setps(XS1_PS_XCORE_CTRL0, UIFM_MODE); - #endif -#endif - #if defined(__XS2A__) #define XS1_UIFM_USB_PHY_EXT_CTRL_REG 0x50 #define XS1_UIFM_USB_PHY_EXT_CTRL_VBUSVLDEXT_MASK 0x4 @@ -623,10 +538,8 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c #endif #if !defined(XUD_SIM_XSIM) - #if defined(ARCH_S) || defined(ARCH_X200) + #ifdef __XS2A__ write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_CONTROL_NUM, (1< void; } } -#if defined(__XS1B__) || defined(__XS2A__) +#if defined(__XS2A__) /* Go into full speed mode: XcvrSelect and Term Select (and suspend) high */ write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_FUNC_CONTROL_NUM, (1< #include "XUD_UIFM_Functions.h" -#include "XUD_UIFM_Defines.h" #include "XUD_USB_Defines.h" #include "XUD_Support.h" diff --git a/lib_xud/src/core/XUD_TestMode.xc b/lib_xud/src/core/XUD_TestMode.xc index 9ce0e7c5..491aaa81 100644 --- a/lib_xud/src/core/XUD_TestMode.xc +++ b/lib_xud/src/core/XUD_TestMode.xc @@ -3,21 +3,13 @@ #include #include "XUD_UIFM_Functions.h" -#include "XUD_UIFM_Defines.h" #include "XUD_USB_Defines.h" #include "XUD_Support.h" #include "XUD_TestMode.h" #include "xud.h" -#ifdef ARCH_S -#include "xs1_su_registers.h" -#endif - -#ifdef ARCH_X200 +#if defined(__XS2A__) #include "xs2_su_registers.h" -#endif - -#if defined(ARCH_S) || defined(ARCH_X200) #include "XUD_USBTile_Support.h" extern unsigned get_tile_id(tileref ref); extern tileref USB_TILE_REF; @@ -29,16 +21,7 @@ extern in port flag1_port; extern in port flag2_port; #endif -#if defined(ARCH_S) || defined(ARCH_X200) || defined(__XS3A__) extern out buffered port:32 p_usb_txd; -#define reg_write_port null -#define reg_read_port null -#else -extern out port reg_write_port; -extern in port reg_read_port; -extern out port p_usb_txd; -extern port p_usb_rxd; -#endif #define TEST_PACKET_LEN 14 #define T_INTER_TEST_PACKET_us 2 @@ -63,46 +46,6 @@ unsigned int test_packet[TEST_PACKET_LEN] = 0xceb67efd }; -int XUD_TestMode_TestJ () -{ -#if defined (__XS3A__) - -#elif defined(ARCH_L) || defined(ARCH_X200) - -#else - XUD_UIFM_RegWrite(reg_write_port, UIFM_REG_PHYCON, 0x15); - XUD_UIFM_RegWrite(reg_write_port, UIFM_REG_CTRL, 0x4); -#endif - - // TestMode remains in J state until exit action is taken (which - // for a device is power cycle) - while(1) - { - p_usb_txd <: 1; - } - return 0; -}; - -int XUD_TestMode_TestK () -{ -#if defined(__XS3A__) - -#elif defined(ARCH_L) || defined(ARCH_X200) - -#else - XUD_UIFM_RegWrite(reg_write_port, UIFM_REG_PHYCON, 0x15); - XUD_UIFM_RegWrite(reg_write_port, UIFM_REG_CTRL, 0x4); -#endif - - // TestMode remains in J state until exit action is taken (which - // for a device is power cycle) - while(1) - { - p_usb_txd <: 0; - } - return 0; -}; - int XUD_TestMode_TestPacket () { // Repetitively transmit specific test packet forever. @@ -137,17 +80,9 @@ int XUD_UsbTestModeHandler() //Function Control Reg. Suspend: 1 Opmode 10 #if defined(__XS3A__) -#warning TODO + #warning Test modes not implemented for XS3A #elif defined(__XS2A__) write_periph_word(USB_TILE_REF, XS1_GLX_PER_UIFM_CHANEND_NUM, XS1_GLX_PER_UIFM_FUNC_CONTROL_NUM, 0b1000); -#elif defined (__XS1B__) - #if defined(ARCH_S) - /* U-series */ - write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_FUNC_CONTROL_NUM, 0b1000); - #else - /* L-series */ - XUD_UIFM_RegWrite(reg_write_port, UIFM_REG_PHYCON, 0x11); - #endif #endif while(1) { @@ -158,15 +93,9 @@ int XUD_UsbTestModeHandler() case USB_WINDEX_TEST_K: //Function Control Reg. Suspend: 1 Opmode 10 #if defined(__XS3A__) -#warning TODO + // TODO #elif defined(__XS2A__) write_periph_word(USB_TILE_REF, XS1_GLX_PER_UIFM_CHANEND_NUM, XS1_GLX_PER_UIFM_FUNC_CONTROL_NUM, 0b1000); -#elif defined(__XS1B__) - #if defined(ARCH_S) - write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_FUNC_CONTROL_NUM, 0b1000); - #else - XUD_UIFM_RegWrite(reg_write_port, UIFM_REG_PHYCON, 0x11); - #endif #endif while(1) diff --git a/lib_xud/src/core/XUD_UIFM_Defines.h b/lib_xud/src/core/XUD_UIFM_Defines.h deleted file mode 100755 index 36c405cd..00000000 --- a/lib_xud/src/core/XUD_UIFM_Defines.h +++ /dev/null @@ -1,165 +0,0 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved -/** - * \brief Defines for interfacing UIFM (L-series and G-series only) - * Author Ross Owen - **/ - -#if defined (ARCH_L) && !defined(ARCH_X200) & !defined(ARCH_S) - -#ifndef _XUD_UIFM_DEFINES_H_ -#define _XUD_UIFM_DEFINES_H_ 1 - -#define UIFM_MODE 2 // ULPI - -#if 1 -/* Flags Register */ -#ifdef ARCH_L -#define UIFM_REG_FLAGS 6 -#else -#define UIFM_REG_FLAGS 5 -#endif - -#define UIFM_FLAGS_RXE 0x1 -#define UIFM_FLAGS_RXA 0x2 -#define UIFM_FLAGS_CRCFAIL 0x4 -//#define UIFM_FLAGS_FS_K 0x8 -//#define UIFM_FLAGS_FS_J 0x10 -#define XS1_UIFM_IFM_FLAGS_K_MASK 0x10 /* Fullspeed J/High-speed K */ -#define XS1_UIFM_IFM_FLAGS_J_MASK 0x08 /* Fullspeed K/High-speed J */ -#define XS1_UIFM_IFM_FLAGS_SE0_MASK 0x20 -#define UIFM_FLAGS_NEWTOK 0x40 -#define XS1_IFM_FLAGS_HOSTACK 0x80 - - -#ifdef ARCH_L -/* L Series UIFM Defines */ - -/* UIFM Ports */ -//#define UIFM_INT_CLK_PORT XS1_PORT_1I // Not required in software -#define UIFM_USB_CLK_PORT XS1_PORT_1H - -#define UIFM_REG_WRITE_PORT XS1_PORT_8C -#define UIFM_REG_READ_PORT XS1_PORT_8D -#define UIFM_FLAG_0_PORT XS1_PORT_1N -#define UIFM_FLAG_1_PORT XS1_PORT_1O -#define UIFM_FLAG_2_PORT XS1_PORT_1P -#define UIFM_TX_DATA_PORT XS1_PORT_8A -#define UIFM_RX_DATA_PORT XS1_PORT_8B -#define UIFM_STP_SUS_PORT XS1_PORT_1E -#define UIFM_LS_PORT XS1_PORT_4D - -/* Basic UIFM Commands */ -#define UIFM_CMD_READ 0x00 -#define UIFM_CMD_WRITE 0x80 -#define UIFM_CMD_WRITEACK 0xc0 - -/* UIFM Registers */ - -/* Control Register */ -#define UIFM_REG_CTRL 0x01 - -#define UIFM_CTRL_DEFAULT 0x00 -#define UIFM_CTRL_DOTOK 0x01 -#define UIFM_CTRL_CHKTOK 0x02 -#define UIFM_CTRL_DECODE_LS 0x04 -#define UIFM_CTRL_PKTBUF 0x08 -#define UIFM_CTRL_BUFFRDY 0x10 - - -/* Device Address Register */ -#define UIFM_REG_ADDRESS 0x02 - - -/* Phy Control Register */ -#define UIFM_REG_PHYCON 0x03 /* Function Ctl */ - -#define UIFM_PHYCON_SUSPEND 0x01 -#define UIFM_PHYCON_XCVRSEL 0x02 -#define UIFM_PHYCON_TERMSEL 0x04 - - -#define UIFM_REG_ULPICON 4 - -//#define UIFM_REG_SOF1 13 -//#define UIFM_REG_SOF2 14 - - -#define UIFM_REG_STATUS 7 /* NEW */ -#define UIFM_REG_STICKY 8 - -#define UIFM_REG_FLAG_MASK0 9 -#define UIFM_REG_FLAG_MASK1 10 -#define UIFM_REG_FLAG_MASK2 11 -#define UIFM_REG_FLAG_MASK3 12 /* NEW */ -#define UIFM_REG_SOF0 13 -#define UIFM_REG_SOF1 14 -#define UIFM_REG_PID 15 -#define UIFM_REG_EP 16 -#define UIFM_REG_HANDSHAKE 17 -#define UIFM_REG_BUFFCTRL 18 -#define UIFM_REG_BUFFDATA 19 - -/* Misc config reg */ -#define UIFM_REG_MISC 55 -#define UIFM_MISC_SOFISTOKEN 0b10000 - -/* OTG Flags Reg */ -#define UIFM_OTG_FLAGS_REG 5 -#define UIFM_OTG_FLAGS_SESSEND_SHIFT 0 -#define UIFM_OTG_FLAGS_SESSVLD_SHIFT 1 -#define UIFM_OTG_FLAGS_VBUSVLD_SHIFT 2 -#define UIFM_OTG_FLAGS_HOSTDIS_SHIFT 3 -#define UIFM_OTG_FLAGS_NIDGND_SHIFT 4 - -#define UIFM_IN_REG_OFFSET 36 -#define UIFM_OUT_REG_OFFSET 20 - -#else - - - -#define UIFM_INT_CLK_PORT XS1_PORT_1I // Not required in software -#define UIFM_USB_CLK_PORT XS1_PORT_1H - - -// Basic UIFM Commands -#define UIFM_CMD_READ 0x00 -#define UIFM_CMD_WRITE 0x80 -#define UIFM_CMD_WRITEACK 0xc0 -// //#define UIFM_CMD_WRITE_BUFFDATA 0x91 -// //#define UIFM_CMD_READ_BUFFDATA 0x11 -// //#define UIFM_CMD_READ_SBUFFDATA 0x34 -// -// // UIFM Register Address' - #define UIFM_REG_ADDRESS 2 - #define UIFM_REG_CTRL 1 - #define UIFM_REG_PHYCON 3 - #define UIFM_REG_ULPICON 4 - #define UIFM_REG_STICKY 7 - #define UIFM_REG_FLAG_MASK0 8 - #define UIFM_REG_FLAG_MASK1 9 - #define UIFM_REG_FLAG_MASK2 10 - #define UIFM_REG_SOF0 11 - #define UIFM_REG_SOF1 12 - #define UIFM_REG_PID 13 - #define UIFM_REG_EP 14 - #define UIFM_REG_HANDSHAKE 15 - #define UIFM_REG_BUFFCTRL 16 - #define UIFM_REG_BUFFDATA 17 -// -// // Control Register defines - #define UIFM_CTRL_DOTOK 0x1 - #define UIFM_CTRL_CHKTOK 0x2 - #define UIFM_CTRL_DECODE_LS 0x4 - #define UIFM_CTRL_PKTBUF 0x8 - #define UIFM_CTRL_BUFFRDY 0x10 -// - #define UIFM_IN_REG_OFFSET 36 - #define UIFM_OUT_REG_OFFSET 20 -// - -#endif -#endif - -#endif // _XUD_UIFM_DEFINES_H_ -#endif diff --git a/lib_xud/src/core/XUD_UIFM_RegAccess.S b/lib_xud/src/core/XUD_UIFM_RegAccess.S index abaca586..32f6e9d3 100644 --- a/lib_xud/src/core/XUD_UIFM_RegAccess.S +++ b/lib_xud/src/core/XUD_UIFM_RegAccess.S @@ -6,7 +6,6 @@ #include -#include "XUD_UIFM_Defines.h" #include #ifndef GLX diff --git a/lib_xud/src/core/included/XUD_Token_In_DI.S b/lib_xud/src/core/included/XUD_Token_In_DI.S index 0bb05503..2096a693 100755 --- a/lib_xud/src/core/included/XUD_Token_In_DI.S +++ b/lib_xud/src/core/included/XUD_Token_In_DI.S @@ -92,6 +92,7 @@ SetupReceiveHandShake: setpsc res[RXD], r11 // Set port shift count (expect 8 bit handshake) eeu res[RXD] // Events on RXD always enabled - Can;t be any more due to using events on channels +#ifdef __XS2A__ SetupTimeout: // Timeout done using another port off same clock block we dont happen to already be using events on. Cunning. ldw r1, sp[STACK_VTOK_PORT] // Load saved ValidToken port. Event vector already set. in r11, res[r1] // Do input and get port time/timestamps @@ -100,6 +101,9 @@ SetupTimeout: // Timeout done using another port off add r11, r11, r9 setpt res[r1], r11 // Set port time and enable events eeu res[r1] +#else +#warning XS3 doesntnot have handshake timeout implemented +#endif WaitForHandshake: // Wait for timeout or handshake .xtabranch TxHandshakeTimeOut, TxHandShakeReceived @@ -117,7 +121,11 @@ TxHandshakeTimeOut: TxHandShakeReceived: XUD_IN_RxAck: in r11, res[RXD] // Input data from RXD port +#ifdef __XS2A__ + #warning needs addressing for XS3A as part of the handshake timeout clrpt res[r1] // Clear port time on valid token port +#endif + {edu res[RXD]; shr r11, r11, 24} // Shift off junk data to leave ACK #if defined(__XS2A__) || defined(__XS1B__) ldc r9, USB_PID_ACK // Check for good ACK (L series strips of negated bits from PID) @@ -125,7 +133,11 @@ XUD_IN_RxAck: ldc r9, USB_PIDn_ACK #endif xor r9, r11, r9 +#ifdef __XS2A__ {edu res[r1]; bt r9, BadHandshake} // Disable events on ValidToken port +#else + {bt r9, BadHandshake} +#endif DoneTx: diff --git a/lib_xud/src/core/included/XUD_Token_Out_DI.S b/lib_xud/src/core/included/XUD_Token_Out_DI.S index fe24239b..dc61eba0 100755 --- a/lib_xud/src/core/included/XUD_Token_Out_DI.S +++ b/lib_xud/src/core/included/XUD_Token_Out_DI.S @@ -56,11 +56,7 @@ StoreTailDataOut: Err_RxErr: // RxError signal high during data packet receive: clrsr 3 clre -#ifdef __XS2A__ ldw r10, sp[STACK_RXE_PORT] // Read out data from RxE port -#else - ldw r10,sp[STACK_FLAG0_PORT] -#endif in r11, res[r10] eeu res[r10] ldw r10, sp[STACK_RXA_PORT] diff --git a/lib_xud/src/core/included/XUD_Token_SOF.S b/lib_xud/src/core/included/XUD_Token_SOF.S index 95cd8453..1eaafdcd 100644 --- a/lib_xud/src/core/included/XUD_Token_SOF.S +++ b/lib_xud/src/core/included/XUD_Token_SOF.S @@ -3,7 +3,7 @@ // Received SOF token: Reset suspend/reset detection timer .align 4 Pid_Sof: -#ifdef ARCH_L +#ifdef __XS2A__ inpw r10, res[RXD], 8 // Read EP Number shr r10, r10, 24; // Shift off junk @@ -39,7 +39,7 @@ Pid_Sof: // Received SOF token: Reset suspend/reset detection timer .align 4 Pid_Sof_NoChan: -#ifdef ARCH_L +#ifdef __XS2A__ inpw r10, res[RXD], 8; /* Read EP Number */ shr r10, r10, 24; /* Shift off junk */ diff --git a/lib_xud/src/user/client/XUD_SetDevAddr.xc b/lib_xud/src/user/client/XUD_SetDevAddr.xc index 3e7e7a67..d347bf88 100644 --- a/lib_xud/src/user/client/XUD_SetDevAddr.xc +++ b/lib_xud/src/user/client/XUD_SetDevAddr.xc @@ -2,22 +2,10 @@ #include "XUD_UIFM_Functions.h" #include "XUD_USB_Defines.h" -#include "XUD_UIFM_Defines.h" #include "xud.h" -#if defined(ARCH_S) - #if !defined(__XS1B__) - #error - #else - #include - #endif -#endif - #if defined(__XS2A__) #include "xs2_su_registers.h" -#endif - -#if defined(ARCH_S) || defined(__XS2A__) #include "XUD_USBTile_Support.h" extern unsigned get_tile_id(tileref ref); extern tileref USB_TILE_REF; From 6ebae75d5505b95ace1e84626f8e055d9a1b0ebb Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 24 Apr 2020 12:02:06 +0100 Subject: [PATCH 103/520] Added some notes to changelog --- CHANGELOG.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 5ce1dbd4..9da28bbd 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,13 @@ lib_xud Change Log ================== +HEAD +---- + + * ADDED: Initial support for XS3A based devices + * CHANGE: Removed support for XS1-G, and XS1-L (including U series) based devices + + 0.1.1 ----- From 80e7c888ef16dd1c7693701cf511292047d597f4 Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 24 Apr 2020 13:25:04 +0100 Subject: [PATCH 104/520] L-series related items removed for XUD_Main() params --- examples/AN00129_hid_class/src/main.xc | 3 +-- lib_xud/api/xud.h | 11 ----------- lib_xud/src/core/XUD_Main.xc | 6 +++--- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/examples/AN00129_hid_class/src/main.xc b/examples/AN00129_hid_class/src/main.xc index 9f8e9d40..63a6e740 100644 --- a/examples/AN00129_hid_class/src/main.xc +++ b/examples/AN00129_hid_class/src/main.xc @@ -88,8 +88,7 @@ int main() par { on tile[0]: XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, - null, null, -1 , XUD_SPEED_HS, XUD_PWR_BUS); + null, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); on tile[0]: Endpoint0(c_ep_out[0], c_ep_in[0]); diff --git a/lib_xud/api/xud.h b/lib_xud/api/xud.h index 98a0b7b5..606ce051 100644 --- a/lib_xud/api/xud.h +++ b/lib_xud/api/xud.h @@ -165,14 +165,6 @@ typedef enum XUD_Result * endpoints, the second array contains the * endpoint types for each of the IN * endpoints. - * \param p_usb_rst The port to used to connect to an external phy reset line. - * Should be ``null`` for U-Series. - * \param clk The clock block to use for the p_usb_rst port - - * this should not be clock block 0. Should be ``null`` for U-Series. - * \param rstMask The mask to use when taking an external phy into/out of reset. The mask is - * ORed into the port to disable reset, and unset when - * deasserting reset. Use '-1' as a default mask if this - * port is not shared. * \param desiredSpeed This parameter specifies what speed the device will attempt to run at * i.e. full-speed (ie 12Mbps) or high-speed (480Mbps) if supported * by the host. Pass ``XUD_SPEED_HS`` if high-speed is desired or ``XUD_SPEED_FS`` @@ -187,9 +179,6 @@ int XUD_Main(/*tileref * unsafe usbtileXUD_res_t &xudres, */ chanend c_epIn[], int noEpIn, NULLABLE_RESOURCE(chanend, c_sof), XUD_EpType epTypeTableOut[], XUD_EpType epTypeTableIn[], - NULLABLE_RESOURCE(out port, p_usb_rst), - NULLABLE_RESOURCE(clock, clk), - unsigned rstMask, XUD_BusSpeed_t desiredSpeed, XUD_PwrConfig pwrConfig); #endif diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index 865bbc51..518fd69b 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -383,7 +383,7 @@ static void SendSpeed(XUD_chan c[], XUD_EpType epTypeTableOut[], XUD_EpType epTy } // Main XUD loop -static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c_sof, XUD_EpType epTypeTableOut[], XUD_EpType epTypeTableIn[], int noEpOut, int noEpIn, out port ?p_rst, unsigned rstMask, clock ?clk, XUD_PwrConfig pwrConfig) +static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c_sof, XUD_EpType epTypeTableOut[], XUD_EpType epTypeTableIn[], int noEpOut, int noEpIn, XUD_PwrConfig pwrConfig) { int reset = 1; /* Flag for if device is returning from a reset */ /* Make sure ports are on and reset port states */ @@ -794,7 +794,7 @@ int XUD_Main(chanend c_ep_out[], int noEpOut, chanend c_ep_in[], int noEpIn, chanend ?c_sof, XUD_EpType epTypeTableOut[], XUD_EpType epTypeTableIn[], - out port ?p_rst, clock ?clk, unsigned rstMask, XUD_BusSpeed_t speed, XUD_PwrConfig pwrConfig) + XUD_BusSpeed_t speed, XUD_PwrConfig pwrConfig) { /* Arrays for channels... */ /* TODO use two arrays? */ @@ -906,7 +906,7 @@ int XUD_Main(chanend c_ep_out[], int noEpOut, #endif /* Run the main XUD loop */ - XUD_Manager_loop(epChans0, epChans, c_sof, epTypeTableOut, epTypeTableIn, noEpOut, noEpIn, p_rst, rstMask, clk, pwrConfig); + XUD_Manager_loop(epChans0, epChans, c_sof, epTypeTableOut, epTypeTableIn, noEpOut, noEpIn, pwrConfig); // Need to close, drain, and check - three stages. for(int i = 0; i < 3; i++) From 6639333b96cfc1af0ebde6099e7bde65dbfc4648 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 27 Apr 2020 14:20:28 +0100 Subject: [PATCH 105/520] Fixes in xs3 test xn files for latest toolsets --- tests/test_bulk_loopback/test_xs3.xn | 2 +- tests/test_bulk_rx_basic/src/test_xs3.xn | 4 ++-- tests/test_bulk_rx_basic_badcrc32/src/test_xs3.xn | 4 ++-- tests/test_bulk_rx_basic_badpid/src/test_xs3.xn | 4 ++-- tests/test_bulk_rx_basic_nodata/src/test_xs3.xn | 4 ++-- tests/test_bulk_rx_basic_rxerror/src/test_xs3.xn | 4 ++-- tests/test_bulk_rx_fastpacket/src/test_xs3.xn | 4 ++-- tests/test_bulk_rx_multiep/src/test_xs3.xn | 4 ++-- tests/test_bulk_rx_traffic/src/test_xs3.xn | 4 ++-- tests/test_bulk_rxtx_fastpacket/src/test_xs3.xn | 4 ++-- tests/test_bulk_tx_badack/src/test_xs3.xn | 4 ++-- tests/test_bulk_tx_basic/src/test_xs3.xn | 4 ++-- tests/test_bulk_tx_basic_noack/src/test_xs3.xn | 4 ++-- tests/test_bulk_tx_basic_short/src/test_xs3.xn | 4 ++-- tests/test_bulk_tx_fastpacket/src/test_xs3.xn | 4 ++-- tests/test_bulk_tx_multiep/src/test_xs3.xn | 4 ++-- tests/test_bulk_tx_noack/src/test_xs3.xn | 4 ++-- tests/test_control_basic_get/src/test_xs3.xn | 4 ++-- tests/test_control_basic_set/src/test_xs3.xn | 4 ++-- tests/test_invalidtoken/src/test_xs3.xn | 4 ++-- tests/test_iso_loopback/src/test_xs3.xn | 4 ++-- tests/test_iso_rx_basic/src/test_xs3.xn | 4 ++-- tests/test_iso_rxtx_fastpacket/src/test_xs3.xn | 4 ++-- tests/test_iso_tx_basic/src/test_xs3.xn | 4 ++-- tests/test_ping_rx_basic/src/test_xs3.xn | 4 ++-- tests/test_shorttoken/src/test_xs3.xn | 4 ++-- tests/test_sof_badcrc/src/test_xs3.xn | 4 ++-- tests/test_sof_basic/src/test_xs3.xn | 4 ++-- 28 files changed, 55 insertions(+), 55 deletions(-) diff --git a/tests/test_bulk_loopback/test_xs3.xn b/tests/test_bulk_loopback/test_xs3.xn index ab436573..72b7b84b 100644 --- a/tests/test_bulk_loopback/test_xs3.xn +++ b/tests/test_bulk_loopback/test_xs3.xn @@ -7,7 +7,7 @@ - + diff --git a/tests/test_bulk_rx_basic/src/test_xs3.xn b/tests/test_bulk_rx_basic/src/test_xs3.xn index ab436573..6ea38caf 100644 --- a/tests/test_bulk_rx_basic/src/test_xs3.xn +++ b/tests/test_bulk_rx_basic/src/test_xs3.xn @@ -7,9 +7,9 @@ - + - + diff --git a/tests/test_bulk_rx_basic_badcrc32/src/test_xs3.xn b/tests/test_bulk_rx_basic_badcrc32/src/test_xs3.xn index ab436573..6ea38caf 100644 --- a/tests/test_bulk_rx_basic_badcrc32/src/test_xs3.xn +++ b/tests/test_bulk_rx_basic_badcrc32/src/test_xs3.xn @@ -7,9 +7,9 @@ - + - + diff --git a/tests/test_bulk_rx_basic_badpid/src/test_xs3.xn b/tests/test_bulk_rx_basic_badpid/src/test_xs3.xn index ab436573..6ea38caf 100644 --- a/tests/test_bulk_rx_basic_badpid/src/test_xs3.xn +++ b/tests/test_bulk_rx_basic_badpid/src/test_xs3.xn @@ -7,9 +7,9 @@ - + - + diff --git a/tests/test_bulk_rx_basic_nodata/src/test_xs3.xn b/tests/test_bulk_rx_basic_nodata/src/test_xs3.xn index ab436573..6ea38caf 100644 --- a/tests/test_bulk_rx_basic_nodata/src/test_xs3.xn +++ b/tests/test_bulk_rx_basic_nodata/src/test_xs3.xn @@ -7,9 +7,9 @@ - + - + diff --git a/tests/test_bulk_rx_basic_rxerror/src/test_xs3.xn b/tests/test_bulk_rx_basic_rxerror/src/test_xs3.xn index ab436573..6ea38caf 100644 --- a/tests/test_bulk_rx_basic_rxerror/src/test_xs3.xn +++ b/tests/test_bulk_rx_basic_rxerror/src/test_xs3.xn @@ -7,9 +7,9 @@ - + - + diff --git a/tests/test_bulk_rx_fastpacket/src/test_xs3.xn b/tests/test_bulk_rx_fastpacket/src/test_xs3.xn index ab436573..6ea38caf 100644 --- a/tests/test_bulk_rx_fastpacket/src/test_xs3.xn +++ b/tests/test_bulk_rx_fastpacket/src/test_xs3.xn @@ -7,9 +7,9 @@ - + - + diff --git a/tests/test_bulk_rx_multiep/src/test_xs3.xn b/tests/test_bulk_rx_multiep/src/test_xs3.xn index ab436573..6ea38caf 100644 --- a/tests/test_bulk_rx_multiep/src/test_xs3.xn +++ b/tests/test_bulk_rx_multiep/src/test_xs3.xn @@ -7,9 +7,9 @@ - + - + diff --git a/tests/test_bulk_rx_traffic/src/test_xs3.xn b/tests/test_bulk_rx_traffic/src/test_xs3.xn index ab436573..6ea38caf 100644 --- a/tests/test_bulk_rx_traffic/src/test_xs3.xn +++ b/tests/test_bulk_rx_traffic/src/test_xs3.xn @@ -7,9 +7,9 @@ - + - + diff --git a/tests/test_bulk_rxtx_fastpacket/src/test_xs3.xn b/tests/test_bulk_rxtx_fastpacket/src/test_xs3.xn index ab436573..6ea38caf 100644 --- a/tests/test_bulk_rxtx_fastpacket/src/test_xs3.xn +++ b/tests/test_bulk_rxtx_fastpacket/src/test_xs3.xn @@ -7,9 +7,9 @@ - + - + diff --git a/tests/test_bulk_tx_badack/src/test_xs3.xn b/tests/test_bulk_tx_badack/src/test_xs3.xn index ab436573..6ea38caf 100644 --- a/tests/test_bulk_tx_badack/src/test_xs3.xn +++ b/tests/test_bulk_tx_badack/src/test_xs3.xn @@ -7,9 +7,9 @@ - + - + diff --git a/tests/test_bulk_tx_basic/src/test_xs3.xn b/tests/test_bulk_tx_basic/src/test_xs3.xn index ab436573..6ea38caf 100644 --- a/tests/test_bulk_tx_basic/src/test_xs3.xn +++ b/tests/test_bulk_tx_basic/src/test_xs3.xn @@ -7,9 +7,9 @@ - + - + diff --git a/tests/test_bulk_tx_basic_noack/src/test_xs3.xn b/tests/test_bulk_tx_basic_noack/src/test_xs3.xn index ab436573..6ea38caf 100644 --- a/tests/test_bulk_tx_basic_noack/src/test_xs3.xn +++ b/tests/test_bulk_tx_basic_noack/src/test_xs3.xn @@ -7,9 +7,9 @@ - + - + diff --git a/tests/test_bulk_tx_basic_short/src/test_xs3.xn b/tests/test_bulk_tx_basic_short/src/test_xs3.xn index ab436573..6ea38caf 100644 --- a/tests/test_bulk_tx_basic_short/src/test_xs3.xn +++ b/tests/test_bulk_tx_basic_short/src/test_xs3.xn @@ -7,9 +7,9 @@ - + - + diff --git a/tests/test_bulk_tx_fastpacket/src/test_xs3.xn b/tests/test_bulk_tx_fastpacket/src/test_xs3.xn index ab436573..6ea38caf 100644 --- a/tests/test_bulk_tx_fastpacket/src/test_xs3.xn +++ b/tests/test_bulk_tx_fastpacket/src/test_xs3.xn @@ -7,9 +7,9 @@ - + - + diff --git a/tests/test_bulk_tx_multiep/src/test_xs3.xn b/tests/test_bulk_tx_multiep/src/test_xs3.xn index ab436573..6ea38caf 100644 --- a/tests/test_bulk_tx_multiep/src/test_xs3.xn +++ b/tests/test_bulk_tx_multiep/src/test_xs3.xn @@ -7,9 +7,9 @@ - + - + diff --git a/tests/test_bulk_tx_noack/src/test_xs3.xn b/tests/test_bulk_tx_noack/src/test_xs3.xn index ab436573..6ea38caf 100644 --- a/tests/test_bulk_tx_noack/src/test_xs3.xn +++ b/tests/test_bulk_tx_noack/src/test_xs3.xn @@ -7,9 +7,9 @@ - + - + diff --git a/tests/test_control_basic_get/src/test_xs3.xn b/tests/test_control_basic_get/src/test_xs3.xn index ab436573..6ea38caf 100644 --- a/tests/test_control_basic_get/src/test_xs3.xn +++ b/tests/test_control_basic_get/src/test_xs3.xn @@ -7,9 +7,9 @@ - + - + diff --git a/tests/test_control_basic_set/src/test_xs3.xn b/tests/test_control_basic_set/src/test_xs3.xn index ab436573..6ea38caf 100644 --- a/tests/test_control_basic_set/src/test_xs3.xn +++ b/tests/test_control_basic_set/src/test_xs3.xn @@ -7,9 +7,9 @@ - + - + diff --git a/tests/test_invalidtoken/src/test_xs3.xn b/tests/test_invalidtoken/src/test_xs3.xn index ab436573..6ea38caf 100644 --- a/tests/test_invalidtoken/src/test_xs3.xn +++ b/tests/test_invalidtoken/src/test_xs3.xn @@ -7,9 +7,9 @@ - + - + diff --git a/tests/test_iso_loopback/src/test_xs3.xn b/tests/test_iso_loopback/src/test_xs3.xn index ab436573..6ea38caf 100644 --- a/tests/test_iso_loopback/src/test_xs3.xn +++ b/tests/test_iso_loopback/src/test_xs3.xn @@ -7,9 +7,9 @@ - + - + diff --git a/tests/test_iso_rx_basic/src/test_xs3.xn b/tests/test_iso_rx_basic/src/test_xs3.xn index ab436573..6ea38caf 100644 --- a/tests/test_iso_rx_basic/src/test_xs3.xn +++ b/tests/test_iso_rx_basic/src/test_xs3.xn @@ -7,9 +7,9 @@ - + - + diff --git a/tests/test_iso_rxtx_fastpacket/src/test_xs3.xn b/tests/test_iso_rxtx_fastpacket/src/test_xs3.xn index ab436573..6ea38caf 100644 --- a/tests/test_iso_rxtx_fastpacket/src/test_xs3.xn +++ b/tests/test_iso_rxtx_fastpacket/src/test_xs3.xn @@ -7,9 +7,9 @@ - + - + diff --git a/tests/test_iso_tx_basic/src/test_xs3.xn b/tests/test_iso_tx_basic/src/test_xs3.xn index ab436573..6ea38caf 100644 --- a/tests/test_iso_tx_basic/src/test_xs3.xn +++ b/tests/test_iso_tx_basic/src/test_xs3.xn @@ -7,9 +7,9 @@ - + - + diff --git a/tests/test_ping_rx_basic/src/test_xs3.xn b/tests/test_ping_rx_basic/src/test_xs3.xn index ab436573..6ea38caf 100644 --- a/tests/test_ping_rx_basic/src/test_xs3.xn +++ b/tests/test_ping_rx_basic/src/test_xs3.xn @@ -7,9 +7,9 @@ - + - + diff --git a/tests/test_shorttoken/src/test_xs3.xn b/tests/test_shorttoken/src/test_xs3.xn index ab436573..6ea38caf 100644 --- a/tests/test_shorttoken/src/test_xs3.xn +++ b/tests/test_shorttoken/src/test_xs3.xn @@ -7,9 +7,9 @@ - + - + diff --git a/tests/test_sof_badcrc/src/test_xs3.xn b/tests/test_sof_badcrc/src/test_xs3.xn index ab436573..6ea38caf 100644 --- a/tests/test_sof_badcrc/src/test_xs3.xn +++ b/tests/test_sof_badcrc/src/test_xs3.xn @@ -7,9 +7,9 @@ - + - + diff --git a/tests/test_sof_basic/src/test_xs3.xn b/tests/test_sof_basic/src/test_xs3.xn index ab436573..6ea38caf 100644 --- a/tests/test_sof_basic/src/test_xs3.xn +++ b/tests/test_sof_basic/src/test_xs3.xn @@ -7,9 +7,9 @@ - + - + From 437090b59d37a9058723bee3ec951fce4b35dcc8 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 27 Apr 2020 15:07:11 +0100 Subject: [PATCH 106/520] L-series phy reset function deleted --- lib_xud/src/core/XUD_PowerSig.xc | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/lib_xud/src/core/XUD_PowerSig.xc b/lib_xud/src/core/XUD_PowerSig.xc index 6bcb5ae3..4f602fa4 100755 --- a/lib_xud/src/core/XUD_PowerSig.xc +++ b/lib_xud/src/core/XUD_PowerSig.xc @@ -53,22 +53,6 @@ extern in buffered port:32 p_usb_rxd; extern unsigned g_curSpeed; -/* Reset USB transceiver for specified time */ -void XUD_PhyReset(out port p_rst, int time, unsigned rstMask) -{ - unsigned x; - - x = peek(p_rst); - x &= (~rstMask); - p_rst <: x; - - XUD_Sup_Delay(time); - - x = peek(p_rst); - x |= rstMask; - p_rst <: x; -} - int XUD_Init() { timer SE0_timer; From 82d8d06858e1a80efe578f25c9ad0c794eeb6d45 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 28 Apr 2020 17:04:25 +0100 Subject: [PATCH 107/520] Added XUD_HAL_WaitForLineStateChange() and added first XS3 suspend implementation (unused) --- lib_xud/src/core/XUD_HAL.h | 4 +- lib_xud/src/core/XUD_HAL.xc | 75 ++++++++++++++++++++++++++++---- lib_xud/src/core/XUD_PowerSig.xc | 70 +++++++++++++++++++++++++++-- 3 files changed, 135 insertions(+), 14 deletions(-) diff --git a/lib_xud/src/core/XUD_HAL.h b/lib_xud/src/core/XUD_HAL.h index 76b1f0da..cac6a43e 100644 --- a/lib_xud/src/core/XUD_HAL.h +++ b/lib_xud/src/core/XUD_HAL.h @@ -23,8 +23,8 @@ typedef enum XUD_LineState_t } XUD_LineState_t; -int XUD_HAL_GetLineState(/*XUD_HAL_t &xudHal*/); - +XUD_LineState_t XUD_HAL_GetLineState(/*XUD_HAL_t &xudHal*/); +unsigned XUD_HAL_WaitForLineStateChange(XUD_LineState_t ¤tLs, unsigned timeout); void XUD_HAL_Mode_PowerSig(); void XUD_HAL_Mode_DataTransfer(); diff --git a/lib_xud/src/core/XUD_HAL.xc b/lib_xud/src/core/XUD_HAL.xc index 25f04e77..152b673e 100644 --- a/lib_xud/src/core/XUD_HAL.xc +++ b/lib_xud/src/core/XUD_HAL.xc @@ -130,17 +130,23 @@ void XUD_HAL_Mode_DataTransfer() #endif -/* TODO pass structure */ -int XUD_HAL_GetLineState(/*XUD_HAL_t &xudHal*/) +{unsigned, unsigned} LineStateToLines(XUD_LineState_t ls) { - unsigned dm, dp; - // xudHal.p_usb_fl0 :> dp; - // xudHal.p_usb_fl1 :> dm; - -#ifdef __XS3A__ - flag0_port :> dp; - flag1_port :> dm; + switch(ls) + { + case XUD_LINESTATE_J: + return {1,0}; + case XUD_LINESTATE_K: + return {0, 1}; + case XUD_LINESTATE_SE0: + return {0, 0}; + case XUD_LINESTATE_INVALID: + return {1,1}; + } +} +static inline XUD_LineState_t LinesToLineState(unsigned dp, unsigned dm) +{ if(dp && !dm) return XUD_LINESTATE_J; else if(dm && !dp) @@ -149,6 +155,22 @@ int XUD_HAL_GetLineState(/*XUD_HAL_t &xudHal*/) return XUD_LINESTATE_SE0; else return XUD_LINESTATE_INVALID; +} + +#define dp_port flag0_port +#define dm_port flag1_port + +/* TODO pass structure */ +XUD_LineState_t XUD_HAL_GetLineState(/*XUD_HAL_t &xudHal*/) +{ + // xudHal.p_usb_fl0 :> dp; + // xudHal.p_usb_fl1 :> dm; + +#ifdef __XS3A__ + unsigned dp, dm; + flag0_port :> dp; + flag1_port :> dm; + return LinesToLineState(dp, dp); #else unsigned j, k, se0; @@ -165,3 +187,38 @@ int XUD_HAL_GetLineState(/*XUD_HAL_t &xudHal*/) #endif } + +unsigned XUD_HAL_WaitForLineStateChange(XUD_LineState_t ¤tLs, unsigned timeout) +{ +#ifdef __XS3A__ + unsigned dp, dm; + timer t; + unsigned time; + + /* Look up line values from linestate */ + {dp, dm} = LineStateToLines(currentLs); + + if (timeout != null) + t :> time; + + /* Wait for change */ + select + { + case dp_port when pinsneq(dp) :> dp: + break; + case dm_port when pinsneq(dm) :> dm: + break; + case timeout != null => t when timerafter(time + timeout) :> int _: + return 1; + + } + + /* Return new linestate */ + currentLs = LinesToLineState(dp, dm); + return 0; + +#else + #error TODO +#endif + +} diff --git a/lib_xud/src/core/XUD_PowerSig.xc b/lib_xud/src/core/XUD_PowerSig.xc index 4f602fa4..87fa0760 100755 --- a/lib_xud/src/core/XUD_PowerSig.xc +++ b/lib_xud/src/core/XUD_PowerSig.xc @@ -217,10 +217,74 @@ int XUD_Suspend(XUD_PwrConfig pwrConfig) #else int XUD_Suspend(XUD_PwrConfig pwrConfig) { -#warning Suspend not implemented for XS3A + timer t; + unsigned time; + + unsigned reset = 0; + while(1); - // TODO -} +#if 0 + XUD_LineState_t currentLs = XUD_LINESTATE_J; + + while(1) + { + unsigned timedOut = XUD_HAL_WaitForLineStateChange(currentLs, 0); + + switch(currentLs) + { + case XUD_LINESTATE_J: + /* Do nothing */ + break; + + + /* Reset signalliung */ + case XUD_LINESTATE_SE0: + + timedOut = XUD_HAL_WaitForLineStateChange(currentLs, T_FILTSE0); + + if(timedOut) + { + /* Consider 2.5ms a complete reset */ + t :> time; + t when timerafter(time + 250000) :> void; + + /* Return 1 for reset */ + return 1; + + } + + /* If didnt timeout then keep looping...*/ + + /* K, start of resume */ + case XUD_LINESTATE_K: + + /* TODO debounce? */ + XUD_HAL_WaitForLineStateChange(currentLs, 0); + + switch(currentLs) + { + /* J, unexpected, return to suspend.. */ + case XUD_LINESTATE_J: + + break; + + /* SE0, end of resume */ + case XUD_LINESTATE_SE0: + if (g_curSpeed == XUD_SPEED_HS) + { + /* Move back into high-speed mode */ + XUD_HAL_EnterMode_PeripheralHighSpeed(); + + /* Return 0 for resumed */ + return 0; + } + break; + } + break; + } + } +#endif +} #endif #endif From 0d77fabd5d9997c332d02e9dcd6e6485a5ef1ed2 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 28 Apr 2020 17:08:59 +0100 Subject: [PATCH 108/520] Fixed typo bug in XUD_HAL --- lib_xud/src/core/XUD_HAL.xc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xud/src/core/XUD_HAL.xc b/lib_xud/src/core/XUD_HAL.xc index 152b673e..3e30c2a5 100644 --- a/lib_xud/src/core/XUD_HAL.xc +++ b/lib_xud/src/core/XUD_HAL.xc @@ -170,7 +170,7 @@ XUD_LineState_t XUD_HAL_GetLineState(/*XUD_HAL_t &xudHal*/) unsigned dp, dm; flag0_port :> dp; flag1_port :> dm; - return LinesToLineState(dp, dp); + return LinesToLineState(dp, dm); #else unsigned j, k, se0; From 075fe2a1b6fbe5ad51617b2572cc4a327dc864ce Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 28 Apr 2020 17:35:07 +0100 Subject: [PATCH 109/520] Enabled Suspend functionality on XS3. Not currently 100% reliable. --- lib_xud/src/core/XUD_IoLoop.S | 5 ----- lib_xud/src/core/XUD_PowerSig.xc | 5 +---- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/lib_xud/src/core/XUD_IoLoop.S b/lib_xud/src/core/XUD_IoLoop.S index 88d846bf..3ebde3e7 100755 --- a/lib_xud/src/core/XUD_IoLoop.S +++ b/lib_xud/src/core/XUD_IoLoop.S @@ -337,7 +337,6 @@ SetupSuspendResetTimer: ldw r9, cp[suspendTimeout] add r11, r11, r9 setd res[r10], r11 - setc res[r10], XS1_SETC_COND_AFTER setc res[r10], XS1_SETC_IE_MODE_INTERRUPT eeu res[r10] // Enable events/interupts on resource @@ -345,11 +344,7 @@ SetupSuspendResetTimer: setc res[RXD], XS1_SETC_RUN_CLRBUF clre -#ifdef __XS2A__ setsr 0x2 // Enable thread interrupts -#else - #warning no suspend functionalty currently implemented for XS3 -#endif bu NextToken // Main IO Loop diff --git a/lib_xud/src/core/XUD_PowerSig.xc b/lib_xud/src/core/XUD_PowerSig.xc index 87fa0760..be063bd9 100755 --- a/lib_xud/src/core/XUD_PowerSig.xc +++ b/lib_xud/src/core/XUD_PowerSig.xc @@ -222,9 +222,6 @@ int XUD_Suspend(XUD_PwrConfig pwrConfig) unsigned reset = 0; - while(1); - -#if 0 XUD_LineState_t currentLs = XUD_LINESTATE_J; while(1) @@ -255,6 +252,7 @@ int XUD_Suspend(XUD_PwrConfig pwrConfig) } /* If didnt timeout then keep looping...*/ + break; /* K, start of resume */ case XUD_LINESTATE_K: @@ -284,7 +282,6 @@ int XUD_Suspend(XUD_PwrConfig pwrConfig) break; } } -#endif } #endif #endif From 10cd5619e06fbe8c600c5b8f8d4b8fb8a7aebe04 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 29 Apr 2020 11:39:41 +0100 Subject: [PATCH 110/520] Comment only --- lib_xud/src/core/XUD_PowerSig.xc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xud/src/core/XUD_PowerSig.xc b/lib_xud/src/core/XUD_PowerSig.xc index be063bd9..6c580099 100755 --- a/lib_xud/src/core/XUD_PowerSig.xc +++ b/lib_xud/src/core/XUD_PowerSig.xc @@ -271,7 +271,7 @@ int XUD_Suspend(XUD_PwrConfig pwrConfig) case XUD_LINESTATE_SE0: if (g_curSpeed == XUD_SPEED_HS) { - /* Move back into high-speed mode */ + /* Move back into high-speed mode - Notes, writes to XS3A registers orders of magnitude faster than XS2A */ XUD_HAL_EnterMode_PeripheralHighSpeed(); /* Return 0 for resumed */ From 53d71deb180696f871738a003962f70bdd03ea0c Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 29 Apr 2020 11:39:51 +0100 Subject: [PATCH 111/520] Comment only --- lib_xud/src/core/XUD_HAL.xc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib_xud/src/core/XUD_HAL.xc b/lib_xud/src/core/XUD_HAL.xc index 3e30c2a5..023fac76 100644 --- a/lib_xud/src/core/XUD_HAL.xc +++ b/lib_xud/src/core/XUD_HAL.xc @@ -163,16 +163,14 @@ static inline XUD_LineState_t LinesToLineState(unsigned dp, unsigned dm) /* TODO pass structure */ XUD_LineState_t XUD_HAL_GetLineState(/*XUD_HAL_t &xudHal*/) { - // xudHal.p_usb_fl0 :> dp; - // xudHal.p_usb_fl1 :> dm; - #ifdef __XS3A__ + // xudHal.p_usb_fl0 :> dp; + // xudHal.p_usb_fl1 :> dm; unsigned dp, dm; flag0_port :> dp; flag1_port :> dm; return LinesToLineState(dp, dm); #else - unsigned j, k, se0; flag0_port :> j; flag1_port :> k; From 13b99233e8ff17f00e6d10a204770776228c7128 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 29 Apr 2020 13:56:33 +0100 Subject: [PATCH 112/520] Added some documentation for XUD_HAL --- lib_xud/src/core/XUD_HAL.h | 66 +++++++++++++++++++++++++++----------- 1 file changed, 47 insertions(+), 19 deletions(-) diff --git a/lib_xud/src/core/XUD_HAL.h b/lib_xud/src/core/XUD_HAL.h index cac6a43e..278f421e 100644 --- a/lib_xud/src/core/XUD_HAL.h +++ b/lib_xud/src/core/XUD_HAL.h @@ -1,30 +1,58 @@ #include "xud.h" - - -void XUD_HAL_EnterMode_PeripheralFullSpeed(); -void XUD_HAL_EnterMode_PeripheralChirp(); -void XUD_HAL_EnterMode_PeripheralHighSpeed(); - - -typedef struct XUD_HAL_t -{ - in port p_usb_fl0; - in port p_usb_fl1; - - -} XUD_HAL_t; - +/** + * @file XUD_HAL.h + * \brief USB HAL Layer +**/ + +/** + * \enum XUD_LineState_t + * \brief USB Line States + */ typedef enum XUD_LineState_t { - XUD_LINESTATE_SE0, - XUD_LINESTATE_J, - XUD_LINESTATE_K, - XUD_LINESTATE_INVALID + XUD_LINESTATE_SE0, /**< SE0 State */ + XUD_LINESTATE_J, /**< J State */ + XUD_LINESTATE_K, /**< K State */ + XUD_LINESTATE_INVALID /**< Invalid bus state both lines high **/ } XUD_LineState_t; +void XUD_HAL_EnterMode_PeripheralChirp(); +void XUD_HAL_EnterMode_PeripheralFullSpeed(); +void XUD_HAL_EnterMode_PeripheralHighSpeed(); + +/** + * \brief Get current linestate status + * \return XUD_LineState_t representing current line status +**/ XUD_LineState_t XUD_HAL_GetLineState(/*XUD_HAL_t &xudHal*/); + +/** + * \brief Wait for a change in linestate and return, or timeout + * \param Reference to current linestate (updated with new linestate + * \return 1 for timed out, otherwise 0 +**/ unsigned XUD_HAL_WaitForLineStateChange(XUD_LineState_t ¤tLs, unsigned timeout); +/** + * \brief HAL function to set xCORE into signalling mode + * (as opposed to "data transfer" mode) + * + * TODO Should this be combined with EnterMode_PeripheralChirp()? + **/ void XUD_HAL_Mode_PowerSig(); + +/** + * \brief HAL function to set xCORE into data transfer mode + * (as opposed to "signalling" mode ) + * + * TODO Should this be combined with EnterMode_PeripheralHigh/FullSpeed()? + **/ void XUD_HAL_Mode_DataTransfer(); + +/** + * \brief HAL function to set xCORE to correct USB device address + * \param address The new address + * \return void + **/ +void XUD_HAL_SetDeviceAddress(unsigned char address); From ad216cea800ad6c7d76839b8c4cc0e94451a4a84 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 29 Apr 2020 13:56:56 +0100 Subject: [PATCH 113/520] Added XUD_HAL_SetDeviceAddress() --- lib_xud/src/core/XUD_HAL.xc | 11 +++++++++++ lib_xud/src/core/XUD_Main.xc | 12 ++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/lib_xud/src/core/XUD_HAL.xc b/lib_xud/src/core/XUD_HAL.xc index 023fac76..c748e516 100644 --- a/lib_xud/src/core/XUD_HAL.xc +++ b/lib_xud/src/core/XUD_HAL.xc @@ -8,6 +8,8 @@ extern in port flag1_port; extern in port flag2_port; #else +void XUD_SetCrcTableAddr(unsigned addr); + #include extern in port flag0_port; /* For XS3: RXA or DP */ @@ -220,3 +222,12 @@ unsigned XUD_HAL_WaitForLineStateChange(XUD_LineState_t ¤tLs, unsigned tim #endif } + +void XUD_HAL_SetDeviceAddress(unsigned char address) +{ +#if defined(__XS2A__) + write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_DEVICE_ADDRESS_NUM, address); +#elif defined(__XS3A__) + XUD_SetCrcTableAddr(address); +#endif +} diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index 518fd69b..f1bd258b 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -397,6 +397,8 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c #endif #if (XUD_OPT_SOFTCRC5) + + // TODO is this required XUD_SetCrcTableAddr(XUD_STARTUP_ADDRESS); #endif @@ -630,9 +632,7 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c SendResetToEps(epChans0, epChans, epTypeTableOut, epTypeTableIn, noEpOut, noEpIn, USB_RESET_TOKEN); sentReset = 1; } -#ifdef __XS3A__ - XUD_SetCrcTableAddr(XUD_STARTUP_ADDRESS); -#endif + /* Reset the OUT ep structures */ for(int i = 0; i< noEpOut; i++) { @@ -652,11 +652,7 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c #if !defined (XUD_SIM_XSIM) /* Set default device address */ - #if defined(__XS1B__) || defined(__XS2A__) - write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_DEVICE_ADDRESS_NUM, 0); - #elif defined(__XS3A__) - XUD_SetCrcTableAddr(XUD_STARTUP_ADDRESS); - #endif + XUD_HAL_SetDeviceAddress(XUD_STARTUP_ADDRESS); #endif #ifdef XUD_BYPASS_RESET From 63ae7fd144afec12d5c9a65ef0a2fddc017790fb Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 29 Apr 2020 13:57:24 +0100 Subject: [PATCH 114/520] Added initial init implementation for XS3 --- lib_xud/src/core/XUD_PowerSig.xc | 41 +++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/lib_xud/src/core/XUD_PowerSig.xc b/lib_xud/src/core/XUD_PowerSig.xc index 6c580099..cdcc713c 100755 --- a/lib_xud/src/core/XUD_PowerSig.xc +++ b/lib_xud/src/core/XUD_PowerSig.xc @@ -58,24 +58,43 @@ int XUD_Init() timer SE0_timer; unsigned SE0_start_time = 0; -#ifdef DO_TOKS - /* Set default device address */ - XUD_UIFM_RegWrite(reg_write_port, UIFM_REG_ADDRESS, 0x0); -#endif - /* Wait for host */ while (1) { #ifdef __XS3A__ -#warning XUD_Init() not properly implemented for XS3A - XUD_LineState_t ls = XUD_HAL_GetLineState(); + XUD_LineState_t currentLs = XUD_HAL_GetLineState(); - if(ls == XUD_LINESTATE_SE0) - return 1; - else if(ls == XUD_LINESTATE_J) - return 0; + switch (currentLs) + { + + case XUD_LINESTATE_SE0: + + unsigned timedOut = XUD_HAL_WaitForLineStateChange(currentLs, T_WTRSTFS); + + /* If no change in LS then return 1 for reset */ + if(timedOut) + return 1; + + /* Otherwise SE0 went away.. keep looking */ + break; + + case XUD_LINESTATE_J: + + unsigned timedOut = XUD_HAL_WaitForLineStateChange(currentLs, STATE_START_TO); + + /* If no change in LS then return 0 for suspend */ + if(timedOut) + return 0; + + /* Otherwise J went away.. keep looking */ + break; + + default: + /* Shouldn't expect to get here, but ignore anyway */ + break; + } #else select From b30a9a7717a91946f7050a3aa6f8b73bbe81e0b1 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 29 Apr 2020 14:02:08 +0100 Subject: [PATCH 115/520] Removed extra call to XUD_SetCrcTableAddr(). Moves xta pragmas. --- lib_xud/src/core/XUD_Main.xc | 202 +---------------------------------- 1 file changed, 4 insertions(+), 198 deletions(-) diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index f1bd258b..eb90c904 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -1,7 +1,8 @@ // Copyright (c) 2011-2020, XMOS Ltd, All rights reserved -/** XUD_Manager.xc - * @brief XMOS USB Device(XUD) Layer +/** + * @file XUD_Manager.xc + * @brief XMOS USB Device (XUD) Layer * @author Ross Owen **/ /* Error printing functions */ @@ -51,196 +52,7 @@ void XUD_UserSuspend(); void XUD_UserResume(); void XUD_PhyReset_User(); -#if 0 -#pragma xta command "config threads stdcore[0] 6" -#pragma xta command "add exclusion Pid_Out" -#pragma xta command "add exclusion Pid_Setup" -#pragma xta command "add exclusion Pid_Sof" -#pragma xta command "add exclusion Pid_Reserved" -#pragma xta command "add exclusion Pid_Ack" -#pragma xta command "add exclusion Pid_Data0" -#pragma xta command "add exclusion Pid_Ping" -#pragma xta command "add exclusion Pid_Nyet" -#pragma xta command "add exclusion Pid_Data2" -#pragma xta command "add exclusion Pid_Data1" -#pragma xta command "add exclusion Pid_Data0" -#pragma xta command "add exclusion Pid_Datam" -#pragma xta command "add exclusion Pid_Split" -#pragma xta command "add exclusion Pid_Stall" -#pragma xta command "add exclusion Pid_Pre" -#pragma xta command "add exclusion InvalidToken" -#pragma xta command "add exclusion InReady" - -#pragma xta command "analyse path XUD_TokenRx_Pid XUD_TokenRx_Ep" -#pragma xta command "set required - 33 ns" -#endif - - -/* Rx to TX 16 clks required with SMSC phy (14 in spec). SIE Decision Time */ -#if 0 -#pragma xta command "analyse path XUD_TokenRx_Ep XUD_IN_TxNak" -#pragma xta command "set required - 233 ns" -#pragma xta command "add exclusion InNotReady" -#pragma xta command "remove exclusion InReady" - - -#pragma xta command "add exclusion XUD_IN_TxPid_Tail1" -#pragma xta command "add exclusion XUD_IN_TxPid_Tail2" -#pragma xta command "add exclusion XUD_IN_TxPid_Tail3" -#pragma xta command "add exclusion XUD_IN_TxPid_TailS0" -#pragma xta command "add exclusion XUD_IN_TxPid_TailS1" -#pragma xta command "add exclusion XUD_IN_TxPid_TailS2" -#pragma xta command "add exclusion XUD_IN_TxPid_TailS3" -#endif -#if 0 -#pragma xta command "analyse path XUD_TokenRx_Ep XUD_IN_TxPid_Tail0" -#pragma xta command "set required - 266 ns" -#endif - -#if 0 -#pragma xta command "remove exclusion XUD_IN_TxPid_TailS0" -#pragma xta command "add exclusion XUD_IN_TxPid_Tail0" -#pragma xta command "analyse path XUD_TokenRx_Ep XUD_IN_TxPid_TailS0" -#pragma xta command "set required - 266 ns" - -#pragma xta command "remove exclusion XUD_IN_TxPid_Tail1" -#pragma xta command "add exclusion XUD_IN_TxPid_TailS0" -#if 0 -#pragma xta command "analyse path XUD_TokenRx_Ep XUD_IN_TxPid_Tail1" -#pragma xta command "set required - 266 ns" -#endif - -#pragma xta command "remove exclusion XUD_IN_TxPid_TailS1" -#pragma xta command "add exclusion XUD_IN_TxPid_Tail1" -#if 0 -#pragma xta command "analyse path XUD_TokenRx_Ep XUD_IN_TxPid_TailS1" -#pragma xta command "set required - 266 ns" -#endif - -//#pragma xta command "remove exclusion ShortPacket" -//pragma xta command "add exclusion NormalPacket" -//#pragma xta command "analyse path XUD_TokenRx_Ep XUD_IN_TxPid_Short" -//#pragma xta command "set required - 233 ns" - -/* TX TO RX */ -/* Tx IN NAK to Token Rx */ -#pragma xta command "remove exclusion InNotReady" -#pragma xta command "add exclusion InReady" -#if 0 -#pragma xta command "analyse path XUD_TokenRx_Pid XUD_IN_TxNak" -#pragma xta command "set required - 100 ns" -#endif - -/* Tx OUT NAK to Token RX */ -#if 0 -#pragma xta command "analyse path XUD_OUT_TxNak XUD_TokenRx_Pid" -#pragma xta command "set required - 100 ns" -#endif - -/* Tx OUT ACK to Token Tx */ -#if 0 -#pragma xta command "analyse path XUD_OUT_TxAck XUD_TokenRx_Pid" -#pragma xta command "set required - 100 ns" -#endif - -/* Tx IN Data (so crc) to Rx Ack (Non ISO IN) */ -#pragma xta command "add exclusion InNotReady" -#pragma xta command "remove exclusion InReady" -#if 0 -#pragma xta command "add exclusion InISO" -#pragma xta command "add exclusion TxHandshakeTimeOut" -#endif - -#pragma xta command "remove exclusion XUD_IN_TxPid_Tail0" -#pragma xta command "add exclusion XUD_IN_TxPid_TailS1" -#if 0 -#pragma xta command "analyse path XUD_IN_TxCrc_Tail0 XUD_IN_RxAck" -#pragma xta command "set required - 100 ns" -#endif - -#pragma xta command "add exclusion XUD_IN_TxPid_Tail0" -#pragma xta command "remove exclusion XUD_IN_TxPid_Tail1" -#if 0 -#pragma xta command "analyse path XUD_IN_TxCrc_Tail1 XUD_IN_RxAck" -#pragma xta command "set required - 100 ns" -#endif - -#pragma xta command "add exclusion XUD_IN_TxPid_Tail1" -#pragma xta command "remove exclusion XUD_IN_TxPid_TailS0" -#if 0 -#pragma xta command "analyse path XUD_IN_TxCrc_TailS0 XUD_IN_RxAck" -#pragma xta command "set required - 100 ns" -#endif - -#pragma xta command "add exclusion XUD_IN_TxPid_TailS0" -#pragma xta command "remove exclusion XUD_IN_TxPid_TailS1" -#if 0 -#pragma xta command "analyse path XUD_IN_TxCrc_TailS1 XUD_IN_RxAck" -#pragma xta command "set required - 100 ns" -#endif - -/* Tx IN Data (so crc) to Rx Token PID (ISO In) */ -#pragma xta command "remove exclusion InISO" -#pragma xta command "add exclusion InNonISO" - -#if 0 -#pragma xta command "analyse path XUD_IN_TxCrc_Tail0 XUD_TokenRx_Pid" -#pragma xta command "set required - 100 ns" - -#pragma xta command "analyse path XUD_IN_TxCrc_Tail1 XUD_TokenRx_Pid" -#pragma xta command "set required - 100 ns" - -#pragma xta command "analyse path XUD_IN_TxCrc_Tail2 XUD_TokenRx_Pid" -#pragma xta command "set required - 100 ns" - -#pragma xta command "analyse path XUD_IN_TxCrc_Tail3 XUD_TokenRx_Pid" -#pragma xta command "set required - 100 ns" - -#pragma xta command "analyse path XUD_IN_TxCrc_TailS0 XUD_TokenRx_Pid" -#pragma xta command "set required - 100 ns" - -#pragma xta command "analyse path XUD_IN_TxCrc_TailS1 XUD_TokenRx_Pid" -#pragma xta command "set required - 100 ns" - -#pragma xta command "analyse path XUD_IN_TxCrc_TailS2 XUD_TokenRx_Pid" -#pragma xta command "set required - 100 ns" - -#pragma xta command "analyse path XUD_IN_TxCrc_TailS3 XUD_TokenRx_Pid" -#pragma xta command "set required - 100 ns" -#endif - -/* RX TO RX */ -/* Rx SOF to Rx SOF - This is a non-interesting case since timing will be ~125uS */ - -//#pragma xta command "remove exclusion Pid_Sof" -//#pragma xta command "add exclusion Pid_Out" -//#pragma xta command "add exclusion Pid_In" -#if 0 -#pragma xta command "analyse path XUD_TokenRx_Ep XUD_TokenRx_Pid" -#pragma xta command "set required - 50 ns" -#endif - -/* Rx OUT Data end to Rx Token (ISO Out Data) */ -//#pragma xta command "add exclusion OutTail0" -//#pragma xta command "add exclusion OutTail1" -//#pragma xta command "add exclusion OutTail2" -//#pragma xta command "add exclusion OutTail3" -//#pragma xta command "add exclusion OutTail4" -//#pragma xta command "add exclusion OutTail5" -//#pragma xta command "add exclusion ReportBadCrc" -//#pragma xta command "add exclusion DoOutHandShakeOut" -#if 0 -#pragma xta command "analyse path XUD_OUT_RxTail XUD_TokenRx_Pid" -#pragma xta command "set required - 50 ns" -#endif - - -#endif -/* TX INTRA PACKET TIMING */ -#if 0 -#pragma xta command "analyse path XUD_IN_TxPid_Tail0 TxLoop0_Out" -#pragma xta command "set required - 83 ns" -#endif +#include "xta_pragmas.h" #define HS_TX_HANDSHAKE_TIMEOUT (167) #define FS_TX_HANDSHAKE_TIMEOUT (5000) @@ -396,12 +208,6 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c set_port_use_on(flag2_port); #endif -#if (XUD_OPT_SOFTCRC5) - - // TODO is this required - XUD_SetCrcTableAddr(XUD_STARTUP_ADDRESS); -#endif - #if defined(__XS3A__) #if (XUD_CORE_CLOCK > 500) #define RX_RISE_DELAY 2 From 7e1549c60d7fdb247f7a17f9de7cc9558c90ab91 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 29 Apr 2020 14:02:42 +0100 Subject: [PATCH 116/520] Added xta_pragmas.h --- lib_xud/src/core/xta_pragmas.h | 191 +++++++++++++++++++++++++++++++++ 1 file changed, 191 insertions(+) create mode 100644 lib_xud/src/core/xta_pragmas.h diff --git a/lib_xud/src/core/xta_pragmas.h b/lib_xud/src/core/xta_pragmas.h new file mode 100644 index 00000000..e99bacd1 --- /dev/null +++ b/lib_xud/src/core/xta_pragmas.h @@ -0,0 +1,191 @@ +#if 0 +#pragma xta command "config threads stdcore[0] 6" +#pragma xta command "add exclusion Pid_Out" +#pragma xta command "add exclusion Pid_Setup" +#pragma xta command "add exclusion Pid_Sof" +#pragma xta command "add exclusion Pid_Reserved" +#pragma xta command "add exclusion Pid_Ack" +#pragma xta command "add exclusion Pid_Data0" +#pragma xta command "add exclusion Pid_Ping" +#pragma xta command "add exclusion Pid_Nyet" +#pragma xta command "add exclusion Pid_Data2" +#pragma xta command "add exclusion Pid_Data1" +#pragma xta command "add exclusion Pid_Data0" +#pragma xta command "add exclusion Pid_Datam" +#pragma xta command "add exclusion Pid_Split" +#pragma xta command "add exclusion Pid_Stall" +#pragma xta command "add exclusion Pid_Pre" +#pragma xta command "add exclusion InvalidToken" +#pragma xta command "add exclusion InReady" + +#pragma xta command "analyse path XUD_TokenRx_Pid XUD_TokenRx_Ep" +#pragma xta command "set required - 33 ns" +#endif + + +/* Rx to TX 16 clks required with SMSC phy (14 in spec). SIE Decision Time */ +#if 0 +#pragma xta command "analyse path XUD_TokenRx_Ep XUD_IN_TxNak" +#pragma xta command "set required - 233 ns" +#pragma xta command "add exclusion InNotReady" +#pragma xta command "remove exclusion InReady" + + +#pragma xta command "add exclusion XUD_IN_TxPid_Tail1" +#pragma xta command "add exclusion XUD_IN_TxPid_Tail2" +#pragma xta command "add exclusion XUD_IN_TxPid_Tail3" +#pragma xta command "add exclusion XUD_IN_TxPid_TailS0" +#pragma xta command "add exclusion XUD_IN_TxPid_TailS1" +#pragma xta command "add exclusion XUD_IN_TxPid_TailS2" +#pragma xta command "add exclusion XUD_IN_TxPid_TailS3" +#endif +#if 0 +#pragma xta command "analyse path XUD_TokenRx_Ep XUD_IN_TxPid_Tail0" +#pragma xta command "set required - 266 ns" +#endif + +#if 0 +#pragma xta command "remove exclusion XUD_IN_TxPid_TailS0" +#pragma xta command "add exclusion XUD_IN_TxPid_Tail0" +#pragma xta command "analyse path XUD_TokenRx_Ep XUD_IN_TxPid_TailS0" +#pragma xta command "set required - 266 ns" + +#pragma xta command "remove exclusion XUD_IN_TxPid_Tail1" +#pragma xta command "add exclusion XUD_IN_TxPid_TailS0" +#if 0 +#pragma xta command "analyse path XUD_TokenRx_Ep XUD_IN_TxPid_Tail1" +#pragma xta command "set required - 266 ns" +#endif + +#pragma xta command "remove exclusion XUD_IN_TxPid_TailS1" +#pragma xta command "add exclusion XUD_IN_TxPid_Tail1" +#if 0 +#pragma xta command "analyse path XUD_TokenRx_Ep XUD_IN_TxPid_TailS1" +#pragma xta command "set required - 266 ns" +#endif + +//#pragma xta command "remove exclusion ShortPacket" +//pragma xta command "add exclusion NormalPacket" +//#pragma xta command "analyse path XUD_TokenRx_Ep XUD_IN_TxPid_Short" +//#pragma xta command "set required - 233 ns" + +/* TX TO RX */ +/* Tx IN NAK to Token Rx */ +#pragma xta command "remove exclusion InNotReady" +#pragma xta command "add exclusion InReady" +#if 0 +#pragma xta command "analyse path XUD_TokenRx_Pid XUD_IN_TxNak" +#pragma xta command "set required - 100 ns" +#endif + +/* Tx OUT NAK to Token RX */ +#if 0 +#pragma xta command "analyse path XUD_OUT_TxNak XUD_TokenRx_Pid" +#pragma xta command "set required - 100 ns" +#endif + +/* Tx OUT ACK to Token Tx */ +#if 0 +#pragma xta command "analyse path XUD_OUT_TxAck XUD_TokenRx_Pid" +#pragma xta command "set required - 100 ns" +#endif + +/* Tx IN Data (so crc) to Rx Ack (Non ISO IN) */ +#pragma xta command "add exclusion InNotReady" +#pragma xta command "remove exclusion InReady" +#if 0 +#pragma xta command "add exclusion InISO" +#pragma xta command "add exclusion TxHandshakeTimeOut" +#endif + +#pragma xta command "remove exclusion XUD_IN_TxPid_Tail0" +#pragma xta command "add exclusion XUD_IN_TxPid_TailS1" +#if 0 +#pragma xta command "analyse path XUD_IN_TxCrc_Tail0 XUD_IN_RxAck" +#pragma xta command "set required - 100 ns" +#endif + +#pragma xta command "add exclusion XUD_IN_TxPid_Tail0" +#pragma xta command "remove exclusion XUD_IN_TxPid_Tail1" +#if 0 +#pragma xta command "analyse path XUD_IN_TxCrc_Tail1 XUD_IN_RxAck" +#pragma xta command "set required - 100 ns" +#endif + +#pragma xta command "add exclusion XUD_IN_TxPid_Tail1" +#pragma xta command "remove exclusion XUD_IN_TxPid_TailS0" +#if 0 +#pragma xta command "analyse path XUD_IN_TxCrc_TailS0 XUD_IN_RxAck" +#pragma xta command "set required - 100 ns" +#endif + +#pragma xta command "add exclusion XUD_IN_TxPid_TailS0" +#pragma xta command "remove exclusion XUD_IN_TxPid_TailS1" +#if 0 +#pragma xta command "analyse path XUD_IN_TxCrc_TailS1 XUD_IN_RxAck" +#pragma xta command "set required - 100 ns" +#endif + +/* Tx IN Data (so crc) to Rx Token PID (ISO In) */ +#pragma xta command "remove exclusion InISO" +#pragma xta command "add exclusion InNonISO" + +#if 0 +#pragma xta command "analyse path XUD_IN_TxCrc_Tail0 XUD_TokenRx_Pid" +#pragma xta command "set required - 100 ns" + +#pragma xta command "analyse path XUD_IN_TxCrc_Tail1 XUD_TokenRx_Pid" +#pragma xta command "set required - 100 ns" + +#pragma xta command "analyse path XUD_IN_TxCrc_Tail2 XUD_TokenRx_Pid" +#pragma xta command "set required - 100 ns" + +#pragma xta command "analyse path XUD_IN_TxCrc_Tail3 XUD_TokenRx_Pid" +#pragma xta command "set required - 100 ns" + +#pragma xta command "analyse path XUD_IN_TxCrc_TailS0 XUD_TokenRx_Pid" +#pragma xta command "set required - 100 ns" + +#pragma xta command "analyse path XUD_IN_TxCrc_TailS1 XUD_TokenRx_Pid" +#pragma xta command "set required - 100 ns" + +#pragma xta command "analyse path XUD_IN_TxCrc_TailS2 XUD_TokenRx_Pid" +#pragma xta command "set required - 100 ns" + +#pragma xta command "analyse path XUD_IN_TxCrc_TailS3 XUD_TokenRx_Pid" +#pragma xta command "set required - 100 ns" +#endif + +/* RX TO RX */ +/* Rx SOF to Rx SOF - This is a non-interesting case since timing will be ~125uS */ + +//#pragma xta command "remove exclusion Pid_Sof" +//#pragma xta command "add exclusion Pid_Out" +//#pragma xta command "add exclusion Pid_In" +#if 0 +#pragma xta command "analyse path XUD_TokenRx_Ep XUD_TokenRx_Pid" +#pragma xta command "set required - 50 ns" +#endif + +/* Rx OUT Data end to Rx Token (ISO Out Data) */ +//#pragma xta command "add exclusion OutTail0" +//#pragma xta command "add exclusion OutTail1" +//#pragma xta command "add exclusion OutTail2" +//#pragma xta command "add exclusion OutTail3" +//#pragma xta command "add exclusion OutTail4" +//#pragma xta command "add exclusion OutTail5" +//#pragma xta command "add exclusion ReportBadCrc" +//#pragma xta command "add exclusion DoOutHandShakeOut" +#if 0 +#pragma xta command "analyse path XUD_OUT_RxTail XUD_TokenRx_Pid" +#pragma xta command "set required - 50 ns" +#endif + + +#endif +/* TX INTRA PACKET TIMING */ +#if 0 +#pragma xta command "analyse path XUD_IN_TxPid_Tail0 TxLoop0_Out" +#pragma xta command "set required - 83 ns" +#endif + From 214383203e4620da404f0f306a43586a61b8b397 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 29 Apr 2020 14:06:29 +0100 Subject: [PATCH 117/520] Removed XUD_PhyResetUser.xc --- lib_xud/src/core/XUD_PhyResetUser.xc | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 lib_xud/src/core/XUD_PhyResetUser.xc diff --git a/lib_xud/src/core/XUD_PhyResetUser.xc b/lib_xud/src/core/XUD_PhyResetUser.xc deleted file mode 100644 index 43799db3..00000000 --- a/lib_xud/src/core/XUD_PhyResetUser.xc +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) 2013-2018, XMOS Ltd, All rights reserved - -#include - -void XUD_PhyReset_User() -{ - return; -} - - - - From e2ed9d58fd16672e4a386242f0ee61d9c8a4ac8e Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 29 Apr 2020 14:06:50 +0100 Subject: [PATCH 118/520] Added XS3 warning about SE0 Test mode --- lib_xud/src/core/XUD_IoLoop.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib_xud/src/core/XUD_IoLoop.S b/lib_xud/src/core/XUD_IoLoop.S index 3ebde3e7..3af93a51 100755 --- a/lib_xud/src/core/XUD_IoLoop.S +++ b/lib_xud/src/core/XUD_IoLoop.S @@ -94,6 +94,7 @@ UsbTestModeHandler_asm: .text .cc_top XUD_UsbTestSE0.func, XUD_UsbTestSE0 XUD_UsbTestSE0: +#warning TODO UsbTestSE0 needs updating for XS3 ldw r0, dp[p_usb_rxd] // Load RXD port ldw r1, dp[flag0_port] // Valid token port ldw r2, dp[p_usb_txd] // Load TXD port @@ -153,7 +154,7 @@ ResetIntHandler: ldw r10, dp[SavedSp] // Restore stack pointer set sp, r10 - ldw r11, sp[STACK_RXE_PORT] // Put RxE back to events.. + ldw r11, sp[STACK_RXE_PORT] // Put RxE back to events.. setc res[r11], XS1_SETC_IE_MODE_EVENT // Set IE mode back to events ldc r0, 1 // Load non-zero (zero is kill) From 498e4a2bd42ebdbb6ebe083b9cb51540feb7c6f8 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 29 Apr 2020 14:07:04 +0100 Subject: [PATCH 119/520] Fixed trap with SOF channel used --- lib_xud/src/core/included/XUD_Token_SOF.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_xud/src/core/included/XUD_Token_SOF.S b/lib_xud/src/core/included/XUD_Token_SOF.S index 1eaafdcd..66bf41d8 100644 --- a/lib_xud/src/core/included/XUD_Token_SOF.S +++ b/lib_xud/src/core/included/XUD_Token_SOF.S @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved // Received SOF token: Reset suspend/reset detection timer .align 4 @@ -19,7 +19,7 @@ Pid_Sof: #endif clrsr 0x3 - ldw r11, sp[(STACK_EXTEND+9)] + ldw r11, sp[STACK_SOFCHAN] out res[r11], r10 From bfb30ec5b07ff9f40e7a309a7e865016208c1686 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 29 Apr 2020 17:04:03 +0100 Subject: [PATCH 120/520] - Added XUD_HAL_EnterMode_PeripheralTestJTestK() - Added test mode support to XS3 - Some test mode code tidy up - Moved SE0 test to own S file --- lib_xud/src/core/XUD_HAL.h | 1 + lib_xud/src/core/XUD_HAL.xc | 49 ++++++++++++++++++++-- lib_xud/src/core/XUD_IoLoop.S | 47 --------------------- lib_xud/src/core/XUD_Main.xc | 1 + lib_xud/src/core/XUD_TestMode.S | 71 ++++++++++++++++++++++++++++++++ lib_xud/src/core/XUD_TestMode.h | 4 +- lib_xud/src/core/XUD_TestMode.xc | 47 +++++---------------- 7 files changed, 130 insertions(+), 90 deletions(-) create mode 100644 lib_xud/src/core/XUD_TestMode.S diff --git a/lib_xud/src/core/XUD_HAL.h b/lib_xud/src/core/XUD_HAL.h index 278f421e..4dd401b4 100644 --- a/lib_xud/src/core/XUD_HAL.h +++ b/lib_xud/src/core/XUD_HAL.h @@ -20,6 +20,7 @@ typedef enum XUD_LineState_t void XUD_HAL_EnterMode_PeripheralChirp(); void XUD_HAL_EnterMode_PeripheralFullSpeed(); void XUD_HAL_EnterMode_PeripheralHighSpeed(); +void XUD_HAL_EnterMode_PeripheralTestJTestK(); /** * \brief Get current linestate status diff --git a/lib_xud/src/core/XUD_HAL.xc b/lib_xud/src/core/XUD_HAL.xc index c748e516..bebf65e0 100644 --- a/lib_xud/src/core/XUD_HAL.xc +++ b/lib_xud/src/core/XUD_HAL.xc @@ -3,18 +3,24 @@ #include #ifdef __XS2A__ +#include "xs2_su_registers.h" +#include "XUD_USBTile_Support.h" + extern in port flag0_port; extern in port flag1_port; extern in port flag2_port; -#else -void XUD_SetCrcTableAddr(unsigned addr); +extern unsigned get_tile_id(tileref ref); +extern tileref USB_TILE_REF; -#include +#else +#include extern in port flag0_port; /* For XS3: RXA or DP */ extern in port flag1_port; /* For XS3: RXE or DM */ +void XUD_SetCrcTableAddr(unsigned addr); + unsigned XtlSelFromMhz(unsigned m) { switch(m) @@ -106,11 +112,43 @@ void XUD_HAL_EnterMode_PeripheralHighSpeed() unsigned xtlselVal = XtlSelFromMhz(XUD_OSC_MHZ); d = XS1_USB_PHY_CFG0_XTLSEL_SET(d, xtlselVal); write_sswitch_reg(get_local_tile_id(), XS1_SSWITCH_USB_PHY_CFG0_NUM, d); - #endif } +void XUD_HAL_EnterMode_PeripheralTestJTestK() +{ +#ifndef XUD_SIM_XSIM +#ifdef __XS3A__ + + /* From ULPI Specification Revsion 1.1, table 41 + * XcvrSelect: 00b + * TermSelect: 0b + * OpMode: 10b + * DpPullDown 0b + * DmPullDown: 0b + */ + unsigned d = 0; + d = XS1_USB_PHY_CFG0_UTMI_XCVRSELECT_SET(d, 0); + d = XS1_USB_PHY_CFG0_UTMI_TERMSELECT_SET(d, 0); + d = XS1_USB_PHY_CFG0_UTMI_OPMODE_SET(d, 2); + d = XS1_USB_PHY_CFG0_DMPULLDOWN_SET(d, 0); + d = XS1_USB_PHY_CFG0_DPPULLDOWN_SET(d, 0); + + d = XS1_USB_PHY_CFG0_UTMI_SUSPENDM_SET(d, 1); + d = XS1_USB_PHY_CFG0_TXBITSTUFF_EN_SET(d, 1); + d = XS1_USB_PHY_CFG0_PLL_EN_SET(d, 1); + d = XS1_USB_PHY_CFG0_LPM_ALIVE_SET(d, 0); + d = XS1_USB_PHY_CFG0_IDPAD_EN_SET(d, 0); + unsigned xtlSelVal = XtlSelFromMhz(XUD_OSC_MHZ); + d = XS1_USB_PHY_CFG0_XTLSEL_SET(d, xtlSelVal); + + write_sswitch_reg(get_local_tile_id(), XS1_SSWITCH_USB_PHY_CFG0_NUM, d); +#else + write_periph_word(USB_TILE_REF, XS1_GLX_PER_UIFM_CHANEND_NUM, XS1_GLX_PER_UIFM_FUNC_CONTROL_NUM, 0b1000); +#endif +#endif +} void XUD_HAL_Mode_PowerSig() { @@ -231,3 +269,6 @@ void XUD_HAL_SetDeviceAddress(unsigned char address) XUD_SetCrcTableAddr(address); #endif } + + + diff --git a/lib_xud/src/core/XUD_IoLoop.S b/lib_xud/src/core/XUD_IoLoop.S index 3af93a51..579a71ee 100755 --- a/lib_xud/src/core/XUD_IoLoop.S +++ b/lib_xud/src/core/XUD_IoLoop.S @@ -87,53 +87,6 @@ UsbTestModeHandler_asm: .cc_bottom UsbTestModeHandler_asm.func #endif - -.globl XUD_UsbTestSE0.nstackwords -.linkset XUD_UsbTestSE0.nstackwords, 0 -.globl XUD_UsbTestSE0 -.text -.cc_top XUD_UsbTestSE0.func, XUD_UsbTestSE0 -XUD_UsbTestSE0: -#warning TODO UsbTestSE0 needs updating for XS3 - ldw r0, dp[p_usb_rxd] // Load RXD port - ldw r1, dp[flag0_port] // Valid token port - ldw r2, dp[p_usb_txd] // Load TXD port - ldw r3, dp[flag1_port] // Load RXA port - -XUD_UsbTestSE0_loop: - inpw r11, res[r0], 8 // Read 8 bit PID - shr r11, r11, 24 // shift off junk - - inpw r9, res[r0], 8 // Read EP Number (dont care) - - in r9, res[r1] - bt r9, InvalidTestToken // If VALID_TOKEN high, ignore token - - eq r10, r11, USB_PID_IN - bf r10, XUD_UsbTestSE0_loop - - nop - nop - nop - nop - nop - - ldc r11, USB_PIDn_NAK - outpw res[r2], r11, 8 - syncr res[r2] - bu XUD_UsbTestSE0_loop - -InvalidTestToken: - in r11, res[r3] - bt r11, InvalidTestToken - setc res[r0], XS1_SETC_RUN_CLRBUF // Clear RXD port - bu XUD_UsbTestSE0_loop - - -// End of code for Test_SE0_NAK -.cc_bottom XUD_UsbTestSE0.func - - ///////////////////////////////////////////////////////////////////////// // void ResetIntHandler() // Interupt handler for reset/suspend timer diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index eb90c904..cb23ca3b 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -198,6 +198,7 @@ static void SendSpeed(XUD_chan c[], XUD_EpType epTypeTableOut[], XUD_EpType epTy static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c_sof, XUD_EpType epTypeTableOut[], XUD_EpType epTypeTableIn[], int noEpOut, int noEpIn, XUD_PwrConfig pwrConfig) { int reset = 1; /* Flag for if device is returning from a reset */ + /* Make sure ports are on and reset port states */ set_port_use_on(p_usb_clk); set_port_use_on(p_usb_txd); diff --git a/lib_xud/src/core/XUD_TestMode.S b/lib_xud/src/core/XUD_TestMode.S new file mode 100644 index 00000000..06765c69 --- /dev/null +++ b/lib_xud/src/core/XUD_TestMode.S @@ -0,0 +1,71 @@ + +#include +#include "XUD_USB_Defines.h" + +.issue_mode dual + +.globl XUD_UsbTestSE0.nstackwords +.linkset XUD_UsbTestSE0.nstackwords, 0 +.globl XUD_UsbTestSE0 +.text +.cc_top XUD_UsbTestSE0.func, XUD_UsbTestSE0 +XUD_UsbTestSE0: + DUALENTSP_lu6 0 // Note, don't really need DI here.. + // TODO ideally don't load these from dp.. + ldw r0, dp[p_usb_rxd] // Load RXD port + ldw r2, dp[p_usb_txd] // Load TXD port + ldw r3, dp[flag1_port] // Load RXA port + +XUD_UsbTestSE0_loop: +#ifdef __XS2A__ + ldw r1, dp[flag2_port] // Valid token port + + inpw r11, res[r0], 8 // Read 8 bit PID + shr r11, r11, 24 // shift off junk + + inpw r9, res[r0], 8 // Read EP Number (dont care) + + in r9, res[r1] + bt r9, InvalidTestToken // If VALID_TOKEN high, ignore token + + eq r10, r11, USB_PID_IN + bf r10, XUD_UsbTestSE0_loop +#else + ldc r8, 16 + inpw r11, res[r0], 8 // Read 3 byte token from data port | CRC[5] | EP[4] | ADDR[7] | PID[8] | junk + {setpsc res[r0], r8; shr r11, r11, 24} + // TODO ideally share this with XUD_CrcAddrCheck rather than a duplication here.. + {in r10, res[r0]; sub r1, r8, 5} // ldc r1, 11 + {shr r10, r10, 16; mkmsk r11, r1} + {and r11, r10, r11; shr r4, r10, r1} // r4: Received CRC + + ldaw r8, dp[crc5Table_Addr] + ld8u r8, r8[r11] // Correct CRC + + xor r4, r4, r8 // Check received CRC against expected CRC + bt r4, InvalidTestToken; // Note, EP number is ignored + + ldc r4, USB_PIDn_IN + eq r11, r11, r4 // Check received PID + bf r11, XUD_UsbTestSE0_loop +#endif + + nop // If all is well respond with a NAK to any IN token.. + nop + nop + nop + nop + + ldc r11, USB_PIDn_NAK + outpw res[r2], r11, 8 + syncr res[r2] + bu XUD_UsbTestSE0_loop + +InvalidTestToken: + in r11, res[r3] + bt r11, InvalidTestToken + setc res[r0], XS1_SETC_RUN_CLRBUF // Clear RXD port + bu XUD_UsbTestSE0_loop + + +.cc_bottom XUD_UsbTestSE0.func diff --git a/lib_xud/src/core/XUD_TestMode.h b/lib_xud/src/core/XUD_TestMode.h index 7b66bcbc..e47539b5 100644 --- a/lib_xud/src/core/XUD_TestMode.h +++ b/lib_xud/src/core/XUD_TestMode.h @@ -3,11 +3,9 @@ #define __XUD_TESTMODE_H__ #include -#include -#include "XUD_UIFM_Functions.h" +#include "XUD_HAL.h" #include "XUD_USB_Defines.h" -#include "XUD_Support.h" unsigned UsbTestModeHandler_asm(); unsigned XUD_UsbTestSE0(); diff --git a/lib_xud/src/core/XUD_TestMode.xc b/lib_xud/src/core/XUD_TestMode.xc index 491aaa81..4266c4a6 100644 --- a/lib_xud/src/core/XUD_TestMode.xc +++ b/lib_xud/src/core/XUD_TestMode.xc @@ -1,34 +1,17 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved #include -#include -#include "XUD_UIFM_Functions.h" -#include "XUD_USB_Defines.h" -#include "XUD_Support.h" -#include "XUD_TestMode.h" #include "xud.h" +#include "XUD_TestMode.h" -#if defined(__XS2A__) -#include "xs2_su_registers.h" -#include "XUD_USBTile_Support.h" -extern unsigned get_tile_id(tileref ref); -extern tileref USB_TILE_REF; -#endif - -extern in port flag0_port; -extern in port flag1_port; -#if !defined(__XS3A__) -extern in port flag2_port; -#endif extern out buffered port:32 p_usb_txd; -#define TEST_PACKET_LEN 14 #define T_INTER_TEST_PACKET_us 2 #define T_INTER_TEST_PACKET (T_INTER_TEST_PACKET_us * REF_CLK_FREQ) #ifndef XUD_TEST_MODE_SUPPORT_DISABLED -unsigned int test_packet[TEST_PACKET_LEN] = +unsigned int test_packet[] = { 0x000000c3, 0x00000000, @@ -58,13 +41,13 @@ int XUD_TestMode_TestPacket () while (1) { #pragma loop unroll - for (i=0; i < TEST_PACKET_LEN; i++ ) + for (i=0; i < sizeof(test_packet)/sizeof(test_packet[0]); i++) { p_usb_txd <: test_packet[i]; }; sync(p_usb_txd); test_packet_timer :> i; - test_packet_timer when timerafter (i + T_INTER_TEST_PACKET) :> int _; + test_packet_timer when timerafter (i + T_INTER_TEST_PACKET) :> int _; } return 0; } @@ -77,13 +60,9 @@ int XUD_UsbTestModeHandler() switch(cmd) { case USB_WINDEX_TEST_J: - //Function Control Reg. Suspend: 1 Opmode 10 - -#if defined(__XS3A__) - #warning Test modes not implemented for XS3A -#elif defined(__XS2A__) - write_periph_word(USB_TILE_REF, XS1_GLX_PER_UIFM_CHANEND_NUM, XS1_GLX_PER_UIFM_FUNC_CONTROL_NUM, 0b1000); -#endif + + XUD_HAL_EnterMode_PeripheralTestJTestK(); + while(1) { p_usb_txd <: 0xffffffff; @@ -91,13 +70,9 @@ int XUD_UsbTestModeHandler() break; case USB_WINDEX_TEST_K: - //Function Control Reg. Suspend: 1 Opmode 10 -#if defined(__XS3A__) - // TODO -#elif defined(__XS2A__) - write_periph_word(USB_TILE_REF, XS1_GLX_PER_UIFM_CHANEND_NUM, XS1_GLX_PER_UIFM_FUNC_CONTROL_NUM, 0b1000); -#endif - + + XUD_HAL_EnterMode_PeripheralTestJTestK(); + while(1) { p_usb_txd <: 0; From ccbe218526b7347be0709f3a9a44e84be245d2fb Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 29 Apr 2020 17:07:39 +0100 Subject: [PATCH 121/520] Test mode code tidy --- lib_xud/src/core/XUD_TestMode.S | 3 ++ lib_xud/src/core/XUD_TestMode.xc | 47 ++++++++++++++------------------ 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/lib_xud/src/core/XUD_TestMode.S b/lib_xud/src/core/XUD_TestMode.S index 06765c69..70feda7e 100644 --- a/lib_xud/src/core/XUD_TestMode.S +++ b/lib_xud/src/core/XUD_TestMode.S @@ -9,6 +9,9 @@ .globl XUD_UsbTestSE0 .text .cc_top XUD_UsbTestSE0.func, XUD_UsbTestSE0 + +// NAK every IN token if the CRC is correct. + XUD_UsbTestSE0: DUALENTSP_lu6 0 // Note, don't really need DI here.. // TODO ideally don't load these from dp.. diff --git a/lib_xud/src/core/XUD_TestMode.xc b/lib_xud/src/core/XUD_TestMode.xc index 4266c4a6..d58c47a8 100644 --- a/lib_xud/src/core/XUD_TestMode.xc +++ b/lib_xud/src/core/XUD_TestMode.xc @@ -29,29 +29,6 @@ unsigned int test_packet[] = 0xceb67efd }; -int XUD_TestMode_TestPacket () -{ - // Repetitively transmit specific test packet forever. - // Timings must still meet minimum interpacket gap - // Have to relate KJ pairings to data. - unsigned i; - timer test_packet_timer; - -#pragma unsafe arrays - while (1) - { -#pragma loop unroll - for (i=0; i < sizeof(test_packet)/sizeof(test_packet[0]); i++) - { - p_usb_txd <: test_packet[i]; - }; - sync(p_usb_txd); - test_packet_timer :> i; - test_packet_timer when timerafter (i + T_INTER_TEST_PACKET) :> int _; - } - return 0; -} - // Runs in XUD thread with interrupt on entering testmode. int XUD_UsbTestModeHandler() { @@ -80,13 +57,31 @@ int XUD_UsbTestModeHandler() break; case USB_WINDEX_TEST_SE0_NAK: - // NAK every IN packet if the CRC is correct. - // Drop into asm to deal with. + /* Drop into asm to deal with this mode */ XUD_UsbTestSE0(); break; case USB_WINDEX_TEST_PACKET: - XUD_TestMode_TestPacket(); + { + // Repetitively transmit specific test packet forever. + // Timings must still meet minimum interpacket gap + // Have to relate KJ pairings to data. + unsigned i; + timer test_packet_timer; + +#pragma unsafe arrays + while (1) + { +#pragma loop unroll + for (i=0; i < sizeof(test_packet)/sizeof(test_packet[0]); i++) + { + p_usb_txd <: test_packet[i]; + }; + sync(p_usb_txd); + test_packet_timer :> i; + test_packet_timer when timerafter (i + T_INTER_TEST_PACKET) :> int _; + } + } break; default: From 1f93023bd92bab9e390f6bcfc62bb1133e4de679 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 29 Apr 2020 17:22:12 +0100 Subject: [PATCH 122/520] Tidy up of token checking code. Also added 1 instruction optimisation for XS3. --- lib_xud/src/core/XUD_CrcAddrCheck.S | 51 +++++++++-------------------- 1 file changed, 16 insertions(+), 35 deletions(-) diff --git a/lib_xud/src/core/XUD_CrcAddrCheck.S b/lib_xud/src/core/XUD_CrcAddrCheck.S index 4d56521e..ca35bf14 100644 --- a/lib_xud/src/core/XUD_CrcAddrCheck.S +++ b/lib_xud/src/core/XUD_CrcAddrCheck.S @@ -1,30 +1,16 @@ // Copyright (c) 2011-2018, XMOS Ltd, All rights reserved -// On Entry: -#ifdef __XS3A__ - -#if 0 -//CrcAddrCheck: // Extract 11 bits for CRC5: | EP(4) | ADDR(7) | - ldw r1, dp[crcmask] - in r10, res[RXD] - shr r10, r10, 16 - and r11, r10, r1 - - ldaw r8, dp[crc5Table_Addr] - ld8u r8, r8[r11] // Correct CRC - shr r4, r10, 5 - shr r4, r4, 6 // Received CRC - - xor r4, r4, r8 // R4 set to 0 in L code with in from valid tok port - bt r4, BadCrcAddr +// On Entry: +// r0: rxd port +// r8: 16 (XS3 only) -//ExtractEP: - shr r10, r11, 7 +// Required on exit: +// r4: 0 +// r10: Extracted EP number -#elif 1 -//CrcAddrCheck: // Extract 11 bits for CRC5: | EP(4) | ADDR(7) | - ldc r1, 11 - in r10, res[RXD] +#ifdef __XS3A__ +#if 1 + {in r10, res[RXD]; sub r1, r8, 5} // ldc r1 11 {shr r10, r10, 16; mkmsk r11, r1} {and r11, r10, r11; shr r4, r10, r1} // r4: Received CRC @@ -32,21 +18,18 @@ ld8u r8, r8[r11] // Correct CRC xor r4, r4, r8 // R4 set to 0 in L code with in from valid tok port - {BRFF_ru6 r4, 5; shr r10, r11, 7} // Extract EP number + {BRFF_ru6 r4, 5; shr r10, r11, 7} // Extract EP number -//waitforRXALow0: - ldw r11, sp[STACK_RXA_PORT] + ldw r11, sp[STACK_RXA_PORT] // Wait for RXA to gow low (i.e. end of packet) in r10, res[r11] bt r10, waitforRXALow0 setc res[RXD], XS1_SETC_RUN_CLRBUF bu Loop_BadPid - - #else in r10, res[RXD] ldaw r1, dp[crc5Table_Addr] ldc r8, 30 - lmul r11, r10, r10, r8, r10, r10 // r11 is CRC5, r10 is EP(4):ADDR(7):CRAP(16):0(5) + lmul r11, r10, r10, r8, r10, r10 // r11 is CRC5, r10 is EP(4):ADDR(7):CRAP(16):0(5) shr r10, r10, 16 // r10 is 0(16):EP(4):ADDR(7):CRAP(5) shr r10, r10, 5 // r10 is 0(21):EP(4):ADDR(7) ld8u r8, r1[r10] // r8 is CRC of r10 @@ -56,15 +39,13 @@ shr r10, r10, 7 #endif - -#else // XS2 +#else + // __XS2A__ inpw r10, res[RXD], 8; // Read EP Number shr r10, r10, 24; // Shift off junk in r4, res[r1]; - bt r4, XUD_InvalidToken; // If VALID_TOKEN not high, ignore token - PORT INVERTED! */ + bt r4, XUD_InvalidToken; // If VALID_TOKEN not high, ignore token - PORT INVERTED! */ #endif -// Required on exit: -// r4: 0 -// r10: Extracted EP number + From fcef462b9a56186844350e4a76b5c6838c2c24b7 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 29 Apr 2020 17:24:38 +0100 Subject: [PATCH 123/520] Tidy of alternative XS3 token checking (unused) --- lib_xud/src/core/XUD_CrcAddrCheck.S | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/lib_xud/src/core/XUD_CrcAddrCheck.S b/lib_xud/src/core/XUD_CrcAddrCheck.S index ca35bf14..2c2f24fd 100644 --- a/lib_xud/src/core/XUD_CrcAddrCheck.S +++ b/lib_xud/src/core/XUD_CrcAddrCheck.S @@ -29,14 +29,18 @@ in r10, res[RXD] ldaw r1, dp[crc5Table_Addr] ldc r8, 30 - lmul r11, r10, r10, r8, r10, r10 // r11 is CRC5, r10 is EP(4):ADDR(7):CRAP(16):0(5) - shr r10, r10, 16 // r10 is 0(16):EP(4):ADDR(7):CRAP(5) - shr r10, r10, 5 // r10 is 0(21):EP(4):ADDR(7) - ld8u r8, r1[r10] // r8 is CRC of r10 - sub r4, r11, r8 // R4 set to 0 in L code with in from valid tok port - //bt r4, BadCrcAddr -//ExtractEP: - shr r10, r10, 7 + lmul r11, r10, r10, r8, r10, r10 // r11 is CRC5, r10 is EP(4):ADDR(7):CRAP(16):0(5) + shr r10, r10, 16 // r10 is 0(16):EP(4):ADDR(7):CRAP(5) + shr r10, r10, 5 // r10 is 0(21):EP(4):ADDR(7) + ld8u r8, r1[r10] // r8 is CRC of r10 + sub r4, r11, r8 // R4 set to 0 in L code with in from valid tok port + {BRFF_ru6 r4, 5; shr r10, r10, 7} // Extract EP number + + ldw r11, sp[STACK_RXA_PORT] // Wait for RXA to gow low (i.e. end of packet) + in r10, res[r11] + bt r10, waitforRXALow0 + setc res[RXD], XS1_SETC_RUN_CLRBUF + bu Loop_BadPid #endif #else From 02c3bc531a45b1ffe016f489f2bf9e1e08847170 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 30 Apr 2020 15:35:50 +0100 Subject: [PATCH 124/520] - Tidy of line state/suspend code - Fix to XS3 suspend reliability --- lib_xud/src/core/XUD_HAL.h | 8 ++++---- lib_xud/src/core/XUD_HAL.xc | 35 ++++++++------------------------ lib_xud/src/core/XUD_PowerSig.xc | 20 +++++++++--------- 3 files changed, 23 insertions(+), 40 deletions(-) diff --git a/lib_xud/src/core/XUD_HAL.h b/lib_xud/src/core/XUD_HAL.h index 4dd401b4..850b35d7 100644 --- a/lib_xud/src/core/XUD_HAL.h +++ b/lib_xud/src/core/XUD_HAL.h @@ -10,10 +10,10 @@ */ typedef enum XUD_LineState_t { - XUD_LINESTATE_SE0, /**< SE0 State */ - XUD_LINESTATE_J, /**< J State */ - XUD_LINESTATE_K, /**< K State */ - XUD_LINESTATE_INVALID /**< Invalid bus state both lines high **/ + XUD_LINESTATE_SE0 = 0, /**< SE0 State */ + XUD_LINESTATE_J = 1, /**< J State */ + XUD_LINESTATE_K = 2, /**< K State */ + XUD_LINESTATE_SE1 = 3 /**< Invalid bus state both lines high **/ } XUD_LineState_t; diff --git a/lib_xud/src/core/XUD_HAL.xc b/lib_xud/src/core/XUD_HAL.xc index bebf65e0..1cacfc8c 100644 --- a/lib_xud/src/core/XUD_HAL.xc +++ b/lib_xud/src/core/XUD_HAL.xc @@ -170,45 +170,28 @@ void XUD_HAL_Mode_DataTransfer() #endif +/* In full-speed and low-speed mode, LineState(0) always reflects DP and LineState(1) reflects DM */ +/* Note, this port ordering is the opposide of what might be expected - but linestate is swapped in the USB shim */ +#define dp_port flag1_port // DP: LINESTATE[0] +#define dm_port flag0_port // DM: LINESTATE[1] + {unsigned, unsigned} LineStateToLines(XUD_LineState_t ls) { - switch(ls) - { - case XUD_LINESTATE_J: - return {1,0}; - case XUD_LINESTATE_K: - return {0, 1}; - case XUD_LINESTATE_SE0: - return {0, 0}; - case XUD_LINESTATE_INVALID: - return {1,1}; - } + return {ls & 1, (ls >> 1) & 1}; } static inline XUD_LineState_t LinesToLineState(unsigned dp, unsigned dm) { - if(dp && !dm) - return XUD_LINESTATE_J; - else if(dm && !dp) - return XUD_LINESTATE_K; - else if(!dm && !dp) - return XUD_LINESTATE_SE0; - else - return XUD_LINESTATE_INVALID; + return (XUD_LineState_t) (dp & 1) | ((dm & 1)<< 1); } -#define dp_port flag0_port -#define dm_port flag1_port - /* TODO pass structure */ XUD_LineState_t XUD_HAL_GetLineState(/*XUD_HAL_t &xudHal*/) { #ifdef __XS3A__ - // xudHal.p_usb_fl0 :> dp; - // xudHal.p_usb_fl1 :> dm; unsigned dp, dm; - flag0_port :> dp; - flag1_port :> dm; + dp_port :> dp; + dm_port :> dm; return LinesToLineState(dp, dm); #else unsigned j, k, se0; diff --git a/lib_xud/src/core/XUD_PowerSig.xc b/lib_xud/src/core/XUD_PowerSig.xc index cdcc713c..879b5ab9 100755 --- a/lib_xud/src/core/XUD_PowerSig.xc +++ b/lib_xud/src/core/XUD_PowerSig.xc @@ -249,11 +249,6 @@ int XUD_Suspend(XUD_PwrConfig pwrConfig) switch(currentLs) { - case XUD_LINESTATE_J: - /* Do nothing */ - break; - - /* Reset signalliung */ case XUD_LINESTATE_SE0: @@ -281,11 +276,6 @@ int XUD_Suspend(XUD_PwrConfig pwrConfig) switch(currentLs) { - /* J, unexpected, return to suspend.. */ - case XUD_LINESTATE_J: - - break; - /* SE0, end of resume */ case XUD_LINESTATE_SE0: if (g_curSpeed == XUD_SPEED_HS) @@ -297,8 +287,18 @@ int XUD_Suspend(XUD_PwrConfig pwrConfig) return 0; } break; + + /* J, unexpected, return to suspend.. */ + case XUD_LINESTATE_J: + default: + break; } break; + + case XUD_LINESTATE_J: + default: + /* Do nothing */ + break; } } } From 3c4e622918c3aa2bc9317b0e819f8b2bee2cef6b Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 30 Apr 2020 17:30:45 +0100 Subject: [PATCH 125/520] - More tidy/removal of old code/headers - Fix to XS3 HS handshake - Moved more items to HAL - Fixed X200 build --- lib_xud/src/core/XUD_DeviceAttach.xc | 168 +++++++++------------- lib_xud/src/core/XUD_HAL.h | 17 +++ lib_xud/src/core/XUD_HAL.xc | 120 +++++++++++++--- lib_xud/src/core/XUD_Main.xc | 85 +---------- lib_xud/src/core/XUD_PowerSig.xc | 14 -- lib_xud/src/core/XUD_UIFM_Functions.h | 42 ------ lib_xud/src/user/XUD_USB_Defines.h | 2 - lib_xud/src/user/client/XUD_SetDevAddr.xc | 34 +---- 8 files changed, 198 insertions(+), 284 deletions(-) delete mode 100755 lib_xud/src/core/XUD_UIFM_Functions.h diff --git a/lib_xud/src/core/XUD_DeviceAttach.xc b/lib_xud/src/core/XUD_DeviceAttach.xc index 483e83bb..c7f1b74d 100755 --- a/lib_xud/src/core/XUD_DeviceAttach.xc +++ b/lib_xud/src/core/XUD_DeviceAttach.xc @@ -10,17 +10,6 @@ #include "XUD_HAL.h" -#ifdef __XS2A__ -#include "xs1_to_glx.h" -#include "xs2_su_registers.h" -#endif - -#ifdef __XS2A__ -#include "XUD_USBTile_Support.h" -extern unsigned get_tile_id(tileref ref); -extern tileref USB_TILE_REF; -#endif - extern in port flag0_port; extern in port flag1_port; extern in port flag2_port; @@ -45,30 +34,14 @@ int XUD_DeviceAttachHS(XUD_PwrConfig pwrConfig) int start_time; int detecting_k = 1; int tx; - int chirpCount; - - chirpCount = 0; + unsigned int chirpCount = 0; clearbuf(p_usb_txd); - // On detecting the SE0: - // De-assert XCVRSelect and set opmode=2 - // DEBUG - write to ulpi reg 0x54. This is: - // opmode = 0b10, termsel = 1, xcvrsel = 0b00; -#if defined(__XS3A__) + /* On detecting the SE0 move into chirp mode */ XUD_HAL_EnterMode_PeripheralChirp(); -#elif defined(__XS2A__) - write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_FUNC_CONTROL_NUM, 0b1010); -#endif - - //t :> start_time; - //t when timerafter(start_time+50):> void; - /* Added a bit of a delay before chirp to match an example HS device */ - //t :> start_time; - //t when timerafter(start_time+10000):> void; - - // output k-chirp for required time + /* output k-chirp for required time */ #if defined(XUD_SIM_RTL) || (XUD_SIM_XSIM) for (int i = 0; i < 800; i++) #else @@ -82,7 +55,7 @@ int XUD_DeviceAttachHS(XUD_PwrConfig pwrConfig) // XS3 has raw linestate on flag port 0 and 1 // Wait for fs chirp k (i.e. HS chirp j) #if defined(__XS2A__) - flag1_port when pinseq(0) :> tmp; // Wait for out k to go + flag1_port when pinseq(0) :> tmp; // Wait for out k to go #endif t :> start_time; @@ -92,93 +65,88 @@ int XUD_DeviceAttachHS(XUD_PwrConfig pwrConfig) { case t when timerafter(start_time + INVALID_DELAY) :> void: - /* Go into full speed mode: XcvrSelect and Term Select (and suspend) high */ -#if defined(__XS3A__) - - XUD_HAL_EnterMode_PeripheralFullSpeed(); -#elif defined(__XS2A__) - write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, - XS1_SU_PER_UIFM_FUNC_CONTROL_NUM, - (1< dm; flag1_port :> dp; if(dp || dm) + { + /* SE0 gone, return 0 to indicate FULL SPEED */ return 0; - } + } #else - flag2_port :> tmp; + flag2_port :> tmp; - if(!tmp) - { - return 0; /* SE0 gone, return 0 to indicate FULL SPEED */ - } + if(!tmp) + { + /* SE0 gone, return 0 to indicate FULL SPEED */ + return 0; + } #endif - - if(pwrConfig == XUD_PWR_SELF) { - unsigned x; -#if defined(__XS2A__) - read_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, - XS1_SU_PER_UIFM_OTG_FLAGS_NUM, x); - if(!(x&(1< flag1_port when pinseq(1):> void @ tx: // K Chirp - flag1_port @ tx + T_FILT :> tmp; - if (tmp) { - detecting_k = 0; - } - break; - - case !detecting_k => flag0_port when pinseq(1) :> void @ tx: // J Chirp - flag0_port @ tx + T_FILT :> tmp; - if (tmp == 0) { // inverted! - chirpCount ++; // Seen an extra K-J pair - detecting_k = 1; - if (chirpCount == 3) { // On 3 we have seen a HS - - // Three pairs of KJ received... de-assert TermSelect... - // (and opmode = 0, suspendm = 1) + if(pwrConfig == XUD_PWR_SELF) + { + unsigned x; #ifdef __XS3A__ - XUD_HAL_EnterMode_PeripheralHighSpeed(); -#elif defined(__XS2A__) - write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, - XS1_SU_PER_UIFM_FUNC_CONTROL_NUM, 0b0000); + #warning VBUS checking in failed HS handhake missing from XS3A +#else + read_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_OTG_FLAGS_NUM, x); + + if(!(x&(1< flag1_port when pinseq(1):> void @ tx: // K Chirp + flag1_port @ tx + T_FILT :> tmp; + if (tmp) + { + detecting_k = 0; + } + break; + + case !detecting_k => flag0_port when pinseq(1) :> void @ tx: // J Chirp + flag0_port @ tx + T_FILT :> tmp; + if (tmp == 1) + { + chirpCount++; // Seen an extra K-J pair + detecting_k = 1; + + if (chirpCount == 3) + { + /* Three pairs of KJ received. Enter high-speed mode */ + XUD_HAL_EnterMode_PeripheralHighSpeed(); + + // Wait for SE0 (TODO consume other chirps?) +#ifdef __XS3A__ + // TODO ideally dont use a polling loop here + while (XUD_HAL_GetLineState() != XUD_LINESTATE_SE0); #else - //wait for SE0 (TODO consume other chirps?) - flag2_port when pinseq(1) :> tmp; + flag2_port when pinseq(1) :> tmp; #endif - - return 1; // Return 1 for HS + + /* Return 1 to indicate successful HS handshake*/ + return 1; - } - } - break; - } - } + } + } + break; + } + } } #endif diff --git a/lib_xud/src/core/XUD_HAL.h b/lib_xud/src/core/XUD_HAL.h index 850b35d7..eeb98660 100644 --- a/lib_xud/src/core/XUD_HAL.h +++ b/lib_xud/src/core/XUD_HAL.h @@ -4,6 +4,17 @@ * \brief USB HAL Layer **/ +#ifdef __XS3A__ +#include +// TODO shoudl be properlty in HAL +unsigned XtlSelFromMhz(unsigned m); +#else +#include "XUD_USBTile_Support.h" +#include "xs1_to_glx.h" +#include "xs2_su_registers.h" +#define USB_TILE_REF usb_tile +#endif + /** * \enum XUD_LineState_t * \brief USB Line States @@ -57,3 +68,9 @@ void XUD_HAL_Mode_DataTransfer(); * \return void **/ void XUD_HAL_SetDeviceAddress(unsigned char address); + +/** + * \brief Enable USB funtionality in the device + **/ +void XUD_HAL_EnableUsb(unsigned pwrConfig); + diff --git a/lib_xud/src/core/XUD_HAL.xc b/lib_xud/src/core/XUD_HAL.xc index 1cacfc8c..e58e1259 100644 --- a/lib_xud/src/core/XUD_HAL.xc +++ b/lib_xud/src/core/XUD_HAL.xc @@ -1,26 +1,22 @@ -#include "XUD_HAL.h" #include +#include "xud.h" + +#include "XUD_HAL.h" #ifdef __XS2A__ +#include "xs1_to_glx.h" #include "xs2_su_registers.h" #include "XUD_USBTile_Support.h" - extern in port flag0_port; extern in port flag1_port; extern in port flag2_port; - -extern unsigned get_tile_id(tileref ref); -extern tileref USB_TILE_REF; - +extern buffered in port:32 p_usb_clk; #else - -#include extern in port flag0_port; /* For XS3: RXA or DP */ extern in port flag1_port; /* For XS3: RXE or DM */ - +extern buffered in port:32 p_usb_clk; void XUD_SetCrcTableAddr(unsigned addr); - unsigned XtlSelFromMhz(unsigned m) { switch(m) @@ -47,10 +43,87 @@ unsigned XtlSelFromMhz(unsigned m) break; } } +#endif + +unsigned int XUD_EnableUsbPortMux(); + +void XUD_HAL_EnableUsb(unsigned pwrConfig) +{ +#ifndef XUD_SIM_XSIM + /* For xCORE-200 enable USB port muxing before enabling phy etc */ + // TODO inline ASM here + XUD_EnableUsbPortMux(); //setps(XS1_PS_XCORE_CTRL0, UIFM_MODE); + +#ifdef __XS2A__ + /* Enable the USB clock */ + write_sswitch_reg(get_tile_id(USB_TILE_REF), XS1_SU_CFG_RST_MISC_NUM, ( 1 << XS1_SU_CFG_USB_CLK_EN_SHIFT)); + + /* Now reset the phy */ + write_periph_word(USB_TILE_REF, XS1_GLX_PER_UIFM_CHANEND_NUM, XS1_GLX_PER_UIFM_PHY_CONTROL_NUM, 0); //(0< int _; + p_usb_clk when pinseq(0) :> int _; + p_usb_clk when pinseq(1) :> int _; + p_usb_clk when pinseq(0) :> int _; + +#ifdef __XS2A__ + /* Some extra settings are required for proper operation on XS2A */ + #define XS1_UIFM_USB_PHY_EXT_CTRL_REG 0x50 + #define XS1_UIFM_USB_PHY_EXT_CTRL_VBUSVLDEXT_MASK 0x4 + + /* Remove requirement for VBUS in bus-powered mode */ + if(pwrConfig == XUD_PWR_BUS) + { + write_periph_word(USB_TILE_REF, XS1_GLX_PER_UIFM_CHANEND_NUM, XS1_UIFM_USB_PHY_EXT_CTRL_REG, XS1_UIFM_USB_PHY_EXT_CTRL_VBUSVLDEXTSEL_MASK | XS1_UIFM_USB_PHY_EXT_CTRL_VBUSVLDEXT_MASK); + } + + #define PHYTUNEREGVAL 0x0093B264 + #define XS1_UIFM_USB_PHY_TUNE_REG 0x4c + /* Phy Tuning parameters */ + /* OTG TUNE: 3b'100 + * TXFSLSTUNE: 4b'1001 + * TXVREFTUNE:4b'1001 -- +1.25% adjustment in HS DC voltage level + * BIASTUNE: 1b'0 + * COMDISTUNE:3b'011 -- -1.5% adjustment from default (disconnect threshold adjustment) + * SQRXTUNE:3b'010 -- +5% adjustment from default (Squelch Threshold) + * TXRISETUNE: 1b'0 + * TXPREEMPHASISTUNE:1b'1 -- enabled (default is disabled) + * TXHSXVTUNE: 2b'11 + */ + write_periph_word(USB_TILE_REF, XS1_GLX_PER_UIFM_CHANEND_NUM, XS1_UIFM_USB_PHY_TUNE_REG, PHYTUNEREGVAL); + + write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_CONTROL_NUM, (1< int _; - p_usb_clk when pinseq(0) :> int _; - p_usb_clk when pinseq(1) :> int _; - p_usb_clk when pinseq(0) :> int _; + /* Enable USB funcitonality in the device */ + XUD_HAL_EnableUsb(pwrConfig); -#if defined(__XS2A__) -#define XS1_UIFM_USB_PHY_EXT_CTRL_REG 0x50 -#define XS1_UIFM_USB_PHY_EXT_CTRL_VBUSVLDEXT_MASK 0x4 - /* Remove requirement for VBUS in bus-powered mode */ - if(pwrConfig == XUD_PWR_BUS) - { - write_periph_word(USB_TILE_REF, XS1_GLX_PER_UIFM_CHANEND_NUM, XS1_UIFM_USB_PHY_EXT_CTRL_REG, XS1_UIFM_USB_PHY_EXT_CTRL_VBUSVLDEXTSEL_MASK | XS1_UIFM_USB_PHY_EXT_CTRL_VBUSVLDEXT_MASK); - } - -#define PHYTUNEREGVAL 0x0093B264 -#define XS1_UIFM_USB_PHY_TUNE_REG 0x4c - /* Phy Tuning parameters */ - /* OTG TUNE: 3b'100 - * TXFSLSTUNE: 4b'1001 - * TXVREFTUNE:4b'1001 -- +1.25% adjustment in HS DC voltage level - * BIASTUNE: 1b'0 - * COMDISTUNE:3b'011 -- -1.5% adjustment from default (disconnect threshold adjustment) - * SQRXTUNE:3b'010 -- +5% adjustment from default (Squelch Threshold) - * TXRISETUNE: 1b'0 - * TXPREEMPHASISTUNE:1b'1 -- enabled (default is disabled) - * TXHSXVTUNE: 2b'11 - */ - write_periph_word(USB_TILE_REF, XS1_GLX_PER_UIFM_CHANEND_NUM, XS1_UIFM_USB_PHY_TUNE_REG, PHYTUNEREGVAL); -#endif - -#if !defined(XUD_SIM_XSIM) - #ifdef __XS2A__ - write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_CONTROL_NUM, (1< -#include #include "xud.h" #include "XUD_Support.h" -#include "XUD_UIFM_Functions.h" #include "XUD_USB_Defines.h" #include "XUD_HAL.h" - -#ifdef __XS2A__ -#include "xs1_to_glx.h" -#include "xs2_su_registers.h" -#include "XUD_USBTile_Support.h" -extern unsigned get_tile_id(tileref ref); -extern tileref USB_TILE_REF; -#endif - - -void XUD_UIFM_PwrSigFlags(); - #define T_WTRSTFS_us 26 // 26us #ifndef T_WTRSTFS #define T_WTRSTFS (T_WTRSTFS_us * REF_CLK_FREQ) diff --git a/lib_xud/src/core/XUD_UIFM_Functions.h b/lib_xud/src/core/XUD_UIFM_Functions.h deleted file mode 100755 index d28888ec..00000000 --- a/lib_xud/src/core/XUD_UIFM_Functions.h +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved - -#ifndef UIFM_FUNCTIONS_H_ -#define UIFM_FUNCTIONS_H_ 1 - -#include "XUD_Support.h" - -// Sets up the ports for use with UIFM -void XUD_UIFM_PortConfig(buffered in port:32 clk_port, out port reg_write_port, in port reg_read_port, in port flag0_port, in port flag1_port, in port flag2_port, out port txd_port, in port rxd_port); - -// Enables UIFM in the passed mode -unsigned XUD_UIFM_Enable(unsigned mode); - -// Write value to UIFM register -void XUD_UIFM_RegWrite(out port reg_write_port, unsigned regNo, unsigned val); - -// Same as above but loads reg write port from DP -void XUD_UIFM_RegWrite_( unsigned regNo, unsigned val); - -// Read value from specified UIFM register -unsigned XUD_UIFM_RegRead(out port reg_write_port, in port reg_read_port, unsigned regNo); - -/* -// Write value to UIFM register. Uses a lock for mutual exclusion -void XUD_UIFM_RegWrite_Locked(out port reg_write_port, XUD_lock l_ifm, unsigned regNo, unsigned val); - -// Read value from specified UIFM register. Uses a lock for mutual exclusion -unsigned XUD_UIFM_RegRead_Locked(out port reg_write_port, in port reg_read_port, XUD_lock l_ifm, unsigned regNo); -*/ - -// Write specified endpoint buffer to UIFM packet buffer -void WriteEpBuffToPktBuff(out port reg_write_port, unsigned ep, unsigned datalength); - -// Read data from specified endpoint buffer. -// Returns DATA PID for sequence checking -// Does CRC checking... returns 0 if CRC16 bad -unsigned ReadPktBuffToEpBuff(out port reg_write_port, in port reg_read_port, unsigned ep, unsigned datalength); - -unsigned ReadSetupBuffToEpBuff(out port reg_write_port, in port reg_read_port, unsigned ep); - - -#endif diff --git a/lib_xud/src/user/XUD_USB_Defines.h b/lib_xud/src/user/XUD_USB_Defines.h index 2b25295d..d84d1cab 100644 --- a/lib_xud/src/user/XUD_USB_Defines.h +++ b/lib_xud/src/user/XUD_USB_Defines.h @@ -6,8 +6,6 @@ #ifndef _USB_DEFS_H_ #define _USB_DEFS_H_ -#define USB_TILE_REF usb_tile - /* Table 8-1. PID Types */ #define USB_PID_OUT 0x1 /* Tokens */ #define USB_PID_IN 0x9 diff --git a/lib_xud/src/user/client/XUD_SetDevAddr.xc b/lib_xud/src/user/client/XUD_SetDevAddr.xc index d347bf88..1f7191f6 100644 --- a/lib_xud/src/user/client/XUD_SetDevAddr.xc +++ b/lib_xud/src/user/client/XUD_SetDevAddr.xc @@ -1,15 +1,7 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved -#include "XUD_UIFM_Functions.h" -#include "XUD_USB_Defines.h" #include "xud.h" - -#if defined(__XS2A__) -#include "xs2_su_registers.h" -#include "XUD_USBTile_Support.h" -extern unsigned get_tile_id(tileref ref); -extern tileref USB_TILE_REF; -#endif +#include "XUD_HAL.h" void XUD_SetCrcTableAddr(unsigned addr); @@ -18,24 +10,12 @@ void XUD_SetCrcTableAddr(unsigned addr); */ XUD_Result_t XUD_SetDevAddr(unsigned addr) { - /* Set device address in UIFM */ -#if defined(__XS2A__) - write_periph_word(USB_TILE_REF, XS1_GLX_PER_UIFM_CHANEND_NUM, XS1_GLX_PER_UIFM_DEVICE_ADDRESS_NUM, addr); -#elif defined(__XS1B__) - #if defined(ARCH_S) - write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_DEVICE_ADDRESS_NUM, addr); - #else - /* Vanilla XS1B/XS1-L */ - /* RegWrite_ loads write port from dp to avoid parallel usage checks */ - /* TODO this should really be locked for mutual exclusion */ - XUD_UIFM_RegWrite_(UIFM_REG_ADDRESS, addr); - #endif - #elif defined(__XS1A__) || defined (__XS3A__) - /* XS1A (XS1-G) and XS3: Modify CRC table for current address */ - XUD_SetCrcTableAddr(addr); +#ifdef __XS3A__ + /* XS1A (XS1-G) and XS3: Modify CRC table for current address */ + XUD_SetCrcTableAddr(addr); #else - #error ARCH define error + /* Set device address in UIFM */ + write_periph_word(USB_TILE_REF, XS1_GLX_PER_UIFM_CHANEND_NUM, XS1_GLX_PER_UIFM_DEVICE_ADDRESS_NUM, addr); #endif - return XUD_RES_OKAY; } From 7bccf19622cc02c89b45e8e376405a0ccab5c4e3 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 30 Apr 2020 17:43:11 +0100 Subject: [PATCH 126/520] More items moved to HAL --- lib_xud/src/core/XUD_HAL.h | 1 - lib_xud/src/core/XUD_HAL.xc | 28 ++++++++++++++++-- lib_xud/src/core/XUD_Main.xc | 55 ++---------------------------------- 3 files changed, 29 insertions(+), 55 deletions(-) diff --git a/lib_xud/src/core/XUD_HAL.h b/lib_xud/src/core/XUD_HAL.h index eeb98660..60ffec9d 100644 --- a/lib_xud/src/core/XUD_HAL.h +++ b/lib_xud/src/core/XUD_HAL.h @@ -27,7 +27,6 @@ typedef enum XUD_LineState_t XUD_LINESTATE_SE1 = 3 /**< Invalid bus state both lines high **/ } XUD_LineState_t; - void XUD_HAL_EnterMode_PeripheralChirp(); void XUD_HAL_EnterMode_PeripheralFullSpeed(); void XUD_HAL_EnterMode_PeripheralHighSpeed(); diff --git a/lib_xud/src/core/XUD_HAL.xc b/lib_xud/src/core/XUD_HAL.xc index e58e1259..35de78a2 100644 --- a/lib_xud/src/core/XUD_HAL.xc +++ b/lib_xud/src/core/XUD_HAL.xc @@ -238,7 +238,15 @@ void XUD_HAL_EnterMode_PeripheralTestJTestK() void XUD_HAL_Mode_PowerSig() { #ifndef XUD_SIM_XSIM -#ifdef __XS3A__ +#ifdef __XS2A__ + /* For XS2 we invert VALID_TOKEN port for data-transfer mode, so undo this for signalling */ + set_port_no_inv(flag2_port); + + write_periph_word(USB_TILE_REF, XS1_GLX_PER_UIFM_CHANEND_NUM, XS1_GLX_PER_UIFM_MASK_NUM, + ((1< void; } } -#if defined(__XS2A__) + /* Go into full speed mode: XcvrSelect and Term Select (and suspend) high */ - write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_FUNC_CONTROL_NUM, (1< Date: Fri, 1 May 2020 12:13:49 +0100 Subject: [PATCH 127/520] Added missing issue_modes --- lib_xud/src/core/XUD_IoLoop.S | 4 ++-- lib_xud/src/core/XUD_Main.xc | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib_xud/src/core/XUD_IoLoop.S b/lib_xud/src/core/XUD_IoLoop.S index 579a71ee..e043e0f2 100755 --- a/lib_xud/src/core/XUD_IoLoop.S +++ b/lib_xud/src/core/XUD_IoLoop.S @@ -68,6 +68,7 @@ suspend_t_wtwrsths: .globl UsbTestModeHandler_asm .text .cc_top UsbTestModeHandler_asm.func, UsbTestModeHandler_asm +.issue_mode dual UsbTestModeHandler_asm: clrsr 0x18 clrsr 0x2 @@ -95,6 +96,7 @@ UsbTestModeHandler_asm: .globl ResetIntHandler .text .cc_top ResetIntHandler.func, ResetIntHandler +.issue_mode dual ResetIntHandler: clrsr 0x18 // Clear InInterrupt bit (and InKernel) clrsr 0x2 @@ -217,8 +219,6 @@ SetupUsbTestMode: setv res[r10], r11 eeu res[r10] #endif - - CrcRxResidualsOnStack: ldc r11, 0x7000 diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index 184e849f..3b3c5117 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -352,7 +352,6 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c #endif } - /* Reset in the ep structures */ for(int i = 0; i< noEpIn; i++) { From 9596637493e0788d008388643d20973ac02854fc Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 1 May 2020 16:25:49 +0100 Subject: [PATCH 128/520] Fixes to test mode support --- lib_xud/src/core/XUD_IoLoop.S | 17 ++++++++++------- lib_xud/src/core/XUD_TestMode.xc | 5 +---- lib_xud/src/user/client/XUD_EpFuncs.S | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib_xud/src/core/XUD_IoLoop.S b/lib_xud/src/core/XUD_IoLoop.S index e043e0f2..c8003ceb 100755 --- a/lib_xud/src/core/XUD_IoLoop.S +++ b/lib_xud/src/core/XUD_IoLoop.S @@ -52,11 +52,11 @@ suspend_t_wtwrsths: // Params #define STACK_VTOK_PORT (STACK_EXTEND + 1) -#define SP_EPTYPES_OUT (STACK_EXTEND + 2) // STACK_EXTEND + 6 : EP Type table (out) +#define SP_EPTYPES_OUT (STACK_EXTEND + 2) // STACK_EXTEND + 6 : EP Type table (out) #define SP_EPTYPES_IN (STACK_EXTEND + 3) // EP Type table (in) -#define STACK_EPCHANS (STACK_EXTEND + 4) +#define STACK_EPCHANS (STACK_EXTEND + 4) #define SP_EPCOUNT (STACK_EXTEND + 5) -#define STACK_SOFCHAN (STACK_EXTEND + 6) +#define STACK_SOFCHAN (STACK_EXTEND + 6) #ifndef XUD_TEST_MODE_SUPPORT_DISABLED ////////////////////////////////////////////////////////////////////////// @@ -68,11 +68,13 @@ suspend_t_wtwrsths: .globl UsbTestModeHandler_asm .text .cc_top UsbTestModeHandler_asm.func, UsbTestModeHandler_asm -.issue_mode dual +.issue_mode single +.align 4 UsbTestModeHandler_asm: + ENTSP_lu6 0 clrsr 0x18 clrsr 0x2 - clre // clear all events + clre // clear all events get r11, ed chkct res[r11], XS1_CT_END outct res[r11], XS1_CT_END @@ -80,8 +82,8 @@ UsbTestModeHandler_asm: chkct res[r11], XS1_CT_END outct res[r11], XS1_CT_END - bf r0, Return // Speical case for Exit - + bf r0, Return // Special case for Exit + bl XUD_UsbTestModeHandler retsp 0 @@ -97,6 +99,7 @@ UsbTestModeHandler_asm: .text .cc_top ResetIntHandler.func, ResetIntHandler .issue_mode dual +.align 4 ResetIntHandler: clrsr 0x18 // Clear InInterrupt bit (and InKernel) clrsr 0x2 diff --git a/lib_xud/src/core/XUD_TestMode.xc b/lib_xud/src/core/XUD_TestMode.xc index d58c47a8..61331bf7 100644 --- a/lib_xud/src/core/XUD_TestMode.xc +++ b/lib_xud/src/core/XUD_TestMode.xc @@ -4,7 +4,6 @@ #include "xud.h" #include "XUD_TestMode.h" - extern out buffered port:32 p_usb_txd; #define T_INTER_TEST_PACKET_us 2 @@ -30,10 +29,8 @@ unsigned int test_packet[] = }; // Runs in XUD thread with interrupt on entering testmode. -int XUD_UsbTestModeHandler() +int XUD_UsbTestModeHandler(unsigned cmd) { - unsigned cmd = UsbTestModeHandler_asm(); - switch(cmd) { case USB_WINDEX_TEST_J: diff --git a/lib_xud/src/user/client/XUD_EpFuncs.S b/lib_xud/src/user/client/XUD_EpFuncs.S index dd906220..57d90f82 100644 --- a/lib_xud/src/user/client/XUD_EpFuncs.S +++ b/lib_xud/src/user/client/XUD_EpFuncs.S @@ -700,7 +700,7 @@ NoOffset: XUD_SetTestMode: #if defined(__XS2A__) || defined(__XS3A__) .issue_mode single - ENTSP_lu6 0 + ENTSP_lu6 0 #endif ldw r0, r0[2] // Load our chanend ID to use outct res[r0], 1 From 43026b1b9a48a8a91d014d960d57d8a6b690f863 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 5 May 2020 16:27:07 +0100 Subject: [PATCH 129/520] Fixed suspend interrupt --- lib_xud/src/core/XUD_IoLoop.S | 30 ++++++++++++++------------- lib_xud/src/user/client/XUD_EpFuncs.S | 14 ++++--------- 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/lib_xud/src/core/XUD_IoLoop.S b/lib_xud/src/core/XUD_IoLoop.S index c8003ceb..848a25e4 100755 --- a/lib_xud/src/core/XUD_IoLoop.S +++ b/lib_xud/src/core/XUD_IoLoop.S @@ -71,7 +71,7 @@ suspend_t_wtwrsths: .issue_mode single .align 4 UsbTestModeHandler_asm: - ENTSP_lu6 0 + ENTSP_lu6 0 clrsr 0x18 clrsr 0x2 clre // clear all events @@ -101,6 +101,7 @@ UsbTestModeHandler_asm: .issue_mode dual .align 4 ResetIntHandler: + DUALENTSP_lu6 0 clrsr 0x18 // Clear InInterrupt bit (and InKernel) clrsr 0x2 @@ -179,29 +180,30 @@ SaveStackPointer: ldaw r11, sp[0] stw r11, dp[SavedSp] + ldw r11, cp[suspendTimeout] stw r11, sp[STACK_SUSPEND_TIMEOUT] ConfigRxDEventVector: // Configure events setc res[RXD], XS1_SETC_IE_MODE_EVENT - ldap r11, TxHandShakeReceived - setv res[RXD], r11 + ldap r11, TxHandShakeReceived + setv res[RXD], r11 ConfigRxA: - setc res[RXA], XS1_SETC_COND_EQ - setc res[RXA], XS1_SETC_IE_MODE_EVENT - ldc r11, 0 - setd res[r1], r11 - ldap r11, RxALow - setv res[r1], r11 - eeu res[RXA] + setc res[RXA], XS1_SETC_COND_EQ + setc res[RXA], XS1_SETC_IE_MODE_EVENT + ldc r11, 0 + setd res[RXA], r11 + ldap r11, RxALow + setv res[RXA], r11 + eeu res[RXA] #ifdef __XS2A__ ConfigValidToken: - ldw r10, sp[STACK_VTOK_PORT] - setc res[r10], XS1_SETC_COND_NONE - ldap r11, TxHandshakeTimeOut // ValidToken is used for timing timeout period when expecting an ack after tx - setv res[r10], r11 + ldw r10, sp[STACK_VTOK_PORT] + setc res[r10], XS1_SETC_COND_NONE + ldap r11, TxHandshakeTimeOut // ValidToken is used for timing timeout period when expecting an ack after tx + setv res[r10], r11 #endif #ifndef XUD_TEST_MODE_SUPPORT_DISABLED diff --git a/lib_xud/src/user/client/XUD_EpFuncs.S b/lib_xud/src/user/client/XUD_EpFuncs.S index 57d90f82..3228ce30 100644 --- a/lib_xud/src/user/client/XUD_EpFuncs.S +++ b/lib_xud/src/user/client/XUD_EpFuncs.S @@ -15,14 +15,10 @@ .globl XUD_GetSetupData .type XUD_GetSetupData, @function .cc_top XUD_GetSetupData.func +.issue_mode single .align 4 XUD_GetSetupData: -#if defined(__XS2A__) || defined(__XS3A__) -.issue_mode single - ENTSP_lu6 4 -#else - entsp 4 -#endif + ENTSP_lu6 4 stw r4, sp[1] stw r10, sp[2] @@ -575,12 +571,10 @@ XUD_SetStallByAddr_OUT: /* R0: ep number */ .cc_top XUD_ClearStallByAddr.func +.issue_mode single .align 4 XUD_ClearStallByAddr: -#if defined(__XS2A__) || defined (__XS3A__) -.issue_mode single - ENTSP_lu6 0 -#endif + ENTSP_lu6 0 ldc r2, USB_PIDn_NAK ldc r11, 0x80 // Check for IN bit and r11, r11, r0 From 29f1690b9cf4ae8a89ed631f9561df99147525d8 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 5 May 2020 16:50:31 +0100 Subject: [PATCH 130/520] Changelog update --- CHANGELOG.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 9da28bbd..c128b5ad 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,7 @@ HEAD * ADDED: Initial support for XS3A based devices * CHANGE: Removed support for XS1-G, and XS1-L (including U series) based devices + * ADDED: Requirement to define XUD_CORE_CLOCK with xcore core clock speed in MHz 0.1.1 From eaa007249d56603dd87e1dbf037bf0f61c329931 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 5 May 2020 16:50:45 +0100 Subject: [PATCH 131/520] Added XUD_CORE_CLOCK default define --- lib_xud/api/xud.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib_xud/api/xud.h b/lib_xud/api/xud.h index 606ce051..20302c46 100644 --- a/lib_xud/api/xud.h +++ b/lib_xud/api/xud.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved /* * \brief User defines and functions for XMOS USB Device library */ @@ -33,6 +33,11 @@ #define USB_TILE tile[0] #endif +#ifndef XUD_CORE_CLOCK +#warning XUD_CORE_CLOCK not defined, using default (700MHz) +#define XUD_CORE_CLOCK (700) +#endif + #if defined(PORT_USB_CLK) /* Ports declared in the .xn file. Automatically detect device series */ #if defined(PORT_USB_RX_READY) From 2f2485cd2ec23ccf432b872ec689622db08f234e Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 5 May 2020 16:51:21 +0100 Subject: [PATCH 132/520] Added error if XUD_CORE CLOCK not defined --- lib_xud/src/core/XUD_Main.xc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index 3b3c5117..b7f16090 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -184,6 +184,9 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c #endif #if defined(__XS3A__) + #ifndef XUD_CORE_CLOCK + #error XUD_CORE_CLOCK not defined (in MHz) + #endif #if (XUD_CORE_CLOCK > 500) #define RX_RISE_DELAY 2 #define RX_FALL_DELAY 5 From e2f69a755ae1209d8ec3888a8b68b9dbf4fdc07b Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 5 May 2020 16:54:35 +0100 Subject: [PATCH 133/520] Readme update --- README.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index eb5868c0..10ad5303 100644 --- a/README.rst +++ b/README.rst @@ -13,7 +13,7 @@ that allows you to control an USB bus via xCORE ports. The library provides functionality to act as a USB *device* only. -This library is aimed primarily for use with xCORE-200 Series or xCORE U-Series devices but it does also support xCORE L-Series devices with the addition of an external USB PHY device. +This library is for use with xCORE-200 Series or xCORE-AI series devices only, previous generations of xCORE devices are no longer supported. Features ........ @@ -22,6 +22,11 @@ Features * Device mode * Bulk, control, interrupt and isochronous endpoint types supported +Known Issues +............ + + * Operation on xCORE-AI devices only supported at 700MHz + Typical Resource Usage ...................... From 5575068224e71c93da865064d1f82607d44e0541 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 6 May 2020 12:00:56 +0100 Subject: [PATCH 134/520] Fixed XUD_SetReady_InPtr() for dual issue low level --- lib_xud/api/xud.h | 42 ++++++++++++++++----------- lib_xud/src/core/XUD_Client.xc | 6 ---- lib_xud/src/user/client/XUD_EpFuncs.S | 2 +- 3 files changed, 26 insertions(+), 24 deletions(-) delete mode 100644 lib_xud/src/core/XUD_Client.xc diff --git a/lib_xud/api/xud.h b/lib_xud/api/xud.h index 20302c46..1206208b 100644 --- a/lib_xud/api/xud.h +++ b/lib_xud/api/xud.h @@ -466,8 +466,8 @@ inline XUD_Result_t XUD_SetReady_InPtr(XUD_ep ep, unsigned addr, int len) { int chan_array_ptr; int tmp, tmp2; - int wordlength; - int taillength; + int wordLength; + int tailLength; int reset; @@ -478,29 +478,37 @@ inline XUD_Result_t XUD_SetReady_InPtr(XUD_ep ep, unsigned addr, int len) return XUD_RES_RST; } - /* Knock off the tail bits */ - wordlength = len >>2; - wordlength <<=2; + /* Tail length bytes to bits */ + tailLength = zext((len << 3),5); - taillength = zext((len << 5),7); + /* Datalength (bytes) --> datalength (words) */ + wordLength = len >> 2; - asm ("ldw %0, %1[0]":"=r"(chan_array_ptr):"r"(ep)); - - // Get end off buffer address - asm ("add %0, %1, %2":"=r"(tmp):"r"(addr),"r"(wordlength)); + /* If tail-length is 0 and word-length not 0. Make tail-length 32 and word-length-- */ + if ((tailLength == 0) && (wordLength != 0)) + { + wordLength = wordLength - 1; + tailLength = 32; + } + + /* Get end off buffer address */ + asm ("add %0, %1, %2":"=r"(tmp):"r"(addr),"r"(wordLength << 2)); - asm ("neg %0, %1":"=r"(tmp2):"r"(len>>2)); // Produce negative offset from end off buffer + /* Produce negative offset from end of buffer */ + asm ("neg %0, %1":"=r"(tmp2):"r"(wordLength)); - // Store neg index - asm ("stw %0, %1[6]"::"r"(tmp2),"r"(ep)); // Store index + /* Store neg index */ + asm ("stw %0, %1[6]"::"r"(tmp2),"r"(ep)); - // Store buffer pointer + /* Store buffer pointer */ asm ("stw %0, %1[3]"::"r"(tmp),"r"(ep)); - // Store tail len - asm ("stw %0, %1[7]"::"r"(taillength),"r"(ep)); + /* Store tail len */ + asm ("stw %0, %1[7]"::"r"(tailLength),"r"(ep)); - asm ("stw %0, %1[0]"::"r"(ep),"r"(chan_array_ptr)); // Mark ready + /* Finally, mark ready */ + asm ("ldw %0, %1[0]":"=r"(chan_array_ptr):"r"(ep)); + asm ("stw %0, %1[0]"::"r"(ep),"r"(chan_array_ptr)); return XUD_RES_OKAY; } diff --git a/lib_xud/src/core/XUD_Client.xc b/lib_xud/src/core/XUD_Client.xc deleted file mode 100644 index d36622de..00000000 --- a/lib_xud/src/core/XUD_Client.xc +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright (c) 2012-2018, XMOS Ltd, All rights reserved -#include - -//extern void XUD_SetReady_In(XUD_ep e, unsigned bufferPtr, int len); - -//extern void XUD_SetData_Inline(XUD_ep e, chanend c); diff --git a/lib_xud/src/user/client/XUD_EpFuncs.S b/lib_xud/src/user/client/XUD_EpFuncs.S index 3228ce30..6bd34e98 100644 --- a/lib_xud/src/user/client/XUD_EpFuncs.S +++ b/lib_xud/src/user/client/XUD_EpFuncs.S @@ -289,7 +289,7 @@ XUD_SetData_NoReq: add r1, r1, r3 // Add start index to buffer address CalcTailLength: - shl r3, r2, 3 // Taillength: bytes to bits + shl r3, r2, 3 // Tail length: bytes to bits zext r3, 5 SetupLoopTerm: From 2ddd4b886e0d337b3d259356f756123c604bbad2 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 6 May 2020 12:56:53 +0100 Subject: [PATCH 135/520] More stack define tidy --- lib_xud/src/core/XUD_IoLoop.S | 12 ++++++------ lib_xud/src/core/included/XUD_Token_In_DI.S | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib_xud/src/core/XUD_IoLoop.S b/lib_xud/src/core/XUD_IoLoop.S index 848a25e4..e2445a40 100755 --- a/lib_xud/src/core/XUD_IoLoop.S +++ b/lib_xud/src/core/XUD_IoLoop.S @@ -51,12 +51,12 @@ suspend_t_wtwrsths: #define STACK_RXCRC_INIT (21) // Params -#define STACK_VTOK_PORT (STACK_EXTEND + 1) -#define SP_EPTYPES_OUT (STACK_EXTEND + 2) // STACK_EXTEND + 6 : EP Type table (out) -#define SP_EPTYPES_IN (STACK_EXTEND + 3) // EP Type table (in) -#define STACK_EPCHANS (STACK_EXTEND + 4) -#define SP_EPCOUNT (STACK_EXTEND + 5) -#define STACK_SOFCHAN (STACK_EXTEND + 6) +#define STACK_VTOK_PORT (STACK_EXTEND + 1) +#define STACK_EPTYPES_OUT (STACK_EXTEND + 2) // STACK_EXTEND + 6 : EP Type table (out) +#define STACK_EPTYPES_IN (STACK_EXTEND + 3) // EP Type table (in) +#define STACK_EPCHANS (STACK_EXTEND + 4) +#define SP_EPCOUNT (STACK_EXTEND + 5) +#define STACK_SOFCHAN (STACK_EXTEND + 6) #ifndef XUD_TEST_MODE_SUPPORT_DISABLED ////////////////////////////////////////////////////////////////////////// diff --git a/lib_xud/src/core/included/XUD_Token_In_DI.S b/lib_xud/src/core/included/XUD_Token_In_DI.S index 2096a693..b38d1ca9 100755 --- a/lib_xud/src/core/included/XUD_Token_In_DI.S +++ b/lib_xud/src/core/included/XUD_Token_In_DI.S @@ -22,7 +22,7 @@ // R0 : RXD .align 4 InNotReady: - ldw r11, sp[SP_EPTYPES_OUT] + ldw r11, sp[STACK_EPTYPES_IN] ldw r11, r11[r10] // Load EP Type bt r11, XUD_IN_TxNak ldc r11, 0xc3 // Create 0-length packet @@ -82,7 +82,7 @@ XUD_IN_TxCrc: // Wait for handshake... or timeout DoneTail: - ldw r11, sp[SP_EPTYPES_OUT] + ldw r11, sp[STACK_EPTYPES_IN] ldw r11, r11[r10] // Load EP Type bt r11, SetupReceiveHandShake bu DoneTx From 648a8885793415d21c1c856c8a3ac7b808b744ba Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 6 May 2020 12:57:19 +0100 Subject: [PATCH 136/520] Fixed trap on over flowed OUT --- lib_xud/src/core/included/XUD_Token_Out_DI.S | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib_xud/src/core/included/XUD_Token_Out_DI.S b/lib_xud/src/core/included/XUD_Token_Out_DI.S index dc61eba0..5def468b 100755 --- a/lib_xud/src/core/included/XUD_Token_Out_DI.S +++ b/lib_xud/src/core/included/XUD_Token_Out_DI.S @@ -65,16 +65,17 @@ Err_RxErr: // RxError signal high during da bu NextToken XUD_TokenOut_BufferFull: - ldw r9, dp[flag1_port] + ldw r9, sp[STACK_RXA_PORT] setc res[r9], XS1_SETC_RUN_CLRBUF setc res[r9], XS1_SETC_COND_NEQ + XUD_TokenOut_WaitForPacketEnd: // Wait for end of data then send NAK in r11, res[r9] setc res[r9], XS1_SETC_COND_EQ in r11, res[r9] // TODO: Observe interpacket delay #ifndef XUD_NAK_ISO_OUT - ldw r4, sp[(STACK_EXTEND+5)] // Load ep type table + ldw r4, sp[STACK_EPTYPES_OUT] // Load ep type table ldw r4, r4[r10] // load EP type bf r4, PrimaryBufferFull_NoNak #endif From 417422f577c24d4305303dcb8c659c36d17d29e5 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 11 May 2020 11:59:30 +0100 Subject: [PATCH 137/520] Added tests readme --- tests/README.txt | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 tests/README.txt diff --git a/tests/README.txt b/tests/README.txt new file mode 100644 index 00000000..f87b8a1b --- /dev/null +++ b/tests/README.txt @@ -0,0 +1,7 @@ + +The xross/feat/usb_shim branches need pulling into the mainlines of the +folliwing repos + +xsim +xsimutils +tools_xmostest From 535d2a2239a1a9a084216e04c594ffc855960bc2 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 12 May 2020 13:05:22 +0100 Subject: [PATCH 138/520] Some test related fixes --- lib_xud/src/core/XUD_Main.xc | 4 +--- lib_xud/src/core/included/XUD_Token_Out.S | 2 +- tests/test_bulk_rx_basic/src/main.xc | 3 +-- tests/test_bulk_rx_basic_badcrc32/src/main.xc | 3 +-- tests/test_bulk_rx_basic_badpid/src/main.xc | 3 +-- tests/test_bulk_rx_basic_nodata/src/main.xc | 3 +-- tests/test_bulk_rx_basic_rxerror/src/main.xc | 2 +- tests/test_bulk_tx_basic/src/main.xc | 2 +- tests/test_bulk_tx_basic_noack/src/main.xc | 2 +- tests/test_bulk_tx_basic_short/src/main.xc | 2 +- tests/test_control_basic_badcrc32/src/main.xc | 2 +- tests/test_control_basic_get/src/main.xc | 2 +- tests/test_control_basic_set/src/main.xc | 2 +- tests/test_control_basic_short/src/main.xc | 2 +- tests/test_ping_rx_basic/src/main.xc | 2 +- tests/test_sof_badcrc/src/main.xc | 2 +- tests/test_sof_basic/src/main.xc | 2 +- 17 files changed, 17 insertions(+), 23 deletions(-) diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index b7f16090..d5f50301 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -361,10 +361,8 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c ep_info[USB_MAX_NUM_EP_OUT+i].pid = USB_PIDn_DATA0; } -#if !defined (XUD_SIM_XSIM) - /* Set default device address */ + /* Set default device address - note, for normal operation this is 0, but can be other values for testing */ XUD_HAL_SetDeviceAddress(XUD_STARTUP_ADDRESS); -#endif #ifdef XUD_BYPASS_RESET #if defined(XUD_TEST_SPEED_HS) diff --git a/lib_xud/src/core/included/XUD_Token_Out.S b/lib_xud/src/core/included/XUD_Token_Out.S index 99007bf6..e92ccd8d 100755 --- a/lib_xud/src/core/included/XUD_Token_Out.S +++ b/lib_xud/src/core/included/XUD_Token_Out.S @@ -32,7 +32,7 @@ InformEP_Iso: // Iso EP - no handshake #ifndef __XS3A__ ldw r1, sp[STACK_FLAG0_PORT] #endif - //ldc r4, XUD_MAX_NUM_EP_OUT // This could be shaved if XUD_MAX_NUM_EP's < 12. Now use an LDAW to at 16. + //ldc r4, XUD_MAX_NUM_EP_OUT // This could be shaved if XUD_MAX_NUM_EP's < 12. Now use an LDAW to at 16. //------------------------------------------------------------------------------------------------ #if defined(__XS2A__) || defined(__XS1B__) diff --git a/tests/test_bulk_rx_basic/src/main.xc b/tests/test_bulk_rx_basic/src/main.xc index cc82ad96..3ff7a1d0 100644 --- a/tests/test_bulk_rx_basic/src/main.xc +++ b/tests/test_bulk_rx_basic/src/main.xc @@ -45,8 +45,7 @@ int main() #endif XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, - null, null, -1, speed, XUD_PWR_BUS); + null, epTypeTableOut, epTypeTableIn, speed, XUD_PWR_BUS); } { diff --git a/tests/test_bulk_rx_basic_badcrc32/src/main.xc b/tests/test_bulk_rx_basic_badcrc32/src/main.xc index dffb9c48..cd89a532 100644 --- a/tests/test_bulk_rx_basic_badcrc32/src/main.xc +++ b/tests/test_bulk_rx_basic_badcrc32/src/main.xc @@ -164,8 +164,7 @@ int main() { XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, - null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); + null, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); //TestEp_Control(c_ep_out[0], c_ep_in[0], 0); diff --git a/tests/test_bulk_rx_basic_badpid/src/main.xc b/tests/test_bulk_rx_basic_badpid/src/main.xc index 92dcbde0..ee4553f8 100644 --- a/tests/test_bulk_rx_basic_badpid/src/main.xc +++ b/tests/test_bulk_rx_basic_badpid/src/main.xc @@ -45,8 +45,7 @@ int main() #endif XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, - null, null, -1, speed, XUD_PWR_BUS); + null, epTypeTableOut, epTypeTableIn, speed, XUD_PWR_BUS); } { diff --git a/tests/test_bulk_rx_basic_nodata/src/main.xc b/tests/test_bulk_rx_basic_nodata/src/main.xc index 92dcbde0..ee4553f8 100644 --- a/tests/test_bulk_rx_basic_nodata/src/main.xc +++ b/tests/test_bulk_rx_basic_nodata/src/main.xc @@ -45,8 +45,7 @@ int main() #endif XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, - null, null, -1, speed, XUD_PWR_BUS); + null, epTypeTableOut, epTypeTableIn, speed, XUD_PWR_BUS); } { diff --git a/tests/test_bulk_rx_basic_rxerror/src/main.xc b/tests/test_bulk_rx_basic_rxerror/src/main.xc index e3b55b2e..597948f0 100644 --- a/tests/test_bulk_rx_basic_rxerror/src/main.xc +++ b/tests/test_bulk_rx_basic_rxerror/src/main.xc @@ -168,7 +168,7 @@ int main() XUD_Manager( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, - null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); + XUD_SPEED_HS, XUD_PWR_BUS); //TestEp_Control(c_ep_out[0], c_ep_in[0], 0); diff --git a/tests/test_bulk_tx_basic/src/main.xc b/tests/test_bulk_tx_basic/src/main.xc index a3c3155d..dcfe935b 100644 --- a/tests/test_bulk_tx_basic/src/main.xc +++ b/tests/test_bulk_tx_basic/src/main.xc @@ -59,7 +59,7 @@ int main() // TODO test is running at 400MHz XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, - null, null, -1, speed, XUD_PWR_BUS); + speed, XUD_PWR_BUS); } { diff --git a/tests/test_bulk_tx_basic_noack/src/main.xc b/tests/test_bulk_tx_basic_noack/src/main.xc index 0adf6bdc..5166b1ae 100644 --- a/tests/test_bulk_tx_basic_noack/src/main.xc +++ b/tests/test_bulk_tx_basic_noack/src/main.xc @@ -97,7 +97,7 @@ int main() XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, - null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); + XUD_SPEED_HS, XUD_PWR_BUS); TestEp_Bulk(c_ep_out[2], c_ep_in[2], 1, c_ep_out[0]); diff --git a/tests/test_bulk_tx_basic_short/src/main.xc b/tests/test_bulk_tx_basic_short/src/main.xc index 0b8e759a..840870b0 100644 --- a/tests/test_bulk_tx_basic_short/src/main.xc +++ b/tests/test_bulk_tx_basic_short/src/main.xc @@ -57,7 +57,7 @@ int main() XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, - null, null, -1, speed, XUD_PWR_BUS); + speed, XUD_PWR_BUS); } { diff --git a/tests/test_control_basic_badcrc32/src/main.xc b/tests/test_control_basic_badcrc32/src/main.xc index b12e5388..7812cee2 100644 --- a/tests/test_control_basic_badcrc32/src/main.xc +++ b/tests/test_control_basic_badcrc32/src/main.xc @@ -193,7 +193,7 @@ int main() XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, - null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); + XUD_SPEED_HS, XUD_PWR_BUS); TestEp_Control(c_ep_out[0], c_ep_in[0], 0); } diff --git a/tests/test_control_basic_get/src/main.xc b/tests/test_control_basic_get/src/main.xc index e087b894..2d84d05d 100644 --- a/tests/test_control_basic_get/src/main.xc +++ b/tests/test_control_basic_get/src/main.xc @@ -89,7 +89,7 @@ int main() XUD_Manager( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, - null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); + XUD_SPEED_HS, XUD_PWR_BUS); { int fail = TestEp_Control(c_ep_out[0], c_ep_in[0], 0); diff --git a/tests/test_control_basic_set/src/main.xc b/tests/test_control_basic_set/src/main.xc index 64bb03a5..59b31168 100644 --- a/tests/test_control_basic_set/src/main.xc +++ b/tests/test_control_basic_set/src/main.xc @@ -95,7 +95,7 @@ int main() XUD_Manager( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, - null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); + XUD_SPEED_HS, XUD_PWR_BUS); { int fail = TestEp_Control(c_ep_out[0], c_ep_in[0], 0); diff --git a/tests/test_control_basic_short/src/main.xc b/tests/test_control_basic_short/src/main.xc index 9cf33947..f2a4a917 100644 --- a/tests/test_control_basic_short/src/main.xc +++ b/tests/test_control_basic_short/src/main.xc @@ -229,7 +229,7 @@ int main() XUD_Manager( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, - null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); + XUD_SPEED_HS, XUD_PWR_BUS); TestEp_Control(c_ep_out[0], c_ep_in[0], 0); } diff --git a/tests/test_ping_rx_basic/src/main.xc b/tests/test_ping_rx_basic/src/main.xc index f9b873ed..1ceec0fa 100644 --- a/tests/test_ping_rx_basic/src/main.xc +++ b/tests/test_ping_rx_basic/src/main.xc @@ -89,7 +89,7 @@ int main() { XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, - null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); + XUD_SPEED_HS, XUD_PWR_BUS); { TestEp_PingTest(c_ep_out, 1, 2); diff --git a/tests/test_sof_badcrc/src/main.xc b/tests/test_sof_badcrc/src/main.xc index ff4bbb89..3c9d65a8 100644 --- a/tests/test_sof_badcrc/src/main.xc +++ b/tests/test_sof_badcrc/src/main.xc @@ -98,7 +98,7 @@ int main() XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, c_sof, epTypeTableOut, epTypeTableIn, - null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); + XUD_SPEED_HS, XUD_PWR_BUS); TestEp_Bulk(c_ep_out[1], c_ep_in[1], 1, c_ep_out[0], c_sof); diff --git a/tests/test_sof_basic/src/main.xc b/tests/test_sof_basic/src/main.xc index d6122e76..064cbe2f 100644 --- a/tests/test_sof_basic/src/main.xc +++ b/tests/test_sof_basic/src/main.xc @@ -87,7 +87,7 @@ int main() XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, c_sof, epTypeTableOut, epTypeTableIn, - null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); + XUD_SPEED_HS, XUD_PWR_BUS); TestEp_Bulk(c_ep_out[1], c_ep_in[1], 1, c_ep_out[0], c_sof); From c29baf9a9fcc46163453c2bb1d5f7783c4af38cd Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 12 May 2020 15:44:55 +0100 Subject: [PATCH 139/520] More test fixes --- README.rst | 3 ++- tests/test_bulk_loopback/src/main.xc | 2 +- tests/test_bulk_rx_basic_rxerror/src/main.xc | 2 +- tests/test_bulk_rx_multiep/src/main.xc | 2 +- tests/test_bulk_rx_traffic/src/main.xc | 2 +- tests/test_bulk_tx_multiep/src/main.xc | 2 +- tests/test_control_basic_get/src/main.xc | 8 +------ tests/test_control_basic_set/src/main.xc | 14 ++---------- tests/test_invalidtoken/src/main.xc | 2 +- tests/test_iso_loopback/src/main.xc | 2 +- tests/test_iso_rx_basic/src/main.xc | 2 +- tests/test_iso_rxtx_fastpacket/src/main.xc | 2 +- tests/test_iso_tx_basic/src/main.xc | 2 +- tests/test_ping_rx_basic/src/main.xc | 24 +++----------------- tests/test_shorttoken/src/main.xc | 4 ++-- tests/test_sof_badcrc/src/main.xc | 4 ++-- tests/test_sof_basic/src/main.xc | 4 ++-- 17 files changed, 24 insertions(+), 57 deletions(-) diff --git a/README.rst b/README.rst index 10ad5303..516ab652 100644 --- a/README.rst +++ b/README.rst @@ -25,7 +25,8 @@ Features Known Issues ............ - * Operation on xCORE-AI devices only supported at 700MHz + * Operation on XS3 based devices only supported at 700MHz + * SOF tokens are not CRC checked on XS3 based devices (see tests/test_sof_badcrc) Typical Resource Usage diff --git a/tests/test_bulk_loopback/src/main.xc b/tests/test_bulk_loopback/src/main.xc index a6edb1e3..bb14d680 100644 --- a/tests/test_bulk_loopback/src/main.xc +++ b/tests/test_bulk_loopback/src/main.xc @@ -79,7 +79,7 @@ int main() XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, - null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); + XUD_SPEED_HS, XUD_PWR_BUS); TestEp_Bulk(c_ep_out[3], c_ep_in[3]); TestEp_Bulk2(c_ep_out[2], c_ep_in[2], c_ep_out[0]); diff --git a/tests/test_bulk_rx_basic_rxerror/src/main.xc b/tests/test_bulk_rx_basic_rxerror/src/main.xc index 597948f0..b96e77e4 100644 --- a/tests/test_bulk_rx_basic_rxerror/src/main.xc +++ b/tests/test_bulk_rx_basic_rxerror/src/main.xc @@ -166,7 +166,7 @@ int main() par { - XUD_Manager( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); diff --git a/tests/test_bulk_rx_multiep/src/main.xc b/tests/test_bulk_rx_multiep/src/main.xc index 79cc39cb..1dd5147c 100644 --- a/tests/test_bulk_rx_multiep/src/main.xc +++ b/tests/test_bulk_rx_multiep/src/main.xc @@ -33,7 +33,7 @@ int main() XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, - null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); + XUD_SPEED_HS, XUD_PWR_BUS); TestEp_Rx(c_ep_out[3], 3, PACKET_LEN_START, PACKET_LEN_END); diff --git a/tests/test_bulk_rx_traffic/src/main.xc b/tests/test_bulk_rx_traffic/src/main.xc index cc82ad96..a365477b 100644 --- a/tests/test_bulk_rx_traffic/src/main.xc +++ b/tests/test_bulk_rx_traffic/src/main.xc @@ -46,7 +46,7 @@ int main() XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, - null, null, -1, speed, XUD_PWR_BUS); + speed, XUD_PWR_BUS); } { diff --git a/tests/test_bulk_tx_multiep/src/main.xc b/tests/test_bulk_tx_multiep/src/main.xc index b18999a6..043d7dfb 100644 --- a/tests/test_bulk_tx_multiep/src/main.xc +++ b/tests/test_bulk_tx_multiep/src/main.xc @@ -27,7 +27,7 @@ int main() XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, - null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); + XUD_SPEED_HS, XUD_PWR_BUS); TestEp_Tx(c_ep_in[3], 3, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_LOOP); TestEp_Tx(c_ep_in[4], 4, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_LOOP); diff --git a/tests/test_control_basic_get/src/main.xc b/tests/test_control_basic_get/src/main.xc index 2d84d05d..edc0e9dd 100644 --- a/tests/test_control_basic_get/src/main.xc +++ b/tests/test_control_basic_get/src/main.xc @@ -63,13 +63,7 @@ int TestEp_Control(chanend c_out, chanend c_in, int epNum) fail(FAIL_RX_BAD_RETURN_CODE); } - if(slength != 8) - { - printintln(length); - fail(FAIL_RX_DATAERROR); - } - - if(RxDataCheck(sbuffer, slength, epNum)) + if(RxDataCheck(sbuffer, slength, epNum, 8)) { fail(FAIL_RX_DATAERROR); } diff --git a/tests/test_control_basic_set/src/main.xc b/tests/test_control_basic_set/src/main.xc index 59b31168..d89cb096 100644 --- a/tests/test_control_basic_set/src/main.xc +++ b/tests/test_control_basic_set/src/main.xc @@ -53,13 +53,8 @@ int TestEp_Control(chanend c_out, chanend c_in, int epNum) { return 1; } - - if(slength != 8) - { - return 1; - } - if(RxDataCheck(sbuffer, slength, epNum)) + if(RxDataCheck(sbuffer, slength, epNum, 8)) { return 1; } @@ -69,13 +64,8 @@ int TestEp_Control(chanend c_out, chanend c_in, int epNum) { return 1; } - - if(length != 10) - { - return 1; - } - if(RxDataCheck(buffer, length, epNum)) + if(RxDataCheck(buffer, length, epNum, 10)) { return 1; } diff --git a/tests/test_invalidtoken/src/main.xc b/tests/test_invalidtoken/src/main.xc index ea66931c..2b250a10 100644 --- a/tests/test_invalidtoken/src/main.xc +++ b/tests/test_invalidtoken/src/main.xc @@ -131,7 +131,7 @@ int main() XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, - null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); + XUD_SPEED_HS, XUD_PWR_BUS); TestEp_Bulk(c_ep_out[1], c_ep_in[1], 1, c_ep_out[0]); diff --git a/tests/test_iso_loopback/src/main.xc b/tests/test_iso_loopback/src/main.xc index 4c06c0f3..f079d5eb 100644 --- a/tests/test_iso_loopback/src/main.xc +++ b/tests/test_iso_loopback/src/main.xc @@ -79,7 +79,7 @@ int main() XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, - null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); + XUD_SPEED_HS, XUD_PWR_BUS); TestEp_LoopbackForever(c_ep_out[3], c_ep_in[3]); TestEp_LoopbackOnce(c_ep_out[2], c_ep_in[2], c_ep_out[0]); diff --git a/tests/test_iso_rx_basic/src/main.xc b/tests/test_iso_rx_basic/src/main.xc index 4faa1ac2..58eaa628 100644 --- a/tests/test_iso_rx_basic/src/main.xc +++ b/tests/test_iso_rx_basic/src/main.xc @@ -49,7 +49,7 @@ int main() XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, - null, null, -1, speed, XUD_PWR_BUS); + speed, XUD_PWR_BUS); } { diff --git a/tests/test_iso_rxtx_fastpacket/src/main.xc b/tests/test_iso_rxtx_fastpacket/src/main.xc index c663a299..0451a3ca 100644 --- a/tests/test_iso_rxtx_fastpacket/src/main.xc +++ b/tests/test_iso_rxtx_fastpacket/src/main.xc @@ -39,7 +39,7 @@ int main() XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, - null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); + XUD_SPEED_HS, XUD_PWR_BUS); TestEp_Tx(c_ep_in[3], 3, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_DIE); diff --git a/tests/test_iso_tx_basic/src/main.xc b/tests/test_iso_tx_basic/src/main.xc index cdedc347..47300a04 100644 --- a/tests/test_iso_tx_basic/src/main.xc +++ b/tests/test_iso_tx_basic/src/main.xc @@ -36,7 +36,7 @@ int main() XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, - null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); + XUD_SPEED_HS, XUD_PWR_BUS); { TestEp_Tx(c_ep_in[3], 3, 10, 14, RUNMODE_DIE); diff --git a/tests/test_ping_rx_basic/src/main.xc b/tests/test_ping_rx_basic/src/main.xc index 1ceec0fa..a00f679a 100644 --- a/tests/test_ping_rx_basic/src/main.xc +++ b/tests/test_ping_rx_basic/src/main.xc @@ -37,13 +37,7 @@ int TestEp_PingTest(chanend c_out[], int epNum1, int epNum2) { XUD_GetBuffer(ep_out1, buffer, length); - if(length != i) - { - printintln(length); - fail(FAIL_RX_LENERROR); - } - - if(RxDataCheck(buffer, length, epNum1)) + if(RxDataCheck(buffer, length, epNum1, i)) { fail(FAIL_RX_DATAERROR); } @@ -52,13 +46,7 @@ int TestEp_PingTest(chanend c_out[], int epNum1, int epNum2) XUD_GetBuffer(ep_out2, buffer, length); - if(length != i) - { - printintln(length); - fail(FAIL_RX_LENERROR); - } - - if(RxDataCheck(buffer, length, epNum2)) + if(RxDataCheck(buffer, length, epNum2, i)) { fail(FAIL_RX_DATAERROR); } @@ -66,13 +54,7 @@ int TestEp_PingTest(chanend c_out[], int epNum1, int epNum2) // Another packet to EP 1 means we can exit XUD_GetBuffer(ep_out1, buffer, length); - if(length != i) - { - printintln(length); - fail(FAIL_RX_LENERROR); - } - - if(RxDataCheck(buffer, length, epNum1)) + if(RxDataCheck(buffer, length, epNum1, i)) { fail(FAIL_RX_DATAERROR); } diff --git a/tests/test_shorttoken/src/main.xc b/tests/test_shorttoken/src/main.xc index a9678307..f8643c85 100644 --- a/tests/test_shorttoken/src/main.xc +++ b/tests/test_shorttoken/src/main.xc @@ -37,7 +37,7 @@ int TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_out_0) fail(FAIL_RX_LENERROR); } - if(RxDataCheck(buffer, length, epNum)) + if(RxDataCheck(buffer, length, epNum,i)) { fail(FAIL_RX_DATAERROR); } @@ -58,7 +58,7 @@ int main() XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, - null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); + XUD_SPEED_HS, XUD_PWR_BUS); TestEp_Bulk(c_ep_out[1], c_ep_in[1], 1, c_ep_out[0]); diff --git a/tests/test_sof_badcrc/src/main.xc b/tests/test_sof_badcrc/src/main.xc index 3c9d65a8..058258ce 100644 --- a/tests/test_sof_badcrc/src/main.xc +++ b/tests/test_sof_badcrc/src/main.xc @@ -37,7 +37,7 @@ int TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_out_0, chanend fail(FAIL_RX_LENERROR); } - if(RxDataCheck(buffer, length, epNum)) + if(RxDataCheck(buffer, length, epNum, 10)) { fail(FAIL_RX_DATAERROR); } @@ -60,7 +60,7 @@ int TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_out_0, chanend fail(FAIL_RX_LENERROR); } - if(RxDataCheck(buffer, length, epNum)) + if(RxDataCheck(buffer, length, epNum, 11)) { fail(FAIL_RX_DATAERROR); } diff --git a/tests/test_sof_basic/src/main.xc b/tests/test_sof_basic/src/main.xc index 064cbe2f..01a27567 100644 --- a/tests/test_sof_basic/src/main.xc +++ b/tests/test_sof_basic/src/main.xc @@ -37,7 +37,7 @@ int TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_out_0, chanend fail(FAIL_RX_LENERROR); } - if(RxDataCheck(buffer, length, epNum)) + if(RxDataCheck(buffer, length, epNum, 10)) { fail(FAIL_RX_DATAERROR); } @@ -54,7 +54,7 @@ int TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_out_0, chanend fail(FAIL_RX_LENERROR); } - if(RxDataCheck(buffer, length, epNum)) + if(RxDataCheck(buffer, length, epNum, 11)) { fail(FAIL_RX_DATAERROR); } From f80338546ad0637a9857952100732a47206601d2 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 13 May 2020 11:59:47 +0100 Subject: [PATCH 140/520] Fixes to test_bulk_rx_basic_rxerror --- lib_xud/src/core/XUD_IoLoop.S | 3 - lib_xud/src/core/included/XUD_Token_Out.S | 2 + lib_xud/src/core/included/XUD_Token_Out_DI.S | 2 + tests/test_bulk_rx_basic_rxerror.py | 2 +- tests/test_bulk_rx_basic_rxerror/src/main.xc | 199 ++++--------------- 5 files changed, 48 insertions(+), 160 deletions(-) diff --git a/lib_xud/src/core/XUD_IoLoop.S b/lib_xud/src/core/XUD_IoLoop.S index e2445a40..cebf97ae 100755 --- a/lib_xud/src/core/XUD_IoLoop.S +++ b/lib_xud/src/core/XUD_IoLoop.S @@ -257,8 +257,6 @@ ConfigSofJump: #endif ConfigSofJump_Done: - -#if !defined (__XS3A__) ConfigRxErrEventVector: setc res[r3], XS1_SETC_COND_EQ setc res[r3], XS1_SETC_IE_MODE_INTERRUPT @@ -267,7 +265,6 @@ ConfigRxErrEventVector: ldc r11, 1 setd res[r3], r11 // Set event cond data to 1 eeu res[r3] -#endif #if 0 SetupOutTimer: diff --git a/lib_xud/src/core/included/XUD_Token_Out.S b/lib_xud/src/core/included/XUD_Token_Out.S index e92ccd8d..8f9a4ec4 100755 --- a/lib_xud/src/core/included/XUD_Token_Out.S +++ b/lib_xud/src/core/included/XUD_Token_Out.S @@ -96,7 +96,9 @@ StoreTailDataOut: bu NextTokenAfterOut // Various Error handling functions ------------------------------------------------------------------- +.align 4 Err_RxErr: // RxError signal high during data packet receive: + DUALENTSP_lu 0 clrsr 3 clre ldw r10, sp[15] // Read out data from RxE port diff --git a/lib_xud/src/core/included/XUD_Token_Out_DI.S b/lib_xud/src/core/included/XUD_Token_Out_DI.S index 5def468b..f222a2be 100755 --- a/lib_xud/src/core/included/XUD_Token_Out_DI.S +++ b/lib_xud/src/core/included/XUD_Token_Out_DI.S @@ -53,7 +53,9 @@ StoreTailDataOut: bu NextTokenAfterOut // Various Error handling functions ------------------------------------------------------------------- +.align 4 Err_RxErr: // RxError signal high during data packet receive: + DUALENTSP_lu6 0 clrsr 3 clre ldw r10, sp[STACK_RXE_PORT] // Read out data from RxE port diff --git a/tests/test_bulk_rx_basic_rxerror.py b/tests/test_bulk_rx_basic_rxerror.py index d28dee29..089e31e6 100644 --- a/tests/test_bulk_rx_basic_rxerror.py +++ b/tests/test_bulk_rx_basic_rxerror.py @@ -40,7 +40,7 @@ def do_test(arch, clk, phy, seed): dataval += 11 AppendOutToken(packets, ep, address, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, length=12, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket(timeout=9)) + packets.append(RxHandshakePacket()) dataval += 12 AppendOutToken(packets, ep, address, inter_pkt_gap=6000) diff --git a/tests/test_bulk_rx_basic_rxerror/src/main.xc b/tests/test_bulk_rx_basic_rxerror/src/main.xc index b96e77e4..6717ab5c 100644 --- a/tests/test_bulk_rx_basic_rxerror/src/main.xc +++ b/tests/test_bulk_rx_basic_rxerror/src/main.xc @@ -1,178 +1,65 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved -/* - * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent - * in both directions between the ports. - * - * NOTE: The src/testbenches/ExampleTestbench must have been compiled for this to run without error. - * - */ +// Copyright (c) 2018-2020, XMOS Ltd, All rights reserved #include #include #include #include "xud.h" #include "platform.h" -//#include "test.h" -#include "xc_ptr.h" - -//#error +#include "shared.h" #define XUD_EP_COUNT_OUT 5 #define XUD_EP_COUNT_IN 5 -//extern xc_ptr char_array_to_xc_ptr(const unsigned char a[]); - -/* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, - XUD_EPTYPE_ISO, - XUD_EPTYPE_BUL, - XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; - -void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend ?c_usb_test); - -void exit(int); - -#define FAIL_RX_DATAERROR 0 -#define FAIL_RX_LENERROR 1 - -unsigned fail(int x) -{ - - printstr("\nXCORE: ### FAIL ******"); - switch(x) - { - case FAIL_RX_DATAERROR: - printstr("XCORE RX Data Error\n"); - break; - - case FAIL_RX_LENERROR: - printstr("XCORE RX Length Error\n"); - break; - - } - - exit(1); -} - -unsigned char g_rxDataCheck[5] = {0, 0, 0, 0, 0}; -unsigned char g_txDataCheck[5] = {0,0,0,0,0,}; -unsigned g_txLength[5] = {0,0,0,0,0}; - - -#pragma unsafe arrays -void SendTxPacket(XUD_ep ep, int length, int epNum) -{ - unsigned char buffer[1024]; - unsigned char x; - - for (int i = 0; i < length; i++) - { - buffer[i] = g_txDataCheck[epNum]++; - - //asm("ld8u %0, %1[%2]":"=r"(x):"r"(g_txDataCheck),"r"(epNum)); - // read_byte_via_xc_ptr_indexed(x, p_txDataCheck, epNum); - - //buffer[i] = x; - //x++; - //asm("st8 %0, %1[%2]"::"r"(x),"r"(g_txDataCheck),"r"(epNum)); - //write_byte_via_xc_ptr_indexed(p_txDataCheck,epNum,x); - } - - XUD_SetBuffer(ep, buffer, length); -} - - - - - -//xc_ptr p_rxDataCheck; -//xc_ptr p_txDataCheck; -//xc_ptr p_txLength; +#ifndef PKT_LENGTH_START +#define PKT_LENGTH_START 10 +#endif -#pragma unsafe arrays -int RxDataCheck(unsigned char b[], int l, int epNum) -{ - int fail = 0; - unsigned char x; - - for (int i = 0; i < l; i++) - { - unsigned char y; - //read_byte_via_xc_ptr_indexed(y, p_rxDataCheck, epNum); - if(b[i] != g_rxDataCheck[epNum]) - { - printstr("#### Mismatch on EP: "); - printint(epNum); - printstr(". Got:"); - printhex(b[i]); - printstr(" Expected:"); - printhexln(g_rxDataCheck[epNum]); - //printintln(l); // Packet length - return 1; - } - - g_rxDataCheck[epNum]++; - //read_byte_via_xc_ptr_indexed(x, p_rxDataCheck, epNum); - //x++; - //write_byte_via_xc_ptr_indexed(p_rxDataCheck,epNum,x); - } - - return 0; -} - -int TestEp_Bulk(chanend c_out, chanend c_in, int epNum) -{ - unsigned int length; - XUD_Result_t res; - - XUD_ep ep_out = XUD_InitEp(c_out); - XUD_ep ep_in = XUD_InitEp(c_in); - - /* Buffer for Setup data */ - unsigned char buffer[1024]; - - for(int i = 10; i <= 14; i++) - { - XUD_GetBuffer(ep_out, buffer, length); - - if(length != i) - { - printintln(length); - fail(FAIL_RX_LENERROR); - } - - if(RxDataCheck(buffer, length, epNum)) - { - fail(FAIL_RX_DATAERROR); - } - - } +#ifndef PKT_LENGTH_END +#define PKT_LENGTH_END 14 +#endif - exit(0); -} +#ifndef TEST_EP_NUM +#define TEST_EP_NUM 1 +#endif +/* Endpoint type tables */ +XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; +XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -#define USB_CORE 0 +#ifdef XUD_SIM_RTL +int testmain() +#else int main() +#endif { chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - chan c_sync; - chan c_sync_iso; - - //p_rxDataCheck = char_array_to_xc_ptr(g_rxDataCheck); - //p_txDataCheck = char_array_to_xc_ptr(g_txDataCheck); - //p_txLength = array_to_xc_ptr(g_txLength); - + par { - - XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, - XUD_SPEED_HS, XUD_PWR_BUS); - - //TestEp_Control(c_ep_out[0], c_ep_in[0], 0); + { + #if defined(XUD_TEST_SPEED_FS) + unsigned speed = XUD_SPEED_FS; + #elif defined(XUD_TEST_SPEED_HS) + unsigned speed = XUD_SPEED_HS; + #else + #error XUD_TEST_SPEED_XX not defined + #endif + + XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + null, epTypeTableOut, epTypeTableIn, speed, XUD_PWR_BUS); + } - TestEp_Bulk(c_ep_out[1], c_ep_in[1], 1); + { + unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); + + if(fail) + TerminateFail(fail); + else + TerminatePass(fail); + + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep0); + exit(0); + } } return 0; From 6769d1a23b1188a37d7c1ec51e5aaa4a3f90dd3a Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 13 May 2020 12:24:38 +0100 Subject: [PATCH 141/520] Fix to test_bulk_tx_badack --- tests/test_bulk_tx_badack/src/main.xc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_bulk_tx_badack/src/main.xc b/tests/test_bulk_tx_badack/src/main.xc index 8ad51c10..a7c54daf 100644 --- a/tests/test_bulk_tx_badack/src/main.xc +++ b/tests/test_bulk_tx_badack/src/main.xc @@ -58,7 +58,7 @@ int main() // TODO test is running at 400MHz XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, - null, null, -1, speed, XUD_PWR_BUS); + speed, XUD_PWR_BUS); } { From e1040f0a0601ab35671e760d06f97c9ccb1839bf Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 13 May 2020 17:13:47 +0100 Subject: [PATCH 142/520] Removed duplicate (renamed) test --- tests/test_bulk_tx_basic_noack.py | 60 -------- tests/test_bulk_tx_basic_noack/LICENSE.txt | 135 ------------------ tests/test_bulk_tx_basic_noack/Makefile | 1 - tests/test_bulk_tx_basic_noack/src/main.xc | 107 -------------- tests/test_bulk_tx_basic_noack/src/test.xn | 72 ---------- .../test_bulk_tx_basic_noack/src/test_xs1.xn | 89 ------------ .../test_bulk_tx_basic_noack/src/test_xs2.xn | 72 ---------- .../test_bulk_tx_basic_noack/src/test_xs3.xn | 24 ---- tests/test_bulk_tx_basic_noack/src/xc_ptr.h | 47 ------ 9 files changed, 607 deletions(-) delete mode 100644 tests/test_bulk_tx_basic_noack.py delete mode 100644 tests/test_bulk_tx_basic_noack/LICENSE.txt delete mode 100644 tests/test_bulk_tx_basic_noack/Makefile delete mode 100644 tests/test_bulk_tx_basic_noack/src/main.xc delete mode 100644 tests/test_bulk_tx_basic_noack/src/test.xn delete mode 100755 tests/test_bulk_tx_basic_noack/src/test_xs1.xn delete mode 100644 tests/test_bulk_tx_basic_noack/src/test_xs2.xn delete mode 100644 tests/test_bulk_tx_basic_noack/src/test_xs3.xn delete mode 100644 tests/test_bulk_tx_basic_noack/src/xc_ptr.h diff --git a/tests/test_bulk_tx_basic_noack.py b/tests/test_bulk_tx_basic_noack.py deleted file mode 100644 index 09244c52..00000000 --- a/tests/test_bulk_tx_basic_noack.py +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env python - -import random -import xmostest -from usb_packet import * -from usb_clock import Clock -from helpers import do_usb_test, runall_rx - - -# Single, setup transaction to EP 0 - -def do_test(arch, tx_clk, tx_phy, seed): - rand = random.Random() - rand.seed(seed) - - address = 1 - ep = 2 - - # The inter-frame gap is to give the DUT time to print its output - packets = [] - - dataval = 0; - - AppendInToken(packets, ep, address) - packets.append(RxDataPacket(rand, data_start_val=dataval, length=10, pid=0x3)) #DATA0 - packets.append(TxHandshakePacket()) - - dataval += 10 - AppendInToken(packets, ep, address, inter_pkt_gap=5000) - packets.append(RxDataPacket(rand, data_start_val=dataval, length=11, pid=0xb)) #DATA1 - packets.append(TxHandshakePacket()) - - #pretend CRC got broken on way to host and dont send ACK - dataval += 11 - AppendInToken(packets, ep, address, inter_pkt_gap=5000) - packets.append(RxDataPacket(rand, data_start_val=dataval, length=12, pid=0x3)) #DATA0 - #packets.append(TxHandshakePacket()) - - #xCore should resend same packet again.. - AppendInToken(packets, ep, address, inter_pkt_gap=5000) - packets.append(RxDataPacket(rand, data_start_val=dataval, length=12, pid=0x3)) #DATA0 - packets.append(TxHandshakePacket()) - - dataval += 12 - AppendInToken(packets, ep, address, inter_pkt_gap=5000) - packets.append(RxDataPacket(rand, data_start_val=dataval, length=13, pid=0xb)) #DATA1 - packets.append(TxHandshakePacket()) - - dataval += 13 - AppendInToken(packets, ep, address, inter_pkt_gap=5000) - packets.append(RxDataPacket(rand, data_start_val=dataval, length=14, pid=0x3)) #DATA0 - packets.append(TxHandshakePacket()) - - # Note, quite big gap to allow checking. - do_usb_test(arch, tx_clk, tx_phy, packets, __file__, seed, - level='smoke', extra_tasks=[]) - -def runtest(): - random.seed(1) - runall_rx(do_test) diff --git a/tests/test_bulk_tx_basic_noack/LICENSE.txt b/tests/test_bulk_tx_basic_noack/LICENSE.txt deleted file mode 100644 index 994856c9..00000000 --- a/tests/test_bulk_tx_basic_noack/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_bulk_tx_basic_noack/Makefile b/tests/test_bulk_tx_basic_noack/Makefile deleted file mode 100644 index 6aed3e76..00000000 --- a/tests/test_bulk_tx_basic_noack/Makefile +++ /dev/null @@ -1 +0,0 @@ -include ../test_makefile.mak diff --git a/tests/test_bulk_tx_basic_noack/src/main.xc b/tests/test_bulk_tx_basic_noack/src/main.xc deleted file mode 100644 index 5166b1ae..00000000 --- a/tests/test_bulk_tx_basic_noack/src/main.xc +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved -/* - * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent - * in both directions between the ports. - * - * NOTE: The src/testbenches/ExampleTestbench must have been compiled for this to run without error. - * - */ -#include -#include -#include -#include "xud.h" -#include "platform.h" -#include "xc_ptr.h" - -#define XUD_EP_COUNT_OUT 3 -#define XUD_EP_COUNT_IN 3 - - -/* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, - XUD_EPTYPE_BUL, - XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, - XUD_EPTYPE_BUL, - XUD_EPTYPE_BUL}; - -void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend ?c_usb_test); - -void exit(int); - -#define FAIL_RX_DATAERROR 0 - -unsigned fail(int x) -{ - - printstr("\nXCORE: ### FAIL ******"); - switch(x) - { - case FAIL_RX_DATAERROR: - printstr("XCORE RX Data Error\n"); - - break; - - } - - exit(1); -} - -unsigned char g_rxDataCheck[5] = {0, 0, 0, 0, 0}; -unsigned char g_txDataCheck[5] = {0,0,0,0,0,}; -unsigned g_txLength[5] = {0,0,0,0,0}; - - -#pragma unsafe arrays -void SendTxPacket(XUD_ep ep, int length, int epNum) -{ - unsigned char buffer[1024]; - unsigned char x; - - for (int i = 0; i < length; i++) - { - buffer[i] = g_txDataCheck[epNum]++; - } - - XUD_SetBuffer(ep, buffer, length); -} - -int TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_out_0) -{ - XUD_ep ep_out_0 = XUD_InitEp(c_out_0); - XUD_ep ep_out = XUD_InitEp(c_out); - XUD_ep ep_in = XUD_InitEp(c_in); - - /* Buffer for Setup data */ - unsigned char buffer[1024]; - - for(int i = 10; i <= 14; i++) - { - SendTxPacket(ep_in, i, epNum); - } - - XUD_Kill(ep_out_0); - exit(0); -} - - -#define USB_CORE 0 -int main() -{ - chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - chan c_sync; - chan c_sync_iso; - - par - { - - XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, - XUD_SPEED_HS, XUD_PWR_BUS); - - - TestEp_Bulk(c_ep_out[2], c_ep_in[2], 1, c_ep_out[0]); - } - - return 0; -} diff --git a/tests/test_bulk_tx_basic_noack/src/test.xn b/tests/test_bulk_tx_basic_noack/src/test.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_bulk_tx_basic_noack/src/test.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_tx_basic_noack/src/test_xs1.xn b/tests/test_bulk_tx_basic_noack/src/test_xs1.xn deleted file mode 100755 index 573aef45..00000000 --- a/tests/test_bulk_tx_basic_noack/src/test_xs1.xn +++ /dev/null @@ -1,89 +0,0 @@ - - - - - tileref tile[1] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_tx_basic_noack/src/test_xs2.xn b/tests/test_bulk_tx_basic_noack/src/test_xs2.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_bulk_tx_basic_noack/src/test_xs2.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_tx_basic_noack/src/test_xs3.xn b/tests/test_bulk_tx_basic_noack/src/test_xs3.xn deleted file mode 100644 index 6ea38caf..00000000 --- a/tests/test_bulk_tx_basic_noack/src/test_xs3.xn +++ /dev/null @@ -1,24 +0,0 @@ - - - - tileref tile[2] - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_tx_basic_noack/src/xc_ptr.h b/tests/test_bulk_tx_basic_noack/src/xc_ptr.h deleted file mode 100644 index 28fa6b8b..00000000 --- a/tests/test_bulk_tx_basic_noack/src/xc_ptr.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved -#ifndef __xc_ptr__ -#define __xc_ptr__ - -typedef unsigned int xc_ptr; - -// Note that this function is marked as const to avoid the XC -// parallel usage checks, this is only really going to work if this -// is the *only* way the array a is accessed (and everything else uses -// the xc_ptr) -inline xc_ptr array_to_xc_ptr(const unsigned a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -inline xc_ptr char_array_to_xc_ptr(const unsigned char a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -#define write_via_xc_ptr_indexed(p,i,x) asm volatile("stw %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_short_via_xc_ptr_indexed(p,i,x) asm volatile("st16 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) - -#define write_via_xc_ptr(p,x) asm volatile("stw %0, %1[0]"::"r"(x),"r"(p)) -// No immediate st8 format -#define write_byte_via_xc_ptr(p,x) write_byte_via_xc_ptr_indexed(p, 0, x) -#define write_short_via_xc_ptr(p,x) write_short_via_xc_ptr_indexed(p, 0, x) - -#define read_via_xc_ptr_indexed(x,p,i) asm("ldw %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_byte_via_xc_ptr_indexed(x,p,i) asm("ld8u %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_short_via_xc_ptr_indexed(x,p,i) asm("ld16s %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); - -#define read_via_xc_ptr(x,p) asm("ldw %0, %1[0]":"=r"(x):"r"(p)); -// No immediate ld8u format -#define read_byte_via_xc_ptr(x,p) read_byte_via_xc_ptr_indexed(x, p, 0) -#define read_short_via_xc_ptr(x,p) read_short_via_xc_ptr_indexed(x, p, 0) - -#define GET_SHARED_GLOBAL(x, g) asm volatile("ldw %0, dp[" #g "]":"=r"(x)::"memory") -#define SET_SHARED_GLOBAL(g, v) asm volatile("stw %0, dp[" #g "]"::"r"(v):"memory") - -#endif From 3a27e93446aed30a0d24df6d33874972ad3eec9e Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 13 May 2020 17:13:57 +0100 Subject: [PATCH 143/520] Port define tidy --- lib_xud/api/xud.h | 50 ++++++----------------------------------------- 1 file changed, 6 insertions(+), 44 deletions(-) diff --git a/lib_xud/api/xud.h b/lib_xud/api/xud.h index 1206208b..59ba110d 100644 --- a/lib_xud/api/xud.h +++ b/lib_xud/api/xud.h @@ -38,48 +38,8 @@ #define XUD_CORE_CLOCK (700) #endif -#if defined(PORT_USB_CLK) - /* Ports declared in the .xn file. Automatically detect device series */ - #if defined(PORT_USB_RX_READY) - #if !defined(XUD_SERIES_SUPPORT) - #define XUD_SERIES_SUPPORT XUD_U_SERIES - #endif - -#if (XUD_SERIES_SUPPORT != XUD_U_SERIES) && (XUD_SERIES_SUPPORT != XUD_X200_SERIES) - #error (XUD_SERIES_SUPPORT != XUD_U_SERIES) with PORT_USB_RX_READY defined - #endif - - #else - #if !defined(XUD_SERIES_SUPPORT) - #define XUD_SERIES_SUPPORT XUD_L_SERIES - #endif - -#if (XUD_SERIES_SUPPORT != XUD_L_SERIES) && (XUD_SERIES_SUPPORT != XUD_G_SERIES) && (XUD_SERIES_SUPPORT != XUD_X200_SERIES) - #error (XUD_SERIES_SUPPORT != XUD_L_SERIES) when PORT_USB_RX_READY not defined - #endif - - #endif - -#else // PORT_USB_CLK - - #if !defined(XUD_SERIES_SUPPORT) - // Default to U-Series if no series is defined - #define XUD_SERIES_SUPPORT XUD_U_SERIES - #endif - - /* Ports have not been defined in the .xn file */ - #if defined (__XS1B__) -#error - #define PORT_USB_CLK on USB_TILE: XS1_PORT_1J - #define PORT_USB_TXD on USB_TILE: XS1_PORT_8A - #define PORT_USB_RXD on USB_TILE: XS1_PORT_8C - #define PORT_USB_TX_READYOUT on USB_TILE: XS1_PORT_1K - #define PORT_USB_TX_READYIN on USB_TILE: XS1_PORT_1H - #define PORT_USB_RX_READY on USB_TILE: XS1_PORT_1M - #define PORT_USB_FLAG0 on USB_TILE: XS1_PORT_1N - #define PORT_USB_FLAG1 on USB_TILE: XS1_PORT_1O - #define PORT_USB_FLAG2 on USB_TILE: XS1_PORT_1P - #else // __XS3A__ and __XS2A__ +#if !defined(PORT_USB_CLK) + /* Ports have not been defined in the .xn file */ #define PORT_USB_CLK on USB_TILE: XS1_PORT_1J #define PORT_USB_TXD on USB_TILE: XS1_PORT_8A #define PORT_USB_RXD on USB_TILE: XS1_PORT_8B @@ -88,8 +48,10 @@ #define PORT_USB_RX_READY on USB_TILE: XS1_PORT_1I #define PORT_USB_FLAG0 on USB_TILE: XS1_PORT_1E #define PORT_USB_FLAG1 on USB_TILE: XS1_PORT_1F - #define PORT_USB_FLAG2 on USB_TILE: XS1_PORT_1G - #endif + #ifdef __XS2A__ + /* XS2A has an additional flag port */ + #define PORT_USB_FLAG2 on USB_TILE: XS1_PORT_1G + #endif #endif // PORT_USB_CLK /** From 15b9e55d8d8403302434caca8b11581a4da8f53a Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 13 May 2020 17:14:40 +0100 Subject: [PATCH 144/520] Fix test_bulk_tx_noack test fail for XS3A --- lib_xud/src/core/XUD_IoLoop.S | 14 ++++++++------ lib_xud/src/core/XUD_Main.xc | 6 +++--- lib_xud/src/core/included/XUD_Token_In_DI.S | 10 +++++----- tests/test_bulk_tx_noack/src/main.xc | 2 +- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/lib_xud/src/core/XUD_IoLoop.S b/lib_xud/src/core/XUD_IoLoop.S index cebf97ae..13c75962 100755 --- a/lib_xud/src/core/XUD_IoLoop.S +++ b/lib_xud/src/core/XUD_IoLoop.S @@ -184,12 +184,12 @@ SaveStackPointer: ldw r11, cp[suspendTimeout] stw r11, sp[STACK_SUSPEND_TIMEOUT] -ConfigRxDEventVector: // Configure events +ConfigRxDEventVector: // Configure event on RXD port for receiveing a handshake after Tx setc res[RXD], XS1_SETC_IE_MODE_EVENT ldap r11, TxHandShakeReceived setv res[RXD], r11 -ConfigRxA: +ConfigRxA: // Configure a event on RXA going low, used during packet reception setc res[RXA], XS1_SETC_COND_EQ setc res[RXA], XS1_SETC_IE_MODE_EVENT ldc r11, 0 @@ -198,13 +198,15 @@ ConfigRxA: setv res[RXA], r11 eeu res[RXA] -#ifdef __XS2A__ ConfigValidToken: - ldw r10, sp[STACK_VTOK_PORT] +#ifdef __XS2A__ + ldw r10, sp[STACK_VTOK_PORT] // ValidToken is used for timing timeout period when expecting an ack after tx +#else + ldw r10, dp[rx_rdy] // TODO use from stack +#endif setc res[r10], XS1_SETC_COND_NONE - ldap r11, TxHandshakeTimeOut // ValidToken is used for timing timeout period when expecting an ack after tx + ldap r11, TxHandshakeTimeOut setv res[r10], r11 -#endif #ifndef XUD_TEST_MODE_SUPPORT_DISABLED SetupUsbTestMode: diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index d5f50301..fe55ade6 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -30,7 +30,6 @@ void XUD_Error_hex(char errString[], int i_err); #if (USB_MAX_NUM_EP_IN != 16) #error USB_MAX_NUM_EP_IN must be 16! #endif - #if (USB_MAX_NUM_EP_OUT != 16) #error USB_MAX_NUM_EP_OUT must be 16! #endif @@ -216,8 +215,8 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c // Xevious needed asm as non-standard usage (to avoid clogging 1-bit ports) // GLX uses 1bit ports so shouldn't be needed. // Handshaken ports need USB clock - configure_clock_src (tx_usb_clk, p_usb_clk); - configure_clock_src (rx_usb_clk, p_usb_clk); + configure_clock_src(tx_usb_clk, p_usb_clk); + configure_clock_src(rx_usb_clk, p_usb_clk); //this along with the following delays forces the clock //to the ports to be effectively controlled by the @@ -251,6 +250,7 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c configure_out_port_handshake(p_usb_txd, tx_readyin, tx_readyout, tx_usb_clk, 0); configure_in_port_strobed_slave(p_usb_rxd, rx_rdy, rx_usb_clk); + /* Clock RxA port from USB clock - helps fall event */ configure_in_port(flag1_port, rx_usb_clk); unsigned noExit = 1; diff --git a/lib_xud/src/core/included/XUD_Token_In_DI.S b/lib_xud/src/core/included/XUD_Token_In_DI.S index b38d1ca9..8e9b4d56 100755 --- a/lib_xud/src/core/included/XUD_Token_In_DI.S +++ b/lib_xud/src/core/included/XUD_Token_In_DI.S @@ -92,18 +92,18 @@ SetupReceiveHandShake: setpsc res[RXD], r11 // Set port shift count (expect 8 bit handshake) eeu res[RXD] // Events on RXD always enabled - Can;t be any more due to using events on channels +SetupTimeout: // Timeout done using another port we dont happen to already be using events on. Cunning. #ifdef __XS2A__ -SetupTimeout: // Timeout done using another port off same clock block we dont happen to already be using events on. Cunning. - ldw r1, sp[STACK_VTOK_PORT] // Load saved ValidToken port. Event vector already set. + ldw r1, sp[STACK_VTOK_PORT] // Load saved ValidToken port. Event vector already set. +#else + ldw r1, dp[rx_rdy] // TODO load from stack +#endif in r11, res[r1] // Do input and get port time/timestamps getts r11, res[r1] ldw r9, dp[g_txHandshakeTimeout] add r11, r11, r9 setpt res[r1], r11 // Set port time and enable events eeu res[r1] -#else -#warning XS3 doesntnot have handshake timeout implemented -#endif WaitForHandshake: // Wait for timeout or handshake .xtabranch TxHandshakeTimeOut, TxHandShakeReceived diff --git a/tests/test_bulk_tx_noack/src/main.xc b/tests/test_bulk_tx_noack/src/main.xc index 8ad51c10..a7c54daf 100644 --- a/tests/test_bulk_tx_noack/src/main.xc +++ b/tests/test_bulk_tx_noack/src/main.xc @@ -58,7 +58,7 @@ int main() // TODO test is running at 400MHz XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, - null, null, -1, speed, XUD_PWR_BUS); + speed, XUD_PWR_BUS); } { From 28a9e9c20fac5fec0d208ac0a8003565c9f74ad3 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 14 May 2020 10:12:58 +0100 Subject: [PATCH 145/520] Fixed portime not being cleared on tx handshake (XS3 only) --- lib_xud/src/core/included/XUD_Token_In_DI.S | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib_xud/src/core/included/XUD_Token_In_DI.S b/lib_xud/src/core/included/XUD_Token_In_DI.S index 8e9b4d56..ddf9e836 100755 --- a/lib_xud/src/core/included/XUD_Token_In_DI.S +++ b/lib_xud/src/core/included/XUD_Token_In_DI.S @@ -121,10 +121,7 @@ TxHandshakeTimeOut: TxHandShakeReceived: XUD_IN_RxAck: in r11, res[RXD] // Input data from RXD port -#ifdef __XS2A__ - #warning needs addressing for XS3A as part of the handshake timeout clrpt res[r1] // Clear port time on valid token port -#endif {edu res[RXD]; shr r11, r11, 24} // Shift off junk data to leave ACK #if defined(__XS2A__) || defined(__XS1B__) From 21728ca22d3073c4da00ee6bf912cb18619ac1cd Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 14 May 2020 14:38:00 +0100 Subject: [PATCH 146/520] Test and close down tidy ups --- lib_xud/src/core/XUD_IoLoop.S | 22 +++-- tests/shared_src/shared.h | 107 ++++++++--------------- tests/test_control_basic_get/src/main.xc | 25 +++--- tests/test_ping_rx_basic/src/main.xc | 46 ++++------ tests/test_sof_badcrc/src/main.xc | 29 +++--- tests/test_sof_basic/src/main.xc | 30 ++++--- 6 files changed, 120 insertions(+), 139 deletions(-) diff --git a/lib_xud/src/core/XUD_IoLoop.S b/lib_xud/src/core/XUD_IoLoop.S index 13c75962..4dc19097 100755 --- a/lib_xud/src/core/XUD_IoLoop.S +++ b/lib_xud/src/core/XUD_IoLoop.S @@ -113,9 +113,6 @@ ResetIntHandler: ldw r10, dp[SavedSp] // Restore stack pointer set sp, r10 - ldw r11, sp[STACK_RXE_PORT] // Put RxE back to events.. - setc res[r11], XS1_SETC_IE_MODE_EVENT // Set IE mode back to events - ldc r0, 1 // Load non-zero (zero is kill) bu Return @@ -340,23 +337,32 @@ Pid_MData: Pid_Datam: Pid_Data0: Pid_Data1: -Pid_Bad: // Bad PID received, ignore +Pid_Bad: // Bad PID received, ignore XUD_InvalidToken: - ldw r10, sp[STACK_RXA_PORT] // Load RxA Port ID (r1) + ldw r10, sp[STACK_RXA_PORT] // Load RxA Port ID (r1) XUD_InvalidTok_waitforRXALow: in r11, res[r10] bt r11, XUD_InvalidTok_waitforRXALow setc res[RXD], XS1_SETC_RUN_CLRBUF - bu Loop_BadPid // Invalid token received Ignore unknown toks + bu Loop_BadPid // Invalid token received Ignore unknown toks .align 4 Return: - ldw r11, sp[14] // Free suspend/reset timer + clre + ldw r11, sp[STACK_SUSPEND_TIMER] // Free suspend/reset timer edu res[r11] freer res[r11] - ldw r4, sp[1] // Register restore + ldw r11, sp[STACK_RXE_PORT] // Put RxE IE mode back to events.. + setc res[r11], XS1_SETC_COND_NONE + edu res[r11] + setc res[r11], XS1_SETC_IE_MODE_EVENT + + ldw r11, sp[STACK_RXA_PORT] + edu res[r11] + + ldw r4, sp[1] // Register restore ldw r5, sp[2] ldw r6, sp[3] ldw r7, sp[4] diff --git a/tests/shared_src/shared.h b/tests/shared_src/shared.h index 75d4b243..9e3dfaf5 100644 --- a/tests/shared_src/shared.h +++ b/tests/shared_src/shared.h @@ -1,4 +1,9 @@ -// Copyright (c) 2016-2019, XMOS Ltd, All rights reserved +// Copyright (c) 2016-2020, XMOS Ltd, All rights reserved +#include +#include +#include +#include +#include "xud.h unsigned char g_rxDataCheck_[16] = {0}; unsigned char g_txDataCheck_[16] = {0}; @@ -12,13 +17,43 @@ unsafe void exit(int); +#define FAIL_RX_DATAERROR 1 +#define FAIL_RX_LENERROR 2 +#define FAIL_RX_EXPECTED_CTL 3 +#define FAIL_RX_BAD_RETURN_CODE 4 +#define FAIL_RX_FRAMENUMBER 5 + #ifdef XUD_SIM_XSIM +/* Alternatives to the RTL sim testbench functions */ void TerminateFail(unsigned x) { - printstr("FAIL\n"); + switch(x) + { + case FAIL_RX_DATAERROR: + printstr("\nXCORE: ### FAIL ### : XCORE RX Data Error\n"); + break; + + case FAIL_RX_LENERROR: + printstr("\nXCORE: ### FAIL ### : XCORE RX Length Error\n"); + break; + + case FAIL_RX_EXPECTED_CTL: + printstr("\nXCORE: ### FAIL ### : Expected a setup\n"); + break; + + case FAIL_RX_BAD_RETURN_CODE: + printstr("\nXCORE: ### FAIL ### : Unexpected return code\n"); + break; + + case FAIL_RX_FRAMENUMBER: + printstr("\nXCORE: ### FAIL ### : Received bad frame number\n"); + break; + } + exit(x); } void TerminatePass(unsigned x) { + exit(0); } #endif @@ -91,41 +126,6 @@ int TestEp_Tx(chanend c_in, int epNum1, unsigned start, unsigned end, t_runMode while(1); } - -#define FAIL_RX_DATAERROR 0 -#define FAIL_RX_LENERROR 1 -#define FAIL_RX_EXPECTED_CTL 2 -#define FAIL_RX_BAD_RETURN_CODE 3 -#define FAIL_RX_FRAMENUMBER 4 - -unsigned fail(int x) -{ - switch(x) - { - case FAIL_RX_DATAERROR: - printstr("\nXCORE: ### FAIL ### : XCORE RX Data Error\n"); - break; - - case FAIL_RX_LENERROR: - printstr("\nXCORE: ### FAIL ### : XCORE RX Length Error\n"); - break; - - case FAIL_RX_EXPECTED_CTL: - printstr("\nXCORE: ### FAIL ### : Expected a setup\n"); - break; - - case FAIL_RX_BAD_RETURN_CODE: - printstr("\nXCORE: ### FAIL ### : Unexpcected return code\n"); - break; - - case FAIL_RX_FRAMENUMBER: - printstr("\nXCORE: ### FAIL ### : Received bad frame number\n"); - break; - } - - exit(1); -} - #pragma unsafe arrays int RxDataCheck(unsigned char b[], int l, int epNum, unsigned expectedLength) { @@ -192,36 +192,3 @@ int TestEp_Rx(chanend c_out, int epNum, int start, int end) return 0; } -#if 0 -int TestEp_Rx(chanend c_out[], int epNum, unsigned start, unsigned end) -{ - unsigned int length; - XUD_Result_t res; - - XUD_ep ep_out_0 = XUD_InitEp(c_out[0]); - XUD_ep ep_out = XUD_InitEp(c_out[epNum]); - - /* Buffer for Setup data */ - unsigned char buffer[1024]; - - for(int i = start; i <= end; i++) - { - XUD_GetBuffer(ep_out, buffer, length); - - if(length != i) - { - printintln(length); - fail(FAIL_RX_LENERROR); - } - - if(RxDataCheck(buffer, length, epNum)) - { - fail(FAIL_RX_DATAERROR); - } - - } - - XUD_Kill(ep_out_0); - exit(0); -} -#endif diff --git a/tests/test_control_basic_get/src/main.xc b/tests/test_control_basic_get/src/main.xc index edc0e9dd..ca974210 100644 --- a/tests/test_control_basic_get/src/main.xc +++ b/tests/test_control_basic_get/src/main.xc @@ -29,16 +29,14 @@ XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, X /* Out EP Should receive some data, perform some test process (crc or similar) to check okay */ /* Answers should be responded to in the IN ep */ -int TestEp_Control(chanend c_out, chanend c_in, int epNum) + +int TestEp_Control(XUD_ep c_ep0_out, XUD_ep c_ep0_in, int epNum) { unsigned int slength; unsigned int length; XUD_Result_t sres; XUD_Result_t res; - XUD_ep c_ep0_out = XUD_InitEp(c_out); - XUD_ep c_ep0_in = XUD_InitEp(c_in); - /* Buffer for Setup data */ unsigned char sbuffer[120]; unsigned char buffer[120]; @@ -54,21 +52,19 @@ int TestEp_Control(chanend c_out, chanend c_in, int epNum) if(length != 0) { - fail(FAIL_RX_DATAERROR); + return FAIL_RX_DATAERROR; } /* Do some checking */ if(res != XUD_RES_OKAY) { - fail(FAIL_RX_BAD_RETURN_CODE); + return FAIL_RX_BAD_RETURN_CODE; } if(RxDataCheck(sbuffer, slength, epNum, 8)) { - fail(FAIL_RX_DATAERROR); + return FAIL_RX_DATAERROR; } - - XUD_Kill(c_ep0_out); return 0; } @@ -81,19 +77,22 @@ int main() par { - XUD_Manager( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Manager(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); { - int fail = TestEp_Control(c_ep_out[0], c_ep_in[0], 0); + XUD_ep c_ep0_out = XUD_InitEp(c_ep_out[0]); + XUD_ep c_ep0_in = XUD_InitEp(c_ep_in[0]); + + int fail = TestEp_Control(c_ep0_out, c_ep0_in, 0); + XUD_Kill(c_ep0_out); + if(fail) TerminateFail(fail); else TerminatePass(fail); - - exit(0); } } diff --git a/tests/test_ping_rx_basic/src/main.xc b/tests/test_ping_rx_basic/src/main.xc index a00f679a..97fa8856 100644 --- a/tests/test_ping_rx_basic/src/main.xc +++ b/tests/test_ping_rx_basic/src/main.xc @@ -1,18 +1,4 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved -/* - * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent - * in both directions between the ports. - * - * NOTE: The src/testbenches/ExampleTestbench must have been compiled for this to run without error. - * - */ -#include -#include -#include -#include "xud.h" -#include "platform.h" -#include "xc_ptr.h" - +// Copyright (c) 2016-2020, XMOS Ltd, All rights reserved #include "shared.h" #define XUD_EP_COUNT_OUT 5 @@ -22,14 +8,10 @@ XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; - -int TestEp_PingTest(chanend c_out[], int epNum1, int epNum2) +int TestEp_PingTest(XUD_ep ep_out1, XUD_ep ep_out2, int epNum1, int epNum2) { unsigned int length; - XUD_ep ep_out1 = XUD_InitEp(c_out[epNum1]); - XUD_ep ep_out2 = XUD_InitEp(c_out[epNum2]); - /* Buffer for Setup data */ unsigned char buffer[1024]; @@ -39,7 +21,7 @@ int TestEp_PingTest(chanend c_out[], int epNum1, int epNum2) if(RxDataCheck(buffer, length, epNum1, i)) { - fail(FAIL_RX_DATAERROR); + return FAIL_RX_DATAERROR; } } @@ -48,7 +30,7 @@ int TestEp_PingTest(chanend c_out[], int epNum1, int epNum2) if(RxDataCheck(buffer, length, epNum2, i)) { - fail(FAIL_RX_DATAERROR); + return FAIL_RX_DATAERROR; } // Another packet to EP 1 means we can exit @@ -56,12 +38,14 @@ int TestEp_PingTest(chanend c_out[], int epNum1, int epNum2) if(RxDataCheck(buffer, length, epNum1, i)) { - fail(FAIL_RX_DATAERROR); + return FAIL_RX_DATAERROR; } return 0; } +#define TEST_EP1 1 +#define TEST_EP2 2 int main() { @@ -74,10 +58,18 @@ int main() XUD_SPEED_HS, XUD_PWR_BUS); { - TestEp_PingTest(c_ep_out, 1, 2); - XUD_ep ep_out_0 = XUD_InitEp(c_ep_out[0]); - XUD_Kill(ep_out_0); - exit(0); + XUD_ep ep_out1 = XUD_InitEp(c_ep_out[TEST_EP1]); + XUD_ep ep_out2 = XUD_InitEp(c_ep_out[TEST_EP2]); + + unsigned fail = TestEp_PingTest(ep_out1, ep_out2, TEST_EP1, TEST_EP2); + + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep0); + + if(fail) + TerminateFail(fail); + else + TerminatePass(fail); } } diff --git a/tests/test_sof_badcrc/src/main.xc b/tests/test_sof_badcrc/src/main.xc index 058258ce..8c523720 100644 --- a/tests/test_sof_badcrc/src/main.xc +++ b/tests/test_sof_badcrc/src/main.xc @@ -15,12 +15,11 @@ XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, X void exit(int); -int TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_out_0, chanend c_sof) +int TestEp(chanend c_out, chanend c_in, int epNum, chanend c_sof) { unsigned int length; XUD_Result_t res; - XUD_ep ep_out_0 = XUD_InitEp(c_out_0); XUD_ep ep_out = XUD_InitEp(c_out); XUD_ep ep_in = XUD_InitEp(c_in); @@ -34,12 +33,12 @@ int TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_out_0, chanend if(length != 10) { printintln(length); - fail(FAIL_RX_LENERROR); + return FAIL_RX_LENERROR; } if(RxDataCheck(buffer, length, epNum, 10)) { - fail(FAIL_RX_DATAERROR); + return FAIL_RX_DATAERROR; } /* Receive SOFs */ @@ -57,12 +56,12 @@ int TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_out_0, chanend if(length != 11) { printintln(length); - fail(FAIL_RX_LENERROR); + return FAIL_RX_LENERROR; } if(RxDataCheck(buffer, length, epNum, 11)) { - fail(FAIL_RX_DATAERROR); + return FAIL_RX_DATAERROR; } unsigned expectedFrame = 52; @@ -79,12 +78,11 @@ int TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_out_0, chanend printintln(i+expectedFrame); printstr("Received: "); printintln(frames[i]); - fail(FAIL_RX_FRAMENUMBER); + return FAIL_RX_FRAMENUMBER; } } - XUD_Kill(ep_out_0); - exit(0); + return 0; } @@ -100,8 +98,19 @@ int main() c_sof, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); + { + unsigned fail = TestEp(c_ep_out[1], c_ep_in[1], 1, c_sof); + + if(fail) + TerminateFail(fail); + else + TerminatePass(fail); + + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep0); + exit(0); - TestEp_Bulk(c_ep_out[1], c_ep_in[1], 1, c_ep_out[0], c_sof); + } } return 0; diff --git a/tests/test_sof_basic/src/main.xc b/tests/test_sof_basic/src/main.xc index 01a27567..7f018c7d 100644 --- a/tests/test_sof_basic/src/main.xc +++ b/tests/test_sof_basic/src/main.xc @@ -15,12 +15,11 @@ XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, X void exit(int); -int TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_out_0, chanend c_sof) +unsigned TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_sof) { unsigned int length; XUD_Result_t res; - XUD_ep ep_out_0 = XUD_InitEp(c_out_0); XUD_ep ep_out = XUD_InitEp(c_out); XUD_ep ep_in = XUD_InitEp(c_in); @@ -34,12 +33,12 @@ int TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_out_0, chanend if(length != 10) { printintln(length); - fail(FAIL_RX_LENERROR); + return FAIL_RX_LENERROR; } if(RxDataCheck(buffer, length, epNum, 10)) { - fail(FAIL_RX_DATAERROR); + return FAIL_RX_DATAERROR; } /* Receive SOFs */ @@ -51,12 +50,12 @@ int TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_out_0, chanend if(length != 11) { printintln(length); - fail(FAIL_RX_LENERROR); + return FAIL_RX_LENERROR; } if(RxDataCheck(buffer, length, epNum, 11)) { - fail(FAIL_RX_DATAERROR); + return FAIL_RX_DATAERROR; } unsigned expectedFrame = 52; @@ -68,15 +67,13 @@ int TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_out_0, chanend { printhexln(i); printhexln(frames[i]); - fail(FAIL_RX_FRAMENUMBER); + return FAIL_RX_FRAMENUMBER; } } - XUD_Kill(ep_out_0); - exit(0); + return 0; } - int main() { chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; @@ -89,8 +86,19 @@ int main() c_sof, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); + { + unsigned fail = TestEp_Bulk(c_ep_out[1], c_ep_in[1], 1, c_sof); + + if(fail) + TerminateFail(fail); + else + TerminatePass(fail); + + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep0); + exit(0); - TestEp_Bulk(c_ep_out[1], c_ep_in[1], 1, c_ep_out[0], c_sof); + } } return 0; From d49479b00066e227b1b1d23ede8cfad548bc36ee Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 15 Jul 2020 17:42:11 +0100 Subject: [PATCH 147/520] Removed some now defunct ifdefs --- lib_xud/src/user/client/XUD_EpFuncs.S | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/lib_xud/src/user/client/XUD_EpFuncs.S b/lib_xud/src/user/client/XUD_EpFuncs.S index 57d90f82..3228ce30 100644 --- a/lib_xud/src/user/client/XUD_EpFuncs.S +++ b/lib_xud/src/user/client/XUD_EpFuncs.S @@ -15,14 +15,10 @@ .globl XUD_GetSetupData .type XUD_GetSetupData, @function .cc_top XUD_GetSetupData.func +.issue_mode single .align 4 XUD_GetSetupData: -#if defined(__XS2A__) || defined(__XS3A__) -.issue_mode single - ENTSP_lu6 4 -#else - entsp 4 -#endif + ENTSP_lu6 4 stw r4, sp[1] stw r10, sp[2] @@ -575,12 +571,10 @@ XUD_SetStallByAddr_OUT: /* R0: ep number */ .cc_top XUD_ClearStallByAddr.func +.issue_mode single .align 4 XUD_ClearStallByAddr: -#if defined(__XS2A__) || defined (__XS3A__) -.issue_mode single - ENTSP_lu6 0 -#endif + ENTSP_lu6 0 ldc r2, USB_PIDn_NAK ldc r11, 0x80 // Check for IN bit and r11, r11, r0 From 6397496435edb59b145255546d7861ff722d6528 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 15 Jul 2020 17:42:54 +0100 Subject: [PATCH 148/520] Fix to test_bulk_rx_basic build --- tests/test_bulk_rx_basic/src/main.xc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/test_bulk_rx_basic/src/main.xc b/tests/test_bulk_rx_basic/src/main.xc index cc82ad96..3ff7a1d0 100644 --- a/tests/test_bulk_rx_basic/src/main.xc +++ b/tests/test_bulk_rx_basic/src/main.xc @@ -45,8 +45,7 @@ int main() #endif XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, - null, null, -1, speed, XUD_PWR_BUS); + null, epTypeTableOut, epTypeTableIn, speed, XUD_PWR_BUS); } { From ddd1ae14b80290c282facd13d0cbe340c74c0695 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 25 Aug 2020 12:12:46 +0100 Subject: [PATCH 149/520] Fixes to test modes --- lib_xud/src/core/XUD_TestMode.xc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_xud/src/core/XUD_TestMode.xc b/lib_xud/src/core/XUD_TestMode.xc index 61331bf7..df5bc80b 100644 --- a/lib_xud/src/core/XUD_TestMode.xc +++ b/lib_xud/src/core/XUD_TestMode.xc @@ -54,12 +54,16 @@ int XUD_UsbTestModeHandler(unsigned cmd) break; case USB_WINDEX_TEST_SE0_NAK: + + XUD_HAL_EnterMode_PeripheralHighSpeed() + /* Drop into asm to deal with this mode */ XUD_UsbTestSE0(); break; case USB_WINDEX_TEST_PACKET: { + XUD_HAL_EnterMode_PeripheralHighSpeed() // Repetitively transmit specific test packet forever. // Timings must still meet minimum interpacket gap // Have to relate KJ pairings to data. From b7c61224381dde1cc7107d0cacea3db0c3439334 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 25 Aug 2020 12:13:11 +0100 Subject: [PATCH 150/520] Remove reply to TEST_FORCE_ENABLE test mode (hubs only) --- lib_xud/src/user/control/xud_device.xc | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_xud/src/user/control/xud_device.xc b/lib_xud/src/user/control/xud_device.xc index 2c42678e..7aba0efb 100644 --- a/lib_xud/src/user/control/xud_device.xc +++ b/lib_xud/src/user/control/xud_device.xc @@ -201,7 +201,6 @@ XUD_Result_t USB_StandardRequests(XUD_ep ep_out, XUD_ep ep_in, case USB_WINDEX_TEST_K: case USB_WINDEX_TEST_SE0_NAK: case USB_WINDEX_TEST_PACKET: - case USB_WINDEX_TEST_FORCE_ENABLE: { XUD_Result_t result; if((result = XUD_DoSetRequestStatus(ep_in)) != XUD_RES_OKAY) From 91754351081bf835f7310b30a969b57ae447589e Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 25 Aug 2020 12:21:35 +0100 Subject: [PATCH 151/520] Added __app_test_mode application. Provides standalone binaries for USB test modes. For use in device test & characterisation. --- .gitignore | 3 +- __app_test_mode/LICENSE.txt | 135 ++++++++++++++++++ __app_test_mode/Makefile | 40 ++++++ __app_test_mode/README.rst | 21 +++ .../src/XCORE-AI-EXPLORER-NO-DDR.xn | 60 ++++++++ __app_test_mode/src/XCORE-AI-EXPLORER.xn | 60 ++++++++ __app_test_mode/src/main.xc | 29 ++++ lib_xud/src/core/XUD_TestMode.xc | 3 - lib_xud/src/user/control/xud_device.xc | 1 + 9 files changed, 348 insertions(+), 4 deletions(-) create mode 100644 __app_test_mode/LICENSE.txt create mode 100644 __app_test_mode/Makefile create mode 100644 __app_test_mode/README.rst create mode 100644 __app_test_mode/src/XCORE-AI-EXPLORER-NO-DDR.xn create mode 100644 __app_test_mode/src/XCORE-AI-EXPLORER.xn create mode 100644 __app_test_mode/src/main.xc diff --git a/.gitignore b/.gitignore index 5fe6751c..cb2062d6 100644 --- a/.gitignore +++ b/.gitignore @@ -27,4 +27,5 @@ sphinx.output Installs/ .settings tests/bin.txt -tests/log \ No newline at end of file +tests/log +__app_test_mode/xscope.xmt.gtkw \ No newline at end of file diff --git a/__app_test_mode/LICENSE.txt b/__app_test_mode/LICENSE.txt new file mode 100644 index 00000000..e27716f4 --- /dev/null +++ b/__app_test_mode/LICENSE.txt @@ -0,0 +1,135 @@ +Software Release License Agreement + +Copyright (c) 2015-2017, XMOS, All rights reserved. + +BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. + +Parties: + +(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). + +(2) An individual or legal entity exercising permissions granted by this License (Customer). + +If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. + +1. Definitions + +"License" means this Software License and any schedules or annexes to it. + +"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License + +"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. + +"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. + +"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. + +"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. + +The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. + +Unless the context otherwise requires: + +- references to XMOS and the Customer include their permitted successors and assigns; +- references to statutory provisions include those statutory provisions as amended or re-enacted; and +- references to any gender include all genders. + +Words in the singular include the plural and in the plural include the singular. + +2. License + +XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. + +Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. + +3. Consideration + +In consideration of the mutual obligations contained in this License, the parties agree to its terms. + +4. Term + +Subject to clause 12 below, this License shall be perpetual. + +5. Restrictions on Use + +The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. + +6. Modifications + +The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. + +XMOS will own all intellectual property rights in the XMOS Modifications. +The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. + +7. Support + +Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. + +8. Warranty and Disclaimer + +The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). + +Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. + +XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. + +9. High Risk Activities + +The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. + +10. Liability + +TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. + +Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. + +11. Ownership + +The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. + +12. Termination + +Either party may terminate this License at any time on written notice to the other if the other: + +- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or + +- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. + +Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. + +On termination for any reason: + +- all rights granted to the Customer under this License shall cease; +- the Customer shall cease all activities authorised by this License; +- the Customer shall immediately pay any sums due to XMOS under this License; and +- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. + +Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. + +13. Third party rights + +No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. + +14. Confidentiality and publicity + +Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. + +The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. +The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. + +15. Entire agreement + +This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. + +16. Assignment + +The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. + +17. Governing law and jurisdiction + +This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. + +This License has been entered into on the date stated at the beginning of it. + +Schedule +XMOS application note AN00129 software diff --git a/__app_test_mode/Makefile b/__app_test_mode/Makefile new file mode 100644 index 00000000..aab8562b --- /dev/null +++ b/__app_test_mode/Makefile @@ -0,0 +1,40 @@ +# The TARGET variable determines what target system the application is +# compiled for. It either refers to an XN file in the source directories +# or a valid argument for the --target option when compiling. + +# In this case, the target depends on the build configuration. +TARGET = XCORE-AI-EXPLORER-NO-DDR.xn + +# The APP_NAME variable determines the name of the final .xe file. It should +# not include the .xe postfix. If left blank the name will default to +# the project name +APP_NAME = app_test_mode + +# The flags passed to xcc when building the application +# You can also set the following to override flags for a particular language: +# +# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS +# +# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to +# xcc for the final link (mapping) stage. + +# These flags define two build configurations - one for U-series and one for +# the xCORE-200 series. + +FLAGS_COMMON = -O3 -report -save-temps -DXUD_BYPASS_RESET -DXUD_TEST_SPEED_HS +XCC_FLAGS_TEST_J = $(FLAGS_COMMON) -DTEST_MODE=USB_WINDEX_TEST_J +XCC_FLAGS_TEST_K = $(FLAGS_COMMON) -DTEST_MODE=USB_WINDEX_TEST_K +XCC_FLAGS_TEST_SE0_NAK = $(FLAGS_COMMON) -DTEST_MODE=USB_WINDEX_TEST_SE0_NAK +XCC_FLAGS_TEST_PACKET = $(FLAGS_COMMON) -DTEST_MODE=USB_WINDEX_TEST_PACKET + +# The USED_MODULES variable lists other module used by the application. +USED_MODULES = lib_xud + +#============================================================================= +# The following part of the Makefile includes the common build infrastructure +# for compiling XMOS applications. You should not need to edit below here. + +XMOS_MAKE_PATH ?= ../.. +include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common + + diff --git a/__app_test_mode/README.rst b/__app_test_mode/README.rst new file mode 100644 index 00000000..697a2327 --- /dev/null +++ b/__app_test_mode/README.rst @@ -0,0 +1,21 @@ +app_test_mode +============= + + +Summary +------- + +This application stand-alone binaries for USB test modes. There are four build configurations, one for each USB test modes: + + - Test_SE0_NAK + - Test_J + - Test_K + - Test_Packet + +The application enters it's respective test mode from boot, this removing the requirement to set the mode from a host via the USBHSETT tool. + +Note, you not shouild expect the the device to appear on any USB bus and its probabky not advisable to plug into any standard host. + +This binaries are most commonly used in device characterisation. + + diff --git a/__app_test_mode/src/XCORE-AI-EXPLORER-NO-DDR.xn b/__app_test_mode/src/XCORE-AI-EXPLORER-NO-DDR.xn new file mode 100644 index 00000000..b39d5abe --- /dev/null +++ b/__app_test_mode/src/XCORE-AI-EXPLORER-NO-DDR.xn @@ -0,0 +1,60 @@ + + + Board + xcore.ai Explorer Kit + + + tileref tile[2] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/__app_test_mode/src/XCORE-AI-EXPLORER.xn b/__app_test_mode/src/XCORE-AI-EXPLORER.xn new file mode 100644 index 00000000..0cc287dd --- /dev/null +++ b/__app_test_mode/src/XCORE-AI-EXPLORER.xn @@ -0,0 +1,60 @@ + + + Board + xcore.ai Explorer Kit + + + tileref tile[2] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/__app_test_mode/src/main.xc b/__app_test_mode/src/main.xc new file mode 100644 index 00000000..962accf3 --- /dev/null +++ b/__app_test_mode/src/main.xc @@ -0,0 +1,29 @@ +// Copyright (c) 2020, XMOS Ltd, All rights reserved +#include "xud_device.h" + +/* Number of Endpoints used by this app */ +#define EP_COUNT_OUT 1 +#define EP_COUNT_IN 1 + +XUD_EpType epTypeTableOut[EP_COUNT_OUT] = {XUD_EPTYPE_CTL}; +XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL}; + + +int main() +{ + chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; + + par + { + on tile[0]: { + XUD_ep ep0_out = XUD_InitEp(c_ep_out[0]); + + XUD_SetTestMode(ep0_out, TEST_MODE); + } + + on tile[0]: XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, + null, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); + } + + return 0; +} diff --git a/lib_xud/src/core/XUD_TestMode.xc b/lib_xud/src/core/XUD_TestMode.xc index df5bc80b..2f435df3 100644 --- a/lib_xud/src/core/XUD_TestMode.xc +++ b/lib_xud/src/core/XUD_TestMode.xc @@ -55,15 +55,12 @@ int XUD_UsbTestModeHandler(unsigned cmd) case USB_WINDEX_TEST_SE0_NAK: - XUD_HAL_EnterMode_PeripheralHighSpeed() - /* Drop into asm to deal with this mode */ XUD_UsbTestSE0(); break; case USB_WINDEX_TEST_PACKET: { - XUD_HAL_EnterMode_PeripheralHighSpeed() // Repetitively transmit specific test packet forever. // Timings must still meet minimum interpacket gap // Have to relate KJ pairings to data. diff --git a/lib_xud/src/user/control/xud_device.xc b/lib_xud/src/user/control/xud_device.xc index 7aba0efb..6d1cac3f 100644 --- a/lib_xud/src/user/control/xud_device.xc +++ b/lib_xud/src/user/control/xud_device.xc @@ -190,6 +190,7 @@ XUD_Result_t USB_StandardRequests(XUD_ep ep_out, XUD_ep ep_in, break; /* Standard Device Request: SetFeature (USB Spec 9.4.9) */ + /* TODO only accept these requests in HS? */ case USB_SET_FEATURE: if((sp.wValue == USB_TEST_MODE) && (sp.wLength == 0)) From 49d2a77d8acce9c261c839e4eadbfaba31dfc55e Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 25 Aug 2020 12:55:23 +0100 Subject: [PATCH 152/520] Resolved some issues with standalone test mode apps --- __app_test_mode/Makefile | 2 +- lib_xud/src/core/XUD_IoLoop.S | 2 +- lib_xud/src/core/XUD_Main.xc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/__app_test_mode/Makefile b/__app_test_mode/Makefile index aab8562b..fce5e954 100644 --- a/__app_test_mode/Makefile +++ b/__app_test_mode/Makefile @@ -21,7 +21,7 @@ APP_NAME = app_test_mode # These flags define two build configurations - one for U-series and one for # the xCORE-200 series. -FLAGS_COMMON = -O3 -report -save-temps -DXUD_BYPASS_RESET -DXUD_TEST_SPEED_HS +FLAGS_COMMON = -O3 -report -save-temps -DXUD_BYPASS_RESET -DXUD_TEST_SPEED_HS -DXUD_BYPASS_CONNECT XCC_FLAGS_TEST_J = $(FLAGS_COMMON) -DTEST_MODE=USB_WINDEX_TEST_J XCC_FLAGS_TEST_K = $(FLAGS_COMMON) -DTEST_MODE=USB_WINDEX_TEST_K XCC_FLAGS_TEST_SE0_NAK = $(FLAGS_COMMON) -DTEST_MODE=USB_WINDEX_TEST_SE0_NAK diff --git a/lib_xud/src/core/XUD_IoLoop.S b/lib_xud/src/core/XUD_IoLoop.S index 4dc19097..d66103e5 100755 --- a/lib_xud/src/core/XUD_IoLoop.S +++ b/lib_xud/src/core/XUD_IoLoop.S @@ -103,7 +103,7 @@ UsbTestModeHandler_asm: ResetIntHandler: DUALENTSP_lu6 0 clrsr 0x18 // Clear InInterrupt bit (and InKernel) - clrsr 0x2 + clrsr 0x3 // Clear thread events and interrupts get r11, ed // Get timer resource ID setc res[r11], XS1_SETC_IE_MODE_EVENT // Set IE mode back to events diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index fe55ade6..b71dd6e8 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -291,7 +291,7 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c /* Go into full speed mode: XcvrSelect and Term Select (and suspend) high */ XUD_HAL_EnterMode_PeripheralFullSpeed(); -#if defined(XUD_SIM_XSIM) +#if defined(XUD_SIM_XSIM) || defined(XUD_BYPASS_CONNECT) reset = 1; #else From 7758715e01945a1e8461afeb987d5e0e70f1d960 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 25 Aug 2020 17:09:43 +0100 Subject: [PATCH 153/520] Fixed to TEST_PACKET and SE0_NAK test modes --- lib_xud/src/core/XUD_TestMode.xc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib_xud/src/core/XUD_TestMode.xc b/lib_xud/src/core/XUD_TestMode.xc index 2f435df3..06ae5309 100644 --- a/lib_xud/src/core/XUD_TestMode.xc +++ b/lib_xud/src/core/XUD_TestMode.xc @@ -54,13 +54,17 @@ int XUD_UsbTestModeHandler(unsigned cmd) break; case USB_WINDEX_TEST_SE0_NAK: - - /* Drop into asm to deal with this mode */ + + XUD_HAL_EnterMode_PeripheralHighSpeed(); + + /* Drop into asm to deal with this mode */ XUD_UsbTestSE0(); break; case USB_WINDEX_TEST_PACKET: { + XUD_HAL_EnterMode_PeripheralHighSpeed(); + // Repetitively transmit specific test packet forever. // Timings must still meet minimum interpacket gap // Have to relate KJ pairings to data. From 8702239ed42d5400227df195d92b0661fab3dd54 Mon Sep 17 00:00:00 2001 From: Henk Muller Date: Fri, 11 Sep 2020 13:43:14 +0100 Subject: [PATCH 154/520] Changing API for closing so that app can shut down completely --- lib_xud/api/xud.h | 16 ++++++++++++++-- lib_xud/src/core/XUD_Main.xc | 7 +++---- lib_xud/src/user/client/XUD_EpFunctions.xc | 10 ++++++++++ 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/lib_xud/api/xud.h b/lib_xud/api/xud.h index 59ba110d..6a132c30 100644 --- a/lib_xud/api/xud.h +++ b/lib_xud/api/xud.h @@ -85,7 +85,8 @@ typedef unsigned int XUD_ep; typedef enum XUD_BusSpeed { XUD_SPEED_FS = 1, - XUD_SPEED_HS = 2 + XUD_SPEED_HS = 2, + XUD_SPEED_KILL = 3 } XUD_BusSpeed_t; typedef enum XUD_PwrConfig @@ -250,10 +251,21 @@ XUD_Result_t XUD_SetDevAddr(/*tileref usbtile*/ unsigned addr); * \param one IN or OUT endpoint identifier to perform the reset on. * \param two Optional second IN or OUT endpoint structure to perform a reset on. * \return Either ``XUD_SPEED_HS`` - the host has accepted that this device can execute - * at high speed, or ``XUD_SPEED_FS`` - the device is runnig at full speed. + * at high speed, ``XUD_SPEED_FS`` - the device is runnig at full speed, + * or ``XUD_SPEED_KILL`` to indicate that the USB stack has been shut down + * by another part of the user code (using XUD_Kill). If the last value is + * returned, the endpoint code should call XUD_CloseEndpoint and then + * terminate. */ XUD_BusSpeed_t XUD_ResetEndpoint(XUD_ep one, NULLABLE_REFERENCE_PARAM(XUD_ep, two)); +/** + * \brief This function closes an endpoint. It should be called when the USB stack + * is shutting down. It should be called on all endpoints, either in parallel + * or in numerical order, first all OUT and then all IN endpoints + * \param one endpoint to close. + */ +void XUD_CloseEndpoint(XUD_ep one); /** * \brief Initialises an XUD_ep diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index b71dd6e8..fece4cce 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -450,12 +450,12 @@ static void drain(chanend chans[], int n, int op, XUD_EpType epTypeTable[]) { switch(op) { case 0: outct(chans[i], XS1_CT_END); + outuint(chans[i], XUD_SPEED_KILL); break; case 1: + outct(chans[i], XS1_CT_END); while (!testct(chans[i])) inuchar(chans[i]); - break; - case 2: chkct(chans[i], XS1_CT_END); break; } @@ -584,13 +584,12 @@ int XUD_Main(chanend c_ep_out[], int noEpOut, XUD_Manager_loop(epChans0, epChans, c_sof, epTypeTableOut, epTypeTableIn, noEpOut, noEpIn, pwrConfig); // Need to close, drain, and check - three stages. - for(int i = 0; i < 3; i++) + for(int i = 0; i < 2; i++) { drain(c_ep_out, noEpOut, i, epTypeTableOut); // On all inputs drain(c_ep_in, noEpIn, i, epTypeTableIn); // On all output } - /* Don't hit */ return 0; } diff --git a/lib_xud/src/user/client/XUD_EpFunctions.xc b/lib_xud/src/user/client/XUD_EpFunctions.xc index 4045324e..0a322191 100644 --- a/lib_xud/src/user/client/XUD_EpFunctions.xc +++ b/lib_xud/src/user/client/XUD_EpFunctions.xc @@ -136,6 +136,16 @@ void XUD_ClearStall(XUD_ep ep) XUD_ClearStallByAddr(epAddress); } +void XUD_CloseEndpoint(XUD_ep one) +{ + unsigned c1; + + /* Input rst control token */ + asm volatile("ldw %0, %1[2]":"=r"(c1):"r"(one)); // Load our chanend + asm volatile ("outct res[%0], 1":: "r"(c1)); // Close channel to other side + asm volatile ("chkct res[%0], 1":: "r"(c1)); // Close channel to this side +} + XUD_BusSpeed_t XUD_ResetEndpoint(XUD_ep one, XUD_ep &?two) { int busStateCt; From 8d2df459947002289b826394ddb13c2e3b1392fc Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 11 Nov 2020 15:02:11 +0000 Subject: [PATCH 155/520] Added REF_CLK_FREQ define --- lib_xud/api/xud.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_xud/api/xud.h b/lib_xud/api/xud.h index 59ba110d..af9fe1c4 100644 --- a/lib_xud/api/xud.h +++ b/lib_xud/api/xud.h @@ -33,6 +33,10 @@ #define USB_TILE tile[0] #endif +#ifndef REF_CLK_FREQ +#define REF_CLK_FREQ 100 +#endif + #ifndef XUD_CORE_CLOCK #warning XUD_CORE_CLOCK not defined, using default (700MHz) #define XUD_CORE_CLOCK (700) From e60220f84191c41c1b83c7d86e39b8186572d9b2 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 12 Jan 2021 16:01:32 +0000 Subject: [PATCH 156/520] PING now respects STALL protocol --- lib_xud/src/core/included/XUD_Token_Ping.S | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib_xud/src/core/included/XUD_Token_Ping.S b/lib_xud/src/core/included/XUD_Token_Ping.S index 0e23153c..9ab6f4b4 100755 --- a/lib_xud/src/core/included/XUD_Token_Ping.S +++ b/lib_xud/src/core/included/XUD_Token_Ping.S @@ -31,8 +31,10 @@ PrimaryBufferFull_PING: // Send NAK nop nop nop - nop - ldc r11, USB_PIDn_NAK + // ldc r11, USB_PIDn_NA + // Load handshake (ACK or STALL) + ldaw r11, dp[handshakeTable_OUT] // Load handshake table + ldw r11, r11[r10] outpw res[TXD], r11, 8 bu NextTokenAfterPing .scheduling default From 099d70f9c0587edf87ea9822ef36889b5f85418f Mon Sep 17 00:00:00 2001 From: Michael Bruno Date: Thu, 18 Feb 2021 16:34:14 -0500 Subject: [PATCH 157/520] Do not setup disabled endpoints XUD_Main() no longer sets up the endpoint struct for disabled endpoints, and no longer sends out the endpoint struct over the associated channel, which may now be null. Applications must no longer call XUD_InitEp() on disabled endpoints. --- lib_xud/src/core/XUD_Main.xc | 46 ++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index fece4cce..205dc3f9 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -498,37 +498,40 @@ int XUD_Main(chanend c_ep_out[], int noEpOut, /* Populate arrays of channels and status flag tabes */ for(int i = 0; i < noEpOut; i++) { - unsigned x; - epChans0[i] = XUD_Sup_GetResourceId(c_ep_out[i]); + if(epTypeTableOut[i] != XUD_EPTYPE_DIS) + { + unsigned x; + epChans0[i] = XUD_Sup_GetResourceId(c_ep_out[i]); - asm("ldaw %0, %1[%2]":"=r"(x):"r"(epChans),"r"(i)); - ep_info[i].chan_array_ptr = x; + asm("ldaw %0, %1[%2]":"=r"(x):"r"(epChans),"r"(i)); + ep_info[i].chan_array_ptr = x; - asm("mov %0, %1":"=r"(x):"r"(c_ep_out[i])); - ep_info[i].ep_xud_chanend = x; + asm("mov %0, %1":"=r"(x):"r"(c_ep_out[i])); + ep_info[i].ep_xud_chanend = x; - asm("getd %0, res[%1]":"=r"(x):"r"(c_ep_out[i])); - ep_info[i].ep_client_chanend = x; + asm("getd %0, res[%1]":"=r"(x):"r"(c_ep_out[i])); + ep_info[i].ep_client_chanend = x; - asm("ldaw %0, %1[%2]":"=r"(x):"r"(ep_info),"r"(i*sizeof(XUD_ep_info)/sizeof(unsigned))); - outuint(c_ep_out[i], x); + asm("ldaw %0, %1[%2]":"=r"(x):"r"(ep_info),"r"(i*sizeof(XUD_ep_info)/sizeof(unsigned))); + outuint(c_ep_out[i], x); - epStatFlagTableOut[i] = epTypeTableOut[i] & XUD_STATUS_ENABLE; - epTypeTableOut[i] = epTypeTableOut[i] & 0x7FFFFFFF; + epStatFlagTableOut[i] = epTypeTableOut[i] & XUD_STATUS_ENABLE; + epTypeTableOut[i] = epTypeTableOut[i] & 0x7FFFFFFF; - ep_info[i].epType = epTypeTableOut[i]; + ep_info[i].epType = epTypeTableOut[i]; #ifdef __XS3A__ - ep_info[i].pid = USB_PIDn_DATA0; + ep_info[i].pid = USB_PIDn_DATA0; #else - ep_info[i].pid = USB_PID_DATA0; + ep_info[i].pid = USB_PID_DATA0; #endif - // ep_info[i].epAddress = i; - + } } for(int i = 0; i< noEpIn; i++) { + if(epTypeTableIn[i] != XUD_EPTYPE_DIS) + { int x; epChans0[i+USB_MAX_NUM_EP_OUT] = XUD_Sup_GetResourceId(c_ep_in[i]); @@ -538,10 +541,10 @@ int XUD_Main(chanend c_ep_out[], int noEpOut, asm("mov %0, %1":"=r"(x):"r"(c_ep_in[i])); ep_info[USB_MAX_NUM_EP_OUT+i].ep_xud_chanend = x; - asm("getd %0, res[%1]":"=r"(x):"r"(c_ep_in[i])); + asm("getd %0, res[%1]":"=r"(x):"r"(c_ep_in[i])); ep_info[USB_MAX_NUM_EP_OUT+i].ep_client_chanend = x; - asm("ldaw %0, %1[%2]":"=r"(x):"r"(ep_info),"r"((USB_MAX_NUM_EP_OUT+i)*sizeof(XUD_ep_info)/sizeof(unsigned))); + asm("ldaw %0, %1[%2]":"=r"(x):"r"(ep_info),"r"((USB_MAX_NUM_EP_OUT+i)*sizeof(XUD_ep_info)/sizeof(unsigned))); outuint(c_ep_in[i], x); @@ -551,9 +554,7 @@ int XUD_Main(chanend c_ep_out[], int noEpOut, epTypeTableIn[i] = epTypeTableIn[i] & 0x7FFFFFFF; ep_info[USB_MAX_NUM_EP_OUT+i].epType = epTypeTableIn[i]; - - //ep_info[USB_MAX_NUM_EP_OUT+i].epAddress = 0x80; // OR in the IN bit - + } } /* EpTypeTable Checks. Note, currently this is not too crucial since we only really care if the EP is ISO or not */ @@ -565,7 +566,6 @@ int XUD_Main(chanend c_ep_out[], int noEpOut, } #if 0 - /* Check that if the required channel has a destination if the EP is marked as in use */ for( int i = 0; i < noEpOut + noEpIn; i++ ) { From eaa88a22255a6bd31e39e4d1cae87ea498420a33 Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Fri, 19 Feb 2021 16:09:18 +0000 Subject: [PATCH 158/520] Update CHANGELOG.rst --- CHANGELOG.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index c128b5ad..110ae6a6 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,8 +5,10 @@ HEAD ---- * ADDED: Initial support for XS3A based devices - * CHANGE: Removed support for XS1-G, and XS1-L (including U series) based devices * ADDED: Requirement to define XUD_CORE_CLOCK with xcore core clock speed in MHz + * CHANGE: Removed support for XS1-G, and XS1-L (including U series) based devices + * RESOLVED: Exception when Endpoint marked as disabled + 0.1.1 From 9732e5a93f6accad4f6e00f0ebddce3f0a191818 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 22 Feb 2021 15:18:26 +0000 Subject: [PATCH 159/520] Removed old file from module_build_info --- lib_xud/module_build_info | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib_xud/module_build_info b/lib_xud/module_build_info index c0d7d20f..55632b00 100644 --- a/lib_xud/module_build_info +++ b/lib_xud/module_build_info @@ -19,8 +19,6 @@ OPTIONAL_HEADERS += xud_conf.h VERSION = 0.1.1 -# DEPENDENT_MODULES = - XCC_FLAGS_endpoint0.xc = $(MODULE_XCC_FLAGS) -Os XCC_FLAGS_dfu.xc = $(MODULE_XCC_FLAGS) -Os XCC_FLAGS_dfu_flash.xc = $(MODULE_XCC_FLAGS) -Os @@ -34,7 +32,6 @@ XCC_FLAGS_XUD_Support.xc = $(MODULE_XCC_FLAGS) -mno-dual-issue XCC_FLAGS_XUD_IOLoopCall.xc = $(MODULE_XCC_FLAGS) -mno-dual-issue XCC_FLAGS_XUD_PowerSig.xc = $(MODULE_XCC_FLAGS) -mno-dual-issue -Wno-return-type XCC_FLAGS_XUD_TestMode.xc = $(MODULE_XCC_FLAGS) -mno-dual-issue -XCC_FLAGS_XUD_GetDone.c = $(MODULE_XCC_FLAGS) -mno-dual-issue XCC_FLAGS_XUD_SetCrcTableAddr.c = $(MODULE_XCC_FLAGS) -mno-dual-issue XCC_FLAGS_XUD_User.c = $(MODULE_XCC_FLAGS) -mno-dual-issue From 0f555ad8fc0a3d306e922e9acbfd80dad38fe6de Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 23 Feb 2021 19:08:49 +0000 Subject: [PATCH 160/520] Fixes to allow for large offsets from DP --- lib_xud/src/core/XUD_CRC5_Table_Addr.S | 2063 ++++++++++++++++++++++++ lib_xud/src/core/XUD_Main.xc | 2 +- lib_xud/src/core/XUD_SetCrcTableAddr.c | 3 +- lib_xud/src/user/client/XUD_EpFuncs.S | 20 +- 4 files changed, 2081 insertions(+), 7 deletions(-) create mode 100755 lib_xud/src/core/XUD_CRC5_Table_Addr.S diff --git a/lib_xud/src/core/XUD_CRC5_Table_Addr.S b/lib_xud/src/core/XUD_CRC5_Table_Addr.S new file mode 100755 index 00000000..c005a290 --- /dev/null +++ b/lib_xud/src/core/XUD_CRC5_Table_Addr.S @@ -0,0 +1,2063 @@ +// Copyright (c) 2011-2021, XMOS Ltd, All rights reserved +/** XUD_CRC5_Table_Addr.S + * @brief CRC5 table + * @author Ross Owen, XMOS Limited + */ + +.section .dp.data, "adw", @progbits +.globl crc5Table_Addr +.type crc5Table_Addr, @object +.cc_top crc5Table_Addr.func, crc5Table_Addr +.align 4 +.skip 0 +crc5Table_Addr: +.byte 0x2 +.byte 0x1d +.byte 0x15 +.byte 0xa +.byte 0x5 +.byte 0x1a +.byte 0x12 +.byte 0xd +.byte 0xc +.byte 0x13 +.byte 0x1b +.byte 0x4 +.byte 0xb +.byte 0x14 +.byte 0x1c +.byte 0x3 +.byte 0x1e +.byte 0x1 +.byte 0x9 +.byte 0x16 +.byte 0x19 +.byte 0x6 +.byte 0xe +.byte 0x11 +.byte 0x10 +.byte 0xf +.byte 0x7 +.byte 0x18 +.byte 0x17 +.byte 0x8 +.byte 0x0 +.byte 0x1f +.byte 0x13 +.byte 0xc +.byte 0x4 +.byte 0x1b +.byte 0x14 +.byte 0xb +.byte 0x3 +.byte 0x1c +.byte 0x1d +.byte 0x2 +.byte 0xa +.byte 0x15 +.byte 0x1a +.byte 0x5 +.byte 0xd +.byte 0x12 +.byte 0xf +.byte 0x10 +.byte 0x18 +.byte 0x7 +.byte 0x8 +.byte 0x17 +.byte 0x1f +.byte 0x0 +.byte 0x1 +.byte 0x1e +.byte 0x16 +.byte 0x9 +.byte 0x6 +.byte 0x19 +.byte 0x11 +.byte 0xe +.byte 0x9 +.byte 0x16 +.byte 0x1e +.byte 0x1 +.byte 0xe +.byte 0x11 +.byte 0x19 +.byte 0x6 +.byte 0x7 +.byte 0x18 +.byte 0x10 +.byte 0xf +.byte 0x0 +.byte 0x1f +.byte 0x17 +.byte 0x8 +.byte 0x15 +.byte 0xa +.byte 0x2 +.byte 0x1d +.byte 0x12 +.byte 0xd +.byte 0x5 +.byte 0x1a +.byte 0x1b +.byte 0x4 +.byte 0xc +.byte 0x13 +.byte 0x1c +.byte 0x3 +.byte 0xb +.byte 0x14 +.byte 0x18 +.byte 0x7 +.byte 0xf +.byte 0x10 +.byte 0x1f +.byte 0x0 +.byte 0x8 +.byte 0x17 +.byte 0x16 +.byte 0x9 +.byte 0x1 +.byte 0x1e +.byte 0x11 +.byte 0xe +.byte 0x6 +.byte 0x19 +.byte 0x4 +.byte 0x1b +.byte 0x13 +.byte 0xc +.byte 0x3 +.byte 0x1c +.byte 0x14 +.byte 0xb +.byte 0xa +.byte 0x15 +.byte 0x1d +.byte 0x2 +.byte 0xd +.byte 0x12 +.byte 0x1a +.byte 0x5 +.byte 0x14 +.byte 0xb +.byte 0x3 +.byte 0x1c +.byte 0x13 +.byte 0xc +.byte 0x4 +.byte 0x1b +.byte 0x1a +.byte 0x5 +.byte 0xd +.byte 0x12 +.byte 0x1d +.byte 0x2 +.byte 0xa +.byte 0x15 +.byte 0x8 +.byte 0x17 +.byte 0x1f +.byte 0x0 +.byte 0xf +.byte 0x10 +.byte 0x18 +.byte 0x7 +.byte 0x6 +.byte 0x19 +.byte 0x11 +.byte 0xe +.byte 0x1 +.byte 0x1e +.byte 0x16 +.byte 0x9 +.byte 0x5 +.byte 0x1a +.byte 0x12 +.byte 0xd +.byte 0x2 +.byte 0x1d +.byte 0x15 +.byte 0xa +.byte 0xb +.byte 0x14 +.byte 0x1c +.byte 0x3 +.byte 0xc +.byte 0x13 +.byte 0x1b +.byte 0x4 +.byte 0x19 +.byte 0x6 +.byte 0xe +.byte 0x11 +.byte 0x1e +.byte 0x1 +.byte 0x9 +.byte 0x16 +.byte 0x17 +.byte 0x8 +.byte 0x0 +.byte 0x1f +.byte 0x10 +.byte 0xf +.byte 0x7 +.byte 0x18 +.byte 0x1f +.byte 0x0 +.byte 0x8 +.byte 0x17 +.byte 0x18 +.byte 0x7 +.byte 0xf +.byte 0x10 +.byte 0x11 +.byte 0xe +.byte 0x6 +.byte 0x19 +.byte 0x16 +.byte 0x9 +.byte 0x1 +.byte 0x1e +.byte 0x3 +.byte 0x1c +.byte 0x14 +.byte 0xb +.byte 0x4 +.byte 0x1b +.byte 0x13 +.byte 0xc +.byte 0xd +.byte 0x12 +.byte 0x1a +.byte 0x5 +.byte 0xa +.byte 0x15 +.byte 0x1d +.byte 0x2 +.byte 0xe +.byte 0x11 +.byte 0x19 +.byte 0x6 +.byte 0x9 +.byte 0x16 +.byte 0x1e +.byte 0x1 +.byte 0x0 +.byte 0x1f +.byte 0x17 +.byte 0x8 +.byte 0x7 +.byte 0x18 +.byte 0x10 +.byte 0xf +.byte 0x12 +.byte 0xd +.byte 0x5 +.byte 0x1a +.byte 0x15 +.byte 0xa +.byte 0x2 +.byte 0x1d +.byte 0x1c +.byte 0x3 +.byte 0xb +.byte 0x14 +.byte 0x1b +.byte 0x4 +.byte 0xc +.byte 0x13 +.byte 0x7 +.byte 0x18 +.byte 0x10 +.byte 0xf +.byte 0x0 +.byte 0x1f +.byte 0x17 +.byte 0x8 +.byte 0x9 +.byte 0x16 +.byte 0x1e +.byte 0x1 +.byte 0xe +.byte 0x11 +.byte 0x19 +.byte 0x6 +.byte 0x1b +.byte 0x4 +.byte 0xc +.byte 0x13 +.byte 0x1c +.byte 0x3 +.byte 0xb +.byte 0x14 +.byte 0x15 +.byte 0xa +.byte 0x2 +.byte 0x1d +.byte 0x12 +.byte 0xd +.byte 0x5 +.byte 0x1a +.byte 0x16 +.byte 0x9 +.byte 0x1 +.byte 0x1e +.byte 0x11 +.byte 0xe +.byte 0x6 +.byte 0x19 +.byte 0x18 +.byte 0x7 +.byte 0xf +.byte 0x10 +.byte 0x1f +.byte 0x0 +.byte 0x8 +.byte 0x17 +.byte 0xa +.byte 0x15 +.byte 0x1d +.byte 0x2 +.byte 0xd +.byte 0x12 +.byte 0x1a +.byte 0x5 +.byte 0x4 +.byte 0x1b +.byte 0x13 +.byte 0xc +.byte 0x3 +.byte 0x1c +.byte 0x14 +.byte 0xb +.byte 0xc +.byte 0x13 +.byte 0x1b +.byte 0x4 +.byte 0xb +.byte 0x14 +.byte 0x1c +.byte 0x3 +.byte 0x2 +.byte 0x1d +.byte 0x15 +.byte 0xa +.byte 0x5 +.byte 0x1a +.byte 0x12 +.byte 0xd +.byte 0x10 +.byte 0xf +.byte 0x7 +.byte 0x18 +.byte 0x17 +.byte 0x8 +.byte 0x0 +.byte 0x1f +.byte 0x1e +.byte 0x1 +.byte 0x9 +.byte 0x16 +.byte 0x19 +.byte 0x6 +.byte 0xe +.byte 0x11 +.byte 0x1d +.byte 0x2 +.byte 0xa +.byte 0x15 +.byte 0x1a +.byte 0x5 +.byte 0xd +.byte 0x12 +.byte 0x13 +.byte 0xc +.byte 0x4 +.byte 0x1b +.byte 0x14 +.byte 0xb +.byte 0x3 +.byte 0x1c +.byte 0x1 +.byte 0x1e +.byte 0x16 +.byte 0x9 +.byte 0x6 +.byte 0x19 +.byte 0x11 +.byte 0xe +.byte 0xf +.byte 0x10 +.byte 0x18 +.byte 0x7 +.byte 0x8 +.byte 0x17 +.byte 0x1f +.byte 0x0 +.byte 0x11 +.byte 0xe +.byte 0x6 +.byte 0x19 +.byte 0x16 +.byte 0x9 +.byte 0x1 +.byte 0x1e +.byte 0x1f +.byte 0x0 +.byte 0x8 +.byte 0x17 +.byte 0x18 +.byte 0x7 +.byte 0xf +.byte 0x10 +.byte 0xd +.byte 0x12 +.byte 0x1a +.byte 0x5 +.byte 0xa +.byte 0x15 +.byte 0x1d +.byte 0x2 +.byte 0x3 +.byte 0x1c +.byte 0x14 +.byte 0xb +.byte 0x4 +.byte 0x1b +.byte 0x13 +.byte 0xc +.byte 0x0 +.byte 0x1f +.byte 0x17 +.byte 0x8 +.byte 0x7 +.byte 0x18 +.byte 0x10 +.byte 0xf +.byte 0xe +.byte 0x11 +.byte 0x19 +.byte 0x6 +.byte 0x9 +.byte 0x16 +.byte 0x1e +.byte 0x1 +.byte 0x1c +.byte 0x3 +.byte 0xb +.byte 0x14 +.byte 0x1b +.byte 0x4 +.byte 0xc +.byte 0x13 +.byte 0x12 +.byte 0xd +.byte 0x5 +.byte 0x1a +.byte 0x15 +.byte 0xa +.byte 0x2 +.byte 0x1d +.byte 0x1a +.byte 0x5 +.byte 0xd +.byte 0x12 +.byte 0x1d +.byte 0x2 +.byte 0xa +.byte 0x15 +.byte 0x14 +.byte 0xb +.byte 0x3 +.byte 0x1c +.byte 0x13 +.byte 0xc +.byte 0x4 +.byte 0x1b +.byte 0x6 +.byte 0x19 +.byte 0x11 +.byte 0xe +.byte 0x1 +.byte 0x1e +.byte 0x16 +.byte 0x9 +.byte 0x8 +.byte 0x17 +.byte 0x1f +.byte 0x0 +.byte 0xf +.byte 0x10 +.byte 0x18 +.byte 0x7 +.byte 0xb +.byte 0x14 +.byte 0x1c +.byte 0x3 +.byte 0xc +.byte 0x13 +.byte 0x1b +.byte 0x4 +.byte 0x5 +.byte 0x1a +.byte 0x12 +.byte 0xd +.byte 0x2 +.byte 0x1d +.byte 0x15 +.byte 0xa +.byte 0x17 +.byte 0x8 +.byte 0x0 +.byte 0x1f +.byte 0x10 +.byte 0xf +.byte 0x7 +.byte 0x18 +.byte 0x19 +.byte 0x6 +.byte 0xe +.byte 0x11 +.byte 0x1e +.byte 0x1 +.byte 0x9 +.byte 0x16 +.byte 0x8 +.byte 0x17 +.byte 0x1f +.byte 0x0 +.byte 0xf +.byte 0x10 +.byte 0x18 +.byte 0x7 +.byte 0x6 +.byte 0x19 +.byte 0x11 +.byte 0xe +.byte 0x1 +.byte 0x1e +.byte 0x16 +.byte 0x9 +.byte 0x14 +.byte 0xb +.byte 0x3 +.byte 0x1c +.byte 0x13 +.byte 0xc +.byte 0x4 +.byte 0x1b +.byte 0x1a +.byte 0x5 +.byte 0xd +.byte 0x12 +.byte 0x1d +.byte 0x2 +.byte 0xa +.byte 0x15 +.byte 0x19 +.byte 0x6 +.byte 0xe +.byte 0x11 +.byte 0x1e +.byte 0x1 +.byte 0x9 +.byte 0x16 +.byte 0x17 +.byte 0x8 +.byte 0x0 +.byte 0x1f +.byte 0x10 +.byte 0xf +.byte 0x7 +.byte 0x18 +.byte 0x5 +.byte 0x1a +.byte 0x12 +.byte 0xd +.byte 0x2 +.byte 0x1d +.byte 0x15 +.byte 0xa +.byte 0xb +.byte 0x14 +.byte 0x1c +.byte 0x3 +.byte 0xc +.byte 0x13 +.byte 0x1b +.byte 0x4 +.byte 0x3 +.byte 0x1c +.byte 0x14 +.byte 0xb +.byte 0x4 +.byte 0x1b +.byte 0x13 +.byte 0xc +.byte 0xd +.byte 0x12 +.byte 0x1a +.byte 0x5 +.byte 0xa +.byte 0x15 +.byte 0x1d +.byte 0x2 +.byte 0x1f +.byte 0x0 +.byte 0x8 +.byte 0x17 +.byte 0x18 +.byte 0x7 +.byte 0xf +.byte 0x10 +.byte 0x11 +.byte 0xe +.byte 0x6 +.byte 0x19 +.byte 0x16 +.byte 0x9 +.byte 0x1 +.byte 0x1e +.byte 0x12 +.byte 0xd +.byte 0x5 +.byte 0x1a +.byte 0x15 +.byte 0xa +.byte 0x2 +.byte 0x1d +.byte 0x1c +.byte 0x3 +.byte 0xb +.byte 0x14 +.byte 0x1b +.byte 0x4 +.byte 0xc +.byte 0x13 +.byte 0xe +.byte 0x11 +.byte 0x19 +.byte 0x6 +.byte 0x9 +.byte 0x16 +.byte 0x1e +.byte 0x1 +.byte 0x0 +.byte 0x1f +.byte 0x17 +.byte 0x8 +.byte 0x7 +.byte 0x18 +.byte 0x10 +.byte 0xf +.byte 0x1e +.byte 0x1 +.byte 0x9 +.byte 0x16 +.byte 0x19 +.byte 0x6 +.byte 0xe +.byte 0x11 +.byte 0x10 +.byte 0xf +.byte 0x7 +.byte 0x18 +.byte 0x17 +.byte 0x8 +.byte 0x0 +.byte 0x1f +.byte 0x2 +.byte 0x1d +.byte 0x15 +.byte 0xa +.byte 0x5 +.byte 0x1a +.byte 0x12 +.byte 0xd +.byte 0xc +.byte 0x13 +.byte 0x1b +.byte 0x4 +.byte 0xb +.byte 0x14 +.byte 0x1c +.byte 0x3 +.byte 0xf +.byte 0x10 +.byte 0x18 +.byte 0x7 +.byte 0x8 +.byte 0x17 +.byte 0x1f +.byte 0x0 +.byte 0x1 +.byte 0x1e +.byte 0x16 +.byte 0x9 +.byte 0x6 +.byte 0x19 +.byte 0x11 +.byte 0xe +.byte 0x13 +.byte 0xc +.byte 0x4 +.byte 0x1b +.byte 0x14 +.byte 0xb +.byte 0x3 +.byte 0x1c +.byte 0x1d +.byte 0x2 +.byte 0xa +.byte 0x15 +.byte 0x1a +.byte 0x5 +.byte 0xd +.byte 0x12 +.byte 0x15 +.byte 0xa +.byte 0x2 +.byte 0x1d +.byte 0x12 +.byte 0xd +.byte 0x5 +.byte 0x1a +.byte 0x1b +.byte 0x4 +.byte 0xc +.byte 0x13 +.byte 0x1c +.byte 0x3 +.byte 0xb +.byte 0x14 +.byte 0x9 +.byte 0x16 +.byte 0x1e +.byte 0x1 +.byte 0xe +.byte 0x11 +.byte 0x19 +.byte 0x6 +.byte 0x7 +.byte 0x18 +.byte 0x10 +.byte 0xf +.byte 0x0 +.byte 0x1f +.byte 0x17 +.byte 0x8 +.byte 0x4 +.byte 0x1b +.byte 0x13 +.byte 0xc +.byte 0x3 +.byte 0x1c +.byte 0x14 +.byte 0xb +.byte 0xa +.byte 0x15 +.byte 0x1d +.byte 0x2 +.byte 0xd +.byte 0x12 +.byte 0x1a +.byte 0x5 +.byte 0x18 +.byte 0x7 +.byte 0xf +.byte 0x10 +.byte 0x1f +.byte 0x0 +.byte 0x8 +.byte 0x17 +.byte 0x16 +.byte 0x9 +.byte 0x1 +.byte 0x1e +.byte 0x11 +.byte 0xe +.byte 0x6 +.byte 0x19 +.byte 0xd +.byte 0x12 +.byte 0x1a +.byte 0x5 +.byte 0xa +.byte 0x15 +.byte 0x1d +.byte 0x2 +.byte 0x3 +.byte 0x1c +.byte 0x14 +.byte 0xb +.byte 0x4 +.byte 0x1b +.byte 0x13 +.byte 0xc +.byte 0x11 +.byte 0xe +.byte 0x6 +.byte 0x19 +.byte 0x16 +.byte 0x9 +.byte 0x1 +.byte 0x1e +.byte 0x1f +.byte 0x0 +.byte 0x8 +.byte 0x17 +.byte 0x18 +.byte 0x7 +.byte 0xf +.byte 0x10 +.byte 0x1c +.byte 0x3 +.byte 0xb +.byte 0x14 +.byte 0x1b +.byte 0x4 +.byte 0xc +.byte 0x13 +.byte 0x12 +.byte 0xd +.byte 0x5 +.byte 0x1a +.byte 0x15 +.byte 0xa +.byte 0x2 +.byte 0x1d +.byte 0x0 +.byte 0x1f +.byte 0x17 +.byte 0x8 +.byte 0x7 +.byte 0x18 +.byte 0x10 +.byte 0xf +.byte 0xe +.byte 0x11 +.byte 0x19 +.byte 0x6 +.byte 0x9 +.byte 0x16 +.byte 0x1e +.byte 0x1 +.byte 0x6 +.byte 0x19 +.byte 0x11 +.byte 0xe +.byte 0x1 +.byte 0x1e +.byte 0x16 +.byte 0x9 +.byte 0x8 +.byte 0x17 +.byte 0x1f +.byte 0x0 +.byte 0xf +.byte 0x10 +.byte 0x18 +.byte 0x7 +.byte 0x1a +.byte 0x5 +.byte 0xd +.byte 0x12 +.byte 0x1d +.byte 0x2 +.byte 0xa +.byte 0x15 +.byte 0x14 +.byte 0xb +.byte 0x3 +.byte 0x1c +.byte 0x13 +.byte 0xc +.byte 0x4 +.byte 0x1b +.byte 0x17 +.byte 0x8 +.byte 0x0 +.byte 0x1f +.byte 0x10 +.byte 0xf +.byte 0x7 +.byte 0x18 +.byte 0x19 +.byte 0x6 +.byte 0xe +.byte 0x11 +.byte 0x1e +.byte 0x1 +.byte 0x9 +.byte 0x16 +.byte 0xb +.byte 0x14 +.byte 0x1c +.byte 0x3 +.byte 0xc +.byte 0x13 +.byte 0x1b +.byte 0x4 +.byte 0x5 +.byte 0x1a +.byte 0x12 +.byte 0xd +.byte 0x2 +.byte 0x1d +.byte 0x15 +.byte 0xa +.byte 0x1b +.byte 0x4 +.byte 0xc +.byte 0x13 +.byte 0x1c +.byte 0x3 +.byte 0xb +.byte 0x14 +.byte 0x15 +.byte 0xa +.byte 0x2 +.byte 0x1d +.byte 0x12 +.byte 0xd +.byte 0x5 +.byte 0x1a +.byte 0x7 +.byte 0x18 +.byte 0x10 +.byte 0xf +.byte 0x0 +.byte 0x1f +.byte 0x17 +.byte 0x8 +.byte 0x9 +.byte 0x16 +.byte 0x1e +.byte 0x1 +.byte 0xe +.byte 0x11 +.byte 0x19 +.byte 0x6 +.byte 0xa +.byte 0x15 +.byte 0x1d +.byte 0x2 +.byte 0xd +.byte 0x12 +.byte 0x1a +.byte 0x5 +.byte 0x4 +.byte 0x1b +.byte 0x13 +.byte 0xc +.byte 0x3 +.byte 0x1c +.byte 0x14 +.byte 0xb +.byte 0x16 +.byte 0x9 +.byte 0x1 +.byte 0x1e +.byte 0x11 +.byte 0xe +.byte 0x6 +.byte 0x19 +.byte 0x18 +.byte 0x7 +.byte 0xf +.byte 0x10 +.byte 0x1f +.byte 0x0 +.byte 0x8 +.byte 0x17 +.byte 0x10 +.byte 0xf +.byte 0x7 +.byte 0x18 +.byte 0x17 +.byte 0x8 +.byte 0x0 +.byte 0x1f +.byte 0x1e +.byte 0x1 +.byte 0x9 +.byte 0x16 +.byte 0x19 +.byte 0x6 +.byte 0xe +.byte 0x11 +.byte 0xc +.byte 0x13 +.byte 0x1b +.byte 0x4 +.byte 0xb +.byte 0x14 +.byte 0x1c +.byte 0x3 +.byte 0x2 +.byte 0x1d +.byte 0x15 +.byte 0xa +.byte 0x5 +.byte 0x1a +.byte 0x12 +.byte 0xd +.byte 0x1 +.byte 0x1e +.byte 0x16 +.byte 0x9 +.byte 0x6 +.byte 0x19 +.byte 0x11 +.byte 0xe +.byte 0xf +.byte 0x10 +.byte 0x18 +.byte 0x7 +.byte 0x8 +.byte 0x17 +.byte 0x1f +.byte 0x0 +.byte 0x1d +.byte 0x2 +.byte 0xa +.byte 0x15 +.byte 0x1a +.byte 0x5 +.byte 0xd +.byte 0x12 +.byte 0x13 +.byte 0xc +.byte 0x4 +.byte 0x1b +.byte 0x14 +.byte 0xb +.byte 0x3 +.byte 0x1c +.byte 0x16 +.byte 0x9 +.byte 0x1 +.byte 0x1e +.byte 0x11 +.byte 0xe +.byte 0x6 +.byte 0x19 +.byte 0x18 +.byte 0x7 +.byte 0xf +.byte 0x10 +.byte 0x1f +.byte 0x0 +.byte 0x8 +.byte 0x17 +.byte 0xa +.byte 0x15 +.byte 0x1d +.byte 0x2 +.byte 0xd +.byte 0x12 +.byte 0x1a +.byte 0x5 +.byte 0x4 +.byte 0x1b +.byte 0x13 +.byte 0xc +.byte 0x3 +.byte 0x1c +.byte 0x14 +.byte 0xb +.byte 0x7 +.byte 0x18 +.byte 0x10 +.byte 0xf +.byte 0x0 +.byte 0x1f +.byte 0x17 +.byte 0x8 +.byte 0x9 +.byte 0x16 +.byte 0x1e +.byte 0x1 +.byte 0xe +.byte 0x11 +.byte 0x19 +.byte 0x6 +.byte 0x1b +.byte 0x4 +.byte 0xc +.byte 0x13 +.byte 0x1c +.byte 0x3 +.byte 0xb +.byte 0x14 +.byte 0x15 +.byte 0xa +.byte 0x2 +.byte 0x1d +.byte 0x12 +.byte 0xd +.byte 0x5 +.byte 0x1a +.byte 0x1d +.byte 0x2 +.byte 0xa +.byte 0x15 +.byte 0x1a +.byte 0x5 +.byte 0xd +.byte 0x12 +.byte 0x13 +.byte 0xc +.byte 0x4 +.byte 0x1b +.byte 0x14 +.byte 0xb +.byte 0x3 +.byte 0x1c +.byte 0x1 +.byte 0x1e +.byte 0x16 +.byte 0x9 +.byte 0x6 +.byte 0x19 +.byte 0x11 +.byte 0xe +.byte 0xf +.byte 0x10 +.byte 0x18 +.byte 0x7 +.byte 0x8 +.byte 0x17 +.byte 0x1f +.byte 0x0 +.byte 0xc +.byte 0x13 +.byte 0x1b +.byte 0x4 +.byte 0xb +.byte 0x14 +.byte 0x1c +.byte 0x3 +.byte 0x2 +.byte 0x1d +.byte 0x15 +.byte 0xa +.byte 0x5 +.byte 0x1a +.byte 0x12 +.byte 0xd +.byte 0x10 +.byte 0xf +.byte 0x7 +.byte 0x18 +.byte 0x17 +.byte 0x8 +.byte 0x0 +.byte 0x1f +.byte 0x1e +.byte 0x1 +.byte 0x9 +.byte 0x16 +.byte 0x19 +.byte 0x6 +.byte 0xe +.byte 0x11 +.byte 0x0 +.byte 0x1f +.byte 0x17 +.byte 0x8 +.byte 0x7 +.byte 0x18 +.byte 0x10 +.byte 0xf +.byte 0xe +.byte 0x11 +.byte 0x19 +.byte 0x6 +.byte 0x9 +.byte 0x16 +.byte 0x1e +.byte 0x1 +.byte 0x1c +.byte 0x3 +.byte 0xb +.byte 0x14 +.byte 0x1b +.byte 0x4 +.byte 0xc +.byte 0x13 +.byte 0x12 +.byte 0xd +.byte 0x5 +.byte 0x1a +.byte 0x15 +.byte 0xa +.byte 0x2 +.byte 0x1d +.byte 0x11 +.byte 0xe +.byte 0x6 +.byte 0x19 +.byte 0x16 +.byte 0x9 +.byte 0x1 +.byte 0x1e +.byte 0x1f +.byte 0x0 +.byte 0x8 +.byte 0x17 +.byte 0x18 +.byte 0x7 +.byte 0xf +.byte 0x10 +.byte 0xd +.byte 0x12 +.byte 0x1a +.byte 0x5 +.byte 0xa +.byte 0x15 +.byte 0x1d +.byte 0x2 +.byte 0x3 +.byte 0x1c +.byte 0x14 +.byte 0xb +.byte 0x4 +.byte 0x1b +.byte 0x13 +.byte 0xc +.byte 0xb +.byte 0x14 +.byte 0x1c +.byte 0x3 +.byte 0xc +.byte 0x13 +.byte 0x1b +.byte 0x4 +.byte 0x5 +.byte 0x1a +.byte 0x12 +.byte 0xd +.byte 0x2 +.byte 0x1d +.byte 0x15 +.byte 0xa +.byte 0x17 +.byte 0x8 +.byte 0x0 +.byte 0x1f +.byte 0x10 +.byte 0xf +.byte 0x7 +.byte 0x18 +.byte 0x19 +.byte 0x6 +.byte 0xe +.byte 0x11 +.byte 0x1e +.byte 0x1 +.byte 0x9 +.byte 0x16 +.byte 0x1a +.byte 0x5 +.byte 0xd +.byte 0x12 +.byte 0x1d +.byte 0x2 +.byte 0xa +.byte 0x15 +.byte 0x14 +.byte 0xb +.byte 0x3 +.byte 0x1c +.byte 0x13 +.byte 0xc +.byte 0x4 +.byte 0x1b +.byte 0x6 +.byte 0x19 +.byte 0x11 +.byte 0xe +.byte 0x1 +.byte 0x1e +.byte 0x16 +.byte 0x9 +.byte 0x8 +.byte 0x17 +.byte 0x1f +.byte 0x0 +.byte 0xf +.byte 0x10 +.byte 0x18 +.byte 0x7 +.byte 0x13 +.byte 0xc +.byte 0x4 +.byte 0x1b +.byte 0x14 +.byte 0xb +.byte 0x3 +.byte 0x1c +.byte 0x1d +.byte 0x2 +.byte 0xa +.byte 0x15 +.byte 0x1a +.byte 0x5 +.byte 0xd +.byte 0x12 +.byte 0xf +.byte 0x10 +.byte 0x18 +.byte 0x7 +.byte 0x8 +.byte 0x17 +.byte 0x1f +.byte 0x0 +.byte 0x1 +.byte 0x1e +.byte 0x16 +.byte 0x9 +.byte 0x6 +.byte 0x19 +.byte 0x11 +.byte 0xe +.byte 0x2 +.byte 0x1d +.byte 0x15 +.byte 0xa +.byte 0x5 +.byte 0x1a +.byte 0x12 +.byte 0xd +.byte 0xc +.byte 0x13 +.byte 0x1b +.byte 0x4 +.byte 0xb +.byte 0x14 +.byte 0x1c +.byte 0x3 +.byte 0x1e +.byte 0x1 +.byte 0x9 +.byte 0x16 +.byte 0x19 +.byte 0x6 +.byte 0xe +.byte 0x11 +.byte 0x10 +.byte 0xf +.byte 0x7 +.byte 0x18 +.byte 0x17 +.byte 0x8 +.byte 0x0 +.byte 0x1f +.byte 0x18 +.byte 0x7 +.byte 0xf +.byte 0x10 +.byte 0x1f +.byte 0x0 +.byte 0x8 +.byte 0x17 +.byte 0x16 +.byte 0x9 +.byte 0x1 +.byte 0x1e +.byte 0x11 +.byte 0xe +.byte 0x6 +.byte 0x19 +.byte 0x4 +.byte 0x1b +.byte 0x13 +.byte 0xc +.byte 0x3 +.byte 0x1c +.byte 0x14 +.byte 0xb +.byte 0xa +.byte 0x15 +.byte 0x1d +.byte 0x2 +.byte 0xd +.byte 0x12 +.byte 0x1a +.byte 0x5 +.byte 0x9 +.byte 0x16 +.byte 0x1e +.byte 0x1 +.byte 0xe +.byte 0x11 +.byte 0x19 +.byte 0x6 +.byte 0x7 +.byte 0x18 +.byte 0x10 +.byte 0xf +.byte 0x0 +.byte 0x1f +.byte 0x17 +.byte 0x8 +.byte 0x15 +.byte 0xa +.byte 0x2 +.byte 0x1d +.byte 0x12 +.byte 0xd +.byte 0x5 +.byte 0x1a +.byte 0x1b +.byte 0x4 +.byte 0xc +.byte 0x13 +.byte 0x1c +.byte 0x3 +.byte 0xb +.byte 0x14 +.byte 0x5 +.byte 0x1a +.byte 0x12 +.byte 0xd +.byte 0x2 +.byte 0x1d +.byte 0x15 +.byte 0xa +.byte 0xb +.byte 0x14 +.byte 0x1c +.byte 0x3 +.byte 0xc +.byte 0x13 +.byte 0x1b +.byte 0x4 +.byte 0x19 +.byte 0x6 +.byte 0xe +.byte 0x11 +.byte 0x1e +.byte 0x1 +.byte 0x9 +.byte 0x16 +.byte 0x17 +.byte 0x8 +.byte 0x0 +.byte 0x1f +.byte 0x10 +.byte 0xf +.byte 0x7 +.byte 0x18 +.byte 0x14 +.byte 0xb +.byte 0x3 +.byte 0x1c +.byte 0x13 +.byte 0xc +.byte 0x4 +.byte 0x1b +.byte 0x1a +.byte 0x5 +.byte 0xd +.byte 0x12 +.byte 0x1d +.byte 0x2 +.byte 0xa +.byte 0x15 +.byte 0x8 +.byte 0x17 +.byte 0x1f +.byte 0x0 +.byte 0xf +.byte 0x10 +.byte 0x18 +.byte 0x7 +.byte 0x6 +.byte 0x19 +.byte 0x11 +.byte 0xe +.byte 0x1 +.byte 0x1e +.byte 0x16 +.byte 0x9 +.byte 0xe +.byte 0x11 +.byte 0x19 +.byte 0x6 +.byte 0x9 +.byte 0x16 +.byte 0x1e +.byte 0x1 +.byte 0x0 +.byte 0x1f +.byte 0x17 +.byte 0x8 +.byte 0x7 +.byte 0x18 +.byte 0x10 +.byte 0xf +.byte 0x12 +.byte 0xd +.byte 0x5 +.byte 0x1a +.byte 0x15 +.byte 0xa +.byte 0x2 +.byte 0x1d +.byte 0x1c +.byte 0x3 +.byte 0xb +.byte 0x14 +.byte 0x1b +.byte 0x4 +.byte 0xc +.byte 0x13 +.byte 0x1f +.byte 0x0 +.byte 0x8 +.byte 0x17 +.byte 0x18 +.byte 0x7 +.byte 0xf +.byte 0x10 +.byte 0x11 +.byte 0xe +.byte 0x6 +.byte 0x19 +.byte 0x16 +.byte 0x9 +.byte 0x1 +.byte 0x1e +.byte 0x3 +.byte 0x1c +.byte 0x14 +.byte 0xb +.byte 0x4 +.byte 0x1b +.byte 0x13 +.byte 0xc +.byte 0xd +.byte 0x12 +.byte 0x1a +.byte 0x5 +.byte 0xa +.byte 0x15 +.byte 0x1d +.byte 0x2 +.byte 0x1c +.byte 0x3 +.byte 0xb +.byte 0x14 +.byte 0x1b +.byte 0x4 +.byte 0xc +.byte 0x13 +.byte 0x12 +.byte 0xd +.byte 0x5 +.byte 0x1a +.byte 0x15 +.byte 0xa +.byte 0x2 +.byte 0x1d +.byte 0x0 +.byte 0x1f +.byte 0x17 +.byte 0x8 +.byte 0x7 +.byte 0x18 +.byte 0x10 +.byte 0xf +.byte 0xe +.byte 0x11 +.byte 0x19 +.byte 0x6 +.byte 0x9 +.byte 0x16 +.byte 0x1e +.byte 0x1 +.byte 0xd +.byte 0x12 +.byte 0x1a +.byte 0x5 +.byte 0xa +.byte 0x15 +.byte 0x1d +.byte 0x2 +.byte 0x3 +.byte 0x1c +.byte 0x14 +.byte 0xb +.byte 0x4 +.byte 0x1b +.byte 0x13 +.byte 0xc +.byte 0x11 +.byte 0xe +.byte 0x6 +.byte 0x19 +.byte 0x16 +.byte 0x9 +.byte 0x1 +.byte 0x1e +.byte 0x1f +.byte 0x0 +.byte 0x8 +.byte 0x17 +.byte 0x18 +.byte 0x7 +.byte 0xf +.byte 0x10 +.byte 0x17 +.byte 0x8 +.byte 0x0 +.byte 0x1f +.byte 0x10 +.byte 0xf +.byte 0x7 +.byte 0x18 +.byte 0x19 +.byte 0x6 +.byte 0xe +.byte 0x11 +.byte 0x1e +.byte 0x1 +.byte 0x9 +.byte 0x16 +.byte 0xb +.byte 0x14 +.byte 0x1c +.byte 0x3 +.byte 0xc +.byte 0x13 +.byte 0x1b +.byte 0x4 +.byte 0x5 +.byte 0x1a +.byte 0x12 +.byte 0xd +.byte 0x2 +.byte 0x1d +.byte 0x15 +.byte 0xa +.byte 0x6 +.byte 0x19 +.byte 0x11 +.byte 0xe +.byte 0x1 +.byte 0x1e +.byte 0x16 +.byte 0x9 +.byte 0x8 +.byte 0x17 +.byte 0x1f +.byte 0x0 +.byte 0xf +.byte 0x10 +.byte 0x18 +.byte 0x7 +.byte 0x1a +.byte 0x5 +.byte 0xd +.byte 0x12 +.byte 0x1d +.byte 0x2 +.byte 0xa +.byte 0x15 +.byte 0x14 +.byte 0xb +.byte 0x3 +.byte 0x1c +.byte 0x13 +.byte 0xc +.byte 0x4 +.byte 0x1b +.byte 0xa +.byte 0x15 +.byte 0x1d +.byte 0x2 +.byte 0xd +.byte 0x12 +.byte 0x1a +.byte 0x5 +.byte 0x4 +.byte 0x1b +.byte 0x13 +.byte 0xc +.byte 0x3 +.byte 0x1c +.byte 0x14 +.byte 0xb +.byte 0x16 +.byte 0x9 +.byte 0x1 +.byte 0x1e +.byte 0x11 +.byte 0xe +.byte 0x6 +.byte 0x19 +.byte 0x18 +.byte 0x7 +.byte 0xf +.byte 0x10 +.byte 0x1f +.byte 0x0 +.byte 0x8 +.byte 0x17 +.byte 0x1b +.byte 0x4 +.byte 0xc +.byte 0x13 +.byte 0x1c +.byte 0x3 +.byte 0xb +.byte 0x14 +.byte 0x15 +.byte 0xa +.byte 0x2 +.byte 0x1d +.byte 0x12 +.byte 0xd +.byte 0x5 +.byte 0x1a +.byte 0x7 +.byte 0x18 +.byte 0x10 +.byte 0xf +.byte 0x0 +.byte 0x1f +.byte 0x17 +.byte 0x8 +.byte 0x9 +.byte 0x16 +.byte 0x1e +.byte 0x1 +.byte 0xe +.byte 0x11 +.byte 0x19 +.byte 0x6 +.byte 0x1 +.byte 0x1e +.byte 0x16 +.byte 0x9 +.byte 0x6 +.byte 0x19 +.byte 0x11 +.byte 0xe +.byte 0xf +.byte 0x10 +.byte 0x18 +.byte 0x7 +.byte 0x8 +.byte 0x17 +.byte 0x1f +.byte 0x0 +.byte 0x1d +.byte 0x2 +.byte 0xa +.byte 0x15 +.byte 0x1a +.byte 0x5 +.byte 0xd +.byte 0x12 +.byte 0x13 +.byte 0xc +.byte 0x4 +.byte 0x1b +.byte 0x14 +.byte 0xb +.byte 0x3 +.byte 0x1c +.byte 0x10 +.byte 0xf +.byte 0x7 +.byte 0x18 +.byte 0x17 +.byte 0x8 +.byte 0x0 +.byte 0x1f +.byte 0x1e +.byte 0x1 +.byte 0x9 +.byte 0x16 +.byte 0x19 +.byte 0x6 +.byte 0xe +.byte 0x11 +.byte 0xc +.byte 0x13 +.byte 0x1b +.byte 0x4 +.byte 0xb +.byte 0x14 +.byte 0x1c +.byte 0x3 +.byte 0x2 +.byte 0x1d +.byte 0x15 +.byte 0xa +.byte 0x5 +.byte 0x1a +.byte 0x12 +.byte 0xd +.byte 0x19 +.byte 0x6 +.byte 0xe +.byte 0x11 +.byte 0x1e +.byte 0x1 +.byte 0x9 +.byte 0x16 +.byte 0x17 +.byte 0x8 +.byte 0x0 +.byte 0x1f +.byte 0x10 +.byte 0xf +.byte 0x7 +.byte 0x18 +.byte 0x5 +.byte 0x1a +.byte 0x12 +.byte 0xd +.byte 0x2 +.byte 0x1d +.byte 0x15 +.byte 0xa +.byte 0xb +.byte 0x14 +.byte 0x1c +.byte 0x3 +.byte 0xc +.byte 0x13 +.byte 0x1b +.byte 0x4 +.byte 0x8 +.byte 0x17 +.byte 0x1f +.byte 0x0 +.byte 0xf +.byte 0x10 +.byte 0x18 +.byte 0x7 +.byte 0x6 +.byte 0x19 +.byte 0x11 +.byte 0xe +.byte 0x1 +.byte 0x1e +.byte 0x16 +.byte 0x9 +.byte 0x14 +.byte 0xb +.byte 0x3 +.byte 0x1c +.byte 0x13 +.byte 0xc +.byte 0x4 +.byte 0x1b +.byte 0x1a +.byte 0x5 +.byte 0xd +.byte 0x12 +.byte 0x1d +.byte 0x2 +.byte 0xa +.byte 0x15 +.byte 0x12 +.byte 0xd +.byte 0x5 +.byte 0x1a +.byte 0x15 +.byte 0xa +.byte 0x2 +.byte 0x1d +.byte 0x1c +.byte 0x3 +.byte 0xb +.byte 0x14 +.byte 0x1b +.byte 0x4 +.byte 0xc +.byte 0x13 +.byte 0xe +.byte 0x11 +.byte 0x19 +.byte 0x6 +.byte 0x9 +.byte 0x16 +.byte 0x1e +.byte 0x1 +.byte 0x0 +.byte 0x1f +.byte 0x17 +.byte 0x8 +.byte 0x7 +.byte 0x18 +.byte 0x10 +.byte 0xf +.byte 0x3 +.byte 0x1c +.byte 0x14 +.byte 0xb +.byte 0x4 +.byte 0x1b +.byte 0x13 +.byte 0xc +.byte 0xd +.byte 0x12 +.byte 0x1a +.byte 0x5 +.byte 0xa +.byte 0x15 +.byte 0x1d +.byte 0x2 +.byte 0x1f +.byte 0x0 +.byte 0x8 +.byte 0x17 +.byte 0x18 +.byte 0x7 +.byte 0xf +.byte 0x10 +.byte 0x11 +.byte 0xe +.byte 0x6 +.byte 0x19 +.byte 0x16 +.byte 0x9 +.byte 0x1 +.byte 0x1e +.byte 0xf +.byte 0x10 +.byte 0x18 +.byte 0x7 +.byte 0x8 +.byte 0x17 +.byte 0x1f +.byte 0x0 +.byte 0x1 +.byte 0x1e +.byte 0x16 +.byte 0x9 +.byte 0x6 +.byte 0x19 +.byte 0x11 +.byte 0xe +.byte 0x13 +.byte 0xc +.byte 0x4 +.byte 0x1b +.byte 0x14 +.byte 0xb +.byte 0x3 +.byte 0x1c +.byte 0x1d +.byte 0x2 +.byte 0xa +.byte 0x15 +.byte 0x1a +.byte 0x5 +.byte 0xd +.byte 0x12 +.byte 0x1e +.byte 0x1 +.byte 0x9 +.byte 0x16 +.byte 0x19 +.byte 0x6 +.byte 0xe +.byte 0x11 +.byte 0x10 +.byte 0xf +.byte 0x7 +.byte 0x18 +.byte 0x17 +.byte 0x8 +.byte 0x0 +.byte 0x1f +.byte 0x2 +.byte 0x1d +.byte 0x15 +.byte 0xa +.byte 0x5 +.byte 0x1a +.byte 0x12 +.byte 0xd +.byte 0xc +.byte 0x13 +.byte 0x1b +.byte 0x4 +.byte 0xb +.byte 0x14 +.byte 0x1c +.byte 0x3 +.byte 0x4 +.byte 0x1b +.byte 0x13 +.byte 0xc +.byte 0x3 +.byte 0x1c +.byte 0x14 +.byte 0xb +.byte 0xa +.byte 0x15 +.byte 0x1d +.byte 0x2 +.byte 0xd +.byte 0x12 +.byte 0x1a +.byte 0x5 +.byte 0x18 +.byte 0x7 +.byte 0xf +.byte 0x10 +.byte 0x1f +.byte 0x0 +.byte 0x8 +.byte 0x17 +.byte 0x16 +.byte 0x9 +.byte 0x1 +.byte 0x1e +.byte 0x11 +.byte 0xe +.byte 0x6 +.byte 0x19 +.byte 0x15 +.byte 0xa +.byte 0x2 +.byte 0x1d +.byte 0x12 +.byte 0xd +.byte 0x5 +.byte 0x1a +.byte 0x1b +.byte 0x4 +.byte 0xc +.byte 0x13 +.byte 0x1c +.byte 0x3 +.byte 0xb +.byte 0x14 +.byte 0x9 +.byte 0x16 +.byte 0x1e +.byte 0x1 +.byte 0xe +.byte 0x11 +.byte 0x19 +.byte 0x6 +.byte 0x7 +.byte 0x18 +.byte 0x10 +.byte 0xf +.byte 0x0 +.byte 0x1f +.byte 0x17 +.byte 0x8 +.size crc5Table_Addr, .-crc5Table_Addr +.cc_bottom crc5Table_Addr.func diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index 205dc3f9..213ad4c4 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -114,7 +114,7 @@ unsigned chanArray; #if (XUD_OPT_SOFTCRC5 == 1) extern unsigned char crc5Table[2048]; -unsigned char crc5Table_Addr[2048]; +extern unsigned char crc5Table_Addr[2048]; void XUD_SetCrcTableAddr(unsigned addr); #endif diff --git a/lib_xud/src/core/XUD_SetCrcTableAddr.c b/lib_xud/src/core/XUD_SetCrcTableAddr.c index fe62275e..747f210d 100644 --- a/lib_xud/src/core/XUD_SetCrcTableAddr.c +++ b/lib_xud/src/core/XUD_SetCrcTableAddr.c @@ -5,10 +5,9 @@ /* Global table used to store complete valid CRC5 table */ -/* TODO Should be char */ extern unsigned char crc5Table[2048]; -/* Glocal table used to store valid CRCs for current address, all other address is this table are invalidated */ +/* Global table used to store valid CRCs for current address, all other address is this table are invalidated */ extern unsigned char crc5Table_Addr[2048]; /** XUD_SetCrcTableAddress diff --git a/lib_xud/src/user/client/XUD_EpFuncs.S b/lib_xud/src/user/client/XUD_EpFuncs.S index 6bd34e98..61584ed7 100644 --- a/lib_xud/src/user/client/XUD_EpFuncs.S +++ b/lib_xud/src/user/client/XUD_EpFuncs.S @@ -1,6 +1,6 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2021, XMOS Ltd, All rights reserved /** XUD_EpFuncs.S - * @brief Functions for data transfer to/from XUD + * @brief ASM functions for data transfer to/from XUD * @author Ross Owen, XMOS Limited */ #include "XUD_USB_Defines.h" @@ -10,8 +10,20 @@ .assert 0, too_many_cores, "Warning: More than 6 cores used on a tile. Ensure this is not the case on tile running XUD." #endif +.section .cp.rodata,"ac", @progbits +.cc_top ep_info_address.data,ep_info_address +.align 4 +.type ep_info_address,@object +.size ep_info_address, 4 +ep_info_address: +.long ep_info +.cc_bottom ep_info_address.data + + + //int XUD_GetSetupData(XUD_ep e_out, unsigned buffer[], unsigned &length); // r0 r1 r2 +.text .globl XUD_GetSetupData .type XUD_GetSetupData, @function .cc_top XUD_GetSetupData.func @@ -602,7 +614,7 @@ XUD_ClearStallByAddr_ResetDataPid: // Reset DATA PID to DATA0 ldc r2, 40 // Size of XUD_ep_info struct TODO use sizeof() - mul r0, r0, r2 // Be careful with packing - ldaw r2, dp[ep_info] + ldw r2, cp[ep_info_address] add r0, r2, r0 stw r1, r0[4] @@ -659,7 +671,7 @@ XUD_ResetEpStateByAddr_: NoOffset: ldc r2, 40 // Size of XUD_ep_info struct TODO. FIXME! mul r0, r0, r2 - ldaw r2, dp[ep_info] + ldw r2, cp[ep_info_address] add r0, r2, r0 stw r1, r0[4] retsp 0 From 095f6d2e14132606b045d116e70eb3e86d082f10 Mon Sep 17 00:00:00 2001 From: mbanth Date: Fri, 26 Feb 2021 15:56:54 +0000 Subject: [PATCH 161/520] Change the node's type from "phoenix" to "XS3-L16A-1024" and add missing node parameters. --- tests/test_bulk_loopback/test_xs3.xn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_bulk_loopback/test_xs3.xn b/tests/test_bulk_loopback/test_xs3.xn index 72b7b84b..afd525af 100644 --- a/tests/test_bulk_loopback/test_xs3.xn +++ b/tests/test_bulk_loopback/test_xs3.xn @@ -9,7 +9,7 @@ - + From 51434786a6b5ed4100882006084ed784a500d6ec Mon Sep 17 00:00:00 2001 From: mbanth Date: Fri, 5 Mar 2021 13:50:28 +0000 Subject: [PATCH 162/520] Add stub functions for a prologue and an epilogue when running tests.. Also add stub functions for making a copy of common XN files and deleting those copies. --- tests/runtests.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/runtests.py b/tests/runtests.py index 7f6e2748..6a94ff0f 100644 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -4,6 +4,18 @@ import helpers +def copy_common_xn_files(args): + pass + +def delete_test_specific_xn_files(args): + pass + +def prologue(args): + pass + +def epilogue(args): + pass + if __name__ == "__main__": global trace argparser = argparse.ArgumentParser(description="XMOS lib_xud tests") @@ -14,6 +26,8 @@ helpers.args = xmostest.init(argparser) + prologue(helpers.args) + xmostest.register_group("lib_xud", "xud_sim_tests", "XUD simulator tests", @@ -37,3 +51,5 @@ xmostest.runtests() xmostest.finish() + + epilogue(helpers.args) From 0eac7e1a570808115a892d56d01594bd14fc501b Mon Sep 17 00:00:00 2001 From: mbanth Date: Fri, 5 Mar 2021 15:52:46 +0000 Subject: [PATCH 163/520] Create common XN files --- tests/shared_src/test_xs1.xn | 89 ++++++++++++++++++++++++++++++++++++ tests/shared_src/test_xs2.xn | 72 +++++++++++++++++++++++++++++ tests/shared_src/test_xs3.xn | 24 ++++++++++ 3 files changed, 185 insertions(+) create mode 100644 tests/shared_src/test_xs1.xn create mode 100644 tests/shared_src/test_xs2.xn create mode 100644 tests/shared_src/test_xs3.xn diff --git a/tests/shared_src/test_xs1.xn b/tests/shared_src/test_xs1.xn new file mode 100644 index 00000000..64455827 --- /dev/null +++ b/tests/shared_src/test_xs1.xn @@ -0,0 +1,89 @@ + + + + + tileref tile[1] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/shared_src/test_xs2.xn b/tests/shared_src/test_xs2.xn new file mode 100644 index 00000000..b580b486 --- /dev/null +++ b/tests/shared_src/test_xs2.xn @@ -0,0 +1,72 @@ + + + Board + XS2 MC Audio + + tileref tile[2] + tileref usb_tile + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/shared_src/test_xs3.xn b/tests/shared_src/test_xs3.xn new file mode 100644 index 00000000..6ea38caf --- /dev/null +++ b/tests/shared_src/test_xs3.xn @@ -0,0 +1,24 @@ + + + + tileref tile[2] + + + + + + + + + + + + + + + + + + From 7e54b58878b3be3cdd691e4be9b87b74965ecca2 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 8 Mar 2021 17:12:36 +0000 Subject: [PATCH 164/520] Fix sim tests --- lib_xud/src/core/XUD_HAL.xc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib_xud/src/core/XUD_HAL.xc b/lib_xud/src/core/XUD_HAL.xc index 35de78a2..bf24ad0b 100644 --- a/lib_xud/src/core/XUD_HAL.xc +++ b/lib_xud/src/core/XUD_HAL.xc @@ -49,11 +49,12 @@ unsigned int XUD_EnableUsbPortMux(); void XUD_HAL_EnableUsb(unsigned pwrConfig) { -#ifndef XUD_SIM_XSIM /* For xCORE-200 enable USB port muxing before enabling phy etc */ // TODO inline ASM here XUD_EnableUsbPortMux(); //setps(XS1_PS_XCORE_CTRL0, UIFM_MODE); +#ifndef XUD_SIM_XSIM + #ifdef __XS2A__ /* Enable the USB clock */ write_sswitch_reg(get_tile_id(USB_TILE_REF), XS1_SU_CFG_RST_MISC_NUM, ( 1 << XS1_SU_CFG_USB_CLK_EN_SHIFT)); From b674bf6012af47b2c64bf0a14fd995f602a8f1e9 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 8 Mar 2021 17:17:51 +0000 Subject: [PATCH 165/520] Fixed broken include syntax --- tests/shared_src/shared.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/shared_src/shared.h b/tests/shared_src/shared.h index 9e3dfaf5..fe2be0a8 100644 --- a/tests/shared_src/shared.h +++ b/tests/shared_src/shared.h @@ -3,7 +3,7 @@ #include #include #include -#include "xud.h +#include "xud.h" unsigned char g_rxDataCheck_[16] = {0}; unsigned char g_txDataCheck_[16] = {0}; From dd00ffd4beb4187469bfa27819a5ceb353d01b0c Mon Sep 17 00:00:00 2001 From: mbanth Date: Mon, 8 Mar 2021 17:58:28 +0000 Subject: [PATCH 166/520] Delete distributed XN files --- tests/runtests.py | 49 +++++++--- tests/test_bulk_loopback/src/test.xn | 72 --------------- tests/test_bulk_loopback/src/test_xs1.xn | 89 ------------------- tests/test_bulk_loopback/test_xs1.xn | 89 ------------------- tests/test_bulk_loopback/test_xs2.xn | 72 --------------- tests/test_bulk_loopback/test_xs3.xn | 24 ----- tests/test_bulk_rx_basic/src/test_xs1.xn | 89 ------------------- tests/test_bulk_rx_basic/src/test_xs2.xn | 72 --------------- tests/test_bulk_rx_basic/src/test_xs3.xn | 24 ----- tests/test_bulk_rx_basic_badcrc32/src/test.xn | 72 --------------- .../src/test_xs1.xn | 89 ------------------- .../src/test_xs2.xn | 72 --------------- .../src/test_xs3.xn | 24 ----- tests/test_bulk_rx_basic_badpid/src/test.xn | 72 --------------- .../test_bulk_rx_basic_badpid/src/test_xs1.xn | 89 ------------------- .../test_bulk_rx_basic_badpid/src/test_xs2.xn | 72 --------------- .../test_bulk_rx_basic_badpid/src/test_xs3.xn | 24 ----- tests/test_bulk_rx_basic_nodata/src/test.xn | 72 --------------- .../test_bulk_rx_basic_nodata/src/test_xs1.xn | 89 ------------------- .../test_bulk_rx_basic_nodata/src/test_xs2.xn | 72 --------------- .../test_bulk_rx_basic_nodata/src/test_xs3.xn | 24 ----- tests/test_bulk_rx_basic_rxerror/src/test.xn | 72 --------------- .../src/test_xs1.xn | 89 ------------------- .../src/test_xs2.xn | 72 --------------- .../src/test_xs3.xn | 24 ----- tests/test_bulk_rx_fastpacket/src/test.xn | 72 --------------- tests/test_bulk_rx_fastpacket/src/test_xs1.xn | 89 ------------------- tests/test_bulk_rx_fastpacket/src/test_xs2.xn | 72 --------------- tests/test_bulk_rx_fastpacket/src/test_xs3.xn | 24 ----- tests/test_bulk_rx_multiep/src/test.xn | 72 --------------- tests/test_bulk_rx_multiep/src/test_xs1.xn | 89 ------------------- tests/test_bulk_rx_multiep/src/test_xs2.xn | 72 --------------- tests/test_bulk_rx_multiep/src/test_xs3.xn | 24 ----- tests/test_bulk_rx_traffic/src/test_xs1.xn | 89 ------------------- tests/test_bulk_rx_traffic/src/test_xs2.xn | 72 --------------- tests/test_bulk_rx_traffic/src/test_xs3.xn | 24 ----- tests/test_bulk_rxtx_fastpacket/src/test.xn | 72 --------------- .../test_bulk_rxtx_fastpacket/src/test_xs1.xn | 89 ------------------- .../test_bulk_rxtx_fastpacket/src/test_xs2.xn | 72 --------------- .../test_bulk_rxtx_fastpacket/src/test_xs3.xn | 24 ----- tests/test_bulk_tx_badack/src/test.xn | 72 --------------- tests/test_bulk_tx_badack/src/test_xs1.xn | 89 ------------------- tests/test_bulk_tx_badack/src/test_xs2.xn | 72 --------------- tests/test_bulk_tx_badack/src/test_xs3.xn | 24 ----- tests/test_bulk_tx_basic/src/test.xn | 72 --------------- tests/test_bulk_tx_basic/src/test_xs1.xn | 89 ------------------- tests/test_bulk_tx_basic/src/test_xs2.xn | 72 --------------- tests/test_bulk_tx_basic/src/test_xs3.xn | 24 ----- tests/test_bulk_tx_basic_short/src/test.xn | 72 --------------- .../test_bulk_tx_basic_short/src/test_xs1.xn | 89 ------------------- .../test_bulk_tx_basic_short/src/test_xs2.xn | 72 --------------- .../test_bulk_tx_basic_short/src/test_xs3.xn | 24 ----- tests/test_bulk_tx_fastpacket/src/test.xn | 72 --------------- tests/test_bulk_tx_fastpacket/src/test_xs1.xn | 89 ------------------- tests/test_bulk_tx_fastpacket/src/test_xs2.xn | 72 --------------- tests/test_bulk_tx_fastpacket/src/test_xs3.xn | 24 ----- tests/test_bulk_tx_multiep/src/test.xn | 72 --------------- tests/test_bulk_tx_multiep/src/test_xs1.xn | 89 ------------------- tests/test_bulk_tx_multiep/src/test_xs2.xn | 72 --------------- tests/test_bulk_tx_multiep/src/test_xs3.xn | 24 ----- tests/test_bulk_tx_noack/src/test.xn | 72 --------------- tests/test_bulk_tx_noack/src/test_xs1.xn | 89 ------------------- tests/test_bulk_tx_noack/src/test_xs2.xn | 72 --------------- tests/test_bulk_tx_noack/src/test_xs3.xn | 24 ----- tests/test_control_basic_badcrc32/src/test.xn | 72 --------------- .../src/test_xs1.xn | 89 ------------------- tests/test_control_basic_get/src/test.xn | 72 --------------- tests/test_control_basic_get/src/test_xs1.xn | 89 ------------------- tests/test_control_basic_get/src/test_xs3.xn | 24 ----- tests/test_control_basic_set/src/test.xn | 72 --------------- tests/test_control_basic_set/src/test_xs1.xn | 89 ------------------- tests/test_control_basic_set/src/test_xs3.xn | 24 ----- tests/test_control_basic_short/src/test.xn | 72 --------------- .../test_control_basic_short/src/test_xs1.xn | 89 ------------------- tests/test_control_repeatedsetup/src/test.xn | 72 --------------- .../src/test_xs1.xn | 89 ------------------- tests/test_invalidtoken/src/test.xn | 72 --------------- tests/test_invalidtoken/src/test_xs1.xn | 89 ------------------- tests/test_invalidtoken/src/test_xs2.xn | 72 --------------- tests/test_invalidtoken/src/test_xs3.xn | 24 ----- tests/test_iso_loopback/src/test.xn | 72 --------------- tests/test_iso_loopback/src/test_xs1.xn | 89 ------------------- tests/test_iso_loopback/src/test_xs2.xn | 72 --------------- tests/test_iso_loopback/src/test_xs3.xn | 24 ----- tests/test_iso_rx_basic/src/test.xn | 72 --------------- tests/test_iso_rx_basic/src/test_xs1.xn | 89 ------------------- tests/test_iso_rx_basic/src/test_xs2.xn | 72 --------------- tests/test_iso_rx_basic/src/test_xs3.xn | 24 ----- tests/test_iso_rxtx_fastpacket/src/test.xn | 72 --------------- .../test_iso_rxtx_fastpacket/src/test_xs1.xn | 89 ------------------- .../test_iso_rxtx_fastpacket/src/test_xs2.xn | 72 --------------- .../test_iso_rxtx_fastpacket/src/test_xs3.xn | 24 ----- tests/test_iso_tx_basic/src/test.xn | 72 --------------- tests/test_iso_tx_basic/src/test_xs1.xn | 89 ------------------- tests/test_iso_tx_basic/src/test_xs2.xn | 72 --------------- tests/test_iso_tx_basic/src/test_xs3.xn | 24 ----- tests/test_ping_rx_basic/src/test.xn | 72 --------------- tests/test_ping_rx_basic/src/test_xs1.xn | 89 ------------------- tests/test_ping_rx_basic/src/test_xs2.xn | 72 --------------- tests/test_ping_rx_basic/src/test_xs3.xn | 24 ----- tests/test_shorttoken/src/test.xn | 72 --------------- tests/test_shorttoken/src/test_xs1.xn | 89 ------------------- tests/test_shorttoken/src/test_xs2.xn | 72 --------------- tests/test_shorttoken/src/test_xs3.xn | 24 ----- tests/test_sof_badcrc/src/test.xn | 72 --------------- tests/test_sof_badcrc/src/test_xs1.xn | 89 ------------------- tests/test_sof_badcrc/src/test_xs2.xn | 72 --------------- tests/test_sof_badcrc/src/test_xs3.xn | 24 ----- tests/test_sof_basic/src/test.xn | 72 --------------- tests/test_sof_basic/src/test_xs1.xn | 89 ------------------- tests/test_sof_basic/src/test_xs2.xn | 72 --------------- tests/test_sof_basic/src/test_xs3.xn | 24 ----- 112 files changed, 35 insertions(+), 7237 deletions(-) delete mode 100644 tests/test_bulk_loopback/src/test.xn delete mode 100755 tests/test_bulk_loopback/src/test_xs1.xn delete mode 100755 tests/test_bulk_loopback/test_xs1.xn delete mode 100644 tests/test_bulk_loopback/test_xs2.xn delete mode 100644 tests/test_bulk_loopback/test_xs3.xn delete mode 100755 tests/test_bulk_rx_basic/src/test_xs1.xn delete mode 100644 tests/test_bulk_rx_basic/src/test_xs2.xn delete mode 100644 tests/test_bulk_rx_basic/src/test_xs3.xn delete mode 100644 tests/test_bulk_rx_basic_badcrc32/src/test.xn delete mode 100755 tests/test_bulk_rx_basic_badcrc32/src/test_xs1.xn delete mode 100644 tests/test_bulk_rx_basic_badcrc32/src/test_xs2.xn delete mode 100644 tests/test_bulk_rx_basic_badcrc32/src/test_xs3.xn delete mode 100644 tests/test_bulk_rx_basic_badpid/src/test.xn delete mode 100755 tests/test_bulk_rx_basic_badpid/src/test_xs1.xn delete mode 100644 tests/test_bulk_rx_basic_badpid/src/test_xs2.xn delete mode 100644 tests/test_bulk_rx_basic_badpid/src/test_xs3.xn delete mode 100644 tests/test_bulk_rx_basic_nodata/src/test.xn delete mode 100755 tests/test_bulk_rx_basic_nodata/src/test_xs1.xn delete mode 100644 tests/test_bulk_rx_basic_nodata/src/test_xs2.xn delete mode 100644 tests/test_bulk_rx_basic_nodata/src/test_xs3.xn delete mode 100644 tests/test_bulk_rx_basic_rxerror/src/test.xn delete mode 100755 tests/test_bulk_rx_basic_rxerror/src/test_xs1.xn delete mode 100644 tests/test_bulk_rx_basic_rxerror/src/test_xs2.xn delete mode 100644 tests/test_bulk_rx_basic_rxerror/src/test_xs3.xn delete mode 100644 tests/test_bulk_rx_fastpacket/src/test.xn delete mode 100755 tests/test_bulk_rx_fastpacket/src/test_xs1.xn delete mode 100644 tests/test_bulk_rx_fastpacket/src/test_xs2.xn delete mode 100644 tests/test_bulk_rx_fastpacket/src/test_xs3.xn delete mode 100644 tests/test_bulk_rx_multiep/src/test.xn delete mode 100755 tests/test_bulk_rx_multiep/src/test_xs1.xn delete mode 100644 tests/test_bulk_rx_multiep/src/test_xs2.xn delete mode 100644 tests/test_bulk_rx_multiep/src/test_xs3.xn delete mode 100755 tests/test_bulk_rx_traffic/src/test_xs1.xn delete mode 100644 tests/test_bulk_rx_traffic/src/test_xs2.xn delete mode 100644 tests/test_bulk_rx_traffic/src/test_xs3.xn delete mode 100644 tests/test_bulk_rxtx_fastpacket/src/test.xn delete mode 100755 tests/test_bulk_rxtx_fastpacket/src/test_xs1.xn delete mode 100644 tests/test_bulk_rxtx_fastpacket/src/test_xs2.xn delete mode 100644 tests/test_bulk_rxtx_fastpacket/src/test_xs3.xn delete mode 100644 tests/test_bulk_tx_badack/src/test.xn delete mode 100755 tests/test_bulk_tx_badack/src/test_xs1.xn delete mode 100644 tests/test_bulk_tx_badack/src/test_xs2.xn delete mode 100644 tests/test_bulk_tx_badack/src/test_xs3.xn delete mode 100644 tests/test_bulk_tx_basic/src/test.xn delete mode 100755 tests/test_bulk_tx_basic/src/test_xs1.xn delete mode 100644 tests/test_bulk_tx_basic/src/test_xs2.xn delete mode 100644 tests/test_bulk_tx_basic/src/test_xs3.xn delete mode 100644 tests/test_bulk_tx_basic_short/src/test.xn delete mode 100755 tests/test_bulk_tx_basic_short/src/test_xs1.xn delete mode 100644 tests/test_bulk_tx_basic_short/src/test_xs2.xn delete mode 100644 tests/test_bulk_tx_basic_short/src/test_xs3.xn delete mode 100644 tests/test_bulk_tx_fastpacket/src/test.xn delete mode 100755 tests/test_bulk_tx_fastpacket/src/test_xs1.xn delete mode 100644 tests/test_bulk_tx_fastpacket/src/test_xs2.xn delete mode 100644 tests/test_bulk_tx_fastpacket/src/test_xs3.xn delete mode 100644 tests/test_bulk_tx_multiep/src/test.xn delete mode 100755 tests/test_bulk_tx_multiep/src/test_xs1.xn delete mode 100644 tests/test_bulk_tx_multiep/src/test_xs2.xn delete mode 100644 tests/test_bulk_tx_multiep/src/test_xs3.xn delete mode 100644 tests/test_bulk_tx_noack/src/test.xn delete mode 100755 tests/test_bulk_tx_noack/src/test_xs1.xn delete mode 100644 tests/test_bulk_tx_noack/src/test_xs2.xn delete mode 100644 tests/test_bulk_tx_noack/src/test_xs3.xn delete mode 100644 tests/test_control_basic_badcrc32/src/test.xn delete mode 100755 tests/test_control_basic_badcrc32/src/test_xs1.xn delete mode 100644 tests/test_control_basic_get/src/test.xn delete mode 100755 tests/test_control_basic_get/src/test_xs1.xn delete mode 100644 tests/test_control_basic_get/src/test_xs3.xn delete mode 100644 tests/test_control_basic_set/src/test.xn delete mode 100755 tests/test_control_basic_set/src/test_xs1.xn delete mode 100644 tests/test_control_basic_set/src/test_xs3.xn delete mode 100644 tests/test_control_basic_short/src/test.xn delete mode 100755 tests/test_control_basic_short/src/test_xs1.xn delete mode 100644 tests/test_control_repeatedsetup/src/test.xn delete mode 100755 tests/test_control_repeatedsetup/src/test_xs1.xn delete mode 100644 tests/test_invalidtoken/src/test.xn delete mode 100755 tests/test_invalidtoken/src/test_xs1.xn delete mode 100644 tests/test_invalidtoken/src/test_xs2.xn delete mode 100644 tests/test_invalidtoken/src/test_xs3.xn delete mode 100644 tests/test_iso_loopback/src/test.xn delete mode 100755 tests/test_iso_loopback/src/test_xs1.xn delete mode 100644 tests/test_iso_loopback/src/test_xs2.xn delete mode 100644 tests/test_iso_loopback/src/test_xs3.xn delete mode 100644 tests/test_iso_rx_basic/src/test.xn delete mode 100755 tests/test_iso_rx_basic/src/test_xs1.xn delete mode 100644 tests/test_iso_rx_basic/src/test_xs2.xn delete mode 100644 tests/test_iso_rx_basic/src/test_xs3.xn delete mode 100644 tests/test_iso_rxtx_fastpacket/src/test.xn delete mode 100755 tests/test_iso_rxtx_fastpacket/src/test_xs1.xn delete mode 100644 tests/test_iso_rxtx_fastpacket/src/test_xs2.xn delete mode 100644 tests/test_iso_rxtx_fastpacket/src/test_xs3.xn delete mode 100644 tests/test_iso_tx_basic/src/test.xn delete mode 100755 tests/test_iso_tx_basic/src/test_xs1.xn delete mode 100644 tests/test_iso_tx_basic/src/test_xs2.xn delete mode 100644 tests/test_iso_tx_basic/src/test_xs3.xn delete mode 100644 tests/test_ping_rx_basic/src/test.xn delete mode 100755 tests/test_ping_rx_basic/src/test_xs1.xn delete mode 100644 tests/test_ping_rx_basic/src/test_xs2.xn delete mode 100644 tests/test_ping_rx_basic/src/test_xs3.xn delete mode 100644 tests/test_shorttoken/src/test.xn delete mode 100755 tests/test_shorttoken/src/test_xs1.xn delete mode 100644 tests/test_shorttoken/src/test_xs2.xn delete mode 100644 tests/test_shorttoken/src/test_xs3.xn delete mode 100644 tests/test_sof_badcrc/src/test.xn delete mode 100755 tests/test_sof_badcrc/src/test_xs1.xn delete mode 100644 tests/test_sof_badcrc/src/test_xs2.xn delete mode 100644 tests/test_sof_badcrc/src/test_xs3.xn delete mode 100644 tests/test_sof_basic/src/test.xn delete mode 100755 tests/test_sof_basic/src/test_xs1.xn delete mode 100644 tests/test_sof_basic/src/test_xs2.xn delete mode 100644 tests/test_sof_basic/src/test_xs3.xn diff --git a/tests/runtests.py b/tests/runtests.py index 6a94ff0f..38e308c3 100644 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -1,20 +1,40 @@ #!/usr/bin/env python import xmostest import argparse +import os +import re +import shutil import helpers -def copy_common_xn_files(args): - pass +XN_FILES = ["test_xs1.xn", "test_xs2.xn", "test_xs3.xn"] -def delete_test_specific_xn_files(args): - pass +def list_test_dirs(args, path = ".", pattern = '^test_*'): + dirs = os.listdir(path) + test_dirs = [dir for dir in dirs if os.path.isdir(dir) and re.match(pattern, dir)] + return test_dirs + +def copy_common_xn_files(args, path = ".", common_dir = "shared_src", source_dir = "src", xn_files = XN_FILES): + test_dirs = list_test_dirs(args, path) + for test_dir in test_dirs: + src_dir = os.path.join(test_dir, source_dir) + for xn_file in xn_files: + xn = os.path.join(common_dir, xn_file) + shutil.copy(xn, src_dir) + +def delete_test_specific_xn_files(args, path = ".", source_dir = "src", xn_files = XN_FILES): + test_dirs = list_test_dirs(args, path) + for test_dir in test_dirs: + src_dir = os.path.join(test_dir, source_dir) + for xn_file in xn_files: + xn = os.path.join(src_dir, xn_file) + os.remove(xn) def prologue(args): - pass + copy_common_xn_files(args) def epilogue(args): - pass + delete_test_specific_xn_files(args) if __name__ == "__main__": global trace @@ -28,10 +48,11 @@ def epilogue(args): prologue(helpers.args) - xmostest.register_group("lib_xud", - "xud_sim_tests", - "XUD simulator tests", - """ + try: + xmostest.register_group("lib_xud", + "xud_sim_tests", + "XUD simulator tests", + """ #Tests are performed by running the GPIO library connected to a simulator model #(written as a python plugin to xsim). The simulator model checks that the pins #are driven and read by the ports as expected. Tests are run to test the @@ -48,8 +69,8 @@ def epilogue(args): # * Outputting with timestamps #""") #''' - xmostest.runtests() - - xmostest.finish() + xmostest.runtests() + xmostest.finish() - epilogue(helpers.args) + finally: + epilogue(helpers.args) diff --git a/tests/test_bulk_loopback/src/test.xn b/tests/test_bulk_loopback/src/test.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_bulk_loopback/src/test.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_loopback/src/test_xs1.xn b/tests/test_bulk_loopback/src/test_xs1.xn deleted file mode 100755 index 573aef45..00000000 --- a/tests/test_bulk_loopback/src/test_xs1.xn +++ /dev/null @@ -1,89 +0,0 @@ - - - - - tileref tile[1] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_loopback/test_xs1.xn b/tests/test_bulk_loopback/test_xs1.xn deleted file mode 100755 index 573aef45..00000000 --- a/tests/test_bulk_loopback/test_xs1.xn +++ /dev/null @@ -1,89 +0,0 @@ - - - - - tileref tile[1] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_loopback/test_xs2.xn b/tests/test_bulk_loopback/test_xs2.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_bulk_loopback/test_xs2.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_loopback/test_xs3.xn b/tests/test_bulk_loopback/test_xs3.xn deleted file mode 100644 index afd525af..00000000 --- a/tests/test_bulk_loopback/test_xs3.xn +++ /dev/null @@ -1,24 +0,0 @@ - - - - tileref tile[2] - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rx_basic/src/test_xs1.xn b/tests/test_bulk_rx_basic/src/test_xs1.xn deleted file mode 100755 index 573aef45..00000000 --- a/tests/test_bulk_rx_basic/src/test_xs1.xn +++ /dev/null @@ -1,89 +0,0 @@ - - - - - tileref tile[1] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rx_basic/src/test_xs2.xn b/tests/test_bulk_rx_basic/src/test_xs2.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_bulk_rx_basic/src/test_xs2.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rx_basic/src/test_xs3.xn b/tests/test_bulk_rx_basic/src/test_xs3.xn deleted file mode 100644 index 6ea38caf..00000000 --- a/tests/test_bulk_rx_basic/src/test_xs3.xn +++ /dev/null @@ -1,24 +0,0 @@ - - - - tileref tile[2] - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rx_basic_badcrc32/src/test.xn b/tests/test_bulk_rx_basic_badcrc32/src/test.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_bulk_rx_basic_badcrc32/src/test.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rx_basic_badcrc32/src/test_xs1.xn b/tests/test_bulk_rx_basic_badcrc32/src/test_xs1.xn deleted file mode 100755 index 573aef45..00000000 --- a/tests/test_bulk_rx_basic_badcrc32/src/test_xs1.xn +++ /dev/null @@ -1,89 +0,0 @@ - - - - - tileref tile[1] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rx_basic_badcrc32/src/test_xs2.xn b/tests/test_bulk_rx_basic_badcrc32/src/test_xs2.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_bulk_rx_basic_badcrc32/src/test_xs2.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rx_basic_badcrc32/src/test_xs3.xn b/tests/test_bulk_rx_basic_badcrc32/src/test_xs3.xn deleted file mode 100644 index 6ea38caf..00000000 --- a/tests/test_bulk_rx_basic_badcrc32/src/test_xs3.xn +++ /dev/null @@ -1,24 +0,0 @@ - - - - tileref tile[2] - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rx_basic_badpid/src/test.xn b/tests/test_bulk_rx_basic_badpid/src/test.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_bulk_rx_basic_badpid/src/test.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rx_basic_badpid/src/test_xs1.xn b/tests/test_bulk_rx_basic_badpid/src/test_xs1.xn deleted file mode 100755 index 573aef45..00000000 --- a/tests/test_bulk_rx_basic_badpid/src/test_xs1.xn +++ /dev/null @@ -1,89 +0,0 @@ - - - - - tileref tile[1] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rx_basic_badpid/src/test_xs2.xn b/tests/test_bulk_rx_basic_badpid/src/test_xs2.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_bulk_rx_basic_badpid/src/test_xs2.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rx_basic_badpid/src/test_xs3.xn b/tests/test_bulk_rx_basic_badpid/src/test_xs3.xn deleted file mode 100644 index 6ea38caf..00000000 --- a/tests/test_bulk_rx_basic_badpid/src/test_xs3.xn +++ /dev/null @@ -1,24 +0,0 @@ - - - - tileref tile[2] - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rx_basic_nodata/src/test.xn b/tests/test_bulk_rx_basic_nodata/src/test.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_bulk_rx_basic_nodata/src/test.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rx_basic_nodata/src/test_xs1.xn b/tests/test_bulk_rx_basic_nodata/src/test_xs1.xn deleted file mode 100755 index 573aef45..00000000 --- a/tests/test_bulk_rx_basic_nodata/src/test_xs1.xn +++ /dev/null @@ -1,89 +0,0 @@ - - - - - tileref tile[1] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rx_basic_nodata/src/test_xs2.xn b/tests/test_bulk_rx_basic_nodata/src/test_xs2.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_bulk_rx_basic_nodata/src/test_xs2.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rx_basic_nodata/src/test_xs3.xn b/tests/test_bulk_rx_basic_nodata/src/test_xs3.xn deleted file mode 100644 index 6ea38caf..00000000 --- a/tests/test_bulk_rx_basic_nodata/src/test_xs3.xn +++ /dev/null @@ -1,24 +0,0 @@ - - - - tileref tile[2] - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rx_basic_rxerror/src/test.xn b/tests/test_bulk_rx_basic_rxerror/src/test.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_bulk_rx_basic_rxerror/src/test.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rx_basic_rxerror/src/test_xs1.xn b/tests/test_bulk_rx_basic_rxerror/src/test_xs1.xn deleted file mode 100755 index 573aef45..00000000 --- a/tests/test_bulk_rx_basic_rxerror/src/test_xs1.xn +++ /dev/null @@ -1,89 +0,0 @@ - - - - - tileref tile[1] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rx_basic_rxerror/src/test_xs2.xn b/tests/test_bulk_rx_basic_rxerror/src/test_xs2.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_bulk_rx_basic_rxerror/src/test_xs2.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rx_basic_rxerror/src/test_xs3.xn b/tests/test_bulk_rx_basic_rxerror/src/test_xs3.xn deleted file mode 100644 index 6ea38caf..00000000 --- a/tests/test_bulk_rx_basic_rxerror/src/test_xs3.xn +++ /dev/null @@ -1,24 +0,0 @@ - - - - tileref tile[2] - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rx_fastpacket/src/test.xn b/tests/test_bulk_rx_fastpacket/src/test.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_bulk_rx_fastpacket/src/test.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rx_fastpacket/src/test_xs1.xn b/tests/test_bulk_rx_fastpacket/src/test_xs1.xn deleted file mode 100755 index 573aef45..00000000 --- a/tests/test_bulk_rx_fastpacket/src/test_xs1.xn +++ /dev/null @@ -1,89 +0,0 @@ - - - - - tileref tile[1] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rx_fastpacket/src/test_xs2.xn b/tests/test_bulk_rx_fastpacket/src/test_xs2.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_bulk_rx_fastpacket/src/test_xs2.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rx_fastpacket/src/test_xs3.xn b/tests/test_bulk_rx_fastpacket/src/test_xs3.xn deleted file mode 100644 index 6ea38caf..00000000 --- a/tests/test_bulk_rx_fastpacket/src/test_xs3.xn +++ /dev/null @@ -1,24 +0,0 @@ - - - - tileref tile[2] - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rx_multiep/src/test.xn b/tests/test_bulk_rx_multiep/src/test.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_bulk_rx_multiep/src/test.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rx_multiep/src/test_xs1.xn b/tests/test_bulk_rx_multiep/src/test_xs1.xn deleted file mode 100755 index 573aef45..00000000 --- a/tests/test_bulk_rx_multiep/src/test_xs1.xn +++ /dev/null @@ -1,89 +0,0 @@ - - - - - tileref tile[1] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rx_multiep/src/test_xs2.xn b/tests/test_bulk_rx_multiep/src/test_xs2.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_bulk_rx_multiep/src/test_xs2.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rx_multiep/src/test_xs3.xn b/tests/test_bulk_rx_multiep/src/test_xs3.xn deleted file mode 100644 index 6ea38caf..00000000 --- a/tests/test_bulk_rx_multiep/src/test_xs3.xn +++ /dev/null @@ -1,24 +0,0 @@ - - - - tileref tile[2] - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rx_traffic/src/test_xs1.xn b/tests/test_bulk_rx_traffic/src/test_xs1.xn deleted file mode 100755 index 573aef45..00000000 --- a/tests/test_bulk_rx_traffic/src/test_xs1.xn +++ /dev/null @@ -1,89 +0,0 @@ - - - - - tileref tile[1] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rx_traffic/src/test_xs2.xn b/tests/test_bulk_rx_traffic/src/test_xs2.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_bulk_rx_traffic/src/test_xs2.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rx_traffic/src/test_xs3.xn b/tests/test_bulk_rx_traffic/src/test_xs3.xn deleted file mode 100644 index 6ea38caf..00000000 --- a/tests/test_bulk_rx_traffic/src/test_xs3.xn +++ /dev/null @@ -1,24 +0,0 @@ - - - - tileref tile[2] - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rxtx_fastpacket/src/test.xn b/tests/test_bulk_rxtx_fastpacket/src/test.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_bulk_rxtx_fastpacket/src/test.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rxtx_fastpacket/src/test_xs1.xn b/tests/test_bulk_rxtx_fastpacket/src/test_xs1.xn deleted file mode 100755 index 573aef45..00000000 --- a/tests/test_bulk_rxtx_fastpacket/src/test_xs1.xn +++ /dev/null @@ -1,89 +0,0 @@ - - - - - tileref tile[1] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rxtx_fastpacket/src/test_xs2.xn b/tests/test_bulk_rxtx_fastpacket/src/test_xs2.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_bulk_rxtx_fastpacket/src/test_xs2.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_rxtx_fastpacket/src/test_xs3.xn b/tests/test_bulk_rxtx_fastpacket/src/test_xs3.xn deleted file mode 100644 index 6ea38caf..00000000 --- a/tests/test_bulk_rxtx_fastpacket/src/test_xs3.xn +++ /dev/null @@ -1,24 +0,0 @@ - - - - tileref tile[2] - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_tx_badack/src/test.xn b/tests/test_bulk_tx_badack/src/test.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_bulk_tx_badack/src/test.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_tx_badack/src/test_xs1.xn b/tests/test_bulk_tx_badack/src/test_xs1.xn deleted file mode 100755 index 573aef45..00000000 --- a/tests/test_bulk_tx_badack/src/test_xs1.xn +++ /dev/null @@ -1,89 +0,0 @@ - - - - - tileref tile[1] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_tx_badack/src/test_xs2.xn b/tests/test_bulk_tx_badack/src/test_xs2.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_bulk_tx_badack/src/test_xs2.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_tx_badack/src/test_xs3.xn b/tests/test_bulk_tx_badack/src/test_xs3.xn deleted file mode 100644 index 6ea38caf..00000000 --- a/tests/test_bulk_tx_badack/src/test_xs3.xn +++ /dev/null @@ -1,24 +0,0 @@ - - - - tileref tile[2] - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_tx_basic/src/test.xn b/tests/test_bulk_tx_basic/src/test.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_bulk_tx_basic/src/test.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_tx_basic/src/test_xs1.xn b/tests/test_bulk_tx_basic/src/test_xs1.xn deleted file mode 100755 index 573aef45..00000000 --- a/tests/test_bulk_tx_basic/src/test_xs1.xn +++ /dev/null @@ -1,89 +0,0 @@ - - - - - tileref tile[1] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_tx_basic/src/test_xs2.xn b/tests/test_bulk_tx_basic/src/test_xs2.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_bulk_tx_basic/src/test_xs2.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_tx_basic/src/test_xs3.xn b/tests/test_bulk_tx_basic/src/test_xs3.xn deleted file mode 100644 index 6ea38caf..00000000 --- a/tests/test_bulk_tx_basic/src/test_xs3.xn +++ /dev/null @@ -1,24 +0,0 @@ - - - - tileref tile[2] - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_tx_basic_short/src/test.xn b/tests/test_bulk_tx_basic_short/src/test.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_bulk_tx_basic_short/src/test.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_tx_basic_short/src/test_xs1.xn b/tests/test_bulk_tx_basic_short/src/test_xs1.xn deleted file mode 100755 index 573aef45..00000000 --- a/tests/test_bulk_tx_basic_short/src/test_xs1.xn +++ /dev/null @@ -1,89 +0,0 @@ - - - - - tileref tile[1] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_tx_basic_short/src/test_xs2.xn b/tests/test_bulk_tx_basic_short/src/test_xs2.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_bulk_tx_basic_short/src/test_xs2.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_tx_basic_short/src/test_xs3.xn b/tests/test_bulk_tx_basic_short/src/test_xs3.xn deleted file mode 100644 index 6ea38caf..00000000 --- a/tests/test_bulk_tx_basic_short/src/test_xs3.xn +++ /dev/null @@ -1,24 +0,0 @@ - - - - tileref tile[2] - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_tx_fastpacket/src/test.xn b/tests/test_bulk_tx_fastpacket/src/test.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_bulk_tx_fastpacket/src/test.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_tx_fastpacket/src/test_xs1.xn b/tests/test_bulk_tx_fastpacket/src/test_xs1.xn deleted file mode 100755 index 573aef45..00000000 --- a/tests/test_bulk_tx_fastpacket/src/test_xs1.xn +++ /dev/null @@ -1,89 +0,0 @@ - - - - - tileref tile[1] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_tx_fastpacket/src/test_xs2.xn b/tests/test_bulk_tx_fastpacket/src/test_xs2.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_bulk_tx_fastpacket/src/test_xs2.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_tx_fastpacket/src/test_xs3.xn b/tests/test_bulk_tx_fastpacket/src/test_xs3.xn deleted file mode 100644 index 6ea38caf..00000000 --- a/tests/test_bulk_tx_fastpacket/src/test_xs3.xn +++ /dev/null @@ -1,24 +0,0 @@ - - - - tileref tile[2] - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_tx_multiep/src/test.xn b/tests/test_bulk_tx_multiep/src/test.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_bulk_tx_multiep/src/test.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_tx_multiep/src/test_xs1.xn b/tests/test_bulk_tx_multiep/src/test_xs1.xn deleted file mode 100755 index 573aef45..00000000 --- a/tests/test_bulk_tx_multiep/src/test_xs1.xn +++ /dev/null @@ -1,89 +0,0 @@ - - - - - tileref tile[1] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_tx_multiep/src/test_xs2.xn b/tests/test_bulk_tx_multiep/src/test_xs2.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_bulk_tx_multiep/src/test_xs2.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_tx_multiep/src/test_xs3.xn b/tests/test_bulk_tx_multiep/src/test_xs3.xn deleted file mode 100644 index 6ea38caf..00000000 --- a/tests/test_bulk_tx_multiep/src/test_xs3.xn +++ /dev/null @@ -1,24 +0,0 @@ - - - - tileref tile[2] - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_tx_noack/src/test.xn b/tests/test_bulk_tx_noack/src/test.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_bulk_tx_noack/src/test.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_tx_noack/src/test_xs1.xn b/tests/test_bulk_tx_noack/src/test_xs1.xn deleted file mode 100755 index 573aef45..00000000 --- a/tests/test_bulk_tx_noack/src/test_xs1.xn +++ /dev/null @@ -1,89 +0,0 @@ - - - - - tileref tile[1] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_tx_noack/src/test_xs2.xn b/tests/test_bulk_tx_noack/src/test_xs2.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_bulk_tx_noack/src/test_xs2.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_bulk_tx_noack/src/test_xs3.xn b/tests/test_bulk_tx_noack/src/test_xs3.xn deleted file mode 100644 index 6ea38caf..00000000 --- a/tests/test_bulk_tx_noack/src/test_xs3.xn +++ /dev/null @@ -1,24 +0,0 @@ - - - - tileref tile[2] - - - - - - - - - - - - - - - - - - diff --git a/tests/test_control_basic_badcrc32/src/test.xn b/tests/test_control_basic_badcrc32/src/test.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_control_basic_badcrc32/src/test.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_control_basic_badcrc32/src/test_xs1.xn b/tests/test_control_basic_badcrc32/src/test_xs1.xn deleted file mode 100755 index 573aef45..00000000 --- a/tests/test_control_basic_badcrc32/src/test_xs1.xn +++ /dev/null @@ -1,89 +0,0 @@ - - - - - tileref tile[1] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_control_basic_get/src/test.xn b/tests/test_control_basic_get/src/test.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_control_basic_get/src/test.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_control_basic_get/src/test_xs1.xn b/tests/test_control_basic_get/src/test_xs1.xn deleted file mode 100755 index 573aef45..00000000 --- a/tests/test_control_basic_get/src/test_xs1.xn +++ /dev/null @@ -1,89 +0,0 @@ - - - - - tileref tile[1] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_control_basic_get/src/test_xs3.xn b/tests/test_control_basic_get/src/test_xs3.xn deleted file mode 100644 index 6ea38caf..00000000 --- a/tests/test_control_basic_get/src/test_xs3.xn +++ /dev/null @@ -1,24 +0,0 @@ - - - - tileref tile[2] - - - - - - - - - - - - - - - - - - diff --git a/tests/test_control_basic_set/src/test.xn b/tests/test_control_basic_set/src/test.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_control_basic_set/src/test.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_control_basic_set/src/test_xs1.xn b/tests/test_control_basic_set/src/test_xs1.xn deleted file mode 100755 index 573aef45..00000000 --- a/tests/test_control_basic_set/src/test_xs1.xn +++ /dev/null @@ -1,89 +0,0 @@ - - - - - tileref tile[1] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_control_basic_set/src/test_xs3.xn b/tests/test_control_basic_set/src/test_xs3.xn deleted file mode 100644 index 6ea38caf..00000000 --- a/tests/test_control_basic_set/src/test_xs3.xn +++ /dev/null @@ -1,24 +0,0 @@ - - - - tileref tile[2] - - - - - - - - - - - - - - - - - - diff --git a/tests/test_control_basic_short/src/test.xn b/tests/test_control_basic_short/src/test.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_control_basic_short/src/test.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_control_basic_short/src/test_xs1.xn b/tests/test_control_basic_short/src/test_xs1.xn deleted file mode 100755 index 573aef45..00000000 --- a/tests/test_control_basic_short/src/test_xs1.xn +++ /dev/null @@ -1,89 +0,0 @@ - - - - - tileref tile[1] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_control_repeatedsetup/src/test.xn b/tests/test_control_repeatedsetup/src/test.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_control_repeatedsetup/src/test.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_control_repeatedsetup/src/test_xs1.xn b/tests/test_control_repeatedsetup/src/test_xs1.xn deleted file mode 100755 index 573aef45..00000000 --- a/tests/test_control_repeatedsetup/src/test_xs1.xn +++ /dev/null @@ -1,89 +0,0 @@ - - - - - tileref tile[1] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_invalidtoken/src/test.xn b/tests/test_invalidtoken/src/test.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_invalidtoken/src/test.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_invalidtoken/src/test_xs1.xn b/tests/test_invalidtoken/src/test_xs1.xn deleted file mode 100755 index 573aef45..00000000 --- a/tests/test_invalidtoken/src/test_xs1.xn +++ /dev/null @@ -1,89 +0,0 @@ - - - - - tileref tile[1] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_invalidtoken/src/test_xs2.xn b/tests/test_invalidtoken/src/test_xs2.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_invalidtoken/src/test_xs2.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_invalidtoken/src/test_xs3.xn b/tests/test_invalidtoken/src/test_xs3.xn deleted file mode 100644 index 6ea38caf..00000000 --- a/tests/test_invalidtoken/src/test_xs3.xn +++ /dev/null @@ -1,24 +0,0 @@ - - - - tileref tile[2] - - - - - - - - - - - - - - - - - - diff --git a/tests/test_iso_loopback/src/test.xn b/tests/test_iso_loopback/src/test.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_iso_loopback/src/test.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_iso_loopback/src/test_xs1.xn b/tests/test_iso_loopback/src/test_xs1.xn deleted file mode 100755 index 573aef45..00000000 --- a/tests/test_iso_loopback/src/test_xs1.xn +++ /dev/null @@ -1,89 +0,0 @@ - - - - - tileref tile[1] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_iso_loopback/src/test_xs2.xn b/tests/test_iso_loopback/src/test_xs2.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_iso_loopback/src/test_xs2.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_iso_loopback/src/test_xs3.xn b/tests/test_iso_loopback/src/test_xs3.xn deleted file mode 100644 index 6ea38caf..00000000 --- a/tests/test_iso_loopback/src/test_xs3.xn +++ /dev/null @@ -1,24 +0,0 @@ - - - - tileref tile[2] - - - - - - - - - - - - - - - - - - diff --git a/tests/test_iso_rx_basic/src/test.xn b/tests/test_iso_rx_basic/src/test.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_iso_rx_basic/src/test.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_iso_rx_basic/src/test_xs1.xn b/tests/test_iso_rx_basic/src/test_xs1.xn deleted file mode 100755 index 573aef45..00000000 --- a/tests/test_iso_rx_basic/src/test_xs1.xn +++ /dev/null @@ -1,89 +0,0 @@ - - - - - tileref tile[1] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_iso_rx_basic/src/test_xs2.xn b/tests/test_iso_rx_basic/src/test_xs2.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_iso_rx_basic/src/test_xs2.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_iso_rx_basic/src/test_xs3.xn b/tests/test_iso_rx_basic/src/test_xs3.xn deleted file mode 100644 index 6ea38caf..00000000 --- a/tests/test_iso_rx_basic/src/test_xs3.xn +++ /dev/null @@ -1,24 +0,0 @@ - - - - tileref tile[2] - - - - - - - - - - - - - - - - - - diff --git a/tests/test_iso_rxtx_fastpacket/src/test.xn b/tests/test_iso_rxtx_fastpacket/src/test.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_iso_rxtx_fastpacket/src/test.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_iso_rxtx_fastpacket/src/test_xs1.xn b/tests/test_iso_rxtx_fastpacket/src/test_xs1.xn deleted file mode 100755 index 573aef45..00000000 --- a/tests/test_iso_rxtx_fastpacket/src/test_xs1.xn +++ /dev/null @@ -1,89 +0,0 @@ - - - - - tileref tile[1] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_iso_rxtx_fastpacket/src/test_xs2.xn b/tests/test_iso_rxtx_fastpacket/src/test_xs2.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_iso_rxtx_fastpacket/src/test_xs2.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_iso_rxtx_fastpacket/src/test_xs3.xn b/tests/test_iso_rxtx_fastpacket/src/test_xs3.xn deleted file mode 100644 index 6ea38caf..00000000 --- a/tests/test_iso_rxtx_fastpacket/src/test_xs3.xn +++ /dev/null @@ -1,24 +0,0 @@ - - - - tileref tile[2] - - - - - - - - - - - - - - - - - - diff --git a/tests/test_iso_tx_basic/src/test.xn b/tests/test_iso_tx_basic/src/test.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_iso_tx_basic/src/test.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_iso_tx_basic/src/test_xs1.xn b/tests/test_iso_tx_basic/src/test_xs1.xn deleted file mode 100755 index 573aef45..00000000 --- a/tests/test_iso_tx_basic/src/test_xs1.xn +++ /dev/null @@ -1,89 +0,0 @@ - - - - - tileref tile[1] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_iso_tx_basic/src/test_xs2.xn b/tests/test_iso_tx_basic/src/test_xs2.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_iso_tx_basic/src/test_xs2.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_iso_tx_basic/src/test_xs3.xn b/tests/test_iso_tx_basic/src/test_xs3.xn deleted file mode 100644 index 6ea38caf..00000000 --- a/tests/test_iso_tx_basic/src/test_xs3.xn +++ /dev/null @@ -1,24 +0,0 @@ - - - - tileref tile[2] - - - - - - - - - - - - - - - - - - diff --git a/tests/test_ping_rx_basic/src/test.xn b/tests/test_ping_rx_basic/src/test.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_ping_rx_basic/src/test.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_ping_rx_basic/src/test_xs1.xn b/tests/test_ping_rx_basic/src/test_xs1.xn deleted file mode 100755 index 573aef45..00000000 --- a/tests/test_ping_rx_basic/src/test_xs1.xn +++ /dev/null @@ -1,89 +0,0 @@ - - - - - tileref tile[1] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_ping_rx_basic/src/test_xs2.xn b/tests/test_ping_rx_basic/src/test_xs2.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_ping_rx_basic/src/test_xs2.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_ping_rx_basic/src/test_xs3.xn b/tests/test_ping_rx_basic/src/test_xs3.xn deleted file mode 100644 index 6ea38caf..00000000 --- a/tests/test_ping_rx_basic/src/test_xs3.xn +++ /dev/null @@ -1,24 +0,0 @@ - - - - tileref tile[2] - - - - - - - - - - - - - - - - - - diff --git a/tests/test_shorttoken/src/test.xn b/tests/test_shorttoken/src/test.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_shorttoken/src/test.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_shorttoken/src/test_xs1.xn b/tests/test_shorttoken/src/test_xs1.xn deleted file mode 100755 index 573aef45..00000000 --- a/tests/test_shorttoken/src/test_xs1.xn +++ /dev/null @@ -1,89 +0,0 @@ - - - - - tileref tile[1] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_shorttoken/src/test_xs2.xn b/tests/test_shorttoken/src/test_xs2.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_shorttoken/src/test_xs2.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_shorttoken/src/test_xs3.xn b/tests/test_shorttoken/src/test_xs3.xn deleted file mode 100644 index 6ea38caf..00000000 --- a/tests/test_shorttoken/src/test_xs3.xn +++ /dev/null @@ -1,24 +0,0 @@ - - - - tileref tile[2] - - - - - - - - - - - - - - - - - - diff --git a/tests/test_sof_badcrc/src/test.xn b/tests/test_sof_badcrc/src/test.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_sof_badcrc/src/test.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_sof_badcrc/src/test_xs1.xn b/tests/test_sof_badcrc/src/test_xs1.xn deleted file mode 100755 index 573aef45..00000000 --- a/tests/test_sof_badcrc/src/test_xs1.xn +++ /dev/null @@ -1,89 +0,0 @@ - - - - - tileref tile[1] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_sof_badcrc/src/test_xs2.xn b/tests/test_sof_badcrc/src/test_xs2.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_sof_badcrc/src/test_xs2.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_sof_badcrc/src/test_xs3.xn b/tests/test_sof_badcrc/src/test_xs3.xn deleted file mode 100644 index 6ea38caf..00000000 --- a/tests/test_sof_badcrc/src/test_xs3.xn +++ /dev/null @@ -1,24 +0,0 @@ - - - - tileref tile[2] - - - - - - - - - - - - - - - - - - diff --git a/tests/test_sof_basic/src/test.xn b/tests/test_sof_basic/src/test.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_sof_basic/src/test.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_sof_basic/src/test_xs1.xn b/tests/test_sof_basic/src/test_xs1.xn deleted file mode 100755 index 573aef45..00000000 --- a/tests/test_sof_basic/src/test_xs1.xn +++ /dev/null @@ -1,89 +0,0 @@ - - - - - tileref tile[1] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_sof_basic/src/test_xs2.xn b/tests/test_sof_basic/src/test_xs2.xn deleted file mode 100644 index d0ee86b8..00000000 --- a/tests/test_sof_basic/src/test_xs2.xn +++ /dev/null @@ -1,72 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/test_sof_basic/src/test_xs3.xn b/tests/test_sof_basic/src/test_xs3.xn deleted file mode 100644 index 6ea38caf..00000000 --- a/tests/test_sof_basic/src/test_xs3.xn +++ /dev/null @@ -1,24 +0,0 @@ - - - - tileref tile[2] - - - - - - - - - - - - - - - - - - From 5382ce6762d163a0427207dcd74704b7a8601e1b Mon Sep 17 00:00:00 2001 From: mbanth Date: Tue, 9 Mar 2021 13:22:37 +0000 Subject: [PATCH 167/520] Remove support for XS1 testing --- tests/runtests.py | 2 +- tests/shared_src/test_xs1.xn | 89 ------------------------------------ 2 files changed, 1 insertion(+), 90 deletions(-) delete mode 100644 tests/shared_src/test_xs1.xn diff --git a/tests/runtests.py b/tests/runtests.py index 38e308c3..6f0a7127 100644 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -7,7 +7,7 @@ import helpers -XN_FILES = ["test_xs1.xn", "test_xs2.xn", "test_xs3.xn"] +XN_FILES = ["test_xs2.xn", "test_xs3.xn"] def list_test_dirs(args, path = ".", pattern = '^test_*'): dirs = os.listdir(path) diff --git a/tests/shared_src/test_xs1.xn b/tests/shared_src/test_xs1.xn deleted file mode 100644 index 64455827..00000000 --- a/tests/shared_src/test_xs1.xn +++ /dev/null @@ -1,89 +0,0 @@ - - - - - tileref tile[1] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 73dd6699a3445cf624dfde94d7506bf5621e9062 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 9 Mar 2021 15:39:02 +0000 Subject: [PATCH 168/520] Fix trap at end of test_bulk_rx_basic (port destructor called whilst port still in use) --- tests/test_bulk_rx_basic/src/main.xc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/test_bulk_rx_basic/src/main.xc b/tests/test_bulk_rx_basic/src/main.xc index 3ff7a1d0..efd95f21 100644 --- a/tests/test_bulk_rx_basic/src/main.xc +++ b/tests/test_bulk_rx_basic/src/main.xc @@ -51,14 +51,15 @@ int main() { unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); + + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep0); + if(fail) TerminateFail(fail); else TerminatePass(fail); - XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); - XUD_Kill(ep0); - exit(0); } } From 47c068111f1a88bb64b430714feb7b25f34e6d7b Mon Sep 17 00:00:00 2001 From: mbanth Date: Tue, 9 Mar 2021 16:04:11 +0000 Subject: [PATCH 169/520] Update change log --- CHANGELOG.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 110ae6a6..2ac64340 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -8,6 +8,7 @@ HEAD * ADDED: Requirement to define XUD_CORE_CLOCK with xcore core clock speed in MHz * CHANGE: Removed support for XS1-G, and XS1-L (including U series) based devices * RESOLVED: Exception when Endpoint marked as disabled + * CHANGE: Use common XN files for tests From 9cd5a86ddc1910c35164c99dcd619abf76a85d13 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 9 Mar 2021 16:25:13 +0000 Subject: [PATCH 170/520] Removed unused header from test_iso_rx_basic --- tests/test_iso_rx_basic/src/main.xc | 1 - tests/test_iso_rx_basic/src/xc_ptr.h | 47 ---------------------------- 2 files changed, 48 deletions(-) delete mode 100644 tests/test_iso_rx_basic/src/xc_ptr.h diff --git a/tests/test_iso_rx_basic/src/main.xc b/tests/test_iso_rx_basic/src/main.xc index 58eaa628..9fce337a 100644 --- a/tests/test_iso_rx_basic/src/main.xc +++ b/tests/test_iso_rx_basic/src/main.xc @@ -4,7 +4,6 @@ #include #include "xud.h" #include "platform.h" -#include "xc_ptr.h" #include "shared.h" #define XUD_EP_COUNT_OUT 5 diff --git a/tests/test_iso_rx_basic/src/xc_ptr.h b/tests/test_iso_rx_basic/src/xc_ptr.h deleted file mode 100644 index 28fa6b8b..00000000 --- a/tests/test_iso_rx_basic/src/xc_ptr.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved -#ifndef __xc_ptr__ -#define __xc_ptr__ - -typedef unsigned int xc_ptr; - -// Note that this function is marked as const to avoid the XC -// parallel usage checks, this is only really going to work if this -// is the *only* way the array a is accessed (and everything else uses -// the xc_ptr) -inline xc_ptr array_to_xc_ptr(const unsigned a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -inline xc_ptr char_array_to_xc_ptr(const unsigned char a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -#define write_via_xc_ptr_indexed(p,i,x) asm volatile("stw %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_short_via_xc_ptr_indexed(p,i,x) asm volatile("st16 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) - -#define write_via_xc_ptr(p,x) asm volatile("stw %0, %1[0]"::"r"(x),"r"(p)) -// No immediate st8 format -#define write_byte_via_xc_ptr(p,x) write_byte_via_xc_ptr_indexed(p, 0, x) -#define write_short_via_xc_ptr(p,x) write_short_via_xc_ptr_indexed(p, 0, x) - -#define read_via_xc_ptr_indexed(x,p,i) asm("ldw %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_byte_via_xc_ptr_indexed(x,p,i) asm("ld8u %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_short_via_xc_ptr_indexed(x,p,i) asm("ld16s %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); - -#define read_via_xc_ptr(x,p) asm("ldw %0, %1[0]":"=r"(x):"r"(p)); -// No immediate ld8u format -#define read_byte_via_xc_ptr(x,p) read_byte_via_xc_ptr_indexed(x, p, 0) -#define read_short_via_xc_ptr(x,p) read_short_via_xc_ptr_indexed(x, p, 0) - -#define GET_SHARED_GLOBAL(x, g) asm volatile("ldw %0, dp[" #g "]":"=r"(x)::"memory") -#define SET_SHARED_GLOBAL(g, v) asm volatile("stw %0, dp[" #g "]"::"r"(v):"memory") - -#endif From 406ca6d4856ff681a387255327609010f9c37523 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 9 Mar 2021 16:28:14 +0000 Subject: [PATCH 171/520] Further fixes to trap at end of tests --- tests/test_bulk_rx_basic_badpid/src/main.xc | 7 +++---- tests/test_bulk_rx_basic_nodata/src/main.xc | 9 ++++----- tests/test_iso_rx_basic/src/main.xc | 6 +++--- tests/test_sof_basic/src/main.xc | 9 ++++----- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/tests/test_bulk_rx_basic_badpid/src/main.xc b/tests/test_bulk_rx_basic_badpid/src/main.xc index ee4553f8..70ebd83a 100644 --- a/tests/test_bulk_rx_basic_badpid/src/main.xc +++ b/tests/test_bulk_rx_basic_badpid/src/main.xc @@ -51,14 +51,13 @@ int main() { unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep0); + if(fail) TerminateFail(fail); else TerminatePass(fail); - - XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); - XUD_Kill(ep0); - exit(0); } } diff --git a/tests/test_bulk_rx_basic_nodata/src/main.xc b/tests/test_bulk_rx_basic_nodata/src/main.xc index ee4553f8..faa6134d 100644 --- a/tests/test_bulk_rx_basic_nodata/src/main.xc +++ b/tests/test_bulk_rx_basic_nodata/src/main.xc @@ -50,15 +50,14 @@ int main() { unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); + + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep0); if(fail) TerminateFail(fail); else - TerminatePass(fail); - - XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); - XUD_Kill(ep0); - exit(0); + TerminatePass(fail); } } diff --git a/tests/test_iso_rx_basic/src/main.xc b/tests/test_iso_rx_basic/src/main.xc index 9fce337a..57d17690 100644 --- a/tests/test_iso_rx_basic/src/main.xc +++ b/tests/test_iso_rx_basic/src/main.xc @@ -54,14 +54,14 @@ int main() { unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep0); + if(fail) TerminateFail(fail); else TerminatePass(fail); - XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); - XUD_Kill(ep0); - exit(0); } } diff --git a/tests/test_sof_basic/src/main.xc b/tests/test_sof_basic/src/main.xc index 7f018c7d..f8ac5414 100644 --- a/tests/test_sof_basic/src/main.xc +++ b/tests/test_sof_basic/src/main.xc @@ -89,14 +89,13 @@ int main() { unsigned fail = TestEp_Bulk(c_ep_out[1], c_ep_in[1], 1, c_sof); + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep0); + if(fail) TerminateFail(fail); else - TerminatePass(fail); - - XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); - XUD_Kill(ep0); - exit(0); + TerminatePass(fail); } } From 7d6f7009ef355093f37b207e3baa802ad8871956 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 9 Mar 2021 16:43:48 +0000 Subject: [PATCH 172/520] Tidy up of test_bulk_rx_basic_badcrc32 --- tests/test_bulk_rx_basic_badcrc32/src/main.xc | 133 +++--------------- 1 file changed, 21 insertions(+), 112 deletions(-) diff --git a/tests/test_bulk_rx_basic_badcrc32/src/main.xc b/tests/test_bulk_rx_basic_badcrc32/src/main.xc index cd89a532..e617d91d 100644 --- a/tests/test_bulk_rx_basic_badcrc32/src/main.xc +++ b/tests/test_bulk_rx_basic_badcrc32/src/main.xc @@ -1,113 +1,29 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved -/* - * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent - * in both directions between the ports. - * - * NOTE: The src/testbenches/ExampleTestbench must have been compiled for this to run without error. - * - */ +// Copyright (c) 2016-2021, XMOS Ltd, All rights reserved + #include #include #include #include "xud.h" #include "platform.h" -#include "xc_ptr.h" +#include "shared.h" #define XUD_EP_COUNT_OUT 5 #define XUD_EP_COUNT_IN 5 #define TEST_EP_NUM (1) -//extern xc_ptr char_array_to_xc_ptr(const unsigned char a[]); - /* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, - XUD_EPTYPE_ISO, - XUD_EPTYPE_BUL, - XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; - -void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend ?c_usb_test); - -void exit(int); - -#define FAIL_RX_DATAERROR 0 -#define FAIL_RX_LENERROR 1 - -unsigned fail(int x) -{ - - printstr("\nXCORE: ### FAIL ******"); - switch(x) - { - case FAIL_RX_DATAERROR: - printstr("XCORE RX Data Error\n"); - break; - - case FAIL_RX_LENERROR: - printstr("XCORE RX Length Error\n"); - break; - - } - - exit(1); -} - -unsigned char g_rxDataCheck[5] = {0, 0, 0, 0, 0}; -unsigned char g_txDataCheck[5] = {0,0,0,0,0,}; -unsigned g_txLength[5] = {0,0,0,0,0}; - - -#pragma unsafe arrays -void SendTxPacket(XUD_ep ep, int length, int epNum) -{ - unsigned char buffer[1024]; - unsigned char x; - - for (int i = 0; i < length; i++) - { - buffer[i] = g_txDataCheck[epNum]++; - - //asm("ld8u %0, %1[%2]":"=r"(x):"r"(g_txDataCheck),"r"(epNum)); - // read_byte_via_xc_ptr_indexed(x, p_txDataCheck, epNum); - - //buffer[i] = x; - //x++; - //asm("st8 %0, %1[%2]"::"r"(x),"r"(g_txDataCheck),"r"(epNum)); - //write_byte_via_xc_ptr_indexed(p_txDataCheck,epNum,x); - } - - XUD_SetBuffer(ep, buffer, length); -} - -#pragma unsafe arrays -int RxDataCheck(unsigned char b[], int l, int epNum) -{ - int fail = 0; - unsigned char x; - - for (int i = 0; i < l; i++) - { - unsigned char y; - //read_byte_via_xc_ptr_indexed(y, p_rxDataCheck, epNum); - if(b[i] != g_rxDataCheck[epNum]) - { - printstr("#### Mismatch on EP: "); - printint(epNum); - printstr(". Got:"); - printhex(b[i]); - printstr(" Expected:"); - printhexln(g_rxDataCheck[epNum]); - //printintln(l); // Packet length - return 1; - } - - g_rxDataCheck[epNum]++; - } - - return 0; -} - +XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, + XUD_EPTYPE_BUL, + XUD_EPTYPE_ISO, + XUD_EPTYPE_BUL, + XUD_EPTYPE_BUL}; + +XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, + XUD_EPTYPE_BUL, + XUD_EPTYPE_ISO, + XUD_EPTYPE_BUL, + XUD_EPTYPE_BUL}; int TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_out_0) { @@ -118,14 +34,13 @@ int TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_out_0) XUD_ep ep_out = XUD_InitEp(c_out); XUD_ep ep_in = XUD_InitEp(c_in); - /* Buffer for Setup data */ unsigned char buffer[1024]; for(int i = 10; i <= 14; i++) { /* Expect bad CRC */ if(i == 12) - { + unsafe{ g_rxDataCheck[epNum]+=12; continue; } @@ -136,14 +51,13 @@ int TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_out_0) { printintln(length); printintln(i); - fail(FAIL_RX_LENERROR); + TerminateFail(FAIL_RX_LENERROR); } - if(RxDataCheck(buffer, length, epNum)) + if(RxDataCheck(buffer, length, epNum, i)) { - fail(FAIL_RX_DATAERROR); + TerminateFail(FAIL_RX_DATAERROR); } - } XUD_Kill(ep_out_0); @@ -151,24 +65,19 @@ int TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_out_0) } -#define USB_CORE 0 int main() { chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - //p_rxDataCheck = char_array_to_xc_ptr(g_rxDataCheck); - //p_txDataCheck = char_array_to_xc_ptr(g_txDataCheck); - //p_txLength = array_to_xc_ptr(g_txLength); - par { XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); - //TestEp_Control(c_ep_out[0], c_ep_in[0], 0); - - TestEp_Bulk(c_ep_out[TEST_EP_NUM], c_ep_in[TEST_EP_NUM], TEST_EP_NUM, c_ep_out[0]); + unsafe { + TestEp_Bulk(c_ep_out[TEST_EP_NUM], c_ep_in[TEST_EP_NUM], TEST_EP_NUM, c_ep_out[0]); + } } return 0; From 6e6a9df672c0680abf5be0fc984c2a50f43f318c Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 9 Mar 2021 16:48:39 +0000 Subject: [PATCH 173/520] Fixed test_bulk_rx_basic_rxerror close down trap --- tests/shared_src/shared.h | 1 - tests/test_bulk_rx_basic_rxerror/src/main.xc | 17 +++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/shared_src/shared.h b/tests/shared_src/shared.h index fe2be0a8..a4bfa63e 100644 --- a/tests/shared_src/shared.h +++ b/tests/shared_src/shared.h @@ -69,7 +69,6 @@ void TerminatePass(unsigned x) #define MAX_PKT_COUNT (10) #endif - #define XUD_Manager XUD_Main typedef enum t_runMode diff --git a/tests/test_bulk_rx_basic_rxerror/src/main.xc b/tests/test_bulk_rx_basic_rxerror/src/main.xc index 6717ab5c..f418bd90 100644 --- a/tests/test_bulk_rx_basic_rxerror/src/main.xc +++ b/tests/test_bulk_rx_basic_rxerror/src/main.xc @@ -6,19 +6,19 @@ #include "platform.h" #include "shared.h" -#define XUD_EP_COUNT_OUT 5 -#define XUD_EP_COUNT_IN 5 +#define XUD_EP_COUNT_OUT (5) +#define XUD_EP_COUNT_IN (5) #ifndef PKT_LENGTH_START -#define PKT_LENGTH_START 10 +#define PKT_LENGTH_START (10) #endif #ifndef PKT_LENGTH_END -#define PKT_LENGTH_END 14 +#define PKT_LENGTH_END (14) #endif #ifndef TEST_EP_NUM -#define TEST_EP_NUM 1 +#define TEST_EP_NUM (1) #endif /* Endpoint type tables */ @@ -51,16 +51,17 @@ int main() { unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep0); + if(fail) TerminateFail(fail); else TerminatePass(fail); - XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); - XUD_Kill(ep0); - exit(0); } } + // Unreachable return 0; } From a185ca531332f91486a92a535ee7ee6774fc1cb0 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 9 Mar 2021 16:50:47 +0000 Subject: [PATCH 174/520] Fix to test_bulk_rx_traffic --- tests/test_bulk_rx_traffic/src/main.xc | 19 +++++----- tests/test_bulk_rx_traffic/src/xc_ptr.h | 47 ------------------------- 2 files changed, 10 insertions(+), 56 deletions(-) delete mode 100644 tests/test_bulk_rx_traffic/src/xc_ptr.h diff --git a/tests/test_bulk_rx_traffic/src/main.xc b/tests/test_bulk_rx_traffic/src/main.xc index a365477b..ef6e6620 100644 --- a/tests/test_bulk_rx_traffic/src/main.xc +++ b/tests/test_bulk_rx_traffic/src/main.xc @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2019, XMOS Ltd, All rights reserved +// Copyright (c) 2018-2021, XMOS Ltd, All rights reserved #include #include #include @@ -6,19 +6,19 @@ #include "platform.h" #include "shared.h" -#define XUD_EP_COUNT_OUT 5 -#define XUD_EP_COUNT_IN 5 +#define XUD_EP_COUNT_OUT (5) +#define XUD_EP_COUNT_IN (5) #ifndef PKT_LENGTH_START -#define PKT_LENGTH_START 10 +#define PKT_LENGTH_START (10) #endif #ifndef PKT_LENGTH_END -#define PKT_LENGTH_END 19 +#define PKT_LENGTH_END (19) #endif #ifndef TEST_EP_NUM -#define TEST_EP_NUM 1 +#define TEST_EP_NUM (1) #endif /* Endpoint type tables */ @@ -52,16 +52,17 @@ int main() { unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep0); + if(fail) TerminateFail(fail); else TerminatePass(fail); - XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); - XUD_Kill(ep0); - exit(0); } } + // Unreachable return 0; } diff --git a/tests/test_bulk_rx_traffic/src/xc_ptr.h b/tests/test_bulk_rx_traffic/src/xc_ptr.h deleted file mode 100644 index 28fa6b8b..00000000 --- a/tests/test_bulk_rx_traffic/src/xc_ptr.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved -#ifndef __xc_ptr__ -#define __xc_ptr__ - -typedef unsigned int xc_ptr; - -// Note that this function is marked as const to avoid the XC -// parallel usage checks, this is only really going to work if this -// is the *only* way the array a is accessed (and everything else uses -// the xc_ptr) -inline xc_ptr array_to_xc_ptr(const unsigned a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -inline xc_ptr char_array_to_xc_ptr(const unsigned char a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -#define write_via_xc_ptr_indexed(p,i,x) asm volatile("stw %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_short_via_xc_ptr_indexed(p,i,x) asm volatile("st16 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) - -#define write_via_xc_ptr(p,x) asm volatile("stw %0, %1[0]"::"r"(x),"r"(p)) -// No immediate st8 format -#define write_byte_via_xc_ptr(p,x) write_byte_via_xc_ptr_indexed(p, 0, x) -#define write_short_via_xc_ptr(p,x) write_short_via_xc_ptr_indexed(p, 0, x) - -#define read_via_xc_ptr_indexed(x,p,i) asm("ldw %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_byte_via_xc_ptr_indexed(x,p,i) asm("ld8u %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_short_via_xc_ptr_indexed(x,p,i) asm("ld16s %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); - -#define read_via_xc_ptr(x,p) asm("ldw %0, %1[0]":"=r"(x):"r"(p)); -// No immediate ld8u format -#define read_byte_via_xc_ptr(x,p) read_byte_via_xc_ptr_indexed(x, p, 0) -#define read_short_via_xc_ptr(x,p) read_short_via_xc_ptr_indexed(x, p, 0) - -#define GET_SHARED_GLOBAL(x, g) asm volatile("ldw %0, dp[" #g "]":"=r"(x)::"memory") -#define SET_SHARED_GLOBAL(g, v) asm volatile("stw %0, dp[" #g "]"::"r"(v):"memory") - -#endif From 7b95f350f44438425d1fedb1a64483a154a05b23 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 9 Mar 2021 17:08:42 +0000 Subject: [PATCH 175/520] Added copied xn files to gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index cb2062d6..2f1ede2f 100644 --- a/.gitignore +++ b/.gitignore @@ -28,4 +28,5 @@ Installs/ .settings tests/bin.txt tests/log -__app_test_mode/xscope.xmt.gtkw \ No newline at end of file +tests/test_**/**test_xs2.xn +tests/test_**/**test_xs3.xn From e86f67a29378337582991932db8ec52d7b845763 Mon Sep 17 00:00:00 2001 From: Dave Atkinson Date: Tue, 16 Mar 2021 09:34:45 +0000 Subject: [PATCH 176/520] Remove references to XS1 --- __app_test/Makefile | 4 ---- lib_xud/src/core/included/XUD_PidJumpTable.S | 4 ++-- lib_xud/src/core/included/XUD_Token_In.S | 2 +- lib_xud/src/core/included/XUD_Token_In_DI.S | 2 +- lib_xud/src/core/included/XUD_Token_Out.S | 2 +- tests/helpers.py | 17 ----------------- tests/test_control_basic_badcrc32/Makefile | 8 -------- tests/test_control_basic_short/Makefile | 8 -------- tests/test_control_repeatedsetup/Makefile | 8 -------- tests/test_makefile.mak | 2 -- 10 files changed, 5 insertions(+), 52 deletions(-) diff --git a/__app_test/Makefile b/__app_test/Makefile index 900f5799..3b9da8f0 100644 --- a/__app_test/Makefile +++ b/__app_test/Makefile @@ -44,10 +44,6 @@ include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common # # Compile the example -# -#build: -# xcc -O3 -target=XS1-G4B-FB512 -march=xs1b main.xc -o app_test.xe - # # Connect the pins together that map to XS1_PORT_1A and XS1_PORT_1B # NOTE: Requires the testbench to have been built (src/testbenches/ExampleTestbench) diff --git a/lib_xud/src/core/included/XUD_PidJumpTable.S b/lib_xud/src/core/included/XUD_PidJumpTable.S index 9d5ff042..b15d548b 100755 --- a/lib_xud/src/core/included/XUD_PidJumpTable.S +++ b/lib_xud/src/core/included/XUD_PidJumpTable.S @@ -1,5 +1,5 @@ // Copyright (c) 2011-2018, XMOS Ltd, All rights reserved -#if defined (__XS2A__) || defined(__XS1B__) +#if defined (__XS2A__) // PID jump table .section .dp.data, "adw", @progbits @@ -282,7 +282,7 @@ PidJumpTable: #endif -#if defined(__XS1A__) || defined(__XS3A__) +#if defined(__XS3A__) // Generated using genpidtable.c .section .dp.data, "adw", @progbits .globl PidJumpTable diff --git a/lib_xud/src/core/included/XUD_Token_In.S b/lib_xud/src/core/included/XUD_Token_In.S index 030d9d98..4a722d36 100755 --- a/lib_xud/src/core/included/XUD_Token_In.S +++ b/lib_xud/src/core/included/XUD_Token_In.S @@ -234,7 +234,7 @@ XUD_IN_RxAck: clrpt res[r1] // Clear port time on valid token port edu res[RXD] shr r11, r11, 24 // Shift off junk data to leave ACK -#if defined(__XS2A__) || defined(__XS1B__) +#if defined(__XS2A__) ldc r9, USB_PID_ACK // Check for good ACK (L series strips of negated bits from PID) #else ldc r9, USB_PIDn_ACK diff --git a/lib_xud/src/core/included/XUD_Token_In_DI.S b/lib_xud/src/core/included/XUD_Token_In_DI.S index ddf9e836..0365db65 100755 --- a/lib_xud/src/core/included/XUD_Token_In_DI.S +++ b/lib_xud/src/core/included/XUD_Token_In_DI.S @@ -124,7 +124,7 @@ XUD_IN_RxAck: clrpt res[r1] // Clear port time on valid token port {edu res[RXD]; shr r11, r11, 24} // Shift off junk data to leave ACK -#if defined(__XS2A__) || defined(__XS1B__) +#if defined(__XS2A__) ldc r9, USB_PID_ACK // Check for good ACK (L series strips of negated bits from PID) #else ldc r9, USB_PIDn_ACK diff --git a/lib_xud/src/core/included/XUD_Token_Out.S b/lib_xud/src/core/included/XUD_Token_Out.S index 8f9a4ec4..dd1dd279 100755 --- a/lib_xud/src/core/included/XUD_Token_Out.S +++ b/lib_xud/src/core/included/XUD_Token_Out.S @@ -35,7 +35,7 @@ InformEP_Iso: // Iso EP - no handshake //ldc r4, XUD_MAX_NUM_EP_OUT // This could be shaved if XUD_MAX_NUM_EP's < 12. Now use an LDAW to at 16. //------------------------------------------------------------------------------------------------ -#if defined(__XS2A__) || defined(__XS1B__) +#if defined(__XS2A__) ldaw r10, dp[PidJumpTable] // Original USB Token: | CRC | EP | ADDR | PID | junk // Received token is address and CRC checked. diff --git a/tests/helpers.py b/tests/helpers.py index 61c9f406..0438f173 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -58,23 +58,6 @@ def get_usb_clk_phy(verbose=True, test_ctrl=None, do_timeout=True, expect_loopback=expect_loopback, dut_exit_time=dut_exit_time) - - elif arch=='xs1': - clk = Clock('tile[0]:XS1_PORT_1J', Clock.CLK_60MHz) - phy = UsbPhyShim('tile[0]:XS1_PORT_8C', - 'tile[0]:XS1_PORT_1O', #rxa - 'tile[0]:XS1_PORT_1M', #rxv - 'tile[0]:XS1_PORT_1P', #rxe - 'tile[0]:XS1_PORT_1N', #vld - 'tile[0]:XS1_PORT_8A', #txd - 'tile[0]:XS1_PORT_1K', #txv - 'tile[0]:XS1_PORT_1H', #txrdy - clk, - verbose=verbose, test_ctrl=test_ctrl, - do_timeout=do_timeout, complete_fn=complete_fn, - expect_loopback=expect_loopback, - dut_exit_time=dut_exit_time) - return (clk, phy) def run_on(**kwargs): diff --git a/tests/test_control_basic_badcrc32/Makefile b/tests/test_control_basic_badcrc32/Makefile index 83edfc42..83a78752 100644 --- a/tests/test_control_basic_badcrc32/Makefile +++ b/tests/test_control_basic_badcrc32/Makefile @@ -24,14 +24,6 @@ COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -X XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -XCC_FLAGS_xs1 = $(COMMON_FLAGS) -DARCH_S -DXUD_SERIES_SUPPORT=XUD_U_SERIES - - - -ifeq ($(CONFIG),$(filter $(CONFIG),xs1)) - TARGET = test_xs1.xn -endif - ifeq ($(CONFIG),$(filter $(CONFIG),xs2)) TARGET = test.xn endif diff --git a/tests/test_control_basic_short/Makefile b/tests/test_control_basic_short/Makefile index 83edfc42..83a78752 100644 --- a/tests/test_control_basic_short/Makefile +++ b/tests/test_control_basic_short/Makefile @@ -24,14 +24,6 @@ COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -X XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -XCC_FLAGS_xs1 = $(COMMON_FLAGS) -DARCH_S -DXUD_SERIES_SUPPORT=XUD_U_SERIES - - - -ifeq ($(CONFIG),$(filter $(CONFIG),xs1)) - TARGET = test_xs1.xn -endif - ifeq ($(CONFIG),$(filter $(CONFIG),xs2)) TARGET = test.xn endif diff --git a/tests/test_control_repeatedsetup/Makefile b/tests/test_control_repeatedsetup/Makefile index 83edfc42..83a78752 100644 --- a/tests/test_control_repeatedsetup/Makefile +++ b/tests/test_control_repeatedsetup/Makefile @@ -24,14 +24,6 @@ COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -X XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -XCC_FLAGS_xs1 = $(COMMON_FLAGS) -DARCH_S -DXUD_SERIES_SUPPORT=XUD_U_SERIES - - - -ifeq ($(CONFIG),$(filter $(CONFIG),xs1)) - TARGET = test_xs1.xn -endif - ifeq ($(CONFIG),$(filter $(CONFIG),xs2)) TARGET = test.xn endif diff --git a/tests/test_makefile.mak b/tests/test_makefile.mak index e5f8b489..7cf06132 100644 --- a/tests/test_makefile.mak +++ b/tests/test_makefile.mak @@ -22,8 +22,6 @@ SHARED_CODE = ../../shared_src COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -Wno-timing -DXUD_SIM_XSIM=1 -DXUD_TEST_SPEED_HS=1 -DXUD_BYPASS_RESET=1 -#XCC_FLAGS_xs1 = $(COMMON_FLAGS) -DARCH_S -DXUD_SERIES_SUPPORT=XUD_U_SERIES -DARCH_L - #XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -DARCH_L XCC_FLAGS_xs3 = $(COMMON_FLAGS) -DXUD_STARTUP_ADDRESS=1 From 51e259e5ce2ce02bfc5495f204481c926ea97057 Mon Sep 17 00:00:00 2001 From: Dave Atkinson Date: Tue, 16 Mar 2021 11:31:12 +0000 Subject: [PATCH 177/520] Add exception on invalid architectureC in helpers.py --- tests/helpers.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/helpers.py b/tests/helpers.py index 61c9f406..221860b2 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -74,6 +74,8 @@ def get_usb_clk_phy(verbose=True, test_ctrl=None, do_timeout=True, do_timeout=do_timeout, complete_fn=complete_fn, expect_loopback=expect_loopback, dut_exit_time=dut_exit_time) + else: + raise ValueError("Invalid arhictecture: " + arch) return (clk, phy) From 675042664798be8c7a39d6b27d87b1329c750347 Mon Sep 17 00:00:00 2001 From: Dave Atkinson Date: Tue, 16 Mar 2021 11:38:38 +0000 Subject: [PATCH 178/520] Remove XS1 from test Makefiles. --- tests/test_control_basic_badcrc32/Makefile | 8 -------- tests/test_control_basic_short/Makefile | 8 -------- tests/test_control_repeatedsetup/Makefile | 8 -------- 3 files changed, 24 deletions(-) diff --git a/tests/test_control_basic_badcrc32/Makefile b/tests/test_control_basic_badcrc32/Makefile index 83edfc42..83a78752 100644 --- a/tests/test_control_basic_badcrc32/Makefile +++ b/tests/test_control_basic_badcrc32/Makefile @@ -24,14 +24,6 @@ COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -X XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -XCC_FLAGS_xs1 = $(COMMON_FLAGS) -DARCH_S -DXUD_SERIES_SUPPORT=XUD_U_SERIES - - - -ifeq ($(CONFIG),$(filter $(CONFIG),xs1)) - TARGET = test_xs1.xn -endif - ifeq ($(CONFIG),$(filter $(CONFIG),xs2)) TARGET = test.xn endif diff --git a/tests/test_control_basic_short/Makefile b/tests/test_control_basic_short/Makefile index 83edfc42..83a78752 100644 --- a/tests/test_control_basic_short/Makefile +++ b/tests/test_control_basic_short/Makefile @@ -24,14 +24,6 @@ COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -X XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -XCC_FLAGS_xs1 = $(COMMON_FLAGS) -DARCH_S -DXUD_SERIES_SUPPORT=XUD_U_SERIES - - - -ifeq ($(CONFIG),$(filter $(CONFIG),xs1)) - TARGET = test_xs1.xn -endif - ifeq ($(CONFIG),$(filter $(CONFIG),xs2)) TARGET = test.xn endif diff --git a/tests/test_control_repeatedsetup/Makefile b/tests/test_control_repeatedsetup/Makefile index 83edfc42..83a78752 100644 --- a/tests/test_control_repeatedsetup/Makefile +++ b/tests/test_control_repeatedsetup/Makefile @@ -24,14 +24,6 @@ COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -X XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -XCC_FLAGS_xs1 = $(COMMON_FLAGS) -DARCH_S -DXUD_SERIES_SUPPORT=XUD_U_SERIES - - - -ifeq ($(CONFIG),$(filter $(CONFIG),xs1)) - TARGET = test_xs1.xn -endif - ifeq ($(CONFIG),$(filter $(CONFIG),xs2)) TARGET = test.xn endif From 722b2341b95cb0ae5afea3d7b7a7c9d349a36a74 Mon Sep 17 00:00:00 2001 From: Dave Atkinson Date: Tue, 16 Mar 2021 12:06:39 +0000 Subject: [PATCH 179/520] Remove previously deleted code re-added in error. --- tests/helpers.py | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/tests/helpers.py b/tests/helpers.py index 92750778..a9293685 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -58,21 +58,6 @@ def get_usb_clk_phy(verbose=True, test_ctrl=None, do_timeout=True, expect_loopback=expect_loopback, dut_exit_time=dut_exit_time) - elif arch=='xs1': - clk = Clock('tile[0]:XS1_PORT_1J', Clock.CLK_60MHz) - phy = UsbPhyShim('tile[0]:XS1_PORT_8C', - 'tile[0]:XS1_PORT_1O', #rxa - 'tile[0]:XS1_PORT_1M', #rxv - 'tile[0]:XS1_PORT_1P', #rxe - 'tile[0]:XS1_PORT_1N', #vld - 'tile[0]:XS1_PORT_8A', #txd - 'tile[0]:XS1_PORT_1K', #txv - 'tile[0]:XS1_PORT_1H', #txrdy - clk, - verbose=verbose, test_ctrl=test_ctrl, - do_timeout=do_timeout, complete_fn=complete_fn, - expect_loopback=expect_loopback, - dut_exit_time=dut_exit_time) else: raise ValueError("Invalid architecture: " + arch) From a8fbe218c39a9252e66862fcbb69bb0b2ad544c3 Mon Sep 17 00:00:00 2001 From: Dave Atkinson Date: Tue, 16 Mar 2021 12:23:01 +0000 Subject: [PATCH 180/520] Fix .xn file names for XS2. --- tests/test_control_basic_badcrc32/Makefile | 2 +- tests/test_control_basic_short/Makefile | 2 +- tests/test_control_repeatedsetup/Makefile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_control_basic_badcrc32/Makefile b/tests/test_control_basic_badcrc32/Makefile index 83a78752..f0398897 100644 --- a/tests/test_control_basic_badcrc32/Makefile +++ b/tests/test_control_basic_badcrc32/Makefile @@ -25,7 +25,7 @@ COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -X XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES ifeq ($(CONFIG),$(filter $(CONFIG),xs2)) - TARGET = test.xn + TARGET = test_xs2.xn endif diff --git a/tests/test_control_basic_short/Makefile b/tests/test_control_basic_short/Makefile index 83a78752..f0398897 100644 --- a/tests/test_control_basic_short/Makefile +++ b/tests/test_control_basic_short/Makefile @@ -25,7 +25,7 @@ COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -X XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES ifeq ($(CONFIG),$(filter $(CONFIG),xs2)) - TARGET = test.xn + TARGET = test_xs2.xn endif diff --git a/tests/test_control_repeatedsetup/Makefile b/tests/test_control_repeatedsetup/Makefile index 83a78752..f0398897 100644 --- a/tests/test_control_repeatedsetup/Makefile +++ b/tests/test_control_repeatedsetup/Makefile @@ -25,7 +25,7 @@ COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -X XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES ifeq ($(CONFIG),$(filter $(CONFIG),xs2)) - TARGET = test.xn + TARGET = test_xs2.xn endif From d8b63d305010abc9308b1c1be5cef5b2b198099b Mon Sep 17 00:00:00 2001 From: mbanth Date: Tue, 16 Mar 2021 16:32:59 +0000 Subject: [PATCH 181/520] Remove unused clock frequencies. --- tests/usb_clock.py | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/tests/usb_clock.py b/tests/usb_clock.py index 7df64602..76e361bd 100644 --- a/tests/usb_clock.py +++ b/tests/usb_clock.py @@ -4,24 +4,17 @@ class Clock(xmostest.SimThread): - (CLK_125MHz, CLK_60MHz, CLK_2_5MHz) = (0x4, 0x2, 0x0) + CLK_60MHz = 0x0 def __init__(self, port, clk): self._running = True self._clk = clk - if clk == self.CLK_125MHz: - self._period = float(1000000000) / 125000000 - self._name = '125Mhz' - self._min_ifg = 96 - self._bit_time = 1 - elif clk == self.CLK_60MHz: + if clk == self.CLK_60MHz: self._period = float(1000000000) / 60000000 self._name = '60Mhz' self._bit_time = 5 # TODO - elif clk == self.CLK_2_5MHz: - self._period = float(1000000000) / 2500000 - self._name = '2.5Mhz' - self._bit_time = 100 + else: + raise ValueError('Unsupported Clock Frequency') self._min_ifg = 96 * self._bit_time self._val = 0 self._port = port From 856496e22a3a2d6a28c8b5dd89a65542f150938b Mon Sep 17 00:00:00 2001 From: mbanth Date: Wed, 17 Mar 2021 17:48:48 +0000 Subject: [PATCH 182/520] Add packet class hierarchy docstring --- tests/usb_packet.py | 57 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/tests/usb_packet.py b/tests/usb_packet.py index 867fab38..468f98da 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -1,3 +1,60 @@ +""" Define packet types + +Packet Class Hierarchy +---------------------- + ++-----------+ +| Object | ++-----------+ + ^ + | ++-----------+ +| UsbPacket | ++-----------+ + ^ + | +------------+ + |-------| DataPacket | + | +------------+ + | + | +-----------------+ + |-------| HandshakePacket | + | +-----------------+ + | + | +----------+ + |-------| RxPacket | + | +----------+ + | + | +----------+ + --------| TxPacket | + +----------+ + ^ + | + +-------------+ + | TokenPacket | + +-------------+ + ++----------+ +------------+ +----------+ +| RxPacket | | DataPacket | | TxPacket | ++----------+ +------------+ +----------+ + ^ ^ ^ ^ + | | | | + ------------- -------------- + | | + +--------------+ +--------------+ + | RxDataPacket | | TxDataPacket | + +--------------+ +--------------+ + ++----------+ +-----------------+ +----------+ +| RxPacket | | HandshakePacket | | TxPacket | ++----------+ +-----------------+ +----------+ + ^ ^ ^ ^ + | | | | + ------------- -------------- + | | + +-------------------+ +-------------------+ + | RxHandshakePacket | | TxHandshakePacket | + +-------------------+ +-------------------+ +""" import sys import zlib From da1cd8e5e7a1dd5bbdad55129984f4f70b2e98b3 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 18 Mar 2021 13:19:27 +0000 Subject: [PATCH 183/520] Resolved build issue with test_shorttoken (still fails, expected) --- tests/test_shorttoken/src/main.xc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_shorttoken/src/main.xc b/tests/test_shorttoken/src/main.xc index f8643c85..af6d7d24 100644 --- a/tests/test_shorttoken/src/main.xc +++ b/tests/test_shorttoken/src/main.xc @@ -34,12 +34,12 @@ int TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_out_0) if(length != i) { printintln(length); - fail(FAIL_RX_LENERROR); + TerminateFail(FAIL_RX_LENERROR); } if(RxDataCheck(buffer, length, epNum,i)) { - fail(FAIL_RX_DATAERROR); + TerminateFail(FAIL_RX_DATAERROR); } } From a4310b8235a6c758632d01439082eb0171d29de9 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 18 Mar 2021 15:43:32 +0000 Subject: [PATCH 184/520] Run() moved to super --- tests/helpers.py | 6 +- tests/usb_phy.py | 167 +++++++++++++++++++++++++++++++++++++++++- tests/usb_phy_utmi.py | 165 +---------------------------------------- 3 files changed, 170 insertions(+), 168 deletions(-) diff --git a/tests/helpers.py b/tests/helpers.py index a9293685..202dfa0f 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -109,7 +109,7 @@ def do_usb_test(arch, clk, phy, packets, test_file, seed, expect_folder = create_if_needed("expect") expect_filename = '{folder}/{test}_{arch}.expect'.format( - folder=expect_folder, test=testname, phy=phy.get_name(), clk=clk.get_name(), arch=arch) + folder=expect_folder, test=testname, phy=phy.name, clk=clk.get_name(), arch=arch) create_expect(arch, packets, expect_filename) tester = xmostest.ComparisonTester(open(expect_filename), @@ -151,7 +151,7 @@ def get_sim_args(testname, clk, phy, arch='xs2'): filename = "{log}/xsim_trace_{test}_{clk}_{arch}".format( log=log_folder, test=testname, - clk=clk.get_name(), phy=phy.get_name(), arch=arch) + clk=clk.get_name(), phy=phy.name, arch=arch) sim_args += ['--trace-to', '{0}.txt'.format(filename), '--enable-fnop-tracing'] @@ -167,7 +167,7 @@ def get_sim_args(testname, clk, phy, arch='xs2'): def packet_processing_time(phy, data_bytes): """ Returns the time it takes the DUT to process a given frame """ - return 6000 * phy.get_clock().get_bit_time() + return 6000 * phy.clock.get_bit_time() #def get_dut_address(): # """ Returns the busaddress of the DUT diff --git a/tests/usb_phy.py b/tests/usb_phy.py index 1c45faab..045b8c71 100644 --- a/tests/usb_phy.py +++ b/tests/usb_phy.py @@ -3,10 +3,10 @@ import sys import zlib from usb_packet import RxPacket, TokenPacket +import usb_packet class UsbPhy(xmostest.SimThread): - # Time in ns from the last packet being sent until the end of test is signalled to the DUT END_OF_TEST_TIME = 5000 @@ -32,10 +32,12 @@ def __init__(self, name, rxd, rxa, rxdv, rxer, txd, txv, txrdy, ls0, ls1, clock, self._expect_loopback = expect_loopback self._dut_exit_time = dut_exit_time - def get_name(self): + @property + def name(self): return self._name - def get_clock(self): + @property + def clock(self): return self._clock def start_test(self): @@ -92,6 +94,165 @@ def set_packets(self, packets): def drive_error(self, value): self.xsi.drive_port_pins(self._rxer, value) + def run(self): + + xsi = self.xsi + + self.start_test() + + for i,packet in enumerate(self._packets): + + if isinstance(packet, RxPacket): + + timeout = packet.get_timeout() + + #print "Expecting pkt. Timeout in: {i}".format(i=timeout) + + in_rx_packet = False + rx_packet = [] + + while timeout != 0: + + self.wait(lambda x: self._clock.is_high()) + self.wait(lambda x: self._clock.is_low()) + + timeout = timeout - 1 + #print "{i}".format(i=timeout) + + #sample TXV for new packet + if xsi.sample_port_pins(self._txv) == 1: + print "Receiving packet {}".format(i) + in_rx_packet = True + break + + if in_rx_packet == False: + print "ERROR: Timed out waiting for packet" + else: + while in_rx_packet == True: + + # TODO txrdy pulsing + xsi.drive_port_pins(self._txrdy, 1) + data = xsi.sample_port_pins(self._txd) + + print "Received byte: {0:#x}".format(data) + rx_packet.append(data) + + self.wait(lambda x: self._clock.is_high()) + self.wait(lambda x: self._clock.is_low()) + + if xsi.sample_port_pins(self._txv) == 0: + #print "TXV low, breaking out of loop" + in_rx_packet = False + + # End of packet + xsi.drive_port_pins(self._txrdy, 0) + + # Check packet against expected + expected = packet.get_bytes(do_tokens=self._do_tokens) + if len(expected) != len(rx_packet): + print "ERROR: Rx packet length bad. Expecting: {} actual: {}".format(len(expected), len(rx_packet)) + + # Check packet data against expected + if cmp(expected, rx_packet): + print "ERROR: Rx Packet Error. Expected:" + for item in expected: + print "{0:#x}".format(item) + + print "Received:" + for item in rx_packet: + print "{0:#x}".format(item) + + else: + + #TxPacket (which could be a TxToken or TxDataPacket) + + # xCore should not be trying to send if we are trying to send.. + if xsi.sample_port_pins(self._txv) == 1: + print "ERROR: Unexpected packet from xCORE" + + rxv_count = packet.get_data_valid_count(); + + #print "Waiting for inter_pkt_gap: {i}".format(i=packet.inter_frame_gap) + self.wait_until(xsi.get_time() + packet.inter_pkt_gap) + + print "Phy transmitting packet {} PID: {} ({})".format(i, packet.get_pid_pretty(), packet.pid) + if self._verbose: + sys.stdout.write(packet.dump()) + + # Set RXA high + #xsi.drive_port_pins(self._rxa, 1) + xsi.drive_periph_pin(self._rxa, 1) + + # Wait for RXA start delay + rxa_start_delay = usb_packet.RXA_START_DELAY; + + while rxa_start_delay != 0: + self.wait(lambda x: self._clock.is_high()) + self.wait(lambda x: self._clock.is_low()) + rxa_start_delay = rxa_start_delay- 1; + + self._tx_packet_init() + + for (i, byte) in enumerate(packet.get_bytes(do_tokens = self._do_tokens)): + + # xCore should not be trying to send if we are trying to send.. + if xsi.sample_port_pins(self._txv) == 1: + print "ERROR: Unexpected packet from xCORE" + + self.wait(lambda x: self._clock.is_low()) + + self.wait(lambda x: self._clock.is_high()) + self.wait(lambda x: self._clock.is_low()) + xsi.drive_periph_pin(self._rxdv, 1) + xsi.drive_periph_pin(self._rxd, byte) + + if (packet.rxe_assert_time != 0) and (packet.rxe_assert_time == i): + #xsi.drive_port_pins(self._rxer, 1) + xsi.drive_periph_pin(self._rxer, 1) + + while rxv_count != 0: + self.wait(lambda x: self._clock.is_high()) + self.wait(lambda x: self._clock.is_low()) + xsi.drive_periph_pin(self._rxdv, 0) + rxv_count = rxv_count - 1 + + # xCore should not be trying to send if we are trying to send.. + if xsi.sample_port_pins(self._txv) == 1: + print "ERROR: Unexpected packet from xCORE" + + #print "Sending byte {0:#x}".format(byte) + + rxv_count = packet.get_data_valid_count(); + + # Wait for last byte + self.wait(lambda x: self._clock.is_high()) + self.wait(lambda x: self._clock.is_low()) + + xsi.drive_periph_pin(self._rxdv, 0) + xsi.drive_periph_pin(self._rxer, 0) + + rxa_end_delay = packet.rxa_end_delay + while rxa_end_delay != 0: + # Wait for RXA fall delay TODO, this should be configurable + self.wait(lambda x: self._clock.is_high()) + self.wait(lambda x: self._clock.is_low()) + rxa_end_delay = rxa_end_delay - 1 + + # xCore should not be trying to send if we are trying to send.. + if xsi.sample_port_pins(self._txv) == 1: + print "ERROR: Unexpected packet from xCORE" + + #xsi.drive_port_pins(self._rxa, 0) + xsi.drive_periph_pin(self._rxa, 0) + + #if self._verbose: + #print "Sent" + + print "Test done" + self.end_test() + + + diff --git a/tests/usb_phy_utmi.py b/tests/usb_phy_utmi.py index f450b699..66edec48 100644 --- a/tests/usb_phy_utmi.py +++ b/tests/usb_phy_utmi.py @@ -13,167 +13,8 @@ def __init__(self, rxd, rxa, rxdv, rxer, txd, txv, txrdy, ls0, ls1, clock, do_timeout=True, complete_fn=None, expect_loopback=True, dut_exit_time=25000): - super(UsbPhyUtmi, self).__init__('mii', rxd, rxa, rxdv, rxer, txd, txv, txrdy, ls0, ls1, clock, + self._do_tokens = False + + super(UsbPhyUtmi, self).__init__('UsbPhyUtmi', rxd, rxa, rxdv, rxer, txd, txv, txrdy, ls0, ls1, clock, initial_delay, verbose, test_ctrl, do_timeout, complete_fn, expect_loopback, dut_exit_time) - def run(self): - xsi = self.xsi - - self.start_test() - - for i,packet in enumerate(self._packets): - - #if isinstance(packet, BusReset): - - # print "BUS RESET" - - - if isinstance(packet, RxPacket): - - timeout = packet.get_timeout() - - #print "Expecting pkt. Timeout in: {i}".format(i=timeout) - - in_rx_packet = False - rx_packet = [] - - while timeout != 0: - - self.wait(lambda x: self._clock.is_high()) - self.wait(lambda x: self._clock.is_low()) - - timeout = timeout - 1 - #print "{i}".format(i=timeout) - - #sample TXV for new packet - if xsi.sample_port_pins(self._txv) == 1: - print "Receiving packet {}".format(i) - in_rx_packet = True - break - - if in_rx_packet == False: - print "ERROR: Timed out waiting for packet" - else: - while in_rx_packet == True: - - # TODO txrdy pulsing - xsi.drive_port_pins(self._txrdy, 1) - data = xsi.sample_port_pins(self._txd) - - print "Received byte: {0:#x}".format(data) - rx_packet.append(data) - - self.wait(lambda x: self._clock.is_high()) - self.wait(lambda x: self._clock.is_low()) - - if xsi.sample_port_pins(self._txv) == 0: - #print "TXV low, breaking out of loop" - in_rx_packet = False - - # End of packet - xsi.drive_port_pins(self._txrdy, 0) - - # Check packet agaist expected - expected = packet.get_bytes(do_tokens=False) - if len(expected) != len(rx_packet): - print "ERROR: Rx packet length bad. Expecting: {} actual: {}".format(len(expected), len(rx_packet)) - - # Check packet data against expected - if cmp(expected, rx_packet): - print "ERROR: Rx Packet Error. Expected:" - for item in expected: - print "{0:#x}".format(item) - - print "Received:" - for item in rx_packet: - print "{0:#x}".format(item) - - else: - - #TxPacket (which could be a TxToken or TxDataPacket) - - # xCore should not be trying to send if we are trying to send.. - if xsi.sample_port_pins(self._txv) == 1: - print "ERROR: Unexpected packet from xCORE" - - rxv_count = packet.get_data_valid_count(); - - #print "Waiting for inter_pkt_gap: {i}".format(i=packet.inter_frame_gap) - self.wait_until(xsi.get_time() + packet.inter_pkt_gap) - - print "Phy transmitting packet {} PID: {} ({})".format(i, packet.get_pid_pretty(), packet.pid) - if self._verbose: - sys.stdout.write(packet.dump()) - - # Set RXA high - #xsi.drive_port_pins(self._rxa, 1) - xsi.drive_periph_pin(self._rxa, 1) - - # Wait for RXA start delay - rxa_start_delay = usb_packet.RXA_START_DELAY; - - while rxa_start_delay != 0: - self.wait(lambda x: self._clock.is_high()) - self.wait(lambda x: self._clock.is_low()) - rxa_start_delay = rxa_start_delay- 1; - - for (i, byte) in enumerate(packet.get_bytes()): - - # xCore should not be trying to send if we are trying to send.. - if xsi.sample_port_pins(self._txv) == 1: - print "ERROR: Unexpected packet from xCORE" - - self.wait(lambda x: self._clock.is_low()) - - self.wait(lambda x: self._clock.is_high()) - self.wait(lambda x: self._clock.is_low()) - xsi.drive_periph_pin(self._rxdv, 1) - xsi.drive_periph_pin(self._rxd, byte) - - if (packet.rxe_assert_time != 0) and (packet.rxe_assert_time == i): - #xsi.drive_port_pins(self._rxer, 1) - xsi.drive_periph_pin(self._rxer, 1) - - while rxv_count != 0: - self.wait(lambda x: self._clock.is_high()) - self.wait(lambda x: self._clock.is_low()) - xsi.drive_periph_pin(self._rxdv, 0) - rxv_count = rxv_count - 1 - - # xCore should not be trying to send if we are trying to send.. - if xsi.sample_port_pins(self._txv) == 1: - print "ERROR: Unexpected packet from xCORE" - - #print "Sending byte {0:#x}".format(byte) - - rxv_count = packet.get_data_valid_count(); - - # Wait for last byte - self.wait(lambda x: self._clock.is_high()) - self.wait(lambda x: self._clock.is_low()) - - xsi.drive_periph_pin(self._rxdv, 0) - xsi.drive_periph_pin(self._rxer, 0) - - rxa_end_delay = packet.rxa_end_delay - while rxa_end_delay != 0: - # Wait for RXA fall delay TODO, this should be configurable - self.wait(lambda x: self._clock.is_high()) - self.wait(lambda x: self._clock.is_low()) - rxa_end_delay = rxa_end_delay - 1 - - # xCore should not be trying to send if we are trying to send.. - if xsi.sample_port_pins(self._txv) == 1: - print "ERROR: Unexpected packet from xCORE" - - #xsi.drive_port_pins(self._rxa, 0) - xsi.drive_periph_pin(self._rxa, 0) - - #if self._verbose: - #print "Sent" - - print "Test done" - self.end_test() - - - From 344f2effb128533b77ea2c14bcdc3f890a275107 Mon Sep 17 00:00:00 2001 From: mbanth Date: Thu, 18 Mar 2021 17:13:34 +0000 Subject: [PATCH 185/520] Add support for Full Speed testing --- tests/helpers.py | 37 ++++++++++++++++++++-------- tests/test_bulk_loopback.py | 20 +++++++-------- tests/test_bulk_rx_basic.py | 8 +++--- tests/test_bulk_rx_basic_badcrc32.py | 24 +++++++++--------- tests/test_bulk_rx_basic_badpid.py | 28 ++++++++++----------- tests/test_bulk_rx_basic_nodata.py | 24 +++++++++--------- tests/test_bulk_rx_basic_rxerror.py | 32 ++++++++++++------------ tests/test_bulk_rx_multiep.py | 20 +++++++-------- tests/test_bulk_rx_traffic.py | 12 ++++----- tests/test_bulk_tx_badack.py | 12 ++++----- tests/test_bulk_tx_basic.py | 8 +++--- tests/test_bulk_tx_basic_short.py | 8 +++--- tests/test_bulk_tx_multiep.py | 20 +++++++-------- tests/test_bulk_tx_noack.py | 10 ++++---- 14 files changed, 140 insertions(+), 123 deletions(-) diff --git a/tests/helpers.py b/tests/helpers.py index a9293685..d9091684 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -63,6 +63,18 @@ def get_usb_clk_phy(verbose=True, test_ctrl=None, do_timeout=True, return (clk, phy) +def get_usb_data_valid_count(usb_speed='HS'): + return_value = 0 + + if usb_speed == 'HS': + return_value = 0 + elif usb_speed == 'FS': + return_value = 39 + else: + raise ValueError("Unsupported USB speed: {}".format(usb_speed)) + + return return_value + def run_on(**kwargs): if not args: return True @@ -74,20 +86,25 @@ def run_on(**kwargs): return True +SUPPORTED_USB_SPEEDS = ['FS', 'HS'] + def runall_rx(test_fn): if run_on(arch='xs3'): - (clk_60, usb_phy) = get_usb_clk_phy(verbose=False, arch='xs3') - seed = args.seed if args.seed else random.randint(0, sys.maxint) - test_fn('xs3', clk_60, usb_phy, seed) + test_arch = 'xs3' if run_on(arch='xs2'): - (clk_60, usb_phy) = get_usb_clk_phy(verbose=False, arch='xs2') - seed = args.seed if args.seed else random.randint(0, sys.maxint) - test_fn('xs2', clk_60, usb_phy, seed) + test_arch = 'xs2' + + (clk_60, usb_phy) = get_usb_clk_phy(verbose=False, arch=test_arch) + seed = args.seed if args.seed else random.randint(0, sys.maxint) + + for speed in SUPPORTED_USB_SPEEDS: + data_valid_count = get_usb_data_valid_count(usb_speed=speed) + test_fn(test_arch, clk_60, usb_phy, data_valid_count, speed, seed) -def do_usb_test(arch, clk, phy, packets, test_file, seed, +def do_usb_test(arch, clk, phy, usb_speed, packets, test_file, seed, level='nightly', extra_tasks=[]): """ Shared test code for all RX tests using the test_rx application. @@ -101,9 +118,9 @@ def do_usb_test(arch, clk, phy, packets, test_file, seed, print binary if xmostest.testlevel_is_at_least(xmostest.get_testlevel(), level): - print "Running {test}: {arch} arch sending {n} packets at {clk} (seed {seed})".format( + print "Running {test}: {arch} arch sending {n} packets at {clk} using {speed} (seed {seed})".format( test=testname, n=len(packets), - arch=arch, clk=clk.get_name(), seed=seed) + arch=arch, clk=clk.get_name(), speed=usb_speed, seed=seed) phy.set_packets(packets) @@ -114,7 +131,7 @@ def do_usb_test(arch, clk, phy, packets, test_file, seed, tester = xmostest.ComparisonTester(open(expect_filename), 'lib_xud', 'xud_sim_tests', testname, - {'clk':clk.get_name(), 'arch':arch}) + {'clk':clk.get_name(), 'arch':arch, 'speed':usb_speed}) tester.set_min_testlevel(level) diff --git a/tests/test_bulk_loopback.py b/tests/test_bulk_loopback.py index cfe97ac5..128b9d17 100644 --- a/tests/test_bulk_loopback.py +++ b/tests/test_bulk_loopback.py @@ -7,7 +7,7 @@ from usb_clock import Clock from helpers import do_usb_test, runall_rx -def do_test(arch, clk, phy, seed): +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): rand = random.Random() rand.seed(seed) @@ -26,15 +26,15 @@ def do_test(arch, clk, phy, seed): for pkt_length in range(0, 20): AppendOutToken(packets, ep_loopback, address) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=pkt_length, pid=data_pid)) - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) # 357 was min IPG supported on bulk loopback to not nak # For move from sc_xud to lib_xud (14.1.2 tools) had to increase this to 377 # Increased again due to setup/out checking AppendInToken(packets, ep_loopback, address, inter_pkt_gap=417) - packets.append(RxDataPacket(rand, data_start_val=dataval, length=pkt_length, pid=data_pid)) - packets.append(TxHandshakePacket()) + packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) + packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) data_pid = data_pid ^ 8 @@ -42,14 +42,14 @@ def do_test(arch, clk, phy, seed): #Loopback and die.. AppendOutToken(packets, ep_loopback_kill, address) - packets.append(TxDataPacket(rand, length=pkt_length, pid=3)) #DATA0 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_valid_count=data_valid_count, length=pkt_length, pid=3)) #DATA0 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) AppendInToken(packets, ep_loopback_kill, address, inter_pkt_gap=400) - packets.append(RxDataPacket(rand, length=pkt_length, pid=3)) #DATA0 - packets.append(TxHandshakePacket()) + packets.append(RxDataPacket(rand, data_valid_count=data_valid_count, length=pkt_length, pid=3)) #DATA0 + packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) - do_usb_test(arch, clk, phy, packets, __file__, seed, + do_usb_test(arch, clk, phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): diff --git a/tests/test_bulk_rx_basic.py b/tests/test_bulk_rx_basic.py index 4e4c8d90..af88634c 100644 --- a/tests/test_bulk_rx_basic.py +++ b/tests/test_bulk_rx_basic.py @@ -7,7 +7,7 @@ from usb_clock import Clock from helpers import do_usb_test, runall_rx -def do_test(arch, clk, phy, seed): +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): rand = random.Random() rand.seed(seed) @@ -24,8 +24,8 @@ def do_test(arch, clk, phy, seed): for pktlength in range(10, 20): AppendOutToken(packets, ep, address, inter_pkt_gap=500) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=pktlength, pid=pid)) - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pktlength, pid=pid)) + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) if(pid == usb_packet.PID_DATA1): pid = usb_packet.PID_DATA0; @@ -34,7 +34,7 @@ def do_test(arch, clk, phy, seed): dataval += pktlength - do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): random.seed(1) diff --git a/tests/test_bulk_rx_basic_badcrc32.py b/tests/test_bulk_rx_basic_badcrc32.py index d1e14789..6980affc 100644 --- a/tests/test_bulk_rx_basic_badcrc32.py +++ b/tests/test_bulk_rx_basic_badcrc32.py @@ -10,7 +10,7 @@ # Single, setup transaction to EP 0 -def do_test(arch, tx_clk, tx_phy, seed): +def do_test(arch, tx_clk, tx_phy, data_valid_count, usb_speed, seed): rand = random.Random() rand.seed(seed) @@ -24,37 +24,37 @@ def do_test(arch, tx_clk, tx_phy, seed): # Good OUT transaction AppendOutToken(packets, ep, dev_address) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=10, pid=usb_packet.PID_DATA0)) - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=10, pid=usb_packet.PID_DATA0)) + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) # Note, quite big gap to allow checking. # Another good OUT transaction dataval += 10 AppendOutToken(packets, ep, dev_address, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=11, pid=usb_packet.PID_DATA1)) - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=11, pid=usb_packet.PID_DATA1)) + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) dataval += 11 AppendOutToken(packets, ep, dev_address, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=12, bad_crc=True, pid=usb_packet.PID_DATA0)) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=12, bad_crc=True, pid=usb_packet.PID_DATA0)) # Bad CRC - dont expect ACK - #packets.append(RxHandshakePacket()) + #packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) #Due to bad CRC, XUD will not ACK and expect a resend of the same packet - so dont change PID dataval += 12 AppendOutToken(packets, ep, dev_address, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=13, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=13, pid=0x3)) #DATA0 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) # PID toggle as normal dataval += 13 AppendOutToken(packets, ep, dev_address, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=14, pid=0xb)) #DATA1 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=14, pid=0xb)) #DATA1 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - do_usb_test(arch, tx_clk, tx_phy, packets, __file__, seed, + do_usb_test(arch, tx_clk, tx_phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): diff --git a/tests/test_bulk_rx_basic_badpid.py b/tests/test_bulk_rx_basic_badpid.py index 065bee5c..c4dea074 100644 --- a/tests/test_bulk_rx_basic_badpid.py +++ b/tests/test_bulk_rx_basic_badpid.py @@ -11,7 +11,7 @@ # Single, setup transaction to EP 0 -def do_test(arch, clk, phy, seed): +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): rand = random.Random() rand.seed(seed) @@ -26,35 +26,35 @@ def do_test(arch, clk, phy, seed): ipg = 500 AppendOutToken(packets, ep, address) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=10, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=10, pid=0x3)) #DATA0 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) dataval += 10 AppendOutToken(packets, ep, address, inter_pkt_gap=ipg) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=11, pid=0xb)) #DATA1 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=11, pid=0xb)) #DATA1 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) #Pretend the ACK went missing. Re-send same packet. xCORE should ACK but throw pkt away AppendOutToken(packets, ep, address, inter_pkt_gap=ipg) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=11, pid=0xb)) #DATA1 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=11, pid=0xb)) #DATA1 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) dataval += 11 AppendOutToken(packets, ep, address, inter_pkt_gap=ipg) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=12, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=12, pid=0x3)) #DATA0 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) dataval += 12 AppendOutToken(packets, ep, address, inter_pkt_gap=ipg) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=13, pid=0xb)) #DATA1 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=13, pid=0xb)) #DATA1 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) dataval += 13 AppendOutToken(packets, ep, address, inter_pkt_gap=ipg) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=14, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=14, pid=0x3)) #DATA0 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): random.seed(1) diff --git a/tests/test_bulk_rx_basic_nodata.py b/tests/test_bulk_rx_basic_nodata.py index eed7eb7e..f3aa1a45 100644 --- a/tests/test_bulk_rx_basic_nodata.py +++ b/tests/test_bulk_rx_basic_nodata.py @@ -11,7 +11,7 @@ # Single, setup transaction to EP 0 -def do_test(arch, clk, phy, seed): +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): rand = random.Random() rand.seed(seed) @@ -26,13 +26,13 @@ def do_test(arch, clk, phy, seed): ipg = 500 AppendOutToken(packets, ep, address) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=10, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=10, pid=0x3)) #DATA0 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) dataval += 10 AppendOutToken(packets, ep, address, inter_pkt_gap=ipg) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=11, pid=0xb)) #DATA1 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=11, pid=0xb)) #DATA1 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) AppendOutToken(packets, ep, address, inter_pkt_gap=ipg) # MISSING DATA PAYLOAD @@ -40,20 +40,20 @@ def do_test(arch, clk, phy, seed): dataval += 11 AppendOutToken(packets, ep, address, inter_pkt_gap=ipg) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=12, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=12, pid=0x3)) #DATA0 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) dataval += 12 AppendOutToken(packets, ep, address, inter_pkt_gap=ipg) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=13, pid=0xb)) #DATA1 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=13, pid=0xb)) #DATA1 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) dataval += 13 AppendOutToken(packets, ep, address, inter_pkt_gap=ipg) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=14, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=14, pid=0x3)) #DATA0 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): random.seed(1) diff --git a/tests/test_bulk_rx_basic_rxerror.py b/tests/test_bulk_rx_basic_rxerror.py index 089e31e6..20bc444a 100644 --- a/tests/test_bulk_rx_basic_rxerror.py +++ b/tests/test_bulk_rx_basic_rxerror.py @@ -8,7 +8,7 @@ # Single, setup transaction to EP 0 -def do_test(arch, clk, phy, seed): +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): rand = random.Random() rand.seed(seed) @@ -21,43 +21,43 @@ def do_test(arch, clk, phy, seed): dataval = 0; AppendOutToken(packets, ep, address) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=10, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=10, pid=0x3)) #DATA0 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) # Assert RxError during packet dataval += 10 AppendOutToken(packets, ep, address, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=11, pid=0xb, rxe_assert_time=5)) #DATA1 + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=11, pid=0xb, rxe_assert_time=5)) #DATA1 # xCORE should ignore the packet and not handshake... - #packets.append(RxHandshakePacket()) + #packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) # Re-send.. AppendOutToken(packets, ep, address, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=11, pid=0xb, rxe_assert_time=0)) #DATA1 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=11, pid=0xb, rxe_assert_time=0)) #DATA1 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) dataval += 11 AppendOutToken(packets, ep, address, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=12, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=12, pid=0x3)) #DATA0 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) dataval += 12 AppendOutToken(packets, ep, address, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=13, pid=0xb, rxe_assert_time=1)) #DATA1 - #packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=13, pid=0xb, rxe_assert_time=1)) #DATA1 + #packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) #resend AppendOutToken(packets, ep, address, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=13, pid=0xb)) #DATA1 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=13, pid=0xb)) #DATA1 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) dataval += 13 AppendOutToken(packets, ep, address, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=14, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=14, pid=0x3)) #DATA0 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): random.seed(1) diff --git a/tests/test_bulk_rx_multiep.py b/tests/test_bulk_rx_multiep.py index 45b8fefc..90d99506 100644 --- a/tests/test_bulk_rx_multiep.py +++ b/tests/test_bulk_rx_multiep.py @@ -6,7 +6,7 @@ from usb_clock import Clock from helpers import do_usb_test, runall_rx -def do_test(arch, clk, phy, seed): +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): rand = random.Random() rand.seed(seed) @@ -22,25 +22,25 @@ def do_test(arch, clk, phy, seed): #min 237 AppendOutToken(packets, 3, address, inter_pkt_gap=1) - packets.append(TxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) #DATA0 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=data_val, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) #DATA0 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) AppendOutToken(packets, 4, address, inter_pkt_gap=1) - packets.append(TxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) #DATA0 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=data_val, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) #DATA0 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) AppendOutToken(packets, 5, address, inter_pkt_gap=0) - packets.append(TxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) #DATA0 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=data_val, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) #DATA0 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) AppendOutToken(packets, 6, address, inter_pkt_gap=0) - packets.append(TxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) #DATA0 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=data_val, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) #DATA0 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) data_val = data_val + pkt_length data_pid = data_pid ^ 8 - do_usb_test(arch, clk, phy, packets, __file__, seed, + do_usb_test(arch, clk, phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): diff --git a/tests/test_bulk_rx_traffic.py b/tests/test_bulk_rx_traffic.py index a73afdf7..0f07a0b1 100644 --- a/tests/test_bulk_rx_traffic.py +++ b/tests/test_bulk_rx_traffic.py @@ -7,7 +7,7 @@ from usb_clock import Clock from helpers import do_usb_test, runall_rx -def do_test(arch, clk, phy, seed): +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): rand = random.Random() rand.seed(seed) @@ -30,14 +30,14 @@ def do_test(arch, clk, phy, seed): for pktlength in range(10, 20): AppendOutToken(packets, trafficEp1, trafficAddress1, inter_pkt_gap=500) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=pktlength, pid=pid)) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pktlength, pid=pid)) AppendOutToken(packets, ep, address, inter_pkt_gap=500) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=pktlength, pid=pid)) - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pktlength, pid=pid)) + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) AppendOutToken(packets, trafficEp2, trafficAddress2, inter_pkt_gap=500) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=pktlength, pid=pid)) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pktlength, pid=pid)) if(pid == usb_packet.PID_DATA1): pid = usb_packet.PID_DATA0; @@ -54,7 +54,7 @@ def do_test(arch, clk, phy, seed): if(trafficEp1 > 15): trafficEp1 = 0 - do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): random.seed(1) diff --git a/tests/test_bulk_tx_badack.py b/tests/test_bulk_tx_badack.py index 0ee6a531..dc0d9f81 100644 --- a/tests/test_bulk_tx_badack.py +++ b/tests/test_bulk_tx_badack.py @@ -7,7 +7,7 @@ from helpers import do_usb_test, runall_rx -def do_test(arch, tx_clk, tx_phy, seed): +def do_test(arch, tx_clk, tx_phy, data_valid_count, usb_speed, seed): rand = random.Random() rand.seed(seed) @@ -27,12 +27,12 @@ def do_test(arch, tx_clk, tx_phy, seed): if(i == 2): AppendInToken(packets, ep, address, inter_pkt_gap=4000) - packets.append(RxDataPacket(rand, data_start_val=dataval, length=pktlength, pid=pid)) #DATA1 - packets.append(TxHandshakePacket(pid=0xff)) + packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pktlength, pid=pid)) #DATA1 + packets.append(TxHandshakePacket(data_valid_count=data_valid_count, pid=0xff)) AppendInToken(packets, ep, address, inter_pkt_gap=4000) - packets.append(RxDataPacket(rand, data_start_val=dataval, length=pktlength, pid=pid)) #DATA1 - packets.append(TxHandshakePacket()) + packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pktlength, pid=pid)) #DATA1 + packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) if(pid == usb_packet.PID_DATA1): pid = usb_packet.PID_DATA0; @@ -43,7 +43,7 @@ def do_test(arch, tx_clk, tx_phy, seed): pktlength += 1 # Note, quite big gap to allow checking. - do_usb_test(arch, tx_clk, tx_phy, packets, __file__, seed, + do_usb_test(arch, tx_clk, tx_phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): diff --git a/tests/test_bulk_tx_basic.py b/tests/test_bulk_tx_basic.py index f1edcb95..87c84422 100644 --- a/tests/test_bulk_tx_basic.py +++ b/tests/test_bulk_tx_basic.py @@ -7,7 +7,7 @@ from helpers import do_usb_test, runall_rx -def do_test(arch, tx_clk, tx_phy, seed): +def do_test(arch, tx_clk, tx_phy, data_valid_count, usb_speed, seed): rand = random.Random() rand.seed(seed) @@ -25,8 +25,8 @@ def do_test(arch, tx_clk, tx_phy, seed): AppendInToken(packets, ep, address, inter_pkt_gap=4000) - packets.append(RxDataPacket(rand, data_start_val=dataval, length=pktlength, pid=pid)) #DATA1 - packets.append(TxHandshakePacket()) + packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pktlength, pid=pid)) #DATA1 + packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) if(pid == usb_packet.PID_DATA1): @@ -37,7 +37,7 @@ def do_test(arch, tx_clk, tx_phy, seed): dataval += pktlength # Note, quite big gap to allow checking. - do_usb_test(arch, tx_clk, tx_phy, packets, __file__, seed, + do_usb_test(arch, tx_clk, tx_phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): diff --git a/tests/test_bulk_tx_basic_short.py b/tests/test_bulk_tx_basic_short.py index e1996fe1..595a6c6f 100644 --- a/tests/test_bulk_tx_basic_short.py +++ b/tests/test_bulk_tx_basic_short.py @@ -7,7 +7,7 @@ from helpers import do_usb_test, runall_rx -def do_test(arch, tx_clk, tx_phy, seed): +def do_test(arch, tx_clk, tx_phy, data_valid_count, usb_speed, seed): rand = random.Random() rand.seed(seed) @@ -25,8 +25,8 @@ def do_test(arch, tx_clk, tx_phy, seed): AppendInToken(packets, ep, address, inter_pkt_gap=4000) - packets.append(RxDataPacket(rand, data_start_val=dataval, length=pktlength, pid=pid)) #DATA1 - packets.append(TxHandshakePacket()) + packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pktlength, pid=pid)) #DATA1 + packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) if(pid == usb_packet.PID_DATA1): @@ -37,7 +37,7 @@ def do_test(arch, tx_clk, tx_phy, seed): dataval += pktlength # Note, quite big gap to allow checking. - do_usb_test(arch, tx_clk, tx_phy, packets, __file__, seed, + do_usb_test(arch, tx_clk, tx_phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): diff --git a/tests/test_bulk_tx_multiep.py b/tests/test_bulk_tx_multiep.py index c3e39713..cc651bf7 100644 --- a/tests/test_bulk_tx_multiep.py +++ b/tests/test_bulk_tx_multiep.py @@ -6,7 +6,7 @@ from usb_clock import Clock from helpers import do_usb_test, runall_rx -def do_test(arch, clk, phy, seed): +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): rand = random.Random() rand.seed(seed) @@ -31,25 +31,25 @@ def do_test(arch, clk, phy, seed): #Multi EP: #177 lowest for valid data (DI) AppendInToken(packets, start_ep, address, inter_pkt_gap=ipg) - packets.append(RxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) - packets.append(TxHandshakePacket()) + packets.append(RxDataPacket(rand, data_start_val=data_val, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) + packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) AppendInToken(packets, start_ep+1, address, inter_pkt_gap=ipg) - packets.append(RxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) - packets.append(TxHandshakePacket()) + packets.append(RxDataPacket(rand, data_start_val=data_val, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) + packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) AppendInToken(packets, start_ep+2, address, inter_pkt_gap=ipg) - packets.append(RxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) - packets.append(TxHandshakePacket()) + packets.append(RxDataPacket(rand, data_start_val=data_val, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) + packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) AppendInToken(packets, start_ep+3, address, inter_pkt_gap=ipg) - packets.append(RxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) - packets.append(TxHandshakePacket()) + packets.append(RxDataPacket(rand, data_start_val=data_val, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) + packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) data_val = data_val + pkt_length data_pid = data_pid ^ 8 - do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): random.seed(1) diff --git a/tests/test_bulk_tx_noack.py b/tests/test_bulk_tx_noack.py index 3dcb256a..176d071a 100644 --- a/tests/test_bulk_tx_noack.py +++ b/tests/test_bulk_tx_noack.py @@ -7,7 +7,7 @@ from helpers import do_usb_test, runall_rx -def do_test(arch, tx_clk, tx_phy, seed): +def do_test(arch, tx_clk, tx_phy, data_valid_count, usb_speed, seed): rand = random.Random() rand.seed(seed) @@ -27,12 +27,12 @@ def do_test(arch, tx_clk, tx_phy, seed): if(i == 2): AppendInToken(packets, ep, address, inter_pkt_gap=4000) - packets.append(RxDataPacket(rand, data_start_val=dataval, length=pktlength, pid=pid)) + packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pktlength, pid=pid)) # Missing ACK - simulate CRC fail at host AppendInToken(packets, ep, address, inter_pkt_gap=4000) - packets.append(RxDataPacket(rand, data_start_val=dataval, length=pktlength, pid=pid)) - packets.append(TxHandshakePacket()) + packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pktlength, pid=pid)) + packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) if(pid == usb_packet.PID_DATA1): pid = usb_packet.PID_DATA0; @@ -43,7 +43,7 @@ def do_test(arch, tx_clk, tx_phy, seed): pktlength += 1 # Note, quite big gap to allow checking. - do_usb_test(arch, tx_clk, tx_phy, packets, __file__, seed, + do_usb_test(arch, tx_clk, tx_phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): From d2d3622381808a470a393e172ca485aff7aaacb3 Mon Sep 17 00:00:00 2001 From: Dave Atkinson Date: Fri, 19 Mar 2021 13:52:24 +0000 Subject: [PATCH 186/520] Fix for XS3 function alignment issue. --- lib_xud/src/core/XUD_AlignmentDefines.h | 26 +++++++++++++++++++ lib_xud/src/core/XUD_IoLoop.S | 11 ++++---- lib_xud/src/core/XUD_UIFM_RegAccess.S | 3 ++- lib_xud/src/core/XUD_USBTile_Support.S | 5 ++-- lib_xud/src/core/included/XUD_Token_In.S | 7 ++--- lib_xud/src/core/included/XUD_Token_In_DI.S | 9 ++++--- lib_xud/src/core/included/XUD_Token_Out.S | 8 +++--- lib_xud/src/core/included/XUD_Token_Out_DI.S | 7 ++--- lib_xud/src/core/included/XUD_Token_Ping.S | 4 ++- lib_xud/src/core/included/XUD_Token_SOF.S | 5 ++-- lib_xud/src/core/included/XUD_Token_Setup.S | 3 ++- .../src/core/included/XUD_Token_Setup_DI.S | 3 ++- lib_xud/src/user/client/XUD_EpFuncs.S | 21 ++++++++------- 13 files changed, 76 insertions(+), 36 deletions(-) create mode 100644 lib_xud/src/core/XUD_AlignmentDefines.h diff --git a/lib_xud/src/core/XUD_AlignmentDefines.h b/lib_xud/src/core/XUD_AlignmentDefines.h new file mode 100644 index 00000000..67834e71 --- /dev/null +++ b/lib_xud/src/core/XUD_AlignmentDefines.h @@ -0,0 +1,26 @@ +// Copyright (c) 2021, XMOS Ltd, All rights reserved +/* XUD_AlignmentDefines.h + * @brief Architecture-specific ASM function alignment + */ + +#ifndef _XUD_ALIGNMENT_DEFINES_ +#define _XUD_ALIGNMENT_DEFINES_ +#if defined(__XS3A__) +#define IBUFFER_FETCH_CORRECTION 1 +#elif defined(__XS2A__) +#define IBUFFER_FETCH_CORRECTION 0 +#else +#error No architecture defined +#endif + +#if IBUFFER_FETCH_CORRECTION == 1 +#define FUNC_ALIGN4 16 +#define FUNC_ALIGN8 16 +#elif IBUFFER_FETCH_CORRECTION == 0 +#define FUNC_ALIGN4 4 +#define FUNC_ALIGN8 8 +#else +#error IBUFFER_FETCH_CORRECTION not defined +#endif + +#endif // _XUD_ALIGNMENT_DEFINES_ diff --git a/lib_xud/src/core/XUD_IoLoop.S b/lib_xud/src/core/XUD_IoLoop.S index d66103e5..9f13bd64 100755 --- a/lib_xud/src/core/XUD_IoLoop.S +++ b/lib_xud/src/core/XUD_IoLoop.S @@ -12,6 +12,7 @@ #include "xud.h" #include "XUD_USB_Defines.h" #include "XUD_TimingDefines.h" +#include "XUD_AlignmentDefines.h" .section .cp.const4,"aMc",@progbits,4 .cc_top suspendTimeout.data @@ -69,7 +70,7 @@ suspend_t_wtwrsths: .text .cc_top UsbTestModeHandler_asm.func, UsbTestModeHandler_asm .issue_mode single -.align 4 +.align FUNC_ALIGN4 UsbTestModeHandler_asm: ENTSP_lu6 0 clrsr 0x18 @@ -99,7 +100,7 @@ UsbTestModeHandler_asm: .text .cc_top ResetIntHandler.func, ResetIntHandler .issue_mode dual -.align 4 +.align FUNC_ALIGN4 ResetIntHandler: DUALENTSP_lu6 0 clrsr 0x18 // Clear InInterrupt bit (and InKernel) @@ -159,7 +160,7 @@ waitforRXALow0: setc res[RXD], XS1_SETC_RUN_CLRBUF bu Loop_BadPid -.align 4 +.align FUNC_ALIGN4 XUD_LLD_IoLoop: DUALENTSP_lu6 STACK_EXTEND stw r4, sp[1] @@ -303,7 +304,7 @@ SetupSuspendResetTimer: bu NextToken // Main IO Loop -.align 8 +.align FUNC_ALIGN8 .skip 0 NextToken: ldc r9, 0xa001 // CRC16 poly, used in doRxData @@ -347,7 +348,7 @@ XUD_InvalidTok_waitforRXALow: setc res[RXD], XS1_SETC_RUN_CLRBUF bu Loop_BadPid // Invalid token received Ignore unknown toks -.align 4 +.align FUNC_ALIGN4 Return: clre ldw r11, sp[STACK_SUSPEND_TIMER] // Free suspend/reset timer diff --git a/lib_xud/src/core/XUD_UIFM_RegAccess.S b/lib_xud/src/core/XUD_UIFM_RegAccess.S index 32f6e9d3..e5ff41a1 100644 --- a/lib_xud/src/core/XUD_UIFM_RegAccess.S +++ b/lib_xud/src/core/XUD_UIFM_RegAccess.S @@ -12,12 +12,13 @@ #ifndef XS1_PS_XCORE_CTRL0 #define XS1_PS_XCORE_CTRL0 0x20b #endif +#include "XUD_AlignmentDefines.h" .text .globl XUD_UIFM_Enable, "f{ui}(ui)" .type XUD_UIFM_Enable, @function .cc_top XUD_UIFM_Enable.function -.align 4 +.align FUNC_ALIGN4 // void XUD_UIFM_Enable (unsigned mode); XUD_UIFM_Enable: ldc r1, XS1_PS_XCORE_CTRL0 diff --git a/lib_xud/src/core/XUD_USBTile_Support.S b/lib_xud/src/core/XUD_USBTile_Support.S index 0e738e8c..a69fefdb 100644 --- a/lib_xud/src/core/XUD_USBTile_Support.S +++ b/lib_xud/src/core/XUD_USBTile_Support.S @@ -10,12 +10,13 @@ #ifdef __XS3A__ #include #endif +#include .text .globl XUD_EnableUsbPortMux, "f{ui}()" .type XUD_EnableUsbPortMux, @function .cc_top XUD_EnableUsbPortMux.function -.align 4 +.align FUNC_ALIGN4 // void XUD_EnableUsbPortMux (unsigned mode); XUD_EnableUsbPortMux: .issue_mode single @@ -47,7 +48,7 @@ XUD_EnableUsbPortMux: .globl XUD_DisableUsbPortMux, "f{ui}()" .type XUD_DisableUsbPortMux, @function .cc_top XUD_DisableUsbPortMux.function -.align 4 +.align FUNC_ALIGN4 // void XUD_DisableUsbPortMux (unsigned mode); XUD_DisableUsbPortMux: ldc r1, XS1_PS_XCORE_CTRL0 diff --git a/lib_xud/src/core/included/XUD_Token_In.S b/lib_xud/src/core/included/XUD_Token_In.S index 4a722d36..ec4072c3 100755 --- a/lib_xud/src/core/included/XUD_Token_In.S +++ b/lib_xud/src/core/included/XUD_Token_In.S @@ -1,5 +1,6 @@ // Copyright (c) 2011-2018, XMOS Ltd, All rights reserved #include +#include "XUD_AlignmentDefines.h" // Ports #define RXD r0 @@ -20,7 +21,7 @@ // R2 : TXD // R1 : Valid Token Port // R0 : RXD -.align 4 +.align FUNC_ALIGN4 InNotReady: ldw r11, sp[SP_EPTYPES_OUT] ldw r11, r11[r10] // Load EP Type @@ -219,7 +220,7 @@ WaitForHandshake: // Wait for timeout or handshake // We sent some data but the host didn't handshake in time. Needs a re-send. -.align 4 +.align FUNC_ALIGN4 TxHandshakeTimeOut: in r11, res[r1] // This will clear port time edu res[r1] @@ -227,7 +228,7 @@ TxHandshakeTimeOut: bu BadHandShake // Transmitted data, and got something back within the timeout. Check for valid handshake... -.align 4 +.align FUNC_ALIGN4 TxHandShakeReceived: XUD_IN_RxAck: in r11, res[RXD] // Input data from RXD port diff --git a/lib_xud/src/core/included/XUD_Token_In_DI.S b/lib_xud/src/core/included/XUD_Token_In_DI.S index 0365db65..03fee3e5 100755 --- a/lib_xud/src/core/included/XUD_Token_In_DI.S +++ b/lib_xud/src/core/included/XUD_Token_In_DI.S @@ -1,5 +1,6 @@ // Copyright (c) 2011-2018, XMOS Ltd, All rights reserved #include +#include "XUD_AlignmentDefines.h" // Ports #define RXD r0 @@ -20,7 +21,7 @@ // R2 : TXD // R1 : Valid Token Port // R0 : RXD -.align 4 +.align FUNC_ALIGN4 InNotReady: ldw r11, sp[STACK_EPTYPES_IN] ldw r11, r11[r10] // Load EP Type @@ -35,7 +36,7 @@ XUD_IN_TxNak: // Non-Iso outpw res[TXD], r11, 8 #include "XUD_TokenJmp.S" -.align 8 +.align FUNC_ALIGN8 Pid_In: #include "XUD_CrcAddrCheck.S" ldaw r3, r10[4] // R3 = R10 + 16 @@ -110,14 +111,14 @@ WaitForHandshake: // Wait for timeout or handshake waiteu // We sent some data but the host didn't handshake in time. Needs a re-send. -.align 4 +.align FUNC_ALIGN4 TxHandshakeTimeOut: in r11, res[r1] // This will clear port time edu res[r1] {edu res[RXD]; bu BadHandshake} // Transmitted data, and got something back within the timeout. Check for valid handshake... -.align 4 +.align FUNC_ALIGN4 TxHandShakeReceived: XUD_IN_RxAck: in r11, res[RXD] // Input data from RXD port diff --git a/lib_xud/src/core/included/XUD_Token_Out.S b/lib_xud/src/core/included/XUD_Token_Out.S index dd1dd279..e7a32550 100755 --- a/lib_xud/src/core/included/XUD_Token_Out.S +++ b/lib_xud/src/core/included/XUD_Token_Out.S @@ -2,10 +2,12 @@ // r10: EP number // OUT Token Packet ----------------------------------------------------------------------------- // Ports +#include "XUD_AlignmentDefines.h" + #define RXD r0 #define TXD r2 -.align 8 +.align FUNC_ALIGN8 .skip 0 Pid_Out: #include "XUD_CrcAddrCheck.S" @@ -64,7 +66,7 @@ JumpOnPid_: bau r11 #endif -.align 4 +.align FUNC_ALIGN4 .skip 0 DoOutNonIso: bl doRXData @@ -96,7 +98,7 @@ StoreTailDataOut: bu NextTokenAfterOut // Various Error handling functions ------------------------------------------------------------------- -.align 4 +.align FUNC_ALIGN4 Err_RxErr: // RxError signal high during data packet receive: DUALENTSP_lu 0 clrsr 3 diff --git a/lib_xud/src/core/included/XUD_Token_Out_DI.S b/lib_xud/src/core/included/XUD_Token_Out_DI.S index f222a2be..2167d3e3 100755 --- a/lib_xud/src/core/included/XUD_Token_Out_DI.S +++ b/lib_xud/src/core/included/XUD_Token_Out_DI.S @@ -1,8 +1,9 @@ // Copyright (c) 2011-2018, XMOS Ltd, All rights reserved // r10: EP number // OUT Token Packet ----------------------------------------------------------------------------- +#include "XUD_AlignmentDefines.h" -.align 8 +.align FUNC_ALIGN8 .skip 0 Pid_Out: #include "XUD_CrcAddrCheck.S" @@ -25,7 +26,7 @@ InformEP_Iso: // Iso EP - no handshake {outt res[r11], r8; ldw r6, sp[STACK_RXCRC_INIT]} // CRC16 init (out) - Needs reseting after an out & Send tail length #include "XUD_TokenJmp.S" -.align 4 +.align FUNC_ALIGN4 .skip 0 DoOutNonIso: bl doRXData @@ -53,7 +54,7 @@ StoreTailDataOut: bu NextTokenAfterOut // Various Error handling functions ------------------------------------------------------------------- -.align 4 +.align FUNC_ALIGN4 Err_RxErr: // RxError signal high during data packet receive: DUALENTSP_lu6 0 clrsr 3 diff --git a/lib_xud/src/core/included/XUD_Token_Ping.S b/lib_xud/src/core/included/XUD_Token_Ping.S index 9ab6f4b4..5c9c466a 100755 --- a/lib_xud/src/core/included/XUD_Token_Ping.S +++ b/lib_xud/src/core/included/XUD_Token_Ping.S @@ -1,5 +1,7 @@ // Copyright (c) 2011-2019, XMOS Ltd, All rights reserved -.align 4 +#include "XUD_AlignmentDefines.h" + +.align FUNC_ALIGN4 Pid_Ping: #include "XUD_CrcAddrCheck.S" diff --git a/lib_xud/src/core/included/XUD_Token_SOF.S b/lib_xud/src/core/included/XUD_Token_SOF.S index 66bf41d8..3c14d558 100644 --- a/lib_xud/src/core/included/XUD_Token_SOF.S +++ b/lib_xud/src/core/included/XUD_Token_SOF.S @@ -1,7 +1,8 @@ // Copyright (c) 2011-2020, XMOS Ltd, All rights reserved +#include "XUD_AlignmentDefines.h" // Received SOF token: Reset suspend/reset detection timer -.align 4 +.align FUNC_ALIGN4 Pid_Sof: #ifdef __XS2A__ inpw r10, res[RXD], 8 // Read EP Number @@ -37,7 +38,7 @@ Pid_Sof: bu Loop_BadPid // Received SOF token: Reset suspend/reset detection timer -.align 4 +.align FUNC_ALIGN4 Pid_Sof_NoChan: #ifdef __XS2A__ inpw r10, res[RXD], 8; /* Read EP Number */ diff --git a/lib_xud/src/core/included/XUD_Token_Setup.S b/lib_xud/src/core/included/XUD_Token_Setup.S index 057dd0f0..534bcc3b 100644 --- a/lib_xud/src/core/included/XUD_Token_Setup.S +++ b/lib_xud/src/core/included/XUD_Token_Setup.S @@ -1,4 +1,5 @@ // Copyright (c) 2011-2019, XMOS Ltd, All rights reserved +#include "XUD_AlignmentDefines.h" .text @@ -16,7 +17,7 @@ WaitForEndDataPacket: // - Data PID will always be DATA0 // - Payload will always be 8 bytes -.align 4 +.align FUNC_ALIGN4 Pid_Setup: #ifdef ARCH_L inpw r10, res[RXD], 8; // Read EP Number diff --git a/lib_xud/src/core/included/XUD_Token_Setup_DI.S b/lib_xud/src/core/included/XUD_Token_Setup_DI.S index 1faa238c..ba088517 100644 --- a/lib_xud/src/core/included/XUD_Token_Setup_DI.S +++ b/lib_xud/src/core/included/XUD_Token_Setup_DI.S @@ -1,10 +1,11 @@ // Copyright (c) 2011-2019, XMOS Ltd, All rights reserved +#include "XUD_AlignmentDefines.h" // We received a setup token. This is much the same as out token, apart from: // - Can't NAK a setup // - Data PID will always be DATA0 // - Payload will always be 8 bytes -.align 4 +.align FUNC_ALIGN4 Pid_Setup: #include "XUD_CrcAddrCheck.S" ldw r3, r5[r10] // Load relevant EP pointer diff --git a/lib_xud/src/user/client/XUD_EpFuncs.S b/lib_xud/src/user/client/XUD_EpFuncs.S index 61584ed7..bfb4f546 100644 --- a/lib_xud/src/user/client/XUD_EpFuncs.S +++ b/lib_xud/src/user/client/XUD_EpFuncs.S @@ -4,6 +4,7 @@ * @author Ross Owen, XMOS Limited */ #include "XUD_USB_Defines.h" +#include "XUD_AlignmentDefines.h" #if !defined __XS2A__ .set too_many_cores, main.maxcores > 6 @@ -12,7 +13,7 @@ .section .cp.rodata,"ac", @progbits .cc_top ep_info_address.data,ep_info_address -.align 4 +.align FUNC_ALIGN4 .type ep_info_address,@object .size ep_info_address, 4 ep_info_address: @@ -28,7 +29,7 @@ ep_info_address: .type XUD_GetSetupData, @function .cc_top XUD_GetSetupData.func .issue_mode single -.align 4 +.align FUNC_ALIGN4 XUD_GetSetupData: ENTSP_lu6 4 stw r4, sp[1] @@ -142,7 +143,7 @@ XUD_GetSetupData_Reset: .globl XUD_GetData .type XUD_GetData, @function .cc_top XUD_GetData.func -.align 4 +.align FUNC_ALIGN4 XUD_GetData: #if defined(__XS2A__) || defined(__XS3A__) .issue_mode single @@ -280,7 +281,7 @@ XUD_GetDataSetupData_ResetPid: // We must reset PID toggling on .globl XUD_SetData .type XUD_SetData, @function .cc_top XUD_SetData.func -.align 4 +.align FUNC_ALIGN4 XUD_SetData: #if defined(__XS2A__) || defined(__XS3A__) .issue_mode single @@ -387,7 +388,7 @@ XUD_SetData_Reset: .globl XUD_GetData_Select .type XUD_GetData_Select, @function .cc_top XUD_GetData_Select.func -.align 4 +.align FUNC_ALIGN4 XUD_GetData_Select: #if defined(__XS2A__) || defined(__XS3A__) .issue_mode single @@ -479,7 +480,7 @@ XUD_GetData_Select_Return_Reset: .globl XUD_SetData_Select .type XUD_SetData_Select, @function .cc_top XUD_SetData_Select.func -.align 4 +.align FUNC_ALIGN4 XUD_SetData_Select: #if defined(__XS2A__) || defined(__XS3A__) .issue_mode single @@ -537,7 +538,7 @@ XUD_SetData_Select_Reset: /* R0: ep number */ .cc_top XUD_SetStallByAddr.func -.align 4 +.align FUNC_ALIGN4 XUD_SetStallByAddr: #if defined(__XS2A__) || defined(__XS3A__) .issue_mode single @@ -584,7 +585,7 @@ XUD_SetStallByAddr_OUT: /* R0: ep number */ .cc_top XUD_ClearStallByAddr.func .issue_mode single -.align 4 +.align FUNC_ALIGN4 XUD_ClearStallByAddr: ENTSP_lu6 0 ldc r2, USB_PIDn_NAK @@ -647,7 +648,7 @@ XUD_ClearStallByAddr_ResetDataPid: // Reset DATA PID to DATA0 /* R0: ep number */ .cc_top XUD_ResetEpStateByAddr.func -.align 4 +.align FUNC_ALIGN4 XUD_ResetEpStateByAddr: #if defined(__XS2A__) || defined(__XS3A__) .issue_mode single @@ -702,7 +703,7 @@ NoOffset: .type XUD_SetTestMode, @function .cc_top XUD_SetTestMode.func -.align 4 +.align FUNC_ALIGN4 XUD_SetTestMode: #if defined(__XS2A__) || defined(__XS3A__) .issue_mode single From b8fa34f195a3e9a94fc5cb96883c2678ea341611 Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 19 Mar 2021 15:46:08 +0000 Subject: [PATCH 187/520] Xs2 xn file fix --- tests/shared_src/test_xs2.xn | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/shared_src/test_xs2.xn b/tests/shared_src/test_xs2.xn index b580b486..a416f1db 100644 --- a/tests/shared_src/test_xs2.xn +++ b/tests/shared_src/test_xs2.xn @@ -59,10 +59,12 @@ - + + + From fc1186797d6bc8b0d029ec40b07fc17c6bd2f1c6 Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 19 Mar 2021 15:46:36 +0000 Subject: [PATCH 188/520] Re-enable xs2 in test makefile --- tests/test_makefile.mak | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/tests/test_makefile.mak b/tests/test_makefile.mak index 7cf06132..9d49b4f9 100644 --- a/tests/test_makefile.mak +++ b/tests/test_makefile.mak @@ -20,11 +20,18 @@ APP_NAME = SHARED_CODE = ../../shared_src -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -Wno-timing -DXUD_SIM_XSIM=1 -DXUD_TEST_SPEED_HS=1 -DXUD_BYPASS_RESET=1 - -#XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -DARCH_L - -XCC_FLAGS_xs3 = $(COMMON_FLAGS) -DXUD_STARTUP_ADDRESS=1 +COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) \ + -DUSB_TILE=tile[0] \ + -Wno-timing \ + -DXUD_SIM_XSIM=1 \ + -DXUD_TEST_SPEED_HS=1 \ + -DXUD_BYPASS_RESET=1 \ + -DXUD_STARTUP_ADDRESS=1 + +#TODO RM ARCH_L define +XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -DARCH_L + +XCC_FLAGS_xs3 = $(COMMON_FLAGS) TARGET = test_$(CONFIG).xn From 10547c0ffa2234d84e4afd636eec0bd2f7bde643 Mon Sep 17 00:00:00 2001 From: mbanth Date: Mon, 22 Mar 2021 16:30:37 +0000 Subject: [PATCH 189/520] Add support for Full Speed testing. I suspect that these tests do not run because they include a call to do_rx_test() which I cannot locate and because they have a non-standard file extension. Regardless, I have updated them so that they can support full-speed operation when brought back into use. --- tests/test_control_basic_badcrc32.py_ | 18 +++++++++--------- tests/test_control_basic_short.py_ | 22 ++++++++++++---------- tests/test_control_repeatedsetup.py_ | 22 ++++++++++++---------- 3 files changed, 33 insertions(+), 29 deletions(-) diff --git a/tests/test_control_basic_badcrc32.py_ b/tests/test_control_basic_badcrc32.py_ index 5c170d06..5d386738 100644 --- a/tests/test_control_basic_badcrc32.py_ +++ b/tests/test_control_basic_badcrc32.py_ @@ -10,7 +10,7 @@ from helpers import choose_small_frame_size, check_received_packet, runall_rx # Single, setup transaction to EP 0 -def do_test(arch, tx_clk, tx_phy, seed): +def do_test(arch, tx_clk, tx_phy, data_valid_count, usb_speed, seed): rand = random.Random() rand.seed(seed) @@ -23,33 +23,33 @@ def do_test(arch, tx_clk, tx_phy, seed): AppendSetupToken(packets, ep) # DATA0 data packet with bad CRC - packets.append(TxDataPacket(rand, length=8, pid=3, bad_crc=True)) + packets.append(TxDataPacket(rand, data_valid_count=data_valid_count, length=8, pid=3, bad_crc=True)) # Dont expect an ACK due to bad CRC #packets.append(RxHandshakePacket()) AppendSetupToken(packets, ep, inter_pkt_gap=400) - packets.append(TxDataPacket(rand, length=8, pid=3, bad_crc=False )) - packets.append(RxHandshakePacket(timeout=11)) + packets.append(TxDataPacket(rand, data_valid_count=data_valid_count, length=8, pid=3, bad_crc=False )) + packets.append(RxHandshakePacket(data_valid_count=data_valid_count, timeout=11)) # Note, quite big gap to allow checking. AppendOutToken(packets, ep, inter_pkt_gap=2000) - packets.append(TxDataPacket(rand, length=10, pid=0xb)) + packets.append(TxDataPacket(rand, data_valid_count=data_valid_count, length=10, pid=0xb)) - packets.append(RxHandshakePacket()) + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) #IN AppendInToken(packets, ep, inter_pkt_gap=500) #Expect 0-length - packets.append(RxDataPacket(rand, length=0, pid=0x4b)) + packets.append(RxDataPacket(rand, data_valid_count=data_valid_count, length=0, pid=0x4b)) # Send ACK - packets.append(TxHandshakePacket()) + packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) - do_rx_test(arch, tx_clk, tx_phy, packets, __file__, seed, + do_rx_test(arch, tx_clk, tx_phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): diff --git a/tests/test_control_basic_short.py_ b/tests/test_control_basic_short.py_ index 740e948d..045194a8 100644 --- a/tests/test_control_basic_short.py_ +++ b/tests/test_control_basic_short.py_ @@ -13,7 +13,7 @@ from helpers import choose_small_frame_size, check_received_packet, runall_rx # Single, setup transaction to EP 0 -def do_test(arch, tx_clk, tx_phy, seed): +def do_test(arch, tx_clk, tx_phy, data_valid_count, usb_speed, seed): rand = random.Random() rand.seed(seed) @@ -24,38 +24,40 @@ def do_test(arch, tx_clk, tx_phy, seed): packets = [] AppendSetupToken(packets, ep) - packets.append(TxDataPacket(rand, length=3, pid=3, bad_crc=True)) - #packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_valid_count=data_valid_count, length=3, pid=3, bad_crc=True)) + #packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) AppendSetupToken(packets, ep) - packets.append(TxDataPacket(rand, length=8, pid=3, bad_crc=False)) - packets.append(RxHandshakePacket(timeout=11)) + packets.append(TxDataPacket(rand, data_valid_count=data_valid_count, length=8, pid=3, bad_crc=False)) + packets.append(RxHandshakePacket(data_valid_count=data_valid_count, timeout=11)) # Note, quite big gap to allow checking. packets.append(TokenPacket( + data_valid_count=data_valid_count, inter_pkt_gap=2000, pid=0xe1, #OUT address=dev_address, endpoint=ep)) - packets.append(TxDataPacket(rand, length=10, pid=0xb)) + packets.append(TxDataPacket(rand, data_valid_count=data_valid_count, length=10, pid=0xb)) - packets.append(RxHandshakePacket()) + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) packets.append(TokenPacket( + data_valid_count=data_valid_count, inter_pkt_gap=2000, pid=0x69, #OUT address=dev_address, endpoint=ep)) #Expect 0-length - packets.append(RxDataPacket(rand, length=0, pid=0x4b)) + packets.append(RxDataPacket(rand, data_valid_count=data_valid_count, length=0, pid=0x4b)) # Send ACK - packets.append(TxHandshakePacket()) + packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) - do_rx_test(arch, tx_clk, tx_phy, packets, __file__, seed, + do_rx_test(arch, tx_clk, tx_phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): diff --git a/tests/test_control_repeatedsetup.py_ b/tests/test_control_repeatedsetup.py_ index e6c50ece..e591b4ba 100644 --- a/tests/test_control_repeatedsetup.py_ +++ b/tests/test_control_repeatedsetup.py_ @@ -10,7 +10,7 @@ from helpers import choose_small_frame_size, check_received_packet, runall_rx # Single, setup transaction to EP 0 -def do_test(arch, tx_clk, tx_phy, seed): +def do_test(arch, tx_clk, tx_phy, data_valid_count, usb_speed, seed): rand = random.Random() rand.seed(seed) @@ -20,35 +20,37 @@ def do_test(arch, tx_clk, tx_phy, seed): packets = [] AppendSetupToken(packets, ep) - packets.append(TxDataPacket(rand, length=8, pid=3)) - packets.append(RxHandshakePacket(timeout=11)) + packets.append(TxDataPacket(rand, data_valid_count=data_valid_count, length=8, pid=3)) + packets.append(RxHandshakePacket(data_valid_count=data_valid_count, timeout=11)) # Note, quite big gap to allow checking. # Send Setup transaction again (simulated ACK lost on way to host AppendSetupToken(packets, ep, inter_pkt_gap=2000) - packets.append(TxDataPacket(rand, length=8, pid=3)) - packets.append(RxHandshakePacket(timeout=11)) + packets.append(TxDataPacket(rand, data_valid_count=data_valid_count, length=8, pid=3)) + packets.append(RxHandshakePacket(data_valid_count=data_valid_count, timeout=11)) packets.append(TokenPacket( + data_valid_count=data_valid_count, inter_pkt_gap=2000, pid=0xe1, #OUT endpoint=ep)) - packets.append(TxDataPacket(rand, length=10, pid=0xb)) - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_valid_count=data_valid_count, length=10, pid=0xb)) + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) packets.append(TokenPacket( + data_valid_count=data_valid_count, inter_pkt_gap=2000, pid=0x69, #IN endpoint=ep)) #Expect 0-length - packets.append(RxDataPacket(rand, length=0, pid=0x4b)) + packets.append(RxDataPacket(rand, data_valid_count=data_valid_count, length=0, pid=0x4b)) # Send ACK - packets.append(TxHandshakePacket()) + packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) - do_rx_test(arch, tx_clk, tx_phy, packets, __file__, seed, + do_rx_test(arch, tx_clk, tx_phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): From 909df7b9eee6d39dc48df9a8a8d41e5850ba17e9 Mon Sep 17 00:00:00 2001 From: mbanth Date: Mon, 22 Mar 2021 17:46:55 +0000 Subject: [PATCH 190/520] Add support for Full Speed testing. --- tests/test_control_basic_get.py | 16 ++++++++-------- tests/test_control_basic_set.py | 16 ++++++++-------- tests/test_invalidtoken.py | 29 +++++++++++++++++------------ tests/test_iso_loopback.py | 16 ++++++++-------- tests/test_iso_rx_basic.py | 6 +++--- tests/test_iso_rxtx_fastpacket.py | 8 ++++---- tests/test_iso_tx_basic.py | 14 +++++++------- tests/test_ping_rx_basic.py | 28 ++++++++++++++-------------- 8 files changed, 69 insertions(+), 64 deletions(-) diff --git a/tests/test_control_basic_get.py b/tests/test_control_basic_get.py index f8137d85..6c14447d 100644 --- a/tests/test_control_basic_get.py +++ b/tests/test_control_basic_get.py @@ -9,7 +9,7 @@ # Single, setup transaction to EP 0 -def do_test(arch, clk, phy, seed): +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): rand = random.Random() rand.seed(seed) @@ -22,21 +22,21 @@ def do_test(arch, clk, phy, seed): # SETUP transaction AppendSetupToken(packets, ep, address) - packets.append(TxDataPacket(rand, length=8, pid=3)) - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_valid_count=data_valid_count, length=8, pid=3)) + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) # IN transaction # Note, quite big gap to avoid nak AppendInToken(packets, ep, address, inter_pkt_gap = 10000) - packets.append(RxDataPacket(rand, length=10, pid=0xb)) - packets.append(TxHandshakePacket()) + packets.append(RxDataPacket(rand, data_valid_count=data_valid_count, length=10, pid=0xb)) + packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) # Send 0 length OUT transaction AppendOutToken(packets, ep, address) - packets.append(TxDataPacket(rand, length=0, pid=PID_DATA1)) - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_valid_count=data_valid_count, length=0, pid=PID_DATA1)) + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): diff --git a/tests/test_control_basic_set.py b/tests/test_control_basic_set.py index 1909a03d..f6f97fdf 100644 --- a/tests/test_control_basic_set.py +++ b/tests/test_control_basic_set.py @@ -7,7 +7,7 @@ from usb_clock import Clock from helpers import do_usb_test, runall_rx -def do_test(arch, tx_clk, tx_phy, seed): +def do_test(arch, tx_clk, tx_phy, data_valid_count, usb_speed, seed): rand = random.Random() rand.seed(seed) @@ -17,20 +17,20 @@ def do_test(arch, tx_clk, tx_phy, seed): packets = [] AppendSetupToken(packets, ep, address) - packets.append(TxDataPacket(rand, length=8, pid=3)) - packets.append(RxHandshakePacket(timeout=11)) + packets.append(TxDataPacket(rand, data_valid_count=data_valid_count, length=8, pid=3)) + packets.append(RxHandshakePacket(data_valid_count=data_valid_count, timeout=11)) # Note, quite big gap to avoid NAL AppendOutToken(packets, ep, address, inter_pkt_gap = 10000) - packets.append(TxDataPacket(rand, length=10, pid=0xb, data_start_val=8)) - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_valid_count=data_valid_count, length=10, pid=0xb, data_start_val=8)) + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) #Expect 0-length AppendInToken(packets, ep, address, inter_pkt_gap = 10000) - packets.append(RxDataPacket(rand, length=0, pid=0xb)) - packets.append(TxHandshakePacket()) + packets.append(RxDataPacket(rand, data_valid_count=data_valid_count, length=0, pid=0xb)) + packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) - do_usb_test(arch, tx_clk, tx_phy, packets, __file__, seed, level='smoke', extra_tasks=[]) + do_usb_test(arch, tx_clk, tx_phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): random.seed(1) diff --git a/tests/test_invalidtoken.py b/tests/test_invalidtoken.py index 4b2466dd..c7d83b97 100644 --- a/tests/test_invalidtoken.py +++ b/tests/test_invalidtoken.py @@ -11,7 +11,7 @@ # Single, setup transaction to EP 0 -def do_test(arch, clk, phy, seed): +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): rand = random.Random() rand.seed(seed) @@ -25,6 +25,7 @@ def do_test(arch, clk, phy, seed): # Reserved PID packets.append(TokenPacket( + data_valid_count=data_valid_count, inter_pkt_gap=2000, pid=0x0, address=address, @@ -32,6 +33,7 @@ def do_test(arch, clk, phy, seed): # Valid IN but not for us.. packets.append(TokenPacket( + data_valid_count=data_valid_count, inter_pkt_gap=200, pid=0x69, address=address+1, @@ -40,6 +42,7 @@ def do_test(arch, clk, phy, seed): # Valid OUT but not for us.. packets.append(TokenPacket( + data_valid_count=data_valid_count, inter_pkt_gap=200, pid=0xe1, address=address+1, @@ -47,11 +50,12 @@ def do_test(arch, clk, phy, seed): valid=False)) AppendOutToken(packets, ep, address) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=10, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=10, pid=0x3)) #DATA0 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) # Valid SETUP but not for us.. packets.append(TokenPacket( + data_valid_count=data_valid_count, inter_pkt_gap=200, pid=0x2d, address=address+2, @@ -62,11 +66,12 @@ def do_test(arch, clk, phy, seed): dataval += 10 AppendOutToken(packets, ep, address, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=11, pid=0xb)) #DATA1 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=11, pid=0xb)) #DATA1 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) # Valid PING but not for us.. packets.append(TokenPacket( + data_valid_count=data_valid_count, inter_pkt_gap=200, pid=0xb4, address=address+3, @@ -75,21 +80,21 @@ def do_test(arch, clk, phy, seed): dataval += 11 AppendOutToken(packets, ep, address, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=12, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=12, pid=0x3)) #DATA0 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) dataval += 12 AppendOutToken(packets, ep, address, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=13, pid=0xb)) #DATA1 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=13, pid=0xb)) #DATA1 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) dataval += 13 AppendOutToken(packets, ep, address, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=14, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=14, pid=0x3)) #DATA0 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): random.seed(1) diff --git a/tests/test_iso_loopback.py b/tests/test_iso_loopback.py index 59c1f75c..47fb408a 100644 --- a/tests/test_iso_loopback.py +++ b/tests/test_iso_loopback.py @@ -6,7 +6,7 @@ from usb_clock import Clock from helpers import do_usb_test, runall_rx -def do_test(arch, clk, phy, seed): +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): rand = random.Random() rand.seed(seed) @@ -27,14 +27,14 @@ def do_test(arch, clk, phy, seed): for pkt_length in range(200, 204): AppendOutToken(packets, ep_loopback, address) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=pkt_length, pid=data_pid)) #DATA0 + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) #DATA0 #XXwas min IPG supported on iso loopback to not nak #This was 420, had to increase when moved to lib_xud (14.1.2 tools) # increased again from 437 when SETUP/OUT checking added # increaed from 477 when adding xs3 AppendInToken(packets, ep_loopback, address, inter_pkt_gap=498) - packets.append(RxDataPacket(rand, data_start_val=dataval, length=pkt_length, pid=data_pid)) #DATA0 + packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) #DATA0 #No toggle for Iso @@ -42,15 +42,15 @@ def do_test(arch, clk, phy, seed): #Loopback and die.. AppendOutToken(packets, ep_loopback_kill, address) - packets.append(TxDataPacket(rand, length=pkt_length, pid=3)) #DATA0 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_valid_count=data_valid_count, length=pkt_length, pid=3)) #DATA0 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) AppendInToken(packets, ep_loopback_kill, address, inter_pkt_gap=ipg) - packets.append(RxDataPacket(rand, length=pkt_length, pid=3)) #DATA0 - packets.append(TxHandshakePacket()) + packets.append(RxDataPacket(rand, data_valid_count=data_valid_count, length=pkt_length, pid=3)) #DATA0 + packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) - do_usb_test(arch, clk, phy, packets, __file__, seed, + do_usb_test(arch, clk, phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): diff --git a/tests/test_iso_rx_basic.py b/tests/test_iso_rx_basic.py index 67419966..44895c82 100644 --- a/tests/test_iso_rx_basic.py +++ b/tests/test_iso_rx_basic.py @@ -7,7 +7,7 @@ from usb_clock import Clock from helpers import do_usb_test, runall_rx -def do_test(arch, clk, phy, seed): +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): rand = random.Random() rand.seed(seed) @@ -24,10 +24,10 @@ def do_test(arch, clk, phy, seed): for pktlength in range(10, 15): AppendOutToken(packets, ep, address, inter_pkt_gap=500) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=pktlength, pid=pid)) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pktlength, pid=pid)) dataval += pktlength - do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): random.seed(1) diff --git a/tests/test_iso_rxtx_fastpacket.py b/tests/test_iso_rxtx_fastpacket.py index 1c2adc29..7d997a20 100644 --- a/tests/test_iso_rxtx_fastpacket.py +++ b/tests/test_iso_rxtx_fastpacket.py @@ -6,7 +6,7 @@ from usb_clock import Clock from helpers import do_usb_test, runall_rx -def do_test(arch, clk, phy, seed): +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): rand = random.Random() rand.seed(seed) @@ -23,15 +23,15 @@ def do_test(arch, clk, phy, seed): # < 17 fails AppendOutToken(packets, ep, address, inter_pkt_gap=20) - packets.append(TxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) #DATA0 + packets.append(TxDataPacket(rand, data_start_val=data_val, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) #DATA0 AppendInToken(packets, ep, address, inter_pkt_gap=58) - packets.append(RxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) + packets.append(RxDataPacket(rand, data_start_val=data_val, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) data_val = data_val + pkt_length #data_pid = data_pid ^ 8 - do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): random.seed(1) diff --git a/tests/test_iso_tx_basic.py b/tests/test_iso_tx_basic.py index c8afc6a5..4cbd0b4e 100644 --- a/tests/test_iso_tx_basic.py +++ b/tests/test_iso_tx_basic.py @@ -9,7 +9,7 @@ # Single, setup transaction to EP 0 -def do_test(arch, tx_clk, tx_phy, seed): +def do_test(arch, tx_clk, tx_phy, data_valid_count, usb_speed, seed): rand = random.Random() rand.seed(seed) @@ -22,25 +22,25 @@ def do_test(arch, tx_clk, tx_phy, seed): dataval = 0; AppendInToken(packets, ep, address) - packets.append(RxDataPacket(rand, data_start_val=dataval, length=10, pid=0x3)) #DATA0 + packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=10, pid=0x3)) #DATA0 dataval += 10 AppendInToken(packets, ep, address, inter_pkt_gap=2000) - packets.append(RxDataPacket(rand, data_start_val=dataval, length=11, pid=0x3)) #DATA0 + packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=11, pid=0x3)) #DATA0 dataval += 11 AppendInToken(packets, ep, address, inter_pkt_gap=2000) - packets.append(RxDataPacket(rand, data_start_val=dataval, length=12, pid=0x3)) #DATA0 + packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=12, pid=0x3)) #DATA0 dataval += 12 AppendInToken(packets, ep, address, inter_pkt_gap=2000) - packets.append(RxDataPacket(rand, data_start_val=dataval, length=13, pid=0x3)) #DATA0 + packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=13, pid=0x3)) #DATA0 dataval += 13 AppendInToken(packets, ep, address, inter_pkt_gap=2000) - packets.append(RxDataPacket(rand, data_start_val=dataval, length=14, pid=0x3)) #DATA0 + packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=14, pid=0x3)) #DATA0 - do_usb_test(arch, tx_clk, tx_phy, packets, __file__, seed, level='smoke', extra_tasks=[]) + do_usb_test(arch, tx_clk, tx_phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): random.seed(1) diff --git a/tests/test_ping_rx_basic.py b/tests/test_ping_rx_basic.py index cbc0f463..37cc745c 100644 --- a/tests/test_ping_rx_basic.py +++ b/tests/test_ping_rx_basic.py @@ -8,7 +8,7 @@ from usb_clock import Clock from helpers import do_usb_test, runall_rx -def do_test(arch, clk, phy, seed): +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): rand = random.Random() rand.seed(seed) @@ -22,44 +22,44 @@ def do_test(arch, clk, phy, seed): # Ping EP 2, expect NAK AppendPingToken(packets, 2, address) - packets.append(RxHandshakePacket(pid=0x5a)) + packets.append(RxHandshakePacket(data_valid_count=data_valid_count, pid=0x5a)) # And again AppendPingToken(packets, 2, address) - packets.append(RxHandshakePacket(pid=0x5a)) + packets.append(RxHandshakePacket(data_valid_count=data_valid_count, pid=0x5a)) # Send packet to EP 1, xCORE should mark EP 2 as ready AppendOutToken(packets, ep, address) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=10, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=10, pid=0x3)) #DATA0 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) # Ping EP 2 again - expect ACK AppendPingToken(packets, 2, address, inter_pkt_gap=6000) - packets.append(RxHandshakePacket()) + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) # And again.. AppendPingToken(packets, 2, address) - packets.append(RxHandshakePacket()) + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) # Send out to EP 2.. expect ack AppendOutToken(packets, 2,address, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=10, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=10, pid=0x3)) #DATA0 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) # Re-Ping EP 2, expect NAK AppendPingToken(packets, 2, address) - packets.append(RxHandshakePacket(pid=0x5a)) + packets.append(RxHandshakePacket(data_valid_count=data_valid_count, pid=0x5a)) # And again AppendPingToken(packets, 2, address) - packets.append(RxHandshakePacket(pid=0x5a)) + packets.append(RxHandshakePacket(data_valid_count=data_valid_count, pid=0x5a)) # Send a packet to EP 1 so the DUT knows it can exit. AppendOutToken(packets, ep, address) - packets.append(TxDataPacket(rand, data_start_val=dataval+10, length=10, pid=0x3^8)) #DATA1 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval+10, data_valid_count=data_valid_count, length=10, pid=0x3^8)) #DATA1 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - do_usb_test(arch, clk, phy, packets, __file__, seed,level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, usb_speed, packets, __file__, seed,level='smoke', extra_tasks=[]) def runtest(): random.seed(1) From 993e5f4ed451e9279cc1650999396c0a2b9c17c2 Mon Sep 17 00:00:00 2001 From: mbanth Date: Mon, 22 Mar 2021 17:54:55 +0000 Subject: [PATCH 191/520] Add support for Full Speed testing. The short token test fails with the same signature under both FS and HS conditions as it currently does at the HEAD of the DEV/XS3 branch. --- tests/test_shorttoken.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/test_shorttoken.py b/tests/test_shorttoken.py index bbe11547..f6106e11 100644 --- a/tests/test_shorttoken.py +++ b/tests/test_shorttoken.py @@ -11,7 +11,7 @@ # Single, setup transaction to EP 0 -def do_test(arch, clk, phy, seed): +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): rand = random.Random() rand.seed(seed) @@ -24,23 +24,23 @@ def do_test(arch, clk, phy, seed): # Start with a valid transaction */ AppendOutToken(packets, ep, address) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=10, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=10, pid=0x3)) #DATA0 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) # tmp hack for xs2 - for xs2 the shim will throw away the short token and it will never be seen by the xCORE if arch == 'xs3': # Create a short token, only PID and 2nd byte - shorttoken = TxPacket(pid=0xe1, data_bytes = [0x81], inter_pkt_gap=100) + shorttoken = TxPacket(pid=0xe1, data_bytes = [0x81], data_valid_count=data_valid_count, inter_pkt_gap=100) packets.append(shorttoken) #Finish with valid transaction dataval += 10 AppendOutToken(packets, ep, address, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=11, pid=0xb)) #DATA1 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=11, pid=0xb)) #DATA1 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): random.seed(1) From 75e2b3a56e8adf2f1465eb1b32b91a9111260db4 Mon Sep 17 00:00:00 2001 From: mbanth Date: Tue, 23 Mar 2021 09:29:46 +0000 Subject: [PATCH 192/520] Add support for Full Speed testing. The SOF Bad CRC test fails with the same signature under both FS and HS conditions as it currently does at the HEAD of the DEV/XS3 branch. --- tests/test_sof_badcrc.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/test_sof_badcrc.py b/tests/test_sof_badcrc.py index 81c47deb..8c2d2596 100644 --- a/tests/test_sof_badcrc.py +++ b/tests/test_sof_badcrc.py @@ -11,7 +11,7 @@ # Single, setup transaction to EP 0 -def do_test(arch, clk, phy, seed): +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): rand = random.Random() rand.seed(seed) @@ -24,8 +24,8 @@ def do_test(arch, clk, phy, seed): # Start with a valid transaction */ AppendOutToken(packets, ep, address) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=10, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=10, pid=0x3)) #DATA0 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) AppendSofToken(packets, framenumber) AppendSofToken(packets, framenumber+1) @@ -36,10 +36,10 @@ def do_test(arch, clk, phy, seed): #Finish with valid transaction dataval += 10 AppendOutToken(packets, ep, address, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=11, pid=0xb)) #DATA1 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=11, pid=0xb)) #DATA1 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): random.seed(1) From b76562d86422dbf663468dfebc51e6975383ec8b Mon Sep 17 00:00:00 2001 From: mbanth Date: Tue, 23 Mar 2021 09:32:22 +0000 Subject: [PATCH 193/520] Add support for Full Speed testing. --- tests/test_sof_basic.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/test_sof_basic.py b/tests/test_sof_basic.py index cb098928..a8e84d91 100644 --- a/tests/test_sof_basic.py +++ b/tests/test_sof_basic.py @@ -11,7 +11,7 @@ # Single, setup transaction to EP 0 -def do_test(arch, clk, phy, seed): +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): rand = random.Random() rand.seed(seed) @@ -24,8 +24,8 @@ def do_test(arch, clk, phy, seed): # Start with a valid transaction */ AppendOutToken(packets, ep, address) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=10, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=10, pid=0x3)) #DATA0 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) AppendSofToken(packets, framenumber) AppendSofToken(packets, framenumber+1) @@ -36,10 +36,10 @@ def do_test(arch, clk, phy, seed): #Finish with valid transaction dataval += 10 AppendOutToken(packets, ep, address, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, length=11, pid=0xb)) #DATA1 - packets.append(RxHandshakePacket()) + packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=11, pid=0xb)) #DATA1 + packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - do_usb_test(arch, clk, phy, packets, __file__, seed, level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) def runtest(): random.seed(1) From 2dd5b86ac5308938e308678ae9bf282d6ab12cd7 Mon Sep 17 00:00:00 2001 From: mbanth Date: Tue, 23 Mar 2021 11:59:04 +0000 Subject: [PATCH 194/520] Allow the Data Valid Count to propagate downward when creating a Token packet. --- tests/usb_packet.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tests/usb_packet.py b/tests/usb_packet.py index 468f98da..df96d677 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -73,21 +73,21 @@ def AppendSetupToken(packets, ep, address, **kwargs): ipg = kwargs.pop('inter_pkt_gap', 500) - AppendTokenPacket(packets, 0x2d, ep, ipg, address) + AppendTokenPacket(packets, 0x2d, ep, ipg, address, **kwargs) def AppendOutToken(packets, ep, address, **kwargs): ipg = kwargs.pop('inter_pkt_gap', 500) - AppendTokenPacket(packets, 0xe1, ep, ipg, address) + AppendTokenPacket(packets, 0xe1, ep, ipg, address, **kwargs) def AppendPingToken(packets, ep, address, **kwargs): ipg = kwargs.pop('inter_pkt_gap', 500) - AppendTokenPacket(packets, 0xb4, ep, ipg, address) + AppendTokenPacket(packets, 0xb4, ep, ipg, address, **kwargs) def AppendInToken(packets, ep, address, **kwargs): #357 was min IPG supported on bulk loopback to not nak #lower values mean the loopback NAKs ipg = kwargs.pop('inter_pkt_gap', 10) - AppendTokenPacket(packets, 0x69, ep, ipg, address) + AppendTokenPacket(packets, 0x69, ep, ipg, address, **kwargs) def AppendSofToken(packets, framenumber, **kwargs): ipg = kwargs.pop('inter_pkt_gap', 500) @@ -95,15 +95,17 @@ def AppendSofToken(packets, framenumber, **kwargs): # Override EP and Address ep = (framenumber >> 7) & 0xf address = (framenumber) & 0x7f - AppendTokenPacket(packets, 0xa5, ep, ipg, address) + AppendTokenPacket(packets, 0xa5, ep, ipg, address, **kwargs) -def AppendTokenPacket(packets, _pid, ep, ipg, addr=0): +def AppendTokenPacket(packets, _pid, ep, ipg, addr=0, **kwargs): + data_valid_count = kwargs.pop('data_valid_count', 0) packets.append(TokenPacket( inter_pkt_gap=ipg, pid=_pid, address=addr, - endpoint=ep)) + endpoint=ep, + data_valid_count=data_valid_count)) def reflect(val, numBits): From 6e1ebaa1b2a1a9283f10c3e82fa795c853ccb45c Mon Sep 17 00:00:00 2001 From: mbanth Date: Tue, 23 Mar 2021 12:13:32 +0000 Subject: [PATCH 195/520] Add Full Speed support to Token packets. --- tests/test_control_basic_get.py | 6 +++--- tests/test_control_basic_set.py | 6 +++--- tests/test_iso_rx_basic.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/test_control_basic_get.py b/tests/test_control_basic_get.py index 6c14447d..b18a47f9 100644 --- a/tests/test_control_basic_get.py +++ b/tests/test_control_basic_get.py @@ -21,18 +21,18 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): packets = [] # SETUP transaction - AppendSetupToken(packets, ep, address) + AppendSetupToken(packets, ep, address, data_valid_count=data_valid_count) packets.append(TxDataPacket(rand, data_valid_count=data_valid_count, length=8, pid=3)) packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) # IN transaction # Note, quite big gap to avoid nak - AppendInToken(packets, ep, address, inter_pkt_gap = 10000) + AppendInToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap = 10000) packets.append(RxDataPacket(rand, data_valid_count=data_valid_count, length=10, pid=0xb)) packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) # Send 0 length OUT transaction - AppendOutToken(packets, ep, address) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count) packets.append(TxDataPacket(rand, data_valid_count=data_valid_count, length=0, pid=PID_DATA1)) packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) diff --git a/tests/test_control_basic_set.py b/tests/test_control_basic_set.py index f6f97fdf..f4f664c4 100644 --- a/tests/test_control_basic_set.py +++ b/tests/test_control_basic_set.py @@ -16,17 +16,17 @@ def do_test(arch, tx_clk, tx_phy, data_valid_count, usb_speed, seed): packets = [] - AppendSetupToken(packets, ep, address) + AppendSetupToken(packets, ep, address, data_valid_count=data_valid_count) packets.append(TxDataPacket(rand, data_valid_count=data_valid_count, length=8, pid=3)) packets.append(RxHandshakePacket(data_valid_count=data_valid_count, timeout=11)) # Note, quite big gap to avoid NAL - AppendOutToken(packets, ep, address, inter_pkt_gap = 10000) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap = 10000) packets.append(TxDataPacket(rand, data_valid_count=data_valid_count, length=10, pid=0xb, data_start_val=8)) packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) #Expect 0-length - AppendInToken(packets, ep, address, inter_pkt_gap = 10000) + AppendInToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap = 10000) packets.append(RxDataPacket(rand, data_valid_count=data_valid_count, length=0, pid=0xb)) packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) diff --git a/tests/test_iso_rx_basic.py b/tests/test_iso_rx_basic.py index 44895c82..0e572183 100644 --- a/tests/test_iso_rx_basic.py +++ b/tests/test_iso_rx_basic.py @@ -23,7 +23,7 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): pid = PID_DATA0; for pktlength in range(10, 15): - AppendOutToken(packets, ep, address, inter_pkt_gap=500) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=500) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pktlength, pid=pid)) dataval += pktlength From b5d9cd849d0cc3cb3205eb9b515539787e54af15 Mon Sep 17 00:00:00 2001 From: mbanth Date: Tue, 23 Mar 2021 13:31:42 +0000 Subject: [PATCH 196/520] Add Full Speed support to Token packets. --- tests/test_bulk_loopback.py | 8 ++++---- tests/test_bulk_rx_basic.py | 2 +- tests/test_bulk_rx_basic_badcrc32.py | 10 +++++----- tests/test_bulk_rx_basic_badpid.py | 12 ++++++------ tests/test_bulk_rx_basic_nodata.py | 12 ++++++------ tests/test_bulk_rx_basic_rxerror.py | 14 +++++++------- tests/test_bulk_rx_multiep.py | 8 ++++---- tests/test_bulk_rx_traffic.py | 6 +++--- tests/test_bulk_tx_badack.py | 4 ++-- tests/test_bulk_tx_basic.py | 2 +- tests/test_bulk_tx_basic_short.py | 2 +- tests/test_bulk_tx_multiep.py | 8 ++++---- tests/test_bulk_tx_noack.py | 4 ++-- tests/test_invalidtoken.py | 10 +++++----- tests/test_iso_loopback.py | 8 ++++---- tests/test_iso_rxtx_fastpacket.py | 4 ++-- tests/test_iso_tx_basic.py | 10 +++++----- tests/test_ping_rx_basic.py | 18 +++++++++--------- tests/test_shorttoken.py | 4 ++-- tests/test_sof_badcrc.py | 14 +++++++------- tests/test_sof_basic.py | 14 +++++++------- 21 files changed, 87 insertions(+), 87 deletions(-) diff --git a/tests/test_bulk_loopback.py b/tests/test_bulk_loopback.py index 128b9d17..1a0a3468 100644 --- a/tests/test_bulk_loopback.py +++ b/tests/test_bulk_loopback.py @@ -25,14 +25,14 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): # TODO randomise packet lengths and data for pkt_length in range(0, 20): - AppendOutToken(packets, ep_loopback, address) + AppendOutToken(packets, ep_loopback, address, data_valid_count=data_valid_count) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) # 357 was min IPG supported on bulk loopback to not nak # For move from sc_xud to lib_xud (14.1.2 tools) had to increase this to 377 # Increased again due to setup/out checking - AppendInToken(packets, ep_loopback, address, inter_pkt_gap=417) + AppendInToken(packets, ep_loopback, address, data_valid_count=data_valid_count, inter_pkt_gap=417) packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) @@ -41,11 +41,11 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): pkt_length = 10 #Loopback and die.. - AppendOutToken(packets, ep_loopback_kill, address) + AppendOutToken(packets, ep_loopback_kill, address, data_valid_count=data_valid_count) packets.append(TxDataPacket(rand, data_valid_count=data_valid_count, length=pkt_length, pid=3)) #DATA0 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - AppendInToken(packets, ep_loopback_kill, address, inter_pkt_gap=400) + AppendInToken(packets, ep_loopback_kill, address, data_valid_count=data_valid_count, inter_pkt_gap=400) packets.append(RxDataPacket(rand, data_valid_count=data_valid_count, length=pkt_length, pid=3)) #DATA0 packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) diff --git a/tests/test_bulk_rx_basic.py b/tests/test_bulk_rx_basic.py index af88634c..f131f799 100644 --- a/tests/test_bulk_rx_basic.py +++ b/tests/test_bulk_rx_basic.py @@ -23,7 +23,7 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): for pktlength in range(10, 20): - AppendOutToken(packets, ep, address, inter_pkt_gap=500) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=500) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pktlength, pid=pid)) packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) diff --git a/tests/test_bulk_rx_basic_badcrc32.py b/tests/test_bulk_rx_basic_badcrc32.py index 6980affc..9a56f882 100644 --- a/tests/test_bulk_rx_basic_badcrc32.py +++ b/tests/test_bulk_rx_basic_badcrc32.py @@ -23,7 +23,7 @@ def do_test(arch, tx_clk, tx_phy, data_valid_count, usb_speed, seed): dataval = 0; # Good OUT transaction - AppendOutToken(packets, ep, dev_address) + AppendOutToken(packets, ep, dev_address, data_valid_count=data_valid_count) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=10, pid=usb_packet.PID_DATA0)) packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) @@ -31,25 +31,25 @@ def do_test(arch, tx_clk, tx_phy, data_valid_count, usb_speed, seed): # Another good OUT transaction dataval += 10 - AppendOutToken(packets, ep, dev_address, inter_pkt_gap=6000) + AppendOutToken(packets, ep, dev_address, data_valid_count=data_valid_count, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=11, pid=usb_packet.PID_DATA1)) packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) dataval += 11 - AppendOutToken(packets, ep, dev_address, inter_pkt_gap=6000) + AppendOutToken(packets, ep, dev_address, data_valid_count=data_valid_count, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=12, bad_crc=True, pid=usb_packet.PID_DATA0)) # Bad CRC - dont expect ACK #packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) #Due to bad CRC, XUD will not ACK and expect a resend of the same packet - so dont change PID dataval += 12 - AppendOutToken(packets, ep, dev_address, inter_pkt_gap=6000) + AppendOutToken(packets, ep, dev_address, data_valid_count=data_valid_count, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=13, pid=0x3)) #DATA0 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) # PID toggle as normal dataval += 13 - AppendOutToken(packets, ep, dev_address, inter_pkt_gap=6000) + AppendOutToken(packets, ep, dev_address, data_valid_count=data_valid_count, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=14, pid=0xb)) #DATA1 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) diff --git a/tests/test_bulk_rx_basic_badpid.py b/tests/test_bulk_rx_basic_badpid.py index c4dea074..5b73fbb1 100644 --- a/tests/test_bulk_rx_basic_badpid.py +++ b/tests/test_bulk_rx_basic_badpid.py @@ -25,32 +25,32 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): ipg = 500 - AppendOutToken(packets, ep, address) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=10, pid=0x3)) #DATA0 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) dataval += 10 - AppendOutToken(packets, ep, address, inter_pkt_gap=ipg) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=ipg) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=11, pid=0xb)) #DATA1 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) #Pretend the ACK went missing. Re-send same packet. xCORE should ACK but throw pkt away - AppendOutToken(packets, ep, address, inter_pkt_gap=ipg) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=ipg) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=11, pid=0xb)) #DATA1 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) dataval += 11 - AppendOutToken(packets, ep, address, inter_pkt_gap=ipg) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=ipg) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=12, pid=0x3)) #DATA0 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) dataval += 12 - AppendOutToken(packets, ep, address, inter_pkt_gap=ipg) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=ipg) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=13, pid=0xb)) #DATA1 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) dataval += 13 - AppendOutToken(packets, ep, address, inter_pkt_gap=ipg) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=ipg) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=14, pid=0x3)) #DATA0 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) diff --git a/tests/test_bulk_rx_basic_nodata.py b/tests/test_bulk_rx_basic_nodata.py index f3aa1a45..b2c5a2e3 100644 --- a/tests/test_bulk_rx_basic_nodata.py +++ b/tests/test_bulk_rx_basic_nodata.py @@ -25,31 +25,31 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): ipg = 500 - AppendOutToken(packets, ep, address) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=10, pid=0x3)) #DATA0 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) dataval += 10 - AppendOutToken(packets, ep, address, inter_pkt_gap=ipg) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=ipg) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=11, pid=0xb)) #DATA1 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - AppendOutToken(packets, ep, address, inter_pkt_gap=ipg) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=ipg) # MISSING DATA PAYLOAD dataval += 11 - AppendOutToken(packets, ep, address, inter_pkt_gap=ipg) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=ipg) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=12, pid=0x3)) #DATA0 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) dataval += 12 - AppendOutToken(packets, ep, address, inter_pkt_gap=ipg) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=ipg) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=13, pid=0xb)) #DATA1 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) dataval += 13 - AppendOutToken(packets, ep, address, inter_pkt_gap=ipg) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=ipg) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=14, pid=0x3)) #DATA0 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) diff --git a/tests/test_bulk_rx_basic_rxerror.py b/tests/test_bulk_rx_basic_rxerror.py index 20bc444a..e5ac2ac4 100644 --- a/tests/test_bulk_rx_basic_rxerror.py +++ b/tests/test_bulk_rx_basic_rxerror.py @@ -20,40 +20,40 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): dataval = 0; - AppendOutToken(packets, ep, address) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=10, pid=0x3)) #DATA0 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) # Assert RxError during packet dataval += 10 - AppendOutToken(packets, ep, address, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=11, pid=0xb, rxe_assert_time=5)) #DATA1 # xCORE should ignore the packet and not handshake... #packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) # Re-send.. - AppendOutToken(packets, ep, address, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=11, pid=0xb, rxe_assert_time=0)) #DATA1 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) dataval += 11 - AppendOutToken(packets, ep, address, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=12, pid=0x3)) #DATA0 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) dataval += 12 - AppendOutToken(packets, ep, address, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=13, pid=0xb, rxe_assert_time=1)) #DATA1 #packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) #resend - AppendOutToken(packets, ep, address, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=13, pid=0xb)) #DATA1 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) dataval += 13 - AppendOutToken(packets, ep, address, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=14, pid=0x3)) #DATA0 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) diff --git a/tests/test_bulk_rx_multiep.py b/tests/test_bulk_rx_multiep.py index 90d99506..259bc741 100644 --- a/tests/test_bulk_rx_multiep.py +++ b/tests/test_bulk_rx_multiep.py @@ -21,19 +21,19 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): for pkt_length in range(10, 20): #min 237 - AppendOutToken(packets, 3, address, inter_pkt_gap=1) + AppendOutToken(packets, 3, address, data_valid_count=data_valid_count, inter_pkt_gap=1) packets.append(TxDataPacket(rand, data_start_val=data_val, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) #DATA0 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - AppendOutToken(packets, 4, address, inter_pkt_gap=1) + AppendOutToken(packets, 4, address, data_valid_count=data_valid_count, inter_pkt_gap=1) packets.append(TxDataPacket(rand, data_start_val=data_val, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) #DATA0 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - AppendOutToken(packets, 5, address, inter_pkt_gap=0) + AppendOutToken(packets, 5, address, data_valid_count=data_valid_count, inter_pkt_gap=0) packets.append(TxDataPacket(rand, data_start_val=data_val, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) #DATA0 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - AppendOutToken(packets, 6, address, inter_pkt_gap=0) + AppendOutToken(packets, 6, address, data_valid_count=data_valid_count, inter_pkt_gap=0) packets.append(TxDataPacket(rand, data_start_val=data_val, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) #DATA0 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) diff --git a/tests/test_bulk_rx_traffic.py b/tests/test_bulk_rx_traffic.py index 0f07a0b1..96ce7fe9 100644 --- a/tests/test_bulk_rx_traffic.py +++ b/tests/test_bulk_rx_traffic.py @@ -29,14 +29,14 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): for pktlength in range(10, 20): - AppendOutToken(packets, trafficEp1, trafficAddress1, inter_pkt_gap=500) + AppendOutToken(packets, trafficEp1, trafficAddress1, data_valid_count=data_valid_count, inter_pkt_gap=500) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pktlength, pid=pid)) - AppendOutToken(packets, ep, address, inter_pkt_gap=500) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=500) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pktlength, pid=pid)) packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - AppendOutToken(packets, trafficEp2, trafficAddress2, inter_pkt_gap=500) + AppendOutToken(packets, trafficEp2, trafficAddress2, data_valid_count=data_valid_count, inter_pkt_gap=500) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pktlength, pid=pid)) if(pid == usb_packet.PID_DATA1): diff --git a/tests/test_bulk_tx_badack.py b/tests/test_bulk_tx_badack.py index dc0d9f81..9414970f 100644 --- a/tests/test_bulk_tx_badack.py +++ b/tests/test_bulk_tx_badack.py @@ -26,11 +26,11 @@ def do_test(arch, tx_clk, tx_phy, data_valid_count, usb_speed, seed): for i in range(0, 4): if(i == 2): - AppendInToken(packets, ep, address, inter_pkt_gap=4000) + AppendInToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=4000) packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pktlength, pid=pid)) #DATA1 packets.append(TxHandshakePacket(data_valid_count=data_valid_count, pid=0xff)) - AppendInToken(packets, ep, address, inter_pkt_gap=4000) + AppendInToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=4000) packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pktlength, pid=pid)) #DATA1 packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) diff --git a/tests/test_bulk_tx_basic.py b/tests/test_bulk_tx_basic.py index 87c84422..327350e5 100644 --- a/tests/test_bulk_tx_basic.py +++ b/tests/test_bulk_tx_basic.py @@ -23,7 +23,7 @@ def do_test(arch, tx_clk, tx_phy, data_valid_count, usb_speed, seed): for pktlength in range(10, 20): - AppendInToken(packets, ep, address, inter_pkt_gap=4000) + AppendInToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=4000) packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pktlength, pid=pid)) #DATA1 packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) diff --git a/tests/test_bulk_tx_basic_short.py b/tests/test_bulk_tx_basic_short.py index 595a6c6f..e09a22b8 100644 --- a/tests/test_bulk_tx_basic_short.py +++ b/tests/test_bulk_tx_basic_short.py @@ -23,7 +23,7 @@ def do_test(arch, tx_clk, tx_phy, data_valid_count, usb_speed, seed): for pktlength in range(0, 8): - AppendInToken(packets, ep, address, inter_pkt_gap=4000) + AppendInToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=4000) packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pktlength, pid=pid)) #DATA1 packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) diff --git a/tests/test_bulk_tx_multiep.py b/tests/test_bulk_tx_multiep.py index cc651bf7..2d85578b 100644 --- a/tests/test_bulk_tx_multiep.py +++ b/tests/test_bulk_tx_multiep.py @@ -30,19 +30,19 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): #Multi EP: #177 lowest for valid data (DI) - AppendInToken(packets, start_ep, address, inter_pkt_gap=ipg) + AppendInToken(packets, start_ep, address, data_valid_count=data_valid_count, inter_pkt_gap=ipg) packets.append(RxDataPacket(rand, data_start_val=data_val, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) - AppendInToken(packets, start_ep+1, address, inter_pkt_gap=ipg) + AppendInToken(packets, start_ep+1, address, data_valid_count=data_valid_count, inter_pkt_gap=ipg) packets.append(RxDataPacket(rand, data_start_val=data_val, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) - AppendInToken(packets, start_ep+2, address, inter_pkt_gap=ipg) + AppendInToken(packets, start_ep+2, address, data_valid_count=data_valid_count, inter_pkt_gap=ipg) packets.append(RxDataPacket(rand, data_start_val=data_val, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) - AppendInToken(packets, start_ep+3, address, inter_pkt_gap=ipg) + AppendInToken(packets, start_ep+3, address, data_valid_count=data_valid_count, inter_pkt_gap=ipg) packets.append(RxDataPacket(rand, data_start_val=data_val, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) diff --git a/tests/test_bulk_tx_noack.py b/tests/test_bulk_tx_noack.py index 176d071a..1fc87da8 100644 --- a/tests/test_bulk_tx_noack.py +++ b/tests/test_bulk_tx_noack.py @@ -26,11 +26,11 @@ def do_test(arch, tx_clk, tx_phy, data_valid_count, usb_speed, seed): for i in range(0, 4): if(i == 2): - AppendInToken(packets, ep, address, inter_pkt_gap=4000) + AppendInToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=4000) packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pktlength, pid=pid)) # Missing ACK - simulate CRC fail at host - AppendInToken(packets, ep, address, inter_pkt_gap=4000) + AppendInToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=4000) packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pktlength, pid=pid)) packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) diff --git a/tests/test_invalidtoken.py b/tests/test_invalidtoken.py index c7d83b97..a9445905 100644 --- a/tests/test_invalidtoken.py +++ b/tests/test_invalidtoken.py @@ -49,7 +49,7 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): endpoint=ep, valid=False)) - AppendOutToken(packets, ep, address) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=10, pid=0x3)) #DATA0 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) @@ -65,7 +65,7 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): # Note, quite big gap to allow checking. dataval += 10 - AppendOutToken(packets, ep, address, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=11, pid=0xb)) #DATA1 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) @@ -79,17 +79,17 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): valid=False)) dataval += 11 - AppendOutToken(packets, ep, address, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=12, pid=0x3)) #DATA0 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) dataval += 12 - AppendOutToken(packets, ep, address, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=13, pid=0xb)) #DATA1 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) dataval += 13 - AppendOutToken(packets, ep, address, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=14, pid=0x3)) #DATA0 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) diff --git a/tests/test_iso_loopback.py b/tests/test_iso_loopback.py index 47fb408a..bdc6782f 100644 --- a/tests/test_iso_loopback.py +++ b/tests/test_iso_loopback.py @@ -26,14 +26,14 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): for pkt_length in range(200, 204): - AppendOutToken(packets, ep_loopback, address) + AppendOutToken(packets, ep_loopback, address, data_valid_count=data_valid_count) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) #DATA0 #XXwas min IPG supported on iso loopback to not nak #This was 420, had to increase when moved to lib_xud (14.1.2 tools) # increased again from 437 when SETUP/OUT checking added # increaed from 477 when adding xs3 - AppendInToken(packets, ep_loopback, address, inter_pkt_gap=498) + AppendInToken(packets, ep_loopback, address, data_valid_count=data_valid_count, inter_pkt_gap=498) packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) #DATA0 #No toggle for Iso @@ -41,11 +41,11 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): pkt_length = 10 #Loopback and die.. - AppendOutToken(packets, ep_loopback_kill, address) + AppendOutToken(packets, ep_loopback_kill, address, data_valid_count=data_valid_count) packets.append(TxDataPacket(rand, data_valid_count=data_valid_count, length=pkt_length, pid=3)) #DATA0 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - AppendInToken(packets, ep_loopback_kill, address, inter_pkt_gap=ipg) + AppendInToken(packets, ep_loopback_kill, address, data_valid_count=data_valid_count, inter_pkt_gap=ipg) packets.append(RxDataPacket(rand, data_valid_count=data_valid_count, length=pkt_length, pid=3)) #DATA0 packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) diff --git a/tests/test_iso_rxtx_fastpacket.py b/tests/test_iso_rxtx_fastpacket.py index 7d997a20..b051cc74 100644 --- a/tests/test_iso_rxtx_fastpacket.py +++ b/tests/test_iso_rxtx_fastpacket.py @@ -22,10 +22,10 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): for pkt_length in range(10, 20): # < 17 fails - AppendOutToken(packets, ep, address, inter_pkt_gap=20) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=20) packets.append(TxDataPacket(rand, data_start_val=data_val, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) #DATA0 - AppendInToken(packets, ep, address, inter_pkt_gap=58) + AppendInToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=58) packets.append(RxDataPacket(rand, data_start_val=data_val, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) data_val = data_val + pkt_length diff --git a/tests/test_iso_tx_basic.py b/tests/test_iso_tx_basic.py index 4cbd0b4e..a3a9f23d 100644 --- a/tests/test_iso_tx_basic.py +++ b/tests/test_iso_tx_basic.py @@ -21,23 +21,23 @@ def do_test(arch, tx_clk, tx_phy, data_valid_count, usb_speed, seed): dataval = 0; - AppendInToken(packets, ep, address) + AppendInToken(packets, ep, address, data_valid_count=data_valid_count) packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=10, pid=0x3)) #DATA0 dataval += 10 - AppendInToken(packets, ep, address, inter_pkt_gap=2000) + AppendInToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=2000) packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=11, pid=0x3)) #DATA0 dataval += 11 - AppendInToken(packets, ep, address, inter_pkt_gap=2000) + AppendInToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=2000) packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=12, pid=0x3)) #DATA0 dataval += 12 - AppendInToken(packets, ep, address, inter_pkt_gap=2000) + AppendInToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=2000) packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=13, pid=0x3)) #DATA0 dataval += 13 - AppendInToken(packets, ep, address, inter_pkt_gap=2000) + AppendInToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=2000) packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=14, pid=0x3)) #DATA0 do_usb_test(arch, tx_clk, tx_phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) diff --git a/tests/test_ping_rx_basic.py b/tests/test_ping_rx_basic.py index 37cc745c..e483283a 100644 --- a/tests/test_ping_rx_basic.py +++ b/tests/test_ping_rx_basic.py @@ -21,41 +21,41 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): dataval = 0; # Ping EP 2, expect NAK - AppendPingToken(packets, 2, address) + AppendPingToken(packets, 2, address, data_valid_count=data_valid_count) packets.append(RxHandshakePacket(data_valid_count=data_valid_count, pid=0x5a)) # And again - AppendPingToken(packets, 2, address) + AppendPingToken(packets, 2, address, data_valid_count=data_valid_count) packets.append(RxHandshakePacket(data_valid_count=data_valid_count, pid=0x5a)) # Send packet to EP 1, xCORE should mark EP 2 as ready - AppendOutToken(packets, ep, address) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=10, pid=0x3)) #DATA0 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) # Ping EP 2 again - expect ACK - AppendPingToken(packets, 2, address, inter_pkt_gap=6000) + AppendPingToken(packets, 2, address, data_valid_count=data_valid_count, inter_pkt_gap=6000) packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) # And again.. - AppendPingToken(packets, 2, address) + AppendPingToken(packets, 2, address, data_valid_count=data_valid_count) packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) # Send out to EP 2.. expect ack - AppendOutToken(packets, 2,address, inter_pkt_gap=6000) + AppendOutToken(packets, 2,address, data_valid_count=data_valid_count, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=10, pid=0x3)) #DATA0 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) # Re-Ping EP 2, expect NAK - AppendPingToken(packets, 2, address) + AppendPingToken(packets, 2, address, data_valid_count=data_valid_count) packets.append(RxHandshakePacket(data_valid_count=data_valid_count, pid=0x5a)) # And again - AppendPingToken(packets, 2, address) + AppendPingToken(packets, 2, address, data_valid_count=data_valid_count) packets.append(RxHandshakePacket(data_valid_count=data_valid_count, pid=0x5a)) # Send a packet to EP 1 so the DUT knows it can exit. - AppendOutToken(packets, ep, address) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count) packets.append(TxDataPacket(rand, data_start_val=dataval+10, data_valid_count=data_valid_count, length=10, pid=0x3^8)) #DATA1 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) diff --git a/tests/test_shorttoken.py b/tests/test_shorttoken.py index f6106e11..04f445ca 100644 --- a/tests/test_shorttoken.py +++ b/tests/test_shorttoken.py @@ -23,7 +23,7 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): # Start with a valid transaction */ - AppendOutToken(packets, ep, address) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=10, pid=0x3)) #DATA0 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) @@ -36,7 +36,7 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): #Finish with valid transaction dataval += 10 - AppendOutToken(packets, ep, address, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=11, pid=0xb)) #DATA1 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) diff --git a/tests/test_sof_badcrc.py b/tests/test_sof_badcrc.py index 8c2d2596..9762700a 100644 --- a/tests/test_sof_badcrc.py +++ b/tests/test_sof_badcrc.py @@ -23,19 +23,19 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): dataval = 0; # Start with a valid transaction */ - AppendOutToken(packets, ep, address) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=10, pid=0x3)) #DATA0 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - AppendSofToken(packets, framenumber) - AppendSofToken(packets, framenumber+1) - AppendSofToken(packets, framenumber+2) - AppendSofToken(packets, framenumber+3, crc5=0xff) # Invalidate the CRC - AppendSofToken(packets, framenumber+4) + AppendSofToken(packets, framenumber, data_valid_count=data_valid_count) + AppendSofToken(packets, framenumber+1, data_valid_count=data_valid_count) + AppendSofToken(packets, framenumber+2, data_valid_count=data_valid_count) + AppendSofToken(packets, framenumber+3, crc5=0xff, data_valid_count=data_valid_count) # Invalidate the CRC + AppendSofToken(packets, framenumber+4, data_valid_count=data_valid_count) #Finish with valid transaction dataval += 10 - AppendOutToken(packets, ep, address, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=11, pid=0xb)) #DATA1 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) diff --git a/tests/test_sof_basic.py b/tests/test_sof_basic.py index a8e84d91..d7699515 100644 --- a/tests/test_sof_basic.py +++ b/tests/test_sof_basic.py @@ -23,19 +23,19 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): dataval = 0; # Start with a valid transaction */ - AppendOutToken(packets, ep, address) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=10, pid=0x3)) #DATA0 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - AppendSofToken(packets, framenumber) - AppendSofToken(packets, framenumber+1) - AppendSofToken(packets, framenumber+2) - AppendSofToken(packets, framenumber+3) - AppendSofToken(packets, framenumber+4) + AppendSofToken(packets, framenumber, data_valid_count=data_valid_count) + AppendSofToken(packets, framenumber+1, data_valid_count=data_valid_count) + AppendSofToken(packets, framenumber+2, data_valid_count=data_valid_count) + AppendSofToken(packets, framenumber+3, data_valid_count=data_valid_count) + AppendSofToken(packets, framenumber+4, data_valid_count=data_valid_count) #Finish with valid transaction dataval += 10 - AppendOutToken(packets, ep, address, inter_pkt_gap=6000) + AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=6000) packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=11, pid=0xb)) #DATA1 packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) From afbd4e50ed74973e4798d5cd7bcfd666084be35d Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 23 Mar 2021 17:13:47 +0000 Subject: [PATCH 197/520] Updates to helpers for XS2 --- tests/helpers.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/helpers.py b/tests/helpers.py index 202dfa0f..9bceddbb 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -41,7 +41,6 @@ def get_usb_clk_phy(verbose=True, test_ctrl=None, do_timeout=True, dut_exit_time=dut_exit_time) elif arch=='xs3': - #clk = Clock('tile[0]:XS1_PORT_1J', Clock.CLK_60MHz) clk = Clock('XS1_USB_CLK', Clock.CLK_60MHz) phy = UsbPhyUtmi('XS1_USB_RXD', 'XS1_USB_RXA', #rxa From a4c147d57fd1fd3b071e98348b5c06715e568ece Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 23 Mar 2021 17:14:09 +0000 Subject: [PATCH 198/520] Updates for helpers for XS2 --- tests/helpers.py | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/tests/helpers.py b/tests/helpers.py index 9bceddbb..a530d5e2 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -25,15 +25,28 @@ def get_usb_clk_phy(verbose=True, test_ctrl=None, do_timeout=True, dut_exit_time=350000, arch='xs2'): if arch=='xs2': - clk = Clock('tile[0]:XS1_PORT_1J', Clock.CLK_60MHz) - phy = UsbPhyShim('tile[0]:XS1_PORT_8B', - 'tile[0]:XS1_PORT_1F', #rxa - 'tile[0]:XS1_PORT_1I', #rxv - 'tile[0]:XS1_PORT_1G', #rxe - 'tile[0]:XS1_PORT_1E', #vld + #clk = Clock('tile[0]:XS1_PORT_1J', Clock.CLK_60MHz) + clk = Clock('XS1_USB_CLK', Clock.CLK_60MHz) + # phy = UsbPhyUtmi('tile[0]:XS1_PORT_8B', + # 'tile[0]:XS1_PORT_1F', #rxa + # 'tile[0]:XS1_PORT_1I', #rxv + # 'tile[0]:XS1_PORT_1G', #rxe + # 'tile[0]:XS1_PORT_1E', #vld + # 'tile[0]:XS1_PORT_8A', #txd + # 'tile[0]:XS1_PORT_1K', #txv + # 'tile[0]:XS1_PORT_1H', #txrdy + phy = UsbPhyUtmi('XS1_USB_RXD', + 'XS1_USB_RXA', #rxa + 'XS1_USB_RXV', #rxv + 'XS1_USB_RXE', #rxe 'tile[0]:XS1_PORT_8A', #txd 'tile[0]:XS1_PORT_1K', #txv 'tile[0]:XS1_PORT_1H', #txrdy + 'XS1_USB_LS0', + 'XS1_USB_LS1', + + + clk, verbose=verbose, test_ctrl=test_ctrl, do_timeout=do_timeout, complete_fn=complete_fn, From 8309745374367e6517a04699dea7e5459578fedc Mon Sep 17 00:00:00 2001 From: mbanth Date: Wed, 24 Mar 2021 13:51:31 +0000 Subject: [PATCH 199/520] Removed directories of tests previously removed by commit f121ea4. --- tests/test_bulk_rx_fastpacket/LICENSE.txt | 135 ------------------- tests/test_bulk_rx_fastpacket/Makefile | 1 - tests/test_bulk_rx_fastpacket/src/main.xc | 46 ------- tests/test_bulk_rx_fastpacket/src/xc_ptr.h | 47 ------- tests/test_bulk_rxtx_fastpacket/LICENSE.txt | 135 ------------------- tests/test_bulk_rxtx_fastpacket/Makefile | 1 - tests/test_bulk_rxtx_fastpacket/src/main.xc | 54 -------- tests/test_bulk_rxtx_fastpacket/src/xc_ptr.h | 47 ------- tests/test_bulk_tx_fastpacket/LICENSE.txt | 135 ------------------- tests/test_bulk_tx_fastpacket/Makefile | 1 - tests/test_bulk_tx_fastpacket/src/main.xc | 122 ----------------- tests/test_bulk_tx_fastpacket/src/xc_ptr.h | 47 ------- 12 files changed, 771 deletions(-) delete mode 100644 tests/test_bulk_rx_fastpacket/LICENSE.txt delete mode 100644 tests/test_bulk_rx_fastpacket/Makefile delete mode 100644 tests/test_bulk_rx_fastpacket/src/main.xc delete mode 100644 tests/test_bulk_rx_fastpacket/src/xc_ptr.h delete mode 100644 tests/test_bulk_rxtx_fastpacket/LICENSE.txt delete mode 100644 tests/test_bulk_rxtx_fastpacket/Makefile delete mode 100644 tests/test_bulk_rxtx_fastpacket/src/main.xc delete mode 100644 tests/test_bulk_rxtx_fastpacket/src/xc_ptr.h delete mode 100644 tests/test_bulk_tx_fastpacket/LICENSE.txt delete mode 100644 tests/test_bulk_tx_fastpacket/Makefile delete mode 100644 tests/test_bulk_tx_fastpacket/src/main.xc delete mode 100644 tests/test_bulk_tx_fastpacket/src/xc_ptr.h diff --git a/tests/test_bulk_rx_fastpacket/LICENSE.txt b/tests/test_bulk_rx_fastpacket/LICENSE.txt deleted file mode 100644 index 994856c9..00000000 --- a/tests/test_bulk_rx_fastpacket/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_bulk_rx_fastpacket/Makefile b/tests/test_bulk_rx_fastpacket/Makefile deleted file mode 100644 index 6aed3e76..00000000 --- a/tests/test_bulk_rx_fastpacket/Makefile +++ /dev/null @@ -1 +0,0 @@ -include ../test_makefile.mak diff --git a/tests/test_bulk_rx_fastpacket/src/main.xc b/tests/test_bulk_rx_fastpacket/src/main.xc deleted file mode 100644 index 937c3fae..00000000 --- a/tests/test_bulk_rx_fastpacket/src/main.xc +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved -/* - * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent - * in both directions between the ports. - * - * NOTE: The src/testbenches/ExampleTestbench must have been compiled for this to run without error. - * - */ -#include -#include -#include -#include - -#include "xud.h" -#include "shared.h" - -#define XUD_EP_COUNT_OUT 5 -#define XUD_EP_COUNT_IN 5 - -#define TEST_EP_NUMBER (3) - -/* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; - -int main() -{ - chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - par - { - XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, - null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); - - - { - TestEp_Rx(c_ep_out[TEST_EP_NUMBER], TEST_EP_NUMBER, 10, 19); - XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); - XUD_Kill(ep0); - exit(0); // TODO should be able to move this outside of the par{} - } - } - - - return 0; -} diff --git a/tests/test_bulk_rx_fastpacket/src/xc_ptr.h b/tests/test_bulk_rx_fastpacket/src/xc_ptr.h deleted file mode 100644 index 28fa6b8b..00000000 --- a/tests/test_bulk_rx_fastpacket/src/xc_ptr.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved -#ifndef __xc_ptr__ -#define __xc_ptr__ - -typedef unsigned int xc_ptr; - -// Note that this function is marked as const to avoid the XC -// parallel usage checks, this is only really going to work if this -// is the *only* way the array a is accessed (and everything else uses -// the xc_ptr) -inline xc_ptr array_to_xc_ptr(const unsigned a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -inline xc_ptr char_array_to_xc_ptr(const unsigned char a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -#define write_via_xc_ptr_indexed(p,i,x) asm volatile("stw %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_short_via_xc_ptr_indexed(p,i,x) asm volatile("st16 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) - -#define write_via_xc_ptr(p,x) asm volatile("stw %0, %1[0]"::"r"(x),"r"(p)) -// No immediate st8 format -#define write_byte_via_xc_ptr(p,x) write_byte_via_xc_ptr_indexed(p, 0, x) -#define write_short_via_xc_ptr(p,x) write_short_via_xc_ptr_indexed(p, 0, x) - -#define read_via_xc_ptr_indexed(x,p,i) asm("ldw %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_byte_via_xc_ptr_indexed(x,p,i) asm("ld8u %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_short_via_xc_ptr_indexed(x,p,i) asm("ld16s %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); - -#define read_via_xc_ptr(x,p) asm("ldw %0, %1[0]":"=r"(x):"r"(p)); -// No immediate ld8u format -#define read_byte_via_xc_ptr(x,p) read_byte_via_xc_ptr_indexed(x, p, 0) -#define read_short_via_xc_ptr(x,p) read_short_via_xc_ptr_indexed(x, p, 0) - -#define GET_SHARED_GLOBAL(x, g) asm volatile("ldw %0, dp[" #g "]":"=r"(x)::"memory") -#define SET_SHARED_GLOBAL(g, v) asm volatile("stw %0, dp[" #g "]"::"r"(v):"memory") - -#endif diff --git a/tests/test_bulk_rxtx_fastpacket/LICENSE.txt b/tests/test_bulk_rxtx_fastpacket/LICENSE.txt deleted file mode 100644 index 994856c9..00000000 --- a/tests/test_bulk_rxtx_fastpacket/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_bulk_rxtx_fastpacket/Makefile b/tests/test_bulk_rxtx_fastpacket/Makefile deleted file mode 100644 index 6aed3e76..00000000 --- a/tests/test_bulk_rxtx_fastpacket/Makefile +++ /dev/null @@ -1 +0,0 @@ -include ../test_makefile.mak diff --git a/tests/test_bulk_rxtx_fastpacket/src/main.xc b/tests/test_bulk_rxtx_fastpacket/src/main.xc deleted file mode 100644 index 980f208b..00000000 --- a/tests/test_bulk_rxtx_fastpacket/src/main.xc +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved -/* - * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent - * in both directions between the ports. - * - * NOTE: The src/testbenches/ExampleTestbench must have been compiled for this to run without error. - * - */ -#include -#include -#include -#include "xud.h" -#include "platform.h" -#include "xc_ptr.h" - -#include "shared.h" - -#define XUD_EP_COUNT_OUT 5 -#define XUD_EP_COUNT_IN 5 - -#ifndef PKT_LENGTH_START -#define PKT_LENGTH_START 10 -#endif - -#ifndef PKT_LENGTH_END -#define PKT_LENGTH_END 19 -#endif - -/* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; - -int main() -{ - chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - - par - { - - XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, - null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); - - TestEp_Tx(c_ep_in[3], 3, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_DIE); - - { - TestEp_Rx(c_ep_out[3], 3, PKT_LENGTH_START, PKT_LENGTH_END); - XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); - XUD_Kill(ep0); - exit(0); // TODO should be able to move this out of the par - } - } - -} diff --git a/tests/test_bulk_rxtx_fastpacket/src/xc_ptr.h b/tests/test_bulk_rxtx_fastpacket/src/xc_ptr.h deleted file mode 100644 index 28fa6b8b..00000000 --- a/tests/test_bulk_rxtx_fastpacket/src/xc_ptr.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved -#ifndef __xc_ptr__ -#define __xc_ptr__ - -typedef unsigned int xc_ptr; - -// Note that this function is marked as const to avoid the XC -// parallel usage checks, this is only really going to work if this -// is the *only* way the array a is accessed (and everything else uses -// the xc_ptr) -inline xc_ptr array_to_xc_ptr(const unsigned a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -inline xc_ptr char_array_to_xc_ptr(const unsigned char a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -#define write_via_xc_ptr_indexed(p,i,x) asm volatile("stw %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_short_via_xc_ptr_indexed(p,i,x) asm volatile("st16 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) - -#define write_via_xc_ptr(p,x) asm volatile("stw %0, %1[0]"::"r"(x),"r"(p)) -// No immediate st8 format -#define write_byte_via_xc_ptr(p,x) write_byte_via_xc_ptr_indexed(p, 0, x) -#define write_short_via_xc_ptr(p,x) write_short_via_xc_ptr_indexed(p, 0, x) - -#define read_via_xc_ptr_indexed(x,p,i) asm("ldw %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_byte_via_xc_ptr_indexed(x,p,i) asm("ld8u %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_short_via_xc_ptr_indexed(x,p,i) asm("ld16s %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); - -#define read_via_xc_ptr(x,p) asm("ldw %0, %1[0]":"=r"(x):"r"(p)); -// No immediate ld8u format -#define read_byte_via_xc_ptr(x,p) read_byte_via_xc_ptr_indexed(x, p, 0) -#define read_short_via_xc_ptr(x,p) read_short_via_xc_ptr_indexed(x, p, 0) - -#define GET_SHARED_GLOBAL(x, g) asm volatile("ldw %0, dp[" #g "]":"=r"(x)::"memory") -#define SET_SHARED_GLOBAL(g, v) asm volatile("stw %0, dp[" #g "]"::"r"(v):"memory") - -#endif diff --git a/tests/test_bulk_tx_fastpacket/LICENSE.txt b/tests/test_bulk_tx_fastpacket/LICENSE.txt deleted file mode 100644 index 994856c9..00000000 --- a/tests/test_bulk_tx_fastpacket/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_bulk_tx_fastpacket/Makefile b/tests/test_bulk_tx_fastpacket/Makefile deleted file mode 100644 index 6aed3e76..00000000 --- a/tests/test_bulk_tx_fastpacket/Makefile +++ /dev/null @@ -1 +0,0 @@ -include ../test_makefile.mak diff --git a/tests/test_bulk_tx_fastpacket/src/main.xc b/tests/test_bulk_tx_fastpacket/src/main.xc deleted file mode 100644 index 7906875e..00000000 --- a/tests/test_bulk_tx_fastpacket/src/main.xc +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (c) 2016-2019, XMOS Ltd, All rights reserved -/* - * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent - * in both directions between the ports. - * - * NOTE: The src/testbenches/ExampleTestbench must have been compiled for this to run without error. - * - */ -#include -#include -#include -#include "xud.h" -#include "platform.h" -#include "xc_ptr.h" - -#define XUD_EP_COUNT_OUT 5 -#define XUD_EP_COUNT_IN 5 - -/* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; - -void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend ?c_usb_test); - -void exit(int); - -#define FAIL_RX_DATAERROR 0 -#define FAIL_RX_LENERROR 1 - -#define PKT_COUNT 10 -#define INITIAL_PKT_LENGTH 10 - -unsigned fail(int x) -{ - - printstr("\nXCORE: ### FAIL ******"); - switch(x) - { - case FAIL_RX_DATAERROR: - printstr("XCORE RX Data Error\n"); - break; - - case FAIL_RX_LENERROR: - printstr("XCORE RX Length Error\n"); - break; - - } - - exit(1); -} - -unsigned char g_rxDataCheck[5] = {0, 0, 0, 0, 0}; -unsigned char g_txDataCheck[5] = {0,0,0,0,0,}; -unsigned g_txLength[5] = {0,0,0,0,0}; - - -#pragma unsafe arrays -void SendTxPacket(XUD_ep ep, int length, int epNum) -{ - unsigned char buffer[1024]; - unsigned char x; - - for (int i = 0; i < length; i++) - { - buffer[i] = g_txDataCheck[epNum]++; - } - - XUD_SetBuffer(ep, buffer, length); -} - -#pragma unsafe arrays -int TestEp_Bulk_Tx(chanend c_in1, int epNum1, chanend c_out_0) -{ - XUD_ep ep_out_0 = XUD_InitEp(c_out_0); - XUD_ep ep_in1 = XUD_InitEp(c_in1); - - unsigned char buffer[PKT_COUNT][1024]; - - int counter = 0; - int length = INITIAL_PKT_LENGTH; - - for(int i = 0; i< PKT_COUNT; i++) - { - for(int j = 0; j < length; j++) - { - buffer[i][j] = counter++; - } - length++; - } - - length = INITIAL_PKT_LENGTH; - -#pragma loop unroll - for(int i = 0; i < PKT_COUNT; i++) - { - XUD_SetBuffer(ep_in1, buffer[i], length++); - } - - XUD_Kill(ep_out_0); - exit(0); - -} - - - -#define USB_CORE 0 -int main() -{ - chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - - par - { - - XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, - null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); - - TestEp_Bulk_Tx(c_ep_in[3], 3, c_ep_out[0]); - } - - return 0; -} diff --git a/tests/test_bulk_tx_fastpacket/src/xc_ptr.h b/tests/test_bulk_tx_fastpacket/src/xc_ptr.h deleted file mode 100644 index 28fa6b8b..00000000 --- a/tests/test_bulk_tx_fastpacket/src/xc_ptr.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved -#ifndef __xc_ptr__ -#define __xc_ptr__ - -typedef unsigned int xc_ptr; - -// Note that this function is marked as const to avoid the XC -// parallel usage checks, this is only really going to work if this -// is the *only* way the array a is accessed (and everything else uses -// the xc_ptr) -inline xc_ptr array_to_xc_ptr(const unsigned a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -inline xc_ptr char_array_to_xc_ptr(const unsigned char a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -#define write_via_xc_ptr_indexed(p,i,x) asm volatile("stw %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_short_via_xc_ptr_indexed(p,i,x) asm volatile("st16 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) - -#define write_via_xc_ptr(p,x) asm volatile("stw %0, %1[0]"::"r"(x),"r"(p)) -// No immediate st8 format -#define write_byte_via_xc_ptr(p,x) write_byte_via_xc_ptr_indexed(p, 0, x) -#define write_short_via_xc_ptr(p,x) write_short_via_xc_ptr_indexed(p, 0, x) - -#define read_via_xc_ptr_indexed(x,p,i) asm("ldw %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_byte_via_xc_ptr_indexed(x,p,i) asm("ld8u %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_short_via_xc_ptr_indexed(x,p,i) asm("ld16s %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); - -#define read_via_xc_ptr(x,p) asm("ldw %0, %1[0]":"=r"(x):"r"(p)); -// No immediate ld8u format -#define read_byte_via_xc_ptr(x,p) read_byte_via_xc_ptr_indexed(x, p, 0) -#define read_short_via_xc_ptr(x,p) read_short_via_xc_ptr_indexed(x, p, 0) - -#define GET_SHARED_GLOBAL(x, g) asm volatile("ldw %0, dp[" #g "]":"=r"(x)::"memory") -#define SET_SHARED_GLOBAL(g, v) asm volatile("stw %0, dp[" #g "]"::"r"(v):"memory") - -#endif From 16ef8ca8c668a8f63498f19b67b927991c45b8b5 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 24 Mar 2021 18:08:37 +0000 Subject: [PATCH 200/520] Fixed not running tests on all arches by default and added busspeed option --- tests/helpers.py | 31 ++++++++++++++++++++----------- tests/runtests.py | 2 ++ tests/usb_phy.py | 2 -- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/tests/helpers.py b/tests/helpers.py index 0491aaeb..4facff00 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -98,22 +98,31 @@ def run_on(**kwargs): return True -SUPPORTED_USB_SPEEDS = ['FS', 'HS'] - def runall_rx(test_fn): - if run_on(arch='xs3'): - test_arch = 'xs3' + seed = args.seed if args.seed else random.randint(0, sys.maxint) + + data_valid_count = {'FS': 30, "HS": 0} - if run_on(arch='xs2'): - test_arch = 'xs2' + if run_on(busspeed='FS'): + + if run_on(arch='xs2'): + (clk_60, usb_phy) = get_usb_clk_phy(verbose=False, arch='xs2') + test_fn('xs2', clk_60, usb_phy, data_valid_count['FS'], 'FS', seed) - (clk_60, usb_phy) = get_usb_clk_phy(verbose=False, arch=test_arch) - seed = args.seed if args.seed else random.randint(0, sys.maxint) + if run_on(arch='xs3'): + (clk_60, usb_phy) = get_usb_clk_phy(verbose=False, arch='xs3') + test_fn('xs3', clk_60, usb_phy, data_valid_count['FS'], 'FS', seed) + + if run_on(busspeed='HS'): + + if run_on(arch='xs2'): + (clk_60, usb_phy) = get_usb_clk_phy(verbose=False, arch='xs2') + test_fn('xs2', clk_60, usb_phy, data_valid_count['HS'], 'HS', seed) - for speed in SUPPORTED_USB_SPEEDS: - data_valid_count = get_usb_data_valid_count(usb_speed=speed) - test_fn(test_arch, clk_60, usb_phy, data_valid_count, speed, seed) + if run_on(arch='xs3'): + (clk_60, usb_phy) = get_usb_clk_phy(verbose=False, arch='xs3') + test_fn('xs3', clk_60, usb_phy, data_valid_count['HS'], 'HS', seed) def do_usb_test(arch, clk, phy, usb_speed, packets, test_file, seed, diff --git a/tests/runtests.py b/tests/runtests.py index 6f0a7127..71c2f619 100644 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -43,6 +43,8 @@ def epilogue(args): argparser.add_argument('--arch', choices=['xs2', 'xs3'], type=str, help='Run tests only on specified xcore architecture') argparser.add_argument('--seed', type=int, help='The seed', default=None) argparser.add_argument('--verbose', action='store_true', help='Enable verbose tracing in the phys') + argparser.add_argument('--busspeed', choices=['FS', 'HS'], help='Speed of USB to run test at') + helpers.args = xmostest.init(argparser) diff --git a/tests/usb_phy.py b/tests/usb_phy.py index 045b8c71..e221b286 100644 --- a/tests/usb_phy.py +++ b/tests/usb_phy.py @@ -191,8 +191,6 @@ def run(self): self.wait(lambda x: self._clock.is_low()) rxa_start_delay = rxa_start_delay- 1; - self._tx_packet_init() - for (i, byte) in enumerate(packet.get_bytes(do_tokens = self._do_tokens)): # xCore should not be trying to send if we are trying to send.. From 6e985ee90d91911234b2531cfc6aa6699787c12d Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 24 Mar 2021 18:10:29 +0000 Subject: [PATCH 201/520] Fixed typo in FS data_valid count and removed unused function --- tests/helpers.py | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/tests/helpers.py b/tests/helpers.py index 4facff00..9d8fe905 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -75,18 +75,6 @@ def get_usb_clk_phy(verbose=True, test_ctrl=None, do_timeout=True, return (clk, phy) -def get_usb_data_valid_count(usb_speed='HS'): - return_value = 0 - - if usb_speed == 'HS': - return_value = 0 - elif usb_speed == 'FS': - return_value = 39 - else: - raise ValueError("Unsupported USB speed: {}".format(usb_speed)) - - return return_value - def run_on(**kwargs): if not args: return True @@ -102,7 +90,7 @@ def runall_rx(test_fn): seed = args.seed if args.seed else random.randint(0, sys.maxint) - data_valid_count = {'FS': 30, "HS": 0} + data_valid_count = {'FS': 39, "HS": 0} if run_on(busspeed='FS'): From 00b70a5dc67c6e1f5593458a6695f2d68740b0b5 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 24 Mar 2021 18:15:43 +0000 Subject: [PATCH 202/520] Small tidies of dead code/comments --- tests/helpers.py | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/tests/helpers.py b/tests/helpers.py index 9d8fe905..156aefe0 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -17,24 +17,12 @@ def create_if_needed(folder): os.makedirs(folder) return folder -#todo -dut_address = 1 - def get_usb_clk_phy(verbose=True, test_ctrl=None, do_timeout=True, complete_fn=None, expect_loopback=False, dut_exit_time=350000, arch='xs2'): if arch=='xs2': - #clk = Clock('tile[0]:XS1_PORT_1J', Clock.CLK_60MHz) clk = Clock('XS1_USB_CLK', Clock.CLK_60MHz) - # phy = UsbPhyUtmi('tile[0]:XS1_PORT_8B', - # 'tile[0]:XS1_PORT_1F', #rxa - # 'tile[0]:XS1_PORT_1I', #rxv - # 'tile[0]:XS1_PORT_1G', #rxe - # 'tile[0]:XS1_PORT_1E', #vld - # 'tile[0]:XS1_PORT_8A', #txd - # 'tile[0]:XS1_PORT_1K', #txv - # 'tile[0]:XS1_PORT_1H', #txrdy phy = UsbPhyUtmi('XS1_USB_RXD', 'XS1_USB_RXA', #rxa 'XS1_USB_RXV', #rxv @@ -195,12 +183,6 @@ def packet_processing_time(phy, data_bytes): """ return 6000 * phy.clock.get_bit_time() -#def get_dut_address(): -# """ Returns the busaddress of the DUT -# """ -# #TODO, we need the ability to config this -# return 1 - def choose_small_frame_size(rand): """ Choose the size of a frame near the minimum size frame (46 data bytes) """ From 9a0a0c199a096c109df9c1d9989e81b4a3e8c2a5 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 25 Mar 2021 11:06:37 +0000 Subject: [PATCH 203/520] Tidy up running tests over different archs and bus speeds. Introduced shared global lists for choices for both these items --- tests/helpers.py | 32 +++++++++----------------------- tests/runtests.py | 8 +++++--- 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/tests/helpers.py b/tests/helpers.py index 156aefe0..a04ec93f 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -12,6 +12,9 @@ args = None +ARCHITECTURE_CHOICES = ['xs2', 'xs3'] +BUSSPEED_CHOICES = ['FS', 'HS'] + def create_if_needed(folder): if not os.path.exists(folder): os.makedirs(folder) @@ -32,9 +35,6 @@ def get_usb_clk_phy(verbose=True, test_ctrl=None, do_timeout=True, 'tile[0]:XS1_PORT_1H', #txrdy 'XS1_USB_LS0', 'XS1_USB_LS1', - - - clk, verbose=verbose, test_ctrl=test_ctrl, do_timeout=do_timeout, complete_fn=complete_fn, @@ -79,27 +79,13 @@ def runall_rx(test_fn): seed = args.seed if args.seed else random.randint(0, sys.maxint) data_valid_count = {'FS': 39, "HS": 0} - - if run_on(busspeed='FS'): - - if run_on(arch='xs2'): - (clk_60, usb_phy) = get_usb_clk_phy(verbose=False, arch='xs2') - test_fn('xs2', clk_60, usb_phy, data_valid_count['FS'], 'FS', seed) - - if run_on(arch='xs3'): - (clk_60, usb_phy) = get_usb_clk_phy(verbose=False, arch='xs3') - test_fn('xs3', clk_60, usb_phy, data_valid_count['FS'], 'FS', seed) - - if run_on(busspeed='HS'): - - if run_on(arch='xs2'): - (clk_60, usb_phy) = get_usb_clk_phy(verbose=False, arch='xs2') - test_fn('xs2', clk_60, usb_phy, data_valid_count['HS'], 'HS', seed) - - if run_on(arch='xs3'): - (clk_60, usb_phy) = get_usb_clk_phy(verbose=False, arch='xs3') - test_fn('xs3', clk_60, usb_phy, data_valid_count['HS'], 'HS', seed) + for _arch in ARCHITECTURE_CHOICES: + for _busspeed in BUSSPEED_CHOICES: + if run_on(arch=_arch): + if run_on(busspeed=_busspeed): + (clk_60, usb_phy) = get_usb_clk_phy(verbose=False, arch=_arch) + test_fn(_arch, clk_60, usb_phy, data_valid_count[_busspeed], _busspeed, seed) def do_usb_test(arch, clk, phy, usb_speed, packets, test_file, seed, level='nightly', extra_tasks=[]): diff --git a/tests/runtests.py b/tests/runtests.py index 71c2f619..40dbc840 100644 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -4,8 +4,8 @@ import os import re import shutil - import helpers +from helpers import ARCHITECTURE_CHOICES, BUSSPEED_CHOICES XN_FILES = ["test_xs2.xn", "test_xs3.xn"] @@ -36,14 +36,16 @@ def prologue(args): def epilogue(args): delete_test_specific_xn_files(args) + + if __name__ == "__main__": global trace argparser = argparse.ArgumentParser(description="XMOS lib_xud tests") argparser.add_argument('--trace', action='store_true', help='Run tests with simulator and VCD traces') - argparser.add_argument('--arch', choices=['xs2', 'xs3'], type=str, help='Run tests only on specified xcore architecture') + argparser.add_argument('--arch', choices=ARCHITECTURE_CHOICES, type=str, help='Run tests only on specified xcore architecture') argparser.add_argument('--seed', type=int, help='The seed', default=None) argparser.add_argument('--verbose', action='store_true', help='Enable verbose tracing in the phys') - argparser.add_argument('--busspeed', choices=['FS', 'HS'], help='Speed of USB to run test at') + argparser.add_argument('--busspeed', choices=BUSSPEED_CHOICES, type=str, help='Speed of USB to run test at') helpers.args = xmostest.init(argparser) From 5804d79c41d121373cf2258a1fd3d78614f7425a Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 25 Mar 2021 11:10:31 +0000 Subject: [PATCH 204/520] Fixed usage string typo only --- tests/runtests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/runtests.py b/tests/runtests.py index 71c2f619..86999c2d 100644 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -42,7 +42,7 @@ def epilogue(args): argparser.add_argument('--trace', action='store_true', help='Run tests with simulator and VCD traces') argparser.add_argument('--arch', choices=['xs2', 'xs3'], type=str, help='Run tests only on specified xcore architecture') argparser.add_argument('--seed', type=int, help='The seed', default=None) - argparser.add_argument('--verbose', action='store_true', help='Enable verbose tracing in the phys') + argparser.add_argument('--verbose', action='store_true', help='Enable verbose tracing in the phy') argparser.add_argument('--busspeed', choices=['FS', 'HS'], help='Speed of USB to run test at') From c1f5a8b0ae49d6262bb8de08d3876841ea850989 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 25 Mar 2021 11:11:50 +0000 Subject: [PATCH 205/520] Started Adding support for UsbSession --- tests/helpers.py | 41 ++++++++++++++++++++++-------------- tests/usb_event.py | 10 +++++++++ tests/usb_packet.py | 6 ++++++ tests/usb_session.py | 45 ++++++++++++++++++++++++++++++++++++++++ tests/usb_transaction.py | 28 +++++++++++++++++++++++++ 5 files changed, 115 insertions(+), 15 deletions(-) create mode 100644 tests/usb_event.py create mode 100644 tests/usb_session.py create mode 100644 tests/usb_transaction.py diff --git a/tests/helpers.py b/tests/helpers.py index 156aefe0..eeee2485 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -100,9 +100,10 @@ def runall_rx(test_fn): (clk_60, usb_phy) = get_usb_clk_phy(verbose=False, arch='xs3') test_fn('xs3', clk_60, usb_phy, data_valid_count['HS'], 'HS', seed) + -def do_usb_test(arch, clk, phy, usb_speed, packets, test_file, seed, - level='nightly', extra_tasks=[]): +def do_usb_test(arch, clk, phy, usb_speed, sessions, test_file, seed, + level='nightly', extra_tasks=[], verbose=False): """ Shared test code for all RX tests using the test_rx application. """ @@ -114,26 +115,36 @@ def do_usb_test(arch, clk, phy, usb_speed, packets, test_file, seed, print binary - if xmostest.testlevel_is_at_least(xmostest.get_testlevel(), level): - print "Running {test}: {arch} arch sending {n} packets at {clk} using {speed} (seed {seed})".format( - test=testname, n=len(packets), - arch=arch, clk=clk.get_name(), speed=usb_speed, seed=seed) + assert len(sessions) == 1, "Multiple sessions not yet supported" + + for session in sessions: + + events = session.events + + if verbose: + print "Session " + str(sessions.index(session)) + print str(session) + + if xmostest.testlevel_is_at_least(xmostest.get_testlevel(), level): + print "Running {test}: {arch} arch sending {n} events at {clk} using {speed} (seed {seed})".format( + test=testname, n=len(events), + arch=arch, clk=clk.get_name(), speed=usb_speed, seed=seed) - phy.set_packets(packets) + phy.set_packets(session.events) - expect_folder = create_if_needed("expect") - expect_filename = '{folder}/{test}_{arch}.expect'.format( - folder=expect_folder, test=testname, phy=phy.name, clk=clk.get_name(), arch=arch) - create_expect(arch, packets, expect_filename) + expect_folder = create_if_needed("expect") + expect_filename = '{folder}/{test}_{arch}.expect'.format( + folder=expect_folder, test=testname, phy=phy.name, clk=clk.get_name(), arch=arch) + create_expect(arch, session.events, expect_filename) - tester = xmostest.ComparisonTester(open(expect_filename), + tester = xmostest.ComparisonTester(open(expect_filename), 'lib_xud', 'xud_sim_tests', testname, {'clk':clk.get_name(), 'arch':arch, 'speed':usb_speed}) - tester.set_min_testlevel(level) + tester.set_min_testlevel(level) - simargs = get_sim_args(testname, clk, phy, arch) - xmostest.run_on_simulator(resources['xsim'], binary, + simargs = get_sim_args(testname, clk, phy, arch) + xmostest.run_on_simulator(resources['xsim'], binary, simthreads=[clk, phy] + extra_tasks, tester=tester, simargs=simargs) diff --git a/tests/usb_event.py b/tests/usb_event.py new file mode 100644 index 00000000..80467e2c --- /dev/null +++ b/tests/usb_event.py @@ -0,0 +1,10 @@ + +class UsbEvent(object): + + def __init__(self, time=0): + self._time = time + + @property + def time(self): + return self._time + diff --git a/tests/usb_packet.py b/tests/usb_packet.py index df96d677..17ed2581 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -56,6 +56,7 @@ +-------------------+ +-------------------+ """ +from usb_event import UsbEvent import sys import zlib import random @@ -222,9 +223,14 @@ def __init__(self, **kwargs): self.data_valid_count = kwargs.pop('data_valid_count', 0) self.bad_crc = kwargs.pop('bad_crc', False) + #super().__init__(time = 0) #TODO + def get_data_valid_count(self): return self.data_valid_count + def __str__(self): + return "USBPacket: " + self.get_pid_pretty() + def get_pid_pretty(self): if self.pid == 2: diff --git a/tests/usb_session.py b/tests/usb_session.py new file mode 100644 index 00000000..3bf3e4f3 --- /dev/null +++ b/tests/usb_session.py @@ -0,0 +1,45 @@ + +class UsbSession(object): + + def __init__(self, bus_speed = "HS", run_enumeration = False, device_address = 0, **kwargs): + self._bus_speed = bus_speed + self._events = [] + self._enumerate = run_enumeration + self._device_address = device_address + + @property + def bus_speed(self): + return self._bus_speed + + @property + def events(self): + return self._events + + @property + def device_address(self): + return self._device_address + + @property + def enumerate(self): + return self._enumerate + + def __str__(self): + + s = "USB Session\n" + + for e in self._events: + s += str(self._events.index(e)) + ":" + s += str(e) + "\n" + + return s + + def add_event(self, e): + self._events.append(e) + self._events = _sort_events_by_time(self._events) + + def pop_event(self, e): + self.events.pop(0) + + def _sort_events_by_time(self, events): + return sorted(events, key=lambda x: x.time, reverse=True) + diff --git a/tests/usb_transaction.py b/tests/usb_transaction.py new file mode 100644 index 00000000..6bae2876 --- /dev/null +++ b/tests/usb_transaction.py @@ -0,0 +1,28 @@ + +from usb_event import UsbEvent + +class UsbTransaction(UsbEvent): + + def __init__(self, endpointAddress = 0, endpointType = "BULK", eventTime = 0): # TODO Enum when we move to py3 + self._endpointAddress = endpointAddress + self._endpointType = endpointType + self._packets = [] + super(UsbTransaction, self).__init__(time = eventTime) + + @property + def endpointAddress(self): + return self._endpointAddress + + @property + def endpointType(self): + return self._endpointType + + @property + def packets(self): + return self._packets + + def __str__(self): + s = "UsbTransaction " + for p in self._packets: + s += str(p) + return s From c10c97fc1ce946beeba5b6ad5451703a2ba8743f Mon Sep 17 00:00:00 2001 From: mbanth Date: Thu, 25 Mar 2021 11:43:55 +0000 Subject: [PATCH 206/520] Update copyright date range --- lib_xud/src/core/XUD_IoLoop.S | 2 +- lib_xud/src/core/included/XUD_Token_Out.S | 2 +- tests/runtests.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_xud/src/core/XUD_IoLoop.S b/lib_xud/src/core/XUD_IoLoop.S index 9e9873b5..8ba7d72a 100755 --- a/lib_xud/src/core/XUD_IoLoop.S +++ b/lib_xud/src/core/XUD_IoLoop.S @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2021, XMOS Ltd, All rights reserved // XUD_LLD_IoLoop.S // Main USB interfacing loop diff --git a/lib_xud/src/core/included/XUD_Token_Out.S b/lib_xud/src/core/included/XUD_Token_Out.S index 1bbab4c4..b67bd3f1 100755 --- a/lib_xud/src/core/included/XUD_Token_Out.S +++ b/lib_xud/src/core/included/XUD_Token_Out.S @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2021, XMOS Ltd, All rights reserved // r10: EP number // OUT Token Packet ----------------------------------------------------------------------------- // Ports diff --git a/tests/runtests.py b/tests/runtests.py index dff225ba..cac883e0 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2016-2019, XMOS Ltd, All rights reserved +# Copyright (c) 2016-2021, XMOS Ltd, All rights reserved import xmostest import argparse import os From 9459c741ea13e158a2471adf81c2daba4a063124 Mon Sep 17 00:00:00 2001 From: mbanth Date: Thu, 25 Mar 2021 12:14:21 +0000 Subject: [PATCH 207/520] Manually revert to match at HEAD of DEV/XS3 Matches commit be1d088af5b936ae9b054b5c5d6bf17860c24a30 --- lib_xud/src/core/included/XUD_Token_Out.S | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib_xud/src/core/included/XUD_Token_Out.S b/lib_xud/src/core/included/XUD_Token_Out.S index b67bd3f1..dd1dd279 100755 --- a/lib_xud/src/core/included/XUD_Token_Out.S +++ b/lib_xud/src/core/included/XUD_Token_Out.S @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2021, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved // r10: EP number // OUT Token Packet ----------------------------------------------------------------------------- // Ports @@ -18,10 +18,9 @@ CheckEpTypeOut: BRFT_ru6 r11, DoOutNonIso // ISO endpoint OutReady: + stw r11, r5[r10] // Clear ready straight away - we don't to CRC checking on Iso - else we would have to wait for end of packet bl doRXData clre - ldc r11, 0 - stw r11, r5[r10] // Clear ready after receiving packet - avoids EP getting stuck in not-ready state if interrupted InformEP_Iso: // Iso EP - no handshake ldw r11, r3[1] // Load EP chanend From 22d9b5537554304c0c9bec8daa9e32dee6d95f9e Mon Sep 17 00:00:00 2001 From: mbanth Date: Thu, 25 Mar 2021 13:12:25 +0000 Subject: [PATCH 208/520] Manually revert to match the HEAD of DEV/XS3 Matches commit be1d088af5b936ae9b054b5c5d6bf17860c24a30 with the exception of the copyright date range --- lib_xud/src/core/XUD_IoLoop.S | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib_xud/src/core/XUD_IoLoop.S b/lib_xud/src/core/XUD_IoLoop.S index 8ba7d72a..788fdddf 100755 --- a/lib_xud/src/core/XUD_IoLoop.S +++ b/lib_xud/src/core/XUD_IoLoop.S @@ -257,8 +257,6 @@ ConfigSofJump: ConfigSofJump_Done: ConfigRxErrEventVector: - stw r3, sp[15] // Store flag port to stack -#if 0 // RxError Interrupts Disabled setc res[r3], XS1_SETC_COND_EQ setc res[r3], XS1_SETC_IE_MODE_INTERRUPT ldap r11, Err_RxErr @@ -266,7 +264,6 @@ ConfigRxErrEventVector: ldc r11, 1 setd res[r3], r11 // Set event cond data to 1 eeu res[r3] -#endif #if 0 SetupOutTimer: From 48cd212824c20872c0e63bafe78652afb24103da Mon Sep 17 00:00:00 2001 From: mbanth Date: Thu, 25 Mar 2021 13:13:23 +0000 Subject: [PATCH 209/520] Update copyright date range to keep the source checker happy --- lib_xud/src/core/included/XUD_Token_Out.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xud/src/core/included/XUD_Token_Out.S b/lib_xud/src/core/included/XUD_Token_Out.S index dd1dd279..6d7564b0 100755 --- a/lib_xud/src/core/included/XUD_Token_Out.S +++ b/lib_xud/src/core/included/XUD_Token_Out.S @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2021, XMOS Ltd, All rights reserved // r10: EP number // OUT Token Packet ----------------------------------------------------------------------------- // Ports From 0997bdefc08a4685bae690ef5d68d37d5113b150 Mon Sep 17 00:00:00 2001 From: mbanth Date: Thu, 25 Mar 2021 13:49:45 +0000 Subject: [PATCH 210/520] Update the version of the XMOS Jenkins Shared Library and use the more flexible technique to obtain the view file name --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ec1272dd..a5513b7e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,14 +1,14 @@ -@Library('xmos_jenkins_shared_library@v0.14.2') _ +@Library('xmos_jenkins_shared_library@v0.16.2') _ getApproval() pipeline { agent { - label 'x86_64&&brew&&macOS' + label 'x86_64 && brew && macOS' } environment { REPO = 'lib_xud' - VIEW = "${env.JOB_NAME.contains('PR-') ? REPO+'_'+env.CHANGE_TARGET : REPO+'_'+env.BRANCH_NAME}" + VIEW = getViewName(REPO) } options { skipDefaultCheckout() From 15b471b1699a6d090765bc4380d7fb07d2db310b Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 29 Mar 2021 13:08:33 +0100 Subject: [PATCH 211/520] Further work on usb events in test bench --- tests/helpers.py | 45 +++++++++------ tests/usb_event.py | 10 ++++ tests/usb_packet.py | 119 +++++++++++++++++++++++---------------- tests/usb_phy.py | 4 +- tests/usb_session.py | 13 ++++- tests/usb_transaction.py | 84 +++++++++++++++++++++++++-- 6 files changed, 202 insertions(+), 73 deletions(-) diff --git a/tests/helpers.py b/tests/helpers.py index c81949bd..759a33a5 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -4,7 +4,7 @@ import random import sys from usb_clock import Clock -from usb_phy import UsbPhy +from usb_phy import UsbPhy, USB_DATA_VALID_COUNT from usb_phy_shim import UsbPhyShim from usb_phy_utmi import UsbPhyUtmi from usb_packet import RxPacket @@ -78,14 +78,12 @@ def runall_rx(test_fn): seed = args.seed if args.seed else random.randint(0, sys.maxint) - data_valid_count = {'FS': 39, "HS": 0} - for _arch in ARCHITECTURE_CHOICES: for _busspeed in BUSSPEED_CHOICES: if run_on(arch=_arch): if run_on(busspeed=_busspeed): (clk_60, usb_phy) = get_usb_clk_phy(verbose=False, arch=_arch) - test_fn(_arch, clk_60, usb_phy, data_valid_count[_busspeed], _busspeed, seed) + test_fn(_arch, clk_60, usb_phy, USB_DATA_VALID_COUNT[_busspeed], _busspeed, seed) def do_usb_test(arch, clk, phy, usb_speed, sessions, test_file, seed, level='nightly', extra_tasks=[], verbose=False): @@ -106,12 +104,12 @@ def do_usb_test(arch, clk, phy, usb_speed, sessions, test_file, seed, events = session.events - if verbose: + if args.verbose: print "Session " + str(sessions.index(session)) print str(session) if xmostest.testlevel_is_at_least(xmostest.get_testlevel(), level): - print "Running {test}: {arch} arch sending {n} events at {clk} using {speed} (seed {seed})".format( + print "Running {test}: {arch} arch sending {n} event(s) at {clk} using {speed} (seed {seed})".format( test=testname, n=len(events), arch=arch, clk=clk.get_name(), speed=usb_speed, seed=seed) @@ -120,6 +118,7 @@ def do_usb_test(arch, clk, phy, usb_speed, sessions, test_file, seed, expect_folder = create_if_needed("expect") expect_filename = '{folder}/{test}_{arch}.expect'.format( folder=expect_folder, test=testname, phy=phy.name, clk=clk.get_name(), arch=arch) + create_expect(arch, session.events, expect_filename) tester = xmostest.ComparisonTester(open(expect_filename), @@ -134,22 +133,32 @@ def do_usb_test(arch, clk, phy, usb_speed, sessions, test_file, seed, tester=tester, simargs=simargs) -def create_expect(arch, packets, filename): - do_tokens = (arch == "xs2") - +def create_expect(arch, events, filename): + """ Create the expect file for what packets should be reported by the DUT """ with open(filename, 'w') as f: - for i,packet in enumerate(packets): - #if not packet.dropped: - if isinstance(packet, RxPacket): - f.write("Receiving packet {}\n".format(i)) - - for (i, byte) in enumerate(packet.get_bytes(do_tokens=do_tokens)): - f.write("Received byte: {0:#x}\n".format(byte)) + for i, event in enumerate(events): + + packet_offset = 0 + expect_str = event.expected_output(0) + expect_str += "\n" + + packet_offset += event.event_count + + print str(expect_str) + f.write(str(expect_str)) + #print str(expect) + #if isinstance(event, RxPacket): + # print "Rx Packet" + # f.write("Receiving packet {}\n".format(i)) + # + + # for (i, byte) in enumerate(packet.get_bytes(do_tokens=do_tokens)): + # f.write("Received byte: {0:#x}\n".format(byte)) - else: - f.write("Phy transmitting packet {} PID: {} ({})\n".format(i, packet.get_pid_pretty(), packet.pid)) + #else: + # f.write("Phy transmitting packet {} PID: {} ({})\n".format(i, event.get_pid_pretty(), event.pid)) f.write("Test done\n") diff --git a/tests/usb_event.py b/tests/usb_event.py index 80467e2c..243289b8 100644 --- a/tests/usb_event.py +++ b/tests/usb_event.py @@ -1,4 +1,6 @@ +import abc + class UsbEvent(object): def __init__(self, time=0): @@ -8,3 +10,11 @@ def __init__(self, time=0): def time(self): return self._time + @abc.abstractmethod + def expected_output(self): + pass + + #Note, an event might contain events + @abc.abstractproperty + def eventcount(self): + pass diff --git a/tests/usb_packet.py b/tests/usb_packet.py index 17ed2581..affaba40 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -67,8 +67,20 @@ RXA_START_DELAY = 5 #Taken from RTL sim RX_RX_DELAY = 40 -PID_DATA1 = 0xb -PID_DATA0 = 0x3 +#PID_DATA1 = 0xb +#PID_DATA0 = 0x3 + +USB_PID = { + "OUT": 0xE1, + "IN" : 0x69, + "SETUP" : 0x2D, + "PING" : 0xA5, + "DATA0" : 11, + "DATA1" : 3, + "SOF" : 165, + "ACK" : 0xD2 + } + @@ -76,9 +88,9 @@ def AppendSetupToken(packets, ep, address, **kwargs): ipg = kwargs.pop('inter_pkt_gap', 500) AppendTokenPacket(packets, 0x2d, ep, ipg, address, **kwargs) -def AppendOutToken(packets, ep, address, **kwargs): - ipg = kwargs.pop('inter_pkt_gap', 500) - AppendTokenPacket(packets, 0xe1, ep, ipg, address, **kwargs) +#def AppendOutToken(packets, ep, address, **kwargs): +# ipg = kwargs.pop('inter_pkt_gap', 500) +# AppendTokenPacket(packets, 0xe1, ep, ipg, address, **kwargs) def AppendPingToken(packets, ep, address, **kwargs): ipg = kwargs.pop('inter_pkt_gap', 500) @@ -98,15 +110,15 @@ def AppendSofToken(packets, framenumber, **kwargs): address = (framenumber) & 0x7f AppendTokenPacket(packets, 0xa5, ep, ipg, address, **kwargs) -def AppendTokenPacket(packets, _pid, ep, ipg, addr=0, **kwargs): - - data_valid_count = kwargs.pop('data_valid_count', 0) - packets.append(TokenPacket( - inter_pkt_gap=ipg, - pid=_pid, - address=addr, - endpoint=ep, - data_valid_count=data_valid_count)) +#def AppendTokenPacket(packets, _pid, ep, ipg, addr=0, **kwargs): +# +# data_valid_count = kwargs.pop('data_valid_count', 0) +# packets.append(TokenPacket( +# inter_pkt_gap=ipg, +# pid=_pid, +# address=addr, +# endpoint=ep, +# data_valid_count=data_valid_count)) def reflect(val, numBits): @@ -223,35 +235,24 @@ def __init__(self, **kwargs): self.data_valid_count = kwargs.pop('data_valid_count', 0) self.bad_crc = kwargs.pop('bad_crc', False) - #super().__init__(time = 0) #TODO - def get_data_valid_count(self): return self.data_valid_count def __str__(self): - return "USBPacket: " + self.get_pid_pretty() - - def get_pid_pretty(self): - - if self.pid == 2: - return "ACK" - elif self.pid == 225: - return "OUT" - elif self.pid == 11: - return "DATA1" - elif self.pid == 3: - return "DATA0" - elif self.pid == 105: - return "IN" - elif self.pid == 180: - return "PING" - elif self.pid == 165: - return "SOF" - elif self.pid == 45: - return "SETUP" - else: - return "UNKNOWN" + return "USBPacket" + + def get_pid_str(self): + + for key, value in USB_PID.iteritems(): + if value == self.pid: + return key + + return "UNKNOWN" + + @property + def event_count(self): + return 1 #Rx to host i.e. xCORE Tx class RxPacket(UsbPacket): @@ -263,6 +264,12 @@ def __init__(self, **kwargs): def get_timeout(self): return self.timeout + @property + def expected_output(self): + expected_output = "DEVICE -> HOST" + return expected_output + + #Tx from host i.e. xCORE Rx class TxPacket(UsbPacket): @@ -277,6 +284,11 @@ def __init__(self, **kwargs): def get_inter_pkt_gap(self): return self.inter_pkt_gap + @property + def expected_output(self): + expected_output = "HOST -> DEVICE" + return expected_output + # Implemented such that we can generate malformed packets def get_bytes(self, do_tokens=False): bytes = [] @@ -292,16 +304,16 @@ def get_bytes(self, do_tokens=False): # DataPacket class, inherits from Usb Packet class DataPacket(UsbPacket): - def __init__(self, **kwargs): + def __init__(self, dataPayload = [], **kwargs): super(DataPacket, self).__init__(**kwargs) self.pid = kwargs.pop('pid', 0x3) #DATA0 - data_start_val = kwargs.pop('data_start_val', None) - - if data_start_val != None: - self.data_bytes = [x+data_start_val for x in range(self.num_data_bytes)] - else: - self.data_bytes = [x for x in range(self.num_data_bytes)] + #data_start_val = kwargs.pop('data_start_val', None) + #if data_start_val != None: + # self.data_bytes = [x+data_start_val for x in range(self.num_data_bytes)] + #else: + # self.data_bytes = [x for x in range(self.num_data_bytes)] + self.data_bytes = dataPayload def get_packet_bytes(self): packet_bytes = [] @@ -344,12 +356,17 @@ def __init__(self, rand, **kwargs): #Re-construct full PID - xCORE sends out full PIDn | PID on Tx super(RxDataPacket, self).__init__(pid = (_pid & 0xf) | (((~_pid)&0xf) << 4), **kwargs) + def __str__(self): + return super(DataPacket, self).__str__() + ": TX DataPacket: " + super(DataPacket, self).get_pid_str() + " " + str(self.data_bytes) + class TxDataPacket(DataPacket, TxPacket): - def __init__(self, rand, **kwargs): + def __init__(self, **kwargs): super(TxDataPacket, self).__init__(**kwargs) #self.inter_pkt_gap = kwargs.pop('inter_pkt_gap', 13) #13 lowest working for single issue loopback - + + def __str__(self): + return super(DataPacket, self).__str__() + ": TX DataPacket: " + super(DataPacket, self).get_pid_str() + " " + str(self.data_bytes) #Always TX class TokenPacket(TxPacket): @@ -387,6 +404,9 @@ def get_bytes(self, do_tokens=False): return bytes + def __str__(self): + return super(TokenPacket, self).__str__() + ": TokenPacket: " + super(TokenPacket, self).get_pid_str() + # Token valid def get_token_valid(self): return self.valid @@ -409,6 +429,9 @@ def __init__(self, **kwargs): self.pid = kwargs.pop('pid', 0xd2) #Default to ACK (not expect inverted bits on Rx) self.timeout = kwargs.pop('timeout', RX_TX_DELAY) + def __str__(self): + return super(RxHandshakePacket, self).__str__() + ": RX HandshakePacket: " + super(RxHandshakePacket, self).get_pid_str() + class TxHandshakePacket(HandshakePacket, TxPacket): @@ -423,3 +446,5 @@ def get_bytes(self, do_tokens=False): bytes.append(self.pid | ((~self.pid) << 4)) return bytes + def __str__(self): + return super(TxHandshakePacket, self).__str__() + ": TX HandshakePacket: " + super(TxHandshakePacket, self).get_pid_str() diff --git a/tests/usb_phy.py b/tests/usb_phy.py index e221b286..042eaeec 100644 --- a/tests/usb_phy.py +++ b/tests/usb_phy.py @@ -5,6 +5,8 @@ from usb_packet import RxPacket, TokenPacket import usb_packet +USB_DATA_VALID_COUNT = {'FS': 39, "HS": 0} + class UsbPhy(xmostest.SimThread): # Time in ns from the last packet being sent until the end of test is signalled to the DUT @@ -90,7 +92,7 @@ def set_clock(self, clock): def set_packets(self, packets): self._packets = packets - + def drive_error(self, value): self.xsi.drive_port_pins(self._rxer, value) diff --git a/tests/usb_session.py b/tests/usb_session.py index 3bf3e4f3..e6e26e1e 100644 --- a/tests/usb_session.py +++ b/tests/usb_session.py @@ -1,4 +1,7 @@ +from usb_phy import USB_DATA_VALID_COUNT +import usb_transaction + class UsbSession(object): def __init__(self, bus_speed = "HS", run_enumeration = False, device_address = 0, **kwargs): @@ -23,19 +26,25 @@ def device_address(self): def enumerate(self): return self._enumerate + @property + def data_valid_count(self): + return USB_DATA_VALID_COUNT[self._bus_speed] + def __str__(self): s = "USB Session\n" for e in self._events: - s += str(self._events.index(e)) + ":" + s += str(self._events.index(e)) + ": " s += str(e) + "\n" return s def add_event(self, e): + + e.bus_speed = self.bus_speed #TODO ideally dont need transction to know bus speed self._events.append(e) - self._events = _sort_events_by_time(self._events) + #self._events = _sort_events_by_time(self._events) def pop_event(self, e): self.events.pop(0) diff --git a/tests/usb_transaction.py b/tests/usb_transaction.py index 6bae2876..0825d10d 100644 --- a/tests/usb_transaction.py +++ b/tests/usb_transaction.py @@ -1,13 +1,54 @@ from usb_event import UsbEvent +from usb_packet import USB_PID, TokenPacket, TxDataPacket, RxHandshakePacket +from usb_phy import USB_DATA_VALID_COUNT + +INTER_TRANSACTION_DELAY = 500 + + +def CounterByte(length = 0): + l = 0 + while l < length: + yield l % 256 + l += 1 class UsbTransaction(UsbEvent): - def __init__(self, endpointAddress = 0, endpointType = "BULK", eventTime = 0): # TODO Enum when we move to py3 - self._endpointAddress = endpointAddress + def __init__(self, deviceAddress = 0, endpointNumber = 0, endpointType = "BULK", + direction="OUT", bus_speed="HS", eventTime = 0, dataLength = 0, data_fn = CounterByte): # TODO Enums when we move to py3 + + self._deviceAddress = deviceAddress + self._endpointNumber = endpointNumber self._endpointType = endpointType + self._direction = direction + self._datalength = dataLength + self._bus_speed = bus_speed + + + dataValidCount = USB_DATA_VALID_COUNT[self.bus_speed] + + # Populate packet list for a (valid) transaction self._packets = [] + self._packets.append(TokenPacket(interPktGap = INTER_TRANSACTION_DELAY, + pid = USB_PID["OUT"], + address = self._deviceAddress, + endpoint = self._endpointNumber, + data_valid_count = dataValidCount)) + + # Generate packet data payload + packetPayload = [x for x in data_fn(dataLength)] + + # TODO FIXME + pid = USB_PID["DATA0"]; + + # Add data packet to packets list + self._packets.append(TxDataPacket(pid=pid, dataPayload = packetPayload)) + + # Add handshake packet to packets list + self._packets.append(RxHandshakePacket()) + super(UsbTransaction, self).__init__(time = eventTime) + @property def endpointAddress(self): @@ -21,8 +62,41 @@ def endpointType(self): def packets(self): return self._packets + @property + def bus_speed(self): + return self._bus_speed + + @bus_speed.setter + def bus_speed(self, bus_speed): + self._bus_speed = bus_speed + + @property + def event_count(self): + eventCount = 0 + + # We should be able to do len(packets) but lets just be sure.. + for p in self.packets: + eventCount += p.event_count + + # Sanity check + assert eventCount == len(self.packets) + + return eventCount + + def expected_output(self, offset): + expected_output = "" + + for i, p in enumerate(self.packets): + expected_output += "Packet {}: ".format(i+offset) + expected_output += p.expected_output + expected_output += "\n" + + return expected_output + def __str__(self): - s = "UsbTransaction " - for p in self._packets: - s += str(p) + s = "UsbTransaction:\n" + for p in self.packets: + s += "\t" + str(p) + "\n" return s + + # PID: Packet ID From e25b08f4282d54a74d7153f65ec458bdfb3465b6 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 29 Mar 2021 17:44:55 +0100 Subject: [PATCH 212/520] Further updates to adding usb events --- .gitignore | 1 + tests/helpers.py | 34 +++++++++++++--------------------- tests/usb_packet.py | 10 ++++++++-- tests/usb_phy.py | 22 ++++++++++++++-------- tests/usb_session.py | 2 +- tests/usb_transaction.py | 13 +++++++------ 6 files changed, 44 insertions(+), 38 deletions(-) diff --git a/.gitignore b/.gitignore index 2f1ede2f..9c01cf3c 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,4 @@ tests/bin.txt tests/log tests/test_**/**test_xs2.xn tests/test_**/**test_xs3.xn +**/venv/** diff --git a/tests/helpers.py b/tests/helpers.py index 759a33a5..d63e1042 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -83,7 +83,7 @@ def runall_rx(test_fn): if run_on(arch=_arch): if run_on(busspeed=_busspeed): (clk_60, usb_phy) = get_usb_clk_phy(verbose=False, arch=_arch) - test_fn(_arch, clk_60, usb_phy, USB_DATA_VALID_COUNT[_busspeed], _busspeed, seed) + test_fn(_arch, clk_60, usb_phy, USB_DATA_VALID_COUNT[_busspeed], _busspeed, seed, verbose=args.verbose) def do_usb_test(arch, clk, phy, usb_speed, sessions, test_file, seed, level='nightly', extra_tasks=[], verbose=False): @@ -113,13 +113,13 @@ def do_usb_test(arch, clk, phy, usb_speed, sessions, test_file, seed, test=testname, n=len(events), arch=arch, clk=clk.get_name(), speed=usb_speed, seed=seed) - phy.set_packets(session.events) + phy.events = session.events expect_folder = create_if_needed("expect") expect_filename = '{folder}/{test}_{arch}.expect'.format( folder=expect_folder, test=testname, phy=phy.name, clk=clk.get_name(), arch=arch) - create_expect(arch, session.events, expect_filename) + create_expect(arch, session.events, expect_filename, verbose=verbose) tester = xmostest.ComparisonTester(open(expect_filename), 'lib_xud', 'xud_sim_tests', testname, @@ -133,32 +133,24 @@ def do_usb_test(arch, clk, phy, usb_speed, sessions, test_file, seed, tester=tester, simargs=simargs) -def create_expect(arch, events, filename): +def create_expect(arch, events, filename, verbose = False): """ Create the expect file for what packets should be reported by the DUT """ with open(filename, 'w') as f: + + packet_offset = 0 + for i, event in enumerate(events): - packet_offset = 0 - expect_str = event.expected_output(0) - expect_str += "\n" - + expect_str = event.expected_output(offset = packet_offset) packet_offset += event.event_count - - print str(expect_str) - f.write(str(expect_str)) - #print str(expect) - #if isinstance(event, RxPacket): - # print "Rx Packet" - # f.write("Receiving packet {}\n".format(i)) - # - - # for (i, byte) in enumerate(packet.get_bytes(do_tokens=do_tokens)): - # f.write("Received byte: {0:#x}\n".format(byte)) - #else: - # f.write("Phy transmitting packet {} PID: {} ({})\n".format(i, event.get_pid_pretty(), event.pid)) + if verbose: + print "EXPECTED:" + print str(expect_str) + + f.write(str(expect_str)) f.write("Test done\n") diff --git a/tests/usb_packet.py b/tests/usb_packet.py index affaba40..2aacb1a1 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -266,7 +266,11 @@ def get_timeout(self): @property def expected_output(self): - expected_output = "DEVICE -> HOST" + expected_output = "DEVICE -> HOST\n" + + for (i, byte) in enumerate(self.get_bytes()): + expected_output += "\tRX byte: {0:#x}\n".format(byte) + "\n" + return expected_output @@ -286,7 +290,9 @@ def get_inter_pkt_gap(self): @property def expected_output(self): - expected_output = "HOST -> DEVICE" + expected_output = "HOST -> DEVICE\n" + expected_output += "PID: {} ({:#x})\n".format(self.get_pid_str(), self.pid) + return expected_output # Implemented such that we can generate malformed packets diff --git a/tests/usb_phy.py b/tests/usb_phy.py index 042eaeec..28b447e1 100644 --- a/tests/usb_phy.py +++ b/tests/usb_phy.py @@ -25,7 +25,7 @@ def __init__(self, name, rxd, rxa, rxdv, rxer, txd, txv, txrdy, ls0, ls1, clock, self._txrdy = txrdy self.ls0 = ls0 self.ls1 = ls1 - self._packets = [] + self._events = [] self._clock = clock self._initial_delay = initial_delay self._verbose = verbose @@ -41,7 +41,15 @@ def name(self): @property def clock(self): return self._clock + + @property + def events(self): + return self._events + @events.setter + def events(self, events): + self._events = events + def start_test(self): self.wait_until(self.xsi.get_time() + self._initial_delay) self.wait(lambda x: self._clock.is_high()) @@ -49,7 +57,7 @@ def start_test(self): def end_test(self): if self._verbose: - print "All packets sent" + print "All events sent" if self._complete_fn: self._complete_fn(self) @@ -63,7 +71,7 @@ def end_test(self): if self._expect_loopback: # If looping back then take into account all the data - total_packet_bytes = sum([len(packet.get_bytes()) for packet in self._packets]) + total_packet_bytes = sum([len(packet.get_bytes()) for packet in self.events]) total_data_bits = total_packet_bytes * 8 # Allow 2 cycles per bit @@ -72,7 +80,7 @@ def end_test(self): # The clock ticks are 2ns long timeout_time *= 2 - # The packets are copied to and from the user application + # The events are copied to and from the user application timeout_time *= 2 self.wait_until(self.xsi.get_time() + timeout_time) @@ -90,8 +98,6 @@ def end_test(self): def set_clock(self, clock): self._clock = clock - def set_packets(self, packets): - self._packets = packets def drive_error(self, value): self.xsi.drive_port_pins(self._rxer, value) @@ -102,7 +108,7 @@ def run(self): self.start_test() - for i,packet in enumerate(self._packets): + for i,packet in enumerate(self.events): if isinstance(packet, RxPacket): @@ -172,7 +178,7 @@ def run(self): if xsi.sample_port_pins(self._txv) == 1: print "ERROR: Unexpected packet from xCORE" - rxv_count = packet.get_data_valid_count(); + rxv_count = packet.data_valid_count #print "Waiting for inter_pkt_gap: {i}".format(i=packet.inter_frame_gap) self.wait_until(xsi.get_time() + packet.inter_pkt_gap) diff --git a/tests/usb_session.py b/tests/usb_session.py index e6e26e1e..c9838640 100644 --- a/tests/usb_session.py +++ b/tests/usb_session.py @@ -32,7 +32,7 @@ def data_valid_count(self): def __str__(self): - s = "USB Session\n" + s = "" for e in self._events: s += str(self._events.index(e)) + ": " diff --git a/tests/usb_transaction.py b/tests/usb_transaction.py index 0825d10d..b57b3e8e 100644 --- a/tests/usb_transaction.py +++ b/tests/usb_transaction.py @@ -23,9 +23,6 @@ def __init__(self, deviceAddress = 0, endpointNumber = 0, endpointType = "BULK", self._direction = direction self._datalength = dataLength self._bus_speed = bus_speed - - - dataValidCount = USB_DATA_VALID_COUNT[self.bus_speed] # Populate packet list for a (valid) transaction self._packets = [] @@ -33,7 +30,7 @@ def __init__(self, deviceAddress = 0, endpointNumber = 0, endpointType = "BULK", pid = USB_PID["OUT"], address = self._deviceAddress, endpoint = self._endpointNumber, - data_valid_count = dataValidCount)) + data_valid_count = self.data_valid_count)) # Generate packet data payload packetPayload = [x for x in data_fn(dataLength)] @@ -48,7 +45,11 @@ def __init__(self, deviceAddress = 0, endpointNumber = 0, endpointType = "BULK", self._packets.append(RxHandshakePacket()) super(UsbTransaction, self).__init__(time = eventTime) - + + # TODO ideally USBTransaction doesnt know about data_valid_count + @property + def data_valid_count(self): + return USB_DATA_VALID_COUNT[self.bus_speed] @property def endpointAddress(self): @@ -83,7 +84,7 @@ def event_count(self): return eventCount - def expected_output(self, offset): + def expected_output(self, offset=0): expected_output = "" for i, p in enumerate(self.packets): From eab743a377d90383049ed0ace64eb4ea145fc465 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 31 Mar 2021 18:13:56 +0100 Subject: [PATCH 213/520] Added interEventDelay to USBEvent. Tests still not running. --- tests/usb_event.py | 8 +++++++- tests/usb_phy.py | 2 +- tests/usb_transaction.py | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/usb_event.py b/tests/usb_event.py index 243289b8..3405c65d 100644 --- a/tests/usb_event.py +++ b/tests/usb_event.py @@ -3,8 +3,9 @@ class UsbEvent(object): - def __init__(self, time=0): + def __init__(self, time=0, interEventDelay= 1): #TODO set delay to sensible default self._time = time + self._interEventDelay = interEventDelay @property def time(self): @@ -18,3 +19,8 @@ def expected_output(self): @abc.abstractproperty def eventcount(self): pass + + # TODO so we want to use relative delays or absolute times? + @property + def interEventDelay(self): + return self._interEventDelay diff --git a/tests/usb_phy.py b/tests/usb_phy.py index 28b447e1..baf2510e 100644 --- a/tests/usb_phy.py +++ b/tests/usb_phy.py @@ -181,7 +181,7 @@ def run(self): rxv_count = packet.data_valid_count #print "Waiting for inter_pkt_gap: {i}".format(i=packet.inter_frame_gap) - self.wait_until(xsi.get_time() + packet.inter_pkt_gap) + self.wait_until(xsi.get_time() + packet.interEventDelay) print "Phy transmitting packet {} PID: {} ({})".format(i, packet.get_pid_pretty(), packet.pid) if self._verbose: diff --git a/tests/usb_transaction.py b/tests/usb_transaction.py index b57b3e8e..3673e441 100644 --- a/tests/usb_transaction.py +++ b/tests/usb_transaction.py @@ -15,7 +15,7 @@ def CounterByte(length = 0): class UsbTransaction(UsbEvent): def __init__(self, deviceAddress = 0, endpointNumber = 0, endpointType = "BULK", - direction="OUT", bus_speed="HS", eventTime = 0, dataLength = 0, data_fn = CounterByte): # TODO Enums when we move to py3 + direction="OUT", bus_speed="HS", eventTime = 0, dataLength = 0, data_fn = CounterByte, interEventDelay=500): # TODO Enums when we move to py3 self._deviceAddress = deviceAddress self._endpointNumber = endpointNumber @@ -44,7 +44,7 @@ def __init__(self, deviceAddress = 0, endpointNumber = 0, endpointType = "BULK", # Add handshake packet to packets list self._packets.append(RxHandshakePacket()) - super(UsbTransaction, self).__init__(time = eventTime) + super(UsbTransaction, self).__init__(time = eventTime, interEventDelay = interEventDelay) # TODO ideally USBTransaction doesnt know about data_valid_count @property From 8c840fc4710b5545937febf571a3c8bc241a4f13 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 1 Apr 2021 14:05:01 +0100 Subject: [PATCH 214/520] Further tides to python testbench. Non-working state. --- tests/helpers.py | 3 +- tests/usb_event.py | 15 ++++-- tests/usb_packet.py | 122 +++++++++++++++++++++++++++++++++++--------- tests/usb_phy.py | 11 ++-- 4 files changed, 119 insertions(+), 32 deletions(-) diff --git a/tests/helpers.py b/tests/helpers.py index d63e1042..a9211aad 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -147,8 +147,7 @@ def create_expect(arch, events, filename, verbose = False): packet_offset += event.event_count if verbose: - print "EXPECTED:" - print str(expect_str) + print str(expect_str), f.write(str(expect_str)) diff --git a/tests/usb_event.py b/tests/usb_event.py index 3405c65d..e7629228 100644 --- a/tests/usb_event.py +++ b/tests/usb_event.py @@ -7,20 +7,27 @@ def __init__(self, time=0, interEventDelay= 1): #TODO set delay to sensible defa self._time = time self._interEventDelay = interEventDelay + #TODO so we want to use relative delays or absolute times? @property def time(self): return self._time + + @property + def interEventDelay(self): + return self._interEventDelay @abc.abstractmethod def expected_output(self): pass + # Drive event to simulator + @abc.abstractmethod + def drive(self, xsi): + pass + #Note, an event might contain events @abc.abstractproperty def eventcount(self): pass - # TODO so we want to use relative delays or absolute times? - @property - def interEventDelay(self): - return self._interEventDelay + diff --git a/tests/usb_packet.py b/tests/usb_packet.py index 2aacb1a1..309c1bad 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -67,9 +67,7 @@ RXA_START_DELAY = 5 #Taken from RTL sim RX_RX_DELAY = 40 -#PID_DATA1 = 0xb -#PID_DATA0 = 0x3 - +#TODO shoud we have a PID class? USB_PID = { "OUT": 0xE1, "IN" : 0x69, @@ -81,9 +79,6 @@ "ACK" : 0xD2 } - - - def AppendSetupToken(packets, ep, address, **kwargs): ipg = kwargs.pop('inter_pkt_gap', 500) AppendTokenPacket(packets, 0x2d, ep, ipg, address, **kwargs) @@ -226,33 +221,34 @@ def __init__(self, **kwargs): # Lowest base class for all packets. All USB packets have: # - a PID # - some (or none) data bytes -class UsbPacket(object): +class UsbPacket(UsbEvent): def __init__(self, **kwargs): self.pid = kwargs.pop('pid', 0xc3) self.data_bytes = kwargs.pop('data_bytes', None) self.num_data_bytes = kwargs.pop('length', 0) - self.data_valid_count = kwargs.pop('data_valid_count', 0) + self._data_valid_count = kwargs.pop('data_valid_count', 0) self.bad_crc = kwargs.pop('bad_crc', False) + ied = kwargs.pop('interEventDelay', 500) #TODO RM magic number + super(UsbPacket, self).__init__(interEventDelay = ied) - def get_data_valid_count(self): - return self.data_valid_count + #@property + #def data_valid_count(self): + # return self._data_valid_count + + @property + def event_count(self): + return 1 def __str__(self): - return "USBPacket" def get_pid_str(self): - for key, value in USB_PID.iteritems(): if value == self.pid: return key - return "UNKNOWN" - @property - def event_count(self): - return 1 #Rx to host i.e. xCORE Tx class RxPacket(UsbPacket): @@ -269,32 +265,112 @@ def expected_output(self): expected_output = "DEVICE -> HOST\n" for (i, byte) in enumerate(self.get_bytes()): - expected_output += "\tRX byte: {0:#x}\n".format(byte) + "\n" + expected_output += "\tRX byte: {0:#x}\n".format(byte) return expected_output + def drive(self, xsi): + print "RxPacket:Drive()" + #Tx from host i.e. xCORE Rx class TxPacket(UsbPacket): def __init__(self, **kwargs): - self.inter_pkt_gap = kwargs.pop('inter_pkt_gap', RX_RX_DELAY) #13 lowest working for single issue loopback + #self.inter_pkt_gap = kwargs.pop('inter_pkt_gap', RX_RX_DELAY) #13 lowest working for single issue loopback self.rxa_start_delay = kwargs.pop('rxa_start_delay', 2) self.rxa_end_delay = kwargs.pop('rxa_end_delay', RXA_END_DELAY) self.rxe_assert_time = kwargs.pop('rxe_assert_time', 0) self.rxe_assert_length = kwargs.pop('rxe_assert_length', 1) super(TxPacket, self).__init__(**kwargs) - def get_inter_pkt_gap(self): - return self.inter_pkt_gap - @property def expected_output(self): expected_output = "HOST -> DEVICE\n" - expected_output += "PID: {} ({:#x})\n".format(self.get_pid_str(), self.pid) - + expected_output += "\tPID: {} ({:#x})\n".format(self.get_pid_str(), self.pid) return expected_output + def drive(self, usb_phy, verbose = True): + print "TxPacket:Drive()" + + xsi = usb_phy.xsi + wait = usb_phy.wait + + # xCore should not be trying to send if we are trying to send.. + if xsi.sample_port_pins(usb_phy._txv) == 1: + print "ERROR: Unexpected packet from xCORE" + + print "X" + rxv_count = self.data_valid_count + + print "Waiting for interEventDelay {i}".format(i=self.interEventDelay) + usb_phy.wait_until(xsi.get_time() + self.interEventDelay) + + print str(self.pid) + print "Phy transmitting packet PID: {} ({})".format(self.get_pid_str(), self.pid) + + # Set RXA high to USB shim + xsi.drive_periph_pin(usb_phy._rxa, 1) + + # Wait for RXA start delay + rxa_start_delay = RXA_START_DELAY; + + while rxa_start_delay != 0: + wait(lambda x: usb_phy._clock.is_high()) + wait(lambda x: usb_phy._clock.is_low()) + rxa_start_delay = rxa_start_delay- 1; + + for (i, byte) in enumerate(self.get_bytes(do_tokens = False)): + + # xCore should not be trying to send if we are trying to send.. + if xsi.sample_port_pins(usb_phy._txv) == 1: + print "ERROR: Unexpected packet from xCORE" + + wait(lambda x: usb_phy._clock.is_low()) + wait(lambda x: usb_phy._clock.is_high()) + wait(lambda x: usb_phy._clock.is_low()) + xsi.drive_periph_pin(self._rxdv, 1) + xsi.drive_periph_pin(self._rxd, byte) + + if (self.rxe_assert_time != 0) and (self.rxe_assert_time == i): + xsi.drive_periph_pin(self._rxer, 1) + + while rxv_count != 0: + wait(lambda x: self._clock.is_high()) + wait(lambda x: self._clock.is_low()) + xsi.drive_periph_pin(self._rxdv, 0) + rxv_count = rxv_count - 1 + + # xCore should not be trying to send if we are trying to send.. + if xsi.sample_port_pins(self._txv) == 1: + print "ERROR: Unexpected packet from xCORE" + + #print "Sending byte {0:#x}".format(byte) + + rxv_count = self.data_valid_count; + + # Wait for last byte + wait(lambda x: usb_phy._clock.is_high()) + wait(lambda x: usb_phy._clock.is_low()) + + xsi.drive_periph_pin(usb_phy._rxdv, 0) + xsi.drive_periph_pin(usb_phy._rxer, 0) + + rxa_end_delay = self.rxa_end_delay + + while rxa_end_delay != 0: + # Wait for RXA fall delay TODO, this should be configurable + wait(lambda x: usb_phy._clock.is_high()) + wait(lambda x: usb_phy._clock.is_low()) + rxa_end_delay = rxa_end_delay - 1 + + # xCore should not be trying to send if we are trying to send.. + if xsi.sample_port_pins(self._txv) == 1: + print "ERROR: Unexpected packet from xCORE" + + xsi.drive_periph_pin(usb_phy._rxa, 0) + + # Implemented such that we can generate malformed packets def get_bytes(self, do_tokens=False): bytes = [] diff --git a/tests/usb_phy.py b/tests/usb_phy.py index baf2510e..85ca4058 100644 --- a/tests/usb_phy.py +++ b/tests/usb_phy.py @@ -2,7 +2,7 @@ import xmostest import sys import zlib -from usb_packet import RxPacket, TokenPacket +from usb_packet import RxPacket, TokenPacket, USB_PID import usb_packet USB_DATA_VALID_COUNT = {'FS': 39, "HS": 0} @@ -109,6 +109,8 @@ def run(self): self.start_test() for i,packet in enumerate(self.events): + + event = packet #TODO RM ME if isinstance(packet, RxPacket): @@ -173,7 +175,9 @@ def run(self): else: #TxPacket (which could be a TxToken or TxDataPacket) - + + event.drive(self) + ''' # xCore should not be trying to send if we are trying to send.. if xsi.sample_port_pins(self._txv) == 1: print "ERROR: Unexpected packet from xCORE" @@ -183,7 +187,7 @@ def run(self): #print "Waiting for inter_pkt_gap: {i}".format(i=packet.inter_frame_gap) self.wait_until(xsi.get_time() + packet.interEventDelay) - print "Phy transmitting packet {} PID: {} ({})".format(i, packet.get_pid_pretty(), packet.pid) + print "Phy transmitting packet {} PID: {} ({})".format(i, USB_PID[packet.pid], packet.pid) if self._verbose: sys.stdout.write(packet.dump()) @@ -253,6 +257,7 @@ def run(self): #if self._verbose: #print "Sent" + ''' print "Test done" self.end_test() From 7f1971c495f837505de317fa4b6801431b60a2c7 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 1 Apr 2021 14:05:27 +0100 Subject: [PATCH 215/520] Updates to usb_transaction. Non-working state --- tests/usb_transaction.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/usb_transaction.py b/tests/usb_transaction.py index 3673e441..d6cac075 100644 --- a/tests/usb_transaction.py +++ b/tests/usb_transaction.py @@ -24,9 +24,10 @@ def __init__(self, deviceAddress = 0, endpointNumber = 0, endpointType = "BULK", self._datalength = dataLength self._bus_speed = bus_speed + # TODO IN TRANSACTION # Populate packet list for a (valid) transaction self._packets = [] - self._packets.append(TokenPacket(interPktGap = INTER_TRANSACTION_DELAY, + self._packets.append(TokenPacket(interEventDelay = INTER_TRANSACTION_DELAY, pid = USB_PID["OUT"], address = self._deviceAddress, endpoint = self._endpointNumber, @@ -89,8 +90,8 @@ def expected_output(self, offset=0): for i, p in enumerate(self.packets): expected_output += "Packet {}: ".format(i+offset) - expected_output += p.expected_output - expected_output += "\n" + expected_output += "\t" + p.expected_output + #expected_output += "\n" return expected_output @@ -100,4 +101,7 @@ def __str__(self): s += "\t" + str(p) + "\n" return s - # PID: Packet ID + def drive(self, xsi): + for i, p in enumerate(self.packets): + p.drive(xsi) + From b279d652f224671ba3779bea59a775b1b80d3979 Mon Sep 17 00:00:00 2001 From: Dave Atkinson Date: Thu, 1 Apr 2021 14:08:00 +0100 Subject: [PATCH 216/520] Rename FUNC_ALIGN[0-9]\+ to FUNCTION_ALIGNMENT --- lib_xud/src/core/XUD_AlignmentDefines.h | 6 ++---- lib_xud/src/core/XUD_IoLoop.S | 10 +++++----- lib_xud/src/core/XUD_UIFM_RegAccess.S | 2 +- lib_xud/src/core/XUD_USBTile_Support.S | 4 ++-- lib_xud/src/core/included/XUD_Token_In.S | 6 +++--- lib_xud/src/core/included/XUD_Token_In_DI.S | 8 ++++---- lib_xud/src/core/included/XUD_Token_Out.S | 6 +++--- lib_xud/src/core/included/XUD_Token_Out_DI.S | 6 +++--- lib_xud/src/core/included/XUD_Token_Ping.S | 2 +- lib_xud/src/core/included/XUD_Token_SOF.S | 4 ++-- lib_xud/src/core/included/XUD_Token_Setup.S | 2 +- .../src/core/included/XUD_Token_Setup_DI.S | 2 +- lib_xud/src/user/client/XUD_EpFuncs.S | 20 +++++++++---------- 13 files changed, 38 insertions(+), 40 deletions(-) diff --git a/lib_xud/src/core/XUD_AlignmentDefines.h b/lib_xud/src/core/XUD_AlignmentDefines.h index 67834e71..2c3d1f26 100644 --- a/lib_xud/src/core/XUD_AlignmentDefines.h +++ b/lib_xud/src/core/XUD_AlignmentDefines.h @@ -14,11 +14,9 @@ #endif #if IBUFFER_FETCH_CORRECTION == 1 -#define FUNC_ALIGN4 16 -#define FUNC_ALIGN8 16 +#define FUNCTION_ALIGNMENT 16 #elif IBUFFER_FETCH_CORRECTION == 0 -#define FUNC_ALIGN4 4 -#define FUNC_ALIGN8 8 +#define FUNCTION_ALIGNMENT 4 #else #error IBUFFER_FETCH_CORRECTION not defined #endif diff --git a/lib_xud/src/core/XUD_IoLoop.S b/lib_xud/src/core/XUD_IoLoop.S index 9f13bd64..c2033861 100755 --- a/lib_xud/src/core/XUD_IoLoop.S +++ b/lib_xud/src/core/XUD_IoLoop.S @@ -70,7 +70,7 @@ suspend_t_wtwrsths: .text .cc_top UsbTestModeHandler_asm.func, UsbTestModeHandler_asm .issue_mode single -.align FUNC_ALIGN4 +.align FUNCTION_ALIGNMENT UsbTestModeHandler_asm: ENTSP_lu6 0 clrsr 0x18 @@ -100,7 +100,7 @@ UsbTestModeHandler_asm: .text .cc_top ResetIntHandler.func, ResetIntHandler .issue_mode dual -.align FUNC_ALIGN4 +.align FUNCTION_ALIGNMENT ResetIntHandler: DUALENTSP_lu6 0 clrsr 0x18 // Clear InInterrupt bit (and InKernel) @@ -160,7 +160,7 @@ waitforRXALow0: setc res[RXD], XS1_SETC_RUN_CLRBUF bu Loop_BadPid -.align FUNC_ALIGN4 +.align FUNCTION_ALIGNMENT XUD_LLD_IoLoop: DUALENTSP_lu6 STACK_EXTEND stw r4, sp[1] @@ -304,7 +304,7 @@ SetupSuspendResetTimer: bu NextToken // Main IO Loop -.align FUNC_ALIGN8 +.align FUNCTION_ALIGNMENT .skip 0 NextToken: ldc r9, 0xa001 // CRC16 poly, used in doRxData @@ -348,7 +348,7 @@ XUD_InvalidTok_waitforRXALow: setc res[RXD], XS1_SETC_RUN_CLRBUF bu Loop_BadPid // Invalid token received Ignore unknown toks -.align FUNC_ALIGN4 +.align FUNCTION_ALIGNMENT Return: clre ldw r11, sp[STACK_SUSPEND_TIMER] // Free suspend/reset timer diff --git a/lib_xud/src/core/XUD_UIFM_RegAccess.S b/lib_xud/src/core/XUD_UIFM_RegAccess.S index e5ff41a1..f5a8c355 100644 --- a/lib_xud/src/core/XUD_UIFM_RegAccess.S +++ b/lib_xud/src/core/XUD_UIFM_RegAccess.S @@ -18,7 +18,7 @@ .globl XUD_UIFM_Enable, "f{ui}(ui)" .type XUD_UIFM_Enable, @function .cc_top XUD_UIFM_Enable.function -.align FUNC_ALIGN4 +.align FUNCTION_ALIGNMENT // void XUD_UIFM_Enable (unsigned mode); XUD_UIFM_Enable: ldc r1, XS1_PS_XCORE_CTRL0 diff --git a/lib_xud/src/core/XUD_USBTile_Support.S b/lib_xud/src/core/XUD_USBTile_Support.S index a69fefdb..20124539 100644 --- a/lib_xud/src/core/XUD_USBTile_Support.S +++ b/lib_xud/src/core/XUD_USBTile_Support.S @@ -16,7 +16,7 @@ .globl XUD_EnableUsbPortMux, "f{ui}()" .type XUD_EnableUsbPortMux, @function .cc_top XUD_EnableUsbPortMux.function -.align FUNC_ALIGN4 +.align FUNCTION_ALIGNMENT // void XUD_EnableUsbPortMux (unsigned mode); XUD_EnableUsbPortMux: .issue_mode single @@ -48,7 +48,7 @@ XUD_EnableUsbPortMux: .globl XUD_DisableUsbPortMux, "f{ui}()" .type XUD_DisableUsbPortMux, @function .cc_top XUD_DisableUsbPortMux.function -.align FUNC_ALIGN4 +.align FUNCTION_ALIGNMENT // void XUD_DisableUsbPortMux (unsigned mode); XUD_DisableUsbPortMux: ldc r1, XS1_PS_XCORE_CTRL0 diff --git a/lib_xud/src/core/included/XUD_Token_In.S b/lib_xud/src/core/included/XUD_Token_In.S index ec4072c3..92d93657 100755 --- a/lib_xud/src/core/included/XUD_Token_In.S +++ b/lib_xud/src/core/included/XUD_Token_In.S @@ -21,7 +21,7 @@ // R2 : TXD // R1 : Valid Token Port // R0 : RXD -.align FUNC_ALIGN4 +.align FUNCTION_ALIGNMENT InNotReady: ldw r11, sp[SP_EPTYPES_OUT] ldw r11, r11[r10] // Load EP Type @@ -220,7 +220,7 @@ WaitForHandshake: // Wait for timeout or handshake // We sent some data but the host didn't handshake in time. Needs a re-send. -.align FUNC_ALIGN4 +.align FUNCTION_ALIGNMENT TxHandshakeTimeOut: in r11, res[r1] // This will clear port time edu res[r1] @@ -228,7 +228,7 @@ TxHandshakeTimeOut: bu BadHandShake // Transmitted data, and got something back within the timeout. Check for valid handshake... -.align FUNC_ALIGN4 +.align FUNCTION_ALIGNMENT TxHandShakeReceived: XUD_IN_RxAck: in r11, res[RXD] // Input data from RXD port diff --git a/lib_xud/src/core/included/XUD_Token_In_DI.S b/lib_xud/src/core/included/XUD_Token_In_DI.S index 03fee3e5..560d2d3e 100755 --- a/lib_xud/src/core/included/XUD_Token_In_DI.S +++ b/lib_xud/src/core/included/XUD_Token_In_DI.S @@ -21,7 +21,7 @@ // R2 : TXD // R1 : Valid Token Port // R0 : RXD -.align FUNC_ALIGN4 +.align FUNCTION_ALIGNMENT InNotReady: ldw r11, sp[STACK_EPTYPES_IN] ldw r11, r11[r10] // Load EP Type @@ -36,7 +36,7 @@ XUD_IN_TxNak: // Non-Iso outpw res[TXD], r11, 8 #include "XUD_TokenJmp.S" -.align FUNC_ALIGN8 +.align FUNCTION_ALIGNMENT Pid_In: #include "XUD_CrcAddrCheck.S" ldaw r3, r10[4] // R3 = R10 + 16 @@ -111,14 +111,14 @@ WaitForHandshake: // Wait for timeout or handshake waiteu // We sent some data but the host didn't handshake in time. Needs a re-send. -.align FUNC_ALIGN4 +.align FUNCTION_ALIGNMENT TxHandshakeTimeOut: in r11, res[r1] // This will clear port time edu res[r1] {edu res[RXD]; bu BadHandshake} // Transmitted data, and got something back within the timeout. Check for valid handshake... -.align FUNC_ALIGN4 +.align FUNCTION_ALIGNMENT TxHandShakeReceived: XUD_IN_RxAck: in r11, res[RXD] // Input data from RXD port diff --git a/lib_xud/src/core/included/XUD_Token_Out.S b/lib_xud/src/core/included/XUD_Token_Out.S index e7a32550..9ffec794 100755 --- a/lib_xud/src/core/included/XUD_Token_Out.S +++ b/lib_xud/src/core/included/XUD_Token_Out.S @@ -7,7 +7,7 @@ #define RXD r0 #define TXD r2 -.align FUNC_ALIGN8 +.align FUNCTION_ALIGNMENT .skip 0 Pid_Out: #include "XUD_CrcAddrCheck.S" @@ -66,7 +66,7 @@ JumpOnPid_: bau r11 #endif -.align FUNC_ALIGN4 +.align FUNCTION_ALIGNMENT .skip 0 DoOutNonIso: bl doRXData @@ -98,7 +98,7 @@ StoreTailDataOut: bu NextTokenAfterOut // Various Error handling functions ------------------------------------------------------------------- -.align FUNC_ALIGN4 +.align FUNCTION_ALIGNMENT Err_RxErr: // RxError signal high during data packet receive: DUALENTSP_lu 0 clrsr 3 diff --git a/lib_xud/src/core/included/XUD_Token_Out_DI.S b/lib_xud/src/core/included/XUD_Token_Out_DI.S index 2167d3e3..9b86db32 100755 --- a/lib_xud/src/core/included/XUD_Token_Out_DI.S +++ b/lib_xud/src/core/included/XUD_Token_Out_DI.S @@ -3,7 +3,7 @@ // OUT Token Packet ----------------------------------------------------------------------------- #include "XUD_AlignmentDefines.h" -.align FUNC_ALIGN8 +.align FUNCTION_ALIGNMENT .skip 0 Pid_Out: #include "XUD_CrcAddrCheck.S" @@ -26,7 +26,7 @@ InformEP_Iso: // Iso EP - no handshake {outt res[r11], r8; ldw r6, sp[STACK_RXCRC_INIT]} // CRC16 init (out) - Needs reseting after an out & Send tail length #include "XUD_TokenJmp.S" -.align FUNC_ALIGN4 +.align FUNCTION_ALIGNMENT .skip 0 DoOutNonIso: bl doRXData @@ -54,7 +54,7 @@ StoreTailDataOut: bu NextTokenAfterOut // Various Error handling functions ------------------------------------------------------------------- -.align FUNC_ALIGN4 +.align FUNCTION_ALIGNMENT Err_RxErr: // RxError signal high during data packet receive: DUALENTSP_lu6 0 clrsr 3 diff --git a/lib_xud/src/core/included/XUD_Token_Ping.S b/lib_xud/src/core/included/XUD_Token_Ping.S index 5c9c466a..29742a5b 100755 --- a/lib_xud/src/core/included/XUD_Token_Ping.S +++ b/lib_xud/src/core/included/XUD_Token_Ping.S @@ -1,7 +1,7 @@ // Copyright (c) 2011-2019, XMOS Ltd, All rights reserved #include "XUD_AlignmentDefines.h" -.align FUNC_ALIGN4 +.align FUNCTION_ALIGNMENT Pid_Ping: #include "XUD_CrcAddrCheck.S" diff --git a/lib_xud/src/core/included/XUD_Token_SOF.S b/lib_xud/src/core/included/XUD_Token_SOF.S index 3c14d558..99d09cb8 100644 --- a/lib_xud/src/core/included/XUD_Token_SOF.S +++ b/lib_xud/src/core/included/XUD_Token_SOF.S @@ -2,7 +2,7 @@ #include "XUD_AlignmentDefines.h" // Received SOF token: Reset suspend/reset detection timer -.align FUNC_ALIGN4 +.align FUNCTION_ALIGNMENT Pid_Sof: #ifdef __XS2A__ inpw r10, res[RXD], 8 // Read EP Number @@ -38,7 +38,7 @@ Pid_Sof: bu Loop_BadPid // Received SOF token: Reset suspend/reset detection timer -.align FUNC_ALIGN4 +.align FUNCTION_ALIGNMENT Pid_Sof_NoChan: #ifdef __XS2A__ inpw r10, res[RXD], 8; /* Read EP Number */ diff --git a/lib_xud/src/core/included/XUD_Token_Setup.S b/lib_xud/src/core/included/XUD_Token_Setup.S index 534bcc3b..b5d9788b 100644 --- a/lib_xud/src/core/included/XUD_Token_Setup.S +++ b/lib_xud/src/core/included/XUD_Token_Setup.S @@ -17,7 +17,7 @@ WaitForEndDataPacket: // - Data PID will always be DATA0 // - Payload will always be 8 bytes -.align FUNC_ALIGN4 +.align FUNCTION_ALIGNMENT Pid_Setup: #ifdef ARCH_L inpw r10, res[RXD], 8; // Read EP Number diff --git a/lib_xud/src/core/included/XUD_Token_Setup_DI.S b/lib_xud/src/core/included/XUD_Token_Setup_DI.S index ba088517..9fcc8759 100644 --- a/lib_xud/src/core/included/XUD_Token_Setup_DI.S +++ b/lib_xud/src/core/included/XUD_Token_Setup_DI.S @@ -5,7 +5,7 @@ // - Can't NAK a setup // - Data PID will always be DATA0 // - Payload will always be 8 bytes -.align FUNC_ALIGN4 +.align FUNCTION_ALIGNMENT Pid_Setup: #include "XUD_CrcAddrCheck.S" ldw r3, r5[r10] // Load relevant EP pointer diff --git a/lib_xud/src/user/client/XUD_EpFuncs.S b/lib_xud/src/user/client/XUD_EpFuncs.S index bfb4f546..3598078b 100644 --- a/lib_xud/src/user/client/XUD_EpFuncs.S +++ b/lib_xud/src/user/client/XUD_EpFuncs.S @@ -13,7 +13,7 @@ .section .cp.rodata,"ac", @progbits .cc_top ep_info_address.data,ep_info_address -.align FUNC_ALIGN4 +.align FUNCTION_ALIGNMENT .type ep_info_address,@object .size ep_info_address, 4 ep_info_address: @@ -29,7 +29,7 @@ ep_info_address: .type XUD_GetSetupData, @function .cc_top XUD_GetSetupData.func .issue_mode single -.align FUNC_ALIGN4 +.align FUNCTION_ALIGNMENT XUD_GetSetupData: ENTSP_lu6 4 stw r4, sp[1] @@ -143,7 +143,7 @@ XUD_GetSetupData_Reset: .globl XUD_GetData .type XUD_GetData, @function .cc_top XUD_GetData.func -.align FUNC_ALIGN4 +.align FUNCTION_ALIGNMENT XUD_GetData: #if defined(__XS2A__) || defined(__XS3A__) .issue_mode single @@ -281,7 +281,7 @@ XUD_GetDataSetupData_ResetPid: // We must reset PID toggling on .globl XUD_SetData .type XUD_SetData, @function .cc_top XUD_SetData.func -.align FUNC_ALIGN4 +.align FUNCTION_ALIGNMENT XUD_SetData: #if defined(__XS2A__) || defined(__XS3A__) .issue_mode single @@ -388,7 +388,7 @@ XUD_SetData_Reset: .globl XUD_GetData_Select .type XUD_GetData_Select, @function .cc_top XUD_GetData_Select.func -.align FUNC_ALIGN4 +.align FUNCTION_ALIGNMENT XUD_GetData_Select: #if defined(__XS2A__) || defined(__XS3A__) .issue_mode single @@ -480,7 +480,7 @@ XUD_GetData_Select_Return_Reset: .globl XUD_SetData_Select .type XUD_SetData_Select, @function .cc_top XUD_SetData_Select.func -.align FUNC_ALIGN4 +.align FUNCTION_ALIGNMENT XUD_SetData_Select: #if defined(__XS2A__) || defined(__XS3A__) .issue_mode single @@ -538,7 +538,7 @@ XUD_SetData_Select_Reset: /* R0: ep number */ .cc_top XUD_SetStallByAddr.func -.align FUNC_ALIGN4 +.align FUNCTION_ALIGNMENT XUD_SetStallByAddr: #if defined(__XS2A__) || defined(__XS3A__) .issue_mode single @@ -585,7 +585,7 @@ XUD_SetStallByAddr_OUT: /* R0: ep number */ .cc_top XUD_ClearStallByAddr.func .issue_mode single -.align FUNC_ALIGN4 +.align FUNCTION_ALIGNMENT XUD_ClearStallByAddr: ENTSP_lu6 0 ldc r2, USB_PIDn_NAK @@ -648,7 +648,7 @@ XUD_ClearStallByAddr_ResetDataPid: // Reset DATA PID to DATA0 /* R0: ep number */ .cc_top XUD_ResetEpStateByAddr.func -.align FUNC_ALIGN4 +.align FUNCTION_ALIGNMENT XUD_ResetEpStateByAddr: #if defined(__XS2A__) || defined(__XS3A__) .issue_mode single @@ -703,7 +703,7 @@ NoOffset: .type XUD_SetTestMode, @function .cc_top XUD_SetTestMode.func -.align FUNC_ALIGN4 +.align FUNCTION_ALIGNMENT XUD_SetTestMode: #if defined(__XS2A__) || defined(__XS3A__) .issue_mode single From 90e0e539339b6096c39baf69017b8c0f72844626 Mon Sep 17 00:00:00 2001 From: Dave Atkinson Date: Thu, 1 Apr 2021 15:41:58 +0100 Subject: [PATCH 217/520] Make the 16-bit function alignment only for XS3 --- lib_xud/src/core/XUD_AlignmentDefines.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xud/src/core/XUD_AlignmentDefines.h b/lib_xud/src/core/XUD_AlignmentDefines.h index 2c3d1f26..02e91bed 100644 --- a/lib_xud/src/core/XUD_AlignmentDefines.h +++ b/lib_xud/src/core/XUD_AlignmentDefines.h @@ -7,7 +7,7 @@ #define _XUD_ALIGNMENT_DEFINES_ #if defined(__XS3A__) #define IBUFFER_FETCH_CORRECTION 1 -#elif defined(__XS2A__) +#else #define IBUFFER_FETCH_CORRECTION 0 #else #error No architecture defined From 8c1964a4e3a4009783bc80b23b6263c7220c942f Mon Sep 17 00:00:00 2001 From: Dave Atkinson <72016461+DaveAtkinsonXMOS@users.noreply.github.com> Date: Tue, 6 Apr 2021 09:32:23 +0100 Subject: [PATCH 218/520] Update XUD_AlignmentDefines.h Remove unnecessary "#else" clause. --- lib_xud/src/core/XUD_AlignmentDefines.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib_xud/src/core/XUD_AlignmentDefines.h b/lib_xud/src/core/XUD_AlignmentDefines.h index 02e91bed..de8fe096 100644 --- a/lib_xud/src/core/XUD_AlignmentDefines.h +++ b/lib_xud/src/core/XUD_AlignmentDefines.h @@ -9,8 +9,6 @@ #define IBUFFER_FETCH_CORRECTION 1 #else #define IBUFFER_FETCH_CORRECTION 0 -#else -#error No architecture defined #endif #if IBUFFER_FETCH_CORRECTION == 1 From ad08e01b8fa65876ad1b773fb014f3f1be7c1780 Mon Sep 17 00:00:00 2001 From: mbanth Date: Tue, 6 Apr 2021 13:37:32 +0100 Subject: [PATCH 219/520] Update application note makefiles to support XCORE-200 and XCORE-AI --- examples/AN00124_CDC_VCOM_class/Makefile | 43 ++++++++++------- examples/AN00125_mass_storage_class/Makefile | 41 +++++++++++----- examples/AN00126_printer_class/Makefile | 47 ++++++++++++------- examples/AN00127_video_class/Makefile | 47 ++++++++++++------- examples/AN00131_CDC_EDC_class/Makefile | 47 ++++++++++++------- examples/AN00132_image_class/Makefile | 47 ++++++++++++------- .../Makefile | 47 ++++++++++++------- examples/AN00136_vendor_specific/Makefile | 47 ++++++++++++------- 8 files changed, 230 insertions(+), 136 deletions(-) diff --git a/examples/AN00124_CDC_VCOM_class/Makefile b/examples/AN00124_CDC_VCOM_class/Makefile index 157952f5..6bc91708 100644 --- a/examples/AN00124_CDC_VCOM_class/Makefile +++ b/examples/AN00124_CDC_VCOM_class/Makefile @@ -1,32 +1,43 @@ +BUILD_FLAGS = -O3 -report -g + +XCOREAI ?= 0 +ifeq ($(XCOREAI),1) +# Xcore.ai Builds +# Use `xmake XCOREAI=1` + # The TARGET variable determines what target system the application is # compiled for. It either refers to an XN file in the source directories # or a valid argument for the --target option when compiling. +TARGET = XCORE-AI-EXPLORER -# In this case, the target depends on the build configuration. -ifeq ($(CONFIG),X200) -TARGET = XCORE-200-EXPLORER -else -TARGET = SLICEKIT-U16 -endif +# The flags passed to xcc when building the application +# You can also set the following to override flags for a particular language: +# +# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS +# +# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to +# xcc for the final link (mapping) stage. +XCC_FLAGS_xcoreai = $(BUILD_FLAGS) -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name -APP_NAME = app_usb_cdc_demo +else +# Xcore-200 Builds +# Use `xmake` +TARGET = XCORE-200-EXPLORER # The flags passed to xcc when building the application # You can also set the following to override flags for a particular language: # # XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS # -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to +# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to # xcc for the final link (mapping) stage. +XCC_FLAGS_X200 = $(BUILD_FLAGS) -DXUD_SERIES_SUPPORT=XUD_X200_SERIES +endif -# These flags define two build configurations - one for U-series and one for -# the xCORE-200 series. - -XCC_FLAGS_U = -O3 -report -DXUD_SERIES_SUPPORT=XUD_U_SERIES -g -XCC_FLAGS_X200 = -O3 -report -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -g +# The APP_NAME variable determines the name of the final .xe file. It should +# not include the .xe postfix. If left blank the name will default to +# the project name +APP_NAME = app_usb_cdc_demo # The USED_MODULES variable lists other module used by the application. USED_MODULES = lib_xud diff --git a/examples/AN00125_mass_storage_class/Makefile b/examples/AN00125_mass_storage_class/Makefile index f99c9b9d..7a451609 100644 --- a/examples/AN00125_mass_storage_class/Makefile +++ b/examples/AN00125_mass_storage_class/Makefile @@ -1,26 +1,43 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. +BUILD_FLAGS = -O3 -report -DUSE_XSCOPE=1 -fxscope -lflash -# In this case, the target depends on the build configuration. -TARGET = SLICEKIT-U16 +XCOREAI ?= 0 +ifeq ($(XCOREAI),1) +# Xcore.ai Builds +# Use `xmake XCOREAI=1` -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name -APP_NAME = app_mass_storage_demo +# The TARGET variable determines what target system the application is +# compiled for. It either refers to an XN file in the source directories +# or a valid argument for the --target option when compiling +TARGET = XCORE-AI-EXPLORER # The flags passed to xcc when building the application # You can also set the following to override flags for a particular language: # # XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS # -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to +# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to # xcc for the final link (mapping) stage. +XCC_FLAGS_xcoreai = $(BUILD_FLAGS) -# These flags define two build configurations - one for U-series +else +# Xcore-200 Builds +# Use `xmake` +TARGET = XCORE-200-EXPLORER -XCC_FLAGS_U = -O3 -report -DXUD_SERIES_SUPPORT=XUD_U_SERIES -DUSE_XSCOPE=1 -fxscope -lflash +# The flags passed to xcc when building the application +# You can also set the following to override flags for a particular language: +# +# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS +# +# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to +# xcc for the final link (mapping) stage. +XCC_FLAGS_X200 = $(BUILD_FLAGS) -DXUD_SERIES_SUPPORT=XUD_X200_SERIES +endif + +# The APP_NAME variable determines the name of the final .xe file. It should +# not include the .xe postfix. If left blank the name will default to +# the project name +APP_NAME = app_mass_storage_demo # The USED_MODULES variable lists other module used by the application. USED_MODULES = lib_xud lib_logging(>=2.0.0) lib_xassert(>=3.0.0) diff --git a/examples/AN00126_printer_class/Makefile b/examples/AN00126_printer_class/Makefile index eb235012..a5802025 100644 --- a/examples/AN00126_printer_class/Makefile +++ b/examples/AN00126_printer_class/Makefile @@ -1,32 +1,43 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. +BUILD_FLAGS = -O3 -report -DUSE_XSCOPE=1 -fxscope -# In this case, the target depends on the build configuration. -ifeq ($(CONFIG),X200) -TARGET = XCORE-200-EXPLORER -else -TARGET = SLICEKIT-U16 -endif +XCOREAI ?= 0 +ifeq ($(XCOREAI),1) +# Xcore.ai Builds +# Use `xmake XCOREAI=1` -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name -APP_NAME = app_printer_demo +# The TARGET variable determines what target system the application is +# compiled for. It either refers to an XN file in the source directories +# or a valid argument for the --target option when compiling +TARGET = XCORE-AI-EXPLORER # The flags passed to xcc when building the application # You can also set the following to override flags for a particular language: # # XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS # -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to +# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to # xcc for the final link (mapping) stage. +XCC_FLAGS_xcoreai = $(BUILD_FLAGS) -# These flags define two build configurations - one for U-series and one for -# the xCORE-200 series. +else +# Xcore-200 Builds +# Use `xmake` +TARGET = XCORE-200-EXPLORER -XCC_FLAGS_U = -O3 -report -DXUD_SERIES_SUPPORT=XUD_U_SERIES -DUSE_XSCOPE=1 -fxscope -XCC_FLAGS_X200 = -O3 -report -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -DUSE_XSCOPE=1 -fxscope +# The flags passed to xcc when building the application +# You can also set the following to override flags for a particular language: +# +# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS +# +# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to +# xcc for the final link (mapping) stage. +XCC_FLAGS_X200 = $(BUILD_FLAGS) -DXUD_SERIES_SUPPORT=XUD_X200_SERIES +endif + +# The APP_NAME variable determines the name of the final .xe file. It should +# not include the .xe postfix. If left blank the name will default to +# the project name +APP_NAME = app_printer_demo # The USED_MODULES variable lists other module used by the application. USED_MODULES = lib_xud lib_logging diff --git a/examples/AN00127_video_class/Makefile b/examples/AN00127_video_class/Makefile index dce383df..1252d2f2 100644 --- a/examples/AN00127_video_class/Makefile +++ b/examples/AN00127_video_class/Makefile @@ -1,32 +1,43 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. +BUILD_FLAGS = -O3 -report -# In this case, the target depends on the build configuration. -ifeq ($(CONFIG),X200) -TARGET = XCORE-200-EXPLORER -else -TARGET = SLICEKIT-U16 -endif +XCOREAI ?= 0 +ifeq ($(XCOREAI),1) +# Xcore.ai Builds +# Use `xmake XCOREAI=1` -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name -APP_NAME = app_video_demo +# The TARGET variable determines what target system the application is +# compiled for. It either refers to an XN file in the source directories +# or a valid argument for the --target option when compiling +TARGET = XCORE-AI-EXPLORER # The flags passed to xcc when building the application # You can also set the following to override flags for a particular language: # # XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS # -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to +# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to # xcc for the final link (mapping) stage. +XCC_FLAGS_xcoreai = $(BUILD_FLAGS) -# These flags define two build configurations - one for U-series and one for -# the xCORE-200 series. +else +# Xcore-200 Builds +# Use `xmake` +TARGET = XCORE-200-EXPLORER -XCC_FLAGS_U = -O3 -report -DXUD_SERIES_SUPPORT=XUD_U_SERIES -XCC_FLAGS_X200 = -O3 -report -DXUD_SERIES_SUPPORT=XUD_X200_SERIES +# The flags passed to xcc when building the application +# You can also set the following to override flags for a particular language: +# +# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS +# +# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to +# xcc for the final link (mapping) stage. +XCC_FLAGS_X200 = $(BUILD_FLAGS) -DXUD_SERIES_SUPPORT=XUD_X200_SERIES +endif + +# The APP_NAME variable determines the name of the final .xe file. It should +# not include the .xe postfix. If left blank the name will default to +# the project name +APP_NAME = app_video_demo # The USED_MODULES variable lists other module used by the application. USED_MODULES = lib_xud lib_logging diff --git a/examples/AN00131_CDC_EDC_class/Makefile b/examples/AN00131_CDC_EDC_class/Makefile index dab73420..3aed9b62 100644 --- a/examples/AN00131_CDC_EDC_class/Makefile +++ b/examples/AN00131_CDC_EDC_class/Makefile @@ -1,32 +1,43 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. +BUILD_FLAGS = -Wall -O3 -report -DUSE_XSCOPE=1 -fxscope -# In this case, the target depends on the build configuration. -ifeq ($(CONFIG),X200) -TARGET = XCORE-200-EXPLORER -else -TARGET = SLICEKIT-U16 -endif +XCOREAI ?= 0 +ifeq ($(XCOREAI),1) +# Xcore.ai Builds +# Use `xmake XCOREAI=1` -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name -APP_NAME = app_cdc_edc_demo +# The TARGET variable determines what target system the application is +# compiled for. It either refers to an XN file in the source directories +# or a valid argument for the --target option when compiling +TARGET = XCORE-AI-EXPLORER # The flags passed to xcc when building the application # You can also set the following to override flags for a particular language: # # XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS # -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to +# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to # xcc for the final link (mapping) stage. +XCC_FLAGS_xcoreai = $(BUILD_FLAGS) -# These flags define two build configurations - one for U-series and one for -# the xCORE-200 series. +else +# Xcore-200 Builds +# Use `xmake` +TARGET = XCORE-200-EXPLORER -XCC_FLAGS_U = -Wall -O3 -report -DXUD_SERIES_SUPPORT=XUD_U_SERIES -DUSE_XSCOPE=1 -fxscope -XCC_FLAGS_X200 = -Wall -O3 -report -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -DUSE_XSCOPE=1 -fxscope +# The flags passed to xcc when building the application +# You can also set the following to override flags for a particular language: +# +# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS +# +# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to +# xcc for the final link (mapping) stage. +XCC_FLAGS_X200 = $(BUILD_FLAGS) -DXUD_SERIES_SUPPORT=XUD_X200_SERIES +endif + +# The APP_NAME variable determines the name of the final .xe file. It should +# not include the .xe postfix. If left blank the name will default to +# the project name +APP_NAME = app_cdc_edc_demo # The USED_MODULES variable lists other module used by the application. USED_MODULES = lib_xud diff --git a/examples/AN00132_image_class/Makefile b/examples/AN00132_image_class/Makefile index 9719d880..324f5609 100644 --- a/examples/AN00132_image_class/Makefile +++ b/examples/AN00132_image_class/Makefile @@ -1,32 +1,43 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. +BUILD_FLAGS = -O3 -report -# In this case, the target depends on the build configuration. -ifeq ($(CONFIG),X200) -TARGET = XCORE-200-EXPLORER -else -TARGET = SLICEKIT-U16 -endif +XCOREAI ?= 0 +ifeq ($(XCOREAI),1) +# Xcore.ai Builds +# Use `xmake XCOREAI=1` -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name -APP_NAME = app_usb_image_demo +# The TARGET variable determines what target system the application is +# compiled for. It either refers to an XN file in the source directories +# or a valid argument for the --target option when compiling +TARGET = XCORE-AI-EXPLORER # The flags passed to xcc when building the application # You can also set the following to override flags for a particular language: # # XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS # -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to +# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to # xcc for the final link (mapping) stage. +XCC_FLAGS_xcoreai = $(BUILD_FLAGS) -# These flags define two build configurations - one for U-series and one for -# the xCORE-200 series. +else +# Xcore-200 Builds +# Use `xmake` +TARGET = XCORE-200-EXPLORER -XCC_FLAGS_U = -O3 -report -DXUD_SERIES_SUPPORT=XUD_U_SERIES -XCC_FLAGS_X200 = -O3 -report -DXUD_SERIES_SUPPORT=XUD_X200_SERIES +# The flags passed to xcc when building the application +# You can also set the following to override flags for a particular language: +# +# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS +# +# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to +# xcc for the final link (mapping) stage. +XCC_FLAGS_X200 = $(BUILD_FLAGS) -DXUD_SERIES_SUPPORT=XUD_X200_SERIES +endif + +# The APP_NAME variable determines the name of the final .xe file. It should +# not include the .xe postfix. If left blank the name will default to +# the project name +APP_NAME = app_usb_image_demo # The USED_MODULES variable lists other module used by the application. USED_MODULES = lib_xud diff --git a/examples/AN00135_test_and_measurement_class/Makefile b/examples/AN00135_test_and_measurement_class/Makefile index 3cf183ab..b4d169e3 100644 --- a/examples/AN00135_test_and_measurement_class/Makefile +++ b/examples/AN00135_test_and_measurement_class/Makefile @@ -1,32 +1,43 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. +BUILD_FLAGS = -O3 -report -# In this case, the target depends on the build configuration. -ifeq ($(CONFIG),X200) -TARGET = XCORE-200-EXPLORER -else -TARGET = SLICEKIT-U16 -endif +XCOREAI ?= 0 +ifeq ($(XCOREAI),1) +# Xcore.ai Builds +# Use `xmake XCOREAI=1` -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name -APP_NAME = app_test_and_measurement +# The TARGET variable determines what target system the application is +# compiled for. It either refers to an XN file in the source directories +# or a valid argument for the --target option when compiling +TARGET = XCORE-AI-EXPLORER # The flags passed to xcc when building the application # You can also set the following to override flags for a particular language: # # XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS # -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to +# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to # xcc for the final link (mapping) stage. +XCC_FLAGS_xcoreai = $(BUILD_FLAGS) -# These flags define two build configurations - one for U-series and one for -# the xCORE-200 series. +else +# Xcore-200 Builds +# Use `xmake` +TARGET = XCORE-200-EXPLORER -XCC_FLAGS_U = -O3 -report -DXUD_SERIES_SUPPORT=XUD_U_SERIES -XCC_FLAGS_X200 = -O3 -report -DXUD_SERIES_SUPPORT=XUD_X200_SERIES +# The flags passed to xcc when building the application +# You can also set the following to override flags for a particular language: +# +# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS +# +# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to +# xcc for the final link (mapping) stage. +XCC_FLAGS_X200 = $(BUILD_FLAGS) -DXUD_SERIES_SUPPORT=XUD_X200_SERIES +endif + +# The APP_NAME variable determines the name of the final .xe file. It should +# not include the .xe postfix. If left blank the name will default to +# the project name +APP_NAME = app_test_and_measurement # The USED_MODULES variable lists other module used by the application. USED_MODULES = lib_xud lib_logging diff --git a/examples/AN00136_vendor_specific/Makefile b/examples/AN00136_vendor_specific/Makefile index 73fe84b2..7e12bc04 100644 --- a/examples/AN00136_vendor_specific/Makefile +++ b/examples/AN00136_vendor_specific/Makefile @@ -1,32 +1,43 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. +BUILD_FLAGS = -O3 -report -# In this case, the target depends on the build configuration. -ifeq ($(CONFIG),X200) -TARGET = XCORE-200-EXPLORER -else -TARGET = SLICEKIT-U16 -endif +XCOREAI ?= 0 +ifeq ($(XCOREAI),1) +# Xcore.ai Builds +# Use `xmake XCOREAI=1` -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name -APP_NAME = app_vendor_specific_demo +# The TARGET variable determines what target system the application is +# compiled for. It either refers to an XN file in the source directories +# or a valid argument for the --target option when compiling +TARGET = XCORE-AI-EXPLORER # The flags passed to xcc when building the application # You can also set the following to override flags for a particular language: # # XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS # -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to +# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to # xcc for the final link (mapping) stage. +XCC_FLAGS_xcoreai = $(BUILD_FLAGS) -# These flags define two build configurations - one for U-series and one for -# the xCORE-200 series. +else +# Xcore-200 Builds +# Use `xmake` +TARGET = XCORE-200-EXPLORER -XCC_FLAGS_U = -O3 -report -DXUD_SERIES_SUPPORT=XUD_U_SERIES -XCC_FLAGS_X200 = -O3 -report -DXUD_SERIES_SUPPORT=XUD_X200_SERIES +# The flags passed to xcc when building the application +# You can also set the following to override flags for a particular language: +# +# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS +# +# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to +# xcc for the final link (mapping) stage. +XCC_FLAGS_X200 = $(BUILD_FLAGS) -DXUD_SERIES_SUPPORT=XUD_X200_SERIES +endif + +# The APP_NAME variable determines the name of the final .xe file. It should +# not include the .xe postfix. If left blank the name will default to +# the project name +APP_NAME = app_vendor_specific_demo # The USED_MODULES variable lists other module used by the application. USED_MODULES = lib_xud From f4bc71e524d7da929fc9050fc77dffa23d40742d Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 7 Apr 2021 16:10:33 +0100 Subject: [PATCH 220/520] Started moving tests to new session/transaction API --- tests/helpers.py | 5 ++ tests/shared_src/shared.h | 5 +- tests/test_bulk_loopback.py | 51 +++--------- tests/test_bulk_rx_basic.py | 35 +++----- tests/test_bulk_tx_basic.py | 37 +++------ tests/usb_packet.py | 116 ++++++++++++++++++++------- tests/usb_phy.py | 154 +----------------------------------- tests/usb_session.py | 48 +++++++++-- tests/usb_transaction.py | 61 +++++++++----- 9 files changed, 217 insertions(+), 295 deletions(-) diff --git a/tests/helpers.py b/tests/helpers.py index a9211aad..f25dd25f 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -141,6 +141,8 @@ def create_expect(arch, events, filename, verbose = False): packet_offset = 0 + if verbose: + print "EXPECTED OUTPUT:" for i, event in enumerate(events): expect_str = event.expected_output(offset = packet_offset) @@ -153,6 +155,9 @@ def create_expect(arch, events, filename, verbose = False): f.write("Test done\n") + if verbose: + print "Test done\n" + def get_sim_args(testname, clk, phy, arch='xs2'): sim_args = [] diff --git a/tests/shared_src/shared.h b/tests/shared_src/shared.h index a4bfa63e..83e12814 100644 --- a/tests/shared_src/shared.h +++ b/tests/shared_src/shared.h @@ -129,7 +129,10 @@ int TestEp_Tx(chanend c_in, int epNum1, unsigned start, unsigned end, t_runMode int RxDataCheck(unsigned char b[], int l, int epNum, unsigned expectedLength) { if (l != expectedLength) - return 2; + { + printf("%d %d", (unsigned) l, expectedLength); + return FAIL_RX_LENERROR; + } for (int i = 0; i < l; i++) { diff --git a/tests/test_bulk_loopback.py b/tests/test_bulk_loopback.py index 1a0a3468..14e57b44 100644 --- a/tests/test_bulk_loopback.py +++ b/tests/test_bulk_loopback.py @@ -1,57 +1,32 @@ #!/usr/bin/env python - -import random import xmostest from usb_packet import * import usb_packet -from usb_clock import Clock from helpers import do_usb_test, runall_rx +from usb_session import UsbSession +from usb_transaction import UsbTransaction -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): - rand = random.Random() - rand.seed(seed) - ep_loopback = 3 ep_loopback_kill = 2 address = 1 - - # The inter-frame gap is to give the DUT time to print its output - packets = [] - - dataval = 0; - data_pid = usb_packet.PID_DATA0 + start_length = 10 + end_length = 20 + session = UsbSession(bus_speed = usb_speed, run_enumeration = False, device_address = address) # TODO randomise packet lengths and data - for pkt_length in range(0, 20): - - AppendOutToken(packets, ep_loopback, address, data_valid_count=data_valid_count) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - - # 357 was min IPG supported on bulk loopback to not nak - # For move from sc_xud to lib_xud (14.1.2 tools) had to increase this to 377 - # Increased again due to setup/out checking - AppendInToken(packets, ep_loopback, address, data_valid_count=data_valid_count, inter_pkt_gap=417) - packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) - packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) - - data_pid = data_pid ^ 8 + for pktLength in range(start_length, end_length+1): + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep_loopback, endpointType="BULK", direction= "OUT", dataLength=pktLength)) + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep_loopback, endpointType="BULK", direction= "IN", dataLength=pktLength)) - pkt_length = 10 + pktLength = start_length #Loopback and die.. - AppendOutToken(packets, ep_loopback_kill, address, data_valid_count=data_valid_count) - packets.append(TxDataPacket(rand, data_valid_count=data_valid_count, length=pkt_length, pid=3)) #DATA0 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - - AppendInToken(packets, ep_loopback_kill, address, data_valid_count=data_valid_count, inter_pkt_gap=400) - packets.append(RxDataPacket(rand, data_valid_count=data_valid_count, length=pkt_length, pid=3)) #DATA0 - packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep_loopback_kill, endpointType="BULK", direction= "OUT", dataLength=pktLength)) + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep_loopback_kill, endpointType="BULK", direction= "IN", dataLength=pktLength)) - do_usb_test(arch, clk, phy, usb_speed, packets, __file__, seed, - level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) def runtest(): - random.seed(1) runall_rx(do_test) diff --git a/tests/test_bulk_rx_basic.py b/tests/test_bulk_rx_basic.py index f131f799..b21d8c68 100644 --- a/tests/test_bulk_rx_basic.py +++ b/tests/test_bulk_rx_basic.py @@ -6,35 +6,22 @@ import usb_packet from usb_clock import Clock from helpers import do_usb_test, runall_rx +from usb_session import UsbSession +from usb_transaction import UsbTransaction -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): - rand = random.Random() - rand.seed(seed) - +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): + ep = 1 address = 1 + start_length = 10 + end_length = 19 + + session = UsbSession(bus_speed = usb_speed, run_enumeration = False, device_address = address) - # The inter-frame gap is to give the DUT time to print its output - packets = [] - - dataval = 0; - - pid = PID_DATA0; - - for pktlength in range(10, 20): - - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=500) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pktlength, pid=pid)) - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - - if(pid == usb_packet.PID_DATA1): - pid = usb_packet.PID_DATA0; - else: - pid = usb_packet.PID_DATA1; - - dataval += pktlength + for pktLength in range(10, end_length+1): + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", eventTime=10, dataLength=pktLength)) - do_usb_test(arch, clk, phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) def runtest(): random.seed(1) diff --git a/tests/test_bulk_tx_basic.py b/tests/test_bulk_tx_basic.py index 327350e5..1119f291 100644 --- a/tests/test_bulk_tx_basic.py +++ b/tests/test_bulk_tx_basic.py @@ -3,42 +3,25 @@ import xmostest from usb_packet import * import usb_packet -from usb_clock import Clock from helpers import do_usb_test, runall_rx +from usb_session import UsbSession +from usb_transaction import UsbTransaction - -def do_test(arch, tx_clk, tx_phy, data_valid_count, usb_speed, seed): +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): rand = random.Random() rand.seed(seed) ep = 1 address = 1 + start_length = 10 + end_length = 19 + + session = UsbSession(bus_speed = usb_speed, run_enumeration = False, device_address = address) - # The inter-frame gap is to give the DUT time to print its output - packets = [] - - dataval = 0; - - pid = PID_DATA0; - - for pktlength in range(10, 20): - - AppendInToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=4000) - - packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pktlength, pid=pid)) #DATA1 - packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) - - - if(pid == usb_packet.PID_DATA1): - pid = usb_packet.PID_DATA0; - else: - pid = usb_packet.PID_DATA1; - - dataval += pktlength + for pktLength in range(10, end_length+1): + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "IN", eventTime=10, dataLength=pktLength)) - # Note, quite big gap to allow checking. - do_usb_test(arch, tx_clk, tx_phy, usb_speed, packets, __file__, seed, - level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) def runtest(): random.seed(1) diff --git a/tests/usb_packet.py b/tests/usb_packet.py index 309c1bad..6c274e43 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -73,8 +73,8 @@ "IN" : 0x69, "SETUP" : 0x2D, "PING" : 0xA5, - "DATA0" : 11, - "DATA1" : 3, + "DATA1" : 0x4b, + "DATA0" : 0xc3, "SOF" : 165, "ACK" : 0xD2 } @@ -232,9 +232,14 @@ def __init__(self, **kwargs): ied = kwargs.pop('interEventDelay', 500) #TODO RM magic number super(UsbPacket, self).__init__(interEventDelay = ied) - #@property - #def data_valid_count(self): - # return self._data_valid_count + # This is used on HOST->DEVICE (TX) packets to toggle RXValid and DEVICE->HOST (RX) packets to toggle TXReady + @property + def data_valid_count(self): + return self._data_valid_count + + @data_valid_count.setter + def data_valid_count(self, dvc): + self._data_valid_count = dvc @property def event_count(self): @@ -254,11 +259,12 @@ def get_pid_str(self): class RxPacket(UsbPacket): def __init__(self, **kwargs): - self.timeout = kwargs.pop('timeout', 25) + self._timeout = kwargs.pop('timeout', 25) super(RxPacket, self).__init__(**kwargs) - def get_timeout(self): - return self.timeout + @property + def timeout(self): + return self._timeout @property def expected_output(self): @@ -269,8 +275,65 @@ def expected_output(self): return expected_output - def drive(self, xsi): - print "RxPacket:Drive()" + def drive(self, usb_phy): + + wait = usb_phy.wait + xsi = usb_phy.xsi + + timeout = self.timeout + in_rx_packet = False + rx_packet = [] + + while timeout != 0: + + wait(lambda x: usb_phy._clock.is_high()) + wait(lambda x: usb_phy._clock.is_low()) + + timeout = timeout - 1 + + #sample TXV for new packet + if xsi.sample_port_pins(usb_phy._txv) == 1: + print "Packet:\tDEVICE -> HOST" + in_rx_packet = True + break + + if in_rx_packet == False: + print "ERROR: Timed out waiting for packet" + else: + while in_rx_packet == True: + + # TODO txrdy pulsing + xsi.drive_port_pins(usb_phy._txrdy, 1) + data = xsi.sample_port_pins(usb_phy._txd) + + print "\tRX byte: {0:#x}".format(data) + rx_packet.append(data) + + wait(lambda x: usb_phy._clock.is_high()) + wait(lambda x: usb_phy._clock.is_low()) + + if xsi.sample_port_pins(usb_phy._txv) == 0: + #print "TXV low, breaking out of loop" + in_rx_packet = False + + # End of packet + xsi.drive_port_pins(usb_phy._txrdy, 0) + + # Check packet against expected + expected = self.get_bytes(do_tokens=False) + if len(expected) != len(rx_packet): + print "ERROR: Rx packet length bad. Expecting: {} actual: {}".format(len(expected), len(rx_packet)) + + # Check packet data against expected + if cmp(expected, rx_packet): + print "ERROR: Rx Packet Error. Expected:" + for item in expected: + print "{0:#x}".format(item) + + print "Received:" + for item in rx_packet: + print "{0:#x}".format(item) + #Tx from host i.e. xCORE Rx @@ -291,8 +354,7 @@ def expected_output(self): return expected_output def drive(self, usb_phy, verbose = True): - print "TxPacket:Drive()" - + xsi = usb_phy.xsi wait = usb_phy.wait @@ -300,14 +362,11 @@ def drive(self, usb_phy, verbose = True): if xsi.sample_port_pins(usb_phy._txv) == 1: print "ERROR: Unexpected packet from xCORE" - print "X" rxv_count = self.data_valid_count - print "Waiting for interEventDelay {i}".format(i=self.interEventDelay) usb_phy.wait_until(xsi.get_time() + self.interEventDelay) - print str(self.pid) - print "Phy transmitting packet PID: {} ({})".format(self.get_pid_str(), self.pid) + print "Packet:\tHOST -> DEVICE\n\tPID: {0} ({1:#x})".format(self.get_pid_str(), self.pid) # Set RXA high to USB shim xsi.drive_periph_pin(usb_phy._rxa, 1) @@ -329,20 +388,20 @@ def drive(self, usb_phy, verbose = True): wait(lambda x: usb_phy._clock.is_low()) wait(lambda x: usb_phy._clock.is_high()) wait(lambda x: usb_phy._clock.is_low()) - xsi.drive_periph_pin(self._rxdv, 1) - xsi.drive_periph_pin(self._rxd, byte) + xsi.drive_periph_pin(usb_phy._rxdv, 1) + xsi.drive_periph_pin(usb_phy._rxd, byte) if (self.rxe_assert_time != 0) and (self.rxe_assert_time == i): - xsi.drive_periph_pin(self._rxer, 1) + xsi.drive_periph_pin(usb_phy._rxer, 1) while rxv_count != 0: - wait(lambda x: self._clock.is_high()) - wait(lambda x: self._clock.is_low()) - xsi.drive_periph_pin(self._rxdv, 0) + wait(lambda x: usb_phy._clock.is_high()) + wait(lambda x: usb_phy._clock.is_low()) + xsi.drive_periph_pin(usb_phy._rxdv, 0) rxv_count = rxv_count - 1 # xCore should not be trying to send if we are trying to send.. - if xsi.sample_port_pins(self._txv) == 1: + if xsi.sample_port_pins(usb_phy._txv) == 1: print "ERROR: Unexpected packet from xCORE" #print "Sending byte {0:#x}".format(byte) @@ -365,7 +424,7 @@ def drive(self, usb_phy, verbose = True): rxa_end_delay = rxa_end_delay - 1 # xCore should not be trying to send if we are trying to send.. - if xsi.sample_port_pins(self._txv) == 1: + if xsi.sample_port_pins(usb_phy._txv) == 1: print "ERROR: Unexpected packet from xCORE" xsi.drive_periph_pin(usb_phy._rxa, 0) @@ -432,7 +491,7 @@ def get_bytes(self, do_tokens=False): class RxDataPacket(RxPacket, DataPacket): - def __init__(self, rand, **kwargs): + def __init__(self, **kwargs): _pid = self.pid = kwargs.pop('pid', 0x3) #DATA0 #Re-construct full PID - xCORE sends out full PIDn | PID on Tx @@ -466,8 +525,9 @@ def __init__(self, **kwargs): self.crc5 = kwargs.pop('crc5', crc5) # Always override to match IFM + # Only required for < XS3? #self.data_valid_count = 4 #todo - self.data_valid_count = 0 + #self.data_valid_count = 0 def get_bytes(self, do_tokens=False): bytes = [] @@ -497,7 +557,7 @@ class HandshakePacket(UsbPacket): def __init__(self, **kwargs): super(HandshakePacket, self).__init__(**kwargs) - self.pid = kwargs.pop('pid', 0x2) #Default to ACK + self.pid = kwargs.pop('pid', USB_PID["ACK"]) #Default to ACK def get_bytes(self, do_tokens=False): bytes = [] @@ -509,7 +569,7 @@ class RxHandshakePacket(HandshakePacket, RxPacket): def __init__(self, **kwargs): super(RxHandshakePacket, self).__init__(**kwargs) self.pid = kwargs.pop('pid', 0xd2) #Default to ACK (not expect inverted bits on Rx) - self.timeout = kwargs.pop('timeout', RX_TX_DELAY) + self._timeout = kwargs.pop('timeout', RX_TX_DELAY) #TODO handled by Super() def __str__(self): return super(RxHandshakePacket, self).__str__() + ": RX HandshakePacket: " + super(RxHandshakePacket, self).get_pid_str() diff --git a/tests/usb_phy.py b/tests/usb_phy.py index 85ca4058..280eb5e0 100644 --- a/tests/usb_phy.py +++ b/tests/usb_phy.py @@ -98,7 +98,6 @@ def end_test(self): def set_clock(self, clock): self._clock = clock - def drive_error(self, value): self.xsi.drive_port_pins(self._rxer, value) @@ -108,157 +107,10 @@ def run(self): self.start_test() - for i,packet in enumerate(self.events): - - event = packet #TODO RM ME - - if isinstance(packet, RxPacket): - - timeout = packet.get_timeout() - - #print "Expecting pkt. Timeout in: {i}".format(i=timeout) - - in_rx_packet = False - rx_packet = [] - - while timeout != 0: - - self.wait(lambda x: self._clock.is_high()) - self.wait(lambda x: self._clock.is_low()) - - timeout = timeout - 1 - #print "{i}".format(i=timeout) - - #sample TXV for new packet - if xsi.sample_port_pins(self._txv) == 1: - print "Receiving packet {}".format(i) - in_rx_packet = True - break - - if in_rx_packet == False: - print "ERROR: Timed out waiting for packet" - else: - while in_rx_packet == True: - - # TODO txrdy pulsing - xsi.drive_port_pins(self._txrdy, 1) - data = xsi.sample_port_pins(self._txd) - - print "Received byte: {0:#x}".format(data) - rx_packet.append(data) - - self.wait(lambda x: self._clock.is_high()) - self.wait(lambda x: self._clock.is_low()) - - if xsi.sample_port_pins(self._txv) == 0: - #print "TXV low, breaking out of loop" - in_rx_packet = False - - # End of packet - xsi.drive_port_pins(self._txrdy, 0) - - # Check packet against expected - expected = packet.get_bytes(do_tokens=self._do_tokens) - if len(expected) != len(rx_packet): - print "ERROR: Rx packet length bad. Expecting: {} actual: {}".format(len(expected), len(rx_packet)) - - # Check packet data against expected - if cmp(expected, rx_packet): - print "ERROR: Rx Packet Error. Expected:" - for item in expected: - print "{0:#x}".format(item) - - print "Received:" - for item in rx_packet: - print "{0:#x}".format(item) - - else: - - #TxPacket (which could be a TxToken or TxDataPacket) - - event.drive(self) - ''' - # xCore should not be trying to send if we are trying to send.. - if xsi.sample_port_pins(self._txv) == 1: - print "ERROR: Unexpected packet from xCORE" - - rxv_count = packet.data_valid_count - - #print "Waiting for inter_pkt_gap: {i}".format(i=packet.inter_frame_gap) - self.wait_until(xsi.get_time() + packet.interEventDelay) - - print "Phy transmitting packet {} PID: {} ({})".format(i, USB_PID[packet.pid], packet.pid) - if self._verbose: - sys.stdout.write(packet.dump()) - - # Set RXA high - #xsi.drive_port_pins(self._rxa, 1) - xsi.drive_periph_pin(self._rxa, 1) - - # Wait for RXA start delay - rxa_start_delay = usb_packet.RXA_START_DELAY; - - while rxa_start_delay != 0: - self.wait(lambda x: self._clock.is_high()) - self.wait(lambda x: self._clock.is_low()) - rxa_start_delay = rxa_start_delay- 1; - - for (i, byte) in enumerate(packet.get_bytes(do_tokens = self._do_tokens)): - - # xCore should not be trying to send if we are trying to send.. - if xsi.sample_port_pins(self._txv) == 1: - print "ERROR: Unexpected packet from xCORE" - - self.wait(lambda x: self._clock.is_low()) - - self.wait(lambda x: self._clock.is_high()) - self.wait(lambda x: self._clock.is_low()) - xsi.drive_periph_pin(self._rxdv, 1) - xsi.drive_periph_pin(self._rxd, byte) - - if (packet.rxe_assert_time != 0) and (packet.rxe_assert_time == i): - #xsi.drive_port_pins(self._rxer, 1) - xsi.drive_periph_pin(self._rxer, 1) - - while rxv_count != 0: - self.wait(lambda x: self._clock.is_high()) - self.wait(lambda x: self._clock.is_low()) - xsi.drive_periph_pin(self._rxdv, 0) - rxv_count = rxv_count - 1 - - # xCore should not be trying to send if we are trying to send.. - if xsi.sample_port_pins(self._txv) == 1: - print "ERROR: Unexpected packet from xCORE" - - #print "Sending byte {0:#x}".format(byte) - - rxv_count = packet.get_data_valid_count(); - - # Wait for last byte - self.wait(lambda x: self._clock.is_high()) - self.wait(lambda x: self._clock.is_low()) - - xsi.drive_periph_pin(self._rxdv, 0) - xsi.drive_periph_pin(self._rxer, 0) - - rxa_end_delay = packet.rxa_end_delay - while rxa_end_delay != 0: - # Wait for RXA fall delay TODO, this should be configurable - self.wait(lambda x: self._clock.is_high()) - self.wait(lambda x: self._clock.is_low()) - rxa_end_delay = rxa_end_delay - 1 - - # xCore should not be trying to send if we are trying to send.. - if xsi.sample_port_pins(self._txv) == 1: - print "ERROR: Unexpected packet from xCORE" - - #xsi.drive_port_pins(self._rxa, 0) - xsi.drive_periph_pin(self._rxa, 0) - - #if self._verbose: - #print "Sent" - ''' + for i,event in enumerate(self.events): + event.drive(self) + print "Test done" self.end_test() diff --git a/tests/usb_session.py b/tests/usb_session.py index c9838640..997ba327 100644 --- a/tests/usb_session.py +++ b/tests/usb_session.py @@ -1,6 +1,13 @@ from usb_phy import USB_DATA_VALID_COUNT import usb_transaction +import usb_packet + +def CounterByte(startVal = 0, length = 0): + l = startVal + while l < length: + yield l % 256 + l += 1 class UsbSession(object): @@ -9,7 +16,12 @@ def __init__(self, bus_speed = "HS", run_enumeration = False, device_address = 0 self._events = [] self._enumerate = run_enumeration self._device_address = device_address - + self._pidTable_out = [usb_packet.USB_PID["DATA0"]] * 16 + self._pidTable_in = [usb_packet.USB_PID["DATA0"]] * 16 + + self._dataGen_in = [0] * 16 + self._dataGen_out = [0] * 16 + @property def bus_speed(self): return self._bus_speed @@ -30,21 +42,45 @@ def enumerate(self): def data_valid_count(self): return USB_DATA_VALID_COUNT[self._bus_speed] + def getPayload_out(self, n, length): + + payload = [x for x in range(self._dataGen_out[n], self._dataGen_out[n] + length)] + self._dataGen_out[n] += length + return payload + + def getPayload_in(self, n, length): + + payload = [x for x in range(self._dataGen_in[n], self._dataGen_in[n] + length)] + self._dataGen_in[n] += length + return payload + + def _pid_toggle(self, pid_table, n): + + if pid_table[n] == usb_packet.USB_PID["DATA0"]: + pid_table[n] = usb_packet.USB_PID["DATA1"] + else: + pid_table[n] = usb_packet.USB_PID["DATA0"] + + def data_pid_in(self, n): + pid = self._pidTable_in[n] + self._pid_toggle(self._pidTable_in, n) + return pid + + def data_pid_out(self, n): + pid = self._pidTable_out[n] + self._pid_toggle(self._pidTable_out, n) + return pid + def __str__(self): - s = "" - for e in self._events: s += str(self._events.index(e)) + ": " s += str(e) + "\n" - return s def add_event(self, e): - e.bus_speed = self.bus_speed #TODO ideally dont need transction to know bus speed self._events.append(e) - #self._events = _sort_events_by_time(self._events) def pop_event(self, e): self.events.pop(0) diff --git a/tests/usb_transaction.py b/tests/usb_transaction.py index d6cac075..e0544ecc 100644 --- a/tests/usb_transaction.py +++ b/tests/usb_transaction.py @@ -1,21 +1,17 @@ from usb_event import UsbEvent -from usb_packet import USB_PID, TokenPacket, TxDataPacket, RxHandshakePacket +from usb_packet import USB_PID, TokenPacket, TxDataPacket, RxHandshakePacket, RxDataPacket, TxHandshakePacket from usb_phy import USB_DATA_VALID_COUNT INTER_TRANSACTION_DELAY = 500 - -def CounterByte(length = 0): - l = 0 - while l < length: - yield l % 256 - l += 1 +USB_DIRECTIONS=["OUT", "IN"] +USB_EP_TYPES=["CONTROL", "BULK", "ISO", "INTERRUPT"] class UsbTransaction(UsbEvent): - def __init__(self, deviceAddress = 0, endpointNumber = 0, endpointType = "BULK", - direction="OUT", bus_speed="HS", eventTime = 0, dataLength = 0, data_fn = CounterByte, interEventDelay=500): # TODO Enums when we move to py3 + def __init__(self, session, deviceAddress = 0, endpointNumber = 0, endpointType = "BULK", + direction="OUT", bus_speed="HS", eventTime = 0, dataLength = 0, interEventDelay=500): # TODO Enums when we move to py3 self._deviceAddress = deviceAddress self._endpointNumber = endpointNumber @@ -24,27 +20,51 @@ def __init__(self, deviceAddress = 0, endpointNumber = 0, endpointType = "BULK", self._datalength = dataLength self._bus_speed = bus_speed - # TODO IN TRANSACTION + assert endpointType in USB_EP_TYPES + assert direction in USB_DIRECTIONS + # Populate packet list for a (valid) transaction self._packets = [] - self._packets.append(TokenPacket(interEventDelay = INTER_TRANSACTION_DELAY, + + if direction == "OUT": + self._packets.append(TokenPacket(interEventDelay = INTER_TRANSACTION_DELAY, pid = USB_PID["OUT"], address = self._deviceAddress, endpoint = self._endpointNumber, data_valid_count = self.data_valid_count)) - # Generate packet data payload - packetPayload = [x for x in data_fn(dataLength)] + # Generate packet data payload + packetPayload = session.getPayload_out(endpointNumber, dataLength); - # TODO FIXME - pid = USB_PID["DATA0"]; + pid = session.data_pid_out(endpointNumber); - # Add data packet to packets list - self._packets.append(TxDataPacket(pid=pid, dataPayload = packetPayload)) + # Add data packet to packets list + self._packets.append(TxDataPacket(pid=pid, dataPayload = packetPayload)) - # Add handshake packet to packets list - self._packets.append(RxHandshakePacket()) + # Add handshake packet to packets list + self._packets.append(RxHandshakePacket()) + else: + self._packets.append(TokenPacket(interEventDelay = INTER_TRANSACTION_DELAY, + pid = USB_PID["IN"], + address = self._deviceAddress, + endpoint = self._endpointNumber, + data_valid_count = self.data_valid_count)) + + # Generate packet data payload + packetPayload = session.getPayload_in(endpointNumber, dataLength); + + pid = session.data_pid_in(endpointNumber); + + # Add data packet to packets list + self._packets.append(RxDataPacket(pid=pid, dataPayload = packetPayload)) + + self._packets.append(TxHandshakePacket()) + + + + + super(UsbTransaction, self).__init__(time = eventTime, interEventDelay = interEventDelay) # TODO ideally USBTransaction doesnt know about data_valid_count @@ -89,7 +109,8 @@ def expected_output(self, offset=0): expected_output = "" for i, p in enumerate(self.packets): - expected_output += "Packet {}: ".format(i+offset) + #expected_output += "Packet {}: ".format(i+offset) + expected_output += "Packet:" expected_output += "\t" + p.expected_output #expected_output += "\n" From 5f3b8414843c043c3e359d414576e81ea8a5e952 Mon Sep 17 00:00:00 2001 From: Daniel Pieczko Date: Wed, 7 Apr 2021 16:19:35 +0100 Subject: [PATCH 221/520] Use public licence --- LICENSE.rst | 84 +++++++++++ LICENSE.txt | 135 ------------------ __app_test/LICENSE.rst | 84 +++++++++++ __app_test/LICENSE.txt | 135 ------------------ __app_test_mode/LICENSE.rst | 84 +++++++++++ __app_test_mode/LICENSE.txt | 135 ------------------ examples/AN00124_CDC_VCOM_class/LICENSE.rst | 84 +++++++++++ examples/AN00124_CDC_VCOM_class/LICENSE.txt | 135 ------------------ .../AN00125_mass_storage_class/LICENSE.rst | 84 +++++++++++ .../AN00125_mass_storage_class/LICENSE.txt | 135 ------------------ examples/AN00126_printer_class/LICENSE.rst | 84 +++++++++++ examples/AN00126_printer_class/LICENSE.txt | 135 ------------------ examples/AN00127_video_class/LICENSE.rst | 84 +++++++++++ examples/AN00127_video_class/LICENSE.txt | 135 ------------------ examples/AN00129_hid_class/LICENSE.rst | 84 +++++++++++ examples/AN00129_hid_class/LICENSE.txt | 135 ------------------ examples/AN00131_CDC_EDC_class/LICENSE.rst | 84 +++++++++++ examples/AN00131_CDC_EDC_class/LICENSE.txt | 135 ------------------ examples/AN00132_image_class/LICENSE.rst | 84 +++++++++++ examples/AN00132_image_class/LICENSE.txt | 135 ------------------ .../LICENSE.rst | 84 +++++++++++ .../LICENSE.txt | 135 ------------------ examples/AN00136_vendor_specific/LICENSE.rst | 84 +++++++++++ examples/AN00136_vendor_specific/LICENSE.txt | 135 ------------------ lib_xud/LICENSE.rst | 84 +++++++++++ lib_xud/LICENSE.txt | 135 ------------------ tests/test_bulk_loopback/LICENSE.rst | 84 +++++++++++ tests/test_bulk_loopback/LICENSE.txt | 135 ------------------ tests/test_bulk_rx_basic/LICENSE.rst | 84 +++++++++++ tests/test_bulk_rx_basic/LICENSE.txt | 135 ------------------ tests/test_bulk_rx_basic_badcrc32/LICENSE.rst | 84 +++++++++++ tests/test_bulk_rx_basic_badcrc32/LICENSE.txt | 135 ------------------ tests/test_bulk_rx_basic_badpid/LICENSE.rst | 84 +++++++++++ tests/test_bulk_rx_basic_badpid/LICENSE.txt | 135 ------------------ tests/test_bulk_rx_basic_nodata/LICENSE.rst | 84 +++++++++++ tests/test_bulk_rx_basic_nodata/LICENSE.txt | 135 ------------------ tests/test_bulk_rx_basic_rxerror/LICENSE.rst | 84 +++++++++++ tests/test_bulk_rx_basic_rxerror/LICENSE.txt | 135 ------------------ tests/test_bulk_rx_multiep/LICENSE.rst | 84 +++++++++++ tests/test_bulk_rx_multiep/LICENSE.txt | 135 ------------------ tests/test_bulk_rx_traffic/LICENSE.rst | 84 +++++++++++ tests/test_bulk_rx_traffic/LICENSE.txt | 135 ------------------ tests/test_bulk_tx_badack/LICENSE.rst | 84 +++++++++++ tests/test_bulk_tx_badack/LICENSE.txt | 135 ------------------ tests/test_bulk_tx_basic/LICENSE.rst | 84 +++++++++++ tests/test_bulk_tx_basic/LICENSE.txt | 135 ------------------ tests/test_bulk_tx_basic_short/LICENSE.rst | 84 +++++++++++ tests/test_bulk_tx_basic_short/LICENSE.txt | 135 ------------------ tests/test_bulk_tx_multiep/LICENSE.rst | 84 +++++++++++ tests/test_bulk_tx_multiep/LICENSE.txt | 135 ------------------ tests/test_bulk_tx_noack/LICENSE.rst | 84 +++++++++++ tests/test_bulk_tx_noack/LICENSE.txt | 135 ------------------ tests/test_control_basic_badcrc32/LICENSE.rst | 84 +++++++++++ tests/test_control_basic_badcrc32/LICENSE.txt | 135 ------------------ tests/test_control_basic_get/LICENSE.rst | 84 +++++++++++ tests/test_control_basic_get/LICENSE.txt | 135 ------------------ tests/test_control_basic_set/LICENSE.rst | 84 +++++++++++ tests/test_control_basic_set/LICENSE.txt | 135 ------------------ tests/test_control_basic_short/LICENSE.rst | 84 +++++++++++ tests/test_control_basic_short/LICENSE.txt | 135 ------------------ tests/test_control_repeatedsetup/LICENSE.rst | 84 +++++++++++ tests/test_control_repeatedsetup/LICENSE.txt | 135 ------------------ tests/test_invalidtoken/LICENSE.rst | 84 +++++++++++ tests/test_invalidtoken/LICENSE.txt | 135 ------------------ tests/test_iso_loopback/LICENSE.rst | 84 +++++++++++ tests/test_iso_loopback/LICENSE.txt | 135 ------------------ tests/test_iso_rx_basic/LICENSE.rst | 84 +++++++++++ tests/test_iso_rx_basic/LICENSE.txt | 135 ------------------ tests/test_iso_rxtx_fastpacket/LICENSE.rst | 84 +++++++++++ tests/test_iso_rxtx_fastpacket/LICENSE.txt | 135 ------------------ tests/test_iso_tx_basic/LICENSE.rst | 84 +++++++++++ tests/test_iso_tx_basic/LICENSE.txt | 135 ------------------ tests/test_ping_rx_basic/LICENSE.rst | 84 +++++++++++ tests/test_ping_rx_basic/LICENSE.txt | 135 ------------------ tests/test_shorttoken/LICENSE.rst | 84 +++++++++++ tests/test_shorttoken/LICENSE.txt | 135 ------------------ tests/test_sof_badcrc/LICENSE.rst | 84 +++++++++++ tests/test_sof_badcrc/LICENSE.txt | 135 ------------------ tests/test_sof_basic/LICENSE.rst | 84 +++++++++++ tests/test_sof_basic/LICENSE.txt | 135 ------------------ 80 files changed, 3360 insertions(+), 5400 deletions(-) create mode 100644 LICENSE.rst delete mode 100644 LICENSE.txt create mode 100644 __app_test/LICENSE.rst delete mode 100644 __app_test/LICENSE.txt create mode 100644 __app_test_mode/LICENSE.rst delete mode 100644 __app_test_mode/LICENSE.txt create mode 100644 examples/AN00124_CDC_VCOM_class/LICENSE.rst delete mode 100644 examples/AN00124_CDC_VCOM_class/LICENSE.txt create mode 100644 examples/AN00125_mass_storage_class/LICENSE.rst delete mode 100644 examples/AN00125_mass_storage_class/LICENSE.txt create mode 100644 examples/AN00126_printer_class/LICENSE.rst delete mode 100644 examples/AN00126_printer_class/LICENSE.txt create mode 100644 examples/AN00127_video_class/LICENSE.rst delete mode 100644 examples/AN00127_video_class/LICENSE.txt create mode 100644 examples/AN00129_hid_class/LICENSE.rst delete mode 100644 examples/AN00129_hid_class/LICENSE.txt create mode 100644 examples/AN00131_CDC_EDC_class/LICENSE.rst delete mode 100644 examples/AN00131_CDC_EDC_class/LICENSE.txt create mode 100644 examples/AN00132_image_class/LICENSE.rst delete mode 100644 examples/AN00132_image_class/LICENSE.txt create mode 100644 examples/AN00135_test_and_measurement_class/LICENSE.rst delete mode 100644 examples/AN00135_test_and_measurement_class/LICENSE.txt create mode 100644 examples/AN00136_vendor_specific/LICENSE.rst delete mode 100644 examples/AN00136_vendor_specific/LICENSE.txt create mode 100644 lib_xud/LICENSE.rst delete mode 100644 lib_xud/LICENSE.txt create mode 100644 tests/test_bulk_loopback/LICENSE.rst delete mode 100644 tests/test_bulk_loopback/LICENSE.txt create mode 100644 tests/test_bulk_rx_basic/LICENSE.rst delete mode 100644 tests/test_bulk_rx_basic/LICENSE.txt create mode 100644 tests/test_bulk_rx_basic_badcrc32/LICENSE.rst delete mode 100644 tests/test_bulk_rx_basic_badcrc32/LICENSE.txt create mode 100644 tests/test_bulk_rx_basic_badpid/LICENSE.rst delete mode 100644 tests/test_bulk_rx_basic_badpid/LICENSE.txt create mode 100644 tests/test_bulk_rx_basic_nodata/LICENSE.rst delete mode 100644 tests/test_bulk_rx_basic_nodata/LICENSE.txt create mode 100644 tests/test_bulk_rx_basic_rxerror/LICENSE.rst delete mode 100644 tests/test_bulk_rx_basic_rxerror/LICENSE.txt create mode 100644 tests/test_bulk_rx_multiep/LICENSE.rst delete mode 100644 tests/test_bulk_rx_multiep/LICENSE.txt create mode 100644 tests/test_bulk_rx_traffic/LICENSE.rst delete mode 100644 tests/test_bulk_rx_traffic/LICENSE.txt create mode 100644 tests/test_bulk_tx_badack/LICENSE.rst delete mode 100644 tests/test_bulk_tx_badack/LICENSE.txt create mode 100644 tests/test_bulk_tx_basic/LICENSE.rst delete mode 100644 tests/test_bulk_tx_basic/LICENSE.txt create mode 100644 tests/test_bulk_tx_basic_short/LICENSE.rst delete mode 100644 tests/test_bulk_tx_basic_short/LICENSE.txt create mode 100644 tests/test_bulk_tx_multiep/LICENSE.rst delete mode 100644 tests/test_bulk_tx_multiep/LICENSE.txt create mode 100644 tests/test_bulk_tx_noack/LICENSE.rst delete mode 100644 tests/test_bulk_tx_noack/LICENSE.txt create mode 100644 tests/test_control_basic_badcrc32/LICENSE.rst delete mode 100644 tests/test_control_basic_badcrc32/LICENSE.txt create mode 100644 tests/test_control_basic_get/LICENSE.rst delete mode 100644 tests/test_control_basic_get/LICENSE.txt create mode 100644 tests/test_control_basic_set/LICENSE.rst delete mode 100644 tests/test_control_basic_set/LICENSE.txt create mode 100644 tests/test_control_basic_short/LICENSE.rst delete mode 100644 tests/test_control_basic_short/LICENSE.txt create mode 100644 tests/test_control_repeatedsetup/LICENSE.rst delete mode 100644 tests/test_control_repeatedsetup/LICENSE.txt create mode 100644 tests/test_invalidtoken/LICENSE.rst delete mode 100644 tests/test_invalidtoken/LICENSE.txt create mode 100644 tests/test_iso_loopback/LICENSE.rst delete mode 100644 tests/test_iso_loopback/LICENSE.txt create mode 100644 tests/test_iso_rx_basic/LICENSE.rst delete mode 100644 tests/test_iso_rx_basic/LICENSE.txt create mode 100644 tests/test_iso_rxtx_fastpacket/LICENSE.rst delete mode 100644 tests/test_iso_rxtx_fastpacket/LICENSE.txt create mode 100644 tests/test_iso_tx_basic/LICENSE.rst delete mode 100644 tests/test_iso_tx_basic/LICENSE.txt create mode 100644 tests/test_ping_rx_basic/LICENSE.rst delete mode 100644 tests/test_ping_rx_basic/LICENSE.txt create mode 100644 tests/test_shorttoken/LICENSE.rst delete mode 100644 tests/test_shorttoken/LICENSE.txt create mode 100644 tests/test_sof_badcrc/LICENSE.rst delete mode 100644 tests/test_sof_badcrc/LICENSE.txt create mode 100644 tests/test_sof_basic/LICENSE.rst delete mode 100644 tests/test_sof_basic/LICENSE.txt diff --git a/LICENSE.rst b/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/LICENSE.txt b/LICENSE.txt deleted file mode 100644 index b5e98f08..00000000 --- a/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2011-2021, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS XMOS USB Device (XUD) Library software diff --git a/__app_test/LICENSE.rst b/__app_test/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/__app_test/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/__app_test/LICENSE.txt b/__app_test/LICENSE.txt deleted file mode 100644 index 46f70853..00000000 --- a/__app_test/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2013-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS XMOS USB Device (XUD) Library software diff --git a/__app_test_mode/LICENSE.rst b/__app_test_mode/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/__app_test_mode/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/__app_test_mode/LICENSE.txt b/__app_test_mode/LICENSE.txt deleted file mode 100644 index e27716f4..00000000 --- a/__app_test_mode/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2017, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS application note AN00129 software diff --git a/examples/AN00124_CDC_VCOM_class/LICENSE.rst b/examples/AN00124_CDC_VCOM_class/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/examples/AN00124_CDC_VCOM_class/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/examples/AN00124_CDC_VCOM_class/LICENSE.txt b/examples/AN00124_CDC_VCOM_class/LICENSE.txt deleted file mode 100644 index f34a9fee..00000000 --- a/examples/AN00124_CDC_VCOM_class/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS application note AN00124 software diff --git a/examples/AN00125_mass_storage_class/LICENSE.rst b/examples/AN00125_mass_storage_class/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/examples/AN00125_mass_storage_class/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/examples/AN00125_mass_storage_class/LICENSE.txt b/examples/AN00125_mass_storage_class/LICENSE.txt deleted file mode 100644 index d5b77d06..00000000 --- a/examples/AN00125_mass_storage_class/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS application note AN00125 software diff --git a/examples/AN00126_printer_class/LICENSE.rst b/examples/AN00126_printer_class/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/examples/AN00126_printer_class/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/examples/AN00126_printer_class/LICENSE.txt b/examples/AN00126_printer_class/LICENSE.txt deleted file mode 100644 index d0347f73..00000000 --- a/examples/AN00126_printer_class/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2017, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS application note AN00126 software diff --git a/examples/AN00127_video_class/LICENSE.rst b/examples/AN00127_video_class/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/examples/AN00127_video_class/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/examples/AN00127_video_class/LICENSE.txt b/examples/AN00127_video_class/LICENSE.txt deleted file mode 100644 index b495b51c..00000000 --- a/examples/AN00127_video_class/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2017, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS application note AN00127 software diff --git a/examples/AN00129_hid_class/LICENSE.rst b/examples/AN00129_hid_class/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/examples/AN00129_hid_class/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/examples/AN00129_hid_class/LICENSE.txt b/examples/AN00129_hid_class/LICENSE.txt deleted file mode 100644 index e27716f4..00000000 --- a/examples/AN00129_hid_class/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2017, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS application note AN00129 software diff --git a/examples/AN00131_CDC_EDC_class/LICENSE.rst b/examples/AN00131_CDC_EDC_class/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/examples/AN00131_CDC_EDC_class/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/examples/AN00131_CDC_EDC_class/LICENSE.txt b/examples/AN00131_CDC_EDC_class/LICENSE.txt deleted file mode 100644 index afb5be38..00000000 --- a/examples/AN00131_CDC_EDC_class/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2017, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS application note AN00131 software diff --git a/examples/AN00132_image_class/LICENSE.rst b/examples/AN00132_image_class/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/examples/AN00132_image_class/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/examples/AN00132_image_class/LICENSE.txt b/examples/AN00132_image_class/LICENSE.txt deleted file mode 100644 index 9bbd6079..00000000 --- a/examples/AN00132_image_class/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS application note AN00132 software diff --git a/examples/AN00135_test_and_measurement_class/LICENSE.rst b/examples/AN00135_test_and_measurement_class/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/examples/AN00135_test_and_measurement_class/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/examples/AN00135_test_and_measurement_class/LICENSE.txt b/examples/AN00135_test_and_measurement_class/LICENSE.txt deleted file mode 100644 index 6e68066c..00000000 --- a/examples/AN00135_test_and_measurement_class/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2019, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS application note AN00135 software diff --git a/examples/AN00136_vendor_specific/LICENSE.rst b/examples/AN00136_vendor_specific/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/examples/AN00136_vendor_specific/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/examples/AN00136_vendor_specific/LICENSE.txt b/examples/AN00136_vendor_specific/LICENSE.txt deleted file mode 100644 index cab7c892..00000000 --- a/examples/AN00136_vendor_specific/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS application note AN00136 software diff --git a/lib_xud/LICENSE.rst b/lib_xud/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/lib_xud/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/lib_xud/LICENSE.txt b/lib_xud/LICENSE.txt deleted file mode 100644 index 2ffa84ee..00000000 --- a/lib_xud/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2020, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_bulk_loopback/LICENSE.rst b/tests/test_bulk_loopback/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/tests/test_bulk_loopback/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_bulk_loopback/LICENSE.txt b/tests/test_bulk_loopback/LICENSE.txt deleted file mode 100644 index 994856c9..00000000 --- a/tests/test_bulk_loopback/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_bulk_rx_basic/LICENSE.rst b/tests/test_bulk_rx_basic/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/tests/test_bulk_rx_basic/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_bulk_rx_basic/LICENSE.txt b/tests/test_bulk_rx_basic/LICENSE.txt deleted file mode 100644 index 994856c9..00000000 --- a/tests/test_bulk_rx_basic/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_bulk_rx_basic_badcrc32/LICENSE.rst b/tests/test_bulk_rx_basic_badcrc32/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/tests/test_bulk_rx_basic_badcrc32/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_bulk_rx_basic_badcrc32/LICENSE.txt b/tests/test_bulk_rx_basic_badcrc32/LICENSE.txt deleted file mode 100644 index 994856c9..00000000 --- a/tests/test_bulk_rx_basic_badcrc32/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_bulk_rx_basic_badpid/LICENSE.rst b/tests/test_bulk_rx_basic_badpid/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/tests/test_bulk_rx_basic_badpid/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_bulk_rx_basic_badpid/LICENSE.txt b/tests/test_bulk_rx_basic_badpid/LICENSE.txt deleted file mode 100644 index 994856c9..00000000 --- a/tests/test_bulk_rx_basic_badpid/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_bulk_rx_basic_nodata/LICENSE.rst b/tests/test_bulk_rx_basic_nodata/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/tests/test_bulk_rx_basic_nodata/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_bulk_rx_basic_nodata/LICENSE.txt b/tests/test_bulk_rx_basic_nodata/LICENSE.txt deleted file mode 100644 index 994856c9..00000000 --- a/tests/test_bulk_rx_basic_nodata/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_bulk_rx_basic_rxerror/LICENSE.rst b/tests/test_bulk_rx_basic_rxerror/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/tests/test_bulk_rx_basic_rxerror/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_bulk_rx_basic_rxerror/LICENSE.txt b/tests/test_bulk_rx_basic_rxerror/LICENSE.txt deleted file mode 100644 index 994856c9..00000000 --- a/tests/test_bulk_rx_basic_rxerror/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_bulk_rx_multiep/LICENSE.rst b/tests/test_bulk_rx_multiep/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/tests/test_bulk_rx_multiep/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_bulk_rx_multiep/LICENSE.txt b/tests/test_bulk_rx_multiep/LICENSE.txt deleted file mode 100644 index 994856c9..00000000 --- a/tests/test_bulk_rx_multiep/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_bulk_rx_traffic/LICENSE.rst b/tests/test_bulk_rx_traffic/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/tests/test_bulk_rx_traffic/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_bulk_rx_traffic/LICENSE.txt b/tests/test_bulk_rx_traffic/LICENSE.txt deleted file mode 100644 index 994856c9..00000000 --- a/tests/test_bulk_rx_traffic/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_bulk_tx_badack/LICENSE.rst b/tests/test_bulk_tx_badack/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/tests/test_bulk_tx_badack/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_bulk_tx_badack/LICENSE.txt b/tests/test_bulk_tx_badack/LICENSE.txt deleted file mode 100644 index 994856c9..00000000 --- a/tests/test_bulk_tx_badack/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_bulk_tx_basic/LICENSE.rst b/tests/test_bulk_tx_basic/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/tests/test_bulk_tx_basic/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_bulk_tx_basic/LICENSE.txt b/tests/test_bulk_tx_basic/LICENSE.txt deleted file mode 100644 index 994856c9..00000000 --- a/tests/test_bulk_tx_basic/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_bulk_tx_basic_short/LICENSE.rst b/tests/test_bulk_tx_basic_short/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/tests/test_bulk_tx_basic_short/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_bulk_tx_basic_short/LICENSE.txt b/tests/test_bulk_tx_basic_short/LICENSE.txt deleted file mode 100644 index 994856c9..00000000 --- a/tests/test_bulk_tx_basic_short/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_bulk_tx_multiep/LICENSE.rst b/tests/test_bulk_tx_multiep/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/tests/test_bulk_tx_multiep/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_bulk_tx_multiep/LICENSE.txt b/tests/test_bulk_tx_multiep/LICENSE.txt deleted file mode 100644 index 994856c9..00000000 --- a/tests/test_bulk_tx_multiep/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_bulk_tx_noack/LICENSE.rst b/tests/test_bulk_tx_noack/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/tests/test_bulk_tx_noack/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_bulk_tx_noack/LICENSE.txt b/tests/test_bulk_tx_noack/LICENSE.txt deleted file mode 100644 index 994856c9..00000000 --- a/tests/test_bulk_tx_noack/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_control_basic_badcrc32/LICENSE.rst b/tests/test_control_basic_badcrc32/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/tests/test_control_basic_badcrc32/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_control_basic_badcrc32/LICENSE.txt b/tests/test_control_basic_badcrc32/LICENSE.txt deleted file mode 100644 index 994856c9..00000000 --- a/tests/test_control_basic_badcrc32/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_control_basic_get/LICENSE.rst b/tests/test_control_basic_get/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/tests/test_control_basic_get/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_control_basic_get/LICENSE.txt b/tests/test_control_basic_get/LICENSE.txt deleted file mode 100644 index 994856c9..00000000 --- a/tests/test_control_basic_get/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_control_basic_set/LICENSE.rst b/tests/test_control_basic_set/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/tests/test_control_basic_set/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_control_basic_set/LICENSE.txt b/tests/test_control_basic_set/LICENSE.txt deleted file mode 100644 index 994856c9..00000000 --- a/tests/test_control_basic_set/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_control_basic_short/LICENSE.rst b/tests/test_control_basic_short/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/tests/test_control_basic_short/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_control_basic_short/LICENSE.txt b/tests/test_control_basic_short/LICENSE.txt deleted file mode 100644 index 994856c9..00000000 --- a/tests/test_control_basic_short/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_control_repeatedsetup/LICENSE.rst b/tests/test_control_repeatedsetup/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/tests/test_control_repeatedsetup/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_control_repeatedsetup/LICENSE.txt b/tests/test_control_repeatedsetup/LICENSE.txt deleted file mode 100644 index 994856c9..00000000 --- a/tests/test_control_repeatedsetup/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_invalidtoken/LICENSE.rst b/tests/test_invalidtoken/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/tests/test_invalidtoken/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_invalidtoken/LICENSE.txt b/tests/test_invalidtoken/LICENSE.txt deleted file mode 100644 index 994856c9..00000000 --- a/tests/test_invalidtoken/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_iso_loopback/LICENSE.rst b/tests/test_iso_loopback/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/tests/test_iso_loopback/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_iso_loopback/LICENSE.txt b/tests/test_iso_loopback/LICENSE.txt deleted file mode 100644 index 994856c9..00000000 --- a/tests/test_iso_loopback/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_iso_rx_basic/LICENSE.rst b/tests/test_iso_rx_basic/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/tests/test_iso_rx_basic/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_iso_rx_basic/LICENSE.txt b/tests/test_iso_rx_basic/LICENSE.txt deleted file mode 100644 index 994856c9..00000000 --- a/tests/test_iso_rx_basic/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_iso_rxtx_fastpacket/LICENSE.rst b/tests/test_iso_rxtx_fastpacket/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/tests/test_iso_rxtx_fastpacket/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_iso_rxtx_fastpacket/LICENSE.txt b/tests/test_iso_rxtx_fastpacket/LICENSE.txt deleted file mode 100644 index 994856c9..00000000 --- a/tests/test_iso_rxtx_fastpacket/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_iso_tx_basic/LICENSE.rst b/tests/test_iso_tx_basic/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/tests/test_iso_tx_basic/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_iso_tx_basic/LICENSE.txt b/tests/test_iso_tx_basic/LICENSE.txt deleted file mode 100644 index 994856c9..00000000 --- a/tests/test_iso_tx_basic/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_ping_rx_basic/LICENSE.rst b/tests/test_ping_rx_basic/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/tests/test_ping_rx_basic/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_ping_rx_basic/LICENSE.txt b/tests/test_ping_rx_basic/LICENSE.txt deleted file mode 100644 index 994856c9..00000000 --- a/tests/test_ping_rx_basic/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_shorttoken/LICENSE.rst b/tests/test_shorttoken/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/tests/test_shorttoken/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_shorttoken/LICENSE.txt b/tests/test_shorttoken/LICENSE.txt deleted file mode 100644 index 994856c9..00000000 --- a/tests/test_shorttoken/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_sof_badcrc/LICENSE.rst b/tests/test_sof_badcrc/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/tests/test_sof_badcrc/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_sof_badcrc/LICENSE.txt b/tests/test_sof_badcrc/LICENSE.txt deleted file mode 100644 index 994856c9..00000000 --- a/tests/test_sof_badcrc/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS XMOS USB Device (XUD) Library software diff --git a/tests/test_sof_basic/LICENSE.rst b/tests/test_sof_basic/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/tests/test_sof_basic/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_sof_basic/LICENSE.txt b/tests/test_sof_basic/LICENSE.txt deleted file mode 100644 index 994856c9..00000000 --- a/tests/test_sof_basic/LICENSE.txt +++ /dev/null @@ -1,135 +0,0 @@ -Software Release License Agreement - -Copyright (c) 2015-2018, XMOS, All rights reserved. - -BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. - -Parties: - -(1) XMOS Limited, incorporated and registered in England and Wales with company number 5494985 whose registered office is 107 Cheapside, London, EC2V 6DN (XMOS). - -(2) An individual or legal entity exercising permissions granted by this License (Customer). - -If you are entering into this Agreement on behalf of another legal entity such as a company, partnership, university, college etc. (for example, as an employee, student or consultant), you warrant that you have authority to bind that entity. - -1. Definitions - -"License" means this Software License and any schedules or annexes to it. - -"License Fee" means the fee for the XMOS Software as detailed in any schedules or annexes to this Software License - -"Licensee Modifications" means all developments and modifications of the XMOS Software developed independently by the Customer. - -"XMOS Modifications" means all developments and modifications of the XMOS Software developed or co-developed by XMOS. - -"XMOS Hardware" means any XMOS hardware devices supplied by XMOS from time to time and/or the particular XMOS devices detailed in any schedules or annexes to this Software License. - -"XMOS Software" comprises the XMOS owned circuit designs, schematics, source code, object code, reference designs, (including related programmer comments and documentation, if any), error corrections, improvements, modifications (including XMOS Modifications) and updates. - -The headings in this License do not affect its interpretation. Save where the context otherwise requires, references to clauses and schedules are to clauses and schedules of this License. - -Unless the context otherwise requires: - -- references to XMOS and the Customer include their permitted successors and assigns; -- references to statutory provisions include those statutory provisions as amended or re-enacted; and -- references to any gender include all genders. - -Words in the singular include the plural and in the plural include the singular. - -2. License - -XMOS grants the Customer a non-exclusive license to use, develop, modify and distribute the XMOS Software with, or for the purpose of being used with, XMOS Hardware. - -Open Source Software (OSS) must be used and dealt with in accordance with any license terms under which OSS is distributed. - -3. Consideration - -In consideration of the mutual obligations contained in this License, the parties agree to its terms. - -4. Term - -Subject to clause 12 below, this License shall be perpetual. - -5. Restrictions on Use - -The Customer will adhere to all applicable import and export laws and regulations of the country in which it resides and of the United States and United Kingdom, without limitation. The Customer agrees that it is its responsibility to obtain copies of and to familiarise itself fully with these laws and regulations to avoid violation. - -6. Modifications - -The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. - -XMOS will own all intellectual property rights in the XMOS Modifications. -The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. - -7. Support - -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. - -8. Warranty and Disclaimer - -The XMOS Software is provided "AS IS" without a warranty of any kind. XMOS and its licensors' entire liability and Customer's exclusive remedy under this warranty to be determined in XMOS's sole and absolute discretion, will be either (a) the corrections of defects in media or replacement of the media, or (b) the refund of the license fee paid (if any). - -Whilst XMOS gives the Customer the ability to load their own software and applications onto XMOS devices, the security of such software and applications when on the XMOS devices is the Customer's own responsibility and any breach of security shall not be deemed a defect or failure of the hardware. XMOS shall have no liability whatsoever in relation to any costs, damages or other losses Customer may incur as a result of any breaches of security in relation to your software or applications. - -XMOS AND ITS LICENSORS DISCLAIM ALL OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY/ SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT EXCEPT TO THE EXTENT THAT THESE DISCLAIMERS ARE HELD TO BE LEGALLY INVALID UNDER APPLICABLE LAW. - -9. High Risk Activities - -The XMOS Software is not designed or intended for use in conjunction with on-line control equipment in hazardous environments requiring fail-safe performance, including without limitation the operation of nuclear facilities, aircraft navigation or communication systems, air traffic control, life support machines, or weapons systems (collectively "High Risk Activities") in which the failure of the XMOS Software could lead directly to death, personal injury, or severe physical or environmental damage. XMOS and its licensors specifically disclaim any express or implied warranties relating to use of the XMOS Software in connection with High Risk Activities. - -10. Liability - -TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, NEITHER XMOS NOR ITS LICENSORS SHALL BE LIABLE FOR ANY LOST REVENUE, BUSINESS, PROFIT, CONTRACTS OR DATA, ADMINISTRATIVE OR OVERHEAD EXPENSES, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THEORY OF LIABILITY ARISING OUT OF THIS LICENSE, EVEN IF XMOS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall XMOS's liability to the Customer whether in contract, tort (including negligence), or otherwise exceed the License Fee. - -Customer agrees to indemnify, hold harmless, and defend XMOS and its licensors from and against any claims or lawsuits, including attorneys' fees and any other liabilities, demands, proceedings, damages, losses, costs, expenses fines and charges which are made or brought against or incurred by XMOS as a result of your use or distribution of the Licensee Modifications or your use or distribution of XMOS Software, or any development of it, other than in accordance with the terms of this License. - -11. Ownership - -The copyrights and all other intellectual and industrial property rights for the protection of information with respect to the XMOS Software (including the methods and techniques on which they are based) are retained by XMOS and/or its licensors. Nothing in this Agreement serves to transfer such rights. Customer may not sell, mortgage, underlet, sublease, sublicense, lend or transfer possession of the XMOS Software in any way whatsoever to any third party who is not bound by this Agreement. - -12. Termination - -Either party may terminate this License at any time on written notice to the other if the other: - -- is in material or persistent breach of any of the terms of this License and either that breach is incapable of remedy, or the other party fails to remedy that breach within 30 days after receiving written notice requiring it to remedy that breach; or - -- is unable to pay its debts (within the meaning of section 123 of the Insolvency Act 1986), or becomes insolvent, or is subject to an order or a resolution for its liquidation, administration, winding-up or dissolution (otherwise than for the purposes of a solvent amalgamation or reconstruction), or has an administrative or other receiver, manager, trustee, liquidator, administrator or similar officer appointed over all or any substantial part of its assets, or enters into or proposes any composition or arrangement with its creditors generally, or is subject to any analogous event or proceeding in any applicable jurisdiction. - -Termination by either party in accordance with the rights contained in clause 12 shall be without prejudice to any other rights or remedies of that party accrued prior to termination. - -On termination for any reason: - -- all rights granted to the Customer under this License shall cease; -- the Customer shall cease all activities authorised by this License; -- the Customer shall immediately pay any sums due to XMOS under this License; and -- the Customer shall immediately destroy or return to the XMOS (at the XMOS's option) all copies of the XMOS Software then in its possession, custody or control and, in the case of destruction, certify to XMOS that it has done so. - -Clauses 5, 8, 9, 10 and 11 shall survive any effective termination of this Agreement. - -13. Third party rights - -No term of this License is intended to confer a benefit on, or to be enforceable by, any person who is not a party to this license. - -14. Confidentiality and publicity - -Each party shall, during the term of this License and thereafter, keep confidential all, and shall not use for its own purposes nor without the prior written consent of the other disclose to any third party any, information of a confidential nature (including, without limitation, trade secrets and information of commercial value) which may become known to such party from the other party and which relates to the other party, unless such information is public knowledge or already known to such party at the time of disclosure, or subsequently becomes public knowledge other than by breach of this license, or subsequently comes lawfully into the possession of such party from a third party. - -The terms of this license are confidential and may not be disclosed by the Customer without the prior written consent of XMOS. -The provisions of clause 14 shall remain in full force and effect notwithstanding termination of this license for any reason. - -15. Entire agreement - -This License and the documents annexed as appendices to this License or otherwise referred to herein contain the whole agreement between the parties relating to the subject matter hereof and supersede all prior agreements, arrangements and understandings between the parties relating to that subject matter. - -16. Assignment - -The Customer shall not assign this License or any of the rights granted under it without XMOS's prior written consent. - -17. Governing law and jurisdiction - -This License shall be governed by and construed in accordance with English law and each party hereby submits to the non-exclusive jurisdiction of the English courts. - -This License has been entered into on the date stated at the beginning of it. - -Schedule -XMOS XMOS USB Device (XUD) Library software From fe9aca86df73e2fca4e95006fc767c23758176a2 Mon Sep 17 00:00:00 2001 From: Daniel Pieczko Date: Wed, 7 Apr 2021 16:23:04 +0100 Subject: [PATCH 222/520] Add licence reference in source files --- __app_test/main.xc | 3 ++- __app_test_mode/src/main.xc | 3 ++- examples/AN00124_CDC_VCOM_class/src/main.xc | 3 ++- examples/AN00124_CDC_VCOM_class/src/xud_cdc.h | 3 ++- examples/AN00124_CDC_VCOM_class/src/xud_cdc.xc | 3 ++- examples/AN00125_mass_storage_class/src/debug_conf.h | 3 ++- examples/AN00125_mass_storage_class/src/endpoint0.xc | 3 ++- examples/AN00125_mass_storage_class/src/main.xc | 3 ++- examples/AN00125_mass_storage_class/src/mass_storage.h | 3 ++- examples/AN00125_mass_storage_class/src/mass_storage.xc | 3 ++- examples/AN00126_printer_class/src/endpoint0.xc | 3 ++- examples/AN00126_printer_class/src/main.xc | 3 ++- examples/AN00127_video_class/src/main.xc | 3 ++- examples/AN00127_video_class/src/usb_video.h | 3 ++- examples/AN00127_video_class/src/usb_video.xc | 3 ++- examples/AN00127_video_class/src/uvc_defs.h | 3 ++- examples/AN00127_video_class/src/uvc_req.c | 3 ++- examples/AN00127_video_class/src/uvc_req.h | 3 ++- examples/AN00129_hid_class/src/endpoint0.xc | 3 ++- examples/AN00129_hid_class/src/hid.h | 3 ++- examples/AN00129_hid_class/src/main.xc | 3 ++- examples/AN00131_CDC_EDC_class/src/eth_tcp/dhcp.h | 3 ++- examples/AN00131_CDC_EDC_class/src/eth_tcp/dhcp.xc | 3 ++- examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoIP.h | 3 ++- examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoIP.xc | 3 ++- examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoTCP.h | 3 ++- examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoTCP.xc | 3 ++- examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoUDP.h | 3 ++- examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoUDP.xc | 3 ++- examples/AN00131_CDC_EDC_class/src/eth_tcp/http.h | 3 ++- examples/AN00131_CDC_EDC_class/src/eth_tcp/http.xc | 3 ++- examples/AN00131_CDC_EDC_class/src/ethernet.h | 3 ++- examples/AN00131_CDC_EDC_class/src/ethernet.xc | 3 ++- examples/AN00131_CDC_EDC_class/src/main.xc | 3 ++- examples/AN00131_CDC_EDC_class/src/packet_buffer.h | 3 ++- examples/AN00131_CDC_EDC_class/src/packet_buffer.xc | 3 ++- examples/AN00131_CDC_EDC_class/src/queue.h | 3 ++- examples/AN00131_CDC_EDC_class/src/queue.xc | 3 ++- examples/AN00131_CDC_EDC_class/src/xud_ecm.h | 3 ++- examples/AN00131_CDC_EDC_class/src/xud_ecm.xc | 3 ++- examples/AN00132_image_class/host/get_image.cpp | 3 ++- examples/AN00132_image_class/host/ptp.h | 3 ++- examples/AN00132_image_class/src/endpoint0.xc | 3 ++- examples/AN00132_image_class/src/main.xc | 3 ++- .../AN00135_test_and_measurement_class/host/usbtmc_test.py | 3 ++- examples/AN00135_test_and_measurement_class/src/endpoint0.xc | 3 ++- examples/AN00135_test_and_measurement_class/src/main.xc | 3 ++- .../src/scpi_parser/custom/scpi_cmds.c | 3 ++- .../src/scpi_parser/custom/scpi_cmds.h | 3 ++- .../src/scpi_parser/custom/scpi_parser_wrapper.c | 3 ++- .../src/scpi_parser/custom/scpi_parser_wrapper.h | 3 ++- .../AN00135_test_and_measurement_class/src/scpi_parser/fifo.c | 3 ++- .../AN00135_test_and_measurement_class/src/usbtmc_endpoints.xc | 3 ++- examples/AN00136_vendor_specific/host/bulk_read_benchmark.cpp | 3 ++- examples/AN00136_vendor_specific/host/bulktest.cpp | 3 ++- examples/AN00136_vendor_specific/src/endpoint0.xc | 3 ++- examples/AN00136_vendor_specific/src/main.xc | 3 ++- lib_xud/api/xud.h | 3 ++- lib_xud/api/xud_conf_default.h | 3 ++- lib_xud/api/xud_device.h | 3 ++- lib_xud/api/xud_std_descriptors.h | 3 ++- lib_xud/api/xud_std_requests.h | 3 ++- lib_xud/src/core/XUD_AlignmentDefines.h | 3 ++- lib_xud/src/core/XUD_CRC5_Table.S | 3 ++- lib_xud/src/core/XUD_CRC5_Table_Addr.S | 3 ++- lib_xud/src/core/XUD_CrcAddrCheck.S | 3 ++- lib_xud/src/core/XUD_DeviceAttach.h | 3 ++- lib_xud/src/core/XUD_DeviceAttach.xc | 3 ++- lib_xud/src/core/XUD_HAL.h | 2 ++ lib_xud/src/core/XUD_HAL.xc | 2 ++ lib_xud/src/core/XUD_IOLoopCall.xc | 3 ++- lib_xud/src/core/XUD_IoLoop.S | 3 ++- lib_xud/src/core/XUD_Main.xc | 3 ++- lib_xud/src/core/XUD_PowerSig.h | 3 ++- lib_xud/src/core/XUD_PowerSig.xc | 3 ++- lib_xud/src/core/XUD_SetCrcTableAddr.c | 3 ++- lib_xud/src/core/XUD_SetupChanOverride.S | 3 ++- lib_xud/src/core/XUD_Support.h | 3 ++- lib_xud/src/core/XUD_Support.xc | 3 ++- lib_xud/src/core/XUD_TestMode.S | 2 ++ lib_xud/src/core/XUD_TestMode.h | 3 ++- lib_xud/src/core/XUD_TestMode.xc | 3 ++- lib_xud/src/core/XUD_TimingDefines.h | 3 ++- lib_xud/src/core/XUD_TokenJmp.S | 3 ++- lib_xud/src/core/XUD_UIFM_PConfig.S | 3 ++- lib_xud/src/core/XUD_UIFM_RegAccess.S | 3 ++- lib_xud/src/core/XUD_USBTile_Support.S | 3 ++- lib_xud/src/core/XUD_USBTile_Support.h | 3 ++- lib_xud/src/core/XUD_USBTile_Support.xc | 3 ++- lib_xud/src/core/XUD_User.xc | 3 ++- lib_xud/src/core/XUD_UserResume.xc | 3 ++- lib_xud/src/core/included/XUD_PidJumpTable.S | 3 ++- lib_xud/src/core/included/XUD_RxData.S | 2 ++ lib_xud/src/core/included/XUD_Token_In.S | 3 ++- lib_xud/src/core/included/XUD_Token_In_DI.S | 3 ++- lib_xud/src/core/included/XUD_Token_Out.S | 3 ++- lib_xud/src/core/included/XUD_Token_Out_DI.S | 3 ++- lib_xud/src/core/included/XUD_Token_Ping.S | 3 ++- lib_xud/src/core/included/XUD_Token_SOF.S | 3 ++- lib_xud/src/core/included/XUD_Token_Setup.S | 3 ++- lib_xud/src/core/included/XUD_Token_Setup_DI.S | 3 ++- lib_xud/src/core/xs1_to_glx.h | 3 ++- lib_xud/src/core/xta_pragmas.h | 2 ++ lib_xud/src/user/XUD_USB_Defines.h | 3 ++- lib_xud/src/user/class/hid.h | 3 ++- lib_xud/src/user/class/usbaudio10.h | 3 ++- lib_xud/src/user/class/usbaudio20.h | 3 ++- lib_xud/src/user/class/usbaudiocommon.h | 3 ++- lib_xud/src/user/client/XUD_EpFuncs.S | 3 ++- lib_xud/src/user/client/XUD_EpFunctions.xc | 3 ++- lib_xud/src/user/client/XUD_SetDevAddr.xc | 3 ++- lib_xud/src/user/control/xud_device.xc | 3 ++- lib_xud/src/user/control/xud_std_requests.xc | 3 ++- lib_xud/xud_conf_example.h | 3 ++- python/setup.py | 3 ++- tests/helpers.py | 3 ++- tests/runtests.py | 3 ++- tests/shared_src/shared.h | 3 ++- tests/suspend_resume_functional/glx.h | 3 ++- tests/suspend_resume_functional/strings.h | 3 ++- tests/suspend_resume_functional/strings.xc | 3 ++- tests/suspend_resume_functional/stubs.xc | 3 ++- tests/suspend_resume_functional/test.xc | 3 ++- tests/test_bulk_loopback.py | 3 ++- tests/test_bulk_loopback/src/main.xc | 3 ++- tests/test_bulk_loopback/src/xc_ptr.h | 3 ++- tests/test_bulk_rx_basic.py | 3 ++- tests/test_bulk_rx_basic/src/main.xc | 3 ++- tests/test_bulk_rx_basic/src/xc_ptr.h | 3 ++- tests/test_bulk_rx_basic_badcrc32.py | 3 ++- tests/test_bulk_rx_basic_badcrc32/src/main.xc | 3 ++- tests/test_bulk_rx_basic_badcrc32/src/xc_ptr.h | 3 ++- tests/test_bulk_rx_basic_badpid.py | 3 ++- tests/test_bulk_rx_basic_badpid/src/main.xc | 3 ++- tests/test_bulk_rx_basic_badpid/src/xc_ptr.h | 3 ++- tests/test_bulk_rx_basic_nodata.py | 2 ++ tests/test_bulk_rx_basic_nodata/src/main.xc | 3 ++- tests/test_bulk_rx_basic_rxerror.py | 3 ++- tests/test_bulk_rx_basic_rxerror/src/main.xc | 3 ++- tests/test_bulk_rx_basic_rxerror/src/xc_ptr.h | 3 ++- tests/test_bulk_rx_multiep.py | 2 ++ tests/test_bulk_rx_multiep/src/main.xc | 3 ++- tests/test_bulk_rx_traffic.py | 2 ++ tests/test_bulk_rx_traffic/src/main.xc | 3 ++- tests/test_bulk_tx_badack.py | 2 ++ tests/test_bulk_tx_badack/src/main.xc | 3 ++- tests/test_bulk_tx_basic.py | 3 ++- tests/test_bulk_tx_basic/src/main.xc | 3 ++- tests/test_bulk_tx_basic/src/xc_ptr.h | 3 ++- tests/test_bulk_tx_basic_short.py | 2 ++ tests/test_bulk_tx_basic_short/src/main.xc | 3 ++- tests/test_bulk_tx_multiep.py | 2 ++ tests/test_bulk_tx_multiep/src/main.xc | 3 ++- tests/test_bulk_tx_noack.py | 2 ++ tests/test_bulk_tx_noack/src/main.xc | 3 ++- tests/test_control_basic_badcrc32/src/main.xc | 3 ++- tests/test_control_basic_badcrc32/src/xc_ptr.h | 3 ++- tests/test_control_basic_get.py | 3 ++- tests/test_control_basic_get/src/main.xc | 3 ++- tests/test_control_basic_get/src/xc_ptr.h | 3 ++- tests/test_control_basic_set.py | 3 ++- tests/test_control_basic_set/src/main.xc | 3 ++- tests/test_control_basic_set/src/xc_ptr.h | 3 ++- tests/test_control_basic_short/src/main.xc | 3 ++- tests/test_control_basic_short/src/xc_ptr.h | 3 ++- tests/test_control_repeatedsetup/src/main.xc | 3 ++- tests/test_control_repeatedsetup/src/xc_ptr.h | 3 ++- tests/test_invalidtoken.py | 3 ++- tests/test_invalidtoken/src/main.xc | 3 ++- tests/test_invalidtoken/src/xc_ptr.h | 3 ++- tests/test_iso_loopback.py | 3 ++- tests/test_iso_loopback/src/main.xc | 3 ++- tests/test_iso_loopback/src/xc_ptr.h | 3 ++- tests/test_iso_rx_basic.py | 3 ++- tests/test_iso_rx_basic/src/main.xc | 3 ++- tests/test_iso_rxtx_fastpacket.py | 3 ++- tests/test_iso_rxtx_fastpacket/src/main.xc | 3 ++- tests/test_iso_rxtx_fastpacket/src/xc_ptr.h | 3 ++- tests/test_iso_tx_basic.py | 3 ++- tests/test_iso_tx_basic/src/main.xc | 3 ++- tests/test_iso_tx_basic/src/xc_ptr.h | 3 ++- tests/test_ping_rx_basic.py | 3 ++- tests/test_ping_rx_basic/src/main.xc | 3 ++- tests/test_ping_rx_basic/src/xc_ptr.h | 3 ++- tests/test_shorttoken.py | 2 ++ tests/test_shorttoken/src/main.xc | 3 ++- tests/test_sof_badcrc.py | 2 ++ tests/test_sof_badcrc/src/main.xc | 3 ++- tests/test_sof_basic.py | 2 ++ tests/test_sof_basic/src/main.xc | 3 ++- tests/usb_clock.py | 3 ++- tests/usb_packet.py | 3 ++- tests/usb_phy.py | 3 ++- tests/usb_phy_shim.py | 2 ++ tests/usb_phy_utmi.py | 2 ++ 195 files changed, 390 insertions(+), 178 deletions(-) diff --git a/__app_test/main.xc b/__app_test/main.xc index 1efc6c4a..481d38ad 100644 --- a/__app_test/main.xc +++ b/__app_test/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2012-2018, XMOS Ltd, All rights reserved +// Copyright 2012-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent * in both directions between the ports. diff --git a/__app_test_mode/src/main.xc b/__app_test_mode/src/main.xc index 962accf3..5e9f4cdc 100644 --- a/__app_test_mode/src/main.xc +++ b/__app_test_mode/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2020, XMOS Ltd, All rights reserved +// Copyright 2020-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "xud_device.h" /* Number of Endpoints used by this app */ diff --git a/examples/AN00124_CDC_VCOM_class/src/main.xc b/examples/AN00124_CDC_VCOM_class/src/main.xc index ff3a7d93..d5db389e 100644 --- a/examples/AN00124_CDC_VCOM_class/src/main.xc +++ b/examples/AN00124_CDC_VCOM_class/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2018, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include diff --git a/examples/AN00124_CDC_VCOM_class/src/xud_cdc.h b/examples/AN00124_CDC_VCOM_class/src/xud_cdc.h index a65416a6..3dca3ed7 100644 --- a/examples/AN00124_CDC_VCOM_class/src/xud_cdc.h +++ b/examples/AN00124_CDC_VCOM_class/src/xud_cdc.h @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef XUD_CDC_H_ #define XUD_CDC_H_ diff --git a/examples/AN00124_CDC_VCOM_class/src/xud_cdc.xc b/examples/AN00124_CDC_VCOM_class/src/xud_cdc.xc index 100f77be..6e7d7fa6 100644 --- a/examples/AN00124_CDC_VCOM_class/src/xud_cdc.xc +++ b/examples/AN00124_CDC_VCOM_class/src/xud_cdc.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include diff --git a/examples/AN00125_mass_storage_class/src/debug_conf.h b/examples/AN00125_mass_storage_class/src/debug_conf.h index 82ab5236..b666c5e5 100644 --- a/examples/AN00125_mass_storage_class/src/debug_conf.h +++ b/examples/AN00125_mass_storage_class/src/debug_conf.h @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef DEBUG_CONF_H_ #define DEBUG_CONF_H_ diff --git a/examples/AN00125_mass_storage_class/src/endpoint0.xc b/examples/AN00125_mass_storage_class/src/endpoint0.xc index 49acdde7..1f43ae20 100644 --- a/examples/AN00125_mass_storage_class/src/endpoint0.xc +++ b/examples/AN00125_mass_storage_class/src/endpoint0.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* * @brief Implements endpoint zero for an example Mass Storage class device. diff --git a/examples/AN00125_mass_storage_class/src/main.xc b/examples/AN00125_mass_storage_class/src/main.xc index dafd11c5..b15f737e 100644 --- a/examples/AN00125_mass_storage_class/src/main.xc +++ b/examples/AN00125_mass_storage_class/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2018, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include "xud_device.h" diff --git a/examples/AN00125_mass_storage_class/src/mass_storage.h b/examples/AN00125_mass_storage_class/src/mass_storage.h index 83c1619e..733551ba 100644 --- a/examples/AN00125_mass_storage_class/src/mass_storage.h +++ b/examples/AN00125_mass_storage_class/src/mass_storage.h @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef MASS_STORAGE_H_ #define MASS_STORAGE_H_ diff --git a/examples/AN00125_mass_storage_class/src/mass_storage.xc b/examples/AN00125_mass_storage_class/src/mass_storage.xc index 5b759297..46d8421f 100644 --- a/examples/AN00125_mass_storage_class/src/mass_storage.xc +++ b/examples/AN00125_mass_storage_class/src/mass_storage.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include diff --git a/examples/AN00126_printer_class/src/endpoint0.xc b/examples/AN00126_printer_class/src/endpoint0.xc index 1abbf7e6..41fb8f5c 100644 --- a/examples/AN00126_printer_class/src/endpoint0.xc +++ b/examples/AN00126_printer_class/src/endpoint0.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* * @brief Implements endpoint zero for an example Printer class device. diff --git a/examples/AN00126_printer_class/src/main.xc b/examples/AN00126_printer_class/src/main.xc index 1c2b3b5e..6f99a091 100644 --- a/examples/AN00126_printer_class/src/main.xc +++ b/examples/AN00126_printer_class/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "xud_device.h" #include "debug_print.h" #include diff --git a/examples/AN00127_video_class/src/main.xc b/examples/AN00127_video_class/src/main.xc index e2955a31..00330cd5 100644 --- a/examples/AN00127_video_class/src/main.xc +++ b/examples/AN00127_video_class/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* Includes */ #include diff --git a/examples/AN00127_video_class/src/usb_video.h b/examples/AN00127_video_class/src/usb_video.h index 1d6d17ee..0cdd8caa 100644 --- a/examples/AN00127_video_class/src/usb_video.h +++ b/examples/AN00127_video_class/src/usb_video.h @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef USB_VIDEO_H_ #define USB_VIDEO_H_ diff --git a/examples/AN00127_video_class/src/usb_video.xc b/examples/AN00127_video_class/src/usb_video.xc index 6f335015..f3cd3b00 100644 --- a/examples/AN00127_video_class/src/usb_video.xc +++ b/examples/AN00127_video_class/src/usb_video.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "string.h" #include "usb_video.h" diff --git a/examples/AN00127_video_class/src/uvc_defs.h b/examples/AN00127_video_class/src/uvc_defs.h index add9b28f..f9a8b904 100644 --- a/examples/AN00127_video_class/src/uvc_defs.h +++ b/examples/AN00127_video_class/src/uvc_defs.h @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef UVC_DEFS_H_ #define UVC_DEFS_H_ diff --git a/examples/AN00127_video_class/src/uvc_req.c b/examples/AN00127_video_class/src/uvc_req.c index be09e585..10024761 100644 --- a/examples/AN00127_video_class/src/uvc_req.c +++ b/examples/AN00127_video_class/src/uvc_req.c @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include "uvc_req.h" diff --git a/examples/AN00127_video_class/src/uvc_req.h b/examples/AN00127_video_class/src/uvc_req.h index 4cbc3c7f..f1e978b6 100644 --- a/examples/AN00127_video_class/src/uvc_req.h +++ b/examples/AN00127_video_class/src/uvc_req.h @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef UVC_REQ_H_ #define UVC_REQ_H_ diff --git a/examples/AN00129_hid_class/src/endpoint0.xc b/examples/AN00129_hid_class/src/endpoint0.xc index caca128d..60bbafee 100644 --- a/examples/AN00129_hid_class/src/endpoint0.xc +++ b/examples/AN00129_hid_class/src/endpoint0.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2015-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* * @brief Implements endpoint zero for an example HID mouse device. */ diff --git a/examples/AN00129_hid_class/src/hid.h b/examples/AN00129_hid_class/src/hid.h index 0155660c..a6df0f11 100644 --- a/examples/AN00129_hid_class/src/hid.h +++ b/examples/AN00129_hid_class/src/hid.h @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2015-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* * @brief Defines from USB Device Class Definition for Human Interface Devices Specification */ diff --git a/examples/AN00129_hid_class/src/main.xc b/examples/AN00129_hid_class/src/main.xc index 63a6e740..49e171ad 100644 --- a/examples/AN00129_hid_class/src/main.xc +++ b/examples/AN00129_hid_class/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "xud_device.h" /* Number of Endpoints used by this app */ diff --git a/examples/AN00131_CDC_EDC_class/src/eth_tcp/dhcp.h b/examples/AN00131_CDC_EDC_class/src/eth_tcp/dhcp.h index 9a2abe75..d7d68d34 100644 --- a/examples/AN00131_CDC_EDC_class/src/eth_tcp/dhcp.h +++ b/examples/AN00131_CDC_EDC_class/src/eth_tcp/dhcp.h @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _DHCP_H_ #define _DHCP_H_ diff --git a/examples/AN00131_CDC_EDC_class/src/eth_tcp/dhcp.xc b/examples/AN00131_CDC_EDC_class/src/eth_tcp/dhcp.xc index 05d933cf..699561f9 100644 --- a/examples/AN00131_CDC_EDC_class/src/eth_tcp/dhcp.xc +++ b/examples/AN00131_CDC_EDC_class/src/eth_tcp/dhcp.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include diff --git a/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoIP.h b/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoIP.h index 2b380dd4..44b40a6c 100644 --- a/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoIP.h +++ b/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoIP.h @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _FEMTOIP_H_ #define _FEMTOIP_H_ diff --git a/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoIP.xc b/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoIP.xc index c275dcf9..cebf8661 100644 --- a/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoIP.xc +++ b/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoIP.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include "femtoIP.h" diff --git a/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoTCP.h b/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoTCP.h index 5c5d49f2..9e9a7327 100644 --- a/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoTCP.h +++ b/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoTCP.h @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _FEMTOTCP_H_ #define _FEMTOTCP_H_ diff --git a/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoTCP.xc b/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoTCP.xc index b2cdf107..43fcc857 100644 --- a/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoTCP.xc +++ b/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoTCP.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include diff --git a/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoUDP.h b/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoUDP.h index 85fa70ff..fdc2c5ca 100644 --- a/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoUDP.h +++ b/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoUDP.h @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _FEMTOUDP_H_ #define _FEMTOUDP_H_ diff --git a/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoUDP.xc b/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoUDP.xc index b43a2c00..d029675e 100644 --- a/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoUDP.xc +++ b/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoUDP.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include diff --git a/examples/AN00131_CDC_EDC_class/src/eth_tcp/http.h b/examples/AN00131_CDC_EDC_class/src/eth_tcp/http.h index 3d160f01..5fe4b098 100644 --- a/examples/AN00131_CDC_EDC_class/src/eth_tcp/http.h +++ b/examples/AN00131_CDC_EDC_class/src/eth_tcp/http.h @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _HTTP_H_ #define _HTTP_H_ diff --git a/examples/AN00131_CDC_EDC_class/src/eth_tcp/http.xc b/examples/AN00131_CDC_EDC_class/src/eth_tcp/http.xc index e66636dd..283288ca 100644 --- a/examples/AN00131_CDC_EDC_class/src/eth_tcp/http.xc +++ b/examples/AN00131_CDC_EDC_class/src/eth_tcp/http.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include diff --git a/examples/AN00131_CDC_EDC_class/src/ethernet.h b/examples/AN00131_CDC_EDC_class/src/ethernet.h index 8bc001a3..f5802154 100644 --- a/examples/AN00131_CDC_EDC_class/src/ethernet.h +++ b/examples/AN00131_CDC_EDC_class/src/ethernet.h @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _ETHERNET_H_ #define _ETHERNET_H_ diff --git a/examples/AN00131_CDC_EDC_class/src/ethernet.xc b/examples/AN00131_CDC_EDC_class/src/ethernet.xc index 049ed936..53679596 100644 --- a/examples/AN00131_CDC_EDC_class/src/ethernet.xc +++ b/examples/AN00131_CDC_EDC_class/src/ethernet.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include diff --git a/examples/AN00131_CDC_EDC_class/src/main.xc b/examples/AN00131_CDC_EDC_class/src/main.xc index fd5a9b28..8f379a91 100644 --- a/examples/AN00131_CDC_EDC_class/src/main.xc +++ b/examples/AN00131_CDC_EDC_class/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include diff --git a/examples/AN00131_CDC_EDC_class/src/packet_buffer.h b/examples/AN00131_CDC_EDC_class/src/packet_buffer.h index 0f7300ef..4704c1a0 100644 --- a/examples/AN00131_CDC_EDC_class/src/packet_buffer.h +++ b/examples/AN00131_CDC_EDC_class/src/packet_buffer.h @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef PACKET_BUFFER_H_ #define PACKET_BUFFER_H_ diff --git a/examples/AN00131_CDC_EDC_class/src/packet_buffer.xc b/examples/AN00131_CDC_EDC_class/src/packet_buffer.xc index 6f706d85..d63e337b 100644 --- a/examples/AN00131_CDC_EDC_class/src/packet_buffer.xc +++ b/examples/AN00131_CDC_EDC_class/src/packet_buffer.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "packet_buffer.h" #include diff --git a/examples/AN00131_CDC_EDC_class/src/queue.h b/examples/AN00131_CDC_EDC_class/src/queue.h index 430cdf11..5d8c8786 100644 --- a/examples/AN00131_CDC_EDC_class/src/queue.h +++ b/examples/AN00131_CDC_EDC_class/src/queue.h @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef QUEUE_H_ #define QUEUE_H_ diff --git a/examples/AN00131_CDC_EDC_class/src/queue.xc b/examples/AN00131_CDC_EDC_class/src/queue.xc index 70b52d94..bfb64f98 100644 --- a/examples/AN00131_CDC_EDC_class/src/queue.xc +++ b/examples/AN00131_CDC_EDC_class/src/queue.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include diff --git a/examples/AN00131_CDC_EDC_class/src/xud_ecm.h b/examples/AN00131_CDC_EDC_class/src/xud_ecm.h index 64d422cf..f4e3c031 100644 --- a/examples/AN00131_CDC_EDC_class/src/xud_ecm.h +++ b/examples/AN00131_CDC_EDC_class/src/xud_ecm.h @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef XUD_ECM_H_ #define XUD_ECM_H_ diff --git a/examples/AN00131_CDC_EDC_class/src/xud_ecm.xc b/examples/AN00131_CDC_EDC_class/src/xud_ecm.xc index b7df653f..72c231c9 100644 --- a/examples/AN00131_CDC_EDC_class/src/xud_ecm.xc +++ b/examples/AN00131_CDC_EDC_class/src/xud_ecm.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include diff --git a/examples/AN00132_image_class/host/get_image.cpp b/examples/AN00132_image_class/host/get_image.cpp index 0ee05a8b..76e73620 100644 --- a/examples/AN00132_image_class/host/get_image.cpp +++ b/examples/AN00132_image_class/host/get_image.cpp @@ -1,4 +1,5 @@ -// Copyright (c) 2017-2018, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include #include diff --git a/examples/AN00132_image_class/host/ptp.h b/examples/AN00132_image_class/host/ptp.h index d5fc5ff2..08297e52 100644 --- a/examples/AN00132_image_class/host/ptp.h +++ b/examples/AN00132_image_class/host/ptp.h @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __PTP_H__ #define __PTP_H__ diff --git a/examples/AN00132_image_class/src/endpoint0.xc b/examples/AN00132_image_class/src/endpoint0.xc index 64391232..8a9dd00d 100644 --- a/examples/AN00132_image_class/src/endpoint0.xc +++ b/examples/AN00132_image_class/src/endpoint0.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* * @brief Implements endpoint zero for an example image acquisition device. diff --git a/examples/AN00132_image_class/src/main.xc b/examples/AN00132_image_class/src/main.xc index f4ab86f0..988722f8 100644 --- a/examples/AN00132_image_class/src/main.xc +++ b/examples/AN00132_image_class/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include diff --git a/examples/AN00135_test_and_measurement_class/host/usbtmc_test.py b/examples/AN00135_test_and_measurement_class/host/usbtmc_test.py index 3076921f..ab68b647 100644 --- a/examples/AN00135_test_and_measurement_class/host/usbtmc_test.py +++ b/examples/AN00135_test_and_measurement_class/host/usbtmc_test.py @@ -1,4 +1,5 @@ -# Copyright (c) 2015-2019, XMOS Ltd, All rights reserved +# Copyright 2017-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. import usb.core import usb.util diff --git a/examples/AN00135_test_and_measurement_class/src/endpoint0.xc b/examples/AN00135_test_and_measurement_class/src/endpoint0.xc index 7b656a83..c4fb22f0 100644 --- a/examples/AN00135_test_and_measurement_class/src/endpoint0.xc +++ b/examples/AN00135_test_and_measurement_class/src/endpoint0.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* * @brief Implements endpoint zero for an example USBTMC test device class diff --git a/examples/AN00135_test_and_measurement_class/src/main.xc b/examples/AN00135_test_and_measurement_class/src/main.xc index 9c861a61..d425a1ed 100644 --- a/examples/AN00135_test_and_measurement_class/src/main.xc +++ b/examples/AN00135_test_and_measurement_class/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "xud_device.h" diff --git a/examples/AN00135_test_and_measurement_class/src/scpi_parser/custom/scpi_cmds.c b/examples/AN00135_test_and_measurement_class/src/scpi_parser/custom/scpi_cmds.c index b1469799..be5cb219 100644 --- a/examples/AN00135_test_and_measurement_class/src/scpi_parser/custom/scpi_cmds.c +++ b/examples/AN00135_test_and_measurement_class/src/scpi_parser/custom/scpi_cmds.c @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /** * @brief Implementation of SCPI command callbacks diff --git a/examples/AN00135_test_and_measurement_class/src/scpi_parser/custom/scpi_cmds.h b/examples/AN00135_test_and_measurement_class/src/scpi_parser/custom/scpi_cmds.h index a85f65fd..d8230fde 100644 --- a/examples/AN00135_test_and_measurement_class/src/scpi_parser/custom/scpi_cmds.h +++ b/examples/AN00135_test_and_measurement_class/src/scpi_parser/custom/scpi_cmds.h @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef SCPI_DEF_H_ #define SCPI_DEF_H_ diff --git a/examples/AN00135_test_and_measurement_class/src/scpi_parser/custom/scpi_parser_wrapper.c b/examples/AN00135_test_and_measurement_class/src/scpi_parser/custom/scpi_parser_wrapper.c index 36eb6ce0..7877e127 100644 --- a/examples/AN00135_test_and_measurement_class/src/scpi_parser/custom/scpi_parser_wrapper.c +++ b/examples/AN00135_test_and_measurement_class/src/scpi_parser/custom/scpi_parser_wrapper.c @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /** * @brief Wrapper calls for SCPI interfacing from a XC client core diff --git a/examples/AN00135_test_and_measurement_class/src/scpi_parser/custom/scpi_parser_wrapper.h b/examples/AN00135_test_and_measurement_class/src/scpi_parser/custom/scpi_parser_wrapper.h index f63f527e..a5ded8f0 100644 --- a/examples/AN00135_test_and_measurement_class/src/scpi_parser/custom/scpi_parser_wrapper.h +++ b/examples/AN00135_test_and_measurement_class/src/scpi_parser/custom/scpi_parser_wrapper.h @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef SCPI_PARSER_WRAPPER_H_ #define SCPI_PARSER_WRAPPER_H_ diff --git a/examples/AN00135_test_and_measurement_class/src/scpi_parser/fifo.c b/examples/AN00135_test_and_measurement_class/src/scpi_parser/fifo.c index 9c51be7e..74e0ec74 100644 --- a/examples/AN00135_test_and_measurement_class/src/scpi_parser/fifo.c +++ b/examples/AN00135_test_and_measurement_class/src/scpi_parser/fifo.c @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "scpi/fifo.h" diff --git a/examples/AN00135_test_and_measurement_class/src/usbtmc_endpoints.xc b/examples/AN00135_test_and_measurement_class/src/usbtmc_endpoints.xc index 42ed308f..0cd81f63 100644 --- a/examples/AN00135_test_and_measurement_class/src/usbtmc_endpoints.xc +++ b/examples/AN00135_test_and_measurement_class/src/usbtmc_endpoints.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "xud_device.h" #include "scpi_parser_wrapper.h" diff --git a/examples/AN00136_vendor_specific/host/bulk_read_benchmark.cpp b/examples/AN00136_vendor_specific/host/bulk_read_benchmark.cpp index 9d58428e..99074c9b 100755 --- a/examples/AN00136_vendor_specific/host/bulk_read_benchmark.cpp +++ b/examples/AN00136_vendor_specific/host/bulk_read_benchmark.cpp @@ -1,4 +1,5 @@ -// Copyright (c) 2017-2018, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include #include diff --git a/examples/AN00136_vendor_specific/host/bulktest.cpp b/examples/AN00136_vendor_specific/host/bulktest.cpp index 1b23b9b1..39a6975d 100644 --- a/examples/AN00136_vendor_specific/host/bulktest.cpp +++ b/examples/AN00136_vendor_specific/host/bulktest.cpp @@ -1,4 +1,5 @@ -// Copyright (c) 2017-2018, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include #include diff --git a/examples/AN00136_vendor_specific/src/endpoint0.xc b/examples/AN00136_vendor_specific/src/endpoint0.xc index 13939e18..e455b3ef 100644 --- a/examples/AN00136_vendor_specific/src/endpoint0.xc +++ b/examples/AN00136_vendor_specific/src/endpoint0.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include "xud_device.h" diff --git a/examples/AN00136_vendor_specific/src/main.xc b/examples/AN00136_vendor_specific/src/main.xc index cf646696..97e0edc2 100644 --- a/examples/AN00136_vendor_specific/src/main.xc +++ b/examples/AN00136_vendor_specific/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include "xud_device.h" diff --git a/lib_xud/api/xud.h b/lib_xud/api/xud.h index e1698aa4..dca1235b 100644 --- a/lib_xud/api/xud.h +++ b/lib_xud/api/xud.h @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* * \brief User defines and functions for XMOS USB Device library */ diff --git a/lib_xud/api/xud_conf_default.h b/lib_xud/api/xud_conf_default.h index 2e945b28..76617f33 100644 --- a/lib_xud/api/xud_conf_default.h +++ b/lib_xud/api/xud_conf_default.h @@ -1,4 +1,5 @@ -// Copyright (c) 2017, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __XUD_CONF_DEFAULT_H__ #define __XUD_CONF_DEFAULT_H__ diff --git a/lib_xud/api/xud_device.h b/lib_xud/api/xud_device.h index 865c78bf..d68b8dca 100644 --- a/lib_xud/api/xud_device.h +++ b/lib_xud/api/xud_device.h @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2018, XMOS Ltd, All rights reserved +// Copyright 2015-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* * @brief USB Device helper functions */ diff --git a/lib_xud/api/xud_std_descriptors.h b/lib_xud/api/xud_std_descriptors.h index 42af4b91..a4c65b12 100644 --- a/lib_xud/api/xud_std_descriptors.h +++ b/lib_xud/api/xud_std_descriptors.h @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2018, XMOS Ltd, All rights reserved +// Copyright 2015-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _USB_DESCRIPTORS_H_ #define _USB_DESCRIPTORS_H_ diff --git a/lib_xud/api/xud_std_requests.h b/lib_xud/api/xud_std_requests.h index 5a7768dd..5fafbb21 100644 --- a/lib_xud/api/xud_std_requests.h +++ b/lib_xud/api/xud_std_requests.h @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2018, XMOS Ltd, All rights reserved +// Copyright 2015-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _USB_STD_REQUESTS_H_ #define _USB_STD_REQUESTS_H_ diff --git a/lib_xud/src/core/XUD_AlignmentDefines.h b/lib_xud/src/core/XUD_AlignmentDefines.h index de8fe096..ed4e7f41 100644 --- a/lib_xud/src/core/XUD_AlignmentDefines.h +++ b/lib_xud/src/core/XUD_AlignmentDefines.h @@ -1,4 +1,5 @@ -// Copyright (c) 2021, XMOS Ltd, All rights reserved +// Copyright 2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* XUD_AlignmentDefines.h * @brief Architecture-specific ASM function alignment */ diff --git a/lib_xud/src/core/XUD_CRC5_Table.S b/lib_xud/src/core/XUD_CRC5_Table.S index 758efec7..c8e941e3 100755 --- a/lib_xud/src/core/XUD_CRC5_Table.S +++ b/lib_xud/src/core/XUD_CRC5_Table.S @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /** XUD_CRC5_Table.S * @brief Full USB CRC5 table * @author Ross Owen, XMOS Limited diff --git a/lib_xud/src/core/XUD_CRC5_Table_Addr.S b/lib_xud/src/core/XUD_CRC5_Table_Addr.S index c005a290..eec473b3 100755 --- a/lib_xud/src/core/XUD_CRC5_Table_Addr.S +++ b/lib_xud/src/core/XUD_CRC5_Table_Addr.S @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2021, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /** XUD_CRC5_Table_Addr.S * @brief CRC5 table * @author Ross Owen, XMOS Limited diff --git a/lib_xud/src/core/XUD_CrcAddrCheck.S b/lib_xud/src/core/XUD_CrcAddrCheck.S index 2c2f24fd..3e48574a 100644 --- a/lib_xud/src/core/XUD_CrcAddrCheck.S +++ b/lib_xud/src/core/XUD_CrcAddrCheck.S @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2019-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. // On Entry: // r0: rxd port diff --git a/lib_xud/src/core/XUD_DeviceAttach.h b/lib_xud/src/core/XUD_DeviceAttach.h index ed0ae5cc..514d1d89 100644 --- a/lib_xud/src/core/XUD_DeviceAttach.h +++ b/lib_xud/src/core/XUD_DeviceAttach.h @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /** @brief Does high speed device attach diff --git a/lib_xud/src/core/XUD_DeviceAttach.xc b/lib_xud/src/core/XUD_DeviceAttach.xc index c7f1b74d..f884e28c 100755 --- a/lib_xud/src/core/XUD_DeviceAttach.xc +++ b/lib_xud/src/core/XUD_DeviceAttach.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #if !defined(XUD_BYPASS_RESET) && !defined(XUD_SIM_XSIM) #include #include diff --git a/lib_xud/src/core/XUD_HAL.h b/lib_xud/src/core/XUD_HAL.h index 60ffec9d..51ee87ec 100644 --- a/lib_xud/src/core/XUD_HAL.h +++ b/lib_xud/src/core/XUD_HAL.h @@ -1,3 +1,5 @@ +// Copyright 2019-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "xud.h" /** * @file XUD_HAL.h diff --git a/lib_xud/src/core/XUD_HAL.xc b/lib_xud/src/core/XUD_HAL.xc index bf24ad0b..61781aba 100644 --- a/lib_xud/src/core/XUD_HAL.xc +++ b/lib_xud/src/core/XUD_HAL.xc @@ -1,3 +1,5 @@ +// Copyright 2019-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include "xud.h" diff --git a/lib_xud/src/core/XUD_IOLoopCall.xc b/lib_xud/src/core/XUD_IOLoopCall.xc index 89c12a34..28900558 100644 --- a/lib_xud/src/core/XUD_IOLoopCall.xc +++ b/lib_xud/src/core/XUD_IOLoopCall.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include diff --git a/lib_xud/src/core/XUD_IoLoop.S b/lib_xud/src/core/XUD_IoLoop.S index 34990f3b..03f7c051 100755 --- a/lib_xud/src/core/XUD_IoLoop.S +++ b/lib_xud/src/core/XUD_IoLoop.S @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2021, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. // XUD_LLD_IoLoop.S // Main USB interfacing loop diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index 213ad4c4..0715fdfa 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /** * @file XUD_Main.xc diff --git a/lib_xud/src/core/XUD_PowerSig.h b/lib_xud/src/core/XUD_PowerSig.h index 0ea314dc..27886b4d 100644 --- a/lib_xud/src/core/XUD_PowerSig.h +++ b/lib_xud/src/core/XUD_PowerSig.h @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _XUD_PWRSIG_H_ #define _XUD_PWRSIG_H_ diff --git a/lib_xud/src/core/XUD_PowerSig.xc b/lib_xud/src/core/XUD_PowerSig.xc index 9fa526fd..a8b604ef 100755 --- a/lib_xud/src/core/XUD_PowerSig.xc +++ b/lib_xud/src/core/XUD_PowerSig.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /** @file XUD_PowerSig.xc * @brief Functions for USB power signaling * @author Ross Owen, XMOS Limited diff --git a/lib_xud/src/core/XUD_SetCrcTableAddr.c b/lib_xud/src/core/XUD_SetCrcTableAddr.c index 747f210d..81fafaf4 100644 --- a/lib_xud/src/core/XUD_SetCrcTableAddr.c +++ b/lib_xud/src/core/XUD_SetCrcTableAddr.c @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /** @file XUD_SetCrcTableAddr.c * @author Ross Owen, XMOS Limited */ diff --git a/lib_xud/src/core/XUD_SetupChanOverride.S b/lib_xud/src/core/XUD_SetupChanOverride.S index b5a3dcdd..b9fbe0f8 100644 --- a/lib_xud/src/core/XUD_SetupChanOverride.S +++ b/lib_xud/src/core/XUD_SetupChanOverride.S @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. .globl SetupChannelVectorsOverride.nstackwords .globl SetupChannelVectorsOverride.maxthreads .globl SetupChannelVectorsOverride.maxtimers diff --git a/lib_xud/src/core/XUD_Support.h b/lib_xud/src/core/XUD_Support.h index 27f602e2..189753ac 100644 --- a/lib_xud/src/core/XUD_Support.h +++ b/lib_xud/src/core/XUD_Support.h @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /** @file XUD_Support.h * @brief Various support functions used in XUD * @author Ross Owen, XMOS Limited diff --git a/lib_xud/src/core/XUD_Support.xc b/lib_xud/src/core/XUD_Support.xc index cb495fb9..25c7bb2e 100755 --- a/lib_xud/src/core/XUD_Support.xc +++ b/lib_xud/src/core/XUD_Support.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2013-2018, XMOS Ltd, All rights reserved +// Copyright 2013-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "XUD_Support.h" #include diff --git a/lib_xud/src/core/XUD_TestMode.S b/lib_xud/src/core/XUD_TestMode.S index 70feda7e..f01b65fa 100644 --- a/lib_xud/src/core/XUD_TestMode.S +++ b/lib_xud/src/core/XUD_TestMode.S @@ -1,3 +1,5 @@ +// Copyright 2020-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include "XUD_USB_Defines.h" diff --git a/lib_xud/src/core/XUD_TestMode.h b/lib_xud/src/core/XUD_TestMode.h index e47539b5..465e054e 100644 --- a/lib_xud/src/core/XUD_TestMode.h +++ b/lib_xud/src/core/XUD_TestMode.h @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __XUD_TESTMODE_H__ #define __XUD_TESTMODE_H__ diff --git a/lib_xud/src/core/XUD_TestMode.xc b/lib_xud/src/core/XUD_TestMode.xc index 06ae5309..a380f69a 100644 --- a/lib_xud/src/core/XUD_TestMode.xc +++ b/lib_xud/src/core/XUD_TestMode.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include "xud.h" diff --git a/lib_xud/src/core/XUD_TimingDefines.h b/lib_xud/src/core/XUD_TimingDefines.h index 55358b3c..ed9fc1df 100755 --- a/lib_xud/src/core/XUD_TimingDefines.h +++ b/lib_xud/src/core/XUD_TimingDefines.h @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2018, XMOS Ltd, All rights reserved +// Copyright 2015-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _XUD_USB_DEFINES_H_ #define _XUD_USB_DEFINES_H_ diff --git a/lib_xud/src/core/XUD_TokenJmp.S b/lib_xud/src/core/XUD_TokenJmp.S index 5538f253..adf434b4 100644 --- a/lib_xud/src/core/XUD_TokenJmp.S +++ b/lib_xud/src/core/XUD_TokenJmp.S @@ -1,4 +1,5 @@ -// Copyright (c) 2013-2018, XMOS Ltd, All rights reserved +// Copyright 2013-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __XS3A__ ldaw r10, dp[PidJumpTable] // TODO Could load from sp here diff --git a/lib_xud/src/core/XUD_UIFM_PConfig.S b/lib_xud/src/core/XUD_UIFM_PConfig.S index c54d5ac7..d08d47c5 100755 --- a/lib_xud/src/core/XUD_UIFM_PConfig.S +++ b/lib_xud/src/core/XUD_UIFM_PConfig.S @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. // XUD_UIFM_PConfig.S // Port configuration for UIFM diff --git a/lib_xud/src/core/XUD_UIFM_RegAccess.S b/lib_xud/src/core/XUD_UIFM_RegAccess.S index f5a8c355..4f5134db 100644 --- a/lib_xud/src/core/XUD_UIFM_RegAccess.S +++ b/lib_xud/src/core/XUD_UIFM_RegAccess.S @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /** XUD_UIFM_RegAccess.S * @brief Functions for UIFM register read/write * @author Ross Owen, XMOS Limited diff --git a/lib_xud/src/core/XUD_USBTile_Support.S b/lib_xud/src/core/XUD_USBTile_Support.S index 20124539..ba6fb4a5 100644 --- a/lib_xud/src/core/XUD_USBTile_Support.S +++ b/lib_xud/src/core/XUD_USBTile_Support.S @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2018, XMOS Ltd, All rights reserved +// Copyright 2015-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /** XUD_USBTile_Support.S * @brief Support functions for USB Tile use * @author Ross Owen, XMOS Limited diff --git a/lib_xud/src/core/XUD_USBTile_Support.h b/lib_xud/src/core/XUD_USBTile_Support.h index 14968360..204b5b8a 100755 --- a/lib_xud/src/core/XUD_USBTile_Support.h +++ b/lib_xud/src/core/XUD_USBTile_Support.h @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2018, XMOS Ltd, All rights reserved +// Copyright 2015-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _XUD_USBTILE_SUPPORT_H_ #define _XUD_USBTILE_SUPPORT_H_ 1 diff --git a/lib_xud/src/core/XUD_USBTile_Support.xc b/lib_xud/src/core/XUD_USBTile_Support.xc index 02522696..901018fc 100644 --- a/lib_xud/src/core/XUD_USBTile_Support.xc +++ b/lib_xud/src/core/XUD_USBTile_Support.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2013-2018, XMOS Ltd, All rights reserved +// Copyright 2013-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include diff --git a/lib_xud/src/core/XUD_User.xc b/lib_xud/src/core/XUD_User.xc index 27bdee0d..b5fc073d 100644 --- a/lib_xud/src/core/XUD_User.xc +++ b/lib_xud/src/core/XUD_User.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* User functions to be overridden by app */ diff --git a/lib_xud/src/core/XUD_UserResume.xc b/lib_xud/src/core/XUD_UserResume.xc index b67c5168..23d33552 100644 --- a/lib_xud/src/core/XUD_UserResume.xc +++ b/lib_xud/src/core/XUD_UserResume.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* User functions to be overriddern by app */ void XUD_UserResume() diff --git a/lib_xud/src/core/included/XUD_PidJumpTable.S b/lib_xud/src/core/included/XUD_PidJumpTable.S index b15d548b..76ee96b2 100755 --- a/lib_xud/src/core/included/XUD_PidJumpTable.S +++ b/lib_xud/src/core/included/XUD_PidJumpTable.S @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #if defined (__XS2A__) // PID jump table diff --git a/lib_xud/src/core/included/XUD_RxData.S b/lib_xud/src/core/included/XUD_RxData.S index 540bb060..dde77ddf 100644 --- a/lib_xud/src/core/included/XUD_RxData.S +++ b/lib_xud/src/core/included/XUD_RxData.S @@ -1,3 +1,5 @@ +// Copyright 2019-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #define PASTER(x,y) x ## _ ## y diff --git a/lib_xud/src/core/included/XUD_Token_In.S b/lib_xud/src/core/included/XUD_Token_In.S index 92d93657..4698abef 100755 --- a/lib_xud/src/core/included/XUD_Token_In.S +++ b/lib_xud/src/core/included/XUD_Token_In.S @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include "XUD_AlignmentDefines.h" diff --git a/lib_xud/src/core/included/XUD_Token_In_DI.S b/lib_xud/src/core/included/XUD_Token_In_DI.S index 560d2d3e..1a232198 100755 --- a/lib_xud/src/core/included/XUD_Token_In_DI.S +++ b/lib_xud/src/core/included/XUD_Token_In_DI.S @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include "XUD_AlignmentDefines.h" diff --git a/lib_xud/src/core/included/XUD_Token_Out.S b/lib_xud/src/core/included/XUD_Token_Out.S index 61f84332..6f4a8d4a 100755 --- a/lib_xud/src/core/included/XUD_Token_Out.S +++ b/lib_xud/src/core/included/XUD_Token_Out.S @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2021, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. // r10: EP number // OUT Token Packet ----------------------------------------------------------------------------- // Ports diff --git a/lib_xud/src/core/included/XUD_Token_Out_DI.S b/lib_xud/src/core/included/XUD_Token_Out_DI.S index 9b86db32..174cf392 100755 --- a/lib_xud/src/core/included/XUD_Token_Out_DI.S +++ b/lib_xud/src/core/included/XUD_Token_Out_DI.S @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. // r10: EP number // OUT Token Packet ----------------------------------------------------------------------------- #include "XUD_AlignmentDefines.h" diff --git a/lib_xud/src/core/included/XUD_Token_Ping.S b/lib_xud/src/core/included/XUD_Token_Ping.S index 29742a5b..142096af 100755 --- a/lib_xud/src/core/included/XUD_Token_Ping.S +++ b/lib_xud/src/core/included/XUD_Token_Ping.S @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "XUD_AlignmentDefines.h" .align FUNCTION_ALIGNMENT diff --git a/lib_xud/src/core/included/XUD_Token_SOF.S b/lib_xud/src/core/included/XUD_Token_SOF.S index 99d09cb8..119ebe51 100644 --- a/lib_xud/src/core/included/XUD_Token_SOF.S +++ b/lib_xud/src/core/included/XUD_Token_SOF.S @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "XUD_AlignmentDefines.h" // Received SOF token: Reset suspend/reset detection timer diff --git a/lib_xud/src/core/included/XUD_Token_Setup.S b/lib_xud/src/core/included/XUD_Token_Setup.S index b5d9788b..aadea792 100644 --- a/lib_xud/src/core/included/XUD_Token_Setup.S +++ b/lib_xud/src/core/included/XUD_Token_Setup.S @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "XUD_AlignmentDefines.h" .text diff --git a/lib_xud/src/core/included/XUD_Token_Setup_DI.S b/lib_xud/src/core/included/XUD_Token_Setup_DI.S index 9fcc8759..1750fabb 100644 --- a/lib_xud/src/core/included/XUD_Token_Setup_DI.S +++ b/lib_xud/src/core/included/XUD_Token_Setup_DI.S @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved +// Copyright 2019-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "XUD_AlignmentDefines.h" // We received a setup token. This is much the same as out token, apart from: diff --git a/lib_xud/src/core/xs1_to_glx.h b/lib_xud/src/core/xs1_to_glx.h index df5415e6..cfee80b1 100644 --- a/lib_xud/src/core/xs1_to_glx.h +++ b/lib_xud/src/core/xs1_to_glx.h @@ -1,4 +1,5 @@ -// Copyright (c) 2017-2018, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _XS1_TO_GLX_H_ #define _XS1_TO_GLX_H_ diff --git a/lib_xud/src/core/xta_pragmas.h b/lib_xud/src/core/xta_pragmas.h index e99bacd1..87f41405 100644 --- a/lib_xud/src/core/xta_pragmas.h +++ b/lib_xud/src/core/xta_pragmas.h @@ -1,3 +1,5 @@ +// Copyright 2020-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #if 0 #pragma xta command "config threads stdcore[0] 6" #pragma xta command "add exclusion Pid_Out" diff --git a/lib_xud/src/user/XUD_USB_Defines.h b/lib_xud/src/user/XUD_USB_Defines.h index d84d1cab..6f0082ef 100644 --- a/lib_xud/src/user/XUD_USB_Defines.h +++ b/lib_xud/src/user/XUD_USB_Defines.h @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2018, XMOS Ltd, All rights reserved +// Copyright 2015-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /** * @brief Defines from the Universal Serial Bus Specification Revision 2.0 **/ diff --git a/lib_xud/src/user/class/hid.h b/lib_xud/src/user/class/hid.h index 049aa43c..a6df0f11 100644 --- a/lib_xud/src/user/class/hid.h +++ b/lib_xud/src/user/class/hid.h @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2018, XMOS Ltd, All rights reserved +// Copyright 2015-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* * @brief Defines from USB Device Class Definition for Human Interface Devices Specification */ diff --git a/lib_xud/src/user/class/usbaudio10.h b/lib_xud/src/user/class/usbaudio10.h index 29f36bcb..712de4ab 100644 --- a/lib_xud/src/user/class/usbaudio10.h +++ b/lib_xud/src/user/class/usbaudio10.h @@ -1,4 +1,5 @@ -// Copyright (c) 2017-2018, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _AUDIO10_H_ #define _AUDIO10_H_ 1 diff --git a/lib_xud/src/user/class/usbaudio20.h b/lib_xud/src/user/class/usbaudio20.h index 05b0f2e6..ed9fec95 100644 --- a/lib_xud/src/user/class/usbaudio20.h +++ b/lib_xud/src/user/class/usbaudio20.h @@ -1,4 +1,5 @@ -// Copyright (c) 2017-2018, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /** * @brief Defines from the USB Audio 2.0 Specifications * @author Ross Owen, XMOS Limited diff --git a/lib_xud/src/user/class/usbaudiocommon.h b/lib_xud/src/user/class/usbaudiocommon.h index e31c7611..87f20615 100644 --- a/lib_xud/src/user/class/usbaudiocommon.h +++ b/lib_xud/src/user/class/usbaudiocommon.h @@ -1,4 +1,5 @@ -// Copyright (c) 2017-2018, XMOS Ltd, All rights reserved +// Copyright 2017-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _USBAUDIOCOMMON_H_ #define _USBAUDIOCOMMON_H_ diff --git a/lib_xud/src/user/client/XUD_EpFuncs.S b/lib_xud/src/user/client/XUD_EpFuncs.S index 3598078b..82036dc8 100644 --- a/lib_xud/src/user/client/XUD_EpFuncs.S +++ b/lib_xud/src/user/client/XUD_EpFuncs.S @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2021, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /** XUD_EpFuncs.S * @brief ASM functions for data transfer to/from XUD * @author Ross Owen, XMOS Limited diff --git a/lib_xud/src/user/client/XUD_EpFunctions.xc b/lib_xud/src/user/client/XUD_EpFunctions.xc index 59ea2e2e..051f21fd 100644 --- a/lib_xud/src/user/client/XUD_EpFunctions.xc +++ b/lib_xud/src/user/client/XUD_EpFunctions.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /** @file XUD_EPFunctions.xc * @brief Implementation of user API functions. See xud.h for documentation. * @author Ross Owen, XMOS Limited diff --git a/lib_xud/src/user/client/XUD_SetDevAddr.xc b/lib_xud/src/user/client/XUD_SetDevAddr.xc index 1f7191f6..1c412c2b 100644 --- a/lib_xud/src/user/client/XUD_SetDevAddr.xc +++ b/lib_xud/src/user/client/XUD_SetDevAddr.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved +// Copyright 2011-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "xud.h" #include "XUD_HAL.h" diff --git a/lib_xud/src/user/control/xud_device.xc b/lib_xud/src/user/control/xud_device.xc index 55233dd9..32525dbc 100644 --- a/lib_xud/src/user/control/xud_device.xc +++ b/lib_xud/src/user/control/xud_device.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2019, XMOS Ltd, All rights reserved +// Copyright 2015-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /** * @brief Implements USB Device standard requests * @author Ross Owen, XMOS Limited diff --git a/lib_xud/src/user/control/xud_std_requests.xc b/lib_xud/src/user/control/xud_std_requests.xc index 76e5d70a..b012ee83 100644 --- a/lib_xud/src/user/control/xud_std_requests.xc +++ b/lib_xud/src/user/control/xud_std_requests.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2015-2018, XMOS Ltd, All rights reserved +// Copyright 2015-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include diff --git a/lib_xud/xud_conf_example.h b/lib_xud/xud_conf_example.h index f7afd9ed..13040e27 100644 --- a/lib_xud/xud_conf_example.h +++ b/lib_xud/xud_conf_example.h @@ -1,4 +1,5 @@ -// Copyright (c) 2013-2018, XMOS Ltd, All rights reserved +// Copyright 2013-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __xud_config_h__ #define __xud_config_h__ diff --git a/python/setup.py b/python/setup.py index 72b097fa..9ed8aa32 100644 --- a/python/setup.py +++ b/python/setup.py @@ -1,4 +1,5 @@ -# Copyright (c) 2020, XMOS Ltd, All rights reserved +# Copyright 2020-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. import setuptools # Another repository might depend on python code defined in this one. The diff --git a/tests/helpers.py b/tests/helpers.py index edf106fd..686f009a 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -1,5 +1,6 @@ #!/usr/bin/env python -# Copyright (c) 2016-2019, XMOS Ltd, All rights reserved +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. import xmostest import os import random diff --git a/tests/runtests.py b/tests/runtests.py index daff4a03..69210ede 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -1,5 +1,6 @@ #!/usr/bin/env python -# Copyright (c) 2016-2021, XMOS Ltd, All rights reserved +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. import xmostest import argparse import os diff --git a/tests/shared_src/shared.h b/tests/shared_src/shared.h index a4bfa63e..4924b19a 100644 --- a/tests/shared_src/shared.h +++ b/tests/shared_src/shared.h @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2020, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include #include diff --git a/tests/suspend_resume_functional/glx.h b/tests/suspend_resume_functional/glx.h index 60636e08..f1895b2f 100644 --- a/tests/suspend_resume_functional/glx.h +++ b/tests/suspend_resume_functional/glx.h @@ -1,4 +1,5 @@ -// Copyright (c) 2018, XMOS Ltd, All rights reserved +// Copyright 2018-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __glx_h__ #define __glx_h__ diff --git a/tests/suspend_resume_functional/strings.h b/tests/suspend_resume_functional/strings.h index 977dd692..b04d5339 100644 --- a/tests/suspend_resume_functional/strings.h +++ b/tests/suspend_resume_functional/strings.h @@ -1,4 +1,5 @@ -// Copyright (c) 2018, XMOS Ltd, All rights reserved +// Copyright 2018-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __strings_h__ #define __strings_h__ diff --git a/tests/suspend_resume_functional/strings.xc b/tests/suspend_resume_functional/strings.xc index e26acedd..104d8433 100644 --- a/tests/suspend_resume_functional/strings.xc +++ b/tests/suspend_resume_functional/strings.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2018, XMOS Ltd, All rights reserved +// Copyright 2018-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include "strings.h" diff --git a/tests/suspend_resume_functional/stubs.xc b/tests/suspend_resume_functional/stubs.xc index 40e76834..8ac1f3a8 100644 --- a/tests/suspend_resume_functional/stubs.xc +++ b/tests/suspend_resume_functional/stubs.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2018, XMOS Ltd, All rights reserved +// Copyright 2018-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include #include "xud.h" diff --git a/tests/suspend_resume_functional/test.xc b/tests/suspend_resume_functional/test.xc index 32f7ef85..7ee25f27 100644 --- a/tests/suspend_resume_functional/test.xc +++ b/tests/suspend_resume_functional/test.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2018, XMOS Ltd, All rights reserved +// Copyright 2018-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include #include diff --git a/tests/test_bulk_loopback.py b/tests/test_bulk_loopback.py index 1fb07fbd..81c8abad 100644 --- a/tests/test_bulk_loopback.py +++ b/tests/test_bulk_loopback.py @@ -1,5 +1,6 @@ #!/usr/bin/env python -# Copyright (c) 2016-2019, XMOS Ltd, All rights reserved +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. import random import xmostest diff --git a/tests/test_bulk_loopback/src/main.xc b/tests/test_bulk_loopback/src/main.xc index bb14d680..51da49df 100644 --- a/tests/test_bulk_loopback/src/main.xc +++ b/tests/test_bulk_loopback/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* lib_xud simple bulk loopback test */ #include #include diff --git a/tests/test_bulk_loopback/src/xc_ptr.h b/tests/test_bulk_loopback/src/xc_ptr.h index 28fa6b8b..8fa5a04e 100644 --- a/tests/test_bulk_loopback/src/xc_ptr.h +++ b/tests/test_bulk_loopback/src/xc_ptr.h @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __xc_ptr__ #define __xc_ptr__ diff --git a/tests/test_bulk_rx_basic.py b/tests/test_bulk_rx_basic.py index 958d4040..3f084ae1 100644 --- a/tests/test_bulk_rx_basic.py +++ b/tests/test_bulk_rx_basic.py @@ -1,5 +1,6 @@ #!/usr/bin/env python -# Copyright (c) 2016-2019, XMOS Ltd, All rights reserved +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. import random import xmostest diff --git a/tests/test_bulk_rx_basic/src/main.xc b/tests/test_bulk_rx_basic/src/main.xc index efd95f21..e2f8be4c 100644 --- a/tests/test_bulk_rx_basic/src/main.xc +++ b/tests/test_bulk_rx_basic/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2018-2019, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include #include diff --git a/tests/test_bulk_rx_basic/src/xc_ptr.h b/tests/test_bulk_rx_basic/src/xc_ptr.h index 28fa6b8b..8fa5a04e 100644 --- a/tests/test_bulk_rx_basic/src/xc_ptr.h +++ b/tests/test_bulk_rx_basic/src/xc_ptr.h @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __xc_ptr__ #define __xc_ptr__ diff --git a/tests/test_bulk_rx_basic_badcrc32.py b/tests/test_bulk_rx_basic_badcrc32.py index 9784f6eb..1c196705 100644 --- a/tests/test_bulk_rx_basic_badcrc32.py +++ b/tests/test_bulk_rx_basic_badcrc32.py @@ -1,5 +1,6 @@ #!/usr/bin/env python -# Copyright (c) 2016-2019, XMOS Ltd, All rights reserved +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. import random import xmostest diff --git a/tests/test_bulk_rx_basic_badcrc32/src/main.xc b/tests/test_bulk_rx_basic_badcrc32/src/main.xc index e617d91d..caa34022 100644 --- a/tests/test_bulk_rx_basic_badcrc32/src/main.xc +++ b/tests/test_bulk_rx_basic_badcrc32/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2021, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include diff --git a/tests/test_bulk_rx_basic_badcrc32/src/xc_ptr.h b/tests/test_bulk_rx_basic_badcrc32/src/xc_ptr.h index 28fa6b8b..8fa5a04e 100644 --- a/tests/test_bulk_rx_basic_badcrc32/src/xc_ptr.h +++ b/tests/test_bulk_rx_basic_badcrc32/src/xc_ptr.h @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __xc_ptr__ #define __xc_ptr__ diff --git a/tests/test_bulk_rx_basic_badpid.py b/tests/test_bulk_rx_basic_badpid.py index 4ee7f0c2..8707e437 100644 --- a/tests/test_bulk_rx_basic_badpid.py +++ b/tests/test_bulk_rx_basic_badpid.py @@ -1,5 +1,6 @@ #!/usr/bin/env python -# Copyright (c) 2016-2019, XMOS Ltd, All rights reserved +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. # Rx out of seq (but valid.. ) data PID diff --git a/tests/test_bulk_rx_basic_badpid/src/main.xc b/tests/test_bulk_rx_basic_badpid/src/main.xc index 70ebd83a..f838ab56 100644 --- a/tests/test_bulk_rx_basic_badpid/src/main.xc +++ b/tests/test_bulk_rx_basic_badpid/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2018-2019, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include #include diff --git a/tests/test_bulk_rx_basic_badpid/src/xc_ptr.h b/tests/test_bulk_rx_basic_badpid/src/xc_ptr.h index 28fa6b8b..8fa5a04e 100644 --- a/tests/test_bulk_rx_basic_badpid/src/xc_ptr.h +++ b/tests/test_bulk_rx_basic_badpid/src/xc_ptr.h @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __xc_ptr__ #define __xc_ptr__ diff --git a/tests/test_bulk_rx_basic_nodata.py b/tests/test_bulk_rx_basic_nodata.py index b2c5a2e3..b6620fd6 100644 --- a/tests/test_bulk_rx_basic_nodata.py +++ b/tests/test_bulk_rx_basic_nodata.py @@ -1,4 +1,6 @@ #!/usr/bin/env python +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. # Rx out of seq (but valid.. ) data PID diff --git a/tests/test_bulk_rx_basic_nodata/src/main.xc b/tests/test_bulk_rx_basic_nodata/src/main.xc index faa6134d..011ac110 100644 --- a/tests/test_bulk_rx_basic_nodata/src/main.xc +++ b/tests/test_bulk_rx_basic_nodata/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2018-2019, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include #include diff --git a/tests/test_bulk_rx_basic_rxerror.py b/tests/test_bulk_rx_basic_rxerror.py index e4db175e..1f9f2f10 100644 --- a/tests/test_bulk_rx_basic_rxerror.py +++ b/tests/test_bulk_rx_basic_rxerror.py @@ -1,5 +1,6 @@ #!/usr/bin/env python -# Copyright (c) 2016-2019, XMOS Ltd, All rights reserved +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. import random import xmostest diff --git a/tests/test_bulk_rx_basic_rxerror/src/main.xc b/tests/test_bulk_rx_basic_rxerror/src/main.xc index f418bd90..87ffcb4c 100644 --- a/tests/test_bulk_rx_basic_rxerror/src/main.xc +++ b/tests/test_bulk_rx_basic_rxerror/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2018-2020, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include #include diff --git a/tests/test_bulk_rx_basic_rxerror/src/xc_ptr.h b/tests/test_bulk_rx_basic_rxerror/src/xc_ptr.h index 28fa6b8b..8fa5a04e 100644 --- a/tests/test_bulk_rx_basic_rxerror/src/xc_ptr.h +++ b/tests/test_bulk_rx_basic_rxerror/src/xc_ptr.h @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __xc_ptr__ #define __xc_ptr__ diff --git a/tests/test_bulk_rx_multiep.py b/tests/test_bulk_rx_multiep.py index 259bc741..789a4d31 100644 --- a/tests/test_bulk_rx_multiep.py +++ b/tests/test_bulk_rx_multiep.py @@ -1,4 +1,6 @@ #!/usr/bin/env python +# Copyright 2019-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. import random import xmostest diff --git a/tests/test_bulk_rx_multiep/src/main.xc b/tests/test_bulk_rx_multiep/src/main.xc index 1dd5147c..ef7d5631 100644 --- a/tests/test_bulk_rx_multiep/src/main.xc +++ b/tests/test_bulk_rx_multiep/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent * in both directions between the ports. diff --git a/tests/test_bulk_rx_traffic.py b/tests/test_bulk_rx_traffic.py index 96ce7fe9..ddc1d929 100644 --- a/tests/test_bulk_rx_traffic.py +++ b/tests/test_bulk_rx_traffic.py @@ -1,4 +1,6 @@ #!/usr/bin/env python +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. import random import xmostest diff --git a/tests/test_bulk_rx_traffic/src/main.xc b/tests/test_bulk_rx_traffic/src/main.xc index ef6e6620..12206927 100644 --- a/tests/test_bulk_rx_traffic/src/main.xc +++ b/tests/test_bulk_rx_traffic/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2018-2021, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include #include diff --git a/tests/test_bulk_tx_badack.py b/tests/test_bulk_tx_badack.py index 9414970f..c679289b 100644 --- a/tests/test_bulk_tx_badack.py +++ b/tests/test_bulk_tx_badack.py @@ -1,4 +1,6 @@ #!/usr/bin/env python +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. import random import xmostest from usb_packet import * diff --git a/tests/test_bulk_tx_badack/src/main.xc b/tests/test_bulk_tx_badack/src/main.xc index a7c54daf..c64e33ee 100644 --- a/tests/test_bulk_tx_badack/src/main.xc +++ b/tests/test_bulk_tx_badack/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent * in both directions between the ports. diff --git a/tests/test_bulk_tx_basic.py b/tests/test_bulk_tx_basic.py index 157da812..0c242f2c 100644 --- a/tests/test_bulk_tx_basic.py +++ b/tests/test_bulk_tx_basic.py @@ -1,5 +1,6 @@ #!/usr/bin/env python -# Copyright (c) 2016-2021, XMOS Ltd, All rights reserved +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. import random import xmostest diff --git a/tests/test_bulk_tx_basic/src/main.xc b/tests/test_bulk_tx_basic/src/main.xc index dcfe935b..790674ec 100644 --- a/tests/test_bulk_tx_basic/src/main.xc +++ b/tests/test_bulk_tx_basic/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent * in both directions between the ports. diff --git a/tests/test_bulk_tx_basic/src/xc_ptr.h b/tests/test_bulk_tx_basic/src/xc_ptr.h index 28fa6b8b..8fa5a04e 100644 --- a/tests/test_bulk_tx_basic/src/xc_ptr.h +++ b/tests/test_bulk_tx_basic/src/xc_ptr.h @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __xc_ptr__ #define __xc_ptr__ diff --git a/tests/test_bulk_tx_basic_short.py b/tests/test_bulk_tx_basic_short.py index e09a22b8..52f121da 100644 --- a/tests/test_bulk_tx_basic_short.py +++ b/tests/test_bulk_tx_basic_short.py @@ -1,4 +1,6 @@ #!/usr/bin/env python +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. import random import xmostest from usb_packet import * diff --git a/tests/test_bulk_tx_basic_short/src/main.xc b/tests/test_bulk_tx_basic_short/src/main.xc index 840870b0..d30636db 100644 --- a/tests/test_bulk_tx_basic_short/src/main.xc +++ b/tests/test_bulk_tx_basic_short/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent * in both directions between the ports. diff --git a/tests/test_bulk_tx_multiep.py b/tests/test_bulk_tx_multiep.py index 2d85578b..0ff869e6 100644 --- a/tests/test_bulk_tx_multiep.py +++ b/tests/test_bulk_tx_multiep.py @@ -1,4 +1,6 @@ #!/usr/bin/env python +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. import random import xmostest diff --git a/tests/test_bulk_tx_multiep/src/main.xc b/tests/test_bulk_tx_multiep/src/main.xc index 043d7dfb..fcef402c 100644 --- a/tests/test_bulk_tx_multiep/src/main.xc +++ b/tests/test_bulk_tx_multiep/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include #include diff --git a/tests/test_bulk_tx_noack.py b/tests/test_bulk_tx_noack.py index 1fc87da8..d0c2d70d 100644 --- a/tests/test_bulk_tx_noack.py +++ b/tests/test_bulk_tx_noack.py @@ -1,4 +1,6 @@ #!/usr/bin/env python +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. import random import xmostest from usb_packet import * diff --git a/tests/test_bulk_tx_noack/src/main.xc b/tests/test_bulk_tx_noack/src/main.xc index a7c54daf..c64e33ee 100644 --- a/tests/test_bulk_tx_noack/src/main.xc +++ b/tests/test_bulk_tx_noack/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent * in both directions between the ports. diff --git a/tests/test_control_basic_badcrc32/src/main.xc b/tests/test_control_basic_badcrc32/src/main.xc index 7812cee2..d57acc45 100644 --- a/tests/test_control_basic_badcrc32/src/main.xc +++ b/tests/test_control_basic_badcrc32/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent * in both directions between the ports. diff --git a/tests/test_control_basic_badcrc32/src/xc_ptr.h b/tests/test_control_basic_badcrc32/src/xc_ptr.h index 28fa6b8b..8fa5a04e 100644 --- a/tests/test_control_basic_badcrc32/src/xc_ptr.h +++ b/tests/test_control_basic_badcrc32/src/xc_ptr.h @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __xc_ptr__ #define __xc_ptr__ diff --git a/tests/test_control_basic_get.py b/tests/test_control_basic_get.py index 9fd356f7..ad3c0387 100644 --- a/tests/test_control_basic_get.py +++ b/tests/test_control_basic_get.py @@ -1,5 +1,6 @@ #!/usr/bin/env python -# Copyright (c) 2016-2019, XMOS Ltd, All rights reserved +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. import random import xmostest diff --git a/tests/test_control_basic_get/src/main.xc b/tests/test_control_basic_get/src/main.xc index ca974210..6724df8c 100644 --- a/tests/test_control_basic_get/src/main.xc +++ b/tests/test_control_basic_get/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent * in both directions between the ports. diff --git a/tests/test_control_basic_get/src/xc_ptr.h b/tests/test_control_basic_get/src/xc_ptr.h index 28fa6b8b..8fa5a04e 100644 --- a/tests/test_control_basic_get/src/xc_ptr.h +++ b/tests/test_control_basic_get/src/xc_ptr.h @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __xc_ptr__ #define __xc_ptr__ diff --git a/tests/test_control_basic_set.py b/tests/test_control_basic_set.py index 56693119..cdc52567 100644 --- a/tests/test_control_basic_set.py +++ b/tests/test_control_basic_set.py @@ -1,5 +1,6 @@ #!/usr/bin/env python -# Copyright (c) 2016-2019, XMOS Ltd, All rights reserved +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. import random import xmostest diff --git a/tests/test_control_basic_set/src/main.xc b/tests/test_control_basic_set/src/main.xc index d89cb096..f2960459 100644 --- a/tests/test_control_basic_set/src/main.xc +++ b/tests/test_control_basic_set/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent * in both directions between the ports. diff --git a/tests/test_control_basic_set/src/xc_ptr.h b/tests/test_control_basic_set/src/xc_ptr.h index 28fa6b8b..8fa5a04e 100644 --- a/tests/test_control_basic_set/src/xc_ptr.h +++ b/tests/test_control_basic_set/src/xc_ptr.h @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __xc_ptr__ #define __xc_ptr__ diff --git a/tests/test_control_basic_short/src/main.xc b/tests/test_control_basic_short/src/main.xc index f2a4a917..cf20ea0f 100644 --- a/tests/test_control_basic_short/src/main.xc +++ b/tests/test_control_basic_short/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent * in both directions between the ports. diff --git a/tests/test_control_basic_short/src/xc_ptr.h b/tests/test_control_basic_short/src/xc_ptr.h index 28fa6b8b..8fa5a04e 100644 --- a/tests/test_control_basic_short/src/xc_ptr.h +++ b/tests/test_control_basic_short/src/xc_ptr.h @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __xc_ptr__ #define __xc_ptr__ diff --git a/tests/test_control_repeatedsetup/src/main.xc b/tests/test_control_repeatedsetup/src/main.xc index e0ae243e..af070c7a 100644 --- a/tests/test_control_repeatedsetup/src/main.xc +++ b/tests/test_control_repeatedsetup/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent * in both directions between the ports. diff --git a/tests/test_control_repeatedsetup/src/xc_ptr.h b/tests/test_control_repeatedsetup/src/xc_ptr.h index 28fa6b8b..8fa5a04e 100644 --- a/tests/test_control_repeatedsetup/src/xc_ptr.h +++ b/tests/test_control_repeatedsetup/src/xc_ptr.h @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __xc_ptr__ #define __xc_ptr__ diff --git a/tests/test_invalidtoken.py b/tests/test_invalidtoken.py index 2c02a95f..788a2ebc 100644 --- a/tests/test_invalidtoken.py +++ b/tests/test_invalidtoken.py @@ -1,5 +1,6 @@ #!/usr/bin/env python -# Copyright (c) 2016-2019, XMOS Ltd, All rights reserved +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. # Same as simple RX bulk test but some invalid tokens also included diff --git a/tests/test_invalidtoken/src/main.xc b/tests/test_invalidtoken/src/main.xc index 2b250a10..962d7893 100644 --- a/tests/test_invalidtoken/src/main.xc +++ b/tests/test_invalidtoken/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent * in both directions between the ports. diff --git a/tests/test_invalidtoken/src/xc_ptr.h b/tests/test_invalidtoken/src/xc_ptr.h index 28fa6b8b..8fa5a04e 100644 --- a/tests/test_invalidtoken/src/xc_ptr.h +++ b/tests/test_invalidtoken/src/xc_ptr.h @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __xc_ptr__ #define __xc_ptr__ diff --git a/tests/test_iso_loopback.py b/tests/test_iso_loopback.py index 21a1f585..a35d1bf7 100644 --- a/tests/test_iso_loopback.py +++ b/tests/test_iso_loopback.py @@ -1,5 +1,6 @@ #!/usr/bin/env python -# Copyright (c) 2016-2019, XMOS Ltd, All rights reserved +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. import random import xmostest diff --git a/tests/test_iso_loopback/src/main.xc b/tests/test_iso_loopback/src/main.xc index f079d5eb..4610ef0b 100644 --- a/tests/test_iso_loopback/src/main.xc +++ b/tests/test_iso_loopback/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent * in both directions between the ports. diff --git a/tests/test_iso_loopback/src/xc_ptr.h b/tests/test_iso_loopback/src/xc_ptr.h index 28fa6b8b..8fa5a04e 100644 --- a/tests/test_iso_loopback/src/xc_ptr.h +++ b/tests/test_iso_loopback/src/xc_ptr.h @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __xc_ptr__ #define __xc_ptr__ diff --git a/tests/test_iso_rx_basic.py b/tests/test_iso_rx_basic.py index 57c7226a..2fead9c3 100644 --- a/tests/test_iso_rx_basic.py +++ b/tests/test_iso_rx_basic.py @@ -1,5 +1,6 @@ #!/usr/bin/env python -# Copyright (c) 2016-2019, XMOS Ltd, All rights reserved +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. import random import xmostest diff --git a/tests/test_iso_rx_basic/src/main.xc b/tests/test_iso_rx_basic/src/main.xc index 57d17690..3d4839fc 100644 --- a/tests/test_iso_rx_basic/src/main.xc +++ b/tests/test_iso_rx_basic/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include #include diff --git a/tests/test_iso_rxtx_fastpacket.py b/tests/test_iso_rxtx_fastpacket.py index cc4f0128..5dd591ab 100644 --- a/tests/test_iso_rxtx_fastpacket.py +++ b/tests/test_iso_rxtx_fastpacket.py @@ -1,5 +1,6 @@ #!/usr/bin/env python -# Copyright (c) 2016-2019, XMOS Ltd, All rights reserved +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. import random import xmostest diff --git a/tests/test_iso_rxtx_fastpacket/src/main.xc b/tests/test_iso_rxtx_fastpacket/src/main.xc index 0451a3ca..d1f5a2e1 100644 --- a/tests/test_iso_rxtx_fastpacket/src/main.xc +++ b/tests/test_iso_rxtx_fastpacket/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent * in both directions between the ports. diff --git a/tests/test_iso_rxtx_fastpacket/src/xc_ptr.h b/tests/test_iso_rxtx_fastpacket/src/xc_ptr.h index 28fa6b8b..8fa5a04e 100644 --- a/tests/test_iso_rxtx_fastpacket/src/xc_ptr.h +++ b/tests/test_iso_rxtx_fastpacket/src/xc_ptr.h @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __xc_ptr__ #define __xc_ptr__ diff --git a/tests/test_iso_tx_basic.py b/tests/test_iso_tx_basic.py index d31b974e..5fb52027 100644 --- a/tests/test_iso_tx_basic.py +++ b/tests/test_iso_tx_basic.py @@ -1,5 +1,6 @@ #!/usr/bin/env python -# Copyright (c) 2016-2019, XMOS Ltd, All rights reserved +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. import random import xmostest diff --git a/tests/test_iso_tx_basic/src/main.xc b/tests/test_iso_tx_basic/src/main.xc index 47300a04..87d85f0e 100644 --- a/tests/test_iso_tx_basic/src/main.xc +++ b/tests/test_iso_tx_basic/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. /* * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent * in both directions between the ports. diff --git a/tests/test_iso_tx_basic/src/xc_ptr.h b/tests/test_iso_tx_basic/src/xc_ptr.h index 28fa6b8b..8fa5a04e 100644 --- a/tests/test_iso_tx_basic/src/xc_ptr.h +++ b/tests/test_iso_tx_basic/src/xc_ptr.h @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __xc_ptr__ #define __xc_ptr__ diff --git a/tests/test_ping_rx_basic.py b/tests/test_ping_rx_basic.py index aa0a3a01..169bb2a0 100644 --- a/tests/test_ping_rx_basic.py +++ b/tests/test_ping_rx_basic.py @@ -1,5 +1,6 @@ #!/usr/bin/env python -# Copyright (c) 2016-2019, XMOS Ltd, All rights reserved +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. # Basic check of PING functionality diff --git a/tests/test_ping_rx_basic/src/main.xc b/tests/test_ping_rx_basic/src/main.xc index 97fa8856..e8aba295 100644 --- a/tests/test_ping_rx_basic/src/main.xc +++ b/tests/test_ping_rx_basic/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2020, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "shared.h" #define XUD_EP_COUNT_OUT 5 diff --git a/tests/test_ping_rx_basic/src/xc_ptr.h b/tests/test_ping_rx_basic/src/xc_ptr.h index 28fa6b8b..8fa5a04e 100644 --- a/tests/test_ping_rx_basic/src/xc_ptr.h +++ b/tests/test_ping_rx_basic/src/xc_ptr.h @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2018, XMOS Ltd, All rights reserved +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __xc_ptr__ #define __xc_ptr__ diff --git a/tests/test_shorttoken.py b/tests/test_shorttoken.py index 04f445ca..3cfec9ee 100644 --- a/tests/test_shorttoken.py +++ b/tests/test_shorttoken.py @@ -1,4 +1,6 @@ #!/usr/bin/env python +# Copyright 2019-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. # Same as simple RX bulk test but some invalid tokens also included diff --git a/tests/test_shorttoken/src/main.xc b/tests/test_shorttoken/src/main.xc index af6d7d24..7be7f321 100644 --- a/tests/test_shorttoken/src/main.xc +++ b/tests/test_shorttoken/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2019, XMOS Ltd, All rights reserved +// Copyright 2019-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include #include diff --git a/tests/test_sof_badcrc.py b/tests/test_sof_badcrc.py index 9762700a..9c49ae55 100644 --- a/tests/test_sof_badcrc.py +++ b/tests/test_sof_badcrc.py @@ -1,4 +1,6 @@ #!/usr/bin/env python +# Copyright 2019-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. # Same as simple RX bulk test but some invalid tokens also included diff --git a/tests/test_sof_badcrc/src/main.xc b/tests/test_sof_badcrc/src/main.xc index 8c523720..e43d363e 100644 --- a/tests/test_sof_badcrc/src/main.xc +++ b/tests/test_sof_badcrc/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2019, XMOS Ltd, All rights reserved +// Copyright 2019-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include #include diff --git a/tests/test_sof_basic.py b/tests/test_sof_basic.py index d7699515..fa43c62c 100644 --- a/tests/test_sof_basic.py +++ b/tests/test_sof_basic.py @@ -1,4 +1,6 @@ #!/usr/bin/env python +# Copyright 2019-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. # Same as simple RX bulk test but some invalid tokens also included diff --git a/tests/test_sof_basic/src/main.xc b/tests/test_sof_basic/src/main.xc index f8ac5414..b8cc8f57 100644 --- a/tests/test_sof_basic/src/main.xc +++ b/tests/test_sof_basic/src/main.xc @@ -1,4 +1,5 @@ -// Copyright (c) 2016-2019, XMOS Ltd, All rights reserved +// Copyright 2019-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include #include diff --git a/tests/usb_clock.py b/tests/usb_clock.py index f14c5c49..1b586d85 100644 --- a/tests/usb_clock.py +++ b/tests/usb_clock.py @@ -1,4 +1,5 @@ -# Copyright (c) 2016-2019, XMOS Ltd, All rights reserved +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. import xmostest import sys import zlib diff --git a/tests/usb_packet.py b/tests/usb_packet.py index 7cde4faa..36c2e77a 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -1,4 +1,5 @@ -# Copyright (c) 2016-2021, XMOS Ltd, All rights reserved +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. """ Define packet types Packet Class Hierarchy diff --git a/tests/usb_phy.py b/tests/usb_phy.py index 39cd2e9a..27e7ce7d 100644 --- a/tests/usb_phy.py +++ b/tests/usb_phy.py @@ -1,4 +1,5 @@ -# Copyright (c) 2016-2019, XMOS Ltd, All rights reserved +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. import random import xmostest import sys diff --git a/tests/usb_phy_shim.py b/tests/usb_phy_shim.py index bd8e629a..c58594ef 100644 --- a/tests/usb_phy_shim.py +++ b/tests/usb_phy_shim.py @@ -1,3 +1,5 @@ +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. import random import xmostest import sys diff --git a/tests/usb_phy_utmi.py b/tests/usb_phy_utmi.py index 66edec48..d23d9dbc 100644 --- a/tests/usb_phy_utmi.py +++ b/tests/usb_phy_utmi.py @@ -1,3 +1,5 @@ +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. import random import xmostest import sys From 856a3ddf755254759b09a8bd87683172c219b074 Mon Sep 17 00:00:00 2001 From: Daniel Pieczko Date: Wed, 7 Apr 2021 16:33:12 +0100 Subject: [PATCH 223/520] Update changelog --- CHANGELOG.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index df401a57..23749d1a 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -9,6 +9,7 @@ HEAD * CHANGE: Removed support for XS1-G, and XS1-L (including U series) based devices * RESOLVED: Exception when Endpoint marked as disabled * CHANGE: Use common XN files for tests + * CHANGE: Use XMOS Public Licence Version 1 1.1.2 ----- From 8db9914c0c9784f569bcff4dac6d428cdb7036b6 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 8 Apr 2021 12:45:31 +0100 Subject: [PATCH 224/520] Comment update only --- lib_xud/src/user/client/XUD_EpFuncs.S | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_xud/src/user/client/XUD_EpFuncs.S b/lib_xud/src/user/client/XUD_EpFuncs.S index 61584ed7..d939e801 100644 --- a/lib_xud/src/user/client/XUD_EpFuncs.S +++ b/lib_xud/src/user/client/XUD_EpFuncs.S @@ -195,7 +195,6 @@ XUD_GetData_PidOkay: bf r11, XUD_GetData_ReturnOk // Jump over PID toggle for ISO XUD_GetData_PidToggle: -//#if (XUD_SERIES_SUPPORT==3) #ifdef __XS3A__ ldc r11, 0x88 #else From e316738d40105cb258f7a01c41773595124859d7 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 8 Apr 2021 12:46:32 +0100 Subject: [PATCH 225/520] Added support to test bench for bad data CRC and packet resends --- tests/helpers.py | 2 +- tests/test_bulk_loopback.py | 4 +- tests/test_bulk_rx_basic.py | 8 +-- tests/test_bulk_rx_basic_badcrc32.py | 74 ++++++++++------------------ tests/test_bulk_rx_basic_badpid.py | 69 ++++++++------------------ tests/usb_packet.py | 2 +- tests/usb_session.py | 29 +++++++---- tests/usb_transaction.py | 40 ++++++++++----- 8 files changed, 99 insertions(+), 129 deletions(-) diff --git a/tests/helpers.py b/tests/helpers.py index f25dd25f..461bf10a 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -74,7 +74,7 @@ def run_on(**kwargs): return True -def runall_rx(test_fn): +def RunUsbTest(test_fn): seed = args.seed if args.seed else random.randint(0, sys.maxint) diff --git a/tests/test_bulk_loopback.py b/tests/test_bulk_loopback.py index 14e57b44..a7d108fe 100644 --- a/tests/test_bulk_loopback.py +++ b/tests/test_bulk_loopback.py @@ -2,7 +2,7 @@ import xmostest from usb_packet import * import usb_packet -from helpers import do_usb_test, runall_rx +from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction @@ -29,4 +29,4 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) def runtest(): - runall_rx(do_test) + RunUsbTest(do_test) diff --git a/tests/test_bulk_rx_basic.py b/tests/test_bulk_rx_basic.py index b21d8c68..a460d938 100644 --- a/tests/test_bulk_rx_basic.py +++ b/tests/test_bulk_rx_basic.py @@ -1,11 +1,8 @@ #!/usr/bin/env python - -import random import xmostest from usb_packet import * import usb_packet -from usb_clock import Clock -from helpers import do_usb_test, runall_rx +from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction @@ -24,5 +21,4 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) def runtest(): - random.seed(1) - runall_rx(do_test) + RunUsbTest(do_test) diff --git a/tests/test_bulk_rx_basic_badcrc32.py b/tests/test_bulk_rx_basic_badcrc32.py index 9a56f882..ba95d961 100644 --- a/tests/test_bulk_rx_basic_badcrc32.py +++ b/tests/test_bulk_rx_basic_badcrc32.py @@ -1,62 +1,38 @@ #!/usr/bin/env python - -import random import xmostest from usb_packet import * import usb_packet -from usb_clock import Clock -from helpers import do_usb_test, runall_rx +from helpers import do_usb_test, RunUsbTest +from usb_session import UsbSession +from usb_transaction import UsbTransaction +def test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): + + address = 1 + ep = 1 -# Single, setup transaction to EP 0 + # The large inter-event delays are to give the DUT time to do checking on the fly + + session = UsbSession(bus_speed = usb_speed, run_enumeration = False, device_address = address) + + # Valid OUT transaction + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", eventTime=10, dataLength=10)) -def do_test(arch, tx_clk, tx_phy, data_valid_count, usb_speed, seed): - rand = random.Random() - rand.seed(seed) + # Another valid OUT transaction + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", eventTime=10, dataLength=11, interEventDelay=6000)) - dev_address = 1 - ep = 1 + # OUT transaction with bad data CRC + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", eventTime=10, dataLength=12, + interEventDelay=6000, badDataCrc=True)) - # The inter-frame gap is to give the DUT time to print its output - packets = [] + # Due to bad CRC, XUD will not ACK and expect a resend of the same packet - DATA PID won't be toggled + # For ease of checking we dont resend the same packet.. + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", eventTime=10, dataLength=13, interEventDelay=6000)) - dataval = 0; - - # Good OUT transaction - AppendOutToken(packets, ep, dev_address, data_valid_count=data_valid_count) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=10, pid=usb_packet.PID_DATA0)) - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) + # PID will be toggled as normal + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", eventTime=10, interEventDelay=6000, dataLength=14)) - # Note, quite big gap to allow checking. - - # Another good OUT transaction - dataval += 10 - AppendOutToken(packets, ep, dev_address, data_valid_count=data_valid_count, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=11, pid=usb_packet.PID_DATA1)) - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - - dataval += 11 - AppendOutToken(packets, ep, dev_address, data_valid_count=data_valid_count, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=12, bad_crc=True, pid=usb_packet.PID_DATA0)) - # Bad CRC - dont expect ACK - #packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - - #Due to bad CRC, XUD will not ACK and expect a resend of the same packet - so dont change PID - dataval += 12 - AppendOutToken(packets, ep, dev_address, data_valid_count=data_valid_count, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=13, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - - # PID toggle as normal - dataval += 13 - AppendOutToken(packets, ep, dev_address, data_valid_count=data_valid_count, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=14, pid=0xb)) #DATA1 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - - - do_usb_test(arch, tx_clk, tx_phy, usb_speed, packets, __file__, seed, - level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) def runtest(): - random.seed(1) - runall_rx(do_test) + RunUsbTest(test) diff --git a/tests/test_bulk_rx_basic_badpid.py b/tests/test_bulk_rx_basic_badpid.py index 5b73fbb1..4675fa91 100644 --- a/tests/test_bulk_rx_basic_badpid.py +++ b/tests/test_bulk_rx_basic_badpid.py @@ -1,61 +1,34 @@ #!/usr/bin/env python - -# Rx out of seq (but valid.. ) data PID - -import random import xmostest from usb_packet import * -from usb_clock import Clock -from helpers import do_usb_test, runall_rx - +from helpers import do_usb_test, RunUsbTest +from usb_session import UsbSession +from usb_transaction import UsbTransaction -# Single, setup transaction to EP 0 - -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): - rand = random.Random() - rand.seed(seed) +# Tests out of seq (but valid.. ) data PID +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): address = 1 ep = 1 - # The inter-frame gap is to give the DUT time to print its output - packets = [] - - dataval = 0; - - ipg = 500 + session = UsbSession(bus_speed = usb_speed, run_enumeration = False, device_address = address) - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=10, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) + # The large inter-frame gap is to give the DUT time to print its output + interEventDelay = 500 + + # Valid OUT transaction + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=10, interEventDelay=interEventDelay)) - dataval += 10 - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=ipg) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=11, pid=0xb)) #DATA1 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - - #Pretend the ACK went missing. Re-send same packet. xCORE should ACK but throw pkt away - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=ipg) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=11, pid=0xb)) #DATA1 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - - dataval += 11 - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=ipg) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=12, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - - dataval += 12 - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=ipg) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=13, pid=0xb)) #DATA1 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - - dataval += 13 - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=ipg) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=14, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) + # Pretend the ACK went missing on the way to host. Re-send same packet. xCORE should ACK but throw pkt away + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=11, interEventDelay=interEventDelay, + resend=True)) + + # Send some valid OUT transactions + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=12, interEventDelay=interEventDelay)) + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=13, interEventDelay=interEventDelay)) + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=14, interEventDelay=interEventDelay)) - do_usb_test(arch, clk, phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) def runtest(): - random.seed(1) - runall_rx(do_test) + RunUsbTest(do_test) diff --git a/tests/usb_packet.py b/tests/usb_packet.py index 6c274e43..dca10400 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -507,7 +507,7 @@ def __init__(self, **kwargs): #self.inter_pkt_gap = kwargs.pop('inter_pkt_gap', 13) #13 lowest working for single issue loopback def __str__(self): - return super(DataPacket, self).__str__() + ": TX DataPacket: " + super(DataPacket, self).get_pid_str() + " " + str(self.data_bytes) + return super(DataPacket, self).__str__() + ": TX DataPacket: " + super(DataPacket, self).get_pid_str() + " " + str(self.data_bytes) + " Valid CRC: " + str(not self.bad_crc) #Always TX class TokenPacket(TxPacket): diff --git a/tests/usb_session.py b/tests/usb_session.py index 997ba327..8962b5a3 100644 --- a/tests/usb_session.py +++ b/tests/usb_session.py @@ -22,6 +22,8 @@ def __init__(self, bus_speed = "HS", run_enumeration = False, device_address = 0 self._dataGen_in = [0] * 16 self._dataGen_out = [0] * 16 + assert run_enumeration == False, "Not yet supported" + @property def bus_speed(self): return self._bus_speed @@ -42,16 +44,23 @@ def enumerate(self): def data_valid_count(self): return USB_DATA_VALID_COUNT[self._bus_speed] - def getPayload_out(self, n, length): - + def getPayload_out(self, n, length, updateCounter = True): + payload = [x for x in range(self._dataGen_out[n], self._dataGen_out[n] + length)] - self._dataGen_out[n] += length + + # We might not want to update the counter if we are expected a re-transmitted packet + if updateCounter: + self._dataGen_out[n] += length + return payload - def getPayload_in(self, n, length): + def getPayload_in(self, n, length, updateCounter = True): payload = [x for x in range(self._dataGen_in[n], self._dataGen_in[n] + length)] - self._dataGen_in[n] += length + + if updateCounter: + self._dataGen_out[n] += length + return payload def _pid_toggle(self, pid_table, n): @@ -61,14 +70,16 @@ def _pid_toggle(self, pid_table, n): else: pid_table[n] = usb_packet.USB_PID["DATA0"] - def data_pid_in(self, n): + def data_pid_in(self, n, togglePid = True): pid = self._pidTable_in[n] - self._pid_toggle(self._pidTable_in, n) + if togglePid: + self._pid_toggle(self._pidTable_in, n) return pid - def data_pid_out(self, n): + def data_pid_out(self, n, togglePid = True): pid = self._pidTable_out[n] - self._pid_toggle(self._pidTable_out, n) + if togglePid: + self._pid_toggle(self._pidTable_out, n) return pid def __str__(self): diff --git a/tests/usb_transaction.py b/tests/usb_transaction.py index e0544ecc..b9f1ec85 100644 --- a/tests/usb_transaction.py +++ b/tests/usb_transaction.py @@ -11,7 +11,7 @@ class UsbTransaction(UsbEvent): def __init__(self, session, deviceAddress = 0, endpointNumber = 0, endpointType = "BULK", - direction="OUT", bus_speed="HS", eventTime = 0, dataLength = 0, interEventDelay=500): # TODO Enums when we move to py3 + direction="OUT", bus_speed="HS", eventTime = 0, dataLength = 0, interEventDelay=INTER_TRANSACTION_DELAY, badDataCrc = False, resend=False): # TODO Enums when we move to py3 self._deviceAddress = deviceAddress self._endpointNumber = endpointNumber @@ -19,6 +19,7 @@ def __init__(self, session, deviceAddress = 0, endpointNumber = 0, endpointType self._direction = direction self._datalength = dataLength self._bus_speed = bus_speed + self._badDataCrc = badDataCrc assert endpointType in USB_EP_TYPES assert direction in USB_DIRECTIONS @@ -27,25 +28,42 @@ def __init__(self, session, deviceAddress = 0, endpointNumber = 0, endpointType self._packets = [] if direction == "OUT": - self._packets.append(TokenPacket(interEventDelay = INTER_TRANSACTION_DELAY, + + packets = [] + packets.append(TokenPacket(interEventDelay = interEventDelay, pid = USB_PID["OUT"], address = self._deviceAddress, endpoint = self._endpointNumber, data_valid_count = self.data_valid_count)) + + # Don't toggle data pid if we had a bad data crc + if self._badDataCrc == True: + togglePid = False + else: + togglePid = True + # Generate packet data payload packetPayload = session.getPayload_out(endpointNumber, dataLength); - pid = session.data_pid_out(endpointNumber); + pid = session.data_pid_out(endpointNumber, togglePid = togglePid) # Add data packet to packets list - self._packets.append(TxDataPacket(pid=pid, dataPayload = packetPayload)) - - # Add handshake packet to packets list - self._packets.append(RxHandshakePacket()) - + packets.append(TxDataPacket(pid=pid, dataPayload = packetPayload, bad_crc=self._badDataCrc)) + + if not self._badDataCrc: + # Add handshake packet to packets list + packets.append(RxHandshakePacket()) + + self._packets.extend(packets) + + if resend: + # Add again.. + self._packets.extend(packets) + else: - self._packets.append(TokenPacket(interEventDelay = INTER_TRANSACTION_DELAY, + + self._packets.append(TokenPacket(interEventDelay = interEventDelay, pid = USB_PID["IN"], address = self._deviceAddress, endpoint = self._endpointNumber, @@ -61,10 +79,6 @@ def __init__(self, session, deviceAddress = 0, endpointNumber = 0, endpointType self._packets.append(TxHandshakePacket()) - - - - super(UsbTransaction, self).__init__(time = eventTime, interEventDelay = interEventDelay) # TODO ideally USBTransaction doesnt know about data_valid_count From 8d481b768c23aaadd4a3775338a92ca5243342be Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 8 Apr 2021 17:05:20 +0100 Subject: [PATCH 226/520] xud.h small tidy --- lib_xud/api/xud.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib_xud/api/xud.h b/lib_xud/api/xud.h index e1698aa4..3734b8d5 100644 --- a/lib_xud/api/xud.h +++ b/lib_xud/api/xud.h @@ -3,8 +3,8 @@ * \brief User defines and functions for XMOS USB Device library */ -#ifndef __xud_h__ -#define __xud_h__ +#ifndef _XUD_H_ +#define _XUD_H_ #include @@ -527,7 +527,7 @@ void XUD_GetData_Select(chanend c, XUD_ep ep, REFERENCE_PARAM(unsigned, length), */ #pragma select handler void XUD_SetData_Select(chanend c, XUD_ep ep, REFERENCE_PARAM(XUD_Result_t, result)); -#endif +#endif //__XC__ || __DOXYGEN__ /* Control token defines - used to inform EPs of bus-state types */ #define USB_RESET_TOKEN 8 /* Control token value that signals RESET */ @@ -536,7 +536,6 @@ void XUD_SetData_Select(chanend c, XUD_ep ep, REFERENCE_PARAM(XUD_Result_t, resu #define XUD_OSC_MHZ (24) #endif +#endif //__ASSEMBLER__ -#endif //__XC__ || __STDC__ - -#endif // __xud_h__ +#endif // _XUD_H_ From d2e8b6c03620e9989abfa3b04aa90bfc2928a157 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 8 Apr 2021 17:05:33 +0100 Subject: [PATCH 227/520] Further port of tests --- tests/test_bulk_rx_basic_nodata.py | 63 ++++++++---------------------- tests/test_bulk_tx_basic.py | 10 +---- tests/usb_event.py | 2 +- tests/usb_packet.py | 10 ++--- tests/usb_session.py | 17 ++------ tests/usb_transaction.py | 8 ++-- 6 files changed, 30 insertions(+), 80 deletions(-) diff --git a/tests/test_bulk_rx_basic_nodata.py b/tests/test_bulk_rx_basic_nodata.py index b2c5a2e3..1971fa35 100644 --- a/tests/test_bulk_rx_basic_nodata.py +++ b/tests/test_bulk_rx_basic_nodata.py @@ -1,60 +1,29 @@ #!/usr/bin/env python - -# Rx out of seq (but valid.. ) data PID - -import random import xmostest -from usb_packet import * -from usb_clock import Clock -from helpers import do_usb_test, runall_rx - +from usb_packet import TokenPacket, USB_PID +from helpers import do_usb_test, RunUsbTest +from usb_session import UsbSession +from usb_transaction import UsbTransaction -# Single, setup transaction to EP 0 - -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): - rand = random.Random() - rand.seed(seed) +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): address = 1 ep = 1 - # The inter-frame gap is to give the DUT time to print its output - packets = [] - - dataval = 0; - - ipg = 500 - - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=10, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - - dataval += 10 - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=ipg) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=11, pid=0xb)) #DATA1 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=ipg) - # MISSING DATA PAYLOAD - + # The large inter-event delay is to give the DUT time to perform checking + ied = 500 - dataval += 11 - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=ipg) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=12, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) + session = UsbSession(bus_speed = usb_speed, run_enumeration = False, device_address = address) - dataval += 12 - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=ipg) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=13, pid=0xb)) #DATA1 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) + for length in range(10, 15): - dataval += 13 - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=ipg) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=14, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=length, interEventDelay=ied)) + + # Simulate missing data payload + if length == 11: + session.add_event(TokenPacket(endpoint=ep, address = address, pid=USB_PID["OUT"])) - do_usb_test(arch, clk, phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) def runtest(): - random.seed(1) - runall_rx(do_test) + RunUsbTest(do_test) diff --git a/tests/test_bulk_tx_basic.py b/tests/test_bulk_tx_basic.py index 1119f291..71919a74 100644 --- a/tests/test_bulk_tx_basic.py +++ b/tests/test_bulk_tx_basic.py @@ -1,15 +1,10 @@ #!/usr/bin/env python -import random import xmostest -from usb_packet import * -import usb_packet -from helpers import do_usb_test, runall_rx +from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): - rand = random.Random() - rand.seed(seed) ep = 1 address = 1 @@ -24,5 +19,4 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) def runtest(): - random.seed(1) - runall_rx(do_test) + RunUsbTest(do_test) diff --git a/tests/usb_event.py b/tests/usb_event.py index e7629228..45fcc501 100644 --- a/tests/usb_event.py +++ b/tests/usb_event.py @@ -17,7 +17,7 @@ def interEventDelay(self): return self._interEventDelay @abc.abstractmethod - def expected_output(self): + def expected_output(self, offset = 0): pass # Drive event to simulator diff --git a/tests/usb_packet.py b/tests/usb_packet.py index dca10400..9d9303e1 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -266,9 +266,8 @@ def __init__(self, **kwargs): def timeout(self): return self._timeout - @property - def expected_output(self): - expected_output = "DEVICE -> HOST\n" + def expected_output(self, offeet=0): + expected_output = "Packet:\tDEVICE -> HOST\n" for (i, byte) in enumerate(self.get_bytes()): expected_output += "\tRX byte: {0:#x}\n".format(byte) @@ -347,9 +346,8 @@ def __init__(self, **kwargs): self.rxe_assert_length = kwargs.pop('rxe_assert_length', 1) super(TxPacket, self).__init__(**kwargs) - @property - def expected_output(self): - expected_output = "HOST -> DEVICE\n" + def expected_output(self, offset=0): + expected_output = "Packet:\tHOST -> DEVICE\n" expected_output += "\tPID: {} ({:#x})\n".format(self.get_pid_str(), self.pid) return expected_output diff --git a/tests/usb_session.py b/tests/usb_session.py index 8962b5a3..830781cf 100644 --- a/tests/usb_session.py +++ b/tests/usb_session.py @@ -44,23 +44,14 @@ def enumerate(self): def data_valid_count(self): return USB_DATA_VALID_COUNT[self._bus_speed] - def getPayload_out(self, n, length, updateCounter = True): - + def getPayload_out(self, n, length): payload = [x for x in range(self._dataGen_out[n], self._dataGen_out[n] + length)] - - # We might not want to update the counter if we are expected a re-transmitted packet - if updateCounter: - self._dataGen_out[n] += length - + self._dataGen_out[n] += length return payload - def getPayload_in(self, n, length, updateCounter = True): - + def getPayload_in(self, n, length): payload = [x for x in range(self._dataGen_in[n], self._dataGen_in[n] + length)] - - if updateCounter: - self._dataGen_out[n] += length - + self._dataGen_in[n] += length return payload def _pid_toggle(self, pid_table, n): diff --git a/tests/usb_transaction.py b/tests/usb_transaction.py index b9f1ec85..6cf1fa1f 100644 --- a/tests/usb_transaction.py +++ b/tests/usb_transaction.py @@ -26,7 +26,8 @@ def __init__(self, session, deviceAddress = 0, endpointNumber = 0, endpointType # Populate packet list for a (valid) transaction self._packets = [] - + + # TODO would it be better to generate packets on the fly in drive() rather than create a packet list? if direction == "OUT": packets = [] @@ -123,10 +124,7 @@ def expected_output(self, offset=0): expected_output = "" for i, p in enumerate(self.packets): - #expected_output += "Packet {}: ".format(i+offset) - expected_output += "Packet:" - expected_output += "\t" + p.expected_output - #expected_output += "\n" + expected_output += p.expected_output() return expected_output From 38214bab8946917eb1ab432b41c2ed30b49f4661 Mon Sep 17 00:00:00 2001 From: Daniel Pieczko Date: Mon, 12 Apr 2021 12:58:35 +0100 Subject: [PATCH 228/520] Re-apply original copyright start years --- examples/AN00124_CDC_VCOM_class/src/main.xc | 2 +- examples/AN00124_CDC_VCOM_class/src/xud_cdc.h | 2 +- examples/AN00124_CDC_VCOM_class/src/xud_cdc.xc | 2 +- examples/AN00125_mass_storage_class/src/debug_conf.h | 2 +- examples/AN00125_mass_storage_class/src/endpoint0.xc | 2 +- examples/AN00125_mass_storage_class/src/main.xc | 2 +- examples/AN00125_mass_storage_class/src/mass_storage.h | 2 +- examples/AN00125_mass_storage_class/src/mass_storage.xc | 2 +- examples/AN00126_printer_class/src/endpoint0.xc | 2 +- examples/AN00126_printer_class/src/main.xc | 2 +- examples/AN00127_video_class/src/main.xc | 2 +- examples/AN00127_video_class/src/usb_video.h | 2 +- examples/AN00127_video_class/src/usb_video.xc | 2 +- examples/AN00127_video_class/src/uvc_defs.h | 2 +- examples/AN00127_video_class/src/uvc_req.c | 2 +- examples/AN00127_video_class/src/uvc_req.h | 2 +- examples/AN00129_hid_class/src/main.xc | 2 +- examples/AN00131_CDC_EDC_class/src/eth_tcp/dhcp.h | 2 +- examples/AN00131_CDC_EDC_class/src/eth_tcp/dhcp.xc | 2 +- examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoIP.h | 2 +- examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoIP.xc | 2 +- examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoTCP.h | 2 +- examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoTCP.xc | 2 +- examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoUDP.h | 2 +- examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoUDP.xc | 2 +- examples/AN00131_CDC_EDC_class/src/eth_tcp/http.h | 2 +- examples/AN00131_CDC_EDC_class/src/eth_tcp/http.xc | 2 +- examples/AN00131_CDC_EDC_class/src/ethernet.h | 2 +- examples/AN00131_CDC_EDC_class/src/ethernet.xc | 2 +- examples/AN00131_CDC_EDC_class/src/main.xc | 2 +- examples/AN00131_CDC_EDC_class/src/packet_buffer.h | 2 +- examples/AN00131_CDC_EDC_class/src/packet_buffer.xc | 2 +- examples/AN00131_CDC_EDC_class/src/queue.h | 2 +- examples/AN00131_CDC_EDC_class/src/queue.xc | 2 +- examples/AN00131_CDC_EDC_class/src/xud_ecm.h | 2 +- examples/AN00131_CDC_EDC_class/src/xud_ecm.xc | 2 +- examples/AN00132_image_class/host/ptp.h | 2 +- examples/AN00132_image_class/src/endpoint0.xc | 2 +- examples/AN00132_image_class/src/main.xc | 2 +- examples/AN00135_test_and_measurement_class/host/usbtmc_test.py | 2 +- examples/AN00135_test_and_measurement_class/src/endpoint0.xc | 2 +- examples/AN00135_test_and_measurement_class/src/main.xc | 2 +- .../src/scpi_parser/custom/scpi_cmds.c | 2 +- .../src/scpi_parser/custom/scpi_cmds.h | 2 +- .../src/scpi_parser/custom/scpi_parser_wrapper.c | 2 +- .../src/scpi_parser/custom/scpi_parser_wrapper.h | 2 +- .../AN00135_test_and_measurement_class/src/scpi_parser/fifo.c | 2 +- .../AN00135_test_and_measurement_class/src/usbtmc_endpoints.xc | 2 +- examples/AN00136_vendor_specific/src/endpoint0.xc | 2 +- examples/AN00136_vendor_specific/src/main.xc | 2 +- lib_xud/src/core/XUD_CrcAddrCheck.S | 2 +- lib_xud/src/core/included/XUD_Token_Setup_DI.S | 2 +- tests/test_shorttoken/src/main.xc | 2 +- tests/test_sof_badcrc/src/main.xc | 2 +- tests/test_sof_basic/src/main.xc | 2 +- 55 files changed, 55 insertions(+), 55 deletions(-) diff --git a/examples/AN00124_CDC_VCOM_class/src/main.xc b/examples/AN00124_CDC_VCOM_class/src/main.xc index d5db389e..2f12c590 100644 --- a/examples/AN00124_CDC_VCOM_class/src/main.xc +++ b/examples/AN00124_CDC_VCOM_class/src/main.xc @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include diff --git a/examples/AN00124_CDC_VCOM_class/src/xud_cdc.h b/examples/AN00124_CDC_VCOM_class/src/xud_cdc.h index 3dca3ed7..928bb29e 100644 --- a/examples/AN00124_CDC_VCOM_class/src/xud_cdc.h +++ b/examples/AN00124_CDC_VCOM_class/src/xud_cdc.h @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef XUD_CDC_H_ diff --git a/examples/AN00124_CDC_VCOM_class/src/xud_cdc.xc b/examples/AN00124_CDC_VCOM_class/src/xud_cdc.xc index 6e7d7fa6..8abc2aaf 100644 --- a/examples/AN00124_CDC_VCOM_class/src/xud_cdc.xc +++ b/examples/AN00124_CDC_VCOM_class/src/xud_cdc.xc @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include diff --git a/examples/AN00125_mass_storage_class/src/debug_conf.h b/examples/AN00125_mass_storage_class/src/debug_conf.h index b666c5e5..f2682392 100644 --- a/examples/AN00125_mass_storage_class/src/debug_conf.h +++ b/examples/AN00125_mass_storage_class/src/debug_conf.h @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef DEBUG_CONF_H_ diff --git a/examples/AN00125_mass_storage_class/src/endpoint0.xc b/examples/AN00125_mass_storage_class/src/endpoint0.xc index 1f43ae20..986eedde 100644 --- a/examples/AN00125_mass_storage_class/src/endpoint0.xc +++ b/examples/AN00125_mass_storage_class/src/endpoint0.xc @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. /* diff --git a/examples/AN00125_mass_storage_class/src/main.xc b/examples/AN00125_mass_storage_class/src/main.xc index b15f737e..5503412c 100644 --- a/examples/AN00125_mass_storage_class/src/main.xc +++ b/examples/AN00125_mass_storage_class/src/main.xc @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include diff --git a/examples/AN00125_mass_storage_class/src/mass_storage.h b/examples/AN00125_mass_storage_class/src/mass_storage.h index 733551ba..d8c8bfa0 100644 --- a/examples/AN00125_mass_storage_class/src/mass_storage.h +++ b/examples/AN00125_mass_storage_class/src/mass_storage.h @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef MASS_STORAGE_H_ diff --git a/examples/AN00125_mass_storage_class/src/mass_storage.xc b/examples/AN00125_mass_storage_class/src/mass_storage.xc index 46d8421f..eb886aab 100644 --- a/examples/AN00125_mass_storage_class/src/mass_storage.xc +++ b/examples/AN00125_mass_storage_class/src/mass_storage.xc @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include diff --git a/examples/AN00126_printer_class/src/endpoint0.xc b/examples/AN00126_printer_class/src/endpoint0.xc index 41fb8f5c..a6d6f7cb 100644 --- a/examples/AN00126_printer_class/src/endpoint0.xc +++ b/examples/AN00126_printer_class/src/endpoint0.xc @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. /* diff --git a/examples/AN00126_printer_class/src/main.xc b/examples/AN00126_printer_class/src/main.xc index 6f99a091..8cf06802 100644 --- a/examples/AN00126_printer_class/src/main.xc +++ b/examples/AN00126_printer_class/src/main.xc @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "xud_device.h" #include "debug_print.h" diff --git a/examples/AN00127_video_class/src/main.xc b/examples/AN00127_video_class/src/main.xc index 00330cd5..cd78905f 100644 --- a/examples/AN00127_video_class/src/main.xc +++ b/examples/AN00127_video_class/src/main.xc @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. /* Includes */ diff --git a/examples/AN00127_video_class/src/usb_video.h b/examples/AN00127_video_class/src/usb_video.h index 0cdd8caa..5e8d9601 100644 --- a/examples/AN00127_video_class/src/usb_video.h +++ b/examples/AN00127_video_class/src/usb_video.h @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef USB_VIDEO_H_ diff --git a/examples/AN00127_video_class/src/usb_video.xc b/examples/AN00127_video_class/src/usb_video.xc index f3cd3b00..46f01bf2 100644 --- a/examples/AN00127_video_class/src/usb_video.xc +++ b/examples/AN00127_video_class/src/usb_video.xc @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "string.h" diff --git a/examples/AN00127_video_class/src/uvc_defs.h b/examples/AN00127_video_class/src/uvc_defs.h index f9a8b904..0c30e6ac 100644 --- a/examples/AN00127_video_class/src/uvc_defs.h +++ b/examples/AN00127_video_class/src/uvc_defs.h @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef UVC_DEFS_H_ diff --git a/examples/AN00127_video_class/src/uvc_req.c b/examples/AN00127_video_class/src/uvc_req.c index 10024761..06a23f9c 100644 --- a/examples/AN00127_video_class/src/uvc_req.c +++ b/examples/AN00127_video_class/src/uvc_req.c @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include diff --git a/examples/AN00127_video_class/src/uvc_req.h b/examples/AN00127_video_class/src/uvc_req.h index f1e978b6..09c24420 100644 --- a/examples/AN00127_video_class/src/uvc_req.h +++ b/examples/AN00127_video_class/src/uvc_req.h @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef UVC_REQ_H_ diff --git a/examples/AN00129_hid_class/src/main.xc b/examples/AN00129_hid_class/src/main.xc index 49e171ad..0235a212 100644 --- a/examples/AN00129_hid_class/src/main.xc +++ b/examples/AN00129_hid_class/src/main.xc @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "xud_device.h" diff --git a/examples/AN00131_CDC_EDC_class/src/eth_tcp/dhcp.h b/examples/AN00131_CDC_EDC_class/src/eth_tcp/dhcp.h index d7d68d34..0c4e4348 100644 --- a/examples/AN00131_CDC_EDC_class/src/eth_tcp/dhcp.h +++ b/examples/AN00131_CDC_EDC_class/src/eth_tcp/dhcp.h @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _DHCP_H_ diff --git a/examples/AN00131_CDC_EDC_class/src/eth_tcp/dhcp.xc b/examples/AN00131_CDC_EDC_class/src/eth_tcp/dhcp.xc index 699561f9..6e76cb8f 100644 --- a/examples/AN00131_CDC_EDC_class/src/eth_tcp/dhcp.xc +++ b/examples/AN00131_CDC_EDC_class/src/eth_tcp/dhcp.xc @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include diff --git a/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoIP.h b/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoIP.h index 44b40a6c..a501dbad 100644 --- a/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoIP.h +++ b/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoIP.h @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _FEMTOIP_H_ diff --git a/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoIP.xc b/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoIP.xc index cebf8661..6f317c9c 100644 --- a/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoIP.xc +++ b/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoIP.xc @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include diff --git a/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoTCP.h b/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoTCP.h index 9e9a7327..75a7cc10 100644 --- a/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoTCP.h +++ b/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoTCP.h @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _FEMTOTCP_H_ diff --git a/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoTCP.xc b/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoTCP.xc index 43fcc857..b2b6ed42 100644 --- a/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoTCP.xc +++ b/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoTCP.xc @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include diff --git a/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoUDP.h b/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoUDP.h index fdc2c5ca..ad3ba0ef 100644 --- a/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoUDP.h +++ b/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoUDP.h @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _FEMTOUDP_H_ diff --git a/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoUDP.xc b/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoUDP.xc index d029675e..31b2e34a 100644 --- a/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoUDP.xc +++ b/examples/AN00131_CDC_EDC_class/src/eth_tcp/femtoUDP.xc @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include diff --git a/examples/AN00131_CDC_EDC_class/src/eth_tcp/http.h b/examples/AN00131_CDC_EDC_class/src/eth_tcp/http.h index 5fe4b098..bc0001f1 100644 --- a/examples/AN00131_CDC_EDC_class/src/eth_tcp/http.h +++ b/examples/AN00131_CDC_EDC_class/src/eth_tcp/http.h @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _HTTP_H_ diff --git a/examples/AN00131_CDC_EDC_class/src/eth_tcp/http.xc b/examples/AN00131_CDC_EDC_class/src/eth_tcp/http.xc index 283288ca..6d6bd62c 100644 --- a/examples/AN00131_CDC_EDC_class/src/eth_tcp/http.xc +++ b/examples/AN00131_CDC_EDC_class/src/eth_tcp/http.xc @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include diff --git a/examples/AN00131_CDC_EDC_class/src/ethernet.h b/examples/AN00131_CDC_EDC_class/src/ethernet.h index f5802154..cf2f390c 100644 --- a/examples/AN00131_CDC_EDC_class/src/ethernet.h +++ b/examples/AN00131_CDC_EDC_class/src/ethernet.h @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef _ETHERNET_H_ diff --git a/examples/AN00131_CDC_EDC_class/src/ethernet.xc b/examples/AN00131_CDC_EDC_class/src/ethernet.xc index 53679596..5010072d 100644 --- a/examples/AN00131_CDC_EDC_class/src/ethernet.xc +++ b/examples/AN00131_CDC_EDC_class/src/ethernet.xc @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include diff --git a/examples/AN00131_CDC_EDC_class/src/main.xc b/examples/AN00131_CDC_EDC_class/src/main.xc index 8f379a91..325fb689 100644 --- a/examples/AN00131_CDC_EDC_class/src/main.xc +++ b/examples/AN00131_CDC_EDC_class/src/main.xc @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include diff --git a/examples/AN00131_CDC_EDC_class/src/packet_buffer.h b/examples/AN00131_CDC_EDC_class/src/packet_buffer.h index 4704c1a0..8345aaa3 100644 --- a/examples/AN00131_CDC_EDC_class/src/packet_buffer.h +++ b/examples/AN00131_CDC_EDC_class/src/packet_buffer.h @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef PACKET_BUFFER_H_ diff --git a/examples/AN00131_CDC_EDC_class/src/packet_buffer.xc b/examples/AN00131_CDC_EDC_class/src/packet_buffer.xc index d63e337b..d344f138 100644 --- a/examples/AN00131_CDC_EDC_class/src/packet_buffer.xc +++ b/examples/AN00131_CDC_EDC_class/src/packet_buffer.xc @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "packet_buffer.h" diff --git a/examples/AN00131_CDC_EDC_class/src/queue.h b/examples/AN00131_CDC_EDC_class/src/queue.h index 5d8c8786..c821c7a5 100644 --- a/examples/AN00131_CDC_EDC_class/src/queue.h +++ b/examples/AN00131_CDC_EDC_class/src/queue.h @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef QUEUE_H_ diff --git a/examples/AN00131_CDC_EDC_class/src/queue.xc b/examples/AN00131_CDC_EDC_class/src/queue.xc index bfb64f98..edc28d7e 100644 --- a/examples/AN00131_CDC_EDC_class/src/queue.xc +++ b/examples/AN00131_CDC_EDC_class/src/queue.xc @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include diff --git a/examples/AN00131_CDC_EDC_class/src/xud_ecm.h b/examples/AN00131_CDC_EDC_class/src/xud_ecm.h index f4e3c031..4a7f16c0 100644 --- a/examples/AN00131_CDC_EDC_class/src/xud_ecm.h +++ b/examples/AN00131_CDC_EDC_class/src/xud_ecm.h @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef XUD_ECM_H_ diff --git a/examples/AN00131_CDC_EDC_class/src/xud_ecm.xc b/examples/AN00131_CDC_EDC_class/src/xud_ecm.xc index 72c231c9..5e0a0f3b 100644 --- a/examples/AN00131_CDC_EDC_class/src/xud_ecm.xc +++ b/examples/AN00131_CDC_EDC_class/src/xud_ecm.xc @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include diff --git a/examples/AN00132_image_class/host/ptp.h b/examples/AN00132_image_class/host/ptp.h index 08297e52..73a84221 100644 --- a/examples/AN00132_image_class/host/ptp.h +++ b/examples/AN00132_image_class/host/ptp.h @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef __PTP_H__ diff --git a/examples/AN00132_image_class/src/endpoint0.xc b/examples/AN00132_image_class/src/endpoint0.xc index 8a9dd00d..087f26c1 100644 --- a/examples/AN00132_image_class/src/endpoint0.xc +++ b/examples/AN00132_image_class/src/endpoint0.xc @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. /* diff --git a/examples/AN00132_image_class/src/main.xc b/examples/AN00132_image_class/src/main.xc index 988722f8..2d78b957 100644 --- a/examples/AN00132_image_class/src/main.xc +++ b/examples/AN00132_image_class/src/main.xc @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include diff --git a/examples/AN00135_test_and_measurement_class/host/usbtmc_test.py b/examples/AN00135_test_and_measurement_class/host/usbtmc_test.py index ab68b647..84a48ac4 100644 --- a/examples/AN00135_test_and_measurement_class/host/usbtmc_test.py +++ b/examples/AN00135_test_and_measurement_class/host/usbtmc_test.py @@ -1,4 +1,4 @@ -# Copyright 2017-2021 XMOS LIMITED. +# Copyright 2015-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. import usb.core diff --git a/examples/AN00135_test_and_measurement_class/src/endpoint0.xc b/examples/AN00135_test_and_measurement_class/src/endpoint0.xc index c4fb22f0..d18678d4 100644 --- a/examples/AN00135_test_and_measurement_class/src/endpoint0.xc +++ b/examples/AN00135_test_and_measurement_class/src/endpoint0.xc @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. /* diff --git a/examples/AN00135_test_and_measurement_class/src/main.xc b/examples/AN00135_test_and_measurement_class/src/main.xc index d425a1ed..61b2c849 100644 --- a/examples/AN00135_test_and_measurement_class/src/main.xc +++ b/examples/AN00135_test_and_measurement_class/src/main.xc @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "xud_device.h" diff --git a/examples/AN00135_test_and_measurement_class/src/scpi_parser/custom/scpi_cmds.c b/examples/AN00135_test_and_measurement_class/src/scpi_parser/custom/scpi_cmds.c index be5cb219..551bb8f2 100644 --- a/examples/AN00135_test_and_measurement_class/src/scpi_parser/custom/scpi_cmds.c +++ b/examples/AN00135_test_and_measurement_class/src/scpi_parser/custom/scpi_cmds.c @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. /** diff --git a/examples/AN00135_test_and_measurement_class/src/scpi_parser/custom/scpi_cmds.h b/examples/AN00135_test_and_measurement_class/src/scpi_parser/custom/scpi_cmds.h index d8230fde..da6ed429 100644 --- a/examples/AN00135_test_and_measurement_class/src/scpi_parser/custom/scpi_cmds.h +++ b/examples/AN00135_test_and_measurement_class/src/scpi_parser/custom/scpi_cmds.h @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef SCPI_DEF_H_ diff --git a/examples/AN00135_test_and_measurement_class/src/scpi_parser/custom/scpi_parser_wrapper.c b/examples/AN00135_test_and_measurement_class/src/scpi_parser/custom/scpi_parser_wrapper.c index 7877e127..a59dd1d7 100644 --- a/examples/AN00135_test_and_measurement_class/src/scpi_parser/custom/scpi_parser_wrapper.c +++ b/examples/AN00135_test_and_measurement_class/src/scpi_parser/custom/scpi_parser_wrapper.c @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. /** diff --git a/examples/AN00135_test_and_measurement_class/src/scpi_parser/custom/scpi_parser_wrapper.h b/examples/AN00135_test_and_measurement_class/src/scpi_parser/custom/scpi_parser_wrapper.h index a5ded8f0..1151e2ae 100644 --- a/examples/AN00135_test_and_measurement_class/src/scpi_parser/custom/scpi_parser_wrapper.h +++ b/examples/AN00135_test_and_measurement_class/src/scpi_parser/custom/scpi_parser_wrapper.h @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef SCPI_PARSER_WRAPPER_H_ diff --git a/examples/AN00135_test_and_measurement_class/src/scpi_parser/fifo.c b/examples/AN00135_test_and_measurement_class/src/scpi_parser/fifo.c index 74e0ec74..983be082 100644 --- a/examples/AN00135_test_and_measurement_class/src/scpi_parser/fifo.c +++ b/examples/AN00135_test_and_measurement_class/src/scpi_parser/fifo.c @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "scpi/fifo.h" diff --git a/examples/AN00135_test_and_measurement_class/src/usbtmc_endpoints.xc b/examples/AN00135_test_and_measurement_class/src/usbtmc_endpoints.xc index 0cd81f63..7ea37f21 100644 --- a/examples/AN00135_test_and_measurement_class/src/usbtmc_endpoints.xc +++ b/examples/AN00135_test_and_measurement_class/src/usbtmc_endpoints.xc @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "xud_device.h" diff --git a/examples/AN00136_vendor_specific/src/endpoint0.xc b/examples/AN00136_vendor_specific/src/endpoint0.xc index e455b3ef..aabacd51 100644 --- a/examples/AN00136_vendor_specific/src/endpoint0.xc +++ b/examples/AN00136_vendor_specific/src/endpoint0.xc @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include diff --git a/examples/AN00136_vendor_specific/src/main.xc b/examples/AN00136_vendor_specific/src/main.xc index 97e0edc2..2a79249a 100644 --- a/examples/AN00136_vendor_specific/src/main.xc +++ b/examples/AN00136_vendor_specific/src/main.xc @@ -1,4 +1,4 @@ -// Copyright 2017-2021 XMOS LIMITED. +// Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include diff --git a/lib_xud/src/core/XUD_CrcAddrCheck.S b/lib_xud/src/core/XUD_CrcAddrCheck.S index 3e48574a..df9c47be 100644 --- a/lib_xud/src/core/XUD_CrcAddrCheck.S +++ b/lib_xud/src/core/XUD_CrcAddrCheck.S @@ -1,4 +1,4 @@ -// Copyright 2019-2021 XMOS LIMITED. +// Copyright 2011-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. // On Entry: diff --git a/lib_xud/src/core/included/XUD_Token_Setup_DI.S b/lib_xud/src/core/included/XUD_Token_Setup_DI.S index 1750fabb..e96453f5 100644 --- a/lib_xud/src/core/included/XUD_Token_Setup_DI.S +++ b/lib_xud/src/core/included/XUD_Token_Setup_DI.S @@ -1,4 +1,4 @@ -// Copyright 2019-2021 XMOS LIMITED. +// Copyright 2011-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "XUD_AlignmentDefines.h" diff --git a/tests/test_shorttoken/src/main.xc b/tests/test_shorttoken/src/main.xc index 7be7f321..3b8c41c5 100644 --- a/tests/test_shorttoken/src/main.xc +++ b/tests/test_shorttoken/src/main.xc @@ -1,4 +1,4 @@ -// Copyright 2019-2021 XMOS LIMITED. +// Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include diff --git a/tests/test_sof_badcrc/src/main.xc b/tests/test_sof_badcrc/src/main.xc index e43d363e..f5030961 100644 --- a/tests/test_sof_badcrc/src/main.xc +++ b/tests/test_sof_badcrc/src/main.xc @@ -1,4 +1,4 @@ -// Copyright 2019-2021 XMOS LIMITED. +// Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include diff --git a/tests/test_sof_basic/src/main.xc b/tests/test_sof_basic/src/main.xc index b8cc8f57..467045b2 100644 --- a/tests/test_sof_basic/src/main.xc +++ b/tests/test_sof_basic/src/main.xc @@ -1,4 +1,4 @@ -// Copyright 2019-2021 XMOS LIMITED. +// Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include From 1a5eabc20f50600b1b7655198700c538a008b0fd Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 12 Apr 2021 17:48:28 +0100 Subject: [PATCH 229/520] Updates for RxError assertion tests --- tests/test_bulk_rx_basic_rxerror.py | 69 ++++++++++------------------- tests/usb_packet.py | 2 +- tests/usb_session.py | 5 ++- tests/usb_transaction.py | 20 ++++++--- 4 files changed, 41 insertions(+), 55 deletions(-) diff --git a/tests/test_bulk_rx_basic_rxerror.py b/tests/test_bulk_rx_basic_rxerror.py index e5ac2ac4..81777dc4 100644 --- a/tests/test_bulk_rx_basic_rxerror.py +++ b/tests/test_bulk_rx_basic_rxerror.py @@ -1,64 +1,43 @@ #!/usr/bin/env python - -import random import xmostest from usb_packet import * -from usb_clock import Clock -from helpers import do_usb_test, runall_rx - -# Single, setup transaction to EP 0 +import usb_packet +from helpers import do_usb_test, RunUsbTest +from usb_session import UsbSession +from usb_transaction import UsbTransaction -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): - rand = random.Random() - rand.seed(seed) +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): address = 1 ep = 1 + # Large inter-event delay is to give the DUT time to perform checking + ied = 6000 - # The inter-frame gap is to give the DUT time to print its output - packets = [] + session = UsbSession(bus_speed = usb_speed, run_enumeration = False, device_address = address) - dataval = 0; - - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=10, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) + # Valid OUT transaction + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=10)) # Assert RxError during packet - dataval += 10 - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=11, pid=0xb, rxe_assert_time=5)) #DATA1 - # xCORE should ignore the packet and not handshake... - #packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=11, + interEventDelay=ied, rxeAssertDelay_data=5)) + # Re-send.. - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=11, pid=0xb, rxe_assert_time=0)) #DATA1 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=11, interEventDelay=ied)) - dataval += 11 - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=12, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) + # Valid OUT transaction + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=12, interEventDelay=ied)) - dataval += 12 - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=13, pid=0xb, rxe_assert_time=1)) #DATA1 - #packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - - #resend - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=13, pid=0xb)) #DATA1 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=13, + interEventDelay=ied, rxeAssertDelay_data=1)) + + # Re-send + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=13, interEventDelay=ied)) - dataval += 13 - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=14, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=14, interEventDelay=ied)) - do_usb_test(arch, clk, phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) def runtest(): - random.seed(1) - runall_rx(do_test) + RunUsbTest(do_test) diff --git a/tests/usb_packet.py b/tests/usb_packet.py index 9d9303e1..df4f1135 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -505,7 +505,7 @@ def __init__(self, **kwargs): #self.inter_pkt_gap = kwargs.pop('inter_pkt_gap', 13) #13 lowest working for single issue loopback def __str__(self): - return super(DataPacket, self).__str__() + ": TX DataPacket: " + super(DataPacket, self).get_pid_str() + " " + str(self.data_bytes) + " Valid CRC: " + str(not self.bad_crc) + return super(DataPacket, self).__str__() + ": TX DataPacket: " + super(DataPacket, self).get_pid_str() + " " + str(self.data_bytes) + " Valid CRC: " + str(not self.bad_crc) + "RXE Assert: " + str(self.rxe_assert_time) #Always TX class TokenPacket(TxPacket): diff --git a/tests/usb_session.py b/tests/usb_session.py index 830781cf..0d0b7348 100644 --- a/tests/usb_session.py +++ b/tests/usb_session.py @@ -44,9 +44,10 @@ def enumerate(self): def data_valid_count(self): return USB_DATA_VALID_COUNT[self._bus_speed] - def getPayload_out(self, n, length): + def getPayload_out(self, n, length, resend = False): payload = [x for x in range(self._dataGen_out[n], self._dataGen_out[n] + length)] - self._dataGen_out[n] += length + if not resend: + self._dataGen_out[n] += length return payload def getPayload_in(self, n, length): diff --git a/tests/usb_transaction.py b/tests/usb_transaction.py index 6cf1fa1f..05c43cb1 100644 --- a/tests/usb_transaction.py +++ b/tests/usb_transaction.py @@ -11,7 +11,8 @@ class UsbTransaction(UsbEvent): def __init__(self, session, deviceAddress = 0, endpointNumber = 0, endpointType = "BULK", - direction="OUT", bus_speed="HS", eventTime = 0, dataLength = 0, interEventDelay=INTER_TRANSACTION_DELAY, badDataCrc = False, resend=False): # TODO Enums when we move to py3 + direction="OUT", bus_speed="HS", eventTime = 0, dataLength = 0, interEventDelay=INTER_TRANSACTION_DELAY, badDataCrc = False, + resend=False, rxeAssertDelay_data=0): # TODO Enums when we move to py3 self._deviceAddress = deviceAddress self._endpointNumber = endpointNumber @@ -20,6 +21,7 @@ def __init__(self, session, deviceAddress = 0, endpointNumber = 0, endpointType self._datalength = dataLength self._bus_speed = bus_speed self._badDataCrc = badDataCrc + self._rxeAssertDelay_data = rxeAssertDelay_data assert endpointType in USB_EP_TYPES assert direction in USB_DIRECTIONS @@ -39,21 +41,25 @@ def __init__(self, session, deviceAddress = 0, endpointNumber = 0, endpointType # Don't toggle data pid if we had a bad data crc - if self._badDataCrc == True: + if self._badDataCrc or self._rxeAssertDelay_data: togglePid = False else: togglePid = True - + + if (not self._badDataCrc) and (not self._rxeAssertDelay_data): + expectHandshake = True + else: + expectHandshake = False + # Generate packet data payload - packetPayload = session.getPayload_out(endpointNumber, dataLength); + packetPayload = session.getPayload_out(endpointNumber, dataLength, resend = not expectHandshake); pid = session.data_pid_out(endpointNumber, togglePid = togglePid) # Add data packet to packets list - packets.append(TxDataPacket(pid=pid, dataPayload = packetPayload, bad_crc=self._badDataCrc)) + packets.append(TxDataPacket(pid=pid, dataPayload = packetPayload, bad_crc=self._badDataCrc, rxe_assert_time=self._rxeAssertDelay_data)) - if not self._badDataCrc: - # Add handshake packet to packets list + if expectHandshake: packets.append(RxHandshakePacket()) self._packets.extend(packets) From dd8d3e5f200325464c3c2be4d7677fa7dba10209 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 13 Apr 2021 12:04:50 +0100 Subject: [PATCH 230/520] Updates to multiep, traffic and in_badack tests --- tests/shared_src/shared.h | 4 +-- tests/test_bulk_rx_multiep.py | 55 ++++++++++------------------------ tests/test_bulk_rx_traffic.py | 56 +++++++++++++---------------------- tests/test_bulk_tx_badack.py | 56 +++++++++++------------------------ tests/usb_packet.py | 14 +++------ tests/usb_session.py | 13 ++++---- tests/usb_transaction.py | 3 +- 7 files changed, 69 insertions(+), 132 deletions(-) diff --git a/tests/shared_src/shared.h b/tests/shared_src/shared.h index 83e12814..3fb5d3b7 100644 --- a/tests/shared_src/shared.h +++ b/tests/shared_src/shared.h @@ -62,11 +62,11 @@ void TerminatePass(unsigned x) #endif #ifndef PKT_LEN_END -#define PKT_LEN_END 21 +#define PKT_LEN_END 21 #endif #ifndef MAX_PKT_COUNT -#define MAX_PKT_COUNT (10) +#define MAX_PKT_COUNT (50) #endif #define XUD_Manager XUD_Main diff --git a/tests/test_bulk_rx_multiep.py b/tests/test_bulk_rx_multiep.py index 259bc741..237c1506 100644 --- a/tests/test_bulk_rx_multiep.py +++ b/tests/test_bulk_rx_multiep.py @@ -1,48 +1,25 @@ -#!/usr/bin/env python - -import random +##!/usr/bin/env python import xmostest from usb_packet import * -from usb_clock import Clock -from helpers import do_usb_test, runall_rx - -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): - rand = random.Random() - rand.seed(seed) +import usb_packet +from helpers import do_usb_test, RunUsbTest +from usb_session import UsbSession +from usb_transaction import UsbTransaction - # The inter-frame gap is to give the DUT time to print its output - packets = [] +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): address = 1 - data_val = 0; - pkt_length = 20 - data_pid = 0x3 #DATA0 - - for pkt_length in range(10, 20): - - #min 237 - AppendOutToken(packets, 3, address, data_valid_count=data_valid_count, inter_pkt_gap=1) - packets.append(TxDataPacket(rand, data_start_val=data_val, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) #DATA0 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - AppendOutToken(packets, 4, address, data_valid_count=data_valid_count, inter_pkt_gap=1) - packets.append(TxDataPacket(rand, data_start_val=data_val, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) #DATA0 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) + session = UsbSession(bus_speed = usb_speed, run_enumeration = False, device_address = address) - AppendOutToken(packets, 5, address, data_valid_count=data_valid_count, inter_pkt_gap=0) - packets.append(TxDataPacket(rand, data_start_val=data_val, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) #DATA0 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - - AppendOutToken(packets, 6, address, data_valid_count=data_valid_count, inter_pkt_gap=0) - packets.append(TxDataPacket(rand, data_start_val=data_val, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) #DATA0 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - - data_val = data_val + pkt_length - data_pid = data_pid ^ 8 - - do_usb_test(arch, clk, phy, usb_speed, packets, __file__, seed, - level='smoke', extra_tasks=[]) + for pktLength in range(10, 20): + + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=3, endpointType="BULK", direction= "OUT", dataLength=pktLength)) + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=4, endpointType="BULK", direction= "OUT", dataLength=pktLength)) + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=5, endpointType="BULK", direction= "OUT", dataLength=pktLength)) + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=6, endpointType="BULK", direction= "OUT", dataLength=pktLength)) + + do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) def runtest(): - random.seed(1) - runall_rx(do_test) + RunUsbTest(do_test) diff --git a/tests/test_bulk_rx_traffic.py b/tests/test_bulk_rx_traffic.py index 96ce7fe9..4d8fcb02 100644 --- a/tests/test_bulk_rx_traffic.py +++ b/tests/test_bulk_rx_traffic.py @@ -1,50 +1,34 @@ -#!/usr/bin/env python - -import random +##!/usr/bin/env python import xmostest from usb_packet import * import usb_packet -from usb_clock import Clock -from helpers import do_usb_test, runall_rx +from helpers import do_usb_test, RunUsbTest +from usb_session import UsbSession +from usb_transaction import UsbTransaction -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): - rand = random.Random() - rand.seed(seed) +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ep = 1 address = 1 - - # The inter-frame gap is to give the DUT time to print its output - packets = [] - - dataval = 0; - - pid = PID_DATA0; - + ied = 500 + trafficAddress1 = 0; trafficAddress2 = 127; - trafficEp1 = 15; trafficEp2 = 0; - for pktlength in range(10, 20): - - AppendOutToken(packets, trafficEp1, trafficAddress1, data_valid_count=data_valid_count, inter_pkt_gap=500) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pktlength, pid=pid)) + session = UsbSession(bus_speed = usb_speed, run_enumeration = False, device_address = address) - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=500) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pktlength, pid=pid)) - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - - AppendOutToken(packets, trafficEp2, trafficAddress2, data_valid_count=data_valid_count, inter_pkt_gap=500) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pktlength, pid=pid)) + for pktLength in range(10, 20): + + session.add_event(UsbTransaction(session, deviceAddress=trafficAddress1, endpointNumber=trafficEp1, endpointType="BULK", direction= "OUT", dataLength=pktLength, + interEventDelay=ied)) - if(pid == usb_packet.PID_DATA1): - pid = usb_packet.PID_DATA0; - else: - pid = usb_packet.PID_DATA1; + session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=pktLength, + interEventDelay=ied)) - dataval += pktlength + session.add_event(UsbTransaction(session, deviceAddress=trafficAddress2, endpointNumber=trafficEp2, endpointType="BULK", direction= "OUT", dataLength=pktLength, + interEventDelay=ied)) trafficEp1 = trafficEp1 - 1 if(trafficEp1 < 0): @@ -53,9 +37,9 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): trafficEp2 + trafficEp2 + 1 if(trafficEp1 > 15): trafficEp1 = 0 - - do_usb_test(arch, clk, phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) + + do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) def runtest(): - random.seed(1) - runall_rx(do_test) + RunUsbTest(do_test) + diff --git a/tests/test_bulk_tx_badack.py b/tests/test_bulk_tx_badack.py index 9414970f..833aee89 100644 --- a/tests/test_bulk_tx_badack.py +++ b/tests/test_bulk_tx_badack.py @@ -1,51 +1,29 @@ #!/usr/bin/env python -import random import xmostest -from usb_packet import * -import usb_packet -from usb_clock import Clock -from helpers import do_usb_test, runall_rx +from usb_packet import TokenPacket, RxDataPacket, TxHandshakePacket, USB_PID +from helpers import do_usb_test, RunUsbTest +from usb_session import UsbSession +from usb_transaction import UsbTransaction - -def do_test(arch, tx_clk, tx_phy, data_valid_count, usb_speed, seed): - rand = random.Random() - rand.seed(seed) +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ep = 1 address = 1 + pktLength = 10 + ied = 4000 - # The inter-frame gap is to give the DUT time to print its output - packets = [] - - dataval = 0; - - pid = PID_DATA0; - - pktlength = 10 + session = UsbSession(bus_speed = usb_speed, run_enumeration = False, device_address = address) + + for pktLength in range(10, 14): - for i in range(0, 4): + if pktLength == 12: + session.add_event(TokenPacket(pid=USB_PID['IN'], address=address, endpoint=ep, data_valid_count=data_valid_count, inter_pkt_gap=ied)) + session.add_event(RxDataPacket(dataPayload=session.getPayload_in(ep, pktLength, resend=True), valid_count=data_valid_count, pid=USB_PID['DATA0'])) + session.add_event(TxHandshakePacket(data_valid_count=data_valid_count, pid=0xff)) - if(i == 2): - AppendInToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=4000) - packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pktlength, pid=pid)) #DATA1 - packets.append(TxHandshakePacket(data_valid_count=data_valid_count, pid=0xff)) - - AppendInToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=4000) - packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pktlength, pid=pid)) #DATA1 - packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "IN", dataLength=pktLength, interEventDelay=ied)) - if(pid == usb_packet.PID_DATA1): - pid = usb_packet.PID_DATA0; - else: - pid = usb_packet.PID_DATA1; - - dataval += pktlength - pktlength += 1 - - # Note, quite big gap to allow checking. - do_usb_test(arch, tx_clk, tx_phy, usb_speed, packets, __file__, seed, - level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) def runtest(): - random.seed(1) - runall_rx(do_test) + RunUsbTest(do_test) diff --git a/tests/usb_packet.py b/tests/usb_packet.py index df4f1135..bac225b2 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -91,11 +91,11 @@ def AppendPingToken(packets, ep, address, **kwargs): ipg = kwargs.pop('inter_pkt_gap', 500) AppendTokenPacket(packets, 0xb4, ep, ipg, address, **kwargs) -def AppendInToken(packets, ep, address, **kwargs): +#def AppendInToken(packets, ep, address, **kwargs): #357 was min IPG supported on bulk loopback to not nak #lower values mean the loopback NAKs - ipg = kwargs.pop('inter_pkt_gap', 10) - AppendTokenPacket(packets, 0x69, ep, ipg, address, **kwargs) +# ipg = kwargs.pop('inter_pkt_gap', 10) +# AppendTokenPacket(packets, 0x69, ep, ipg, address, **kwargs) def AppendSofToken(packets, framenumber, **kwargs): ipg = kwargs.pop('inter_pkt_gap', 500) @@ -266,7 +266,7 @@ def __init__(self, **kwargs): def timeout(self): return self._timeout - def expected_output(self, offeet=0): + def expected_output(self, offset=0): expected_output = "Packet:\tDEVICE -> HOST\n" for (i, byte) in enumerate(self.get_bytes()): @@ -446,12 +446,6 @@ class DataPacket(UsbPacket): def __init__(self, dataPayload = [], **kwargs): super(DataPacket, self).__init__(**kwargs) self.pid = kwargs.pop('pid', 0x3) #DATA0 - #data_start_val = kwargs.pop('data_start_val', None) - - #if data_start_val != None: - # self.data_bytes = [x+data_start_val for x in range(self.num_data_bytes)] - #else: - # self.data_bytes = [x for x in range(self.num_data_bytes)] self.data_bytes = dataPayload def get_packet_bytes(self): diff --git a/tests/usb_session.py b/tests/usb_session.py index 0d0b7348..3c1ad57d 100644 --- a/tests/usb_session.py +++ b/tests/usb_session.py @@ -3,6 +3,8 @@ import usb_transaction import usb_packet +# TODO should EP numbers include the IN bit? + def CounterByte(startVal = 0, length = 0): l = startVal while l < length: @@ -15,7 +17,7 @@ def __init__(self, bus_speed = "HS", run_enumeration = False, device_address = 0 self._bus_speed = bus_speed self._events = [] self._enumerate = run_enumeration - self._device_address = device_address + self._deviceAddress = device_address self._pidTable_out = [usb_packet.USB_PID["DATA0"]] * 16 self._pidTable_in = [usb_packet.USB_PID["DATA0"]] * 16 @@ -33,8 +35,8 @@ def events(self): return self._events @property - def device_address(self): - return self._device_address + def deviceAddress(self): + return self._deviceAddress @property def enumerate(self): @@ -50,9 +52,10 @@ def getPayload_out(self, n, length, resend = False): self._dataGen_out[n] += length return payload - def getPayload_in(self, n, length): + def getPayload_in(self, n, length, resend = False): payload = [x for x in range(self._dataGen_in[n], self._dataGen_in[n] + length)] - self._dataGen_in[n] += length + if not resend: + self._dataGen_in[n] += length return payload def _pid_toggle(self, pid_table, n): diff --git a/tests/usb_transaction.py b/tests/usb_transaction.py index 05c43cb1..984da6fe 100644 --- a/tests/usb_transaction.py +++ b/tests/usb_transaction.py @@ -8,6 +8,7 @@ USB_DIRECTIONS=["OUT", "IN"] USB_EP_TYPES=["CONTROL", "BULK", "ISO", "INTERRUPT"] +#TODO UsbTransaction_IN and UsbTransaction_OUT class UsbTransaction(UsbEvent): def __init__(self, session, deviceAddress = 0, endpointNumber = 0, endpointType = "BULK", @@ -46,7 +47,7 @@ def __init__(self, session, deviceAddress = 0, endpointNumber = 0, endpointType else: togglePid = True - if (not self._badDataCrc) and (not self._rxeAssertDelay_data): + if (not self._badDataCrc) and (not self._rxeAssertDelay_data) and deviceAddress == session.deviceAddress: expectHandshake = True else: expectHandshake = False From 123e901187bea8c48d0d35fb7a8adb91d9780f71 Mon Sep 17 00:00:00 2001 From: Dave Atkinson Date: Tue, 13 Apr 2021 14:34:14 +0100 Subject: [PATCH 231/520] Automatic update of python 2 to 3. --- tests/helpers.py | 26 +++++++++++++------------- tests/usb_clock.py | 2 +- tests/usb_phy.py | 32 ++++++++++++++++---------------- tests/usb_phy_shim.py | 28 ++++++++++++++-------------- 4 files changed, 44 insertions(+), 44 deletions(-) diff --git a/tests/helpers.py b/tests/helpers.py index edf106fd..ca7a74d3 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -68,7 +68,7 @@ def run_on(**kwargs): if not args: return True - for name,value in kwargs.iteritems(): + for name,value in kwargs.items(): arg_value = getattr(args,name) if arg_value is not None and value != arg_value: return False @@ -77,7 +77,7 @@ def run_on(**kwargs): def runall_rx(test_fn): - seed = args.seed if args.seed else random.randint(0, sys.maxint) + seed = args.seed if args.seed else random.randint(0, sys.maxsize) data_valid_count = {'FS': 39, "HS": 0} @@ -99,12 +99,12 @@ def do_usb_test(arch, clk, phy, usb_speed, packets, test_file, seed, binary = '{testname}/bin/{arch}/{testname}_{arch}.xe'.format(testname=testname, arch=arch) - print binary + print(binary) if xmostest.testlevel_is_at_least(xmostest.get_testlevel(), level): - print "Running {test}: {arch} arch sending {n} packets at {clk} using {speed} (seed {seed})".format( + print("Running {test}: {arch} arch sending {n} packets at {clk} using {speed} (seed {seed})".format( test=testname, n=len(packets), - arch=arch, clk=clk.get_name(), speed=usb_speed, seed=seed) + arch=arch, clk=clk.get_name(), speed=usb_speed, seed=seed)) phy.set_packets(packets) @@ -189,15 +189,15 @@ def check_received_packet(packet, phy): if phy.expect_packet_index < phy.num_expected_packets: expected = phy.expected_packets[phy.expect_packet_index] if packet != expected: - print "ERROR: packet {n} does not match expected packet".format( - n=phy.expect_packet_index) + print("ERROR: packet {n} does not match expected packet".format( + n=phy.expect_packet_index)) - print "Received:" + print("Received:") sys.stdout.write(packet.dump()) - print "Expected:" + print("Expected:") sys.stdout.write(expected.dump()) - print "Received packet {} ok".format(phy.expect_packet_index) + print("Received packet {} ok".format(phy.expect_packet_index)) # Skip this packet phy.expect_packet_index += 1 @@ -205,11 +205,11 @@ def check_received_packet(packet, phy): move_to_next_valid_packet(phy) else: - print "ERROR: received unexpected packet from DUT" - print "Received:" + print("ERROR: received unexpected packet from DUT") + print("Received:") sys.stdout.write(packet.dump()) if phy.expect_packet_index >= phy.num_expected_packets: - print "Test done" + print("Test done") phy.xsi.terminate() diff --git a/tests/usb_clock.py b/tests/usb_clock.py index f14c5c49..ed5e433d 100644 --- a/tests/usb_clock.py +++ b/tests/usb_clock.py @@ -49,7 +49,7 @@ def get_bit_time(self): return self._bit_time def stop(self): - print "**** CLOCK STOP ****" + print("**** CLOCK STOP ****") self._running = False def start(self): diff --git a/tests/usb_phy.py b/tests/usb_phy.py index 39cd2e9a..f435ec20 100644 --- a/tests/usb_phy.py +++ b/tests/usb_phy.py @@ -48,7 +48,7 @@ def start_test(self): def end_test(self): if self._verbose: - print "All packets sent" + print("All packets sent") if self._complete_fn: self._complete_fn(self) @@ -83,7 +83,7 @@ def end_test(self): # Allow time for the DUT to exit self.wait_until(self.xsi.get_time() + self._dut_exit_time) - print "ERROR: Test timed out" + print("ERROR: Test timed out") self.xsi.terminate() def set_clock(self, clock): @@ -122,12 +122,12 @@ def run(self): #sample TXV for new packet if xsi.sample_port_pins(self._txv) == 1: - print "Receiving packet {}".format(i) + print("Receiving packet {}".format(i)) in_rx_packet = True break if in_rx_packet == False: - print "ERROR: Timed out waiting for packet" + print("ERROR: Timed out waiting for packet") else: while in_rx_packet == True: @@ -135,7 +135,7 @@ def run(self): xsi.drive_port_pins(self._txrdy, 1) data = xsi.sample_port_pins(self._txd) - print "Received byte: {0:#x}".format(data) + print("Received byte: {0:#x}".format(data)) rx_packet.append(data) self.wait(lambda x: self._clock.is_high()) @@ -151,17 +151,17 @@ def run(self): # Check packet against expected expected = packet.get_bytes(do_tokens=self._do_tokens) if len(expected) != len(rx_packet): - print "ERROR: Rx packet length bad. Expecting: {} actual: {}".format(len(expected), len(rx_packet)) + print("ERROR: Rx packet length bad. Expecting: {} actual: {}".format(len(expected), len(rx_packet))) # Check packet data against expected if cmp(expected, rx_packet): - print "ERROR: Rx Packet Error. Expected:" + print("ERROR: Rx Packet Error. Expected:") for item in expected: - print "{0:#x}".format(item) + print("{0:#x}".format(item)) - print "Received:" + print("Received:") for item in rx_packet: - print "{0:#x}".format(item) + print("{0:#x}".format(item)) else: @@ -169,14 +169,14 @@ def run(self): # xCore should not be trying to send if we are trying to send.. if xsi.sample_port_pins(self._txv) == 1: - print "ERROR: Unexpected packet from xCORE" + print("ERROR: Unexpected packet from xCORE") rxv_count = packet.get_data_valid_count(); #print "Waiting for inter_pkt_gap: {i}".format(i=packet.inter_frame_gap) self.wait_until(xsi.get_time() + packet.inter_pkt_gap) - print "Phy transmitting packet {} PID: {} ({})".format(i, packet.get_pid_pretty(), packet.pid) + print("Phy transmitting packet {} PID: {} ({})".format(i, packet.get_pid_pretty(), packet.pid)) if self._verbose: sys.stdout.write(packet.dump()) @@ -196,7 +196,7 @@ def run(self): # xCore should not be trying to send if we are trying to send.. if xsi.sample_port_pins(self._txv) == 1: - print "ERROR: Unexpected packet from xCORE" + print("ERROR: Unexpected packet from xCORE") self.wait(lambda x: self._clock.is_low()) @@ -217,7 +217,7 @@ def run(self): # xCore should not be trying to send if we are trying to send.. if xsi.sample_port_pins(self._txv) == 1: - print "ERROR: Unexpected packet from xCORE" + print("ERROR: Unexpected packet from xCORE") #print "Sending byte {0:#x}".format(byte) @@ -239,7 +239,7 @@ def run(self): # xCore should not be trying to send if we are trying to send.. if xsi.sample_port_pins(self._txv) == 1: - print "ERROR: Unexpected packet from xCORE" + print("ERROR: Unexpected packet from xCORE") #xsi.drive_port_pins(self._rxa, 0) xsi.drive_periph_pin(self._rxa, 0) @@ -247,7 +247,7 @@ def run(self): #if self._verbose: #print "Sent" - print "Test done" + print("Test done") self.end_test() diff --git a/tests/usb_phy_shim.py b/tests/usb_phy_shim.py index bd8e629a..472efbd4 100644 --- a/tests/usb_phy_shim.py +++ b/tests/usb_phy_shim.py @@ -47,12 +47,12 @@ def run(self): #sample TXV for new packet if xsi.sample_port_pins(self._txv) == 1: - print "Receiving packet {}".format(i) + print("Receiving packet {}".format(i)) in_rx_packet = True break if in_rx_packet == False: - print "ERROR: Timed out waiting for packet" + print("ERROR: Timed out waiting for packet") else: #print "in packet" @@ -62,7 +62,7 @@ def run(self): xsi.drive_port_pins(self._txrdy, 1) data = xsi.sample_port_pins(self._txd) - print "Received byte: {0:#x}".format(data) + print("Received byte: {0:#x}".format(data)) rx_packet.append(data) self.wait(lambda x: self._clock.is_high()) @@ -80,30 +80,30 @@ def run(self): # Check packet agaist expected expected = packet.get_bytes(do_tokens=True) if len(expected) != len(rx_packet): - print "ERROR: Rx packet length bad. Expecting: {} actual: {}".format(len(expected), len(rx_packet)) + print("ERROR: Rx packet length bad. Expecting: {} actual: {}".format(len(expected), len(rx_packet))) # Check packet data against expected if cmp(expected, rx_packet): - print "ERROR: Rx Packet Error. Expected:" + print("ERROR: Rx Packet Error. Expected:") for item in expected: - print "{0:#x}".format(item) + print("{0:#x}".format(item)) - print "Received:" + print("Received:") for item in rx_packet: - print "{0:#x}".format(item) + print("{0:#x}".format(item)) else: # xCore should not be trying to send if we are trying to send.. if xsi.sample_port_pins(self._txv) == 1: - print "ERROR: Unexpected packet from xCORE" + print("ERROR: Unexpected packet from xCORE") rxv_count = packet.get_data_valid_count(); #print "Waiting for inter_pkt_gap: {i}".format(i=packet.inter_frame_gap) self.wait_until(xsi.get_time() + packet.inter_pkt_gap) - print "Phy transmitting packet {} PID: {} ({})".format(i, packet.get_pid_pretty(), packet.pid) + print("Phy transmitting packet {} PID: {} ({})".format(i, packet.get_pid_pretty(), packet.pid)) if self._verbose: sys.stdout.write(packet.dump()) @@ -122,7 +122,7 @@ def run(self): # xCore should not be trying to send if we are trying to send.. if xsi.sample_port_pins(self._txv) == 1: - print "ERROR: Unexpected packet from xCORE" + print("ERROR: Unexpected packet from xCORE") self.wait(lambda x: self._clock.is_low()) @@ -142,7 +142,7 @@ def run(self): # xCore should not be trying to send if we are trying to send.. if xsi.sample_port_pins(self._txv) == 1: - print "ERROR: Unexpected packet from xCORE" + print("ERROR: Unexpected packet from xCORE") #print "Sending byte {0:#x}".format(byte) @@ -171,14 +171,14 @@ def run(self): # xCore should not be trying to send if we are trying to send.. if xsi.sample_port_pins(self._txv) == 1: - print "ERROR: Unexpected packet from xCORE" + print("ERROR: Unexpected packet from xCORE") xsi.drive_port_pins(self._rxa, 0) #if self._verbose: #print "Sent" - print "Test done" + print("Test done") self.end_test() From d05d013ca6affbef72209f5c0089209710685ed6 Mon Sep 17 00:00:00 2001 From: Dave Atkinson Date: Tue, 13 Apr 2021 15:33:01 +0100 Subject: [PATCH 232/520] Replace cmp() with '=='. --- tests/usb_phy.py | 2 +- tests/usb_phy_shim.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/usb_phy.py b/tests/usb_phy.py index f435ec20..e1ea1894 100644 --- a/tests/usb_phy.py +++ b/tests/usb_phy.py @@ -154,7 +154,7 @@ def run(self): print("ERROR: Rx packet length bad. Expecting: {} actual: {}".format(len(expected), len(rx_packet))) # Check packet data against expected - if cmp(expected, rx_packet): + if expected == rx_packet: print("ERROR: Rx Packet Error. Expected:") for item in expected: print("{0:#x}".format(item)) diff --git a/tests/usb_phy_shim.py b/tests/usb_phy_shim.py index 472efbd4..81e44609 100644 --- a/tests/usb_phy_shim.py +++ b/tests/usb_phy_shim.py @@ -83,7 +83,7 @@ def run(self): print("ERROR: Rx packet length bad. Expecting: {} actual: {}".format(len(expected), len(rx_packet))) # Check packet data against expected - if cmp(expected, rx_packet): + if expected == rx_packet: print("ERROR: Rx Packet Error. Expected:") for item in expected: print("{0:#x}".format(item)) From 0212380b579ba273c176c04e6e4deecccde9310d Mon Sep 17 00:00:00 2001 From: Dave Atkinson Date: Tue, 13 Apr 2021 15:37:02 +0100 Subject: [PATCH 233/520] Replace cmp() with '!=' instead. --- tests/usb_phy.py | 2 +- tests/usb_phy_shim.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/usb_phy.py b/tests/usb_phy.py index e1ea1894..c5736505 100644 --- a/tests/usb_phy.py +++ b/tests/usb_phy.py @@ -154,7 +154,7 @@ def run(self): print("ERROR: Rx packet length bad. Expecting: {} actual: {}".format(len(expected), len(rx_packet))) # Check packet data against expected - if expected == rx_packet: + if expected != rx_packet: print("ERROR: Rx Packet Error. Expected:") for item in expected: print("{0:#x}".format(item)) diff --git a/tests/usb_phy_shim.py b/tests/usb_phy_shim.py index 81e44609..ed78771b 100644 --- a/tests/usb_phy_shim.py +++ b/tests/usb_phy_shim.py @@ -83,7 +83,7 @@ def run(self): print("ERROR: Rx packet length bad. Expecting: {} actual: {}".format(len(expected), len(rx_packet))) # Check packet data against expected - if expected == rx_packet: + if expected != rx_packet: print("ERROR: Rx Packet Error. Expected:") for item in expected: print("{0:#x}".format(item)) From 5cc6952e19a8be7558ddd1158543585b87f2f14c Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 13 Apr 2021 15:50:56 +0100 Subject: [PATCH 234/520] Fixes to bulk tx_basic_short and bulk_tx_multiep tests --- tests/test_bulk_tx_basic_short.py | 47 +++++++----------------- tests/test_bulk_tx_multiep.py | 60 ++++++++----------------------- 2 files changed, 27 insertions(+), 80 deletions(-) diff --git a/tests/test_bulk_tx_basic_short.py b/tests/test_bulk_tx_basic_short.py index e09a22b8..709d3581 100644 --- a/tests/test_bulk_tx_basic_short.py +++ b/tests/test_bulk_tx_basic_short.py @@ -1,45 +1,24 @@ #!/usr/bin/env python -import random import xmostest -from usb_packet import * -import usb_packet -from usb_clock import Clock -from helpers import do_usb_test, runall_rx +from helpers import do_usb_test, RunUsbTest +from usb_session import UsbSession +from usb_transaction import UsbTransaction - -def do_test(arch, tx_clk, tx_phy, data_valid_count, usb_speed, seed): - rand = random.Random() - rand.seed(seed) +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ep = 1 address = 1 + start_length = 0 + end_length = 7 + + session = UsbSession(bus_speed=usb_speed, run_enumeration=False, device_address=address) - # The inter-frame gap is to give the DUT time to print its output - packets = [] - - dataval = 0; - - pid = PID_DATA0; - - for pktlength in range(0, 8): + for pktLength in range(start_length, end_length+1): + session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "IN", eventTime=10, dataLength=pktLength)) - AppendInToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=4000) - - packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pktlength, pid=pid)) #DATA1 - packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) + do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) - - if(pid == usb_packet.PID_DATA1): - pid = usb_packet.PID_DATA0; - else: - pid = usb_packet.PID_DATA1; - - dataval += pktlength +def runtest(): + RunUsbTest(do_test) - # Note, quite big gap to allow checking. - do_usb_test(arch, tx_clk, tx_phy, usb_speed, packets, __file__, seed, - level='smoke', extra_tasks=[]) -def runtest(): - random.seed(1) - runall_rx(do_test) diff --git a/tests/test_bulk_tx_multiep.py b/tests/test_bulk_tx_multiep.py index 2d85578b..2699c33a 100644 --- a/tests/test_bulk_tx_multiep.py +++ b/tests/test_bulk_tx_multiep.py @@ -1,56 +1,24 @@ #!/usr/bin/env python - -import random import xmostest -from usb_packet import * -from usb_clock import Clock -from helpers import do_usb_test, runall_rx +from helpers import do_usb_test, RunUsbTest +from usb_session import UsbSession +from usb_transaction import UsbTransaction -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): - rand = random.Random() - rand.seed(seed) +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): - start_ep = 3 - - # The inter-frame gap is to give the DUT time to print its output - packets = [] + ep = 3 # Note this is a starting EP address = 1 + ied = 200 - data_val = 0; - pkt_length = 20 - data_pid = 0x3 #DATA0 - - ipg = 200 + session = UsbSession(bus_speed = usb_speed, run_enumeration = False, device_address = address) - for pkt_length in range(10, 20): - - #Single EP: - #317 lowest for valid data (SI) - #337 for initial DI version + for pktLength in range(10, 20): + session.add_event(UsbTransaction(session, deviceAddress =address, endpointNumber=ep, endpointType="BULK", direction= "IN", dataLength=pktLength, interEventDelay=ied)) + session.add_event(UsbTransaction(session, deviceAddress =address, endpointNumber=ep+1, endpointType="BULK", direction= "IN", dataLength=pktLength, interEventDelay=ied)) + session.add_event(UsbTransaction(session, deviceAddress =address, endpointNumber=ep+2, endpointType="BULK", direction= "IN", dataLength=pktLength, interEventDelay=ied)) + session.add_event(UsbTransaction(session, deviceAddress =address, endpointNumber=ep+3, endpointType="BULK", direction= "IN", dataLength=pktLength, interEventDelay=ied)) - #Multi EP: - #177 lowest for valid data (DI) - AppendInToken(packets, start_ep, address, data_valid_count=data_valid_count, inter_pkt_gap=ipg) - packets.append(RxDataPacket(rand, data_start_val=data_val, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) - packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) - - AppendInToken(packets, start_ep+1, address, data_valid_count=data_valid_count, inter_pkt_gap=ipg) - packets.append(RxDataPacket(rand, data_start_val=data_val, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) - packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) - - AppendInToken(packets, start_ep+2, address, data_valid_count=data_valid_count, inter_pkt_gap=ipg) - packets.append(RxDataPacket(rand, data_start_val=data_val, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) - packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) - - AppendInToken(packets, start_ep+3, address, data_valid_count=data_valid_count, inter_pkt_gap=ipg) - packets.append(RxDataPacket(rand, data_start_val=data_val, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) - packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) - - data_val = data_val + pkt_length - data_pid = data_pid ^ 8 - - do_usb_test(arch, clk, phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) def runtest(): - random.seed(1) - runall_rx(do_test) + RunUsbTest(do_test) From 08d82afd39b91e7ccdd1887f4f49d0cdcbb490e8 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 13 Apr 2021 17:13:48 +0100 Subject: [PATCH 235/520] Fixes to test_control_basic_get --- tests/test_bulk_rx_basic_badpid.py | 16 +++++---- tests/test_bulk_tx_noack.py | 53 ++++++++++-------------------- tests/test_control_basic_get.py | 44 ++++++++++--------------- tests/usb_packet.py | 27 ++++++++------- 4 files changed, 56 insertions(+), 84 deletions(-) diff --git a/tests/test_bulk_rx_basic_badpid.py b/tests/test_bulk_rx_basic_badpid.py index 4675fa91..95ae600e 100644 --- a/tests/test_bulk_rx_basic_badpid.py +++ b/tests/test_bulk_rx_basic_badpid.py @@ -5,6 +5,8 @@ from usb_session import UsbSession from usb_transaction import UsbTransaction + + # Tests out of seq (but valid.. ) data PID def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): @@ -16,17 +18,17 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): # The large inter-frame gap is to give the DUT time to print its output interEventDelay = 500 - # Valid OUT transaction - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=10, interEventDelay=interEventDelay)) + # Valid IN transaction + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "IN", dataLength=10, interEventDelay=interEventDelay)) # Pretend the ACK went missing on the way to host. Re-send same packet. xCORE should ACK but throw pkt away - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=11, interEventDelay=interEventDelay, + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "IN", dataLength=11, interEventDelay=interEventDelay, resend=True)) - # Send some valid OUT transactions - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=12, interEventDelay=interEventDelay)) - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=13, interEventDelay=interEventDelay)) - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=14, interEventDelay=interEventDelay)) + # Send some valid IN transactions + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "IN", dataLength=12, interEventDelay=interEventDelay)) + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "IN", dataLength=13, interEventDelay=interEventDelay)) + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "IN", dataLength=14, interEventDelay=interEventDelay)) do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) diff --git a/tests/test_bulk_tx_noack.py b/tests/test_bulk_tx_noack.py index 1fc87da8..38b323be 100644 --- a/tests/test_bulk_tx_noack.py +++ b/tests/test_bulk_tx_noack.py @@ -1,51 +1,32 @@ #!/usr/bin/env python -import random import xmostest -from usb_packet import * -import usb_packet -from usb_clock import Clock -from helpers import do_usb_test, runall_rx +from usb_packet import USB_PID, TokenPacket, RxDataPacket +from helpers import do_usb_test, RunUsbTest +from usb_session import UsbSession +from usb_transaction import UsbTransaction - -def do_test(arch, tx_clk, tx_phy, data_valid_count, usb_speed, seed): - rand = random.Random() - rand.seed(seed) +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ep = 1 address = 1 + + # Note, quite big gap to allow checking + ied = 4000 - # The inter-frame gap is to give the DUT time to print its output - packets = [] - - dataval = 0; - - pid = PID_DATA0; + session = UsbSession(bus_speed=usb_speed, run_enumeration=False, device_address=address) - pktlength = 10 + for pktLength in range(10, 14): - for i in range(0, 4): - - if(i == 2): - AppendInToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=4000) - packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pktlength, pid=pid)) + if pktLength == 12: + session.add_event(TokenPacket(pid=USB_PID['IN'], address=address, endpoint=ep, data_valid_count=data_valid_count, inter_pkt_gap=ied)) + session.add_event(RxDataPacket(dataPayload=session.getPayload_in(ep, pktLength, resend=True))) # Missing ACK - simulate CRC fail at host - AppendInToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=4000) - packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pktlength, pid=pid)) - packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) - - if(pid == usb_packet.PID_DATA1): - pid = usb_packet.PID_DATA0; - else: - pid = usb_packet.PID_DATA1; + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "IN", dataLength=pktLength, interEventDelay=ied)) - dataval += pktlength - pktlength += 1 + do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) - # Note, quite big gap to allow checking. - do_usb_test(arch, tx_clk, tx_phy, usb_speed, packets, __file__, seed, - level='smoke', extra_tasks=[]) def runtest(): - random.seed(1) - runall_rx(do_test) + RunUsbTest(do_test) + diff --git a/tests/test_control_basic_get.py b/tests/test_control_basic_get.py index b18a47f9..0b653f9f 100644 --- a/tests/test_control_basic_get.py +++ b/tests/test_control_basic_get.py @@ -1,44 +1,34 @@ #!/usr/bin/env python - -import random import xmostest -from usb_packet import * -import usb_packet -from usb_clock import Clock -from helpers import do_usb_test, runall_rx - -# Single, setup transaction to EP 0 - -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): - rand = random.Random() - rand.seed(seed) +from usb_packet import TokenPacket, TxDataPacket, RxDataPacket, TxHandshakePacket, RxHandshakePacket, USB_PID +from helpers import do_usb_test, RunUsbTest +from usb_session import UsbSession +from usb_transaction import UsbTransaction +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ep = 0 address = 1 - # The inter-frame gap is to give the DUT time to print its output - packets = [] + session = UsbSession(bus_speed=usb_speed, run_enumeration=False, device_address=address) # SETUP transaction - AppendSetupToken(packets, ep, address, data_valid_count=data_valid_count) - packets.append(TxDataPacket(rand, data_valid_count=data_valid_count, length=8, pid=3)) - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) + session.add_event(TokenPacket(pid=USB_PID['SETUP'], address=address, endpoint=ep, data_valid_count=data_valid_count)) + session.add_event(TxDataPacket(dataPayload=session.getPayload_out(ep, 8), data_valid_count=data_valid_count, pid=USB_PID["DATA0"])) + session.add_event(RxHandshakePacket(data_valid_count=data_valid_count)) # IN transaction # Note, quite big gap to avoid nak - AppendInToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap = 10000) - packets.append(RxDataPacket(rand, data_valid_count=data_valid_count, length=10, pid=0xb)) - packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) + session.add_event(TokenPacket(pid=USB_PID['IN'], address=address, endpoint=ep, data_valid_count=data_valid_count, interEventDelay=10000)) + session.add_event(RxDataPacket(dataPayload=session.getPayload_in(ep, 10), data_valid_count=data_valid_count, pid=USB_PID["DATA1"])) + session.add_event(TxHandshakePacket(data_valid_count=data_valid_count)) # Send 0 length OUT transaction - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count) - packets.append(TxDataPacket(rand, data_valid_count=data_valid_count, length=0, pid=PID_DATA1)) - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - - do_usb_test(arch, clk, phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) + session.add_event(TokenPacket(pid=USB_PID['OUT'], address=address, endpoint=ep, data_valid_count=data_valid_count)) + session.add_event(TxDataPacket(data_valid_count=data_valid_count, length=0, pid=USB_PID['DATA1'])) + session.add_event(RxHandshakePacket(data_valid_count=data_valid_count)) + do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[]) def runtest(): - random.seed(1) - runall_rx(do_test) + RunUsbTest(do_test) diff --git a/tests/usb_packet.py b/tests/usb_packet.py index bac225b2..1cc34ee0 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -79,17 +79,17 @@ "ACK" : 0xD2 } -def AppendSetupToken(packets, ep, address, **kwargs): - ipg = kwargs.pop('inter_pkt_gap', 500) - AppendTokenPacket(packets, 0x2d, ep, ipg, address, **kwargs) +#def AppendSetupToken(packets, ep, address, **kwargs): +# ipg = kwargs.pop('inter_pkt_gap', 500) +# AppendTokenPacket(packets, 0x2d, ep, ipg, address, **kwargs) #def AppendOutToken(packets, ep, address, **kwargs): # ipg = kwargs.pop('inter_pkt_gap', 500) # AppendTokenPacket(packets, 0xe1, ep, ipg, address, **kwargs) -def AppendPingToken(packets, ep, address, **kwargs): - ipg = kwargs.pop('inter_pkt_gap', 500) - AppendTokenPacket(packets, 0xb4, ep, ipg, address, **kwargs) +#def AppendPingToken(packets, ep, address, **kwargs): +# ipg = kwargs.pop('inter_pkt_gap', 500) +# AppendTokenPacket(packets, 0xb4, ep, ipg, address, **kwargs) #def AppendInToken(packets, ep, address, **kwargs): #357 was min IPG supported on bulk loopback to not nak @@ -97,13 +97,13 @@ def AppendPingToken(packets, ep, address, **kwargs): # ipg = kwargs.pop('inter_pkt_gap', 10) # AppendTokenPacket(packets, 0x69, ep, ipg, address, **kwargs) -def AppendSofToken(packets, framenumber, **kwargs): - ipg = kwargs.pop('inter_pkt_gap', 500) +#def AppendSofToken(packets, framenumber, **kwargs): +# ipg = kwargs.pop('inter_pkt_gap', 500) # Override EP and Address - ep = (framenumber >> 7) & 0xf - address = (framenumber) & 0x7f - AppendTokenPacket(packets, 0xa5, ep, ipg, address, **kwargs) +# ep = (framenumber >> 7) & 0xf +# address = (framenumber) & 0x7f +# AppendTokenPacket(packets, 0xa5, ep, ipg, address, **kwargs) #def AppendTokenPacket(packets, _pid, ep, ipg, addr=0, **kwargs): # @@ -490,16 +490,15 @@ def __init__(self, **kwargs): super(RxDataPacket, self).__init__(pid = (_pid & 0xf) | (((~_pid)&0xf) << 4), **kwargs) def __str__(self): - return super(DataPacket, self).__str__() + ": TX DataPacket: " + super(DataPacket, self).get_pid_str() + " " + str(self.data_bytes) + return super(DataPacket, self).__str__() + ": RX DataPacket: " + super(DataPacket, self).get_pid_str() + " " + str(self.data_bytes) class TxDataPacket(DataPacket, TxPacket): def __init__(self, **kwargs): super(TxDataPacket, self).__init__(**kwargs) - #self.inter_pkt_gap = kwargs.pop('inter_pkt_gap', 13) #13 lowest working for single issue loopback def __str__(self): - return super(DataPacket, self).__str__() + ": TX DataPacket: " + super(DataPacket, self).get_pid_str() + " " + str(self.data_bytes) + " Valid CRC: " + str(not self.bad_crc) + "RXE Assert: " + str(self.rxe_assert_time) + return super(DataPacket, self).__str__() + ": RX DataPacket: " + super(DataPacket, self).get_pid_str() + " " + str(self.data_bytes) + " Valid CRC: " + str(not self.bad_crc) + "RXE Assert: " + str(self.rxe_assert_time) #Always TX class TokenPacket(TxPacket): From 2c9f356a8ff0ffde79de06e8dae3933b43a41ff6 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 14 Apr 2021 11:42:57 +0100 Subject: [PATCH 236/520] Fixes to test_control_basic_set --- tests/test_control_basic_set.py | 49 ++++++++++++++++----------------- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/tests/test_control_basic_set.py b/tests/test_control_basic_set.py index f4f664c4..72cbe8ba 100644 --- a/tests/test_control_basic_set.py +++ b/tests/test_control_basic_set.py @@ -1,37 +1,34 @@ #!/usr/bin/env python - -import random import xmostest -from usb_packet import * -import usb_packet -from usb_clock import Clock -from helpers import do_usb_test, runall_rx +from usb_packet import TokenPacket, TxDataPacket, RxDataPacket, TxHandshakePacket, RxHandshakePacket, USB_PID +from helpers import do_usb_test, RunUsbTest +from usb_session import UsbSession +from usb_transaction import UsbTransaction -def do_test(arch, tx_clk, tx_phy, data_valid_count, usb_speed, seed): - rand = random.Random() - rand.seed(seed) +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ep = 0 - address = 1 - - packets = [] + address = 1 - AppendSetupToken(packets, ep, address, data_valid_count=data_valid_count) - packets.append(TxDataPacket(rand, data_valid_count=data_valid_count, length=8, pid=3)) - packets.append(RxHandshakePacket(data_valid_count=data_valid_count, timeout=11)) + session = UsbSession(bus_speed=usb_speed, run_enumeration=False, device_address=address) - # Note, quite big gap to avoid NAL - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap = 10000) - packets.append(TxDataPacket(rand, data_valid_count=data_valid_count, length=10, pid=0xb, data_start_val=8)) - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) + # SETUP transaction + session.add_event(TokenPacket(pid=USB_PID['SETUP'], address=address, endpoint=ep, data_valid_count=data_valid_count)) + session.add_event(TxDataPacket(dataPayload=session.getPayload_out(ep, 8), data_valid_count=data_valid_count, pid=USB_PID["DATA0"])) + session.add_event(RxHandshakePacket(data_valid_count=data_valid_count)) - #Expect 0-length - AppendInToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap = 10000) - packets.append(RxDataPacket(rand, data_valid_count=data_valid_count, length=0, pid=0xb)) - packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) + # OUT transaction + # Note, quite big gap to avoid nak + session.add_event(TokenPacket(pid=USB_PID['OUT'], address=address, endpoint=ep, data_valid_count=data_valid_count, interEventDelay=10000)) + session.add_event(TxDataPacket(dataPayload=session.getPayload_out(ep, 10), data_valid_count=data_valid_count, pid=USB_PID["DATA1"])) + session.add_event(RxHandshakePacket(data_valid_count=data_valid_count)) + + # Expect 0 length IN transaction + session.add_event(TokenPacket(pid=USB_PID['IN'], address=address, endpoint=ep, data_valid_count=data_valid_count)) + session.add_event(RxDataPacket(dataPayload=[], valid_count=data_valid_count, pid=USB_PID['DATA1'])) + session.add_event(TxHandshakePacket(data_valid_count=data_valid_count)) - do_usb_test(arch, tx_clk, tx_phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[]) def runtest(): - random.seed(1) - runall_rx(do_test) + RunUsbTest(do_test) From 815df0a9ee012fba2fae9d80e2d49edf1c2946b4 Mon Sep 17 00:00:00 2001 From: mbanth Date: Wed, 14 Apr 2021 15:20:56 +0100 Subject: [PATCH 237/520] Change the makefile contents to match the template provided in lib_i2c issue 71. Remove extra arguments from the call to XUD_Main(). --- examples/AN00124_CDC_VCOM_class/Makefile | 43 +++++++------------ examples/AN00124_CDC_VCOM_class/src/main.xc | 2 +- examples/AN00125_mass_storage_class/Makefile | 42 +++++++----------- .../AN00125_mass_storage_class/src/main.xc | 2 +- examples/AN00126_printer_class/Makefile | 42 +++++++----------- examples/AN00126_printer_class/src/main.xc | 2 +- examples/AN00127_video_class/Makefile | 42 +++++++----------- examples/AN00127_video_class/src/main.xc | 2 +- examples/AN00131_CDC_EDC_class/Makefile | 42 +++++++----------- examples/AN00131_CDC_EDC_class/src/main.xc | 2 +- examples/AN00132_image_class/Makefile | 42 +++++++----------- examples/AN00132_image_class/src/main.xc | 2 +- .../Makefile | 42 +++++++----------- .../src/main.xc | 2 +- examples/AN00136_vendor_specific/Makefile | 42 +++++++----------- examples/AN00136_vendor_specific/src/main.xc | 2 +- 16 files changed, 128 insertions(+), 225 deletions(-) diff --git a/examples/AN00124_CDC_VCOM_class/Makefile b/examples/AN00124_CDC_VCOM_class/Makefile index 6bc91708..42e269e1 100644 --- a/examples/AN00124_CDC_VCOM_class/Makefile +++ b/examples/AN00124_CDC_VCOM_class/Makefile @@ -1,14 +1,8 @@ -BUILD_FLAGS = -O3 -report -g - -XCOREAI ?= 0 -ifeq ($(XCOREAI),1) -# Xcore.ai Builds -# Use `xmake XCOREAI=1` +# The APP_NAME variable determines the name of the final .xe file. It should +# not include the .xe postfix. If left blank the name will default to +# the project name -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. -TARGET = XCORE-AI-EXPLORER +APP_NAME = app_usb_cdc_demo # The flags passed to xcc when building the application # You can also set the following to override flags for a particular language: @@ -17,29 +11,24 @@ TARGET = XCORE-AI-EXPLORER # # If the variable XCC_MAP_FLAGS is set it overrides the flags passed to # xcc for the final link (mapping) stage. + +BUILD_FLAGS = -O3 -g -report + +XCC_FLAGS_xcore200 = $(BUILD_FLAGS) -DXUD_SERIES_SUPPORT=XUD_X200_SERIES XCC_FLAGS_xcoreai = $(BUILD_FLAGS) +# The TARGET variable determines what target system the application is +# compiled for. It either refers to an XN file in the source directories +# or a valid argument for the --target option when compiling. + +ifeq ($(CONFIG),xcoreai) +TARGET = XCORE-AI-EXPLORER else -# Xcore-200 Builds -# Use `xmake` TARGET = XCORE-200-EXPLORER - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. -XCC_FLAGS_X200 = $(BUILD_FLAGS) -DXUD_SERIES_SUPPORT=XUD_X200_SERIES endif -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name -APP_NAME = app_usb_cdc_demo +# The USED_MODULES variable lists other module used by the application. -# The USED_MODULES variable lists other module used by the application. USED_MODULES = lib_xud #============================================================================= @@ -48,5 +37,3 @@ USED_MODULES = lib_xud XMOS_MAKE_PATH ?= ../.. include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common - - diff --git a/examples/AN00124_CDC_VCOM_class/src/main.xc b/examples/AN00124_CDC_VCOM_class/src/main.xc index 2f12c590..993291e5 100644 --- a/examples/AN00124_CDC_VCOM_class/src/main.xc +++ b/examples/AN00124_CDC_VCOM_class/src/main.xc @@ -36,7 +36,7 @@ int main() { { on USB_TILE: XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, - null, null, -1 , XUD_SPEED_HS, XUD_PWR_BUS); + XUD_SPEED_HS, XUD_PWR_BUS); on USB_TILE: Endpoint0(c_ep_out[0], c_ep_in[0]); diff --git a/examples/AN00125_mass_storage_class/Makefile b/examples/AN00125_mass_storage_class/Makefile index 7a451609..35f5d7ef 100644 --- a/examples/AN00125_mass_storage_class/Makefile +++ b/examples/AN00125_mass_storage_class/Makefile @@ -1,14 +1,8 @@ -BUILD_FLAGS = -O3 -report -DUSE_XSCOPE=1 -fxscope -lflash - -XCOREAI ?= 0 -ifeq ($(XCOREAI),1) -# Xcore.ai Builds -# Use `xmake XCOREAI=1` +# The APP_NAME variable determines the name of the final .xe file. It should +# not include the .xe postfix. If left blank the name will default to +# the project name -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling -TARGET = XCORE-AI-EXPLORER +APP_NAME = app_mass_storage_demo # The flags passed to xcc when building the application # You can also set the following to override flags for a particular language: @@ -17,29 +11,24 @@ TARGET = XCORE-AI-EXPLORER # # If the variable XCC_MAP_FLAGS is set it overrides the flags passed to # xcc for the final link (mapping) stage. + +BUILD_FLAGS = -O3 -report -DUSE_XSCOPE=1 -fxscope -lflash + +XCC_FLAGS_xcore200 = $(BUILD_FLAGS) -DXUD_SERIES_SUPPORT=XUD_X200_SERIES XCC_FLAGS_xcoreai = $(BUILD_FLAGS) +# The TARGET variable determines what target system the application is +# compiled for. It either refers to an XN file in the source directories +# or a valid argument for the --target option when compiling. + +ifeq ($(CONFIG),xcoreai) +TARGET = XCORE-AI-EXPLORER else -# Xcore-200 Builds -# Use `xmake` TARGET = XCORE-200-EXPLORER - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. -XCC_FLAGS_X200 = $(BUILD_FLAGS) -DXUD_SERIES_SUPPORT=XUD_X200_SERIES endif -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name -APP_NAME = app_mass_storage_demo +# The USED_MODULES variable lists other module used by the application. -# The USED_MODULES variable lists other module used by the application. USED_MODULES = lib_xud lib_logging(>=2.0.0) lib_xassert(>=3.0.0) #============================================================================= @@ -49,4 +38,3 @@ USED_MODULES = lib_xud lib_logging(>=2.0.0) lib_xassert(>=3.0.0) XMOS_MAKE_PATH ?= ../.. include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common - diff --git a/examples/AN00125_mass_storage_class/src/main.xc b/examples/AN00125_mass_storage_class/src/main.xc index 5503412c..c4e425f3 100644 --- a/examples/AN00125_mass_storage_class/src/main.xc +++ b/examples/AN00125_mass_storage_class/src/main.xc @@ -36,7 +36,7 @@ int main() { on USB_TILE: XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, - null, null, -1 , XUD_SPEED_HS, XUD_PWR_BUS); + XUD_SPEED_HS, XUD_PWR_BUS); on USB_TILE: Endpoint0(c_ep_out[0], c_ep_in[0]); diff --git a/examples/AN00126_printer_class/Makefile b/examples/AN00126_printer_class/Makefile index a5802025..271b2ad9 100644 --- a/examples/AN00126_printer_class/Makefile +++ b/examples/AN00126_printer_class/Makefile @@ -1,14 +1,8 @@ -BUILD_FLAGS = -O3 -report -DUSE_XSCOPE=1 -fxscope - -XCOREAI ?= 0 -ifeq ($(XCOREAI),1) -# Xcore.ai Builds -# Use `xmake XCOREAI=1` +# The APP_NAME variable determines the name of the final .xe file. It should +# not include the .xe postfix. If left blank the name will default to +# the project name -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling -TARGET = XCORE-AI-EXPLORER +APP_NAME = app_printer_demo # The flags passed to xcc when building the application # You can also set the following to override flags for a particular language: @@ -17,29 +11,24 @@ TARGET = XCORE-AI-EXPLORER # # If the variable XCC_MAP_FLAGS is set it overrides the flags passed to # xcc for the final link (mapping) stage. + +BUILD_FLAGS = -O3 -report -DUSE_XSCOPE=1 -fxscope + +XCC_FLAGS_xcore200 = $(BUILD_FLAGS) -DXUD_SERIES_SUPPORT=XUD_X200_SERIES XCC_FLAGS_xcoreai = $(BUILD_FLAGS) +# The TARGET variable determines what target system the application is +# compiled for. It either refers to an XN file in the source directories +# or a valid argument for the --target option when compiling. + +ifeq ($(CONFIG),xcoreai) +TARGET = XCORE-AI-EXPLORER else -# Xcore-200 Builds -# Use `xmake` TARGET = XCORE-200-EXPLORER - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. -XCC_FLAGS_X200 = $(BUILD_FLAGS) -DXUD_SERIES_SUPPORT=XUD_X200_SERIES endif -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name -APP_NAME = app_printer_demo +# The USED_MODULES variable lists other module used by the application. -# The USED_MODULES variable lists other module used by the application. USED_MODULES = lib_xud lib_logging #============================================================================= @@ -49,4 +38,3 @@ USED_MODULES = lib_xud lib_logging XMOS_MAKE_PATH ?= ../.. include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common - diff --git a/examples/AN00126_printer_class/src/main.xc b/examples/AN00126_printer_class/src/main.xc index 8cf06802..0ecedeb4 100644 --- a/examples/AN00126_printer_class/src/main.xc +++ b/examples/AN00126_printer_class/src/main.xc @@ -84,7 +84,7 @@ int main() { on USB_TILE: XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, - null, null, -1 , XUD_SPEED_HS, XUD_PWR_BUS); + XUD_SPEED_HS, XUD_PWR_BUS); on USB_TILE: Endpoint0(c_ep_out[0], c_ep_in[0]); diff --git a/examples/AN00127_video_class/Makefile b/examples/AN00127_video_class/Makefile index 1252d2f2..c5f24dc4 100644 --- a/examples/AN00127_video_class/Makefile +++ b/examples/AN00127_video_class/Makefile @@ -1,14 +1,8 @@ -BUILD_FLAGS = -O3 -report - -XCOREAI ?= 0 -ifeq ($(XCOREAI),1) -# Xcore.ai Builds -# Use `xmake XCOREAI=1` +# The APP_NAME variable determines the name of the final .xe file. It should +# not include the .xe postfix. If left blank the name will default to +# the project name -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling -TARGET = XCORE-AI-EXPLORER +APP_NAME = app_video_demo # The flags passed to xcc when building the application # You can also set the following to override flags for a particular language: @@ -17,29 +11,24 @@ TARGET = XCORE-AI-EXPLORER # # If the variable XCC_MAP_FLAGS is set it overrides the flags passed to # xcc for the final link (mapping) stage. + +BUILD_FLAGS = -O3 -report + +XCC_FLAGS_xcore200 = $(BUILD_FLAGS) -DXUD_SERIES_SUPPORT=XUD_X200_SERIES XCC_FLAGS_xcoreai = $(BUILD_FLAGS) +# The TARGET variable determines what target system the application is +# compiled for. It either refers to an XN file in the source directories +# or a valid argument for the --target option when compiling. + +ifeq ($(CONFIG),xcoreai) +TARGET = XCORE-AI-EXPLORER else -# Xcore-200 Builds -# Use `xmake` TARGET = XCORE-200-EXPLORER - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. -XCC_FLAGS_X200 = $(BUILD_FLAGS) -DXUD_SERIES_SUPPORT=XUD_X200_SERIES endif -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name -APP_NAME = app_video_demo +# The USED_MODULES variable lists other module used by the application. -# The USED_MODULES variable lists other module used by the application. USED_MODULES = lib_xud lib_logging #============================================================================= @@ -49,4 +38,3 @@ USED_MODULES = lib_xud lib_logging XMOS_MAKE_PATH ?= ../.. include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common - diff --git a/examples/AN00127_video_class/src/main.xc b/examples/AN00127_video_class/src/main.xc index cd78905f..0a5eed46 100644 --- a/examples/AN00127_video_class/src/main.xc +++ b/examples/AN00127_video_class/src/main.xc @@ -37,7 +37,7 @@ int main() { { on USB_TILE: XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, - null, null, -1 , XUD_SPEED_HS, XUD_PWR_BUS); + XUD_SPEED_HS, XUD_PWR_BUS); on USB_TILE: Endpoint0(c_ep_out[0], c_ep_in[0]); diff --git a/examples/AN00131_CDC_EDC_class/Makefile b/examples/AN00131_CDC_EDC_class/Makefile index 3aed9b62..d7c0b808 100644 --- a/examples/AN00131_CDC_EDC_class/Makefile +++ b/examples/AN00131_CDC_EDC_class/Makefile @@ -1,14 +1,8 @@ -BUILD_FLAGS = -Wall -O3 -report -DUSE_XSCOPE=1 -fxscope - -XCOREAI ?= 0 -ifeq ($(XCOREAI),1) -# Xcore.ai Builds -# Use `xmake XCOREAI=1` +# The APP_NAME variable determines the name of the final .xe file. It should +# not include the .xe postfix. If left blank the name will default to +# the project name -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling -TARGET = XCORE-AI-EXPLORER +APP_NAME = app_cdc_edc_demo # The flags passed to xcc when building the application # You can also set the following to override flags for a particular language: @@ -17,29 +11,24 @@ TARGET = XCORE-AI-EXPLORER # # If the variable XCC_MAP_FLAGS is set it overrides the flags passed to # xcc for the final link (mapping) stage. + +BUILD_FLAGS = -Wall -O3 -report -DUSE_XSCOPE=1 -fxscope + +XCC_FLAGS_xcore200 = $(BUILD_FLAGS) -DXUD_SERIES_SUPPORT=XUD_X200_SERIES XCC_FLAGS_xcoreai = $(BUILD_FLAGS) +# The TARGET variable determines what target system the application is +# compiled for. It either refers to an XN file in the source directories +# or a valid argument for the --target option when compiling. + +ifeq ($(CONFIG),xcoreai) +TARGET = XCORE-AI-EXPLORER else -# Xcore-200 Builds -# Use `xmake` TARGET = XCORE-200-EXPLORER - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. -XCC_FLAGS_X200 = $(BUILD_FLAGS) -DXUD_SERIES_SUPPORT=XUD_X200_SERIES endif -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name -APP_NAME = app_cdc_edc_demo +# The USED_MODULES variable lists other module used by the application. -# The USED_MODULES variable lists other module used by the application. USED_MODULES = lib_xud #============================================================================= @@ -49,4 +38,3 @@ USED_MODULES = lib_xud XMOS_MAKE_PATH ?= ../.. include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common - diff --git a/examples/AN00131_CDC_EDC_class/src/main.xc b/examples/AN00131_CDC_EDC_class/src/main.xc index 325fb689..c06fd8dc 100644 --- a/examples/AN00131_CDC_EDC_class/src/main.xc +++ b/examples/AN00131_CDC_EDC_class/src/main.xc @@ -35,7 +35,7 @@ int main() { { on USB_TILE: XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, - null, null, -1 , XUD_SPEED_HS, XUD_PWR_BUS); + XUD_SPEED_HS, XUD_PWR_BUS); on USB_TILE: Endpoint0(c_ep_out[0], c_ep_in[0]); diff --git a/examples/AN00132_image_class/Makefile b/examples/AN00132_image_class/Makefile index 324f5609..dc2fd25a 100644 --- a/examples/AN00132_image_class/Makefile +++ b/examples/AN00132_image_class/Makefile @@ -1,14 +1,8 @@ -BUILD_FLAGS = -O3 -report - -XCOREAI ?= 0 -ifeq ($(XCOREAI),1) -# Xcore.ai Builds -# Use `xmake XCOREAI=1` +# The APP_NAME variable determines the name of the final .xe file. It should +# not include the .xe postfix. If left blank the name will default to +# the project name -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling -TARGET = XCORE-AI-EXPLORER +APP_NAME = app_usb_image_demo # The flags passed to xcc when building the application # You can also set the following to override flags for a particular language: @@ -17,29 +11,24 @@ TARGET = XCORE-AI-EXPLORER # # If the variable XCC_MAP_FLAGS is set it overrides the flags passed to # xcc for the final link (mapping) stage. + +BUILD_FLAGS = -O3 -report + +XCC_FLAGS_xcore200 = $(BUILD_FLAGS) -DXUD_SERIES_SUPPORT=XUD_X200_SERIES XCC_FLAGS_xcoreai = $(BUILD_FLAGS) +# The TARGET variable determines what target system the application is +# compiled for. It either refers to an XN file in the source directories +# or a valid argument for the --target option when compiling. + +ifeq ($(CONFIG),xcoreai) +TARGET = XCORE-AI-EXPLORER else -# Xcore-200 Builds -# Use `xmake` TARGET = XCORE-200-EXPLORER - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. -XCC_FLAGS_X200 = $(BUILD_FLAGS) -DXUD_SERIES_SUPPORT=XUD_X200_SERIES endif -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name -APP_NAME = app_usb_image_demo +# The USED_MODULES variable lists other module used by the application. -# The USED_MODULES variable lists other module used by the application. USED_MODULES = lib_xud SOURCE_DIRS = src @@ -51,4 +40,3 @@ SOURCE_DIRS = src XMOS_MAKE_PATH ?= ../.. include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common - diff --git a/examples/AN00132_image_class/src/main.xc b/examples/AN00132_image_class/src/main.xc index 2d78b957..00704a51 100644 --- a/examples/AN00132_image_class/src/main.xc +++ b/examples/AN00132_image_class/src/main.xc @@ -166,7 +166,7 @@ int main() { on USB_TILE: XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, - null, null, -1 , XUD_SPEED_HS, XUD_PWR_BUS); + XUD_SPEED_HS, XUD_PWR_BUS); on USB_TILE: Endpoint0(c_ep_out[0], c_ep_in[0]); diff --git a/examples/AN00135_test_and_measurement_class/Makefile b/examples/AN00135_test_and_measurement_class/Makefile index b4d169e3..65052e14 100644 --- a/examples/AN00135_test_and_measurement_class/Makefile +++ b/examples/AN00135_test_and_measurement_class/Makefile @@ -1,14 +1,8 @@ -BUILD_FLAGS = -O3 -report - -XCOREAI ?= 0 -ifeq ($(XCOREAI),1) -# Xcore.ai Builds -# Use `xmake XCOREAI=1` +# The APP_NAME variable determines the name of the final .xe file. It should +# not include the .xe postfix. If left blank the name will default to +# the project name -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling -TARGET = XCORE-AI-EXPLORER +APP_NAME = app_test_and_measurement # The flags passed to xcc when building the application # You can also set the following to override flags for a particular language: @@ -17,29 +11,24 @@ TARGET = XCORE-AI-EXPLORER # # If the variable XCC_MAP_FLAGS is set it overrides the flags passed to # xcc for the final link (mapping) stage. + +BUILD_FLAGS = -O3 -report + +XCC_FLAGS_xcore200 = $(BUILD_FLAGS) -DXUD_SERIES_SUPPORT=XUD_X200_SERIES XCC_FLAGS_xcoreai = $(BUILD_FLAGS) +# The TARGET variable determines what target system the application is +# compiled for. It either refers to an XN file in the source directories +# or a valid argument for the --target option when compiling. + +ifeq ($(CONFIG),xcoreai) +TARGET = XCORE-AI-EXPLORER else -# Xcore-200 Builds -# Use `xmake` TARGET = XCORE-200-EXPLORER - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. -XCC_FLAGS_X200 = $(BUILD_FLAGS) -DXUD_SERIES_SUPPORT=XUD_X200_SERIES endif -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name -APP_NAME = app_test_and_measurement +# The USED_MODULES variable lists other module used by the application. -# The USED_MODULES variable lists other module used by the application. USED_MODULES = lib_xud lib_logging #============================================================================= @@ -49,4 +38,3 @@ USED_MODULES = lib_xud lib_logging XMOS_MAKE_PATH ?= ../.. include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common - diff --git a/examples/AN00135_test_and_measurement_class/src/main.xc b/examples/AN00135_test_and_measurement_class/src/main.xc index 61b2c849..ef520060 100644 --- a/examples/AN00135_test_and_measurement_class/src/main.xc +++ b/examples/AN00135_test_and_measurement_class/src/main.xc @@ -28,7 +28,7 @@ int main() { on USB_TILE: XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, - null, null, -1 , XUD_SPEED_HS, XUD_PWR_BUS); + XUD_SPEED_HS, XUD_PWR_BUS); on USB_TILE: Endpoint0(c_ep_out[0], c_ep_in[0]); diff --git a/examples/AN00136_vendor_specific/Makefile b/examples/AN00136_vendor_specific/Makefile index 7e12bc04..896f389f 100644 --- a/examples/AN00136_vendor_specific/Makefile +++ b/examples/AN00136_vendor_specific/Makefile @@ -1,14 +1,8 @@ -BUILD_FLAGS = -O3 -report - -XCOREAI ?= 0 -ifeq ($(XCOREAI),1) -# Xcore.ai Builds -# Use `xmake XCOREAI=1` +# The APP_NAME variable determines the name of the final .xe file. It should +# not include the .xe postfix. If left blank the name will default to +# the project name -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling -TARGET = XCORE-AI-EXPLORER +APP_NAME = app_vendor_specific_demo # The flags passed to xcc when building the application # You can also set the following to override flags for a particular language: @@ -17,29 +11,24 @@ TARGET = XCORE-AI-EXPLORER # # If the variable XCC_MAP_FLAGS is set it overrides the flags passed to # xcc for the final link (mapping) stage. + +BUILD_FLAGS = -O3 -report + +XCC_FLAGS_xcore200 = $(BUILD_FLAGS) -DXUD_SERIES_SUPPORT=XUD_X200_SERIES XCC_FLAGS_xcoreai = $(BUILD_FLAGS) +# The TARGET variable determines what target system the application is +# compiled for. It either refers to an XN file in the source directories +# or a valid argument for the --target option when compiling. + +ifeq ($(CONFIG),xcoreai) +TARGET = XCORE-AI-EXPLORER else -# Xcore-200 Builds -# Use `xmake` TARGET = XCORE-200-EXPLORER - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. -XCC_FLAGS_X200 = $(BUILD_FLAGS) -DXUD_SERIES_SUPPORT=XUD_X200_SERIES endif -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name -APP_NAME = app_vendor_specific_demo +# The USED_MODULES variable lists other module used by the application. -# The USED_MODULES variable lists other module used by the application. USED_MODULES = lib_xud SOURCE_DIRS = src @@ -52,4 +41,3 @@ INCLUDE_DIRS = src XMOS_MAKE_PATH ?= ../.. include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common - diff --git a/examples/AN00136_vendor_specific/src/main.xc b/examples/AN00136_vendor_specific/src/main.xc index 2a79249a..1d70c7dd 100644 --- a/examples/AN00136_vendor_specific/src/main.xc +++ b/examples/AN00136_vendor_specific/src/main.xc @@ -92,7 +92,7 @@ int main() { on USB_TILE: XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, - null, null, -1 , XUD_SPEED_HS, XUD_PWR_BUS); + XUD_SPEED_HS, XUD_PWR_BUS); on USB_TILE: Endpoint0(c_ep_out[0], c_ep_in[0]); From 5c72646444240f5a3bd86d4338674011f22487d9 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 14 Apr 2021 18:59:46 +0100 Subject: [PATCH 238/520] Fixes for invalid token and iso loopback tests --- tests/test_invalidtoken.py | 106 +++++++++---------------------------- tests/test_iso_loopback.py | 61 +++++++-------------- tests/usb_packet.py | 18 ++++--- tests/usb_session.py | 4 +- tests/usb_transaction.py | 21 +++++--- 5 files changed, 71 insertions(+), 139 deletions(-) diff --git a/tests/test_invalidtoken.py b/tests/test_invalidtoken.py index a9445905..392566fb 100644 --- a/tests/test_invalidtoken.py +++ b/tests/test_invalidtoken.py @@ -1,101 +1,47 @@ #!/usr/bin/env python - -# Same as simple RX bulk test but some invalid tokens also included - -import random import xmostest -from usb_packet import * -from usb_clock import Clock -from helpers import do_usb_test, runall_rx +from usb_packet import TokenPacket, TxDataPacket, RxDataPacket, TxHandshakePacket, RxHandshakePacket, USB_PID +from helpers import do_usb_test, RunUsbTest +from usb_session import UsbSession +from usb_transaction import UsbTransaction +# Same as simple RX bulk test but some invalid tokens also included -# Single, setup transaction to EP 0 - -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): - rand = random.Random() - rand.seed(seed) +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): address = 1 ep = 1 - # The inter-frame gap is to give the DUT time to print its output - packets = [] - - dataval = 0; - - # Reserved PID - packets.append(TokenPacket( - data_valid_count=data_valid_count, - inter_pkt_gap=2000, - pid=0x0, - address=address, - endpoint=ep)) + session = UsbSession(bus_speed=usb_speed, run_enumeration=False, device_address=address) + + # Reserved/Invalid PID + session.add_event(TokenPacket(pid=USB_PID['RESERVED'], address=address, endpoint=ep, data_valid_count=data_valid_count)) - # Valid IN but not for us.. - packets.append(TokenPacket( - data_valid_count=data_valid_count, - inter_pkt_gap=200, - pid=0x69, - address=address+1, - endpoint=ep, - valid=False)) #Note, the valid is the valid flag for xs2 + # Valid IN but not for DUT + session.add_event(TokenPacket(pid=USB_PID['IN'], address=address+1, endpoint=ep, data_valid_count=data_valid_count)) - # Valid OUT but not for us.. - packets.append(TokenPacket( - data_valid_count=data_valid_count, - inter_pkt_gap=200, - pid=0xe1, - address=address+1, - endpoint=ep, - valid=False)) + # Valid OUT but not for DUT + session.add_event(TokenPacket(pid=USB_PID['OUT'], address=address+1, endpoint=ep, data_valid_count=data_valid_count)) - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=10, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) + # Valid OUT transaction + session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=10)) # Valid SETUP but not for us.. - packets.append(TokenPacket( - data_valid_count=data_valid_count, - inter_pkt_gap=200, - pid=0x2d, - address=address+2, - endpoint=ep, - valid=False)) + session.add_event(TokenPacket(pid=USB_PID['SETUP'], address=address+2, endpoint=ep, data_valid_count=data_valid_count)) + # Valid OUT transaction # Note, quite big gap to allow checking. - - dataval += 10 - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=11, pid=0xb)) #DATA1 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) + session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=11, interEventDelay=6000)) # Valid PING but not for us.. - packets.append(TokenPacket( - data_valid_count=data_valid_count, - inter_pkt_gap=200, - pid=0xb4, - address=address+3, - endpoint=ep, - valid=False)) - - dataval += 11 - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=12, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - - dataval += 12 - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=13, pid=0xb)) #DATA1 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - - dataval += 13 - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=14, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) + session.add_event(TokenPacket(pid=USB_PID['PING'], address=address+2, endpoint=ep, data_valid_count=data_valid_count)) + # Finish with some valid transactions + session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=12, interEventDelay=6000)) + session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=13, interEventDelay=6000)) + session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=14, interEventDelay=6000)) - do_usb_test(arch, clk, phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[]) def runtest(): - random.seed(1) - runall_rx(do_test) + RunUsbTest(do_test) diff --git a/tests/test_iso_loopback.py b/tests/test_iso_loopback.py index bdc6782f..8b275df8 100644 --- a/tests/test_iso_loopback.py +++ b/tests/test_iso_loopback.py @@ -1,58 +1,37 @@ #!/usr/bin/env python - -import random import xmostest from usb_packet import * -from usb_clock import Clock -from helpers import do_usb_test, runall_rx - -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): - - rand = random.Random() - rand.seed(seed) +import usb_packet +from helpers import do_usb_test, RunUsbTest +from usb_session import UsbSession +from usb_transaction import UsbTransaction - address = 1 +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ep_loopback = 3 ep_loopback_kill = 2 + address = 1 + start_length = 200 + end_length = 203 + session = UsbSession(bus_speed = usb_speed, run_enumeration = False, device_address = address) - # The inter-frame gap is to give the DUT time to print its output - packets = [] - - dataval = 0; - data_pid = 0x3 #DATA0 - - ipg = 6000 + # TODO randomise packet lengths and data + for pktLength in range(start_length, end_length+1): + session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep_loopback, endpointType="ISO", direction= "OUT", dataLength=pktLength)) - for pkt_length in range(200, 204): - - AppendOutToken(packets, ep_loopback, address, data_valid_count=data_valid_count) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) #DATA0 - - #XXwas min IPG supported on iso loopback to not nak - #This was 420, had to increase when moved to lib_xud (14.1.2 tools) + # Was min IPG supported on iso loopback to not nak + # This was 420, had to increase when moved to lib_xud (14.1.2 tools) # increased again from 437 when SETUP/OUT checking added # increaed from 477 when adding xs3 - AppendInToken(packets, ep_loopback, address, data_valid_count=data_valid_count, inter_pkt_gap=498) - packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) #DATA0 + session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep_loopback, endpointType="ISO", direction= "IN", dataLength=pktLength, interEventDelay=498)) - #No toggle for Iso - - pkt_length = 10 + pktLength = 10 #Loopback and die.. - AppendOutToken(packets, ep_loopback_kill, address, data_valid_count=data_valid_count) - packets.append(TxDataPacket(rand, data_valid_count=data_valid_count, length=pkt_length, pid=3)) #DATA0 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - - AppendInToken(packets, ep_loopback_kill, address, data_valid_count=data_valid_count, inter_pkt_gap=ipg) - packets.append(RxDataPacket(rand, data_valid_count=data_valid_count, length=pkt_length, pid=3)) #DATA0 - packets.append(TxHandshakePacket(data_valid_count=data_valid_count)) - + session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep_loopback_kill, endpointType="BULK", direction= "OUT", dataLength=pktLength)) + session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep_loopback_kill, endpointType="BULK", direction= "IN", dataLength=pktLength)) - do_usb_test(arch, clk, phy, usb_speed, packets, __file__, seed, - level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) def runtest(): - random.seed(1) - runall_rx(do_test) + RunUsbTest(do_test) diff --git a/tests/usb_packet.py b/tests/usb_packet.py index 1cc34ee0..5e507389 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -68,15 +68,17 @@ RX_RX_DELAY = 40 #TODO shoud we have a PID class? +#TODO remove the inverted check bits USB_PID = { - "OUT": 0xE1, - "IN" : 0x69, - "SETUP" : 0x2D, - "PING" : 0xA5, - "DATA1" : 0x4b, - "DATA0" : 0xc3, - "SOF" : 165, - "ACK" : 0xD2 + "OUT" : 0xE1, + "IN" : 0x69, + "SETUP" : 0x2D, + "SOF" : 0xA5, + "DATA1" : 0x4b, + "DATA0" : 0xc3, + "ACK" : 0xD2, + "PING" : 0xB4, + "RESERVED" : 0x0F, } #def AppendSetupToken(packets, ep, address, **kwargs): diff --git a/tests/usb_session.py b/tests/usb_session.py index 3c1ad57d..3510ce72 100644 --- a/tests/usb_session.py +++ b/tests/usb_session.py @@ -47,13 +47,13 @@ def data_valid_count(self): return USB_DATA_VALID_COUNT[self._bus_speed] def getPayload_out(self, n, length, resend = False): - payload = [x for x in range(self._dataGen_out[n], self._dataGen_out[n] + length)] + payload = [(x & 0xff) for x in range(self._dataGen_out[n], self._dataGen_out[n] + length)] if not resend: self._dataGen_out[n] += length return payload def getPayload_in(self, n, length, resend = False): - payload = [x for x in range(self._dataGen_in[n], self._dataGen_in[n] + length)] + payload = [(x & 0xff) for x in range(self._dataGen_in[n], self._dataGen_in[n] + length)] if not resend: self._dataGen_in[n] += length return payload diff --git a/tests/usb_transaction.py b/tests/usb_transaction.py index 984da6fe..c993c474 100644 --- a/tests/usb_transaction.py +++ b/tests/usb_transaction.py @@ -40,25 +40,24 @@ def __init__(self, session, deviceAddress = 0, endpointNumber = 0, endpointType endpoint = self._endpointNumber, data_valid_count = self.data_valid_count)) - # Don't toggle data pid if we had a bad data crc - if self._badDataCrc or self._rxeAssertDelay_data: + if self._badDataCrc or self._rxeAssertDelay_data or endpointType == "ISO": togglePid = False else: togglePid = True - if (not self._badDataCrc) and (not self._rxeAssertDelay_data) and deviceAddress == session.deviceAddress: + if (not self._badDataCrc) and (not self._rxeAssertDelay_data) and (deviceAddress == session.deviceAddress) and (self._endpointType != "ISO"): expectHandshake = True else: expectHandshake = False # Generate packet data payload - packetPayload = session.getPayload_out(endpointNumber, dataLength, resend = not expectHandshake); + packetPayload = session.getPayload_out(endpointNumber, dataLength, resend = False)#(not expectHandshake or not self._endpointType == "ISO")) pid = session.data_pid_out(endpointNumber, togglePid = togglePid) # Add data packet to packets list - packets.append(TxDataPacket(pid=pid, dataPayload = packetPayload, bad_crc=self._badDataCrc, rxe_assert_time=self._rxeAssertDelay_data)) + packets.append(TxDataPacket(pid=pid, dataPayload=packetPayload, bad_crc=self._badDataCrc, rxe_assert_time=self._rxeAssertDelay_data)) if expectHandshake: packets.append(RxHandshakePacket()) @@ -80,12 +79,18 @@ def __init__(self, session, deviceAddress = 0, endpointNumber = 0, endpointType # Generate packet data payload packetPayload = session.getPayload_in(endpointNumber, dataLength); - pid = session.data_pid_in(endpointNumber); + if self._badDataCrc or self._rxeAssertDelay_data or self._endpointType == "ISO": + togglePid = False + else: + togglePid = True + + pid = session.data_pid_in(endpointNumber, togglePid = togglePid); # Add data packet to packets list self._packets.append(RxDataPacket(pid=pid, dataPayload = packetPayload)) - - self._packets.append(TxHandshakePacket()) + + if self._endpointType != "ISO": + self._packets.append(TxHandshakePacket()) super(UsbTransaction, self).__init__(time = eventTime, interEventDelay = interEventDelay) From f16874b4baa84b0b881658aaadba857336f9cfb4 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 15 Apr 2021 13:25:24 +0100 Subject: [PATCH 239/520] Fixes to test_iso_rx_basic --- tests/test_iso_rx_basic.py | 38 ++++++++++++++------------------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/tests/test_iso_rx_basic.py b/tests/test_iso_rx_basic.py index 0e572183..d35806a4 100644 --- a/tests/test_iso_rx_basic.py +++ b/tests/test_iso_rx_basic.py @@ -1,34 +1,24 @@ #!/usr/bin/env python - -import random import xmostest -from usb_packet import * -#import * AppendSetupToken, TxDataPacket, RxDataPacket, TokenPacket, RxHandshakePacket, TxHandshakePacket -from usb_clock import Clock -from helpers import do_usb_test, runall_rx - -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): - rand = random.Random() - rand.seed(seed) +from helpers import do_usb_test, RunUsbTest +from usb_session import UsbSession +from usb_transaction import UsbTransaction +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): + ep = 2 address = 1 + start_length = 10 + end_length = 14 + + session = UsbSession(bus_speed=usb_speed, run_enumeration=False, device_address=address) - # The inter-frame gap is to give the DUT time to print its output - packets = [] - - dataval = 0; + for pktLength in range(10, end_length+1): + session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="ISO", direction= "OUT", dataLength=pktLength)) - # Note, quite big gap to allow checking. - pid = PID_DATA0; + do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) - for pktlength in range(10, 15): - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=500) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=pktlength, pid=pid)) - dataval += pktlength +def runtest(): + RunUsbTest(do_test) - do_usb_test(arch, clk, phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) -def runtest(): - random.seed(1) - runall_rx(do_test) From ee2696b18343e2ae9b5b3cedb27964f0672c1ad6 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 15 Apr 2021 13:56:42 +0100 Subject: [PATCH 240/520] Fixes to test_iso_rxtx_pastpacket --- tests/test_iso_rxtx_fastpacket.py | 39 ++++++++++++------------------- 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/tests/test_iso_rxtx_fastpacket.py b/tests/test_iso_rxtx_fastpacket.py index b051cc74..7b89af41 100644 --- a/tests/test_iso_rxtx_fastpacket.py +++ b/tests/test_iso_rxtx_fastpacket.py @@ -1,38 +1,29 @@ -#!/usr/bin/env python -import random +#!/usr/bin/env python import xmostest from usb_packet import * -from usb_clock import Clock -from helpers import do_usb_test, runall_rx +import usb_packet +from helpers import do_usb_test, RunUsbTest +from usb_session import UsbSession +from usb_transaction import UsbTransaction -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): - rand = random.Random() - rand.seed(seed) +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ep = 3 address = 1 + start_length = 10 + end_length = 19 - packets = [] - - data_val = 0; - pkt_length = 20 - data_pid = 0x3 #DATA0 + session = UsbSession(bus_speed = usb_speed, run_enumeration = False, device_address = address) - for pkt_length in range(10, 20): + for pktLength in range(start_length, end_length+1): # < 17 fails - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=20) - packets.append(TxDataPacket(rand, data_start_val=data_val, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) #DATA0 - - AppendInToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=58) - packets.append(RxDataPacket(rand, data_start_val=data_val, data_valid_count=data_valid_count, length=pkt_length, pid=data_pid)) - - data_val = data_val + pkt_length - #data_pid = data_pid ^ 8 + session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="ISO", direction= "OUT", dataLength=pktLength, interEventDelay=20)) + + session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="ISO", direction= "IN", dataLength=pktLength, interEventDelay=58)) - do_usb_test(arch, clk, phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) def runtest(): - random.seed(1) - runall_rx(do_test) + RunUsbTest(do_test) From cc9649f7a7f6ff163fc8f9f5cfd2c760be807bf3 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 15 Apr 2021 18:22:13 +0100 Subject: [PATCH 241/520] Fixes to test_iso_tx_basic --- tests/test_bulk_tx_basic.py | 2 +- tests/test_iso_tx_basic.py | 50 ++++++++++--------------------------- 2 files changed, 14 insertions(+), 38 deletions(-) diff --git a/tests/test_bulk_tx_basic.py b/tests/test_bulk_tx_basic.py index 71919a74..d3dcb07a 100644 --- a/tests/test_bulk_tx_basic.py +++ b/tests/test_bulk_tx_basic.py @@ -14,7 +14,7 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): session = UsbSession(bus_speed = usb_speed, run_enumeration = False, device_address = address) for pktLength in range(10, end_length+1): - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "IN", eventTime=10, dataLength=pktLength)) + session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "IN", dataLength=pktLength)) do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) diff --git a/tests/test_iso_tx_basic.py b/tests/test_iso_tx_basic.py index a3a9f23d..070c931e 100644 --- a/tests/test_iso_tx_basic.py +++ b/tests/test_iso_tx_basic.py @@ -1,47 +1,23 @@ -#!/usr/bin/env python -import random +#!/usr/bin/env python import xmostest -from usb_packet import * -from usb_clock import Clock -from helpers import do_usb_test, runall_rx - +from helpers import do_usb_test, RunUsbTest +from usb_session import UsbSession +from usb_transaction import UsbTransaction -# Single, setup transaction to EP 0 - -def do_test(arch, tx_clk, tx_phy, data_valid_count, usb_speed, seed): - rand = random.Random() - rand.seed(seed) +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ep = 3 address = 1 + start_length = 10 + end_length = 14 + + session = UsbSession(bus_speed = usb_speed, run_enumeration=False, device_address=address) - # The inter-frame gap is to give the DUT time to print its output - packets = [] - - dataval = 0; - - AppendInToken(packets, ep, address, data_valid_count=data_valid_count) - packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=10, pid=0x3)) #DATA0 - - dataval += 10 - AppendInToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=2000) - packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=11, pid=0x3)) #DATA0 - - dataval += 11 - AppendInToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=2000) - packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=12, pid=0x3)) #DATA0 - - dataval += 12 - AppendInToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=2000) - packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=13, pid=0x3)) #DATA0 - - dataval += 13 - AppendInToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=2000) - packets.append(RxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=14, pid=0x3)) #DATA0 + for pktLength in range(10, end_length+1): + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="ISO", direction= "IN", dataLength=pktLength)) - do_usb_test(arch, tx_clk, tx_phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) def runtest(): - random.seed(1) - runall_rx(do_test) + RunUsbTest(do_test) From f09f688c054bb28c632dbd257c5e5f82331350ab Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 15 Apr 2021 18:38:03 +0100 Subject: [PATCH 242/520] Fixes to test_ping_rx_basic --- tests/test_bulk_rx_basic.py | 4 +-- tests/test_ping_rx_basic.py | 63 +++++++++++++++---------------------- tests/usb_packet.py | 1 + 3 files changed, 29 insertions(+), 39 deletions(-) diff --git a/tests/test_bulk_rx_basic.py b/tests/test_bulk_rx_basic.py index a460d938..eabaaf47 100644 --- a/tests/test_bulk_rx_basic.py +++ b/tests/test_bulk_rx_basic.py @@ -13,10 +13,10 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): start_length = 10 end_length = 19 - session = UsbSession(bus_speed = usb_speed, run_enumeration = False, device_address = address) + session = UsbSession(bus_speed=usb_speed, run_enumeration=False, device_address = address) for pktLength in range(10, end_length+1): - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", eventTime=10, dataLength=pktLength)) + session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=pktLength)) do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) diff --git a/tests/test_ping_rx_basic.py b/tests/test_ping_rx_basic.py index e483283a..af7b78f9 100644 --- a/tests/test_ping_rx_basic.py +++ b/tests/test_ping_rx_basic.py @@ -2,65 +2,54 @@ # Basic check of PING functionality -import random import xmostest -from usb_packet import * -from usb_clock import Clock -from helpers import do_usb_test, runall_rx +from usb_packet import TokenPacket, TxDataPacket, RxDataPacket, TxHandshakePacket, RxHandshakePacket, USB_PID +from helpers import do_usb_test, RunUsbTest +from usb_session import UsbSession +from usb_transaction import UsbTransaction -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): - rand = random.Random() - rand.seed(seed) + +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): address = 1 ep = 1 - # The inter-frame gap is to give the DUT time to print its output - packets = [] - - dataval = 0; + session = UsbSession(bus_speed=usb_speed, run_enumeration=False, device_address=address) # Ping EP 2, expect NAK - AppendPingToken(packets, 2, address, data_valid_count=data_valid_count) - packets.append(RxHandshakePacket(data_valid_count=data_valid_count, pid=0x5a)) + session.add_event(TokenPacket(pid=USB_PID['PING'], address=address, endpoint=2, data_valid_count=data_valid_count)) + session.add_event(RxHandshakePacket(data_valid_count=data_valid_count, pid=USB_PID['NAK'])) # And again - AppendPingToken(packets, 2, address, data_valid_count=data_valid_count) - packets.append(RxHandshakePacket(data_valid_count=data_valid_count, pid=0x5a)) + session.add_event(TokenPacket(pid=USB_PID['PING'], address=address, endpoint=2, data_valid_count=data_valid_count)) + session.add_event(RxHandshakePacket(data_valid_count=data_valid_count, pid=USB_PID['NAK'])) # Send packet to EP 1, xCORE should mark EP 2 as ready - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=10, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) + session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction="OUT", dataLength=10)) # Ping EP 2 again - expect ACK - AppendPingToken(packets, 2, address, data_valid_count=data_valid_count, inter_pkt_gap=6000) - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) + session.add_event(TokenPacket(pid=USB_PID['PING'], address=address, endpoint=2, data_valid_count=data_valid_count, interEventDelay=6000)) + session.add_event(RxHandshakePacket(data_valid_count=data_valid_count, pid=USB_PID['ACK'])) # And again.. - AppendPingToken(packets, 2, address, data_valid_count=data_valid_count) - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) + session.add_event(TokenPacket(pid=USB_PID['PING'], address=address, endpoint=2, data_valid_count=data_valid_count, interEventDelay=6000)) + session.add_event(RxHandshakePacket(data_valid_count=data_valid_count, pid=USB_PID['ACK'])) # Send out to EP 2.. expect ack - AppendOutToken(packets, 2,address, data_valid_count=data_valid_count, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=10, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) + session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=2, endpointType="BULK", direction="OUT", dataLength=10, interEventDelay=6000)) # Re-Ping EP 2, expect NAK - AppendPingToken(packets, 2, address, data_valid_count=data_valid_count) - packets.append(RxHandshakePacket(data_valid_count=data_valid_count, pid=0x5a)) + session.add_event(TokenPacket(pid=USB_PID['PING'], address=address, endpoint=2, data_valid_count=data_valid_count)) + session.add_event(RxHandshakePacket(data_valid_count=data_valid_count, pid=USB_PID['NAK'])) # And again - AppendPingToken(packets, 2, address, data_valid_count=data_valid_count) - packets.append(RxHandshakePacket(data_valid_count=data_valid_count, pid=0x5a)) - - # Send a packet to EP 1 so the DUT knows it can exit. - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count) - packets.append(TxDataPacket(rand, data_start_val=dataval+10, data_valid_count=data_valid_count, length=10, pid=0x3^8)) #DATA1 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) + session.add_event(TokenPacket(pid=USB_PID['PING'], address=address, endpoint=2, data_valid_count=data_valid_count)) + session.add_event(RxHandshakePacket(data_valid_count=data_valid_count, pid=USB_PID['NAK'])) - do_usb_test(arch, clk, phy, usb_speed, packets, __file__, seed,level='smoke', extra_tasks=[]) + # Send a packet to EP 1 so the DUT knows it can exit. + session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction="OUT", dataLength=10)) + + do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[]) def runtest(): - random.seed(1) - runall_rx(do_test) + RunUsbTest(do_test) diff --git a/tests/usb_packet.py b/tests/usb_packet.py index 5e507389..5facccc3 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -79,6 +79,7 @@ "ACK" : 0xD2, "PING" : 0xB4, "RESERVED" : 0x0F, + "NAK" : 0x5A, } #def AppendSetupToken(packets, ep, address, **kwargs): From a0e3f7bb86f8b2284c45de14dda3816b4e0b00a4 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 15 Apr 2021 18:55:03 +0100 Subject: [PATCH 243/520] Fixes to test_shorttoken. Note, expected fail on XS3 --- tests/test_shorttoken.py | 41 ++++++++++++---------------------------- 1 file changed, 12 insertions(+), 29 deletions(-) diff --git a/tests/test_shorttoken.py b/tests/test_shorttoken.py index 04f445ca..e8a6e5ef 100644 --- a/tests/test_shorttoken.py +++ b/tests/test_shorttoken.py @@ -1,47 +1,30 @@ #!/usr/bin/env python - -# Same as simple RX bulk test but some invalid tokens also included - -import random import xmostest -from usb_packet import * -from usb_clock import Clock -from helpers import do_usb_test, runall_rx - +from usb_packet import TxPacket, USB_PID +from helpers import do_usb_test, RunUsbTest +from usb_session import UsbSession +from usb_transaction import UsbTransaction -# Single, setup transaction to EP 0 - -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): - rand = random.Random() - rand.seed(seed) +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): address = 1 ep = 1 - packets = [] - dataval = 0; - + session = UsbSession(bus_speed=usb_speed, run_enumeration=False, device_address = address) # Start with a valid transaction */ - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=10, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) + session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=10)) # tmp hack for xs2 - for xs2 the shim will throw away the short token and it will never be seen by the xCORE - if arch == 'xs3': # Create a short token, only PID and 2nd byte - shorttoken = TxPacket(pid=0xe1, data_bytes = [0x81], data_valid_count=data_valid_count, inter_pkt_gap=100) - packets.append(shorttoken) + shorttoken = TxPacket(pid=USB_PID["OUT"], data_bytes = [0x81], data_valid_count=data_valid_count, interEventDelay=100) + session.add_event(shorttoken) #Finish with valid transaction - dataval += 10 - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=11, pid=0xb)) #DATA1 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) + session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=11, interEventDelay=6000)) - do_usb_test(arch, clk, phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) + do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[]) def runtest(): - random.seed(1) - runall_rx(do_test) + RunUsbTest(do_test) From 57efd44b8a798c8bc0e8b068a5af63705baddc50 Mon Sep 17 00:00:00 2001 From: Michael Bruno Date: Thu, 15 Apr 2021 15:45:10 -0400 Subject: [PATCH 244/520] Issue STALL even when EP is marked ready If an OUT endpoint stalls and then subsequently waits for data, for example with XUD_GetBuffer(), the endpoint will continue to respond with STALL handshakes until the stall condition is cleared. --- lib_xud/src/core/included/XUD_Token_Out.S | 7 +++++++ lib_xud/src/core/included/XUD_Token_Out_DI.S | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/lib_xud/src/core/included/XUD_Token_Out.S b/lib_xud/src/core/included/XUD_Token_Out.S index 6f4a8d4a..bf6781fc 100755 --- a/lib_xud/src/core/included/XUD_Token_Out.S +++ b/lib_xud/src/core/included/XUD_Token_Out.S @@ -12,6 +12,13 @@ .skip 0 Pid_Out: #include "XUD_CrcAddrCheck.S" + + ldaw r11, dp[handshakeTable_OUT] // Load handshake table + ldw r11, r11[r10] + ldc r3, USB_PIDn_STALL + eq r3, r11, r3 + bt r3, XUD_TokenOut_BufferFull + ldw r3, r5[r10] // Load relevant EP pointer bf r3, XUD_TokenOut_BufferFull ldw r1, r3[3] // Load buffer from EP structure diff --git a/lib_xud/src/core/included/XUD_Token_Out_DI.S b/lib_xud/src/core/included/XUD_Token_Out_DI.S index 174cf392..5c5eac27 100755 --- a/lib_xud/src/core/included/XUD_Token_Out_DI.S +++ b/lib_xud/src/core/included/XUD_Token_Out_DI.S @@ -8,6 +8,13 @@ .skip 0 Pid_Out: #include "XUD_CrcAddrCheck.S" + + ldaw r11, dp[handshakeTable_OUT] // Load handshake table + {ldw r11, r11[r10] + ldc r3, USB_PIDn_STALL} + eq r3, r11, r3 + bt r3, XUD_TokenOut_BufferFull + ldw r3, r5[r10] // Load relevant EP pointer bf r3, XUD_TokenOut_BufferFull ldw r1, r3[3] // Load buffer from EP structure From 9049cf1e2d6e99c731de540de54bce29e4daf180 Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 16 Apr 2021 14:57:07 +0100 Subject: [PATCH 245/520] Fixed run issues with test_sof_badcrc (expected fail on xs3) --- tests/test_sof_badcrc.py | 64 +++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 33 deletions(-) diff --git a/tests/test_sof_badcrc.py b/tests/test_sof_badcrc.py index 9762700a..cb93cf60 100644 --- a/tests/test_sof_badcrc.py +++ b/tests/test_sof_badcrc.py @@ -1,46 +1,44 @@ #!/usr/bin/env python - -# Same as simple RX bulk test but some invalid tokens also included - -import random import xmostest from usb_packet import * -from usb_clock import Clock -from helpers import do_usb_test, runall_rx - - -# Single, setup transaction to EP 0 - -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): - rand = random.Random() - rand.seed(seed) - +import usb_packet +from helpers import do_usb_test, RunUsbTest +from usb_session import UsbSession +from usb_transaction import UsbTransaction + +# TODO ideally creation of SOF's is moved elsewhere +def CreateSofToken(frameNumber, data_valid_count, badCrc = False): + ep = (frameNumber >> 7) & 0xf + address = (frameNumber) & 0x7f + + if badCrc: + return TokenPacket(pid=USB_PID['SOF'], address=address, endpoint=ep, data_valid_count=data_valid_count, crc5=0xff) + else: + return TokenPacket(pid=USB_PID['SOF'], address=address, endpoint=ep, data_valid_count=data_valid_count) + + return sofToken + +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): + address = 1 ep = 1 - framenumber = 52 # Note, for frame number 52 we expect A5 34 40 on the bus + frameNumber = 52 # Note, for frame number 52 we expect A5 34 40 on the bus - packets = [] - dataval = 0; + session = UsbSession(bus_speed=usb_speed, run_enumeration=False, device_address = address) # Start with a valid transaction */ - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=10, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) + session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=10)) - AppendSofToken(packets, framenumber, data_valid_count=data_valid_count) - AppendSofToken(packets, framenumber+1, data_valid_count=data_valid_count) - AppendSofToken(packets, framenumber+2, data_valid_count=data_valid_count) - AppendSofToken(packets, framenumber+3, crc5=0xff, data_valid_count=data_valid_count) # Invalidate the CRC - AppendSofToken(packets, framenumber+4, data_valid_count=data_valid_count) + session.add_event(CreateSofToken(frameNumber, data_valid_count)) + session.add_event(CreateSofToken(frameNumber+1, data_valid_count)) + session.add_event(CreateSofToken(frameNumber+2, data_valid_count)) + session.add_event(CreateSofToken(frameNumber+3, data_valid_count, badCrc=True)) # Invalidate the CRC + session.add_event(CreateSofToken(frameNumber+4, data_valid_count)) #Finish with valid transaction - dataval += 10 - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=11, pid=0xb)) #DATA1 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - - do_usb_test(arch, clk, phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) + session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=11, interEventDelay=6000)) + + do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) def runtest(): - random.seed(1) - runall_rx(do_test) + RunUsbTest(do_test) From 6bcf78aad4c5191f9a9a35bc9297b81e90295909 Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 16 Apr 2021 15:28:13 +0100 Subject: [PATCH 246/520] Fixes to test_sof_basic --- tests/test_sof_basic.py | 65 ++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 33 deletions(-) diff --git a/tests/test_sof_basic.py b/tests/test_sof_basic.py index d7699515..16ab4302 100644 --- a/tests/test_sof_basic.py +++ b/tests/test_sof_basic.py @@ -1,46 +1,45 @@ #!/usr/bin/env python - -# Same as simple RX bulk test but some invalid tokens also included - -import random import xmostest from usb_packet import * -from usb_clock import Clock -from helpers import do_usb_test, runall_rx - - -# Single, setup transaction to EP 0 - -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed): - rand = random.Random() - rand.seed(seed) - +import usb_packet +from helpers import do_usb_test, RunUsbTest +from usb_session import UsbSession +from usb_transaction import UsbTransaction + +# TODO ideally creation of SOF's is moved elsewhere +def CreateSofToken(frameNumber, data_valid_count, badCrc = False): + ep = (frameNumber >> 7) & 0xf + address = (frameNumber) & 0x7f + + if badCrc: + return TokenPacket(pid=USB_PID['SOF'], address=address, endpoint=ep, data_valid_count=data_valid_count, crc5=0xff) + else: + return TokenPacket(pid=USB_PID['SOF'], address=address, endpoint=ep, data_valid_count=data_valid_count) + + return sofToken + +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): + address = 1 ep = 1 - framenumber = 52 # Note, for frame number 52 we expect A5 34 40 on the bus + frameNumber = 52 # Note, for frame number 52 we expect A5 34 40 on the bus - packets = [] - dataval = 0; + session = UsbSession(bus_speed=usb_speed, run_enumeration=False, device_address = address) # Start with a valid transaction */ - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=10, pid=0x3)) #DATA0 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) + session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=10)) - AppendSofToken(packets, framenumber, data_valid_count=data_valid_count) - AppendSofToken(packets, framenumber+1, data_valid_count=data_valid_count) - AppendSofToken(packets, framenumber+2, data_valid_count=data_valid_count) - AppendSofToken(packets, framenumber+3, data_valid_count=data_valid_count) - AppendSofToken(packets, framenumber+4, data_valid_count=data_valid_count) + session.add_event(CreateSofToken(frameNumber, data_valid_count)) + session.add_event(CreateSofToken(frameNumber+1, data_valid_count)) + session.add_event(CreateSofToken(frameNumber+2, data_valid_count)) + session.add_event(CreateSofToken(frameNumber+3, data_valid_count)) + session.add_event(CreateSofToken(frameNumber+4, data_valid_count)) #Finish with valid transaction - dataval += 10 - AppendOutToken(packets, ep, address, data_valid_count=data_valid_count, inter_pkt_gap=6000) - packets.append(TxDataPacket(rand, data_start_val=dataval, data_valid_count=data_valid_count, length=11, pid=0xb)) #DATA1 - packets.append(RxHandshakePacket(data_valid_count=data_valid_count)) - - do_usb_test(arch, clk, phy, usb_speed, packets, __file__, seed, level='smoke', extra_tasks=[]) + session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=11, interEventDelay=6000)) + + do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) def runtest(): - random.seed(1) - runall_rx(do_test) + RunUsbTest(do_test) + From 55657db1d36ff208f0fb898ec4461871f21f4ad3 Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 16 Apr 2021 16:08:22 +0100 Subject: [PATCH 247/520] More test fixes --- tests/test_bulk_rx_basic_badcrc32.py | 15 ++++++++------- tests/test_bulk_rx_basic_badcrc32/src/main.xc | 10 +++++----- tests/test_bulk_rx_basic_badpid.py | 16 ++++++++-------- tests/usb_transaction.py | 11 ++++++++--- 4 files changed, 29 insertions(+), 23 deletions(-) diff --git a/tests/test_bulk_rx_basic_badcrc32.py b/tests/test_bulk_rx_basic_badcrc32.py index ba95d961..1376dff0 100644 --- a/tests/test_bulk_rx_basic_badcrc32.py +++ b/tests/test_bulk_rx_basic_badcrc32.py @@ -16,21 +16,22 @@ def test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): session = UsbSession(bus_speed = usb_speed, run_enumeration = False, device_address = address) # Valid OUT transaction - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", eventTime=10, dataLength=10)) + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=10)) # Another valid OUT transaction - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", eventTime=10, dataLength=11, interEventDelay=6000)) + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=11, interEventDelay=6000)) # OUT transaction with bad data CRC - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", eventTime=10, dataLength=12, - interEventDelay=6000, badDataCrc=True)) + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=12, interEventDelay=6000, + badDataCrc=True)) # Due to bad CRC, XUD will not ACK and expect a resend of the same packet - DATA PID won't be toggled - # For ease of checking we dont resend the same packet.. - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", eventTime=10, dataLength=13, interEventDelay=6000)) + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=12, interEventDelay=6000)) # PID will be toggled as normal - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", eventTime=10, interEventDelay=6000, dataLength=14)) + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=13, interEventDelay=6000)) + + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=14, interEventDelay=6000)) do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) diff --git a/tests/test_bulk_rx_basic_badcrc32/src/main.xc b/tests/test_bulk_rx_basic_badcrc32/src/main.xc index e617d91d..e3186870 100644 --- a/tests/test_bulk_rx_basic_badcrc32/src/main.xc +++ b/tests/test_bulk_rx_basic_badcrc32/src/main.xc @@ -39,11 +39,11 @@ int TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_out_0) for(int i = 10; i <= 14; i++) { /* Expect bad CRC */ - if(i == 12) - unsafe{ - g_rxDataCheck[epNum]+=12; - continue; - } + //if(i == 12) + //unsafe{ + // g_rxDataCheck[epNum]+=12; + // continue; + //} XUD_GetBuffer(ep_out, buffer, length); diff --git a/tests/test_bulk_rx_basic_badpid.py b/tests/test_bulk_rx_basic_badpid.py index 95ae600e..cecf21f9 100644 --- a/tests/test_bulk_rx_basic_badpid.py +++ b/tests/test_bulk_rx_basic_badpid.py @@ -13,22 +13,22 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): address = 1 ep = 1 - session = UsbSession(bus_speed = usb_speed, run_enumeration = False, device_address = address) + session = UsbSession(bus_speed=usb_speed, run_enumeration = False, device_address=address) # The large inter-frame gap is to give the DUT time to print its output interEventDelay = 500 - # Valid IN transaction - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "IN", dataLength=10, interEventDelay=interEventDelay)) + # Valid OUT transaction + session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=10, interEventDelay=interEventDelay)) # Pretend the ACK went missing on the way to host. Re-send same packet. xCORE should ACK but throw pkt away - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "IN", dataLength=11, interEventDelay=interEventDelay, + session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=11, interEventDelay=interEventDelay, resend=True)) - # Send some valid IN transactions - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "IN", dataLength=12, interEventDelay=interEventDelay)) - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "IN", dataLength=13, interEventDelay=interEventDelay)) - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "IN", dataLength=14, interEventDelay=interEventDelay)) + # Send some valid OUT transactions + session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=12, interEventDelay=interEventDelay)) + session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=13, interEventDelay=interEventDelay)) + session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=14, interEventDelay=interEventDelay)) do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) diff --git a/tests/usb_transaction.py b/tests/usb_transaction.py index c993c474..e7ec2b1f 100644 --- a/tests/usb_transaction.py +++ b/tests/usb_transaction.py @@ -51,8 +51,13 @@ def __init__(self, session, deviceAddress = 0, endpointNumber = 0, endpointType else: expectHandshake = False + if expectHandshake or self._endpointType == "ISO": + resend = False + else: + resend = True + # Generate packet data payload - packetPayload = session.getPayload_out(endpointNumber, dataLength, resend = False)#(not expectHandshake or not self._endpointType == "ISO")) + packetPayload = session.getPayload_out(endpointNumber, dataLength, resend=resend) pid = session.data_pid_out(endpointNumber, togglePid = togglePid) @@ -64,9 +69,9 @@ def __init__(self, session, deviceAddress = 0, endpointNumber = 0, endpointType self._packets.extend(packets) - if resend: + #if resend: # Add again.. - self._packets.extend(packets) + # self._packets.extend(packets) else: From 89f73b12725cbefc0c9459cf7898df5ec6899eca Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 16 Apr 2021 16:35:28 +0100 Subject: [PATCH 248/520] Python2 -> Python3 --- tests/helpers.py | 36 ++++++++++++++++++------------------ tests/usb_clock.py | 2 +- tests/usb_packet.py | 30 +++++++++++++++--------------- tests/usb_phy.py | 6 +++--- tests/usb_phy_shim.py | 28 ++++++++++++++-------------- 5 files changed, 51 insertions(+), 51 deletions(-) diff --git a/tests/helpers.py b/tests/helpers.py index 461bf10a..d58370ec 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -67,7 +67,7 @@ def run_on(**kwargs): if not args: return True - for name,value in kwargs.iteritems(): + for name,value in kwargs.items(): arg_value = getattr(args,name) if arg_value is not None and value != arg_value: return False @@ -76,7 +76,7 @@ def run_on(**kwargs): def RunUsbTest(test_fn): - seed = args.seed if args.seed else random.randint(0, sys.maxint) + seed = args.seed if args.seed else random.randint(0, sys.maxsize) for _arch in ARCHITECTURE_CHOICES: for _busspeed in BUSSPEED_CHOICES: @@ -96,7 +96,7 @@ def do_usb_test(arch, clk, phy, usb_speed, sessions, test_file, seed, binary = '{testname}/bin/{arch}/{testname}_{arch}.xe'.format(testname=testname, arch=arch) - print binary + print(binary) assert len(sessions) == 1, "Multiple sessions not yet supported" @@ -105,13 +105,13 @@ def do_usb_test(arch, clk, phy, usb_speed, sessions, test_file, seed, events = session.events if args.verbose: - print "Session " + str(sessions.index(session)) - print str(session) + print("Session " + str(sessions.index(session))) + print(str(session)) if xmostest.testlevel_is_at_least(xmostest.get_testlevel(), level): - print "Running {test}: {arch} arch sending {n} event(s) at {clk} using {speed} (seed {seed})".format( + print("Running {test}: {arch} arch sending {n} event(s) at {clk} using {speed} (seed {seed})".format( test=testname, n=len(events), - arch=arch, clk=clk.get_name(), speed=usb_speed, seed=seed) + arch=arch, clk=clk.get_name(), speed=usb_speed, seed=seed)) phy.events = session.events @@ -142,21 +142,21 @@ def create_expect(arch, events, filename, verbose = False): packet_offset = 0 if verbose: - print "EXPECTED OUTPUT:" + print("EXPECTED OUTPUT:") for i, event in enumerate(events): expect_str = event.expected_output(offset = packet_offset) packet_offset += event.event_count if verbose: - print str(expect_str), + print(str(expect_str), end=' ') f.write(str(expect_str)) f.write("Test done\n") if verbose: - print "Test done\n" + print("Test done\n") def get_sim_args(testname, clk, phy, arch='xs2'): sim_args = [] @@ -203,15 +203,15 @@ def check_received_packet(packet, phy): if phy.expect_packet_index < phy.num_expected_packets: expected = phy.expected_packets[phy.expect_packet_index] if packet != expected: - print "ERROR: packet {n} does not match expected packet".format( - n=phy.expect_packet_index) + print("ERROR: packet {n} does not match expected packet".format( + n=phy.expect_packet_index)) - print "Received:" + print("Received:") sys.stdout.write(packet.dump()) - print "Expected:" + print("Expected:") sys.stdout.write(expected.dump()) - print "Received packet {} ok".format(phy.expect_packet_index) + print("Received packet {} ok".format(phy.expect_packet_index)) # Skip this packet phy.expect_packet_index += 1 @@ -219,11 +219,11 @@ def check_received_packet(packet, phy): move_to_next_valid_packet(phy) else: - print "ERROR: received unexpected packet from DUT" - print "Received:" + print("ERROR: received unexpected packet from DUT") + print("Received:") sys.stdout.write(packet.dump()) if phy.expect_packet_index >= phy.num_expected_packets: - print "Test done" + print("Test done") phy.xsi.terminate() diff --git a/tests/usb_clock.py b/tests/usb_clock.py index 76e361bd..6bbd7d02 100644 --- a/tests/usb_clock.py +++ b/tests/usb_clock.py @@ -48,7 +48,7 @@ def get_bit_time(self): return self._bit_time def stop(self): - print "**** CLOCK STOP ****" + print("**** CLOCK STOP ****") self._running = False def start(self): diff --git a/tests/usb_packet.py b/tests/usb_packet.py index 5facccc3..3f77fb8a 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -252,7 +252,7 @@ def __str__(self): return "USBPacket" def get_pid_str(self): - for key, value in USB_PID.iteritems(): + for key, value in USB_PID.items(): if value == self.pid: return key return "UNKNOWN" @@ -295,12 +295,12 @@ def drive(self, usb_phy): #sample TXV for new packet if xsi.sample_port_pins(usb_phy._txv) == 1: - print "Packet:\tDEVICE -> HOST" + print("Packet:\tDEVICE -> HOST") in_rx_packet = True break if in_rx_packet == False: - print "ERROR: Timed out waiting for packet" + print("ERROR: Timed out waiting for packet") else: while in_rx_packet == True: @@ -308,7 +308,7 @@ def drive(self, usb_phy): xsi.drive_port_pins(usb_phy._txrdy, 1) data = xsi.sample_port_pins(usb_phy._txd) - print "\tRX byte: {0:#x}".format(data) + print("\tRX byte: {0:#x}".format(data)) rx_packet.append(data) wait(lambda x: usb_phy._clock.is_high()) @@ -324,17 +324,17 @@ def drive(self, usb_phy): # Check packet against expected expected = self.get_bytes(do_tokens=False) if len(expected) != len(rx_packet): - print "ERROR: Rx packet length bad. Expecting: {} actual: {}".format(len(expected), len(rx_packet)) + print("ERROR: Rx packet length bad. Expecting: {} actual: {}".format(len(expected), len(rx_packet))) # Check packet data against expected - if cmp(expected, rx_packet): - print "ERROR: Rx Packet Error. Expected:" + if expected != rx_packet: + print("ERROR: Rx Packet Error. Expected:") for item in expected: - print "{0:#x}".format(item) + print("{0:#x}".format(item)) - print "Received:" + print("Received:") for item in rx_packet: - print "{0:#x}".format(item) + print("{0:#x}".format(item)) @@ -361,13 +361,13 @@ def drive(self, usb_phy, verbose = True): # xCore should not be trying to send if we are trying to send.. if xsi.sample_port_pins(usb_phy._txv) == 1: - print "ERROR: Unexpected packet from xCORE" + print("ERROR: Unexpected packet from xCORE") rxv_count = self.data_valid_count usb_phy.wait_until(xsi.get_time() + self.interEventDelay) - print "Packet:\tHOST -> DEVICE\n\tPID: {0} ({1:#x})".format(self.get_pid_str(), self.pid) + print("Packet:\tHOST -> DEVICE\n\tPID: {0} ({1:#x})".format(self.get_pid_str(), self.pid)) # Set RXA high to USB shim xsi.drive_periph_pin(usb_phy._rxa, 1) @@ -384,7 +384,7 @@ def drive(self, usb_phy, verbose = True): # xCore should not be trying to send if we are trying to send.. if xsi.sample_port_pins(usb_phy._txv) == 1: - print "ERROR: Unexpected packet from xCORE" + print("ERROR: Unexpected packet from xCORE") wait(lambda x: usb_phy._clock.is_low()) wait(lambda x: usb_phy._clock.is_high()) @@ -403,7 +403,7 @@ def drive(self, usb_phy, verbose = True): # xCore should not be trying to send if we are trying to send.. if xsi.sample_port_pins(usb_phy._txv) == 1: - print "ERROR: Unexpected packet from xCORE" + print("ERROR: Unexpected packet from xCORE") #print "Sending byte {0:#x}".format(byte) @@ -426,7 +426,7 @@ def drive(self, usb_phy, verbose = True): # xCore should not be trying to send if we are trying to send.. if xsi.sample_port_pins(usb_phy._txv) == 1: - print "ERROR: Unexpected packet from xCORE" + print("ERROR: Unexpected packet from xCORE") xsi.drive_periph_pin(usb_phy._rxa, 0) diff --git a/tests/usb_phy.py b/tests/usb_phy.py index 280eb5e0..5621a8ee 100644 --- a/tests/usb_phy.py +++ b/tests/usb_phy.py @@ -57,7 +57,7 @@ def start_test(self): def end_test(self): if self._verbose: - print "All events sent" + print("All events sent") if self._complete_fn: self._complete_fn(self) @@ -92,7 +92,7 @@ def end_test(self): # Allow time for the DUT to exit self.wait_until(self.xsi.get_time() + self._dut_exit_time) - print "ERROR: Test timed out" + print("ERROR: Test timed out") self.xsi.terminate() def set_clock(self, clock): @@ -111,7 +111,7 @@ def run(self): event.drive(self) - print "Test done" + print("Test done") self.end_test() diff --git a/tests/usb_phy_shim.py b/tests/usb_phy_shim.py index bd8e629a..472efbd4 100644 --- a/tests/usb_phy_shim.py +++ b/tests/usb_phy_shim.py @@ -47,12 +47,12 @@ def run(self): #sample TXV for new packet if xsi.sample_port_pins(self._txv) == 1: - print "Receiving packet {}".format(i) + print("Receiving packet {}".format(i)) in_rx_packet = True break if in_rx_packet == False: - print "ERROR: Timed out waiting for packet" + print("ERROR: Timed out waiting for packet") else: #print "in packet" @@ -62,7 +62,7 @@ def run(self): xsi.drive_port_pins(self._txrdy, 1) data = xsi.sample_port_pins(self._txd) - print "Received byte: {0:#x}".format(data) + print("Received byte: {0:#x}".format(data)) rx_packet.append(data) self.wait(lambda x: self._clock.is_high()) @@ -80,30 +80,30 @@ def run(self): # Check packet agaist expected expected = packet.get_bytes(do_tokens=True) if len(expected) != len(rx_packet): - print "ERROR: Rx packet length bad. Expecting: {} actual: {}".format(len(expected), len(rx_packet)) + print("ERROR: Rx packet length bad. Expecting: {} actual: {}".format(len(expected), len(rx_packet))) # Check packet data against expected if cmp(expected, rx_packet): - print "ERROR: Rx Packet Error. Expected:" + print("ERROR: Rx Packet Error. Expected:") for item in expected: - print "{0:#x}".format(item) + print("{0:#x}".format(item)) - print "Received:" + print("Received:") for item in rx_packet: - print "{0:#x}".format(item) + print("{0:#x}".format(item)) else: # xCore should not be trying to send if we are trying to send.. if xsi.sample_port_pins(self._txv) == 1: - print "ERROR: Unexpected packet from xCORE" + print("ERROR: Unexpected packet from xCORE") rxv_count = packet.get_data_valid_count(); #print "Waiting for inter_pkt_gap: {i}".format(i=packet.inter_frame_gap) self.wait_until(xsi.get_time() + packet.inter_pkt_gap) - print "Phy transmitting packet {} PID: {} ({})".format(i, packet.get_pid_pretty(), packet.pid) + print("Phy transmitting packet {} PID: {} ({})".format(i, packet.get_pid_pretty(), packet.pid)) if self._verbose: sys.stdout.write(packet.dump()) @@ -122,7 +122,7 @@ def run(self): # xCore should not be trying to send if we are trying to send.. if xsi.sample_port_pins(self._txv) == 1: - print "ERROR: Unexpected packet from xCORE" + print("ERROR: Unexpected packet from xCORE") self.wait(lambda x: self._clock.is_low()) @@ -142,7 +142,7 @@ def run(self): # xCore should not be trying to send if we are trying to send.. if xsi.sample_port_pins(self._txv) == 1: - print "ERROR: Unexpected packet from xCORE" + print("ERROR: Unexpected packet from xCORE") #print "Sending byte {0:#x}".format(byte) @@ -171,14 +171,14 @@ def run(self): # xCore should not be trying to send if we are trying to send.. if xsi.sample_port_pins(self._txv) == 1: - print "ERROR: Unexpected packet from xCORE" + print("ERROR: Unexpected packet from xCORE") xsi.drive_port_pins(self._rxa, 0) #if self._verbose: #print "Sent" - print "Test done" + print("Test done") self.end_test() From dd357c248c4002a42016540446437421ee2f573e Mon Sep 17 00:00:00 2001 From: Michael Bruno Date: Tue, 20 Apr 2021 12:27:50 -0400 Subject: [PATCH 249/520] Update STALL fix to not change timing The check for a STALL condition on an OUT endpoint that has a buffer ready now occurs after receving the data packet. This check replaces several NOPs that were present to ensure a minimum interpacket delay. This check should therefore not change the timing. The data packet will be received into the buffer provided by the application, but if the endpoint is halted, then a STALL will be issued, the application will not be notified, and the ready condition will not be cleared. --- lib_xud/src/core/included/XUD_Token_Out.S | 33 +++++++++----------- lib_xud/src/core/included/XUD_Token_Out_DI.S | 29 ++++++++--------- 2 files changed, 29 insertions(+), 33 deletions(-) diff --git a/lib_xud/src/core/included/XUD_Token_Out.S b/lib_xud/src/core/included/XUD_Token_Out.S index bf6781fc..627b64a9 100755 --- a/lib_xud/src/core/included/XUD_Token_Out.S +++ b/lib_xud/src/core/included/XUD_Token_Out.S @@ -13,12 +13,6 @@ Pid_Out: #include "XUD_CrcAddrCheck.S" - ldaw r11, dp[handshakeTable_OUT] // Load handshake table - ldw r11, r11[r10] - ldc r3, USB_PIDn_STALL - eq r3, r11, r3 - bt r3, XUD_TokenOut_BufferFull - ldw r3, r5[r10] // Load relevant EP pointer bf r3, XUD_TokenOut_BufferFull ldw r1, r3[3] // Load buffer from EP structure @@ -84,18 +78,21 @@ DoOutNonIso: doRXDataReturn_NonIso: bf r1, NextTokenAfterOut // Check for bad crc - ldc r11, USB_PIDn_ACK // Data CRC good and EP not Iso: Send Ack - nop - nop - nop - nop - nop + + ldaw r6, dp[handshakeTable_OUT] // Load the handshake table. + ldw r11, r6[r10] // Get the handshake PID for this EP + ldc r1, USB_PIDn_STALL // as well as the STALL PID + eq r1, r11, r1 // and compare them. + bt r1, XUD_TokenOut_Handshake // If the handshake PID for this EP is STALL, then + // go and send the handshake without clearing ready + // or communicating back to the application that + // the packet has been received. + + ldc r11, USB_PIDn_ACK // Data CRC good, EP not Iso, and EP not halted: Send Ack outpw res[TXD], r11, 8 syncr res[TXD] StoreTailDataOut: - //shr r8, r8, 3 // r8: number of tail bits, convert to bytes - // This is now done on the other side ldc r11, 0 stw r11, r5[r10] // Clear ready ldw r11, r3[1] // Load EP chanend @@ -145,15 +142,13 @@ XUD_TokenOut_WaitForPacketEnd: // Wait for end of data then sen #endif // LOAD HANDSHAKE PID or STALL - ldaw r5, dp[handshakeTable_OUT] // Load handshake table - ldw r11, r5[r10] - //ldc r11, 0x5a + ldaw r6, dp[handshakeTable_OUT] // Load handshake table +XUD_TokenOut_Handshake: + ldw r11, r6[r10] outpw res[TXD], r11, 8 syncr res[TXD] PrimaryBufferFull_NoNak: - //endin r11, res[RXD] - //in r11, res[RXD] setc res[RXD], XS1_SETC_RUN_CLRBUF bu NextToken diff --git a/lib_xud/src/core/included/XUD_Token_Out_DI.S b/lib_xud/src/core/included/XUD_Token_Out_DI.S index 5c5eac27..1ebaf823 100755 --- a/lib_xud/src/core/included/XUD_Token_Out_DI.S +++ b/lib_xud/src/core/included/XUD_Token_Out_DI.S @@ -9,12 +9,6 @@ Pid_Out: #include "XUD_CrcAddrCheck.S" - ldaw r11, dp[handshakeTable_OUT] // Load handshake table - {ldw r11, r11[r10] - ldc r3, USB_PIDn_STALL} - eq r3, r11, r3 - bt r3, XUD_TokenOut_BufferFull - ldw r3, r5[r10] // Load relevant EP pointer bf r3, XUD_TokenOut_BufferFull ldw r1, r3[3] // Load buffer from EP structure @@ -42,12 +36,18 @@ DoOutNonIso: doRXDataReturn_NonIso: bf r1, NextTokenAfterOut // Check for bad crc - ldc r11, USB_PIDn_ACK // Data CRC good and EP not Iso: Send Ack - nop - nop - nop - nop - nop + + ldaw r6, dp[handshakeTable_OUT] // Load the handshake table. + {ldw r11, r6[r10] // Get the handshake PID for this EP + ldc r1, USB_PIDn_STALL} // as well as the STALL PID + eq r1, r11, r1 // and compare them. + nop // NOP to ensure minimum interpacket delay. + bt r1, XUD_TokenOut_Handshake // If the handshake PID for this EP is STALL, then + // go and send the handshake without clearing ready + // or communicating back to the application that + // the packet has been received. + + ldc r11, USB_PIDn_ACK // Data CRC good, EP not Iso, and EP not halted: Send Ack outpw res[TXD], r11, 8 syncr res[TXD] @@ -92,8 +92,9 @@ XUD_TokenOut_WaitForPacketEnd: // Wait for end of data then sen #endif // Load handshake (ACK or STALL) - ldaw r5, dp[handshakeTable_OUT] // Load handshake table - ldw r11, r5[r10] + ldaw r6, dp[handshakeTable_OUT] // Load handshake table +XUD_TokenOut_Handshake: + ldw r11, r6[r10] outpw res[TXD], r11, 8 syncr res[TXD] From 30cd37c521b6e76c7f004400be32370869b74514 Mon Sep 17 00:00:00 2001 From: Michael Bruno Date: Tue, 20 Apr 2021 12:40:07 -0400 Subject: [PATCH 250/520] Remove added whitespace --- lib_xud/src/core/included/XUD_Token_Out.S | 1 - lib_xud/src/core/included/XUD_Token_Out_DI.S | 1 - 2 files changed, 2 deletions(-) diff --git a/lib_xud/src/core/included/XUD_Token_Out.S b/lib_xud/src/core/included/XUD_Token_Out.S index 627b64a9..764b83d4 100755 --- a/lib_xud/src/core/included/XUD_Token_Out.S +++ b/lib_xud/src/core/included/XUD_Token_Out.S @@ -12,7 +12,6 @@ .skip 0 Pid_Out: #include "XUD_CrcAddrCheck.S" - ldw r3, r5[r10] // Load relevant EP pointer bf r3, XUD_TokenOut_BufferFull ldw r1, r3[3] // Load buffer from EP structure diff --git a/lib_xud/src/core/included/XUD_Token_Out_DI.S b/lib_xud/src/core/included/XUD_Token_Out_DI.S index 1ebaf823..4e05d8da 100755 --- a/lib_xud/src/core/included/XUD_Token_Out_DI.S +++ b/lib_xud/src/core/included/XUD_Token_Out_DI.S @@ -8,7 +8,6 @@ .skip 0 Pid_Out: #include "XUD_CrcAddrCheck.S" - ldw r3, r5[r10] // Load relevant EP pointer bf r3, XUD_TokenOut_BufferFull ldw r1, r3[3] // Load buffer from EP structure From 815ba703467c03b4c416b875443cd3b7e2c90196 Mon Sep 17 00:00:00 2001 From: Michael Bruno Date: Tue, 20 Apr 2021 16:09:46 -0400 Subject: [PATCH 251/520] STALL halted IN EP even when marked ready This allows IN endpoints to be STALLed when they are halted, even if the application has prepare a buffer for it. This is similar to the fix for OUT endpoints. This introduces more cycles between receving an IN token packet, and replying with a DATA packet, but this should still be well under the maximum time allowed by the USB spec. This case is seems less important than it is for OUT endpoints, but I do think we should handle it for completeness. --- lib_xud/src/core/included/XUD_Token_In_DI.S | 39 +++++++++++++-------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/lib_xud/src/core/included/XUD_Token_In_DI.S b/lib_xud/src/core/included/XUD_Token_In_DI.S index 1a232198..684271fe 100755 --- a/lib_xud/src/core/included/XUD_Token_In_DI.S +++ b/lib_xud/src/core/included/XUD_Token_In_DI.S @@ -23,27 +23,36 @@ // R1 : Valid Token Port // R0 : RXD .align FUNCTION_ALIGNMENT -InNotReady: - ldw r11, sp[STACK_EPTYPES_IN] - ldw r11, r11[r10] // Load EP Type - bt r11, XUD_IN_TxNak - ldc r11, 0xc3 // Create 0-length packet - outpw res[TXD], r11, 24 +Pid_In: + #include "XUD_CrcAddrCheck.S" + ldaw r3, r10[4] // R3 = R10 + 16 + ldw r4, r5[r3] // Load EP structure address into R4 + + + ldw r11, sp[STACK_EPTYPES_IN] + ldw r11, r11[r10] // Load EP Type into R11 + bt r11, In_NonIso // If the type is non-zero then it is not isochronous + bt r4, In_LoadPid // If the EP structure address is not 0, and the + // EP type is iso, then we are ready to send. + ldc r11, 0xc3 // Otherwise, create 0-length packet + outpw res[TXD], r11, 24 #include "XUD_TokenJmp.S" -XUD_IN_TxNak: // Non-Iso +In_NonIso: ldaw r11, dp[handshakeTable_IN] // Load handshake table - ldw r11, r11[r10] // Load handshake PID + ldw r11, r11[r10] // Load handshake PID into R11 + {bf r4, In_TxHandshake // If the EP structure address is 0, and the EP type + // is not iso, then send the PID from the handshake table. + ldc r8, USB_PIDn_STALL} // If the EP is ready, then compare the STALL PID + eq r8, r11, r8 // with the PID in the handshake table. + bf r8, In_LoadPid // If it's not a STALL, then we are ready to send. + // Otherwise, send the PID from the handshake table. + ldc r8, 0 + ecallf r8 +In_TxHandshake: outpw res[TXD], r11, 8 #include "XUD_TokenJmp.S" -.align FUNCTION_ALIGNMENT -Pid_In: - #include "XUD_CrcAddrCheck.S" - ldaw r3, r10[4] // R3 = R10 + 16 - ldw r4, r5[r3] // Load EP structure address - bf r4, InNotReady // If 0 then not ready... - In_LoadPid: ldw r11, r4[4] // Load PID from structure From 32a797c2b5a71c3fa7dcdc0415ab7ebfcd752b9c Mon Sep 17 00:00:00 2001 From: Michael Bruno Date: Tue, 20 Apr 2021 16:28:19 -0400 Subject: [PATCH 252/520] Remove erroneous instruction left from testing --- lib_xud/src/core/included/XUD_Token_In_DI.S | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib_xud/src/core/included/XUD_Token_In_DI.S b/lib_xud/src/core/included/XUD_Token_In_DI.S index 684271fe..9b558de3 100755 --- a/lib_xud/src/core/included/XUD_Token_In_DI.S +++ b/lib_xud/src/core/included/XUD_Token_In_DI.S @@ -47,8 +47,6 @@ In_NonIso: eq r8, r11, r8 // with the PID in the handshake table. bf r8, In_LoadPid // If it's not a STALL, then we are ready to send. // Otherwise, send the PID from the handshake table. - ldc r8, 0 - ecallf r8 In_TxHandshake: outpw res[TXD], r11, 8 #include "XUD_TokenJmp.S" From 9741184c2e0194e6f5b82c21a1178b88a994c5c0 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 21 Apr 2021 16:09:37 +0100 Subject: [PATCH 253/520] Started to add basic suspend test --- tests/test_suspend.py | 31 ++++++++++++ tests/test_suspend/LICENSE.rst | 84 +++++++++++++++++++++++++++++++++ tests/test_suspend/Makefile | 1 + tests/test_suspend/src/main.xc | 68 ++++++++++++++++++++++++++ tests/test_suspend/src/xc_ptr.h | 48 +++++++++++++++++++ tests/usb_signalling.py | 45 ++++++++++++++++++ 6 files changed, 277 insertions(+) create mode 100644 tests/test_suspend.py create mode 100644 tests/test_suspend/LICENSE.rst create mode 100644 tests/test_suspend/Makefile create mode 100644 tests/test_suspend/src/main.xc create mode 100644 tests/test_suspend/src/xc_ptr.h create mode 100644 tests/usb_signalling.py diff --git a/tests/test_suspend.py b/tests/test_suspend.py new file mode 100644 index 00000000..d1a151c1 --- /dev/null +++ b/tests/test_suspend.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. + +import xmostest +import usb_packet +from helpers import do_usb_test, RunUsbTest +from usb_session import UsbSession +from usb_transaction import UsbTransaction +from usb_signalling import UsbSuspend + +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): + + ep = 1 + address = 1 + start_length = 10 + end_length = 12 + + session = UsbSession(bus_speed=usb_speed, run_enumeration=False, device_address = address) + + for pktLength in range(start_length, end_length+1): + + if pktLength == start_length + 2: + session.add_event(UsbSuspend(10)) + + session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=pktLength)) + + do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) + +def runtest(): + RunUsbTest(do_test) diff --git a/tests/test_suspend/LICENSE.rst b/tests/test_suspend/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/tests/test_suspend/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_suspend/Makefile b/tests/test_suspend/Makefile new file mode 100644 index 00000000..6aed3e76 --- /dev/null +++ b/tests/test_suspend/Makefile @@ -0,0 +1 @@ +include ../test_makefile.mak diff --git a/tests/test_suspend/src/main.xc b/tests/test_suspend/src/main.xc new file mode 100644 index 00000000..e2f8be4c --- /dev/null +++ b/tests/test_suspend/src/main.xc @@ -0,0 +1,68 @@ +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. +#include +#include +#include +#include "xud.h" +#include "platform.h" +#include "shared.h" + +#define XUD_EP_COUNT_OUT 5 +#define XUD_EP_COUNT_IN 5 + +#ifndef PKT_LENGTH_START +#define PKT_LENGTH_START 10 +#endif + +#ifndef PKT_LENGTH_END +#define PKT_LENGTH_END 19 +#endif + +#ifndef TEST_EP_NUM +#define TEST_EP_NUM 1 +#endif + +/* Endpoint type tables */ +XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; +XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; + +#ifdef XUD_SIM_RTL +int testmain() +#else +int main() +#endif +{ + chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + + par + { + { + #if defined(XUD_TEST_SPEED_FS) + unsigned speed = XUD_SPEED_FS; + #elif defined(XUD_TEST_SPEED_HS) + unsigned speed = XUD_SPEED_HS; + #else + #error XUD_TEST_SPEED_XX not defined + #endif + + XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + null, epTypeTableOut, epTypeTableIn, speed, XUD_PWR_BUS); + } + + { + unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); + + + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep0); + + if(fail) + TerminateFail(fail); + else + TerminatePass(fail); + + } + } + + return 0; +} diff --git a/tests/test_suspend/src/xc_ptr.h b/tests/test_suspend/src/xc_ptr.h new file mode 100644 index 00000000..8fa5a04e --- /dev/null +++ b/tests/test_suspend/src/xc_ptr.h @@ -0,0 +1,48 @@ +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. +#ifndef __xc_ptr__ +#define __xc_ptr__ + +typedef unsigned int xc_ptr; + +// Note that this function is marked as const to avoid the XC +// parallel usage checks, this is only really going to work if this +// is the *only* way the array a is accessed (and everything else uses +// the xc_ptr) +inline xc_ptr array_to_xc_ptr(const unsigned a[]) +{ + xc_ptr x; + asm("mov %0, %1":"=r"(x):"r"(a)); + return x; +} + +inline xc_ptr char_array_to_xc_ptr(const unsigned char a[]) +{ + xc_ptr x; + asm("mov %0, %1":"=r"(x):"r"(a)); + return x; +} + +#define write_via_xc_ptr_indexed(p,i,x) asm volatile("stw %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) +#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) +#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) +#define write_short_via_xc_ptr_indexed(p,i,x) asm volatile("st16 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) + +#define write_via_xc_ptr(p,x) asm volatile("stw %0, %1[0]"::"r"(x),"r"(p)) +// No immediate st8 format +#define write_byte_via_xc_ptr(p,x) write_byte_via_xc_ptr_indexed(p, 0, x) +#define write_short_via_xc_ptr(p,x) write_short_via_xc_ptr_indexed(p, 0, x) + +#define read_via_xc_ptr_indexed(x,p,i) asm("ldw %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); +#define read_byte_via_xc_ptr_indexed(x,p,i) asm("ld8u %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); +#define read_short_via_xc_ptr_indexed(x,p,i) asm("ld16s %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); + +#define read_via_xc_ptr(x,p) asm("ldw %0, %1[0]":"=r"(x):"r"(p)); +// No immediate ld8u format +#define read_byte_via_xc_ptr(x,p) read_byte_via_xc_ptr_indexed(x, p, 0) +#define read_short_via_xc_ptr(x,p) read_short_via_xc_ptr_indexed(x, p, 0) + +#define GET_SHARED_GLOBAL(x, g) asm volatile("ldw %0, dp[" #g "]":"=r"(x)::"memory") +#define SET_SHARED_GLOBAL(g, v) asm volatile("stw %0, dp[" #g "]"::"r"(v):"memory") + +#endif diff --git a/tests/usb_signalling.py b/tests/usb_signalling.py new file mode 100644 index 00000000..73d7f8ac --- /dev/null +++ b/tests/usb_signalling.py @@ -0,0 +1,45 @@ + + +from usb_event import UsbEvent + +class UsbSuspend(UsbEvent): + + # TODO create instance of Suspend with duracton in seconds and convert to clks? + def __init__(self, duration, interEventDelay=1): + self._duration = duration + super().__init__(interEventDelay=interEventDelay) + + def expected_output(self, offset = 0): + expected_output = "" + for i in range(0, self._duration): + expected_output += "Suspend: {}\n".format(self._duration - i) + return expected_output + + def __str__(self): + return "UsbSuspend: " + str(self._duration) + + @property + def event_count(self): + return 1 + + def drive(self, usb_phy): + + xsi = usb_phy.xsi + wait = usb_phy.wait + + # xCore should not be trying to send if we are trying to send.. + if xsi.sample_port_pins(usb_phy._txv) == 1: + print("ERROR: Unexpected packet from xCORE") + + usb_phy.wait_until(xsi.get_time() + self.interEventDelay) + + # Drive J state onto LS pins + xsi.drive_periph_pin(usb_phy._ls, 1) + + duration = self._duration_clks + + while duration > 0: + print("Suspend: {0})".format(duration)) + wait(lambda x: usb_phy._clock.is_high()) + wait(lambda x: usb_phy._clock.is_low()) + duration = duraton -1 From 780fc4c43da9afedb1cde1d12623bce113f48826 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 28 Apr 2021 10:39:15 +0100 Subject: [PATCH 254/520] Modifications for testing suspend --- lib_xud/src/core/XUD_HAL.xc | 12 ------ lib_xud/src/core/XUD_Main.xc | 7 +++- lib_xud/src/core/XUD_PowerSig.xc | 3 -- lib_xud/src/core/XUD_SetCrcTableAddr.c | 2 +- lib_xud/src/core/XUD_TimingDefines.h | 6 ++- tests/helpers.py | 10 +++-- tests/test_makefile.mak | 8 ++-- tests/test_suspend.py | 12 ++++-- tests/test_suspend/Makefile | 3 ++ tests/usb_clock.py | 8 ++++ tests/usb_phy.py | 24 +++++++++-- tests/usb_phy_utmi.py | 7 +--- tests/usb_signalling.py | 56 ++++++++++++++++++++------ 13 files changed, 108 insertions(+), 50 deletions(-) diff --git a/lib_xud/src/core/XUD_HAL.xc b/lib_xud/src/core/XUD_HAL.xc index 61781aba..ec2450fc 100644 --- a/lib_xud/src/core/XUD_HAL.xc +++ b/lib_xud/src/core/XUD_HAL.xc @@ -125,7 +125,6 @@ void XUD_HAL_EnableUsb(unsigned pwrConfig) void XUD_HAL_EnterMode_PeripheralFullSpeed() { -#ifndef XUD_SIM_XSIM #ifdef __XS3A__ unsigned d = 0; d = XS1_USB_PHY_CFG0_UTMI_XCVRSELECT_SET(d, 1); @@ -148,12 +147,10 @@ void XUD_HAL_EnterMode_PeripheralFullSpeed() write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_FUNC_CONTROL_NUM, (1< #include "xud.h" @@ -290,4 +288,3 @@ int XUD_Suspend(XUD_PwrConfig pwrConfig) } } #endif -#endif diff --git a/lib_xud/src/core/XUD_SetCrcTableAddr.c b/lib_xud/src/core/XUD_SetCrcTableAddr.c index 81fafaf4..55590abb 100644 --- a/lib_xud/src/core/XUD_SetCrcTableAddr.c +++ b/lib_xud/src/core/XUD_SetCrcTableAddr.c @@ -3,7 +3,7 @@ /** @file XUD_SetCrcTableAddr.c * @author Ross Owen, XMOS Limited */ - +#include /* Global table used to store complete valid CRC5 table */ extern unsigned char crc5Table[2048]; diff --git a/lib_xud/src/core/XUD_TimingDefines.h b/lib_xud/src/core/XUD_TimingDefines.h index ed9fc1df..cfa94509 100755 --- a/lib_xud/src/core/XUD_TimingDefines.h +++ b/lib_xud/src/core/XUD_TimingDefines.h @@ -4,8 +4,10 @@ #define _XUD_USB_DEFINES_H_ // Defines relating to USB/ULPI/UTMI/Phy specs -#define REF_CLK_FREQ 100 -#define SUSPEND_TIMEOUT_us 3000 +#define REF_CLK_FREQ (100) +#ifndef SUSPEND_TIMEOUT_us +#define SUSPEND_TIMEOUT_us (3000) +#endif #define SUSPEND_TIMEOUT (SUSPEND_TIMEOUT_us * REF_CLK_FREQ) // Device attach timing defines diff --git a/tests/helpers.py b/tests/helpers.py index 40c711a3..235fe4ce 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -35,8 +35,9 @@ def get_usb_clk_phy(verbose=True, test_ctrl=None, do_timeout=True, 'tile[0]:XS1_PORT_8A', #txd 'tile[0]:XS1_PORT_1K', #txv 'tile[0]:XS1_PORT_1H', #txrdy - 'XS1_USB_LS0', - 'XS1_USB_LS1', + 'XS1_USB_LS', + 'XS1_USB_XCVRSEL', + 'XS1_USB_TERMSEL', clk, verbose=verbose, test_ctrl=test_ctrl, do_timeout=do_timeout, complete_fn=complete_fn, @@ -52,8 +53,9 @@ def get_usb_clk_phy(verbose=True, test_ctrl=None, do_timeout=True, 'tile[0]:XS1_PORT_8A', #txd 'tile[0]:XS1_PORT_1K', #txv 'tile[0]:XS1_PORT_1H', #txrdy - 'XS1_USB_LS0', - 'XS1_USB_LS1', + 'XS1_USB_LS', + 'XS1_USB_XCVRSEL', + 'XS1_USB_TERMSEL', clk, verbose=verbose, test_ctrl=test_ctrl, do_timeout=do_timeout, complete_fn=complete_fn, diff --git a/tests/test_makefile.mak b/tests/test_makefile.mak index 9d49b4f9..c5a10e0d 100644 --- a/tests/test_makefile.mak +++ b/tests/test_makefile.mak @@ -20,18 +20,20 @@ APP_NAME = SHARED_CODE = ../../shared_src +TEST_FLAGS ?= + COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) \ -DUSB_TILE=tile[0] \ -Wno-timing \ -DXUD_SIM_XSIM=1 \ -DXUD_TEST_SPEED_HS=1 \ -DXUD_BYPASS_RESET=1 \ - -DXUD_STARTUP_ADDRESS=1 + -DXUD_STARTUP_ADDRESS=1 #TODO RM ARCH_L define -XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -DARCH_L +XCC_FLAGS_xs2 = $(TEST_FLAGS) $(COMMON_FLAGS) -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -DARCH_L -XCC_FLAGS_xs3 = $(COMMON_FLAGS) +XCC_FLAGS_xs3 = $(TEST_FLAGS) $(COMMON_FLAGS) TARGET = test_$(CONFIG).xn diff --git a/tests/test_suspend.py b/tests/test_suspend.py index d1a151c1..8f1b2490 100644 --- a/tests/test_suspend.py +++ b/tests/test_suspend.py @@ -17,13 +17,17 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): end_length = 12 session = UsbSession(bus_speed=usb_speed, run_enumeration=False, device_address = address) + + pktLength = 10 + session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=pktLength, interEventDelay=0)) + session.add_event(UsbSuspend(500000000000)) + session.add_event(UsbResume()) - for pktLength in range(start_length, end_length+1): + #for pktLength in range(start_length, end_length+1): - if pktLength == start_length + 2: - session.add_event(UsbSuspend(10)) + # if pktLength == start_length + 2: + # session.add_event(UsbSuspend(500000000000)) - session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=pktLength)) do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) diff --git a/tests/test_suspend/Makefile b/tests/test_suspend/Makefile index 6aed3e76..21270f52 100644 --- a/tests/test_suspend/Makefile +++ b/tests/test_suspend/Makefile @@ -1 +1,4 @@ + +TEST_FLAGS = -DSUSPEND_TIMEOUT_us=300 + include ../test_makefile.mak diff --git a/tests/usb_clock.py b/tests/usb_clock.py index c2520088..337f912f 100644 --- a/tests/usb_clock.py +++ b/tests/usb_clock.py @@ -31,6 +31,14 @@ def run(self): #self.xsi.drive_port_pins(self._port, self._val) self.xsi.drive_periph_pin(self._port, self._val) + @property + def period_ns(self): + return self._period + + @property + def period_us(self): + return self._period/1000 + def is_high(self): return (self._val == 1) diff --git a/tests/usb_phy.py b/tests/usb_phy.py index e3b5eb78..c4366441 100644 --- a/tests/usb_phy.py +++ b/tests/usb_phy.py @@ -9,12 +9,25 @@ USB_DATA_VALID_COUNT = {'FS': 39, "HS": 0} +USB_LINESTATE = { + 'IDLE': 0, + 'FS_J': 2, + 'FS_K': 1, + 'HS_J': 1, + 'HS_K': 2, + } + +USB_TIMINGS = { + 'IDLE_TO_FS_MIN_US': 3000, + 'IDLE_TO_FS_MAX_US': 3125, + } + class UsbPhy(xmostest.SimThread): # Time in ns from the last packet being sent until the end of test is signalled to the DUT END_OF_TEST_TIME = 5000 - def __init__(self, name, rxd, rxa, rxdv, rxer, txd, txv, txrdy, ls0, ls1, clock, initial_delay, verbose, + def __init__(self, name, rxd, rxa, rxdv, rxer, txd, txv, txrdy, ls, xcvrsel, termsel, clock, initial_delay, verbose, test_ctrl, do_timeout, complete_fn, expect_loopback, dut_exit_time): self._name = name self._test_ctrl = test_ctrl @@ -25,8 +38,9 @@ def __init__(self, name, rxd, rxa, rxdv, rxer, txd, txv, txrdy, ls0, ls1, clock, self._txd = txd self._txv = txv self._txrdy = txrdy - self.ls0 = ls0 - self.ls1 = ls1 + self._ls = ls + self._xcvrsel = xcvrsel + self._termsel = termsel self._events = [] self._clock = clock self._initial_delay = initial_delay @@ -52,6 +66,10 @@ def events(self): def events(self, events): self._events = events + def us_to_clocks(self, time_us): + time_clocks = time_us/self._clock.period_us + return time_clocks + def start_test(self): self.wait_until(self.xsi.get_time() + self._initial_delay) self.wait(lambda x: self._clock.is_high()) diff --git a/tests/usb_phy_utmi.py b/tests/usb_phy_utmi.py index d23d9dbc..372044db 100644 --- a/tests/usb_phy_utmi.py +++ b/tests/usb_phy_utmi.py @@ -1,22 +1,19 @@ # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -import random import xmostest -import sys -import zlib from usb_packet import RxPacket, TokenPacket import usb_packet from usb_phy import UsbPhy class UsbPhyUtmi(UsbPhy): - def __init__(self, rxd, rxa, rxdv, rxer, txd, txv, txrdy, ls0, ls1, clock, + def __init__(self, rxd, rxa, rxdv, rxer, txd, txv, txrdy, ls, xcvrsel, termsel, clock, initial_delay=60000, verbose=False, test_ctrl=None, do_timeout=True, complete_fn=None, expect_loopback=True, dut_exit_time=25000): self._do_tokens = False - super(UsbPhyUtmi, self).__init__('UsbPhyUtmi', rxd, rxa, rxdv, rxer, txd, txv, txrdy, ls0, ls1, clock, + super(UsbPhyUtmi, self).__init__('UsbPhyUtmi', rxd, rxa, rxdv, rxer, txd, txv, txrdy, ls, xcvrsel, termsel, clock, initial_delay, verbose, test_ctrl, do_timeout, complete_fn, expect_loopback, dut_exit_time) diff --git a/tests/usb_signalling.py b/tests/usb_signalling.py index 73d7f8ac..52970177 100644 --- a/tests/usb_signalling.py +++ b/tests/usb_signalling.py @@ -1,18 +1,22 @@ - from usb_event import UsbEvent +from usb_phy import USB_LINESTATE, USB_TIMINGS + + class UsbSuspend(UsbEvent): # TODO create instance of Suspend with duracton in seconds and convert to clks? - def __init__(self, duration, interEventDelay=1): + def __init__(self, duration, interEventDelay=0): self._duration = duration super().__init__(interEventDelay=interEventDelay) def expected_output(self, offset = 0): - expected_output = "" - for i in range(0, self._duration): - expected_output += "Suspend: {}\n".format(self._duration - i) + expected_output = "SUSPEND START. WAITING FOR DUT TO ENTER FS\n" + expected_output += "DEVICE ENTERED FS\n" + expected_output += "SUSPEND END\n" + #for i in range(0, self._duration): + # expected_output += "Suspend: {}\n".format(self._duration - i) return expected_output def __str__(self): @@ -27,19 +31,47 @@ def drive(self, usb_phy): xsi = usb_phy.xsi wait = usb_phy.wait + # xCore should not be trying to send if we are trying to send.. if xsi.sample_port_pins(usb_phy._txv) == 1: print("ERROR: Unexpected packet from xCORE") usb_phy.wait_until(xsi.get_time() + self.interEventDelay) - # Drive J state onto LS pins - xsi.drive_periph_pin(usb_phy._ls, 1) + # Drive IDLE state onto LS pins + xsi.drive_periph_pin(usb_phy._ls, USB_LINESTATE['IDLE']) + + # Within X uS device should transition to FS + clocks_min = int(usb_phy.us_to_clocks(USB_TIMINGS['IDLE_TO_FS_MIN_US'])) + clocks_max = int(usb_phy.us_to_clocks(USB_TIMINGS['IDLE_TO_FS_MAX_US'])) - duration = self._duration_clks - - while duration > 0: - print("Suspend: {0})".format(duration)) + print("SUSPEND START. WAITING FOR DUT TO ENTER FS") + + print("clocks_min: " + str(clocks_min)) + print("clocks_max: " + str(clocks_max)) + + clock_count = 0 + #for _ in range(0, clocks_max): + while True: + wait(lambda x: usb_phy._clock.is_high()) wait(lambda x: usb_phy._clock.is_low()) - duration = duraton -1 + + # TODO check other pins + if xsi.sample_port_pins(usb_phy._txv) == 1: + print("ERROR: Unexpected packet from xCORE") + + xcvr = xsi.sample_periph_pin(usb_phy._xcvrsel) + termsel = xsi.sample_periph_pin(usb_phy._termsel) + + clock_count+=1 + if xcvr == 1 and termsel == 1: + print("DEVICE ENTERED FS AFTER " + str(clock_count) + "CLOCKS (" + str(int((clock_count*usb_phy.clock.period_us))) + " uS)") + + # Drive J state onto LS pins - replicate pullup + xsi.drive_periph_pin(usb_phy._ls, USB_LINESTATE['FS_J']) + + break + + print("SUSPEND END") + From 8165bc1c1327571b76c20b88be6feea3fe29cd16 Mon Sep 17 00:00:00 2001 From: Dave Atkinson Date: Thu, 29 Apr 2021 15:35:46 +0100 Subject: [PATCH 255/520] Provide VBUS detect function. The function XUD_GetVBusState() will get the state of the VBUS detection circuit. On XS3 architecture it has weak linkage to allow it to be overridden with an application-specific version. --- lib_xud/src/core/XUD_Default.c | 20 ++++++++++++++++++++ lib_xud/src/core/XUD_DeviceAttach.xc | 9 +-------- lib_xud/src/core/XUD_HAL.h | 7 +++++++ lib_xud/src/core/XUD_HAL.xc | 3 --- lib_xud/src/core/XUD_Main.xc | 10 +++------- lib_xud/src/core/XUD_PowerSig.xc | 4 +--- 6 files changed, 32 insertions(+), 21 deletions(-) create mode 100644 lib_xud/src/core/XUD_Default.c diff --git a/lib_xud/src/core/XUD_Default.c b/lib_xud/src/core/XUD_Default.c new file mode 100644 index 00000000..75fc374d --- /dev/null +++ b/lib_xud/src/core/XUD_Default.c @@ -0,0 +1,20 @@ +// Copyright 2019-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. + +#if defined(__XS3A__) +unsigned int XUD_HAL_GetVBusState(void) __attribute__((weak)); +#endif +unsigned int XUD_HAL_GetVBusState(void) +{ +#if defined(__XS3A__) + return 1u; +#elif defined(__XS2A__) + unsigned int x; + + read_periph_word(USB_TILE_REF, XS1_GLX_PER_UIFM_CHANEND_NUM, XS1_GLX_PER_UIFM_OTG_FLAGS_NUM, x); + + return x & (1 << XS1_UIFM_OTG_FLAGS_SESSVLDB_SHIFT); +#else +#error no architecture defined +#endif +} diff --git a/lib_xud/src/core/XUD_DeviceAttach.xc b/lib_xud/src/core/XUD_DeviceAttach.xc index f884e28c..61c8cddc 100755 --- a/lib_xud/src/core/XUD_DeviceAttach.xc +++ b/lib_xud/src/core/XUD_DeviceAttach.xc @@ -94,18 +94,11 @@ int XUD_DeviceAttachHS(XUD_PwrConfig pwrConfig) #endif if(pwrConfig == XUD_PWR_SELF) { - unsigned x; -#ifdef __XS3A__ - #warning VBUS checking in failed HS handhake missing from XS3A -#else - read_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_OTG_FLAGS_NUM, x); - - if(!(x&(1< t when timerafter(time + SUSPEND_VBUS_POLL_TIMER_TICKS) :> void: - read_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_OTG_FLAGS_NUM, tmp); - if (!(tmp & (1 << XS1_SU_UIFM_OTG_FLAGS_SESSVLDB_SHIFT))) + if(!XUD_HAL_GetVBusState()) { // VBUS not valid write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_FUNC_CONTROL_NUM, 4 /* OpMode 01 */); From 908f6f15c6bacdcc1f542de5140937605d92959c Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 12 May 2021 09:24:03 +0100 Subject: [PATCH 256/520] Fix line state change handling for XS3 --- lib_xud/src/core/XUD_HAL.xc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib_xud/src/core/XUD_HAL.xc b/lib_xud/src/core/XUD_HAL.xc index ec2450fc..f4f62d5a 100644 --- a/lib_xud/src/core/XUD_HAL.xc +++ b/lib_xud/src/core/XUD_HAL.xc @@ -292,8 +292,8 @@ XUD_LineState_t XUD_HAL_GetLineState(/*XUD_HAL_t &xudHal*/) { #ifdef __XS3A__ unsigned dp, dm; - dp_port :> dp; - dm_port :> dm; + dp_port :> dp;//flag1 + dm_port :> dm;//flag0 return LinesToLineState(dp, dm); #else unsigned j, k, se0; @@ -328,8 +328,10 @@ unsigned XUD_HAL_WaitForLineStateChange(XUD_LineState_t ¤tLs, unsigned tim select { case dp_port when pinsneq(dp) :> dp: + dm_port :> dm; //Both might have changed! break; case dm_port when pinsneq(dm) :> dm: + dp_port :> dp; //Both might have changed! break; case timeout != null => t when timerafter(time + timeout) :> int _: return 1; From 2a46a3111076a487249d44052fdbc4f6021101d0 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 12 May 2021 09:42:36 +0100 Subject: [PATCH 257/520] Added guard for timing define --- lib_xud/src/core/XUD_TimingDefines.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib_xud/src/core/XUD_TimingDefines.h b/lib_xud/src/core/XUD_TimingDefines.h index cfa94509..700d8b97 100755 --- a/lib_xud/src/core/XUD_TimingDefines.h +++ b/lib_xud/src/core/XUD_TimingDefines.h @@ -27,8 +27,9 @@ #define T_FILT (T_FILT_us * REF_CLK_FREQ) #endif - -#define SUSPEND_T_WTWRSTHS_us 200 // 200us Time beforechecking for J after asserting XcvrSelect and Termselect +#ifndef SUSPEND_T_WTWRSTHS_us +#define SUSPEND_T_WTWRSTHS_us 200 // 200us Time beforechecking for J after asserting XcvrSelect and Termselect: T_WTRSTHS: 100-875us +#endif #define SUSPEND_T_WTWRSTHS (SUSPEND_T_WTWRSTHS_us * REF_CLK_FREQ) #define OUT_TIMEOUT_us 500 // How long we wait for data after OUT token From 99a45d2497ff3f4dfbc7965a7b8efb6955374232 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 12 May 2021 09:44:00 +0100 Subject: [PATCH 258/520] Changes to suspend test source --- tests/test_suspend/Makefile | 2 +- tests/test_suspend/src/main.xc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_suspend/Makefile b/tests/test_suspend/Makefile index 21270f52..6bd91548 100644 --- a/tests/test_suspend/Makefile +++ b/tests/test_suspend/Makefile @@ -1,4 +1,4 @@ -TEST_FLAGS = -DSUSPEND_TIMEOUT_us=300 +TEST_FLAGS = -DSUSPEND_TIMEOUT_us=300 -DSUSPEND_T_WTWRSTHS_us=20 include ../test_makefile.mak diff --git a/tests/test_suspend/src/main.xc b/tests/test_suspend/src/main.xc index e2f8be4c..7e4d797e 100644 --- a/tests/test_suspend/src/main.xc +++ b/tests/test_suspend/src/main.xc @@ -15,7 +15,7 @@ #endif #ifndef PKT_LENGTH_END -#define PKT_LENGTH_END 19 +#define PKT_LENGTH_END 11 #endif #ifndef TEST_EP_NUM From a80f1bb4fb4ba1c8f02868253c508a8785cc6845 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 12 May 2021 09:44:34 +0100 Subject: [PATCH 259/520] Moved createSofToken helper func --- tests/test_sof_basic.py | 14 ++----------- tests/usb_packet.py | 46 ++++++++++------------------------------- 2 files changed, 13 insertions(+), 47 deletions(-) diff --git a/tests/test_sof_basic.py b/tests/test_sof_basic.py index 4cbeac73..47d44ae9 100644 --- a/tests/test_sof_basic.py +++ b/tests/test_sof_basic.py @@ -4,21 +4,11 @@ import xmostest from usb_packet import * import usb_packet -from helpers import do_usb_test, RunUsbTest +from helpers import do_usb_test, RunUsbTest, CreateSofToken from usb_session import UsbSession from usb_transaction import UsbTransaction -# TODO ideally creation of SOF's is moved elsewhere -def CreateSofToken(frameNumber, data_valid_count, badCrc = False): - ep = (frameNumber >> 7) & 0xf - address = (frameNumber) & 0x7f - - if badCrc: - return TokenPacket(pid=USB_PID['SOF'], address=address, endpoint=ep, data_valid_count=data_valid_count, crc5=0xff) - else: - return TokenPacket(pid=USB_PID['SOF'], address=address, endpoint=ep, data_valid_count=data_valid_count) - - return sofToken + def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): diff --git a/tests/usb_packet.py b/tests/usb_packet.py index a4d5e698..541a7673 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -84,41 +84,17 @@ "NAK" : 0x5A, } -#def AppendSetupToken(packets, ep, address, **kwargs): -# ipg = kwargs.pop('inter_pkt_gap', 500) -# AppendTokenPacket(packets, 0x2d, ep, ipg, address, **kwargs) - -#def AppendOutToken(packets, ep, address, **kwargs): -# ipg = kwargs.pop('inter_pkt_gap', 500) -# AppendTokenPacket(packets, 0xe1, ep, ipg, address, **kwargs) - -#def AppendPingToken(packets, ep, address, **kwargs): -# ipg = kwargs.pop('inter_pkt_gap', 500) -# AppendTokenPacket(packets, 0xb4, ep, ipg, address, **kwargs) - -#def AppendInToken(packets, ep, address, **kwargs): - #357 was min IPG supported on bulk loopback to not nak - #lower values mean the loopback NAKs -# ipg = kwargs.pop('inter_pkt_gap', 10) -# AppendTokenPacket(packets, 0x69, ep, ipg, address, **kwargs) - -#def AppendSofToken(packets, framenumber, **kwargs): -# ipg = kwargs.pop('inter_pkt_gap', 500) +def CreateSofToken(frameNumber, data_valid_count, badCrc = False, interEventDelay=1000): + ep = (frameNumber >> 7) & 0xf + address = (frameNumber) & 0x7f + + if badCrc: + return TokenPacket(pid=USB_PID['SOF'], address=address, endpoint=ep, data_valid_count=data_valid_count, crc5=0xff, interEventDelay=interEventDelay) + else: + return TokenPacket(pid=USB_PID['SOF'], address=address, endpoint=ep, data_valid_count=data_valid_count, interEventDelay=interEventDelay) - # Override EP and Address -# ep = (framenumber >> 7) & 0xf -# address = (framenumber) & 0x7f -# AppendTokenPacket(packets, 0xa5, ep, ipg, address, **kwargs) - -#def AppendTokenPacket(packets, _pid, ep, ipg, addr=0, **kwargs): -# -# data_valid_count = kwargs.pop('data_valid_count', 0) -# packets.append(TokenPacket( -# inter_pkt_gap=ipg, -# pid=_pid, -# address=addr, -# endpoint=ep, -# data_valid_count=data_valid_count)) + return sofToken + def reflect(val, numBits): @@ -251,7 +227,7 @@ def event_count(self): return 1 def __str__(self): - return "USBPacket" + return super().__str__() + " USBPacket" def get_pid_str(self): for key, value in USB_PID.items(): From d648b8f69f13c984f5e57d1fb6ecfd8667daa84a Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 12 May 2021 09:45:03 +0100 Subject: [PATCH 260/520] Added usb to xsim tracing options --- tests/helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/helpers.py b/tests/helpers.py index 235fe4ce..5ead71f0 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -178,7 +178,7 @@ def get_sim_args(testname, clk, phy, arch='xs2'): vcd_args = '-o {0}.vcd'.format(filename) vcd_args += (' -tile tile[0] -ports -ports-detailed -instructions' - ' -functions -cycles -clock-blocks -pads -cores') + ' -functions -cycles -clock-blocks -pads -cores -usb') sim_args += ['--vcd-tracing', vcd_args] # sim_args += ['--xscope', '-offline logs/xscope.xmt'] From 0286498f3ce0cb945f5a06005d9fef4987780dc5 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 12 May 2021 11:44:40 +0100 Subject: [PATCH 261/520] Fixed test issues when XUD_BYPASS_CONNECT defines. Used timing defines. --- lib_xud/src/core/XUD_Main.xc | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index 50b8e513..497f26fe 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -27,6 +27,7 @@ void XUD_Error_hex(char errString[], int i_err); #include "XUD_DeviceAttach.h" #include "XUD_PowerSig.h" #include "XUD_HAL.h" +#include "XUD_TimingDefines.h" #if (USB_MAX_NUM_EP_IN != 16) #error USB_MAX_NUM_EP_IN must be 16! @@ -292,24 +293,24 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c /* Go into full speed mode: XcvrSelect and Term Select (and suspend) high */ XUD_HAL_EnterMode_PeripheralFullSpeed(); -//#if defined(XUD_SIM_XSIM) || defined(XUD_BYPASS_CONNECT) -#if 0 - reset = 1; -#else /* Setup flags for power signalling - i.e. J/K/SE0 line state*/ XUD_HAL_Mode_PowerSig(); if (one) { - reset = XUD_Init(); + #if defined(XUD_SIM_XSIM) || defined(XUD_BYPASS_CONNECT) + reset = 1; + #else + reset = XUD_Init(); + #endif one = 0; } else { timer t; unsigned time; t :> time; - t when timerafter(time + 20000) :> int _;// T_WTRSTHS: 100-875us + t when timerafter(time + SUSPEND_T_WTWRSTHS) :> int _;// T_WTRSTHS: 100-875us /* Sample line state and check for reset (or suspend) */ XUD_LineState_t ls = XUD_HAL_GetLineState(); @@ -317,8 +318,6 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c reset == 1; else reset = 0; - - printstr("RESET: "); printintln(reset); } /* Inspect for suspend or reset */ if(!reset) @@ -338,7 +337,6 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c /* Run user resume code */ XUD_UserResume(); } -#endif /* Test if coming back from reset or suspend */ if(reset == 1) { From d98df59728cb3ab2e505d02fdf0f2690ee25e963 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 12 May 2021 18:39:28 +0100 Subject: [PATCH 262/520] File rename --- lib_xud/src/core/{XUD_PowerSig.xc => XUD_Signalling.xc} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename lib_xud/src/core/{XUD_PowerSig.xc => XUD_Signalling.xc} (100%) diff --git a/lib_xud/src/core/XUD_PowerSig.xc b/lib_xud/src/core/XUD_Signalling.xc similarity index 100% rename from lib_xud/src/core/XUD_PowerSig.xc rename to lib_xud/src/core/XUD_Signalling.xc From 198575bb1f1d113e0d6bbc5b0724b7fda762d8fd Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 12 May 2021 18:39:43 +0100 Subject: [PATCH 263/520] Updated filename in module_build_info --- lib_xud/module_build_info | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xud/module_build_info b/lib_xud/module_build_info index a7ad4b20..38e54179 100644 --- a/lib_xud/module_build_info +++ b/lib_xud/module_build_info @@ -20,7 +20,7 @@ XCC_FLAGS_XUD_DeviceAttach.xc = $(MODULE_XCC_FLAGS) -mno-dual-issue -Wno-return- XCC_FLAGS_XUD_PhyResetUser.xc = $(MODULE_XCC_FLAGS) -mno-dual-issue XCC_FLAGS_XUD_Support.xc = $(MODULE_XCC_FLAGS) -mno-dual-issue XCC_FLAGS_XUD_IOLoopCall.xc = $(MODULE_XCC_FLAGS) -mno-dual-issue -XCC_FLAGS_XUD_PowerSig.xc = $(MODULE_XCC_FLAGS) -mno-dual-issue -Wno-return-type +XCC_FLAGS_XUD_Signalling.xc = $(MODULE_XCC_FLAGS) -mno-dual-issue -Wno-return-type XCC_FLAGS_XUD_TestMode.xc = $(MODULE_XCC_FLAGS) -mno-dual-issue XCC_FLAGS_XUD_SetCrcTableAddr.c = $(MODULE_XCC_FLAGS) -mno-dual-issue XCC_FLAGS_XUD_User.c = $(MODULE_XCC_FLAGS) -mno-dual-issue From e6b9135eb66462c00709ac53ce613134f73f9a0e Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 12 May 2021 18:40:11 +0100 Subject: [PATCH 264/520] Resolving vbus related build issue on XS2 --- lib_xud/src/core/XUD_Default.c | 10 +++++----- lib_xud/src/core/XUD_HAL.h | 5 ++++- lib_xud/src/core/XUD_HAL.xc | 9 +++++++++ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/lib_xud/src/core/XUD_Default.c b/lib_xud/src/core/XUD_Default.c index 75fc374d..426c65a4 100644 --- a/lib_xud/src/core/XUD_Default.c +++ b/lib_xud/src/core/XUD_Default.c @@ -1,19 +1,19 @@ // Copyright 2019-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. +#include "xud.h" #if defined(__XS3A__) unsigned int XUD_HAL_GetVBusState(void) __attribute__((weak)); +#else +unsigned int read_vbus(); #endif + unsigned int XUD_HAL_GetVBusState(void) { #if defined(__XS3A__) return 1u; #elif defined(__XS2A__) - unsigned int x; - - read_periph_word(USB_TILE_REF, XS1_GLX_PER_UIFM_CHANEND_NUM, XS1_GLX_PER_UIFM_OTG_FLAGS_NUM, x); - - return x & (1 << XS1_UIFM_OTG_FLAGS_SESSVLDB_SHIFT); + return read_vbus(); #else #error no architecture defined #endif diff --git a/lib_xud/src/core/XUD_HAL.h b/lib_xud/src/core/XUD_HAL.h index 11ce2143..ec0b8c7c 100644 --- a/lib_xud/src/core/XUD_HAL.h +++ b/lib_xud/src/core/XUD_HAL.h @@ -1,11 +1,14 @@ // Copyright 2019-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -#include "xud.h" + /** * @file XUD_HAL.h * \brief USB HAL Layer **/ +#include "xud.h" +#include + #ifdef __XS3A__ #include // TODO shoudl be properlty in HAL diff --git a/lib_xud/src/core/XUD_HAL.xc b/lib_xud/src/core/XUD_HAL.xc index 09d33f21..66d0525e 100644 --- a/lib_xud/src/core/XUD_HAL.xc +++ b/lib_xud/src/core/XUD_HAL.xc @@ -355,3 +355,12 @@ void XUD_HAL_SetDeviceAddress(unsigned char address) write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_DEVICE_ADDRESS_NUM, address); #endif } + +#ifdef __XS2A__ +unsigned read_vbus() +{ + unsigned int x; + read_periph_word(USB_TILE_REF, XS1_GLX_PER_UIFM_CHANEND_NUM, XS1_GLX_PER_UIFM_OTG_FLAGS_NUM, x); + return x & (1 << XS1_UIFM_OTG_FLAGS_SESSVLDB_SHIFT); +} +#endif From 03bdadf33159fe71e2665ff8d3cf260dda0847f3 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 12 May 2021 18:41:10 +0100 Subject: [PATCH 265/520] Basic Suspend/Resume test now passing on XS3 --- tests/test_suspend.py | 23 ++++--- tests/usb_event.py | 3 +- tests/usb_phy.py | 8 ++- tests/usb_signalling.py | 134 ++++++++++++++++++++++++++++++++++------ 4 files changed, 135 insertions(+), 33 deletions(-) diff --git a/tests/test_suspend.py b/tests/test_suspend.py index 8f1b2490..fdffeb88 100644 --- a/tests/test_suspend.py +++ b/tests/test_suspend.py @@ -4,10 +4,11 @@ import xmostest import usb_packet +from usb_packet import CreateSofToken from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction -from usb_signalling import UsbSuspend +from usb_signalling import UsbSuspend, UsbResume def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): @@ -15,19 +16,23 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): address = 1 start_length = 10 end_length = 12 - + pktLength = 10 + frameNumber = 52 # Note, for frame number 52 we expect A5 34 40 on the bus + session = UsbSession(bus_speed=usb_speed, run_enumeration=False, device_address = address) - pktLength = 10 session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=pktLength, interEventDelay=0)) - session.add_event(UsbSuspend(500000000000)) + + session.add_event(CreateSofToken(frameNumber, data_valid_count)) + + session.add_event(UsbSuspend(350000)) session.add_event(UsbResume()) - - #for pktLength in range(start_length, end_length+1): + + frameNumber = frameNumber + 1 + pktLength = pktLength + 1 + session.add_event(CreateSofToken(frameNumber, data_valid_count, interEventDelay=2000)) + session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=pktLength, interEventDelay=0)) - # if pktLength == start_length + 2: - # session.add_event(UsbSuspend(500000000000)) - do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) diff --git a/tests/usb_event.py b/tests/usb_event.py index 45fcc501..59067492 100644 --- a/tests/usb_event.py +++ b/tests/usb_event.py @@ -30,4 +30,5 @@ def drive(self, xsi): def eventcount(self): pass - + def __str__(self): + return "UsbEvent IED: " + str(self.interEventDelay) diff --git a/tests/usb_phy.py b/tests/usb_phy.py index c4366441..11f8a685 100644 --- a/tests/usb_phy.py +++ b/tests/usb_phy.py @@ -18,8 +18,10 @@ } USB_TIMINGS = { - 'IDLE_TO_FS_MIN_US': 3000, - 'IDLE_TO_FS_MAX_US': 3125, + 'IDLE_TO_FS_MIN_US': 300, #Spec: 3000 + 'IDLE_TO_FS_MAX_US': 312, #Spec: 3125 + 'RESUME_FSK_MIN_US': 200, #Spec: 20000us + 'RESUME_SE0_US': 1.25, # 1.25uS - 1.5uS } class UsbPhy(xmostest.SimThread): @@ -67,7 +69,7 @@ def events(self, events): self._events = events def us_to_clocks(self, time_us): - time_clocks = time_us/self._clock.period_us + time_clocks = int(time_us/self._clock.period_us) return time_clocks def start_test(self): diff --git a/tests/usb_signalling.py b/tests/usb_signalling.py index 52970177..8d42136d 100644 --- a/tests/usb_signalling.py +++ b/tests/usb_signalling.py @@ -2,25 +2,92 @@ from usb_event import UsbEvent from usb_phy import USB_LINESTATE, USB_TIMINGS +class UsbResume(UsbEvent): + + def __init__(self, duration=USB_TIMINGS["RESUME_FSK_MIN_US"], interEventDelay=0): + self._duration = duration + super().__init__(interEventDelay=interEventDelay) + + def expected_output(self, offset=0): + expected_output = "RESUME\n" + expected_output += "RESUME END\n" + expected_output += "DUT ENTERED HS MODE\n" #TODO only if was in HS pre-suspend + return expected_output + + def __str__(self): + return "UsbResume: " + str(self._duration) + + @property + def event_count(self): + return 1 + + def drive(self, usb_phy): + xsi = usb_phy.xsi + wait = usb_phy.wait + + # xCore should not be trying to send if we are trying to send.. + if xsi.sample_port_pins(usb_phy._txv) == 1: + print("ERROR: Unexpected packet from xCORE") + + resumeStartTime_ns = xsi.get_time() + + #print("RESUME: " + str(resumeStartTime_ns)) + print("RESUME") + + # Drive resume signalling + xsi.drive_periph_pin(usb_phy._ls, USB_LINESTATE['FS_K']) + + while True: + wait(lambda x: usb_phy._clock.is_high()) + wait(lambda x: usb_phy._clock.is_low()) + + currentTime_ns = xsi.get_time() + if currentTime_ns >= resumeStartTime_ns + (USB_TIMINGS["RESUME_FSK_MIN_US"]*1000): + break + + endResumeStartTime_ns = xsi.get_time() + #print("TB SE0: " + str(endResumeStartTime_ns)) + xsi.drive_periph_pin(usb_phy._ls, USB_LINESTATE['IDLE']) + + while True: + wait(lambda x: usb_phy._clock.is_high()) + wait(lambda x: usb_phy._clock.is_low()) + + currentTime_ns = xsi.get_time() + if currentTime_ns >= endResumeStartTime_ns + (USB_TIMINGS["RESUME_SE0_US"]*1000): + break; + + print("RESUME END") + #print("RESUME END: " + str(currentTime_ns)) + + # Check that the DUT has re-entered HS + xcvrsel = xsi.sample_periph_pin(usb_phy._xcvrsel) + termsel = xsi.sample_periph_pin(usb_phy._termsel) + + if xcvrsel == 1: + print("ERROR: DUT did not enter HS after resume (XCVRSel)") + + if termsel == 1: + print("ERROR: DUT did not enter HS after resume (TermSel)") + + print("DUT ENTERED HS MODE") class UsbSuspend(UsbEvent): # TODO create instance of Suspend with duracton in seconds and convert to clks? - def __init__(self, duration, interEventDelay=0): - self._duration = duration + def __init__(self, duration_ns, interEventDelay=0): + self._duration_ns = duration_ns super().__init__(interEventDelay=interEventDelay) def expected_output(self, offset = 0): expected_output = "SUSPEND START. WAITING FOR DUT TO ENTER FS\n" - expected_output += "DEVICE ENTERED FS\n" + expected_output += "DEVICE ENTERED FS MODE\n" expected_output += "SUSPEND END\n" - #for i in range(0, self._duration): - # expected_output += "Suspend: {}\n".format(self._duration - i) return expected_output def __str__(self): - return "UsbSuspend: " + str(self._duration) + return "UsbSuspend: " + str(self._duration_ns) @property def event_count(self): @@ -31,27 +98,21 @@ def drive(self, usb_phy): xsi = usb_phy.xsi wait = usb_phy.wait - # xCore should not be trying to send if we are trying to send.. if xsi.sample_port_pins(usb_phy._txv) == 1: print("ERROR: Unexpected packet from xCORE") - usb_phy.wait_until(xsi.get_time() + self.interEventDelay) + suspendStartTime_ns = xsi.get_time() + #print("SUSPEND START TIME: " + str(suspendStartTime_ns)) + + assert self.interEventDelay == 0 # Drive IDLE state onto LS pins xsi.drive_periph_pin(usb_phy._ls, USB_LINESTATE['IDLE']) # Within X uS device should transition to FS - clocks_min = int(usb_phy.us_to_clocks(USB_TIMINGS['IDLE_TO_FS_MIN_US'])) - clocks_max = int(usb_phy.us_to_clocks(USB_TIMINGS['IDLE_TO_FS_MAX_US'])) - print("SUSPEND START. WAITING FOR DUT TO ENTER FS") - print("clocks_min: " + str(clocks_min)) - print("clocks_max: " + str(clocks_max)) - - clock_count = 0 - #for _ in range(0, clocks_max): while True: wait(lambda x: usb_phy._clock.is_high()) @@ -64,14 +125,47 @@ def drive(self, usb_phy): xcvr = xsi.sample_periph_pin(usb_phy._xcvrsel) termsel = xsi.sample_periph_pin(usb_phy._termsel) - clock_count+=1 + # Wait for DUT to move into FS mode if xcvr == 1 and termsel == 1: - print("DEVICE ENTERED FS AFTER " + str(clock_count) + "CLOCKS (" + str(int((clock_count*usb_phy.clock.period_us))) + " uS)") + + fsTime_ns = xsi.get_time() + timeToFs_ns = fsTime_ns - suspendStartTime_ns + #print("DEVICE ENTERED FS AT TIME " + str(fsTime_ns/1000) + "(after " + str(timeToFs_ns/1000) +" uS)") + print("DEVICE ENTERED FS MODE"); + + if timeToFs_ns < (USB_TIMINGS["IDLE_TO_FS_MIN_US"]*1000): + print("ERROR: DUT ENTERED FS MODE TOO SOON") + exit() # Drive J state onto LS pins - replicate pullup xsi.drive_periph_pin(usb_phy._ls, USB_LINESTATE['FS_J']) - + break; + + time_ns = xsi.get_time() - suspendStartTime_ns + if time_ns > (USB_TIMINGS["IDLE_TO_FS_MAX_US"]*1000): + print("ERROR: DUT DID NOT ENTER FS MODE IN TIME") + + # Wait for end of suspend + while True: + + wait(lambda x: usb_phy._clock.is_high()) + wait(lambda x: usb_phy._clock.is_low()) + + # xCore should not be trying to send if we are trying to send.. + if xsi.sample_port_pins(usb_phy._txv) == 1: + print("ERROR: Unexpected packet from xCORE") + + xcvr = xsi.sample_periph_pin(usb_phy._xcvrsel) + termsel = xsi.sample_periph_pin(usb_phy._termsel) + + # Wait for DUT to move into FS mode + if not (xcvr == 1 and termsel == 1): + print("ERROR: DUT moved out of FS mode unexpectly during suspend") + + time_ns = xsi.get_time() - suspendStartTime_ns + if time_ns == self._duration_ns: + #print("SUSPEND END: " + str(xsi.get_time())) + print("SUSPEND END") break - print("SUSPEND END") From d5828a0268233cb3d70d7d073fa703dc53a6817a Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 13 May 2021 12:14:49 +0100 Subject: [PATCH 266/520] Test rename --- tests/{test_suspend.py => test_suspend_resume.py} | 0 tests/{test_suspend => test_suspend_resume}/LICENSE.rst | 0 tests/{test_suspend => test_suspend_resume}/Makefile | 0 tests/{test_suspend => test_suspend_resume}/src/main.xc | 0 tests/{test_suspend => test_suspend_resume}/src/xc_ptr.h | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename tests/{test_suspend.py => test_suspend_resume.py} (100%) rename tests/{test_suspend => test_suspend_resume}/LICENSE.rst (100%) rename tests/{test_suspend => test_suspend_resume}/Makefile (100%) rename tests/{test_suspend => test_suspend_resume}/src/main.xc (100%) rename tests/{test_suspend => test_suspend_resume}/src/xc_ptr.h (100%) diff --git a/tests/test_suspend.py b/tests/test_suspend_resume.py similarity index 100% rename from tests/test_suspend.py rename to tests/test_suspend_resume.py diff --git a/tests/test_suspend/LICENSE.rst b/tests/test_suspend_resume/LICENSE.rst similarity index 100% rename from tests/test_suspend/LICENSE.rst rename to tests/test_suspend_resume/LICENSE.rst diff --git a/tests/test_suspend/Makefile b/tests/test_suspend_resume/Makefile similarity index 100% rename from tests/test_suspend/Makefile rename to tests/test_suspend_resume/Makefile diff --git a/tests/test_suspend/src/main.xc b/tests/test_suspend_resume/src/main.xc similarity index 100% rename from tests/test_suspend/src/main.xc rename to tests/test_suspend_resume/src/main.xc diff --git a/tests/test_suspend/src/xc_ptr.h b/tests/test_suspend_resume/src/xc_ptr.h similarity index 100% rename from tests/test_suspend/src/xc_ptr.h rename to tests/test_suspend_resume/src/xc_ptr.h From f255ee222609910cb64f97ba7af5ca44f1ac8f9c Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 13 May 2021 12:49:08 +0100 Subject: [PATCH 267/520] Test rename --- tests/{test_suspend_resume.py => test_suspend_resume_hs.py} | 0 tests/{test_suspend_resume => test_suspend_resume_hs}/LICENSE.rst | 0 tests/{test_suspend_resume => test_suspend_resume_hs}/Makefile | 0 tests/{test_suspend_resume => test_suspend_resume_hs}/src/main.xc | 0 .../{test_suspend_resume => test_suspend_resume_hs}/src/xc_ptr.h | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename tests/{test_suspend_resume.py => test_suspend_resume_hs.py} (100%) rename tests/{test_suspend_resume => test_suspend_resume_hs}/LICENSE.rst (100%) rename tests/{test_suspend_resume => test_suspend_resume_hs}/Makefile (100%) rename tests/{test_suspend_resume => test_suspend_resume_hs}/src/main.xc (100%) rename tests/{test_suspend_resume => test_suspend_resume_hs}/src/xc_ptr.h (100%) diff --git a/tests/test_suspend_resume.py b/tests/test_suspend_resume_hs.py similarity index 100% rename from tests/test_suspend_resume.py rename to tests/test_suspend_resume_hs.py diff --git a/tests/test_suspend_resume/LICENSE.rst b/tests/test_suspend_resume_hs/LICENSE.rst similarity index 100% rename from tests/test_suspend_resume/LICENSE.rst rename to tests/test_suspend_resume_hs/LICENSE.rst diff --git a/tests/test_suspend_resume/Makefile b/tests/test_suspend_resume_hs/Makefile similarity index 100% rename from tests/test_suspend_resume/Makefile rename to tests/test_suspend_resume_hs/Makefile diff --git a/tests/test_suspend_resume/src/main.xc b/tests/test_suspend_resume_hs/src/main.xc similarity index 100% rename from tests/test_suspend_resume/src/main.xc rename to tests/test_suspend_resume_hs/src/main.xc diff --git a/tests/test_suspend_resume/src/xc_ptr.h b/tests/test_suspend_resume_hs/src/xc_ptr.h similarity index 100% rename from tests/test_suspend_resume/src/xc_ptr.h rename to tests/test_suspend_resume_hs/src/xc_ptr.h From ff78deeb78f90f461abd87397e90a103ee57c9a5 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 13 May 2021 16:39:42 +0100 Subject: [PATCH 268/520] Test rename --- tests/{test_suspend_resume_hs.py => test_suspend_resume.py} | 0 tests/{test_suspend_resume_hs => test_suspend_resume}/LICENSE.rst | 0 tests/{test_suspend_resume_hs => test_suspend_resume}/Makefile | 0 tests/{test_suspend_resume_hs => test_suspend_resume}/src/main.xc | 0 .../{test_suspend_resume_hs => test_suspend_resume}/src/xc_ptr.h | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename tests/{test_suspend_resume_hs.py => test_suspend_resume.py} (100%) rename tests/{test_suspend_resume_hs => test_suspend_resume}/LICENSE.rst (100%) rename tests/{test_suspend_resume_hs => test_suspend_resume}/Makefile (100%) rename tests/{test_suspend_resume_hs => test_suspend_resume}/src/main.xc (100%) rename tests/{test_suspend_resume_hs => test_suspend_resume}/src/xc_ptr.h (100%) diff --git a/tests/test_suspend_resume_hs.py b/tests/test_suspend_resume.py similarity index 100% rename from tests/test_suspend_resume_hs.py rename to tests/test_suspend_resume.py diff --git a/tests/test_suspend_resume_hs/LICENSE.rst b/tests/test_suspend_resume/LICENSE.rst similarity index 100% rename from tests/test_suspend_resume_hs/LICENSE.rst rename to tests/test_suspend_resume/LICENSE.rst diff --git a/tests/test_suspend_resume_hs/Makefile b/tests/test_suspend_resume/Makefile similarity index 100% rename from tests/test_suspend_resume_hs/Makefile rename to tests/test_suspend_resume/Makefile diff --git a/tests/test_suspend_resume_hs/src/main.xc b/tests/test_suspend_resume/src/main.xc similarity index 100% rename from tests/test_suspend_resume_hs/src/main.xc rename to tests/test_suspend_resume/src/main.xc diff --git a/tests/test_suspend_resume_hs/src/xc_ptr.h b/tests/test_suspend_resume/src/xc_ptr.h similarity index 100% rename from tests/test_suspend_resume_hs/src/xc_ptr.h rename to tests/test_suspend_resume/src/xc_ptr.h From bf86d4a1c3d1a5b7274b1e9884c90b21fda65170 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 13 May 2021 16:39:55 +0100 Subject: [PATCH 269/520] Removed exit() on error --- tests/usb_signalling.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/usb_signalling.py b/tests/usb_signalling.py index 8d42136d..0fdf8377 100644 --- a/tests/usb_signalling.py +++ b/tests/usb_signalling.py @@ -135,7 +135,6 @@ def drive(self, usb_phy): if timeToFs_ns < (USB_TIMINGS["IDLE_TO_FS_MIN_US"]*1000): print("ERROR: DUT ENTERED FS MODE TOO SOON") - exit() # Drive J state onto LS pins - replicate pullup xsi.drive_periph_pin(usb_phy._ls, USB_LINESTATE['FS_J']) From 350845000bdfaecee743c7055bffc66e7006eb59 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 13 May 2021 16:40:35 +0100 Subject: [PATCH 270/520] usb_phy now takes a session instead of an event list (such that it can infer bus speed) --- tests/helpers.py | 6 ++---- tests/usb_phy.py | 16 ++++++++-------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/tests/helpers.py b/tests/helpers.py index 5ead71f0..b1ac0a22 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -107,8 +107,6 @@ def do_usb_test(arch, clk, phy, usb_speed, sessions, test_file, seed, assert len(sessions) == 1, "Multiple sessions not yet supported" for session in sessions: - - events = session.events if args.verbose: print("Session " + str(sessions.index(session))) @@ -116,10 +114,10 @@ def do_usb_test(arch, clk, phy, usb_speed, sessions, test_file, seed, if xmostest.testlevel_is_at_least(xmostest.get_testlevel(), level): print("Running {test}: {arch} arch sending {n} event(s) at {clk} using {speed} (seed {seed})".format( - test=testname, n=len(events), + test=testname, n=len(session.events), arch=arch, clk=clk.get_name(), speed=usb_speed, seed=seed)) - phy.events = session.events + phy.session = session expect_folder = create_if_needed("expect") expect_filename = '{folder}/{test}_{arch}.expect'.format( diff --git a/tests/usb_phy.py b/tests/usb_phy.py index 11f8a685..00f5877a 100644 --- a/tests/usb_phy.py +++ b/tests/usb_phy.py @@ -43,7 +43,7 @@ def __init__(self, name, rxd, rxa, rxdv, rxer, txd, txv, txrdy, ls, xcvrsel, ter self._ls = ls self._xcvrsel = xcvrsel self._termsel = termsel - self._events = [] + self._session = [] self._clock = clock self._initial_delay = initial_delay self._verbose = verbose @@ -61,12 +61,12 @@ def clock(self): return self._clock @property - def events(self): - return self._events + def session(self): + return self._session - @events.setter - def events(self, events): - self._events = events + @session.setter + def session(self, session): + self._session = session def us_to_clocks(self, time_us): time_clocks = int(time_us/self._clock.period_us) @@ -93,7 +93,7 @@ def end_test(self): if self._expect_loopback: # If looping back then take into account all the data - total_packet_bytes = sum([len(packet.get_bytes()) for packet in self.events]) + total_packet_bytes = sum([len(packet.get_bytes()) for packet in self._session.events]) total_data_bits = total_packet_bytes * 8 # Allow 2 cycles per bit @@ -129,7 +129,7 @@ def run(self): self.start_test() - for i,event in enumerate(self.events): + for i,event in enumerate(self._session.events): event.drive(self) From 6dcf332fc9e4a6d263a1230e3a0b4642a3acc73c Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 13 May 2021 17:05:04 +0100 Subject: [PATCH 271/520] Drive functions now take bus_speed arg --- tests/usb_event.py | 2 +- tests/usb_packet.py | 4 ++-- tests/usb_phy.py | 2 +- tests/usb_signalling.py | 26 ++++++++++++++------------ tests/usb_transaction.py | 4 ++-- 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/tests/usb_event.py b/tests/usb_event.py index 59067492..910bdfe7 100644 --- a/tests/usb_event.py +++ b/tests/usb_event.py @@ -22,7 +22,7 @@ def expected_output(self, offset = 0): # Drive event to simulator @abc.abstractmethod - def drive(self, xsi): + def drive(self, usb_phy, bus_speed): pass #Note, an event might contain events diff --git a/tests/usb_packet.py b/tests/usb_packet.py index 541a7673..19a56e2f 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -255,7 +255,7 @@ def expected_output(self, offset=0): return expected_output - def drive(self, usb_phy): + def drive(self, usb_phy, bus_speed): wait = usb_phy.wait xsi = usb_phy.xsi @@ -332,7 +332,7 @@ def expected_output(self, offset=0): expected_output += "\tPID: {} ({:#x})\n".format(self.get_pid_str(), self.pid) return expected_output - def drive(self, usb_phy, verbose = True): + def drive(self, usb_phy, bus_speed, verbose = True): xsi = usb_phy.xsi wait = usb_phy.wait diff --git a/tests/usb_phy.py b/tests/usb_phy.py index 00f5877a..7f26df39 100644 --- a/tests/usb_phy.py +++ b/tests/usb_phy.py @@ -131,7 +131,7 @@ def run(self): for i,event in enumerate(self._session.events): - event.drive(self) + event.drive(self, xsi, self._session.bus_speed) print("Test done") self.end_test() diff --git a/tests/usb_signalling.py b/tests/usb_signalling.py index 0fdf8377..d26e2ad4 100644 --- a/tests/usb_signalling.py +++ b/tests/usb_signalling.py @@ -21,7 +21,7 @@ def __str__(self): def event_count(self): return 1 - def drive(self, usb_phy): + def drive(self, usb_phy, bus_speed): xsi = usb_phy.xsi wait = usb_phy.wait @@ -60,17 +60,18 @@ def drive(self, usb_phy): print("RESUME END") #print("RESUME END: " + str(currentTime_ns)) - # Check that the DUT has re-entered HS - xcvrsel = xsi.sample_periph_pin(usb_phy._xcvrsel) - termsel = xsi.sample_periph_pin(usb_phy._termsel) + if bus_speed == "HS": + # Check that the DUT has re-entered HS + xcvrsel = xsi.sample_periph_pin(usb_phy._xcvrsel) + termsel = xsi.sample_periph_pin(usb_phy._termsel) - if xcvrsel == 1: - print("ERROR: DUT did not enter HS after resume (XCVRSel)") + if xcvrsel == 1: + print("ERROR: DUT did not enter HS after resume (XCVRSel)") - if termsel == 1: - print("ERROR: DUT did not enter HS after resume (TermSel)") + if termsel == 1: + print("ERROR: DUT did not enter HS after resume (TermSel)") - print("DUT ENTERED HS MODE") + print("DUT ENTERED HS MODE") class UsbSuspend(UsbEvent): @@ -93,7 +94,7 @@ def __str__(self): def event_count(self): return 1 - def drive(self, usb_phy): + def drive(self, usb_phy, bus_speed): xsi = usb_phy.xsi wait = usb_phy.wait @@ -133,8 +134,9 @@ def drive(self, usb_phy): #print("DEVICE ENTERED FS AT TIME " + str(fsTime_ns/1000) + "(after " + str(timeToFs_ns/1000) +" uS)") print("DEVICE ENTERED FS MODE"); - if timeToFs_ns < (USB_TIMINGS["IDLE_TO_FS_MIN_US"]*1000): - print("ERROR: DUT ENTERED FS MODE TOO SOON") + if bus_speed == "HS": + if timeToFs_ns < (USB_TIMINGS["IDLE_TO_FS_MIN_US"]*1000): + print("ERROR: DUT ENTERED FS MODE TOO SOON") # Drive J state onto LS pins - replicate pullup xsi.drive_periph_pin(usb_phy._ls, USB_LINESTATE['FS_J']) diff --git a/tests/usb_transaction.py b/tests/usb_transaction.py index e7ec2b1f..75c36423 100644 --- a/tests/usb_transaction.py +++ b/tests/usb_transaction.py @@ -151,7 +151,7 @@ def __str__(self): s += "\t" + str(p) + "\n" return s - def drive(self, xsi): + def drive(self, usb_phy, bus_speed): for i, p in enumerate(self.packets): - p.drive(xsi) + p.drive(usb_phy, bus_speed) From edba750bec971f42562b8a72c70752c3eeeb2963 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 13 May 2021 17:05:41 +0100 Subject: [PATCH 272/520] Removed dead test code --- tests/test_bulk_rx_basic_badcrc32/src/main.xc | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tests/test_bulk_rx_basic_badcrc32/src/main.xc b/tests/test_bulk_rx_basic_badcrc32/src/main.xc index a85c6ed0..071d7a93 100644 --- a/tests/test_bulk_rx_basic_badcrc32/src/main.xc +++ b/tests/test_bulk_rx_basic_badcrc32/src/main.xc @@ -39,13 +39,6 @@ int TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_out_0) for(int i = 10; i <= 14; i++) { - /* Expect bad CRC */ - //if(i == 12) - //unsafe{ - // g_rxDataCheck[epNum]+=12; - // continue; - //} - XUD_GetBuffer(ep_out, buffer, length); if(length != i) From 7bc0dff9a339552ee69f0d4c230421095f416289 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 13 May 2021 17:07:51 +0100 Subject: [PATCH 273/520] Added USB_MAX_EP_ADDRESS --- tests/test_bulk_rx_traffic.py | 7 ++++--- tests/usb_phy.py | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/test_bulk_rx_traffic.py b/tests/test_bulk_rx_traffic.py index 47c6f752..d57baba2 100644 --- a/tests/test_bulk_rx_traffic.py +++ b/tests/test_bulk_rx_traffic.py @@ -7,6 +7,7 @@ from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +from usb_phy import MAX_ENDPOINT_ADDRESS def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): @@ -16,7 +17,7 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): trafficAddress1 = 0; trafficAddress2 = 127; - trafficEp1 = 15; + trafficEp1 = USB_MAX_EP_ADDRESS; trafficEp2 = 0; session = UsbSession(bus_speed = usb_speed, run_enumeration = False, device_address = address) @@ -34,10 +35,10 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): trafficEp1 = trafficEp1 - 1 if(trafficEp1 < 0): - trafficEp1 = 15 + trafficEp1 = USB_MAX_EP_ADDRESS trafficEp2 + trafficEp2 + 1 - if(trafficEp1 > 15): + if(trafficEp1 > USB_MAX_EP_ADDRESS): trafficEp1 = 0 do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) diff --git a/tests/usb_phy.py b/tests/usb_phy.py index e3b5eb78..97e97820 100644 --- a/tests/usb_phy.py +++ b/tests/usb_phy.py @@ -7,6 +7,8 @@ from usb_packet import RxPacket, TokenPacket, USB_PID import usb_packet +USB_MAX_EP_ADDRESS = 15 + USB_DATA_VALID_COUNT = {'FS': 39, "HS": 0} class UsbPhy(xmostest.SimThread): From 871fc0af1a7a36da4c8df5665570e9cf6baa658c Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 13 May 2021 17:11:11 +0100 Subject: [PATCH 274/520] Removed old commented out code --- tests/usb_packet.py | 37 ------------------------------------- 1 file changed, 37 deletions(-) diff --git a/tests/usb_packet.py b/tests/usb_packet.py index a4d5e698..6d288eef 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -84,42 +84,6 @@ "NAK" : 0x5A, } -#def AppendSetupToken(packets, ep, address, **kwargs): -# ipg = kwargs.pop('inter_pkt_gap', 500) -# AppendTokenPacket(packets, 0x2d, ep, ipg, address, **kwargs) - -#def AppendOutToken(packets, ep, address, **kwargs): -# ipg = kwargs.pop('inter_pkt_gap', 500) -# AppendTokenPacket(packets, 0xe1, ep, ipg, address, **kwargs) - -#def AppendPingToken(packets, ep, address, **kwargs): -# ipg = kwargs.pop('inter_pkt_gap', 500) -# AppendTokenPacket(packets, 0xb4, ep, ipg, address, **kwargs) - -#def AppendInToken(packets, ep, address, **kwargs): - #357 was min IPG supported on bulk loopback to not nak - #lower values mean the loopback NAKs -# ipg = kwargs.pop('inter_pkt_gap', 10) -# AppendTokenPacket(packets, 0x69, ep, ipg, address, **kwargs) - -#def AppendSofToken(packets, framenumber, **kwargs): -# ipg = kwargs.pop('inter_pkt_gap', 500) - - # Override EP and Address -# ep = (framenumber >> 7) & 0xf -# address = (framenumber) & 0x7f -# AppendTokenPacket(packets, 0xa5, ep, ipg, address, **kwargs) - -#def AppendTokenPacket(packets, _pid, ep, ipg, addr=0, **kwargs): -# -# data_valid_count = kwargs.pop('data_valid_count', 0) -# packets.append(TokenPacket( -# inter_pkt_gap=ipg, -# pid=_pid, -# address=addr, -# endpoint=ep, -# data_valid_count=data_valid_count)) - def reflect(val, numBits): valRef = 0; @@ -344,7 +308,6 @@ def drive(self, usb_phy): class TxPacket(UsbPacket): def __init__(self, **kwargs): - #self.inter_pkt_gap = kwargs.pop('inter_pkt_gap', RX_RX_DELAY) #13 lowest working for single issue loopback self.rxa_start_delay = kwargs.pop('rxa_start_delay', 2) self.rxa_end_delay = kwargs.pop('rxa_end_delay', RXA_END_DELAY) self.rxe_assert_time = kwargs.pop('rxe_assert_time', 0) From dc9219028dbe35b973b6096b60dbfff9de7eef78 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 13 May 2021 17:14:19 +0100 Subject: [PATCH 275/520] Removed commented out code and added TODO comment for XS2 --- tests/usb_packet.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/usb_packet.py b/tests/usb_packet.py index 6d288eef..fcdb8f47 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -483,10 +483,7 @@ def __init__(self, **kwargs): # Correct crc5 can be overridden self.crc5 = kwargs.pop('crc5', crc5) - # Always override to match IFM - # Only required for < XS3? - #self.data_valid_count = 4 #todo - #self.data_valid_count = 0 + # TODO Always override data_valid count to match IFM for archs < XS3 def get_bytes(self, do_tokens=False): bytes = [] From 17dba1d89756e9e478763c5b730342e073e82370 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 13 May 2021 17:15:04 +0100 Subject: [PATCH 276/520] Removed more commented out test code --- tests/usb_transaction.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/usb_transaction.py b/tests/usb_transaction.py index e7ec2b1f..a4ac3793 100644 --- a/tests/usb_transaction.py +++ b/tests/usb_transaction.py @@ -69,10 +69,6 @@ def __init__(self, session, deviceAddress = 0, endpointNumber = 0, endpointType self._packets.extend(packets) - #if resend: - # Add again.. - # self._packets.extend(packets) - else: self._packets.append(TokenPacket(interEventDelay = interEventDelay, From 75c013173ddd4065890399d062878b8d9bdf057a Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 13 May 2021 22:04:44 +0100 Subject: [PATCH 277/520] Auto formatted python test code with black --- .../host/usbtmc_test.py | 13 +- python/setup.py | 7 +- tests/helpers.py | 267 +++++++----- tests/runtests.py | 54 ++- tests/test_bulk_loopback.py | 71 +++- tests/test_bulk_rx_basic.py | 38 +- tests/test_bulk_rx_basic_badcrc32.py | 102 ++++- tests/test_bulk_rx_basic_badpid.py | 88 +++- tests/test_bulk_rx_basic_nodata.py | 41 +- tests/test_bulk_rx_basic_rxerror.py | 116 ++++- tests/test_bulk_rx_multiep.py | 69 ++- tests/test_bulk_rx_traffic.py | 81 +++- tests/test_bulk_tx_badack.py | 59 ++- tests/test_bulk_tx_basic.py | 34 +- tests/test_bulk_tx_basic_short.py | 37 +- tests/test_bulk_tx_multiep.py | 71 +++- tests/test_bulk_tx_noack.py | 51 ++- tests/test_control_basic_get.py | 81 +++- tests/test_control_basic_set.py | 81 +++- tests/test_invalidtoken.py | 139 +++++- tests/test_iso_loopback.py | 70 ++- tests/test_iso_rx_basic.py | 38 +- tests/test_iso_rxtx_fastpacket.py | 49 ++- tests/test_iso_tx_basic.py | 34 +- tests/test_ping_rx_basic.py | 146 ++++++- tests/test_shorttoken.py | 56 ++- tests/test_sof_badcrc.py | 91 +++- tests/test_sof_basic.py | 61 ++- tests/test_suspend_resume.py | 60 ++- tests/usb_clock.py | 19 +- tests/usb_event.py | 17 +- tests/usb_packet.py | 397 ++++++++++-------- tests/usb_phy.py | 82 ++-- tests/usb_phy_shim.py | 125 +++--- tests/usb_phy_utmi.py | 51 ++- tests/usb_session.py | 40 +- tests/usb_signalling.py | 112 ++--- tests/usb_transaction.py | 146 ++++--- 38 files changed, 2292 insertions(+), 802 deletions(-) diff --git a/examples/AN00135_test_and_measurement_class/host/usbtmc_test.py b/examples/AN00135_test_and_measurement_class/host/usbtmc_test.py index 84a48ac4..b5190dc6 100644 --- a/examples/AN00135_test_and_measurement_class/host/usbtmc_test.py +++ b/examples/AN00135_test_and_measurement_class/host/usbtmc_test.py @@ -5,27 +5,28 @@ import usb.util # Find XMOS USBTMC test device -dev = usb.core.find(idVendor=0x20b1, idProduct=0x2337) +dev = usb.core.find(idVendor=0x20B1, idProduct=0x2337) import usbtmc -instr = usbtmc.Instrument(0x20b1, 0x2337) + +instr = usbtmc.Instrument(0x20B1, 0x2337) # Test SCPI commands # ------------------ -print('Starting basic SCPI commands testing...') -print ('') +print("Starting basic SCPI commands testing...") +print("") # Request device identification details print(instr.ask("*IDN?")) # Reset device; this command is not implemented! print(instr.ask("*RST")) -print ('') +print("") # Fetch DC voltage value from the device print(instr.ask("*MEASure:VOLTage:DC?")) -print('Exiting...') +print("Exiting...") diff --git a/python/setup.py b/python/setup.py index 9ed8aa32..78c9b74f 100644 --- a/python/setup.py +++ b/python/setup.py @@ -10,11 +10,10 @@ # least the same minor version as specified in the requirements.txt file. # The same modules should appear in the requirements.txt file as given below. setuptools.setup( - name='lib_xud', + name="lib_xud", packages=setuptools.find_packages(), install_requires=[ - 'flake8~=3.8', - ], - dependency_links=[ + "flake8~=3.8", ], + dependency_links=[], ) diff --git a/tests/helpers.py b/tests/helpers.py index b1ac0a22..cfb37ca1 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -14,93 +14,131 @@ args = None -ARCHITECTURE_CHOICES = ['xs2', 'xs3'] -BUSSPEED_CHOICES = ['FS', 'HS'] +ARCHITECTURE_CHOICES = ["xs2", "xs3"] +BUSSPEED_CHOICES = ["FS", "HS"] + def create_if_needed(folder): if not os.path.exists(folder): os.makedirs(folder) return folder -def get_usb_clk_phy(verbose=True, test_ctrl=None, do_timeout=True, - complete_fn=None, expect_loopback=False, - dut_exit_time=350000, arch='xs2'): - - if arch=='xs2': - clk = Clock('XS1_USB_CLK', Clock.CLK_60MHz) - phy = UsbPhyUtmi('XS1_USB_RXD', - 'XS1_USB_RXA', #rxa - 'XS1_USB_RXV', #rxv - 'XS1_USB_RXE', #rxe - 'tile[0]:XS1_PORT_8A', #txd - 'tile[0]:XS1_PORT_1K', #txv - 'tile[0]:XS1_PORT_1H', #txrdy - 'XS1_USB_LS', - 'XS1_USB_XCVRSEL', - 'XS1_USB_TERMSEL', - clk, - verbose=verbose, test_ctrl=test_ctrl, - do_timeout=do_timeout, complete_fn=complete_fn, - expect_loopback=expect_loopback, - dut_exit_time=dut_exit_time) - - elif arch=='xs3': - clk = Clock('XS1_USB_CLK', Clock.CLK_60MHz) - phy = UsbPhyUtmi('XS1_USB_RXD', - 'XS1_USB_RXA', #rxa - 'XS1_USB_RXV', #rxv - 'XS1_USB_RXE', #rxe - 'tile[0]:XS1_PORT_8A', #txd - 'tile[0]:XS1_PORT_1K', #txv - 'tile[0]:XS1_PORT_1H', #txrdy - 'XS1_USB_LS', - 'XS1_USB_XCVRSEL', - 'XS1_USB_TERMSEL', - clk, - verbose=verbose, test_ctrl=test_ctrl, - do_timeout=do_timeout, complete_fn=complete_fn, - expect_loopback=expect_loopback, - dut_exit_time=dut_exit_time) + +def get_usb_clk_phy( + verbose=True, + test_ctrl=None, + do_timeout=True, + complete_fn=None, + expect_loopback=False, + dut_exit_time=350000, + arch="xs2", +): + + if arch == "xs2": + clk = Clock("XS1_USB_CLK", Clock.CLK_60MHz) + phy = UsbPhyUtmi( + "XS1_USB_RXD", + "XS1_USB_RXA", # rxa + "XS1_USB_RXV", # rxv + "XS1_USB_RXE", # rxe + "tile[0]:XS1_PORT_8A", # txd + "tile[0]:XS1_PORT_1K", # txv + "tile[0]:XS1_PORT_1H", # txrdy + "XS1_USB_LS", + "XS1_USB_XCVRSEL", + "XS1_USB_TERMSEL", + clk, + verbose=verbose, + test_ctrl=test_ctrl, + do_timeout=do_timeout, + complete_fn=complete_fn, + expect_loopback=expect_loopback, + dut_exit_time=dut_exit_time, + ) + + elif arch == "xs3": + clk = Clock("XS1_USB_CLK", Clock.CLK_60MHz) + phy = UsbPhyUtmi( + "XS1_USB_RXD", + "XS1_USB_RXA", # rxa + "XS1_USB_RXV", # rxv + "XS1_USB_RXE", # rxe + "tile[0]:XS1_PORT_8A", # txd + "tile[0]:XS1_PORT_1K", # txv + "tile[0]:XS1_PORT_1H", # txrdy + "XS1_USB_LS", + "XS1_USB_XCVRSEL", + "XS1_USB_TERMSEL", + clk, + verbose=verbose, + test_ctrl=test_ctrl, + do_timeout=do_timeout, + complete_fn=complete_fn, + expect_loopback=expect_loopback, + dut_exit_time=dut_exit_time, + ) else: raise ValueError("Invalid architecture: " + arch) - + return (clk, phy) + def run_on(**kwargs): if not args: return True - for name,value in kwargs.items(): - arg_value = getattr(args,name) + for name, value in kwargs.items(): + arg_value = getattr(args, name) if arg_value is not None and value != arg_value: return False return True + def RunUsbTest(test_fn): - + seed = args.seed if args.seed else random.randint(0, sys.maxsize) - data_valid_count = {'FS': 39, "HS": 0} + data_valid_count = {"FS": 39, "HS": 0} for _arch in ARCHITECTURE_CHOICES: for _busspeed in BUSSPEED_CHOICES: if run_on(arch=_arch): if run_on(busspeed=_busspeed): (clk_60, usb_phy) = get_usb_clk_phy(verbose=False, arch=_arch) - test_fn(_arch, clk_60, usb_phy, USB_DATA_VALID_COUNT[_busspeed], _busspeed, seed, verbose=args.verbose) - -def do_usb_test(arch, clk, phy, usb_speed, sessions, test_file, seed, - level='nightly', extra_tasks=[], verbose=False): - - """ Shared test code for all RX tests using the test_rx application. - """ - testname,extension = os.path.splitext(os.path.basename(test_file)) + test_fn( + _arch, + clk_60, + usb_phy, + USB_DATA_VALID_COUNT[_busspeed], + _busspeed, + seed, + verbose=args.verbose, + ) + + +def do_usb_test( + arch, + clk, + phy, + usb_speed, + sessions, + test_file, + seed, + level="nightly", + extra_tasks=[], + verbose=False, +): + + """Shared test code for all usb tests.""" + testname, extension = os.path.splitext(os.path.basename(test_file)) resources = xmostest.request_resource("xsim") - binary = '{testname}/bin/{arch}/{testname}_{arch}.xe'.format(testname=testname, arch=arch) + binary = "{testname}/bin/{arch}/{testname}_{arch}.xe".format( + testname=testname, arch=arch + ) print(binary) @@ -113,91 +151,120 @@ def do_usb_test(arch, clk, phy, usb_speed, sessions, test_file, seed, print(str(session)) if xmostest.testlevel_is_at_least(xmostest.get_testlevel(), level): - print("Running {test}: {arch} arch sending {n} event(s) at {clk} using {speed} (seed {seed})".format( - test=testname, n=len(session.events), - arch=arch, clk=clk.get_name(), speed=usb_speed, seed=seed)) + print( + "Running {test}: {arch} arch sending {n} event(s) at {clk} using {speed} (seed {seed})".format( + test=testname, + n=len(session.events), + arch=arch, + clk=clk.get_name(), + speed=usb_speed, + seed=seed, + ) + ) phy.session = session expect_folder = create_if_needed("expect") - expect_filename = '{folder}/{test}_{arch}.expect'.format( - folder=expect_folder, test=testname, phy=phy.name, clk=clk.get_name(), arch=arch) - - create_expect(arch, session.events, expect_filename, verbose=verbose) - - tester = xmostest.ComparisonTester(open(expect_filename), - 'lib_xud', 'xud_sim_tests', testname, - {'clk':clk.get_name(), 'arch':arch, 'speed':usb_speed}) + expect_filename = "{folder}/{test}_{arch}.expect".format( + folder=expect_folder, + test=testname, + phy=phy.name, + clk=clk.get_name(), + arch=arch, + ) + + create_expect(arch, session, expect_filename, verbose=verbose) + + tester = xmostest.ComparisonTester( + open(expect_filename), + "lib_xud", + "xud_sim_tests", + testname, + {"clk": clk.get_name(), "arch": arch, "speed": usb_speed}, + ) tester.set_min_testlevel(level) simargs = get_sim_args(testname, clk, phy, arch) - xmostest.run_on_simulator(resources['xsim'], binary, - simthreads=[clk, phy] + extra_tasks, - tester=tester, - simargs=simargs) + xmostest.run_on_simulator( + resources["xsim"], + binary, + simthreads=[clk, phy] + extra_tasks, + tester=tester, + simargs=simargs, + ) + + +def create_expect(arch, session, filename, verbose=False): + + events = session.events -def create_expect(arch, events, filename, verbose = False): - """ Create the expect file for what packets should be reported by the DUT """ - with open(filename, 'w') as f: - + with open(filename, "w") as f: + packet_offset = 0 - + if verbose: print("EXPECTED OUTPUT:") for i, event in enumerate(events): - - expect_str = event.expected_output(offset = packet_offset) + + expect_str = event.expected_output(session.bus_speed, offset=packet_offset) packet_offset += event.event_count - + if verbose: - print(str(expect_str), end=' ') - + print(str(expect_str), end=" ") + f.write(str(expect_str)) - + f.write("Test done\n") if verbose: print("Test done\n") -def get_sim_args(testname, clk, phy, arch='xs2'): + +def get_sim_args(testname, clk, phy, arch="xs2"): sim_args = [] if args and args.trace: log_folder = create_if_needed("logs") filename = "{log}/xsim_trace_{test}_{clk}_{arch}".format( - log=log_folder, test=testname, - clk=clk.get_name(), phy=phy.name, arch=arch) + log=log_folder, test=testname, clk=clk.get_name(), phy=phy.name, arch=arch + ) - sim_args += ['--trace-to', '{0}.txt'.format(filename), '--enable-fnop-tracing'] + sim_args += ["--trace-to", "{0}.txt".format(filename), "--enable-fnop-tracing"] - vcd_args = '-o {0}.vcd'.format(filename) - vcd_args += (' -tile tile[0] -ports -ports-detailed -instructions' - ' -functions -cycles -clock-blocks -pads -cores -usb') + vcd_args = "-o {0}.vcd".format(filename) + vcd_args += ( + " -tile tile[0] -ports -ports-detailed -instructions" + " -functions -cycles -clock-blocks -pads -cores -usb" + ) - sim_args += ['--vcd-tracing', vcd_args] -# sim_args += ['--xscope', '-offline logs/xscope.xmt'] + sim_args += ["--vcd-tracing", vcd_args] + # sim_args += ['--xscope', '-offline logs/xscope.xmt'] return sim_args + def packet_processing_time(phy, data_bytes): - """ Returns the time it takes the DUT to process a given frame - """ + """Returns the time it takes the DUT to process a given frame""" return 6000 * phy.clock.get_bit_time() + def choose_small_frame_size(rand): - """ Choose the size of a frame near the minimum size frame (46 data bytes) - """ + """Choose the size of a frame near the minimum size frame (46 data bytes)""" return rand.randint(46, 54) + def move_to_next_valid_packet(phy): - while (phy.expect_packet_index < phy.num_expected_packets and - phy.expected_packets[phy.expect_packet_index].dropped): + while ( + phy.expect_packet_index < phy.num_expected_packets + and phy.expected_packets[phy.expect_packet_index].dropped + ): phy.expect_packet_index += 1 + def check_received_packet(packet, phy): if phy.expected_packets is None: return @@ -207,8 +274,11 @@ def check_received_packet(packet, phy): if phy.expect_packet_index < phy.num_expected_packets: expected = phy.expected_packets[phy.expect_packet_index] if packet != expected: - print("ERROR: packet {n} does not match expected packet".format( - n=phy.expect_packet_index)) + print( + "ERROR: packet {n} does not match expected packet".format( + n=phy.expect_packet_index + ) + ) print("Received:") sys.stdout.write(packet.dump()) @@ -230,4 +300,3 @@ def check_received_packet(packet, phy): if phy.expect_packet_index >= phy.num_expected_packets: print("Test done") phy.xsi.terminate() - diff --git a/tests/runtests.py b/tests/runtests.py index cfceda42..56a2924d 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -11,12 +11,16 @@ XN_FILES = ["test_xs2.xn", "test_xs3.xn"] -def list_test_dirs(args, path = ".", pattern = '^test_*'): + +def list_test_dirs(args, path=".", pattern="^test_*"): dirs = os.listdir(path) test_dirs = [dir for dir in dirs if os.path.isdir(dir) and re.match(pattern, dir)] return test_dirs -def copy_common_xn_files(args, path = ".", common_dir = "shared_src", source_dir = "src", xn_files = XN_FILES): + +def copy_common_xn_files( + args, path=".", common_dir="shared_src", source_dir="src", xn_files=XN_FILES +): test_dirs = list_test_dirs(args, path) for test_dir in test_dirs: src_dir = os.path.join(test_dir, source_dir) @@ -24,7 +28,8 @@ def copy_common_xn_files(args, path = ".", common_dir = "shared_src", source_dir xn = os.path.join(common_dir, xn_file) shutil.copy(xn, src_dir) -def delete_test_specific_xn_files(args, path = ".", source_dir = "src", xn_files = XN_FILES): + +def delete_test_specific_xn_files(args, path=".", source_dir="src", xn_files=XN_FILES): test_dirs = list_test_dirs(args, path) for test_dir in test_dirs: src_dir = os.path.join(test_dir, source_dir) @@ -32,32 +37,48 @@ def delete_test_specific_xn_files(args, path = ".", source_dir = "src", xn_files xn = os.path.join(src_dir, xn_file) os.remove(xn) + def prologue(args): copy_common_xn_files(args) + def epilogue(args): delete_test_specific_xn_files(args) - if __name__ == "__main__": global trace argparser = argparse.ArgumentParser(description="XMOS lib_xud tests") - argparser.add_argument('--trace', action='store_true', help='Run tests with simulator and VCD traces') - argparser.add_argument('--arch', choices=ARCHITECTURE_CHOICES, type=str, help='Run tests only on specified xcore architecture') - argparser.add_argument('--seed', type=int, help='The seed', default=None) - argparser.add_argument('--verbose', action='store_true', help='Enable verbose tracing in the phy') - argparser.add_argument('--busspeed', choices=BUSSPEED_CHOICES, type=str, help='Speed of USB to run test at') - + argparser.add_argument( + "--trace", action="store_true", help="Run tests with simulator and VCD traces" + ) + argparser.add_argument( + "--arch", + choices=ARCHITECTURE_CHOICES, + type=str, + help="Run tests only on specified xcore architecture", + ) + argparser.add_argument("--seed", type=int, help="The seed", default=None) + argparser.add_argument( + "--verbose", action="store_true", help="Enable verbose tracing in the phy" + ) + argparser.add_argument( + "--busspeed", + choices=BUSSPEED_CHOICES, + type=str, + help="Speed of USB to run test at", + ) + helpers.args = xmostest.init(argparser) prologue(helpers.args) try: - xmostest.register_group("lib_xud", - "xud_sim_tests", - "XUD simulator tests", - """ + xmostest.register_group( + "lib_xud", + "xud_sim_tests", + "XUD simulator tests", + """ #Tests are performed by running the GPIO library connected to a simulator model #(written as a python plugin to xsim). The simulator model checks that the pins #are driven and read by the ports as expected. Tests are run to test the @@ -72,8 +93,9 @@ def epilogue(args): # * Outputting on a multibit port with multiple clients using the default pin map # * Outputting on a multibit port with multiple clients using a specified pin map # * Outputting with timestamps -#""") -#''' +#""", + ) + #''' xmostest.runtests() xmostest.finish() diff --git a/tests/test_bulk_loopback.py b/tests/test_bulk_loopback.py index d0aa4e1b..65a72462 100644 --- a/tests/test_bulk_loopback.py +++ b/tests/test_bulk_loopback.py @@ -2,33 +2,84 @@ # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. import xmostest -from usb_packet import * +from usb_packet import * import usb_packet from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction + def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): - + ep_loopback = 3 ep_loopback_kill = 2 address = 1 start_length = 10 end_length = 20 - session = UsbSession(bus_speed = usb_speed, run_enumeration = False, device_address = address) + session = UsbSession( + bus_speed=usb_speed, run_enumeration=False, device_address=address + ) # TODO randomise packet lengths and data - for pktLength in range(start_length, end_length+1): - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep_loopback, endpointType="BULK", direction= "OUT", dataLength=pktLength)) - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep_loopback, endpointType="BULK", direction= "IN", dataLength=pktLength)) + for pktLength in range(start_length, end_length + 1): + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep_loopback, + endpointType="BULK", + direction="OUT", + dataLength=pktLength, + ) + ) + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep_loopback, + endpointType="BULK", + direction="IN", + dataLength=pktLength, + ) + ) pktLength = start_length - #Loopback and die.. - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep_loopback_kill, endpointType="BULK", direction= "OUT", dataLength=pktLength)) - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep_loopback_kill, endpointType="BULK", direction= "IN", dataLength=pktLength)) + # Loopback and die.. + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep_loopback_kill, + endpointType="BULK", + direction="OUT", + dataLength=pktLength, + ) + ) + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep_loopback_kill, + endpointType="BULK", + direction="IN", + dataLength=pktLength, + ) + ) + + do_usb_test( + arch, + clk, + phy, + usb_speed, + [session], + __file__, + seed, + level="smoke", + extra_tasks=[], + verbose=verbose, + ) - do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) def runtest(): RunUsbTest(do_test) diff --git a/tests/test_bulk_rx_basic.py b/tests/test_bulk_rx_basic.py index 83ed8691..d7de96dd 100644 --- a/tests/test_bulk_rx_basic.py +++ b/tests/test_bulk_rx_basic.py @@ -3,25 +3,49 @@ # This Software is subject to the terms of the XMOS Public Licence: Version 1. import xmostest -from usb_packet import * +from usb_packet import * import usb_packet from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction + def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): - + ep = 1 address = 1 start_length = 10 end_length = 19 - - session = UsbSession(bus_speed=usb_speed, run_enumeration=False, device_address = address) - for pktLength in range(10, end_length+1): - session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=pktLength)) + session = UsbSession( + bus_speed=usb_speed, run_enumeration=False, device_address=address + ) + + for pktLength in range(10, end_length + 1): + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=pktLength, + ) + ) + + do_usb_test( + arch, + clk, + phy, + usb_speed, + [session], + __file__, + seed, + level="smoke", + extra_tasks=[], + verbose=verbose, + ) - do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) def runtest(): RunUsbTest(do_test) diff --git a/tests/test_bulk_rx_basic_badcrc32.py b/tests/test_bulk_rx_basic_badcrc32.py index 7f0268aa..e5390721 100644 --- a/tests/test_bulk_rx_basic_badcrc32.py +++ b/tests/test_bulk_rx_basic_badcrc32.py @@ -2,40 +2,114 @@ # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. import xmostest -from usb_packet import * +from usb_packet import * import usb_packet from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction + def test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): - + address = 1 ep = 1 # The large inter-event delays are to give the DUT time to do checking on the fly - - session = UsbSession(bus_speed = usb_speed, run_enumeration = False, device_address = address) - + + session = UsbSession( + bus_speed=usb_speed, run_enumeration=False, device_address=address + ) + # Valid OUT transaction - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=10)) + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=10, + ) + ) # Another valid OUT transaction - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=11, interEventDelay=6000)) + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=11, + interEventDelay=6000, + ) + ) # OUT transaction with bad data CRC - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=12, interEventDelay=6000, - badDataCrc=True)) + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=12, + interEventDelay=6000, + badDataCrc=True, + ) + ) # Due to bad CRC, XUD will not ACK and expect a resend of the same packet - DATA PID won't be toggled - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=12, interEventDelay=6000)) + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=12, + interEventDelay=6000, + ) + ) # PID will be toggled as normal - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=13, interEventDelay=6000)) - - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=14, interEventDelay=6000)) + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=13, + interEventDelay=6000, + ) + ) + + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=14, + interEventDelay=6000, + ) + ) + + do_usb_test( + arch, + clk, + phy, + usb_speed, + [session], + __file__, + seed, + level="smoke", + extra_tasks=[], + verbose=verbose, + ) - do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) def runtest(): RunUsbTest(test) diff --git a/tests/test_bulk_rx_basic_badpid.py b/tests/test_bulk_rx_basic_badpid.py index d52c6d31..d2c64b84 100644 --- a/tests/test_bulk_rx_basic_badpid.py +++ b/tests/test_bulk_rx_basic_badpid.py @@ -2,7 +2,7 @@ # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. import xmostest -from usb_packet import * +from usb_packet import * from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction @@ -13,24 +13,88 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): address = 1 ep = 1 - session = UsbSession(bus_speed=usb_speed, run_enumeration = False, device_address=address) + session = UsbSession( + bus_speed=usb_speed, run_enumeration=False, device_address=address + ) # The large inter-frame gap is to give the DUT time to print its output interEventDelay = 500 - + # Valid OUT transaction - session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=10, interEventDelay=interEventDelay)) - + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=10, + interEventDelay=interEventDelay, + ) + ) + # Pretend the ACK went missing on the way to host. Re-send same packet. xCORE should ACK but throw pkt away - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=11, interEventDelay=interEventDelay, - resend=True)) - + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=11, + interEventDelay=interEventDelay, + resend=True, + ) + ) + # Send some valid OUT transactions - session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=12, interEventDelay=interEventDelay)) - session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=13, interEventDelay=interEventDelay)) - session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=14, interEventDelay=interEventDelay)) + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=12, + interEventDelay=interEventDelay, + ) + ) + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=13, + interEventDelay=interEventDelay, + ) + ) + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=14, + interEventDelay=interEventDelay, + ) + ) + + do_usb_test( + arch, + clk, + phy, + usb_speed, + [session], + __file__, + seed, + level="smoke", + extra_tasks=[], + verbose=verbose, + ) - do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) def runtest(): RunUsbTest(do_test) diff --git a/tests/test_bulk_rx_basic_nodata.py b/tests/test_bulk_rx_basic_nodata.py index 1e479ad1..a8c44fd5 100644 --- a/tests/test_bulk_rx_basic_nodata.py +++ b/tests/test_bulk_rx_basic_nodata.py @@ -4,11 +4,12 @@ # Rx out of seq (but valid.. ) data PID import xmostest -from usb_packet import TokenPacket, USB_PID +from usb_packet import TokenPacket, USB_PID from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction + def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): address = 1 @@ -17,17 +18,43 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): # The large inter-event delay is to give the DUT time to perform checking ied = 500 - session = UsbSession(bus_speed = usb_speed, run_enumeration = False, device_address = address) + session = UsbSession( + bus_speed=usb_speed, run_enumeration=False, device_address=address + ) for length in range(10, 15): - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=length, interEventDelay=ied)) - - # Simulate missing data payload + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=length, + interEventDelay=ied, + ) + ) + + # Simulate missing data payload if length == 11: - session.add_event(TokenPacket(endpoint=ep, address = address, pid=USB_PID["OUT"])) + session.add_event( + TokenPacket(endpoint=ep, address=address, pid=USB_PID["OUT"]) + ) + + do_usb_test( + arch, + clk, + phy, + usb_speed, + [session], + __file__, + seed, + level="smoke", + extra_tasks=[], + verbose=verbose, + ) - do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) def runtest(): RunUsbTest(do_test) diff --git a/tests/test_bulk_rx_basic_rxerror.py b/tests/test_bulk_rx_basic_rxerror.py index f34d6d41..f7f1725c 100644 --- a/tests/test_bulk_rx_basic_rxerror.py +++ b/tests/test_bulk_rx_basic_rxerror.py @@ -2,12 +2,13 @@ # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. import xmostest -from usb_packet import * +from usb_packet import * import usb_packet from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction + def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): address = 1 @@ -15,31 +16,114 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): # Large inter-event delay is to give the DUT time to perform checking ied = 6000 - session = UsbSession(bus_speed = usb_speed, run_enumeration = False, device_address = address) + session = UsbSession( + bus_speed=usb_speed, run_enumeration=False, device_address=address + ) - # Valid OUT transaction - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=10)) + # Valid OUT transaction + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=10, + ) + ) # Assert RxError during packet # xCORE should ignore the packet and not handshake... - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=11, - interEventDelay=ied, rxeAssertDelay_data=5)) - + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=11, + interEventDelay=ied, + rxeAssertDelay_data=5, + ) + ) + # Re-send.. - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=11, interEventDelay=ied)) + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=11, + interEventDelay=ied, + ) + ) - # Valid OUT transaction - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=12, interEventDelay=ied)) + # Valid OUT transaction + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=12, + interEventDelay=ied, + ) + ) + + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=13, + interEventDelay=ied, + rxeAssertDelay_data=1, + ) + ) - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=13, - interEventDelay=ied, rxeAssertDelay_data=1)) - # Re-send - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=13, interEventDelay=ied)) + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=13, + interEventDelay=ied, + ) + ) + + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=14, + interEventDelay=ied, + ) + ) - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=14, interEventDelay=ied)) + do_usb_test( + arch, + clk, + phy, + usb_speed, + [session], + __file__, + seed, + level="smoke", + extra_tasks=[], + verbose=verbose, + ) - do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) def runtest(): RunUsbTest(do_test) diff --git a/tests/test_bulk_rx_multiep.py b/tests/test_bulk_rx_multiep.py index 19beaafa..d64bcad3 100644 --- a/tests/test_bulk_rx_multiep.py +++ b/tests/test_bulk_rx_multiep.py @@ -3,26 +3,77 @@ # This Software is subject to the terms of the XMOS Public Licence: Version 1. import xmostest -from usb_packet import * +from usb_packet import * import usb_packet from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction + def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): address = 1 - session = UsbSession(bus_speed = usb_speed, run_enumeration = False, device_address = address) + session = UsbSession( + bus_speed=usb_speed, run_enumeration=False, device_address=address + ) for pktLength in range(10, 20): - - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=3, endpointType="BULK", direction= "OUT", dataLength=pktLength)) - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=4, endpointType="BULK", direction= "OUT", dataLength=pktLength)) - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=5, endpointType="BULK", direction= "OUT", dataLength=pktLength)) - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=6, endpointType="BULK", direction= "OUT", dataLength=pktLength)) - - do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) + + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=3, + endpointType="BULK", + direction="OUT", + dataLength=pktLength, + ) + ) + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=4, + endpointType="BULK", + direction="OUT", + dataLength=pktLength, + ) + ) + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=5, + endpointType="BULK", + direction="OUT", + dataLength=pktLength, + ) + ) + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=6, + endpointType="BULK", + direction="OUT", + dataLength=pktLength, + ) + ) + + do_usb_test( + arch, + clk, + phy, + usb_speed, + [session], + __file__, + seed, + level="smoke", + extra_tasks=[], + verbose=verbose, + ) + def runtest(): RunUsbTest(do_test) diff --git a/tests/test_bulk_rx_traffic.py b/tests/test_bulk_rx_traffic.py index d57baba2..7bc5b163 100644 --- a/tests/test_bulk_rx_traffic.py +++ b/tests/test_bulk_rx_traffic.py @@ -2,47 +2,88 @@ # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. import xmostest -from usb_packet import * +from usb_packet import * import usb_packet from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction from usb_phy import MAX_ENDPOINT_ADDRESS + def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ep = 1 address = 1 ied = 500 - - trafficAddress1 = 0; - trafficAddress2 = 127; - trafficEp1 = USB_MAX_EP_ADDRESS; - trafficEp2 = 0; - session = UsbSession(bus_speed = usb_speed, run_enumeration = False, device_address = address) + trafficAddress1 = 0 + trafficAddress2 = 127 + trafficEp1 = USB_MAX_EP_ADDRESS + trafficEp2 = 0 + + session = UsbSession( + bus_speed=usb_speed, run_enumeration=False, device_address=address + ) for pktLength in range(10, 20): - - session.add_event(UsbTransaction(session, deviceAddress=trafficAddress1, endpointNumber=trafficEp1, endpointType="BULK", direction= "OUT", dataLength=pktLength, - interEventDelay=ied)) - session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=pktLength, - interEventDelay=ied)) + session.add_event( + UsbTransaction( + session, + deviceAddress=trafficAddress1, + endpointNumber=trafficEp1, + endpointType="BULK", + direction="OUT", + dataLength=pktLength, + interEventDelay=ied, + ) + ) - session.add_event(UsbTransaction(session, deviceAddress=trafficAddress2, endpointNumber=trafficEp2, endpointType="BULK", direction= "OUT", dataLength=pktLength, - interEventDelay=ied)) + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=pktLength, + interEventDelay=ied, + ) + ) + + session.add_event( + UsbTransaction( + session, + deviceAddress=trafficAddress2, + endpointNumber=trafficEp2, + endpointType="BULK", + direction="OUT", + dataLength=pktLength, + interEventDelay=ied, + ) + ) trafficEp1 = trafficEp1 - 1 - if(trafficEp1 < 0): + if trafficEp1 < 0: trafficEp1 = USB_MAX_EP_ADDRESS - + trafficEp2 + trafficEp2 + 1 - if(trafficEp1 > USB_MAX_EP_ADDRESS): + if trafficEp1 > USB_MAX_EP_ADDRESS: trafficEp1 = 0 - - do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) + + do_usb_test( + arch, + clk, + phy, + usb_speed, + [session], + __file__, + seed, + level="smoke", + extra_tasks=[], + verbose=verbose, + ) + def runtest(): RunUsbTest(do_test) - diff --git a/tests/test_bulk_tx_badack.py b/tests/test_bulk_tx_badack.py index e4ce656f..7511a407 100644 --- a/tests/test_bulk_tx_badack.py +++ b/tests/test_bulk_tx_badack.py @@ -2,11 +2,12 @@ # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. import xmostest -from usb_packet import TokenPacket, RxDataPacket, TxHandshakePacket, USB_PID +from usb_packet import TokenPacket, RxDataPacket, TxHandshakePacket, USB_PID from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction + def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ep = 1 @@ -14,18 +15,58 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): pktLength = 10 ied = 4000 - session = UsbSession(bus_speed = usb_speed, run_enumeration = False, device_address = address) - + session = UsbSession( + bus_speed=usb_speed, run_enumeration=False, device_address=address + ) + for pktLength in range(10, 14): if pktLength == 12: - session.add_event(TokenPacket(pid=USB_PID['IN'], address=address, endpoint=ep, data_valid_count=data_valid_count, inter_pkt_gap=ied)) - session.add_event(RxDataPacket(dataPayload=session.getPayload_in(ep, pktLength, resend=True), valid_count=data_valid_count, pid=USB_PID['DATA0'])) - session.add_event(TxHandshakePacket(data_valid_count=data_valid_count, pid=0xff)) + session.add_event( + TokenPacket( + pid=USB_PID["IN"], + address=address, + endpoint=ep, + data_valid_count=data_valid_count, + inter_pkt_gap=ied, + ) + ) + session.add_event( + RxDataPacket( + dataPayload=session.getPayload_in(ep, pktLength, resend=True), + valid_count=data_valid_count, + pid=USB_PID["DATA0"], + ) + ) + session.add_event( + TxHandshakePacket(data_valid_count=data_valid_count, pid=0xFF) + ) + + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="IN", + dataLength=pktLength, + interEventDelay=ied, + ) + ) + + do_usb_test( + arch, + clk, + phy, + usb_speed, + [session], + __file__, + seed, + level="smoke", + extra_tasks=[], + verbose=verbose, + ) - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "IN", dataLength=pktLength, interEventDelay=ied)) - - do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) def runtest(): RunUsbTest(do_test) diff --git a/tests/test_bulk_tx_basic.py b/tests/test_bulk_tx_basic.py index 694996f0..40a884f8 100644 --- a/tests/test_bulk_tx_basic.py +++ b/tests/test_bulk_tx_basic.py @@ -7,19 +7,43 @@ from usb_session import UsbSession from usb_transaction import UsbTransaction + def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ep = 1 address = 1 start_length = 10 end_length = 19 - - session = UsbSession(bus_speed = usb_speed, run_enumeration = False, device_address = address) - for pktLength in range(10, end_length+1): - session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "IN", dataLength=pktLength)) + session = UsbSession( + bus_speed=usb_speed, run_enumeration=False, device_address=address + ) + + for pktLength in range(10, end_length + 1): + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="IN", + dataLength=pktLength, + ) + ) + + do_usb_test( + arch, + clk, + phy, + usb_speed, + [session], + __file__, + seed, + level="smoke", + extra_tasks=[], + verbose=verbose, + ) - do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) def runtest(): RunUsbTest(do_test) diff --git a/tests/test_bulk_tx_basic_short.py b/tests/test_bulk_tx_basic_short.py index 02cd4ce7..1e3d2256 100644 --- a/tests/test_bulk_tx_basic_short.py +++ b/tests/test_bulk_tx_basic_short.py @@ -6,21 +6,44 @@ from usb_session import UsbSession from usb_transaction import UsbTransaction + def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ep = 1 address = 1 start_length = 0 end_length = 7 - - session = UsbSession(bus_speed=usb_speed, run_enumeration=False, device_address=address) - for pktLength in range(start_length, end_length+1): - session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "IN", eventTime=10, dataLength=pktLength)) + session = UsbSession( + bus_speed=usb_speed, run_enumeration=False, device_address=address + ) - do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) + for pktLength in range(start_length, end_length + 1): + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="IN", + eventTime=10, + dataLength=pktLength, + ) + ) -def runtest(): - RunUsbTest(do_test) + do_usb_test( + arch, + clk, + phy, + usb_speed, + [session], + __file__, + seed, + level="smoke", + extra_tasks=[], + verbose=verbose, + ) +def runtest(): + RunUsbTest(do_test) diff --git a/tests/test_bulk_tx_multiep.py b/tests/test_bulk_tx_multiep.py index bf15f830..a3821613 100644 --- a/tests/test_bulk_tx_multiep.py +++ b/tests/test_bulk_tx_multiep.py @@ -7,21 +7,76 @@ from usb_session import UsbSession from usb_transaction import UsbTransaction + def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): - ep = 3 # Note this is a starting EP + ep = 3 # Note this is a starting EP address = 1 ied = 200 - session = UsbSession(bus_speed = usb_speed, run_enumeration = False, device_address = address) + session = UsbSession( + bus_speed=usb_speed, run_enumeration=False, device_address=address + ) for pktLength in range(10, 20): - session.add_event(UsbTransaction(session, deviceAddress =address, endpointNumber=ep, endpointType="BULK", direction= "IN", dataLength=pktLength, interEventDelay=ied)) - session.add_event(UsbTransaction(session, deviceAddress =address, endpointNumber=ep+1, endpointType="BULK", direction= "IN", dataLength=pktLength, interEventDelay=ied)) - session.add_event(UsbTransaction(session, deviceAddress =address, endpointNumber=ep+2, endpointType="BULK", direction= "IN", dataLength=pktLength, interEventDelay=ied)) - session.add_event(UsbTransaction(session, deviceAddress =address, endpointNumber=ep+3, endpointType="BULK", direction= "IN", dataLength=pktLength, interEventDelay=ied)) - - do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="IN", + dataLength=pktLength, + interEventDelay=ied, + ) + ) + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep + 1, + endpointType="BULK", + direction="IN", + dataLength=pktLength, + interEventDelay=ied, + ) + ) + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep + 2, + endpointType="BULK", + direction="IN", + dataLength=pktLength, + interEventDelay=ied, + ) + ) + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep + 3, + endpointType="BULK", + direction="IN", + dataLength=pktLength, + interEventDelay=ied, + ) + ) + + do_usb_test( + arch, + clk, + phy, + usb_speed, + [session], + __file__, + seed, + level="smoke", + extra_tasks=[], + verbose=verbose, + ) + def runtest(): RunUsbTest(do_test) diff --git a/tests/test_bulk_tx_noack.py b/tests/test_bulk_tx_noack.py index 3d8fb0a5..441a480b 100644 --- a/tests/test_bulk_tx_noack.py +++ b/tests/test_bulk_tx_noack.py @@ -2,33 +2,68 @@ # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. import xmostest -from usb_packet import USB_PID, TokenPacket, RxDataPacket +from usb_packet import USB_PID, TokenPacket, RxDataPacket from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction + def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ep = 1 address = 1 - + # Note, quite big gap to allow checking ied = 4000 - session = UsbSession(bus_speed=usb_speed, run_enumeration=False, device_address=address) + session = UsbSession( + bus_speed=usb_speed, run_enumeration=False, device_address=address + ) for pktLength in range(10, 14): if pktLength == 12: - session.add_event(TokenPacket(pid=USB_PID['IN'], address=address, endpoint=ep, data_valid_count=data_valid_count, inter_pkt_gap=ied)) - session.add_event(RxDataPacket(dataPayload=session.getPayload_in(ep, pktLength, resend=True))) + session.add_event( + TokenPacket( + pid=USB_PID["IN"], + address=address, + endpoint=ep, + data_valid_count=data_valid_count, + inter_pkt_gap=ied, + ) + ) + session.add_event( + RxDataPacket( + dataPayload=session.getPayload_in(ep, pktLength, resend=True) + ) + ) # Missing ACK - simulate CRC fail at host - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="BULK", direction= "IN", dataLength=pktLength, interEventDelay=ied)) + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="IN", + dataLength=pktLength, + interEventDelay=ied, + ) + ) - do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) + do_usb_test( + arch, + clk, + phy, + usb_speed, + [session], + __file__, + seed, + level="smoke", + extra_tasks=[], + verbose=verbose, + ) def runtest(): RunUsbTest(do_test) - diff --git a/tests/test_control_basic_get.py b/tests/test_control_basic_get.py index b37c1134..032de41b 100644 --- a/tests/test_control_basic_get.py +++ b/tests/test_control_basic_get.py @@ -2,35 +2,92 @@ # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. import xmostest -from usb_packet import TokenPacket, TxDataPacket, RxDataPacket, TxHandshakePacket, RxHandshakePacket, USB_PID +from usb_packet import ( + TokenPacket, + TxDataPacket, + RxDataPacket, + TxHandshakePacket, + RxHandshakePacket, + USB_PID, +) from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction + def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ep = 0 - address = 1 + address = 1 - session = UsbSession(bus_speed=usb_speed, run_enumeration=False, device_address=address) + session = UsbSession( + bus_speed=usb_speed, run_enumeration=False, device_address=address + ) # SETUP transaction - session.add_event(TokenPacket(pid=USB_PID['SETUP'], address=address, endpoint=ep, data_valid_count=data_valid_count)) - session.add_event(TxDataPacket(dataPayload=session.getPayload_out(ep, 8), data_valid_count=data_valid_count, pid=USB_PID["DATA0"])) + session.add_event( + TokenPacket( + pid=USB_PID["SETUP"], + address=address, + endpoint=ep, + data_valid_count=data_valid_count, + ) + ) + session.add_event( + TxDataPacket( + dataPayload=session.getPayload_out(ep, 8), + data_valid_count=data_valid_count, + pid=USB_PID["DATA0"], + ) + ) session.add_event(RxHandshakePacket(data_valid_count=data_valid_count)) # IN transaction # Note, quite big gap to avoid nak - session.add_event(TokenPacket(pid=USB_PID['IN'], address=address, endpoint=ep, data_valid_count=data_valid_count, interEventDelay=10000)) - session.add_event(RxDataPacket(dataPayload=session.getPayload_in(ep, 10), data_valid_count=data_valid_count, pid=USB_PID["DATA1"])) + session.add_event( + TokenPacket( + pid=USB_PID["IN"], + address=address, + endpoint=ep, + data_valid_count=data_valid_count, + interEventDelay=10000, + ) + ) + session.add_event( + RxDataPacket( + dataPayload=session.getPayload_in(ep, 10), + data_valid_count=data_valid_count, + pid=USB_PID["DATA1"], + ) + ) session.add_event(TxHandshakePacket(data_valid_count=data_valid_count)) - - # Send 0 length OUT transaction - session.add_event(TokenPacket(pid=USB_PID['OUT'], address=address, endpoint=ep, data_valid_count=data_valid_count)) - session.add_event(TxDataPacket(data_valid_count=data_valid_count, length=0, pid=USB_PID['DATA1'])) + + # Send 0 length OUT transaction + session.add_event( + TokenPacket( + pid=USB_PID["OUT"], + address=address, + endpoint=ep, + data_valid_count=data_valid_count, + ) + ) + session.add_event( + TxDataPacket(data_valid_count=data_valid_count, length=0, pid=USB_PID["DATA1"]) + ) session.add_event(RxHandshakePacket(data_valid_count=data_valid_count)) - do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[]) + do_usb_test( + arch, + clk, + phy, + usb_speed, + [session], + __file__, + seed, + level="smoke", + extra_tasks=[], + ) + def runtest(): RunUsbTest(do_test) diff --git a/tests/test_control_basic_set.py b/tests/test_control_basic_set.py index 9ff3fac2..1018caee 100644 --- a/tests/test_control_basic_set.py +++ b/tests/test_control_basic_set.py @@ -2,35 +2,92 @@ # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. import xmostest -from usb_packet import TokenPacket, TxDataPacket, RxDataPacket, TxHandshakePacket, RxHandshakePacket, USB_PID +from usb_packet import ( + TokenPacket, + TxDataPacket, + RxDataPacket, + TxHandshakePacket, + RxHandshakePacket, + USB_PID, +) from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction + def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ep = 0 - address = 1 + address = 1 - session = UsbSession(bus_speed=usb_speed, run_enumeration=False, device_address=address) + session = UsbSession( + bus_speed=usb_speed, run_enumeration=False, device_address=address + ) # SETUP transaction - session.add_event(TokenPacket(pid=USB_PID['SETUP'], address=address, endpoint=ep, data_valid_count=data_valid_count)) - session.add_event(TxDataPacket(dataPayload=session.getPayload_out(ep, 8), data_valid_count=data_valid_count, pid=USB_PID["DATA0"])) + session.add_event( + TokenPacket( + pid=USB_PID["SETUP"], + address=address, + endpoint=ep, + data_valid_count=data_valid_count, + ) + ) + session.add_event( + TxDataPacket( + dataPayload=session.getPayload_out(ep, 8), + data_valid_count=data_valid_count, + pid=USB_PID["DATA0"], + ) + ) session.add_event(RxHandshakePacket(data_valid_count=data_valid_count)) # OUT transaction # Note, quite big gap to avoid nak - session.add_event(TokenPacket(pid=USB_PID['OUT'], address=address, endpoint=ep, data_valid_count=data_valid_count, interEventDelay=10000)) - session.add_event(TxDataPacket(dataPayload=session.getPayload_out(ep, 10), data_valid_count=data_valid_count, pid=USB_PID["DATA1"])) + session.add_event( + TokenPacket( + pid=USB_PID["OUT"], + address=address, + endpoint=ep, + data_valid_count=data_valid_count, + interEventDelay=10000, + ) + ) + session.add_event( + TxDataPacket( + dataPayload=session.getPayload_out(ep, 10), + data_valid_count=data_valid_count, + pid=USB_PID["DATA1"], + ) + ) session.add_event(RxHandshakePacket(data_valid_count=data_valid_count)) - - # Expect 0 length IN transaction - session.add_event(TokenPacket(pid=USB_PID['IN'], address=address, endpoint=ep, data_valid_count=data_valid_count)) - session.add_event(RxDataPacket(dataPayload=[], valid_count=data_valid_count, pid=USB_PID['DATA1'])) + + # Expect 0 length IN transaction + session.add_event( + TokenPacket( + pid=USB_PID["IN"], + address=address, + endpoint=ep, + data_valid_count=data_valid_count, + ) + ) + session.add_event( + RxDataPacket(dataPayload=[], valid_count=data_valid_count, pid=USB_PID["DATA1"]) + ) session.add_event(TxHandshakePacket(data_valid_count=data_valid_count)) - do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[]) + do_usb_test( + arch, + clk, + phy, + usb_speed, + [session], + __file__, + seed, + level="smoke", + extra_tasks=[], + ) + def runtest(): RunUsbTest(do_test) diff --git a/tests/test_invalidtoken.py b/tests/test_invalidtoken.py index 0eeb50b1..8d3afe2a 100644 --- a/tests/test_invalidtoken.py +++ b/tests/test_invalidtoken.py @@ -2,48 +2,153 @@ # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. import xmostest -from usb_packet import TokenPacket, TxDataPacket, RxDataPacket, TxHandshakePacket, RxHandshakePacket, USB_PID +from usb_packet import ( + TokenPacket, + TxDataPacket, + RxDataPacket, + TxHandshakePacket, + RxHandshakePacket, + USB_PID, +) from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction # Same as simple RX bulk test but some invalid tokens also included + def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): address = 1 ep = 1 - session = UsbSession(bus_speed=usb_speed, run_enumeration=False, device_address=address) - + session = UsbSession( + bus_speed=usb_speed, run_enumeration=False, device_address=address + ) + # Reserved/Invalid PID - session.add_event(TokenPacket(pid=USB_PID['RESERVED'], address=address, endpoint=ep, data_valid_count=data_valid_count)) - + session.add_event( + TokenPacket( + pid=USB_PID["RESERVED"], + address=address, + endpoint=ep, + data_valid_count=data_valid_count, + ) + ) + # Valid IN but not for DUT - session.add_event(TokenPacket(pid=USB_PID['IN'], address=address+1, endpoint=ep, data_valid_count=data_valid_count)) + session.add_event( + TokenPacket( + pid=USB_PID["IN"], + address=address + 1, + endpoint=ep, + data_valid_count=data_valid_count, + ) + ) # Valid OUT but not for DUT - session.add_event(TokenPacket(pid=USB_PID['OUT'], address=address+1, endpoint=ep, data_valid_count=data_valid_count)) + session.add_event( + TokenPacket( + pid=USB_PID["OUT"], + address=address + 1, + endpoint=ep, + data_valid_count=data_valid_count, + ) + ) - # Valid OUT transaction - session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=10)) + # Valid OUT transaction + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=10, + ) + ) # Valid SETUP but not for us.. - session.add_event(TokenPacket(pid=USB_PID['SETUP'], address=address+2, endpoint=ep, data_valid_count=data_valid_count)) + session.add_event( + TokenPacket( + pid=USB_PID["SETUP"], + address=address + 2, + endpoint=ep, + data_valid_count=data_valid_count, + ) + ) # Valid OUT transaction # Note, quite big gap to allow checking. - session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=11, interEventDelay=6000)) + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=11, + interEventDelay=6000, + ) + ) # Valid PING but not for us.. - session.add_event(TokenPacket(pid=USB_PID['PING'], address=address+2, endpoint=ep, data_valid_count=data_valid_count)) + session.add_event( + TokenPacket( + pid=USB_PID["PING"], + address=address + 2, + endpoint=ep, + data_valid_count=data_valid_count, + ) + ) + + # Finish with some valid transactions + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=12, + interEventDelay=6000, + ) + ) + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=13, + interEventDelay=6000, + ) + ) + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=14, + interEventDelay=6000, + ) + ) - # Finish with some valid transactions - session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=12, interEventDelay=6000)) - session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=13, interEventDelay=6000)) - session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=14, interEventDelay=6000)) + do_usb_test( + arch, + clk, + phy, + usb_speed, + [session], + __file__, + seed, + level="smoke", + extra_tasks=[], + ) - do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[]) def runtest(): RunUsbTest(do_test) diff --git a/tests/test_iso_loopback.py b/tests/test_iso_loopback.py index 18b69c0d..cf3f14ea 100644 --- a/tests/test_iso_loopback.py +++ b/tests/test_iso_loopback.py @@ -3,12 +3,13 @@ # This Software is subject to the terms of the XMOS Public Licence: Version 1. import xmostest -from usb_packet import * +from usb_packet import * import usb_packet from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction + def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ep_loopback = 3 @@ -16,25 +17,76 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): address = 1 start_length = 200 end_length = 203 - session = UsbSession(bus_speed = usb_speed, run_enumeration = False, device_address = address) + session = UsbSession( + bus_speed=usb_speed, run_enumeration=False, device_address=address + ) # TODO randomise packet lengths and data - for pktLength in range(start_length, end_length+1): - session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep_loopback, endpointType="ISO", direction= "OUT", dataLength=pktLength)) + for pktLength in range(start_length, end_length + 1): + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep_loopback, + endpointType="ISO", + direction="OUT", + dataLength=pktLength, + ) + ) # Was min IPG supported on iso loopback to not nak # This was 420, had to increase when moved to lib_xud (14.1.2 tools) # increased again from 437 when SETUP/OUT checking added # increaed from 477 when adding xs3 - session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep_loopback, endpointType="ISO", direction= "IN", dataLength=pktLength, interEventDelay=498)) + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep_loopback, + endpointType="ISO", + direction="IN", + dataLength=pktLength, + interEventDelay=498, + ) + ) pktLength = 10 - #Loopback and die.. - session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep_loopback_kill, endpointType="BULK", direction= "OUT", dataLength=pktLength)) - session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep_loopback_kill, endpointType="BULK", direction= "IN", dataLength=pktLength)) + # Loopback and die.. + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep_loopback_kill, + endpointType="BULK", + direction="OUT", + dataLength=pktLength, + ) + ) + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep_loopback_kill, + endpointType="BULK", + direction="IN", + dataLength=pktLength, + ) + ) + + do_usb_test( + arch, + clk, + phy, + usb_speed, + [session], + __file__, + seed, + level="smoke", + extra_tasks=[], + verbose=verbose, + ) - do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) def runtest(): RunUsbTest(do_test) diff --git a/tests/test_iso_rx_basic.py b/tests/test_iso_rx_basic.py index 65e4c29b..bcedf8ab 100644 --- a/tests/test_iso_rx_basic.py +++ b/tests/test_iso_rx_basic.py @@ -6,21 +6,43 @@ from usb_session import UsbSession from usb_transaction import UsbTransaction + def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): - + ep = 2 address = 1 start_length = 10 end_length = 14 - - session = UsbSession(bus_speed=usb_speed, run_enumeration=False, device_address=address) - for pktLength in range(10, end_length+1): - session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="ISO", direction= "OUT", dataLength=pktLength)) + session = UsbSession( + bus_speed=usb_speed, run_enumeration=False, device_address=address + ) - do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) + for pktLength in range(10, end_length + 1): + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="ISO", + direction="OUT", + dataLength=pktLength, + ) + ) -def runtest(): - RunUsbTest(do_test) + do_usb_test( + arch, + clk, + phy, + usb_speed, + [session], + __file__, + seed, + level="smoke", + extra_tasks=[], + verbose=verbose, + ) +def runtest(): + RunUsbTest(do_test) diff --git a/tests/test_iso_rxtx_fastpacket.py b/tests/test_iso_rxtx_fastpacket.py index 1c861c2d..1df2f950 100644 --- a/tests/test_iso_rxtx_fastpacket.py +++ b/tests/test_iso_rxtx_fastpacket.py @@ -3,12 +3,13 @@ # This Software is subject to the terms of the XMOS Public Licence: Version 1. import xmostest -from usb_packet import * +from usb_packet import * import usb_packet from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction + def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ep = 3 @@ -16,16 +17,50 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): start_length = 10 end_length = 19 - session = UsbSession(bus_speed = usb_speed, run_enumeration = False, device_address = address) + session = UsbSession( + bus_speed=usb_speed, run_enumeration=False, device_address=address + ) - for pktLength in range(start_length, end_length+1): + for pktLength in range(start_length, end_length + 1): # < 17 fails - session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="ISO", direction= "OUT", dataLength=pktLength, interEventDelay=20)) - - session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="ISO", direction= "IN", dataLength=pktLength, interEventDelay=58)) + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="ISO", + direction="OUT", + dataLength=pktLength, + interEventDelay=20, + ) + ) + + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="ISO", + direction="IN", + dataLength=pktLength, + interEventDelay=58, + ) + ) + + do_usb_test( + arch, + clk, + phy, + usb_speed, + [session], + __file__, + seed, + level="smoke", + extra_tasks=[], + verbose=verbose, + ) - do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) def runtest(): RunUsbTest(do_test) diff --git a/tests/test_iso_tx_basic.py b/tests/test_iso_tx_basic.py index a64b0751..7c568a9e 100644 --- a/tests/test_iso_tx_basic.py +++ b/tests/test_iso_tx_basic.py @@ -6,19 +6,43 @@ from usb_session import UsbSession from usb_transaction import UsbTransaction + def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ep = 3 address = 1 start_length = 10 end_length = 14 - - session = UsbSession(bus_speed = usb_speed, run_enumeration=False, device_address=address) - for pktLength in range(10, end_length+1): - session.add_event(UsbTransaction(session, deviceAddress = address, endpointNumber=ep, endpointType="ISO", direction= "IN", dataLength=pktLength)) + session = UsbSession( + bus_speed=usb_speed, run_enumeration=False, device_address=address + ) + + for pktLength in range(10, end_length + 1): + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="ISO", + direction="IN", + dataLength=pktLength, + ) + ) + + do_usb_test( + arch, + clk, + phy, + usb_speed, + [session], + __file__, + seed, + level="smoke", + extra_tasks=[], + verbose=verbose, + ) - do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) def runtest(): RunUsbTest(do_test) diff --git a/tests/test_ping_rx_basic.py b/tests/test_ping_rx_basic.py index 7d4b62a6..ca98243c 100644 --- a/tests/test_ping_rx_basic.py +++ b/tests/test_ping_rx_basic.py @@ -5,7 +5,14 @@ # Basic check of PING functionality import xmostest -from usb_packet import TokenPacket, TxDataPacket, RxDataPacket, TxHandshakePacket, RxHandshakePacket, USB_PID +from usb_packet import ( + TokenPacket, + TxDataPacket, + RxDataPacket, + TxHandshakePacket, + RxHandshakePacket, + USB_PID, +) from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction @@ -16,42 +23,139 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): address = 1 ep = 1 - session = UsbSession(bus_speed=usb_speed, run_enumeration=False, device_address=address) + session = UsbSession( + bus_speed=usb_speed, run_enumeration=False, device_address=address + ) # Ping EP 2, expect NAK - session.add_event(TokenPacket(pid=USB_PID['PING'], address=address, endpoint=2, data_valid_count=data_valid_count)) - session.add_event(RxHandshakePacket(data_valid_count=data_valid_count, pid=USB_PID['NAK'])) + session.add_event( + TokenPacket( + pid=USB_PID["PING"], + address=address, + endpoint=2, + data_valid_count=data_valid_count, + ) + ) + session.add_event( + RxHandshakePacket(data_valid_count=data_valid_count, pid=USB_PID["NAK"]) + ) # And again - session.add_event(TokenPacket(pid=USB_PID['PING'], address=address, endpoint=2, data_valid_count=data_valid_count)) - session.add_event(RxHandshakePacket(data_valid_count=data_valid_count, pid=USB_PID['NAK'])) + session.add_event( + TokenPacket( + pid=USB_PID["PING"], + address=address, + endpoint=2, + data_valid_count=data_valid_count, + ) + ) + session.add_event( + RxHandshakePacket(data_valid_count=data_valid_count, pid=USB_PID["NAK"]) + ) # Send packet to EP 1, xCORE should mark EP 2 as ready - session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction="OUT", dataLength=10)) - + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=10, + ) + ) + # Ping EP 2 again - expect ACK - session.add_event(TokenPacket(pid=USB_PID['PING'], address=address, endpoint=2, data_valid_count=data_valid_count, interEventDelay=6000)) - session.add_event(RxHandshakePacket(data_valid_count=data_valid_count, pid=USB_PID['ACK'])) + session.add_event( + TokenPacket( + pid=USB_PID["PING"], + address=address, + endpoint=2, + data_valid_count=data_valid_count, + interEventDelay=6000, + ) + ) + session.add_event( + RxHandshakePacket(data_valid_count=data_valid_count, pid=USB_PID["ACK"]) + ) # And again.. - session.add_event(TokenPacket(pid=USB_PID['PING'], address=address, endpoint=2, data_valid_count=data_valid_count, interEventDelay=6000)) - session.add_event(RxHandshakePacket(data_valid_count=data_valid_count, pid=USB_PID['ACK'])) + session.add_event( + TokenPacket( + pid=USB_PID["PING"], + address=address, + endpoint=2, + data_valid_count=data_valid_count, + interEventDelay=6000, + ) + ) + session.add_event( + RxHandshakePacket(data_valid_count=data_valid_count, pid=USB_PID["ACK"]) + ) # Send out to EP 2.. expect ack - session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=2, endpointType="BULK", direction="OUT", dataLength=10, interEventDelay=6000)) + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=2, + endpointType="BULK", + direction="OUT", + dataLength=10, + interEventDelay=6000, + ) + ) # Re-Ping EP 2, expect NAK - session.add_event(TokenPacket(pid=USB_PID['PING'], address=address, endpoint=2, data_valid_count=data_valid_count)) - session.add_event(RxHandshakePacket(data_valid_count=data_valid_count, pid=USB_PID['NAK'])) + session.add_event( + TokenPacket( + pid=USB_PID["PING"], + address=address, + endpoint=2, + data_valid_count=data_valid_count, + ) + ) + session.add_event( + RxHandshakePacket(data_valid_count=data_valid_count, pid=USB_PID["NAK"]) + ) # And again - session.add_event(TokenPacket(pid=USB_PID['PING'], address=address, endpoint=2, data_valid_count=data_valid_count)) - session.add_event(RxHandshakePacket(data_valid_count=data_valid_count, pid=USB_PID['NAK'])) + session.add_event( + TokenPacket( + pid=USB_PID["PING"], + address=address, + endpoint=2, + data_valid_count=data_valid_count, + ) + ) + session.add_event( + RxHandshakePacket(data_valid_count=data_valid_count, pid=USB_PID["NAK"]) + ) + + # Send a packet to EP 1 so the DUT knows it can exit. + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=10, + ) + ) + + do_usb_test( + arch, + clk, + phy, + usb_speed, + [session], + __file__, + seed, + level="smoke", + extra_tasks=[], + ) - # Send a packet to EP 1 so the DUT knows it can exit. - session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction="OUT", dataLength=10)) - - do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[]) def runtest(): RunUsbTest(do_test) diff --git a/tests/test_shorttoken.py b/tests/test_shorttoken.py index b64b7336..f84d4dc9 100644 --- a/tests/test_shorttoken.py +++ b/tests/test_shorttoken.py @@ -3,31 +3,69 @@ # This Software is subject to the terms of the XMOS Public Licence: Version 1. import xmostest -from usb_packet import TxPacket, USB_PID +from usb_packet import TxPacket, USB_PID from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction + def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): address = 1 ep = 1 - session = UsbSession(bus_speed=usb_speed, run_enumeration=False, device_address = address) + session = UsbSession( + bus_speed=usb_speed, run_enumeration=False, device_address=address + ) # Start with a valid transaction */ - session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=10)) + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=10, + ) + ) # tmp hack for xs2 - for xs2 the shim will throw away the short token and it will never be seen by the xCORE - if arch == 'xs3': - # Create a short token, only PID and 2nd byte - shorttoken = TxPacket(pid=USB_PID["OUT"], data_bytes = [0x81], data_valid_count=data_valid_count, interEventDelay=100) + if arch == "xs3": + # Create a short token, only PID and 2nd byte + shorttoken = TxPacket( + pid=USB_PID["OUT"], + data_bytes=[0x81], + data_valid_count=data_valid_count, + interEventDelay=100, + ) session.add_event(shorttoken) - #Finish with valid transaction - session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=11, interEventDelay=6000)) + # Finish with valid transaction + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=11, + interEventDelay=6000, + ) + ) + + do_usb_test( + arch, + clk, + phy, + usb_speed, + [session], + __file__, + seed, + level="smoke", + extra_tasks=[], + ) - do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[]) def runtest(): RunUsbTest(do_test) diff --git a/tests/test_sof_badcrc.py b/tests/test_sof_badcrc.py index 63c52edd..7c7084c7 100644 --- a/tests/test_sof_badcrc.py +++ b/tests/test_sof_badcrc.py @@ -2,45 +2,92 @@ # Copyright 2019-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. import xmostest -from usb_packet import * +from usb_packet import * import usb_packet from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction -# TODO ideally creation of SOF's is moved elsewhere -def CreateSofToken(frameNumber, data_valid_count, badCrc = False): - ep = (frameNumber >> 7) & 0xf - address = (frameNumber) & 0x7f - +# TODO ideally creation of SOF's is moved elsewhere +def CreateSofToken(frameNumber, data_valid_count, badCrc=False): + ep = (frameNumber >> 7) & 0xF + address = (frameNumber) & 0x7F + if badCrc: - return TokenPacket(pid=USB_PID['SOF'], address=address, endpoint=ep, data_valid_count=data_valid_count, crc5=0xff) + return TokenPacket( + pid=USB_PID["SOF"], + address=address, + endpoint=ep, + data_valid_count=data_valid_count, + crc5=0xFF, + ) else: - return TokenPacket(pid=USB_PID['SOF'], address=address, endpoint=ep, data_valid_count=data_valid_count) - + return TokenPacket( + pid=USB_PID["SOF"], + address=address, + endpoint=ep, + data_valid_count=data_valid_count, + ) + return sofToken + def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): - + address = 1 ep = 1 - frameNumber = 52 # Note, for frame number 52 we expect A5 34 40 on the bus + frameNumber = 52 # Note, for frame number 52 we expect A5 34 40 on the bus - session = UsbSession(bus_speed=usb_speed, run_enumeration=False, device_address = address) + session = UsbSession( + bus_speed=usb_speed, run_enumeration=False, device_address=address + ) # Start with a valid transaction */ - session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=10)) + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=10, + ) + ) session.add_event(CreateSofToken(frameNumber, data_valid_count)) - session.add_event(CreateSofToken(frameNumber+1, data_valid_count)) - session.add_event(CreateSofToken(frameNumber+2, data_valid_count)) - session.add_event(CreateSofToken(frameNumber+3, data_valid_count, badCrc=True)) # Invalidate the CRC - session.add_event(CreateSofToken(frameNumber+4, data_valid_count)) - - #Finish with valid transaction - session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=11, interEventDelay=6000)) - - do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) + session.add_event(CreateSofToken(frameNumber + 1, data_valid_count)) + session.add_event(CreateSofToken(frameNumber + 2, data_valid_count)) + session.add_event( + CreateSofToken(frameNumber + 3, data_valid_count, badCrc=True) + ) # Invalidate the CRC + session.add_event(CreateSofToken(frameNumber + 4, data_valid_count)) + + # Finish with valid transaction + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=11, + interEventDelay=6000, + ) + ) + + do_usb_test( + arch, + clk, + phy, + usb_speed, + [session], + __file__, + seed, + level="smoke", + extra_tasks=[], + verbose=verbose, + ) + def runtest(): RunUsbTest(do_test) diff --git a/tests/test_sof_basic.py b/tests/test_sof_basic.py index 47d44ae9..4df9e9ee 100644 --- a/tests/test_sof_basic.py +++ b/tests/test_sof_basic.py @@ -2,36 +2,67 @@ # Copyright 2019-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. import xmostest -from usb_packet import * +from usb_packet import * import usb_packet from helpers import do_usb_test, RunUsbTest, CreateSofToken from usb_session import UsbSession from usb_transaction import UsbTransaction - def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): - + address = 1 ep = 1 - frameNumber = 52 # Note, for frame number 52 we expect A5 34 40 on the bus + frameNumber = 52 # Note, for frame number 52 we expect A5 34 40 on the bus - session = UsbSession(bus_speed=usb_speed, run_enumeration=False, device_address = address) + session = UsbSession( + bus_speed=usb_speed, run_enumeration=False, device_address=address + ) # Start with a valid transaction */ - session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=10)) + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=10, + ) + ) session.add_event(CreateSofToken(frameNumber, data_valid_count)) - session.add_event(CreateSofToken(frameNumber+1, data_valid_count)) - session.add_event(CreateSofToken(frameNumber+2, data_valid_count)) - session.add_event(CreateSofToken(frameNumber+3, data_valid_count)) - session.add_event(CreateSofToken(frameNumber+4, data_valid_count)) + session.add_event(CreateSofToken(frameNumber + 1, data_valid_count)) + session.add_event(CreateSofToken(frameNumber + 2, data_valid_count)) + session.add_event(CreateSofToken(frameNumber + 3, data_valid_count)) + session.add_event(CreateSofToken(frameNumber + 4, data_valid_count)) + + # Finish with valid transaction + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=11, + interEventDelay=6000, + ) + ) + + do_usb_test( + arch, + clk, + phy, + usb_speed, + [session], + __file__, + seed, + level="smoke", + extra_tasks=[], + verbose=verbose, + ) - #Finish with valid transaction - session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=11, interEventDelay=6000)) - - do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) def runtest(): RunUsbTest(do_test) - diff --git a/tests/test_suspend_resume.py b/tests/test_suspend_resume.py index fdffeb88..ea78ca5b 100644 --- a/tests/test_suspend_resume.py +++ b/tests/test_suspend_resume.py @@ -10,31 +10,67 @@ from usb_transaction import UsbTransaction from usb_signalling import UsbSuspend, UsbResume + def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): - + ep = 1 address = 1 start_length = 10 end_length = 12 pktLength = 10 - frameNumber = 52 # Note, for frame number 52 we expect A5 34 40 on the bus + frameNumber = 52 # Note, for frame number 52 we expect A5 34 40 on the bus + + session = UsbSession( + bus_speed=usb_speed, run_enumeration=False, device_address=address + ) + + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=pktLength, + interEventDelay=0, + ) + ) - session = UsbSession(bus_speed=usb_speed, run_enumeration=False, device_address = address) - - session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=pktLength, interEventDelay=0)) - session.add_event(CreateSofToken(frameNumber, data_valid_count)) - + session.add_event(UsbSuspend(350000)) session.add_event(UsbResume()) - + frameNumber = frameNumber + 1 pktLength = pktLength + 1 - session.add_event(CreateSofToken(frameNumber, data_valid_count, interEventDelay=2000)) - session.add_event(UsbTransaction(session, deviceAddress=address, endpointNumber=ep, endpointType="BULK", direction= "OUT", dataLength=pktLength, interEventDelay=0)) - + session.add_event( + CreateSofToken(frameNumber, data_valid_count, interEventDelay=2000) + ) + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=pktLength, + interEventDelay=0, + ) + ) + + do_usb_test( + arch, + clk, + phy, + usb_speed, + [session], + __file__, + seed, + level="smoke", + extra_tasks=[], + verbose=verbose, + ) - do_usb_test(arch, clk, phy, usb_speed, [session], __file__, seed, level='smoke', extra_tasks=[], verbose=verbose) def runtest(): RunUsbTest(do_test) diff --git a/tests/usb_clock.py b/tests/usb_clock.py index 337f912f..c3bc1a6f 100644 --- a/tests/usb_clock.py +++ b/tests/usb_clock.py @@ -4,6 +4,7 @@ import sys import zlib + class Clock(xmostest.SimThread): CLK_60MHz = 0x0 @@ -13,22 +14,22 @@ def __init__(self, port, clk): self._clk = clk if clk == self.CLK_60MHz: self._period = float(1000000000) / 60000000 - self._name = '60Mhz' - self._bit_time = 5 # TODO + self._name = "60Mhz" + self._bit_time = 5 # TODO else: - raise ValueError('Unsupported Clock Frequency') + raise ValueError("Unsupported Clock Frequency") self._min_ifg = 96 * self._bit_time self._val = 0 self._port = port def run(self): while True: - self.wait_until(self.xsi.get_time() + self._period/2) + self.wait_until(self.xsi.get_time() + self._period / 2) self._val = 1 - self._val if self._running: - #print "{}".format(self._val) - #self.xsi.drive_port_pins(self._port, self._val) + # print "{}".format(self._val) + # self.xsi.drive_port_pins(self._port, self._val) self.xsi.drive_periph_pin(self._port, self._val) @property @@ -37,13 +38,13 @@ def period_ns(self): @property def period_us(self): - return self._period/1000 + return self._period / 1000 def is_high(self): - return (self._val == 1) + return self._val == 1 def is_low(self): - return (self._val == 0) + return self._val == 0 def get_rate(self): return self._clk diff --git a/tests/usb_event.py b/tests/usb_event.py index 910bdfe7..91a343cc 100644 --- a/tests/usb_event.py +++ b/tests/usb_event.py @@ -1,23 +1,22 @@ - import abc -class UsbEvent(object): - def __init__(self, time=0, interEventDelay= 1): #TODO set delay to sensible default +class UsbEvent(object): + def __init__(self, time=0, interEventDelay=1): # TODO set delay to sensible default self._time = time self._interEventDelay = interEventDelay - - #TODO so we want to use relative delays or absolute times? + + # TODO so we want to use relative delays or absolute times? @property def time(self): return self._time - + @property def interEventDelay(self): - return self._interEventDelay + return self._interEventDelay @abc.abstractmethod - def expected_output(self, offset = 0): + def expected_output(self, bus_speed, offset=0): pass # Drive event to simulator @@ -25,7 +24,7 @@ def expected_output(self, offset = 0): def drive(self, usb_phy, bus_speed): pass - #Note, an event might contain events + # Note, an event might contain events @abc.abstractproperty def eventcount(self): pass diff --git a/tests/usb_packet.py b/tests/usb_packet.py index f3850862..48628688 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -65,152 +65,173 @@ # In USB clocks RX_TX_DELAY = 20 -RXA_END_DELAY = 2 # Pad delay not currently simulated in xsim for USB or OTP, so add this delay here -RXA_START_DELAY = 5 #Taken from RTL sim +RXA_END_DELAY = 2 # Pad delay not currently simulated in xsim for USB or OTP, so add this delay here +RXA_START_DELAY = 5 # Taken from RTL sim RX_RX_DELAY = 40 -#TODO shoud we have a PID class? -#TODO remove the inverted check bits +# TODO shoud we have a PID class? +# TODO remove the inverted check bits USB_PID = { - "OUT" : 0xE1, - "IN" : 0x69, - "SETUP" : 0x2D, - "SOF" : 0xA5, - "DATA1" : 0x4b, - "DATA0" : 0xc3, - "ACK" : 0xD2, - "PING" : 0xB4, - "RESERVED" : 0x0F, - "NAK" : 0x5A, - } - -def CreateSofToken(frameNumber, data_valid_count, badCrc = False, interEventDelay=1000): - ep = (frameNumber >> 7) & 0xf - address = (frameNumber) & 0x7f - + "OUT": 0xE1, + "IN": 0x69, + "SETUP": 0x2D, + "SOF": 0xA5, + "DATA1": 0x4B, + "DATA0": 0xC3, + "ACK": 0xD2, + "PING": 0xB4, + "RESERVED": 0x0F, + "NAK": 0x5A, +} + + +def CreateSofToken(frameNumber, data_valid_count, badCrc=False, interEventDelay=1000): + ep = (frameNumber >> 7) & 0xF + address = (frameNumber) & 0x7F + if badCrc: - return TokenPacket(pid=USB_PID['SOF'], address=address, endpoint=ep, data_valid_count=data_valid_count, crc5=0xff, interEventDelay=interEventDelay) + return TokenPacket( + pid=USB_PID["SOF"], + address=address, + endpoint=ep, + data_valid_count=data_valid_count, + crc5=0xFF, + interEventDelay=interEventDelay, + ) else: - return TokenPacket(pid=USB_PID['SOF'], address=address, endpoint=ep, data_valid_count=data_valid_count, interEventDelay=interEventDelay) - + return TokenPacket( + pid=USB_PID["SOF"], + address=address, + endpoint=ep, + data_valid_count=data_valid_count, + interEventDelay=interEventDelay, + ) + return sofToken + def reflect(val, numBits): - valRef = 0; + valRef = 0 for i in range(numBits): - valRef <<= 1; - - if (val & 1): - valRef |= 1; - - val >>= 1; - - return valRef; + valRef <<= 1 + + if val & 1: + valRef |= 1 + + val >>= 1 + + return valRef + def GenCrc16(args): data = args - - crc = 0xffff; - poly = 0x8005; - for byte in data: - topBit = 1 << 15; - crc ^= reflect(int(byte) & int(0xFF), 8) << 8; + crc = 0xFFFF + poly = 0x8005 - for k in range(0,8): + for byte in data: + topBit = 1 << 15 + crc ^= reflect(int(byte) & int(0xFF), 8) << 8 + + for k in range(0, 8): if crc & topBit: - crc = (crc << 1) ^ poly; + crc = (crc << 1) ^ poly else: - crc <<= 1; + crc <<= 1 + + # //crc = crc ^0xffff; + crc = reflect(crc, 16) + crc = ~crc + crc = crc & 0xFFFF + # print "CRC: : {0:#x}".format(crc) + return crc - #//crc = crc ^0xffff; - crc = reflect(crc,16); - crc = ~crc; - crc = crc & 0xffff; - #print "CRC: : {0:#x}".format(crc) - return crc; def GenCrc5(args): - intSize = 32; + intSize = 32 elevenBits = args - poly5 = (0x05 << (intSize - 5)); - crc5 = (0x1F << (intSize - 5)); - udata = (elevenBits << (intSize - 11)); #crc over 11 bits - - iBitcnt = 11; + poly5 = 0x05 << (intSize - 5) + crc5 = 0x1F << (intSize - 5) + udata = elevenBits << (intSize - 11) + # crc over 11 bits + + iBitcnt = 11 while iBitcnt > 0: - if ((udata ^ crc5) & (0x1 << (intSize - 1))): #bit4 != bit4? - crc5 <<= 1; - crc5 ^= poly5; + if (udata ^ crc5) & (0x1 << (intSize - 1)): # bit4 != bit4? + crc5 <<= 1 + crc5 ^= poly5 else: - crc5 <<= 1; - udata <<= 1; - iBitcnt = iBitcnt-1 + crc5 <<= 1 + udata <<= 1 + iBitcnt = iBitcnt - 1 - #Shift back into position - crc5 >>= intSize - 5; + # Shift back into position + crc5 >>= intSize - 5 - #Invert contents to generate crc field - crc5 ^= 0x1f; - - crc5 = reflect(crc5, 5); - return crc5; + # Invert contents to generate crc field + crc5 ^= 0x1F + + crc5 = reflect(crc5, 5) + return crc5 # Functions for creating the data contents of packets def create_data(args): - f_name,f_args = args - func = 'create_data_{}'.format(f_name) + f_name, f_args = args + func = "create_data_{}".format(f_name) return globals()[func](f_args) + def create_data_step(args): - step,num_data_bytes = args - return [(step * i) & 0xff for i in range(num_data_bytes)] + step, num_data_bytes = args + return [(step * i) & 0xFF for i in range(num_data_bytes)] + def create_data_same(args): - value,num_data_bytes = args - return [value & 0xff for i in range(num_data_bytes)] + value, num_data_bytes = args + return [value & 0xFF for i in range(num_data_bytes)] # Functions for creating the expected output that the DUT will print given # this packet def create_data_expect(args): - f_name,f_args = args - func = 'create_data_expect_{}'.format(f_name) + f_name, f_args = args + func = "create_data_expect_{}".format(f_name) return globals()[func](f_args) + def create_data_expect_step(args): - step,num_data_bytes = args + step, num_data_bytes = args return "Step = {0}\n".format(step) + def create_data_expect_same(args): - value,num_data_bytes = args + value, num_data_bytes = args return "Value = {0}\n".format(value) -class BusReset(object): +class BusReset(object): def __init__(self, **kwargs): - self.duration_ms = kwargs.pop('duraton', 10) #Duration of reset - self.bus_speed = kwargs.pop('bus_speed', 'high') #Bus speed to reset into + self.duration_ms = kwargs.pop("duraton", 10) # Duration of reset + self.bus_speed = kwargs.pop("bus_speed", "high") # Bus speed to reset into # Lowest base class for all packets. All USB packets have: # - a PID # - some (or none) data bytes class UsbPacket(UsbEvent): - def __init__(self, **kwargs): - self.pid = kwargs.pop('pid', 0xc3) - self.data_bytes = kwargs.pop('data_bytes', None) - self.num_data_bytes = kwargs.pop('length', 0) - self._data_valid_count = kwargs.pop('data_valid_count', 0) - self.bad_crc = kwargs.pop('bad_crc', False) - ied = kwargs.pop('interEventDelay', 500) #TODO RM magic number - super(UsbPacket, self).__init__(interEventDelay = ied) + self.pid = kwargs.pop("pid", 0xC3) + self.data_bytes = kwargs.pop("data_bytes", None) + self.num_data_bytes = kwargs.pop("length", 0) + self._data_valid_count = kwargs.pop("data_valid_count", 0) + self.bad_crc = kwargs.pop("bad_crc", False) + ied = kwargs.pop("interEventDelay", 500) # TODO RM magic number + super(UsbPacket, self).__init__(interEventDelay=ied) # This is used on HOST->DEVICE (TX) packets to toggle RXValid and DEVICE->HOST (RX) packets to toggle TXReady @property @@ -220,7 +241,7 @@ def data_valid_count(self): @data_valid_count.setter def data_valid_count(self, dvc): self._data_valid_count = dvc - + @property def event_count(self): return 1 @@ -235,20 +256,19 @@ def get_pid_str(self): return "UNKNOWN" -#Rx to host i.e. xCORE Tx +# Rx to host i.e. xCORE Tx class RxPacket(UsbPacket): - def __init__(self, **kwargs): - self._timeout = kwargs.pop('timeout', 25) + self._timeout = kwargs.pop("timeout", 25) super(RxPacket, self).__init__(**kwargs) - @property + @property def timeout(self): return self._timeout - def expected_output(self, offset=0): + def expected_output(self, bus_speed, offset=0): expected_output = "Packet:\tDEVICE -> HOST\n" - + for (i, byte) in enumerate(self.get_bytes()): expected_output += "\tRX byte: {0:#x}\n".format(byte) @@ -270,7 +290,7 @@ def drive(self, usb_phy, bus_speed): timeout = timeout - 1 - #sample TXV for new packet + # sample TXV for new packet if xsi.sample_port_pins(usb_phy._txv) == 1: print("Packet:\tDEVICE -> HOST") in_rx_packet = True @@ -292,7 +312,7 @@ def drive(self, usb_phy, bus_speed): wait(lambda x: usb_phy._clock.is_low()) if xsi.sample_port_pins(usb_phy._txv) == 0: - #print "TXV low, breaking out of loop" + # print "TXV low, breaking out of loop" in_rx_packet = False # End of packet @@ -301,7 +321,11 @@ def drive(self, usb_phy, bus_speed): # Check packet against expected expected = self.get_bytes(do_tokens=False) if len(expected) != len(rx_packet): - print("ERROR: Rx packet length bad. Expecting: {} actual: {}".format(len(expected), len(rx_packet))) + print( + "ERROR: Rx packet length bad. Expecting: {} actual: {}".format( + len(expected), len(rx_packet) + ) + ) # Check packet data against expected if expected != rx_packet: @@ -314,28 +338,26 @@ def drive(self, usb_phy, bus_speed): print("{0:#x}".format(item)) - -#Tx from host i.e. xCORE Rx +# Tx from host i.e. xCORE Rx class TxPacket(UsbPacket): - def __init__(self, **kwargs): - self.rxa_start_delay = kwargs.pop('rxa_start_delay', 2) - self.rxa_end_delay = kwargs.pop('rxa_end_delay', RXA_END_DELAY) - self.rxe_assert_time = kwargs.pop('rxe_assert_time', 0) - self.rxe_assert_length = kwargs.pop('rxe_assert_length', 1) + self.rxa_start_delay = kwargs.pop("rxa_start_delay", 2) + self.rxa_end_delay = kwargs.pop("rxa_end_delay", RXA_END_DELAY) + self.rxe_assert_time = kwargs.pop("rxe_assert_time", 0) + self.rxe_assert_length = kwargs.pop("rxe_assert_length", 1) super(TxPacket, self).__init__(**kwargs) - def expected_output(self, offset=0): + def expected_output(self, bus_speed, offset=0): expected_output = "Packet:\tHOST -> DEVICE\n" expected_output += "\tPID: {} ({:#x})\n".format(self.get_pid_str(), self.pid) return expected_output - def drive(self, usb_phy, bus_speed, verbose = True): - + def drive(self, usb_phy, bus_speed, verbose=True): + xsi = usb_phy.xsi wait = usb_phy.wait - # xCore should not be trying to send if we are trying to send.. + # xCore should not be trying to send if we are trying to send.. if xsi.sample_port_pins(usb_phy._txv) == 1: print("ERROR: Unexpected packet from xCORE") @@ -343,20 +365,24 @@ def drive(self, usb_phy, bus_speed, verbose = True): usb_phy.wait_until(xsi.get_time() + self.interEventDelay) - print("Packet:\tHOST -> DEVICE\n\tPID: {0} ({1:#x})".format(self.get_pid_str(), self.pid)) - + print( + "Packet:\tHOST -> DEVICE\n\tPID: {0} ({1:#x})".format( + self.get_pid_str(), self.pid + ) + ) + # Set RXA high to USB shim xsi.drive_periph_pin(usb_phy._rxa, 1) # Wait for RXA start delay - rxa_start_delay = RXA_START_DELAY; + rxa_start_delay = RXA_START_DELAY while rxa_start_delay != 0: wait(lambda x: usb_phy._clock.is_high()) wait(lambda x: usb_phy._clock.is_low()) - rxa_start_delay = rxa_start_delay- 1; + rxa_start_delay = rxa_start_delay - 1 - for (i, byte) in enumerate(self.get_bytes(do_tokens = False)): + for (i, byte) in enumerate(self.get_bytes(do_tokens=False)): # xCore should not be trying to send if we are trying to send.. if xsi.sample_port_pins(usb_phy._txv) == 1: @@ -381,9 +407,9 @@ def drive(self, usb_phy, bus_speed, verbose = True): if xsi.sample_port_pins(usb_phy._txv) == 1: print("ERROR: Unexpected packet from xCORE") - #print "Sending byte {0:#x}".format(byte) + # print "Sending byte {0:#x}".format(byte) - rxv_count = self.data_valid_count; + rxv_count = self.data_valid_count # Wait for last byte wait(lambda x: usb_phy._clock.is_high()) @@ -393,7 +419,7 @@ def drive(self, usb_phy, bus_speed, verbose = True): xsi.drive_periph_pin(usb_phy._rxer, 0) rxa_end_delay = self.rxa_end_delay - + while rxa_end_delay != 0: # Wait for RXA fall delay TODO, this should be configurable wait(lambda x: usb_phy._clock.is_high()) @@ -406,8 +432,7 @@ def drive(self, usb_phy, bus_speed, verbose = True): xsi.drive_periph_pin(usb_phy._rxa, 0) - -# Implemented such that we can generate malformed packets + # Implemented such that we can generate malformed packets def get_bytes(self, do_tokens=False): bytes = [] if do_tokens: @@ -415,138 +440,166 @@ def get_bytes(self, do_tokens=False): else: bytes.append(self.pid | ((~self.pid) << 4)) for x in range(len(self.data_bytes)): - bytes.append(self.data_bytes[x]) + bytes.append(self.data_bytes[x]) return bytes # DataPacket class, inherits from Usb Packet class DataPacket(UsbPacket): - - def __init__(self, dataPayload = [], **kwargs): + def __init__(self, dataPayload=[], **kwargs): super(DataPacket, self).__init__(**kwargs) - self.pid = kwargs.pop('pid', 0x3) #DATA0 + self.pid = kwargs.pop("pid", 0x3) # DATA0 self.data_bytes = dataPayload def get_packet_bytes(self): packet_bytes = [] packet_bytes = self.data_bytes return packet_bytes - + def get_crc(self, packet_bytes): - crc = GenCrc16(packet_bytes) + crc = GenCrc16(packet_bytes) return crc def get_bytes(self, do_tokens=False): - + bytes = [] if do_tokens: - bytes.append(self.pid) + bytes.append(self.pid) else: - bytes.append(self.pid | (((~self.pid)&0xf) << 4)) + bytes.append(self.pid | (((~self.pid) & 0xF) << 4)) packet_bytes = self.get_packet_bytes() for byte in packet_bytes: bytes.append(byte) if self.bad_crc == True: - crc = 0xbeef - else: + crc = 0xBEEF + else: crc = self.get_crc(packet_bytes) - #Append the 2 bytes of CRC onto the packet + # Append the 2 bytes of CRC onto the packet for i in range(0, 2): - bytes.append((crc >> (8*i)) & 0xff) + bytes.append((crc >> (8 * i)) & 0xFF) return bytes + class RxDataPacket(RxPacket, DataPacket): - def __init__(self, **kwargs): - _pid = self.pid = kwargs.pop('pid', 0x3) #DATA0 + _pid = self.pid = kwargs.pop("pid", 0x3) # DATA0 - #Re-construct full PID - xCORE sends out full PIDn | PID on Tx - super(RxDataPacket, self).__init__(pid = (_pid & 0xf) | (((~_pid)&0xf) << 4), **kwargs) + # Re-construct full PID - xCORE sends out full PIDn | PID on Tx + super(RxDataPacket, self).__init__( + pid=(_pid & 0xF) | (((~_pid) & 0xF) << 4), **kwargs + ) def __str__(self): - return super(DataPacket, self).__str__() + ": RX DataPacket: " + super(DataPacket, self).get_pid_str() + " " + str(self.data_bytes) + return ( + super(DataPacket, self).__str__() + + ": RX DataPacket: " + + super(DataPacket, self).get_pid_str() + + " " + + str(self.data_bytes) + ) -class TxDataPacket(DataPacket, TxPacket): +class TxDataPacket(DataPacket, TxPacket): def __init__(self, **kwargs): super(TxDataPacket, self).__init__(**kwargs) - - def __str__(self): - return super(DataPacket, self).__str__() + ": RX DataPacket: " + super(DataPacket, self).get_pid_str() + " " + str(self.data_bytes) + " Valid CRC: " + str(not self.bad_crc) + "RXE Assert: " + str(self.rxe_assert_time) -#Always TX + def __str__(self): + return ( + super(DataPacket, self).__str__() + + ": RX DataPacket: " + + super(DataPacket, self).get_pid_str() + + " " + + str(self.data_bytes) + + " Valid CRC: " + + str(not self.bad_crc) + + "RXE Assert: " + + str(self.rxe_assert_time) + ) + + +# Always TX class TokenPacket(TxPacket): - def __init__(self, **kwargs): super(TokenPacket, self).__init__(**kwargs) - self.endpoint = kwargs.pop('endpoint', 0) - self.valid = kwargs.pop('valid', 1) - self.address = kwargs.pop('address', 0) - + self.endpoint = kwargs.pop("endpoint", 0) + self.valid = kwargs.pop("valid", 1) + self.address = kwargs.pop("address", 0) + # Generate correct crc5 - crc5 = GenCrc5(reflect(((self.endpoint & 0xf)<<7) | ((self.address & 0x7f)<<0), 11)) - + crc5 = GenCrc5( + reflect(((self.endpoint & 0xF) << 7) | ((self.address & 0x7F) << 0), 11) + ) + # Correct crc5 can be overridden - self.crc5 = kwargs.pop('crc5', crc5) + self.crc5 = kwargs.pop("crc5", crc5) # TODO Always override data_valid count to match IFM for archs < XS3 def get_bytes(self, do_tokens=False): bytes = [] - + if do_tokens: - bytes.append(self.pid & 0xf) + bytes.append(self.pid & 0xF) bytes.append(self.endpoint) else: bytes.append(self.pid) - - tokenbyte0 = self.address | ((self.endpoint & 1) << 7); + + tokenbyte0 = self.address | ((self.endpoint & 1) << 7) tokenbyte1 = (self.endpoint >> 1) | (self.crc5 << 3) - - bytes.append(tokenbyte0); - bytes.append(tokenbyte1); - + + bytes.append(tokenbyte0) + bytes.append(tokenbyte1) + return bytes def __str__(self): - return super(TokenPacket, self).__str__() + ": TokenPacket: " + super(TokenPacket, self).get_pid_str() + return ( + super(TokenPacket, self).__str__() + + ": TokenPacket: " + + super(TokenPacket, self).get_pid_str() + ) # Token valid def get_token_valid(self): return self.valid + class HandshakePacket(UsbPacket): - def __init__(self, **kwargs): super(HandshakePacket, self).__init__(**kwargs) - self.pid = kwargs.pop('pid', USB_PID["ACK"]) #Default to ACK - + self.pid = kwargs.pop("pid", USB_PID["ACK"]) # Default to ACK + def get_bytes(self, do_tokens=False): bytes = [] bytes.append(self.pid) return bytes -class RxHandshakePacket(HandshakePacket, RxPacket): +class RxHandshakePacket(HandshakePacket, RxPacket): def __init__(self, **kwargs): super(RxHandshakePacket, self).__init__(**kwargs) - self.pid = kwargs.pop('pid', 0xd2) #Default to ACK (not expect inverted bits on Rx) - self._timeout = kwargs.pop('timeout', RX_TX_DELAY) #TODO handled by Super() - + self.pid = kwargs.pop( + "pid", 0xD2 + ) # Default to ACK (not expect inverted bits on Rx) + self._timeout = kwargs.pop("timeout", RX_TX_DELAY) # TODO handled by Super() + def __str__(self): - return super(RxHandshakePacket, self).__str__() + ": RX HandshakePacket: " + super(RxHandshakePacket, self).get_pid_str() + return ( + super(RxHandshakePacket, self).__str__() + + ": RX HandshakePacket: " + + super(RxHandshakePacket, self).get_pid_str() + ) + - class TxHandshakePacket(HandshakePacket, TxPacket): - def __init__(self, **kwargs): super(TxHandshakePacket, self).__init__(**kwargs) - + def get_bytes(self, do_tokens=False): bytes = [] if do_tokens: @@ -556,4 +609,8 @@ def get_bytes(self, do_tokens=False): return bytes def __str__(self): - return super(TxHandshakePacket, self).__str__() + ": TX HandshakePacket: " + super(TxHandshakePacket, self).get_pid_str() + return ( + super(TxHandshakePacket, self).__str__() + + ": TX HandshakePacket: " + + super(TxHandshakePacket, self).get_pid_str() + ) diff --git a/tests/usb_phy.py b/tests/usb_phy.py index 1c21469d..b4eb177b 100644 --- a/tests/usb_phy.py +++ b/tests/usb_phy.py @@ -9,36 +9,57 @@ USB_MAX_EP_ADDRESS = 15 -USB_DATA_VALID_COUNT = {'FS': 39, "HS": 0} +USB_DATA_VALID_COUNT = {"FS": 39, "HS": 0} USB_LINESTATE = { - 'IDLE': 0, - 'FS_J': 2, - 'FS_K': 1, - 'HS_J': 1, - 'HS_K': 2, - } + "IDLE": 0, + "FS_J": 2, + "FS_K": 1, + "HS_J": 1, + "HS_K": 2, +} USB_TIMINGS = { - 'IDLE_TO_FS_MIN_US': 300, #Spec: 3000 - 'IDLE_TO_FS_MAX_US': 312, #Spec: 3125 - 'RESUME_FSK_MIN_US': 200, #Spec: 20000us - 'RESUME_SE0_US': 1.25, # 1.25uS - 1.5uS - } + "IDLE_TO_FS_MIN_US": 300, # Spec: 3000 + "IDLE_TO_FS_MAX_US": 312, # Spec: 3125 + "RESUME_FSK_MIN_US": 200, # Spec: 20000us + "RESUME_SE0_US": 1.25, # 1.25uS - 1.5uS +} + class UsbPhy(xmostest.SimThread): # Time in ns from the last packet being sent until the end of test is signalled to the DUT END_OF_TEST_TIME = 5000 - def __init__(self, name, rxd, rxa, rxdv, rxer, txd, txv, txrdy, ls, xcvrsel, termsel, clock, initial_delay, verbose, - test_ctrl, do_timeout, complete_fn, expect_loopback, dut_exit_time): + def __init__( + self, + name, + rxd, + rxa, + rxdv, + rxer, + txd, + txv, + txrdy, + ls, + xcvrsel, + termsel, + clock, + initial_delay, + verbose, + test_ctrl, + do_timeout, + complete_fn, + expect_loopback, + dut_exit_time, + ): self._name = name self._test_ctrl = test_ctrl - self._rxd = rxd #Rx data - self._rxa = rxa #Rx Active - self._rxdv = rxdv #Rx valid - self._rxer = rxer #Rx Error + self._rxd = rxd # Rx data + self._rxa = rxa # Rx Active + self._rxdv = rxdv # Rx valid + self._rxer = rxer # Rx Error self._txd = txd self._txv = txv self._txrdy = txrdy @@ -61,7 +82,7 @@ def name(self): @property def clock(self): return self._clock - + @property def session(self): return self._session @@ -69,9 +90,9 @@ def session(self): @session.setter def session(self, session): self._session = session - + def us_to_clocks(self, time_us): - time_clocks = int(time_us/self._clock.period_us) + time_clocks = int(time_us / self._clock.period_us) return time_clocks def start_test(self): @@ -91,11 +112,13 @@ def end_test(self): if self._do_timeout: # Allow time for a maximum sized packet to arrive - timeout_time = (self._clock.get_bit_time() * 1522 * 8) + timeout_time = self._clock.get_bit_time() * 1522 * 8 if self._expect_loopback: # If looping back then take into account all the data - total_packet_bytes = sum([len(packet.get_bytes()) for packet in self._session.events]) + total_packet_bytes = sum( + [len(packet.get_bytes()) for packet in self._session.events] + ) total_data_bits = total_packet_bytes * 8 # Allow 2 cycles per bit @@ -131,16 +154,9 @@ def run(self): self.start_test() - for i,event in enumerate(self._session.events): + for i, event in enumerate(self._session.events): + + event.drive(self, self._session.bus_speed) - event.drive(self, xsi, self._session.bus_speed) - print("Test done") self.end_test() - - - - - - - diff --git a/tests/usb_phy_shim.py b/tests/usb_phy_shim.py index ec918204..4c1f999a 100644 --- a/tests/usb_phy_shim.py +++ b/tests/usb_phy_shim.py @@ -7,34 +7,63 @@ from usb_packet import RxPacket, TokenPacket from usb_phy import UsbPhy -class UsbPhyShim(UsbPhy): - def __init__(self, rxd, rxa, rxdv, rxer, vld, txd, txv, txrdy, clock, - initial_delay=85000, verbose=False, test_ctrl=None, - do_timeout=True, complete_fn=None, expect_loopback=True, - dut_exit_time=25000): - - # Shim adds a valid token line +class UsbPhyShim(UsbPhy): + def __init__( + self, + rxd, + rxa, + rxdv, + rxer, + vld, + txd, + txv, + txrdy, + clock, + initial_delay=85000, + verbose=False, + test_ctrl=None, + do_timeout=True, + complete_fn=None, + expect_loopback=True, + dut_exit_time=25000, + ): + + # Shim adds a valid token line self._vld = vld - super(UsbPhyShim, self).__init__('mii', rxd, rxa, rxdv, rxer, txd, txv, txrdy, clock, - initial_delay, verbose, test_ctrl, - do_timeout, complete_fn, expect_loopback, - dut_exit_time) + super(UsbPhyShim, self).__init__( + "mii", + rxd, + rxa, + rxdv, + rxer, + txd, + txv, + txrdy, + clock, + initial_delay, + verbose, + test_ctrl, + do_timeout, + complete_fn, + expect_loopback, + dut_exit_time, + ) def run(self): xsi = self.xsi self.start_test() - for i,packet in enumerate(self._packets): - #error_nibbles = packet.get_error_nibbles() - + for i, packet in enumerate(self._packets): + # error_nibbles = packet.get_error_nibbles() + if isinstance(packet, RxPacket): - + timeout = packet.get_timeout() - - #print "Expecting pkt. Timeout in: {i}".format(i=timeout) + + # print "Expecting pkt. Timeout in: {i}".format(i=timeout) in_rx_packet = False rx_packet = [] @@ -45,25 +74,25 @@ def run(self): self.wait(lambda x: self._clock.is_low()) timeout = timeout - 1 - #print "{i}".format(i=timeout) + # print "{i}".format(i=timeout) - #sample TXV for new packet + # sample TXV for new packet if xsi.sample_port_pins(self._txv) == 1: print("Receiving packet {}".format(i)) in_rx_packet = True break - + if in_rx_packet == False: print("ERROR: Timed out waiting for packet") else: - #print "in packet" + # print "in packet" while in_rx_packet == True: - + # TODO txrdy pulsing xsi.drive_port_pins(self._txrdy, 1) data = xsi.sample_port_pins(self._txd) - + print("Received byte: {0:#x}".format(data)) rx_packet.append(data) @@ -71,10 +100,8 @@ def run(self): self.wait(lambda x: self._clock.is_low()) if xsi.sample_port_pins(self._txv) == 0: - #print "TXV low, breaking out of loop" + # print "TXV low, breaking out of loop" in_rx_packet = False - - # End of packet xsi.drive_port_pins(self._txrdy, 0) @@ -82,42 +109,49 @@ def run(self): # Check packet agaist expected expected = packet.get_bytes(do_tokens=True) if len(expected) != len(rx_packet): - print("ERROR: Rx packet length bad. Expecting: {} actual: {}".format(len(expected), len(rx_packet))) - + print( + "ERROR: Rx packet length bad. Expecting: {} actual: {}".format( + len(expected), len(rx_packet) + ) + ) + # Check packet data against expected if expected != rx_packet: print("ERROR: Rx Packet Error. Expected:") for item in expected: print("{0:#x}".format(item)) - print("Received:") + print("Received:") for item in rx_packet: print("{0:#x}".format(item)) else: - # xCore should not be trying to send if we are trying to send.. if xsi.sample_port_pins(self._txv) == 1: print("ERROR: Unexpected packet from xCORE") - rxv_count = packet.get_data_valid_count(); + rxv_count = packet.get_data_valid_count() - #print "Waiting for inter_pkt_gap: {i}".format(i=packet.inter_frame_gap) + # print "Waiting for inter_pkt_gap: {i}".format(i=packet.inter_frame_gap) self.wait_until(xsi.get_time() + packet.inter_pkt_gap) - print("Phy transmitting packet {} PID: {} ({})".format(i, packet.get_pid_pretty(), packet.pid)) + print( + "Phy transmitting packet {} PID: {} ({})".format( + i, packet.get_pid_pretty(), packet.pid + ) + ) if self._verbose: sys.stdout.write(packet.dump()) # Set RXA high xsi.drive_port_pins(self._rxa, 1) - # Wait for RXA rise delay TODO, this should be configurable + # Wait for RXA rise delay TODO, this should be configurable self.wait(lambda x: self._clock.is_high()) self.wait(lambda x: self._clock.is_low()) - #if isinstance(packet, TokenPacket): - # print "Token packet, clear valid token" + # if isinstance(packet, TokenPacket): + # print "Token packet, clear valid token" xsi.drive_port_pins(self._vld, 0) for (i, byte) in enumerate(packet.get_bytes(do_tokens=True)): @@ -132,7 +166,7 @@ def run(self): self.wait(lambda x: self._clock.is_low()) xsi.drive_port_pins(self._rxdv, 1) xsi.drive_port_pins(self._rxd, byte) - + if (packet.rxe_assert_time != 0) and (packet.rxe_assert_time == i): xsi.drive_port_pins(self._rxer, 1) @@ -146,12 +180,12 @@ def run(self): if xsi.sample_port_pins(self._txv) == 1: print("ERROR: Unexpected packet from xCORE") - #print "Sending byte {0:#x}".format(byte) + # print "Sending byte {0:#x}".format(byte) - rxv_count = packet.get_data_valid_count(); + rxv_count = packet.get_data_valid_count() if isinstance(packet, TokenPacket): - #print "Token packet, driving valid" + # print "Token packet, driving valid" if packet.get_token_valid(): xsi.drive_port_pins(self._vld, 1) else: @@ -166,22 +200,19 @@ def run(self): rxa_end_delay = packet.rxa_end_delay while rxa_end_delay != 0: - # Wait for RXA fall delay TODO, this should be configurable + # Wait for RXA fall delay TODO, this should be configurable self.wait(lambda x: self._clock.is_high()) self.wait(lambda x: self._clock.is_low()) rxa_end_delay = rxa_end_delay - 1 - + # xCore should not be trying to send if we are trying to send.. if xsi.sample_port_pins(self._txv) == 1: print("ERROR: Unexpected packet from xCORE") xsi.drive_port_pins(self._rxa, 0) - #if self._verbose: - #print "Sent" + # if self._verbose: + # print "Sent" print("Test done") self.end_test() - - - diff --git a/tests/usb_phy_utmi.py b/tests/usb_phy_utmi.py index 372044db..f28690b1 100644 --- a/tests/usb_phy_utmi.py +++ b/tests/usb_phy_utmi.py @@ -5,15 +5,50 @@ import usb_packet from usb_phy import UsbPhy -class UsbPhyUtmi(UsbPhy): - def __init__(self, rxd, rxa, rxdv, rxer, txd, txv, txrdy, ls, xcvrsel, termsel, clock, - initial_delay=60000, verbose=False, test_ctrl=None, - do_timeout=True, complete_fn=None, expect_loopback=True, - dut_exit_time=25000): +class UsbPhyUtmi(UsbPhy): + def __init__( + self, + rxd, + rxa, + rxdv, + rxer, + txd, + txv, + txrdy, + ls, + xcvrsel, + termsel, + clock, + initial_delay=60000, + verbose=False, + test_ctrl=None, + do_timeout=True, + complete_fn=None, + expect_loopback=True, + dut_exit_time=25000, + ): self._do_tokens = False - super(UsbPhyUtmi, self).__init__('UsbPhyUtmi', rxd, rxa, rxdv, rxer, txd, txv, txrdy, ls, xcvrsel, termsel, clock, - initial_delay, verbose, test_ctrl, - do_timeout, complete_fn, expect_loopback, dut_exit_time) + super(UsbPhyUtmi, self).__init__( + "UsbPhyUtmi", + rxd, + rxa, + rxdv, + rxer, + txd, + txv, + txrdy, + ls, + xcvrsel, + termsel, + clock, + initial_delay, + verbose, + test_ctrl, + do_timeout, + complete_fn, + expect_loopback, + dut_exit_time, + ) diff --git a/tests/usb_session.py b/tests/usb_session.py index 3510ce72..ce7f062c 100644 --- a/tests/usb_session.py +++ b/tests/usb_session.py @@ -1,19 +1,21 @@ - from usb_phy import USB_DATA_VALID_COUNT import usb_transaction import usb_packet # TODO should EP numbers include the IN bit? -def CounterByte(startVal = 0, length = 0): + +def CounterByte(startVal=0, length=0): l = startVal while l < length: yield l % 256 l += 1 -class UsbSession(object): - def __init__(self, bus_speed = "HS", run_enumeration = False, device_address = 0, **kwargs): +class UsbSession(object): + def __init__( + self, bus_speed="HS", run_enumeration=False, device_address=0, **kwargs + ): self._bus_speed = bus_speed self._events = [] self._enumerate = run_enumeration @@ -44,20 +46,25 @@ def enumerate(self): @property def data_valid_count(self): - return USB_DATA_VALID_COUNT[self._bus_speed] + return USB_DATA_VALID_COUNT[self._bus_speed] - def getPayload_out(self, n, length, resend = False): - payload = [(x & 0xff) for x in range(self._dataGen_out[n], self._dataGen_out[n] + length)] + def getPayload_out(self, n, length, resend=False): + payload = [ + (x & 0xFF) + for x in range(self._dataGen_out[n], self._dataGen_out[n] + length) + ] if not resend: self._dataGen_out[n] += length return payload - def getPayload_in(self, n, length, resend = False): - payload = [(x & 0xff) for x in range(self._dataGen_in[n], self._dataGen_in[n] + length)] + def getPayload_in(self, n, length, resend=False): + payload = [ + (x & 0xFF) for x in range(self._dataGen_in[n], self._dataGen_in[n] + length) + ] if not resend: self._dataGen_in[n] += length return payload - + def _pid_toggle(self, pid_table, n): if pid_table[n] == usb_packet.USB_PID["DATA0"]: @@ -65,13 +72,13 @@ def _pid_toggle(self, pid_table, n): else: pid_table[n] = usb_packet.USB_PID["DATA0"] - def data_pid_in(self, n, togglePid = True): + def data_pid_in(self, n, togglePid=True): pid = self._pidTable_in[n] if togglePid: self._pid_toggle(self._pidTable_in, n) return pid - - def data_pid_out(self, n, togglePid = True): + + def data_pid_out(self, n, togglePid=True): pid = self._pidTable_out[n] if togglePid: self._pid_toggle(self._pidTable_out, n) @@ -80,12 +87,14 @@ def data_pid_out(self, n, togglePid = True): def __str__(self): s = "" for e in self._events: - s += str(self._events.index(e)) + ": " + s += str(self._events.index(e)) + ": " s += str(e) + "\n" return s def add_event(self, e): - e.bus_speed = self.bus_speed #TODO ideally dont need transction to know bus speed + e.bus_speed = ( + self.bus_speed + ) # TODO ideally dont need transction to know bus speed self._events.append(e) def pop_event(self, e): @@ -93,4 +102,3 @@ def pop_event(self, e): def _sort_events_by_time(self, events): return sorted(events, key=lambda x: x.time, reverse=True) - diff --git a/tests/usb_signalling.py b/tests/usb_signalling.py index d26e2ad4..4a58a8a8 100644 --- a/tests/usb_signalling.py +++ b/tests/usb_signalling.py @@ -1,27 +1,31 @@ - from usb_event import UsbEvent from usb_phy import USB_LINESTATE, USB_TIMINGS -class UsbResume(UsbEvent): +class UsbResume(UsbEvent): def __init__(self, duration=USB_TIMINGS["RESUME_FSK_MIN_US"], interEventDelay=0): self._duration = duration super().__init__(interEventDelay=interEventDelay) - def expected_output(self, offset=0): + def expected_output(self, bus_speed, offset=0): expected_output = "RESUME\n" expected_output += "RESUME END\n" - expected_output += "DUT ENTERED HS MODE\n" #TODO only if was in HS pre-suspend + + if bus_speed == "HS": + expected_output += ( + "DUT ENTERED HS MODE\n" # TODO only if was in HS pre-suspend + ) + return expected_output def __str__(self): - return "UsbResume: " + str(self._duration) + return "UsbResume: " + str(self._duration) @property def event_count(self): return 1 - - def drive(self, usb_phy, bus_speed): + + def drive(self, usb_phy, bus_speed): xsi = usb_phy.xsi wait = usb_phy.wait @@ -30,65 +34,69 @@ def drive(self, usb_phy, bus_speed): print("ERROR: Unexpected packet from xCORE") resumeStartTime_ns = xsi.get_time() - - #print("RESUME: " + str(resumeStartTime_ns)) + + # print("RESUME: " + str(resumeStartTime_ns)) print("RESUME") # Drive resume signalling - xsi.drive_periph_pin(usb_phy._ls, USB_LINESTATE['FS_K']) - + xsi.drive_periph_pin(usb_phy._ls, USB_LINESTATE["FS_K"]) + while True: wait(lambda x: usb_phy._clock.is_high()) wait(lambda x: usb_phy._clock.is_low()) - + currentTime_ns = xsi.get_time() - if currentTime_ns >= resumeStartTime_ns + (USB_TIMINGS["RESUME_FSK_MIN_US"]*1000): + if currentTime_ns >= resumeStartTime_ns + ( + USB_TIMINGS["RESUME_FSK_MIN_US"] * 1000 + ): break - + endResumeStartTime_ns = xsi.get_time() - #print("TB SE0: " + str(endResumeStartTime_ns)) - xsi.drive_periph_pin(usb_phy._ls, USB_LINESTATE['IDLE']) - + # print("TB SE0: " + str(endResumeStartTime_ns)) + xsi.drive_periph_pin(usb_phy._ls, USB_LINESTATE["IDLE"]) + while True: wait(lambda x: usb_phy._clock.is_high()) wait(lambda x: usb_phy._clock.is_low()) - + currentTime_ns = xsi.get_time() - if currentTime_ns >= endResumeStartTime_ns + (USB_TIMINGS["RESUME_SE0_US"]*1000): - break; - + if currentTime_ns >= endResumeStartTime_ns + ( + USB_TIMINGS["RESUME_SE0_US"] * 1000 + ): + break + print("RESUME END") - #print("RESUME END: " + str(currentTime_ns)) + # print("RESUME END: " + str(currentTime_ns)) if bus_speed == "HS": # Check that the DUT has re-entered HS xcvrsel = xsi.sample_periph_pin(usb_phy._xcvrsel) termsel = xsi.sample_periph_pin(usb_phy._termsel) - + if xcvrsel == 1: print("ERROR: DUT did not enter HS after resume (XCVRSel)") - - if termsel == 1: + + if termsel == 1: print("ERROR: DUT did not enter HS after resume (TermSel)") - print("DUT ENTERED HS MODE") + print("DUT ENTERED HS MODE") -class UsbSuspend(UsbEvent): +class UsbSuspend(UsbEvent): # TODO create instance of Suspend with duracton in seconds and convert to clks? def __init__(self, duration_ns, interEventDelay=0): self._duration_ns = duration_ns super().__init__(interEventDelay=interEventDelay) - def expected_output(self, offset = 0): + def expected_output(self, bus_speed, offset=0): expected_output = "SUSPEND START. WAITING FOR DUT TO ENTER FS\n" expected_output += "DEVICE ENTERED FS MODE\n" expected_output += "SUSPEND END\n" return expected_output - + def __str__(self): - return "UsbSuspend: " + str(self._duration_ns) + return "UsbSuspend: " + str(self._duration_ns) @property def event_count(self): @@ -99,26 +107,26 @@ def drive(self, usb_phy, bus_speed): xsi = usb_phy.xsi wait = usb_phy.wait - # xCore should not be trying to send if we are trying to send.. + # xCore should not be trying to send if we are trying to send.. if xsi.sample_port_pins(usb_phy._txv) == 1: print("ERROR: Unexpected packet from xCORE") suspendStartTime_ns = xsi.get_time() - #print("SUSPEND START TIME: " + str(suspendStartTime_ns)) + # print("SUSPEND START TIME: " + str(suspendStartTime_ns)) assert self.interEventDelay == 0 - # Drive IDLE state onto LS pins - xsi.drive_periph_pin(usb_phy._ls, USB_LINESTATE['IDLE']) - + # Drive IDLE state onto LS pins + xsi.drive_periph_pin(usb_phy._ls, USB_LINESTATE["IDLE"]) + # Within X uS device should transition to FS print("SUSPEND START. WAITING FOR DUT TO ENTER FS") - - while True: + + while True: wait(lambda x: usb_phy._clock.is_high()) wait(lambda x: usb_phy._clock.is_low()) - + # TODO check other pins if xsi.sample_port_pins(usb_phy._txv) == 1: print("ERROR: Unexpected packet from xCORE") @@ -129,21 +137,21 @@ def drive(self, usb_phy, bus_speed): # Wait for DUT to move into FS mode if xcvr == 1 and termsel == 1: - fsTime_ns = xsi.get_time() + fsTime_ns = xsi.get_time() timeToFs_ns = fsTime_ns - suspendStartTime_ns - #print("DEVICE ENTERED FS AT TIME " + str(fsTime_ns/1000) + "(after " + str(timeToFs_ns/1000) +" uS)") - print("DEVICE ENTERED FS MODE"); + # print("DEVICE ENTERED FS AT TIME " + str(fsTime_ns/1000) + "(after " + str(timeToFs_ns/1000) +" uS)") + print("DEVICE ENTERED FS MODE") - if bus_speed == "HS": - if timeToFs_ns < (USB_TIMINGS["IDLE_TO_FS_MIN_US"]*1000): + if bus_speed == "HS": + if timeToFs_ns < (USB_TIMINGS["IDLE_TO_FS_MIN_US"] * 1000): print("ERROR: DUT ENTERED FS MODE TOO SOON") - - # Drive J state onto LS pins - replicate pullup - xsi.drive_periph_pin(usb_phy._ls, USB_LINESTATE['FS_J']) - break; - + + # Drive J state onto LS pins - replicate pullup + xsi.drive_periph_pin(usb_phy._ls, USB_LINESTATE["FS_J"]) + break + time_ns = xsi.get_time() - suspendStartTime_ns - if time_ns > (USB_TIMINGS["IDLE_TO_FS_MAX_US"]*1000): + if time_ns > (USB_TIMINGS["IDLE_TO_FS_MAX_US"] * 1000): print("ERROR: DUT DID NOT ENTER FS MODE IN TIME") # Wait for end of suspend @@ -155,7 +163,7 @@ def drive(self, usb_phy, bus_speed): # xCore should not be trying to send if we are trying to send.. if xsi.sample_port_pins(usb_phy._txv) == 1: print("ERROR: Unexpected packet from xCORE") - + xcvr = xsi.sample_periph_pin(usb_phy._xcvrsel) termsel = xsi.sample_periph_pin(usb_phy._termsel) @@ -165,8 +173,6 @@ def drive(self, usb_phy, bus_speed): time_ns = xsi.get_time() - suspendStartTime_ns if time_ns == self._duration_ns: - #print("SUSPEND END: " + str(xsi.get_time())) + # print("SUSPEND END: " + str(xsi.get_time())) print("SUSPEND END") break - - diff --git a/tests/usb_transaction.py b/tests/usb_transaction.py index f462c7a6..0e38ca77 100644 --- a/tests/usb_transaction.py +++ b/tests/usb_transaction.py @@ -1,20 +1,37 @@ - from usb_event import UsbEvent -from usb_packet import USB_PID, TokenPacket, TxDataPacket, RxHandshakePacket, RxDataPacket, TxHandshakePacket +from usb_packet import ( + USB_PID, + TokenPacket, + TxDataPacket, + RxHandshakePacket, + RxDataPacket, + TxHandshakePacket, +) from usb_phy import USB_DATA_VALID_COUNT INTER_TRANSACTION_DELAY = 500 -USB_DIRECTIONS=["OUT", "IN"] -USB_EP_TYPES=["CONTROL", "BULK", "ISO", "INTERRUPT"] +USB_DIRECTIONS = ["OUT", "IN"] +USB_EP_TYPES = ["CONTROL", "BULK", "ISO", "INTERRUPT"] -#TODO UsbTransaction_IN and UsbTransaction_OUT +# TODO UsbTransaction_IN and UsbTransaction_OUT class UsbTransaction(UsbEvent): + def __init__( + self, + session, + deviceAddress=0, + endpointNumber=0, + endpointType="BULK", + direction="OUT", + bus_speed="HS", + eventTime=0, + dataLength=0, + interEventDelay=INTER_TRANSACTION_DELAY, + badDataCrc=False, + resend=False, + rxeAssertDelay_data=0, + ): # TODO Enums when we move to py3 - def __init__(self, session, deviceAddress = 0, endpointNumber = 0, endpointType = "BULK", - direction="OUT", bus_speed="HS", eventTime = 0, dataLength = 0, interEventDelay=INTER_TRANSACTION_DELAY, badDataCrc = False, - resend=False, rxeAssertDelay_data=0): # TODO Enums when we move to py3 - self._deviceAddress = deviceAddress self._endpointNumber = endpointNumber self._endpointType = endpointType @@ -27,26 +44,35 @@ def __init__(self, session, deviceAddress = 0, endpointNumber = 0, endpointType assert endpointType in USB_EP_TYPES assert direction in USB_DIRECTIONS - # Populate packet list for a (valid) transaction + # Populate packet list for a (valid) transaction self._packets = [] - + # TODO would it be better to generate packets on the fly in drive() rather than create a packet list? if direction == "OUT": packets = [] - packets.append(TokenPacket(interEventDelay = interEventDelay, - pid = USB_PID["OUT"], - address = self._deviceAddress, - endpoint = self._endpointNumber, - data_valid_count = self.data_valid_count)) - - # Don't toggle data pid if we had a bad data crc + packets.append( + TokenPacket( + interEventDelay=interEventDelay, + pid=USB_PID["OUT"], + address=self._deviceAddress, + endpoint=self._endpointNumber, + data_valid_count=self.data_valid_count, + ) + ) + + # Don't toggle data pid if we had a bad data crc if self._badDataCrc or self._rxeAssertDelay_data or endpointType == "ISO": togglePid = False else: togglePid = True - - if (not self._badDataCrc) and (not self._rxeAssertDelay_data) and (deviceAddress == session.deviceAddress) and (self._endpointType != "ISO"): + + if ( + (not self._badDataCrc) + and (not self._rxeAssertDelay_data) + and (deviceAddress == session.deviceAddress) + and (self._endpointType != "ISO") + ): expectHandshake = True else: expectHandshake = False @@ -57,44 +83,63 @@ def __init__(self, session, deviceAddress = 0, endpointNumber = 0, endpointType resend = True # Generate packet data payload - packetPayload = session.getPayload_out(endpointNumber, dataLength, resend=resend) + packetPayload = session.getPayload_out( + endpointNumber, dataLength, resend=resend + ) + + pid = session.data_pid_out(endpointNumber, togglePid=togglePid) + + # Add data packet to packets list + packets.append( + TxDataPacket( + pid=pid, + dataPayload=packetPayload, + bad_crc=self._badDataCrc, + rxe_assert_time=self._rxeAssertDelay_data, + ) + ) - pid = session.data_pid_out(endpointNumber, togglePid = togglePid) - - # Add data packet to packets list - packets.append(TxDataPacket(pid=pid, dataPayload=packetPayload, bad_crc=self._badDataCrc, rxe_assert_time=self._rxeAssertDelay_data)) - if expectHandshake: packets.append(RxHandshakePacket()) - + self._packets.extend(packets) - else: - - self._packets.append(TokenPacket(interEventDelay = interEventDelay, - pid = USB_PID["IN"], - address = self._deviceAddress, - endpoint = self._endpointNumber, - data_valid_count = self.data_valid_count)) + else: + + self._packets.append( + TokenPacket( + interEventDelay=interEventDelay, + pid=USB_PID["IN"], + address=self._deviceAddress, + endpoint=self._endpointNumber, + data_valid_count=self.data_valid_count, + ) + ) # Generate packet data payload - packetPayload = session.getPayload_in(endpointNumber, dataLength); + packetPayload = session.getPayload_in(endpointNumber, dataLength) - if self._badDataCrc or self._rxeAssertDelay_data or self._endpointType == "ISO": + if ( + self._badDataCrc + or self._rxeAssertDelay_data + or self._endpointType == "ISO" + ): togglePid = False else: togglePid = True - pid = session.data_pid_in(endpointNumber, togglePid = togglePid); + pid = session.data_pid_in(endpointNumber, togglePid=togglePid) + + # Add data packet to packets list + self._packets.append(RxDataPacket(pid=pid, dataPayload=packetPayload)) - # Add data packet to packets list - self._packets.append(RxDataPacket(pid=pid, dataPayload = packetPayload)) - if self._endpointType != "ISO": self._packets.append(TxHandshakePacket()) - super(UsbTransaction, self).__init__(time = eventTime, interEventDelay = interEventDelay) - + super(UsbTransaction, self).__init__( + time=eventTime, interEventDelay=interEventDelay + ) + # TODO ideally USBTransaction doesnt know about data_valid_count @property def data_valid_count(self): @@ -123,31 +168,30 @@ def bus_speed(self, bus_speed): @property def event_count(self): eventCount = 0 - + # We should be able to do len(packets) but lets just be sure.. for p in self.packets: eventCount += p.event_count - + # Sanity check assert eventCount == len(self.packets) return eventCount - - def expected_output(self, offset=0): + + def expected_output(self, bus_speed, offset=0): expected_output = "" - + for i, p in enumerate(self.packets): - expected_output += p.expected_output() + expected_output += p.expected_output(bus_speed) - return expected_output + return expected_output def __str__(self): s = "UsbTransaction:\n" for p in self.packets: - s += "\t" + str(p) + "\n" + s += "\t" + str(p) + "\n" return s def drive(self, usb_phy, bus_speed): for i, p in enumerate(self.packets): p.drive(usb_phy, bus_speed) - From 4b03edd122c750c35fef6da444d6097150844aba Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 17 May 2021 13:16:30 +0100 Subject: [PATCH 278/520] Whitespace only --- lib_xud/src/core/XUD_Main.xc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index 56e693b9..70a51b25 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -295,11 +295,11 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c if (one) { - #if defined(XUD_SIM_XSIM) || defined(XUD_BYPASS_CONNECT) - reset = 1; - #else - reset = XUD_Init(); - #endif +#if defined(XUD_SIM_XSIM) || defined(XUD_BYPASS_CONNECT) + reset = 1; +#else + reset = XUD_Init(); +#endif one = 0; } else From dc232099278dd8a8e7e526fd94f1c3254a3ba1a1 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 17 May 2021 13:28:38 +0100 Subject: [PATCH 279/520] Update timing define naming. Removed unused defines. --- lib_xud/src/core/XUD_IoLoop.S | 4 ++-- lib_xud/src/core/XUD_Main.xc | 2 +- lib_xud/src/core/XUD_TimingDefines.h | 24 +++++++++--------------- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/lib_xud/src/core/XUD_IoLoop.S b/lib_xud/src/core/XUD_IoLoop.S index 03f7c051..207dea0c 100755 --- a/lib_xud/src/core/XUD_IoLoop.S +++ b/lib_xud/src/core/XUD_IoLoop.S @@ -19,7 +19,7 @@ .cc_top suspendTimeout.data .align 4 suspendTimeout: -.long SUSPEND_TIMEOUT +.long SUSPEND_TIMEOUT_ticks .cc_bottom suspendTimeout.data .text @@ -27,7 +27,7 @@ suspendTimeout: .cc_top suspend_t_wtwrsths.data .align 4 suspend_t_wtwrsths: -.long SUSPEND_T_WTWRSTHS +.long SUSPEND_T_WTWRSTHS_ticks .cc_bottom suspend_t_wtwrsths.data .text diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index 70a51b25..711dabba 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -306,7 +306,7 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c { timer t; unsigned time; t :> time; - t when timerafter(time + SUSPEND_T_WTWRSTHS) :> int _;// T_WTRSTHS: 100-875us + t when timerafter(time + SUSPEND_T_WTWRSTHS_ticks) :> int _;// T_WTRSTHS: 100-875us /* Sample line state and check for reset (or suspend) */ XUD_LineState_t ls = XUD_HAL_GetLineState(); diff --git a/lib_xud/src/core/XUD_TimingDefines.h b/lib_xud/src/core/XUD_TimingDefines.h index 700d8b97..e9e2d297 100755 --- a/lib_xud/src/core/XUD_TimingDefines.h +++ b/lib_xud/src/core/XUD_TimingDefines.h @@ -8,33 +8,27 @@ #ifndef SUSPEND_TIMEOUT_us #define SUSPEND_TIMEOUT_us (3000) #endif -#define SUSPEND_TIMEOUT (SUSPEND_TIMEOUT_us * REF_CLK_FREQ) +#define SUSPEND_TIMEOUT_ticks (SUSPEND_TIMEOUT_us * REF_CLK_FREQ) // Device attach timing defines -#define T_SIGATT_ULPI_us 5000 // 5ms -#define T_SIGATT_ULPI (T_SIGATT_ULPI_us * REF_CLK_FREQ) -#define T_ATTDB_us 1000000 // 1000ms -#define T_ATTDB (T_ATTDB_us * REF_CLK_FREQ) #define T_UCHEND_T_UCH_us 1000000 // 1000ms #define T_UCHEND_T_UCH (T_UCHEND_T_UCH_us * REF_CLK_FREQ) -#define T_UCHEND_T_UCH_ULPI_us 2000 // 2ms -#define T_UCHEND_T_UCH_ULPI (T_UCHEND_T_UCH_us * REF_CLK_FREQ) #ifdef XUD_TIMING_SHORT -#define T_FILT 100 +#define T_FILT_ticks (100) #else -#define T_FILT_us 3 // 2.5us -#define T_FILT (T_FILT_us * REF_CLK_FREQ) +#define T_FILT_us (3) // 2.5us +#define T_FILT_ticks (T_FILT_us * REF_CLK_FREQ) #endif #ifndef SUSPEND_T_WTWRSTHS_us #define SUSPEND_T_WTWRSTHS_us 200 // 200us Time beforechecking for J after asserting XcvrSelect and Termselect: T_WTRSTHS: 100-875us #endif -#define SUSPEND_T_WTWRSTHS (SUSPEND_T_WTWRSTHS_us * REF_CLK_FREQ) +#define SUSPEND_T_WTWRSTHS_ticks (SUSPEND_T_WTWRSTHS_us * REF_CLK_FREQ) -#define OUT_TIMEOUT_us 500 // How long we wait for data after OUT token -#define OUT_TIMEOUT (OUT_TIMEOUT_us * REF_CLK_FREQ) -#define TX_HANDSHAKE_TIMEOUT_us 5 // How long we wait for handshake after sending tx data -#define TX_HANDSHAKE_TIMEOUT (TX_HANDSHAKE_TIMEOUT_us * REF_CLK_FREQ) +#define OUT_TIMEOUT_us (500) // How long we wait for data after OUT token +#define OUT_TIMEOUT_ticks (OUT_TIMEOUT_us * REF_CLK_FREQ) +#define TX_HANDSHAKE_TIMEOUT_us (5) // How long we wait for handshake after sending tx data +#define TX_HANDSHAKE_TIMEOUT_ticks (TX_HANDSHAKE_TIMEOUT_us * REF_CLK_FREQ) #endif From 8a22a4ae7e1a404f6bf8e0f98a7b144b18a41b02 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 17 May 2021 13:39:29 +0100 Subject: [PATCH 280/520] Removed dead code --- tests/helpers.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/tests/helpers.py b/tests/helpers.py index cfb37ca1..26415320 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -242,21 +242,10 @@ def get_sim_args(testname, clk, phy, arch="xs2"): ) sim_args += ["--vcd-tracing", vcd_args] - # sim_args += ['--xscope', '-offline logs/xscope.xmt'] return sim_args -def packet_processing_time(phy, data_bytes): - """Returns the time it takes the DUT to process a given frame""" - return 6000 * phy.clock.get_bit_time() - - -def choose_small_frame_size(rand): - """Choose the size of a frame near the minimum size frame (46 data bytes)""" - return rand.randint(46, 54) - - def move_to_next_valid_packet(phy): while ( phy.expect_packet_index < phy.num_expected_packets From 12428f11745495602d42b95e7338f7ea7ee28cfa Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 17 May 2021 13:39:41 +0100 Subject: [PATCH 281/520] Fixed ABC hangover from Py2 --- tests/usb_event.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/usb_event.py b/tests/usb_event.py index 91a343cc..401d896c 100644 --- a/tests/usb_event.py +++ b/tests/usb_event.py @@ -1,7 +1,7 @@ -import abc +from abc import ABC, abstractmethod, abstractproperty -class UsbEvent(object): +class UsbEvent(ABC): def __init__(self, time=0, interEventDelay=1): # TODO set delay to sensible default self._time = time self._interEventDelay = interEventDelay @@ -15,18 +15,18 @@ def time(self): def interEventDelay(self): return self._interEventDelay - @abc.abstractmethod + @abstractmethod def expected_output(self, bus_speed, offset=0): pass # Drive event to simulator - @abc.abstractmethod + @abstractmethod def drive(self, usb_phy, bus_speed): pass # Note, an event might contain events - @abc.abstractproperty - def eventcount(self): + @abstractproperty + def event_count(self): pass def __str__(self): From c374aac36cdd8eba85eacfe8d57306563dff690a Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 17 May 2021 13:55:58 +0100 Subject: [PATCH 282/520] Removed dead return --- tests/usb_packet.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/usb_packet.py b/tests/usb_packet.py index 48628688..047ae2cb 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -107,8 +107,6 @@ def CreateSofToken(frameNumber, data_valid_count, badCrc=False, interEventDelay= interEventDelay=interEventDelay, ) - return sofToken - def reflect(val, numBits): From 7241377d9f7aba1099a27c20a85ab86e89ff1a69 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 17 May 2021 14:13:05 +0100 Subject: [PATCH 283/520] CRC gen speed up --- tests/usb_packet.py | 89 +++++++++++++++++---------------------------- 1 file changed, 34 insertions(+), 55 deletions(-) diff --git a/tests/usb_packet.py b/tests/usb_packet.py index 047ae2cb..a3ee609b 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -108,73 +108,52 @@ def CreateSofToken(frameNumber, data_valid_count, badCrc=False, interEventDelay= ) -def reflect(val, numBits): - - valRef = 0 - for i in range(numBits): - valRef <<= 1 - - if val & 1: - valRef |= 1 - - val >>= 1 - - return valRef - - -def GenCrc16(args): - - data = args - +def GenCrc16(data: bytes): + poly = 0xA001 crc = 0xFFFF - poly = 0x8005 - - for byte in data: - topBit = 1 << 15 - crc ^= reflect(int(byte) & int(0xFF), 8) << 8 - - for k in range(0, 8): - if crc & topBit: - crc = (crc << 1) ^ poly + for b in data: + crc ^= 0xFF & b + for _ in range(0, 8): + if crc & 0x0001: + crc = (crc >> 1) ^ poly else: - crc <<= 1 + crc >>= 1 - # //crc = crc ^0xffff; - crc = reflect(crc, 16) - crc = ~crc - crc = crc & 0xFFFF - # print "CRC: : {0:#x}".format(crc) - return crc + return crc ^ 0xFFFF def GenCrc5(args): - intSize = 32 - elevenBits = args + poly = 0x14 + crc = 0x1F + n = args & 0x7FF + i = 11 + + while i > 0: + if (n ^ crc) & 1: + crc = (crc >> 1) ^ poly + else: + crc >>= 1 + i -= 1 + n >>= 1 - poly5 = 0x05 << (intSize - 5) - crc5 = 0x1F << (intSize - 5) - udata = elevenBits << (intSize - 11) - # crc over 11 bits + # Invert contents to generate crc field + crc ^= 0x1F - iBitcnt = 11 + return crc - while iBitcnt > 0: - if (udata ^ crc5) & (0x1 << (intSize - 1)): # bit4 != bit4? - crc5 <<= 1 - crc5 ^= poly5 - else: - crc5 <<= 1 - udata <<= 1 - iBitcnt = iBitcnt - 1 - # Shift back into position - crc5 >>= intSize - 5 +def reflect(val, numBits): - # Invert contents to generate crc field - crc5 ^= 0x1F + valRef = 0 + for i in range(numBits): + valRef <<= 1 + + if val & 1: + valRef |= 1 + + val >>= 1 - crc5 = reflect(crc5, 5) - return crc5 + return valRef # Functions for creating the data contents of packets From f4ee3e21893b3051d49654d5ba9f8bd917ff5865 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 17 May 2021 14:13:37 +0100 Subject: [PATCH 284/520] Removed dead test code and tidy --- tests/usb_phy_shim.py | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/tests/usb_phy_shim.py b/tests/usb_phy_shim.py index 4c1f999a..ad369abd 100644 --- a/tests/usb_phy_shim.py +++ b/tests/usb_phy_shim.py @@ -57,14 +57,11 @@ def run(self): self.start_test() for i, packet in enumerate(self._packets): - # error_nibbles = packet.get_error_nibbles() if isinstance(packet, RxPacket): timeout = packet.get_timeout() - # print "Expecting pkt. Timeout in: {i}".format(i=timeout) - in_rx_packet = False rx_packet = [] @@ -74,7 +71,6 @@ def run(self): self.wait(lambda x: self._clock.is_low()) timeout = timeout - 1 - # print "{i}".format(i=timeout) # sample TXV for new packet if xsi.sample_port_pins(self._txv) == 1: @@ -86,7 +82,6 @@ def run(self): print("ERROR: Timed out waiting for packet") else: - # print "in packet" while in_rx_packet == True: # TODO txrdy pulsing @@ -132,7 +127,6 @@ def run(self): rxv_count = packet.get_data_valid_count() - # print "Waiting for inter_pkt_gap: {i}".format(i=packet.inter_frame_gap) self.wait_until(xsi.get_time() + packet.inter_pkt_gap) print( @@ -150,8 +144,6 @@ def run(self): self.wait(lambda x: self._clock.is_high()) self.wait(lambda x: self._clock.is_low()) - # if isinstance(packet, TokenPacket): - # print "Token packet, clear valid token" xsi.drive_port_pins(self._vld, 0) for (i, byte) in enumerate(packet.get_bytes(do_tokens=True)): @@ -180,12 +172,10 @@ def run(self): if xsi.sample_port_pins(self._txv) == 1: print("ERROR: Unexpected packet from xCORE") - # print "Sending byte {0:#x}".format(byte) - rxv_count = packet.get_data_valid_count() if isinstance(packet, TokenPacket): - # print "Token packet, driving valid" + if packet.get_token_valid(): xsi.drive_port_pins(self._vld, 1) else: @@ -211,8 +201,5 @@ def run(self): xsi.drive_port_pins(self._rxa, 0) - # if self._verbose: - # print "Sent" - print("Test done") self.end_test() From 75b8291c997cec115341bf5c66b56f748109c857 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 19 May 2021 12:12:04 +0100 Subject: [PATCH 285/520] Initial attach test file add --- tests/test_device_attach.py | 74 +++++++++++++++++++++++ tests/test_device_attach/LICENSE.rst | 84 +++++++++++++++++++++++++++ tests/test_device_attach/Makefile | 4 ++ tests/test_device_attach/src/main.xc | 68 ++++++++++++++++++++++ tests/test_device_attach/src/xc_ptr.h | 48 +++++++++++++++ tests/usb_signalling.py | 18 ++++++ 6 files changed, 296 insertions(+) create mode 100644 tests/test_device_attach.py create mode 100644 tests/test_device_attach/LICENSE.rst create mode 100644 tests/test_device_attach/Makefile create mode 100644 tests/test_device_attach/src/main.xc create mode 100644 tests/test_device_attach/src/xc_ptr.h diff --git a/tests/test_device_attach.py b/tests/test_device_attach.py new file mode 100644 index 00000000..cadddd52 --- /dev/null +++ b/tests/test_device_attach.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. + +import xmostest +import usb_packet +from usb_packet import CreateSofToken +from helpers import do_usb_test, RunUsbTest +from usb_session import UsbSession +from usb_transaction import UsbTransaction +from usb_signalling import UsbDeviceAttach + + +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): + + ep = 1 + address = 1 + start_length = 10 + end_length = 12 + pktLength = 10 + frameNumber = 52 # Note, for frame number 52 we expect A5 34 40 on the bus + + session = UsbSession( + bus_speed=usb_speed, run_enumeration=False, device_address=address + ) + + session.add_event(UsbDeviceAttach()) + + session.add_event(CreateSofToken(frameNumber, data_valid_count)) + + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=pktLength, + interEventDelay=0, + ) + ) + + frameNumber = frameNumber + 1 + pktLength = pktLength + 1 + + session.add_event(CreateSofToken(frameNumber, data_valid_count)) + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=pktLength, + interEventDelay=0, + ) + ) + + do_usb_test( + arch, + clk, + phy, + usb_speed, + [session], + __file__, + seed, + level="smoke", + extra_tasks=[], + verbose=verbose, + ) + + +def runtest(): + RunUsbTest(do_test) diff --git a/tests/test_device_attach/LICENSE.rst b/tests/test_device_attach/LICENSE.rst new file mode 100644 index 00000000..ca48f20f --- /dev/null +++ b/tests/test_device_attach/LICENSE.rst @@ -0,0 +1,84 @@ +******************************* +XMOS PUBLIC LICENCE: Version 1 +******************************* + +Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. + +**1. Definitions** + +**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. + +**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. + +**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. + +**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. + +**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. + +**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. + +This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. + + +**2. Licence** + +**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: + +2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: + +2.1.1 for personal or academic, non-commercial purposes; or + +2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): + +(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and + +(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). + +The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. + +2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: + +2.2.1 for personal or academic, non-commercial purposes; or + +2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): + +(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; + +(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and + +(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. + +Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. + +2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. + +**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. + +**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. + +**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. + +**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. + +**7. IPR and Ownership** +Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** + +Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). +Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. + +**8. Termination** + +8.1 This Licence will automatically terminate immediately, without notice to you, if: + +(a) you fail to comply with the terms of this Licence; and/or + +(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or + +(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. + +**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. + +**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. + +**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_device_attach/Makefile b/tests/test_device_attach/Makefile new file mode 100644 index 00000000..6bd91548 --- /dev/null +++ b/tests/test_device_attach/Makefile @@ -0,0 +1,4 @@ + +TEST_FLAGS = -DSUSPEND_TIMEOUT_us=300 -DSUSPEND_T_WTWRSTHS_us=20 + +include ../test_makefile.mak diff --git a/tests/test_device_attach/src/main.xc b/tests/test_device_attach/src/main.xc new file mode 100644 index 00000000..7e4d797e --- /dev/null +++ b/tests/test_device_attach/src/main.xc @@ -0,0 +1,68 @@ +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. +#include +#include +#include +#include "xud.h" +#include "platform.h" +#include "shared.h" + +#define XUD_EP_COUNT_OUT 5 +#define XUD_EP_COUNT_IN 5 + +#ifndef PKT_LENGTH_START +#define PKT_LENGTH_START 10 +#endif + +#ifndef PKT_LENGTH_END +#define PKT_LENGTH_END 11 +#endif + +#ifndef TEST_EP_NUM +#define TEST_EP_NUM 1 +#endif + +/* Endpoint type tables */ +XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; +XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; + +#ifdef XUD_SIM_RTL +int testmain() +#else +int main() +#endif +{ + chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + + par + { + { + #if defined(XUD_TEST_SPEED_FS) + unsigned speed = XUD_SPEED_FS; + #elif defined(XUD_TEST_SPEED_HS) + unsigned speed = XUD_SPEED_HS; + #else + #error XUD_TEST_SPEED_XX not defined + #endif + + XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + null, epTypeTableOut, epTypeTableIn, speed, XUD_PWR_BUS); + } + + { + unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); + + + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep0); + + if(fail) + TerminateFail(fail); + else + TerminatePass(fail); + + } + } + + return 0; +} diff --git a/tests/test_device_attach/src/xc_ptr.h b/tests/test_device_attach/src/xc_ptr.h new file mode 100644 index 00000000..8fa5a04e --- /dev/null +++ b/tests/test_device_attach/src/xc_ptr.h @@ -0,0 +1,48 @@ +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. +#ifndef __xc_ptr__ +#define __xc_ptr__ + +typedef unsigned int xc_ptr; + +// Note that this function is marked as const to avoid the XC +// parallel usage checks, this is only really going to work if this +// is the *only* way the array a is accessed (and everything else uses +// the xc_ptr) +inline xc_ptr array_to_xc_ptr(const unsigned a[]) +{ + xc_ptr x; + asm("mov %0, %1":"=r"(x):"r"(a)); + return x; +} + +inline xc_ptr char_array_to_xc_ptr(const unsigned char a[]) +{ + xc_ptr x; + asm("mov %0, %1":"=r"(x):"r"(a)); + return x; +} + +#define write_via_xc_ptr_indexed(p,i,x) asm volatile("stw %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) +#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) +#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) +#define write_short_via_xc_ptr_indexed(p,i,x) asm volatile("st16 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) + +#define write_via_xc_ptr(p,x) asm volatile("stw %0, %1[0]"::"r"(x),"r"(p)) +// No immediate st8 format +#define write_byte_via_xc_ptr(p,x) write_byte_via_xc_ptr_indexed(p, 0, x) +#define write_short_via_xc_ptr(p,x) write_short_via_xc_ptr_indexed(p, 0, x) + +#define read_via_xc_ptr_indexed(x,p,i) asm("ldw %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); +#define read_byte_via_xc_ptr_indexed(x,p,i) asm("ld8u %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); +#define read_short_via_xc_ptr_indexed(x,p,i) asm("ld16s %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); + +#define read_via_xc_ptr(x,p) asm("ldw %0, %1[0]":"=r"(x):"r"(p)); +// No immediate ld8u format +#define read_byte_via_xc_ptr(x,p) read_byte_via_xc_ptr_indexed(x, p, 0) +#define read_short_via_xc_ptr(x,p) read_short_via_xc_ptr_indexed(x, p, 0) + +#define GET_SHARED_GLOBAL(x, g) asm volatile("ldw %0, dp[" #g "]":"=r"(x)::"memory") +#define SET_SHARED_GLOBAL(g, v) asm volatile("stw %0, dp[" #g "]"::"r"(v):"memory") + +#endif diff --git a/tests/usb_signalling.py b/tests/usb_signalling.py index 4a58a8a8..2b98cbc9 100644 --- a/tests/usb_signalling.py +++ b/tests/usb_signalling.py @@ -2,6 +2,24 @@ from usb_phy import USB_LINESTATE, USB_TIMINGS +class UsbDeviceAttach(UsbEvent): + def __init__(self, interEventDelay=0): + super().__init__(interEventDelay=interEventDelay) + + def __str__(self): + return "DeviceAttach" + + def expected_output(self, bus_speed, offset=0): + return self.__str__() + "\n" + + @property + def event_count(self): + return 1 + + def drive(self, usb_phy, bus_speed): + pass + + class UsbResume(UsbEvent): def __init__(self, duration=USB_TIMINGS["RESUME_FSK_MIN_US"], interEventDelay=0): self._duration = duration From 9d8538669f623b751236c0810a781dae2743a947 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 19 May 2021 12:20:39 +0100 Subject: [PATCH 286/520] Revert "CRC gen speed up" This reverts commit 7241377d9f7aba1099a27c20a85ab86e89ff1a69. --- tests/usb_packet.py | 89 ++++++++++++++++++++++++++++----------------- 1 file changed, 55 insertions(+), 34 deletions(-) diff --git a/tests/usb_packet.py b/tests/usb_packet.py index a3ee609b..047ae2cb 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -108,40 +108,6 @@ def CreateSofToken(frameNumber, data_valid_count, badCrc=False, interEventDelay= ) -def GenCrc16(data: bytes): - poly = 0xA001 - crc = 0xFFFF - for b in data: - crc ^= 0xFF & b - for _ in range(0, 8): - if crc & 0x0001: - crc = (crc >> 1) ^ poly - else: - crc >>= 1 - - return crc ^ 0xFFFF - - -def GenCrc5(args): - poly = 0x14 - crc = 0x1F - n = args & 0x7FF - i = 11 - - while i > 0: - if (n ^ crc) & 1: - crc = (crc >> 1) ^ poly - else: - crc >>= 1 - i -= 1 - n >>= 1 - - # Invert contents to generate crc field - crc ^= 0x1F - - return crc - - def reflect(val, numBits): valRef = 0 @@ -156,6 +122,61 @@ def reflect(val, numBits): return valRef +def GenCrc16(args): + + data = args + + crc = 0xFFFF + poly = 0x8005 + + for byte in data: + topBit = 1 << 15 + crc ^= reflect(int(byte) & int(0xFF), 8) << 8 + + for k in range(0, 8): + if crc & topBit: + crc = (crc << 1) ^ poly + else: + crc <<= 1 + + # //crc = crc ^0xffff; + crc = reflect(crc, 16) + crc = ~crc + crc = crc & 0xFFFF + # print "CRC: : {0:#x}".format(crc) + return crc + + +def GenCrc5(args): + intSize = 32 + elevenBits = args + + poly5 = 0x05 << (intSize - 5) + crc5 = 0x1F << (intSize - 5) + udata = elevenBits << (intSize - 11) + # crc over 11 bits + + iBitcnt = 11 + + while iBitcnt > 0: + if (udata ^ crc5) & (0x1 << (intSize - 1)): # bit4 != bit4? + crc5 <<= 1 + crc5 ^= poly5 + else: + crc5 <<= 1 + udata <<= 1 + iBitcnt = iBitcnt - 1 + + # Shift back into position + crc5 >>= intSize - 5 + + # Invert contents to generate crc field + crc5 ^= 0x1F + + crc5 = reflect(crc5, 5) + return crc5 + + # Functions for creating the data contents of packets def create_data(args): f_name, f_args = args From 30393f4d870db5c35c5ba8a52c63ff0bc8ac8506 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 20 May 2021 23:11:12 +0100 Subject: [PATCH 287/520] Added copyright comment --- tests/usb_signalling.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/usb_signalling.py b/tests/usb_signalling.py index 4a58a8a8..5450c2f0 100644 --- a/tests/usb_signalling.py +++ b/tests/usb_signalling.py @@ -1,3 +1,6 @@ +# Copyright 2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. + from usb_event import UsbEvent from usb_phy import USB_LINESTATE, USB_TIMINGS From eb81cd3d551539cb4e734aedeb0f20666c1a07ab Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 20 May 2021 23:17:19 +0100 Subject: [PATCH 288/520] Removed erroneously added test files --- tests/test_suspend_resume/LICENSE.rst | 84 -------------------------- tests/test_suspend_resume/src/xc_ptr.h | 48 --------------- 2 files changed, 132 deletions(-) delete mode 100644 tests/test_suspend_resume/LICENSE.rst delete mode 100644 tests/test_suspend_resume/src/xc_ptr.h diff --git a/tests/test_suspend_resume/LICENSE.rst b/tests/test_suspend_resume/LICENSE.rst deleted file mode 100644 index ca48f20f..00000000 --- a/tests/test_suspend_resume/LICENSE.rst +++ /dev/null @@ -1,84 +0,0 @@ -******************************* -XMOS PUBLIC LICENCE: Version 1 -******************************* - -Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. - -**1. Definitions** - -**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. - -**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. - -**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. - -**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. - -**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. - -**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. - -This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. - - -**2. Licence** - -**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: - -2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: - -2.1.1 for personal or academic, non-commercial purposes; or - -2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): - -(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and - -(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). - -The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. - -2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: - -2.2.1 for personal or academic, non-commercial purposes; or - -2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): - -(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; - -(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and - -(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. - -Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. - -2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. - -**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. - -**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. - -**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. - -**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. - -**7. IPR and Ownership** -Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** - -Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). -Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. - -**8. Termination** - -8.1 This Licence will automatically terminate immediately, without notice to you, if: - -(a) you fail to comply with the terms of this Licence; and/or - -(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or - -(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. - -**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. - -**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. - -**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_suspend_resume/src/xc_ptr.h b/tests/test_suspend_resume/src/xc_ptr.h deleted file mode 100644 index 8fa5a04e..00000000 --- a/tests/test_suspend_resume/src/xc_ptr.h +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2016-2021 XMOS LIMITED. -// This Software is subject to the terms of the XMOS Public Licence: Version 1. -#ifndef __xc_ptr__ -#define __xc_ptr__ - -typedef unsigned int xc_ptr; - -// Note that this function is marked as const to avoid the XC -// parallel usage checks, this is only really going to work if this -// is the *only* way the array a is accessed (and everything else uses -// the xc_ptr) -inline xc_ptr array_to_xc_ptr(const unsigned a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -inline xc_ptr char_array_to_xc_ptr(const unsigned char a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -#define write_via_xc_ptr_indexed(p,i,x) asm volatile("stw %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_short_via_xc_ptr_indexed(p,i,x) asm volatile("st16 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) - -#define write_via_xc_ptr(p,x) asm volatile("stw %0, %1[0]"::"r"(x),"r"(p)) -// No immediate st8 format -#define write_byte_via_xc_ptr(p,x) write_byte_via_xc_ptr_indexed(p, 0, x) -#define write_short_via_xc_ptr(p,x) write_short_via_xc_ptr_indexed(p, 0, x) - -#define read_via_xc_ptr_indexed(x,p,i) asm("ldw %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_byte_via_xc_ptr_indexed(x,p,i) asm("ld8u %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_short_via_xc_ptr_indexed(x,p,i) asm("ld16s %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); - -#define read_via_xc_ptr(x,p) asm("ldw %0, %1[0]":"=r"(x):"r"(p)); -// No immediate ld8u format -#define read_byte_via_xc_ptr(x,p) read_byte_via_xc_ptr_indexed(x, p, 0) -#define read_short_via_xc_ptr(x,p) read_short_via_xc_ptr_indexed(x, p, 0) - -#define GET_SHARED_GLOBAL(x, g) asm volatile("ldw %0, dp[" #g "]":"=r"(x)::"memory") -#define SET_SHARED_GLOBAL(g, v) asm volatile("stw %0, dp[" #g "]"::"r"(v):"memory") - -#endif From 38bfdd00007b2237af72b5430cce312337227880 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 20 May 2021 23:17:41 +0100 Subject: [PATCH 289/520] Added missing define brackets --- lib_xud/src/core/XUD_TimingDefines.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_xud/src/core/XUD_TimingDefines.h b/lib_xud/src/core/XUD_TimingDefines.h index e9e2d297..32d3b16d 100755 --- a/lib_xud/src/core/XUD_TimingDefines.h +++ b/lib_xud/src/core/XUD_TimingDefines.h @@ -11,7 +11,7 @@ #define SUSPEND_TIMEOUT_ticks (SUSPEND_TIMEOUT_us * REF_CLK_FREQ) // Device attach timing defines -#define T_UCHEND_T_UCH_us 1000000 // 1000ms +#define T_UCHEND_T_UCH_us (1000000) // 1000ms #define T_UCHEND_T_UCH (T_UCHEND_T_UCH_us * REF_CLK_FREQ) #ifdef XUD_TIMING_SHORT @@ -22,7 +22,7 @@ #endif #ifndef SUSPEND_T_WTWRSTHS_us -#define SUSPEND_T_WTWRSTHS_us 200 // 200us Time beforechecking for J after asserting XcvrSelect and Termselect: T_WTRSTHS: 100-875us +#define SUSPEND_T_WTWRSTHS_us (200) // 200us Time beforechecking for J after asserting XcvrSelect and Termselect: T_WTRSTHS: 100-875us #endif #define SUSPEND_T_WTWRSTHS_ticks (SUSPEND_T_WTWRSTHS_us * REF_CLK_FREQ) From aa6eff7c55b4bdb3aab3cda08f5bfb53aa6922b9 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 20 May 2021 23:17:52 +0100 Subject: [PATCH 290/520] Whitespace only --- tests/test_makefile.mak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_makefile.mak b/tests/test_makefile.mak index c5a10e0d..3a851317 100644 --- a/tests/test_makefile.mak +++ b/tests/test_makefile.mak @@ -28,7 +28,7 @@ COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -X -DXUD_SIM_XSIM=1 \ -DXUD_TEST_SPEED_HS=1 \ -DXUD_BYPASS_RESET=1 \ - -DXUD_STARTUP_ADDRESS=1 + -DXUD_STARTUP_ADDRESS=1 #TODO RM ARCH_L define XCC_FLAGS_xs2 = $(TEST_FLAGS) $(COMMON_FLAGS) -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -DARCH_L From eaf0c89c8880ef5161cbb5ce584b05fa6dedacd9 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 20 May 2021 23:18:08 +0100 Subject: [PATCH 291/520] Fixed copyright comment --- tests/test_suspend_resume/src/main.xc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_suspend_resume/src/main.xc b/tests/test_suspend_resume/src/main.xc index 7e4d797e..23ee09a9 100644 --- a/tests/test_suspend_resume/src/main.xc +++ b/tests/test_suspend_resume/src/main.xc @@ -1,4 +1,4 @@ -// Copyright 2016-2021 XMOS LIMITED. +// Copyright 2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include From a7c40a045aee663a3f1a6a2b931c2df61cd41e88 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 20 May 2021 23:20:15 +0100 Subject: [PATCH 292/520] Added missing copyright comments --- tests/usb_event.py | 3 ++- tests/usb_session.py | 3 ++- tests/usb_transaction.py | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/usb_event.py b/tests/usb_event.py index 401d896c..4fb9d37b 100644 --- a/tests/usb_event.py +++ b/tests/usb_event.py @@ -1,4 +1,5 @@ -from abc import ABC, abstractmethod, abstractproperty +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1.rom abc import ABC, abstractmethod, abstractproperty class UsbEvent(ABC): diff --git a/tests/usb_session.py b/tests/usb_session.py index ce7f062c..35811c12 100644 --- a/tests/usb_session.py +++ b/tests/usb_session.py @@ -1,4 +1,5 @@ -from usb_phy import USB_DATA_VALID_COUNT +# Copyright 2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1.rom usb_phy import USB_DATA_VALID_COUNT import usb_transaction import usb_packet diff --git a/tests/usb_transaction.py b/tests/usb_transaction.py index 0e38ca77..a13dfdae 100644 --- a/tests/usb_transaction.py +++ b/tests/usb_transaction.py @@ -1,4 +1,5 @@ -from usb_event import UsbEvent +# Copyright 2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1.rom usb_event import UsbEvent from usb_packet import ( USB_PID, TokenPacket, From f5a770e82fd518d98a8cb30cc66e19e3b907f74a Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 20 May 2021 23:53:12 +0100 Subject: [PATCH 293/520] Define guard --- lib_xud/src/core/XUD_TimingDefines.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib_xud/src/core/XUD_TimingDefines.h b/lib_xud/src/core/XUD_TimingDefines.h index 32d3b16d..c9030013 100755 --- a/lib_xud/src/core/XUD_TimingDefines.h +++ b/lib_xud/src/core/XUD_TimingDefines.h @@ -3,8 +3,11 @@ #ifndef _XUD_USB_DEFINES_H_ #define _XUD_USB_DEFINES_H_ -// Defines relating to USB/ULPI/UTMI/Phy specs +#ifndef REF_CLK_FREQ #define REF_CLK_FREQ (100) +#endif + +// Defines relating to USB/ULPI/UTMI/Phy specs #ifndef SUSPEND_TIMEOUT_us #define SUSPEND_TIMEOUT_us (3000) #endif From 4f8bd37e626015ba15f6e3413beeeb75779c1942 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 20 May 2021 23:59:03 +0100 Subject: [PATCH 294/520] Added XUD_HAL_EnterMode_TristateDrivers() --- lib_xud/src/core/XUD_HAL.h | 6 ++++-- lib_xud/src/core/XUD_HAL.xc | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/lib_xud/src/core/XUD_HAL.h b/lib_xud/src/core/XUD_HAL.h index ec0b8c7c..af6ecbc1 100644 --- a/lib_xud/src/core/XUD_HAL.h +++ b/lib_xud/src/core/XUD_HAL.h @@ -9,15 +9,16 @@ #include "xud.h" #include +#define USB_TILE_REF usb_tile + #ifdef __XS3A__ #include -// TODO shoudl be properlty in HAL +// TODO should be properlty in HAL unsigned XtlSelFromMhz(unsigned m); #else #include "XUD_USBTile_Support.h" #include "xs1_to_glx.h" #include "xs2_su_registers.h" -#define USB_TILE_REF usb_tile #endif /** @@ -36,6 +37,7 @@ void XUD_HAL_EnterMode_PeripheralChirp(); void XUD_HAL_EnterMode_PeripheralFullSpeed(); void XUD_HAL_EnterMode_PeripheralHighSpeed(); void XUD_HAL_EnterMode_PeripheralTestJTestK(); +void XUD_HAL_EnterMode_TristateDrivers(); /** * \brief Get current linestate status diff --git a/lib_xud/src/core/XUD_HAL.xc b/lib_xud/src/core/XUD_HAL.xc index 66d0525e..f8bf7055 100644 --- a/lib_xud/src/core/XUD_HAL.xc +++ b/lib_xud/src/core/XUD_HAL.xc @@ -9,7 +9,6 @@ #ifdef __XS2A__ #include "xs1_to_glx.h" #include "xs2_su_registers.h" -#include "XUD_USBTile_Support.h" extern in port flag0_port; extern in port flag1_port; extern in port flag2_port; @@ -230,6 +229,39 @@ void XUD_HAL_EnterMode_PeripheralTestJTestK() #endif } +void XUD_HAL_EnterMode_TristateDrivers() +{ +#ifdef __XS2A__ + write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_FUNC_CONTROL_NUM, 4); +#else + /* From ULPI Specification Revsion 1.1, table 41 + * XcvrSelect: XXb + * TermSelect: Xb + * OpMode: 01b + * DpPullDown Xb + * DmPullDown: Xb + */ + unsigned d = 0; + d = XS1_USB_PHY_CFG0_UTMI_XCVRSELECT_SET(d, 0); + d = XS1_USB_PHY_CFG0_UTMI_TERMSELECT_SET(d, 0); + d = XS1_USB_PHY_CFG0_UTMI_OPMODE_SET(d, 1); + d = XS1_USB_PHY_CFG0_DMPULLDOWN_SET(d, 0); + d = XS1_USB_PHY_CFG0_DPPULLDOWN_SET(d, 0); + + d = XS1_USB_PHY_CFG0_UTMI_SUSPENDM_SET(d, 1); + d = XS1_USB_PHY_CFG0_TXBITSTUFF_EN_SET(d, 1); + d = XS1_USB_PHY_CFG0_PLL_EN_SET(d, 1); + d = XS1_USB_PHY_CFG0_LPM_ALIVE_SET(d, 0); + d = XS1_USB_PHY_CFG0_IDPAD_EN_SET(d, 0); + + unsigned xtlSelVal = XtlSelFromMhz(XUD_OSC_MHZ); + d = XS1_USB_PHY_CFG0_XTLSEL_SET(d, xtlSelVal); + + write_sswitch_reg(get_local_tile_id(), XS1_SSWITCH_USB_PHY_CFG0_NUM, d); +#endif +} + + void XUD_HAL_Mode_PowerSig() { #ifdef __XS2A__ From 287198d13d9bd040153924da001f4d6b8b0e0576 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 20 May 2021 23:59:44 +0100 Subject: [PATCH 295/520] Fixed define names in DeviceAttach --- lib_xud/src/core/XUD_DeviceAttach.xc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_xud/src/core/XUD_DeviceAttach.xc b/lib_xud/src/core/XUD_DeviceAttach.xc index 61c8cddc..7deec566 100755 --- a/lib_xud/src/core/XUD_DeviceAttach.xc +++ b/lib_xud/src/core/XUD_DeviceAttach.xc @@ -107,7 +107,7 @@ int XUD_DeviceAttachHS(XUD_PwrConfig pwrConfig) #warning J and K definitons are reversed in XS3A #endif case detecting_k => flag1_port when pinseq(1):> void @ tx: // K Chirp - flag1_port @ tx + T_FILT :> tmp; + flag1_port @ tx + T_FILT_ticks :> tmp; if (tmp) { detecting_k = 0; @@ -115,7 +115,7 @@ int XUD_DeviceAttachHS(XUD_PwrConfig pwrConfig) break; case !detecting_k => flag0_port when pinseq(1) :> void @ tx: // J Chirp - flag0_port @ tx + T_FILT :> tmp; + flag0_port @ tx + T_FILT_ticks :> tmp; if (tmp == 1) { chirpCount++; // Seen an extra K-J pair From 0ec9af2cdc498c951d3a894279304fec8a98ec08 Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 21 May 2021 00:00:29 +0100 Subject: [PATCH 296/520] Fix disconnect on invalid VBUS on xs3 (using HAL function) --- lib_xud/src/core/XUD_DeviceAttach.xc | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib_xud/src/core/XUD_DeviceAttach.xc b/lib_xud/src/core/XUD_DeviceAttach.xc index 7deec566..232d2e7f 100755 --- a/lib_xud/src/core/XUD_DeviceAttach.xc +++ b/lib_xud/src/core/XUD_DeviceAttach.xc @@ -2,13 +2,11 @@ // This Software is subject to the terms of the XMOS Public Licence: Version 1. #if !defined(XUD_BYPASS_RESET) && !defined(XUD_SIM_XSIM) #include -#include #include +#include "xud.h" #include "XUD_USB_Defines.h" #include "XUD_TimingDefines.h" -#include "XUD_Support.h" -#include "xud.h" - +//#include "XUD_Support.h" #include "XUD_HAL.h" extern in port flag0_port; @@ -16,9 +14,9 @@ extern in port flag1_port; extern in port flag2_port; extern out buffered port:32 p_usb_txd; -#define TUCHEND_DELAY_us 1500 // 1.5ms +#define TUCHEND_DELAY_us (1500) // 1.5ms #define TUCHEND_DELAY (TUCHEND_DELAY_us * REF_CLK_FREQ) -#define INVALID_DELAY_us 2500 // 2.5ms +#define INVALID_DELAY_us (2500) // 2.5ms #define INVALID_DELAY (INVALID_DELAY_us * REF_CLK_FREQ) extern int resetCount; @@ -96,8 +94,8 @@ int XUD_DeviceAttachHS(XUD_PwrConfig pwrConfig) { if(!XUD_HAL_GetVBusState()) { - write_periph_word(USB_TILE_REF, XS1_SU_PER_UIFM_CHANEND_NUM, XS1_SU_PER_UIFM_FUNC_CONTROL_NUM, 4); - return -1; // VBUS gone, handshake fails completely. + XUD_HAL_EnterMode_TristateDrivers(); + return -1; // VBUS gone, handshake fails completely. } } } From 94e3b8f3f3910ae4d6048b99685db106b37ff0b3 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 24 May 2021 15:50:42 +0100 Subject: [PATCH 297/520] Fixed errononeous line merging --- tests/usb_event.py | 4 ++-- tests/usb_session.py | 4 +++- tests/usb_transaction.py | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/usb_event.py b/tests/usb_event.py index 4fb9d37b..2c0f3cc4 100644 --- a/tests/usb_event.py +++ b/tests/usb_event.py @@ -1,6 +1,6 @@ # Copyright 2016-2021 XMOS LIMITED. -# This Software is subject to the terms of the XMOS Public Licence: Version 1.rom abc import ABC, abstractmethod, abstractproperty - +# This Software is subject to the terms of the XMOS Public Licence: Version 1. +from abc import ABC, abstractmethod, abstractproperty class UsbEvent(ABC): def __init__(self, time=0, interEventDelay=1): # TODO set delay to sensible default diff --git a/tests/usb_session.py b/tests/usb_session.py index 35811c12..aa27f69c 100644 --- a/tests/usb_session.py +++ b/tests/usb_session.py @@ -1,5 +1,7 @@ # Copyright 2021 XMOS LIMITED. -# This Software is subject to the terms of the XMOS Public Licence: Version 1.rom usb_phy import USB_DATA_VALID_COUNT +# This Software is subject to the terms of the XMOS Public Licence: Version 1 + +from usb_phy import USB_DATA_VALID_COUNT import usb_transaction import usb_packet diff --git a/tests/usb_transaction.py b/tests/usb_transaction.py index a13dfdae..3821de54 100644 --- a/tests/usb_transaction.py +++ b/tests/usb_transaction.py @@ -1,5 +1,7 @@ # Copyright 2021 XMOS LIMITED. -# This Software is subject to the terms of the XMOS Public Licence: Version 1.rom usb_event import UsbEvent +# This Software is subject to the terms of the XMOS Public Licence: Version 1. + +from usb_event import UsbEvent from usb_packet import ( USB_PID, TokenPacket, From 9f383b29f1fd2acef1c26546b80ad143d13d7bf3 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 25 May 2021 16:25:29 +0100 Subject: [PATCH 298/520] test_device_attach tidy --- tests/test_device_attach.py | 2 +- tests/test_device_attach/LICENSE.rst | 84 --------------------------- tests/test_device_attach/src/main.xc | 3 +- tests/test_device_attach/src/xc_ptr.h | 48 --------------- tests/usb_event.py | 1 + 5 files changed, 4 insertions(+), 134 deletions(-) delete mode 100644 tests/test_device_attach/LICENSE.rst delete mode 100644 tests/test_device_attach/src/xc_ptr.h diff --git a/tests/test_device_attach.py b/tests/test_device_attach.py index cadddd52..1d9cdd6e 100644 --- a/tests/test_device_attach.py +++ b/tests/test_device_attach.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2016-2021 XMOS LIMITED. +# Copyright 2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. import xmostest diff --git a/tests/test_device_attach/LICENSE.rst b/tests/test_device_attach/LICENSE.rst deleted file mode 100644 index ca48f20f..00000000 --- a/tests/test_device_attach/LICENSE.rst +++ /dev/null @@ -1,84 +0,0 @@ -******************************* -XMOS PUBLIC LICENCE: Version 1 -******************************* - -Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. - -**1. Definitions** - -**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. - -**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. - -**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. - -**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. - -**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. - -**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. - -This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. - - -**2. Licence** - -**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: - -2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: - -2.1.1 for personal or academic, non-commercial purposes; or - -2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): - -(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and - -(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). - -The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. - -2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: - -2.2.1 for personal or academic, non-commercial purposes; or - -2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): - -(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; - -(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and - -(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. - -Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. - -2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. - -**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. - -**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. - -**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. - -**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. - -**7. IPR and Ownership** -Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** - -Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). -Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. - -**8. Termination** - -8.1 This Licence will automatically terminate immediately, without notice to you, if: - -(a) you fail to comply with the terms of this Licence; and/or - -(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or - -(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. - -**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. - -**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. - -**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_device_attach/src/main.xc b/tests/test_device_attach/src/main.xc index 7e4d797e..f7e53eb1 100644 --- a/tests/test_device_attach/src/main.xc +++ b/tests/test_device_attach/src/main.xc @@ -1,5 +1,6 @@ -// Copyright 2016-2021 XMOS LIMITED. +// Copyright 2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. + #include #include #include diff --git a/tests/test_device_attach/src/xc_ptr.h b/tests/test_device_attach/src/xc_ptr.h deleted file mode 100644 index 8fa5a04e..00000000 --- a/tests/test_device_attach/src/xc_ptr.h +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2016-2021 XMOS LIMITED. -// This Software is subject to the terms of the XMOS Public Licence: Version 1. -#ifndef __xc_ptr__ -#define __xc_ptr__ - -typedef unsigned int xc_ptr; - -// Note that this function is marked as const to avoid the XC -// parallel usage checks, this is only really going to work if this -// is the *only* way the array a is accessed (and everything else uses -// the xc_ptr) -inline xc_ptr array_to_xc_ptr(const unsigned a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -inline xc_ptr char_array_to_xc_ptr(const unsigned char a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -#define write_via_xc_ptr_indexed(p,i,x) asm volatile("stw %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_short_via_xc_ptr_indexed(p,i,x) asm volatile("st16 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) - -#define write_via_xc_ptr(p,x) asm volatile("stw %0, %1[0]"::"r"(x),"r"(p)) -// No immediate st8 format -#define write_byte_via_xc_ptr(p,x) write_byte_via_xc_ptr_indexed(p, 0, x) -#define write_short_via_xc_ptr(p,x) write_short_via_xc_ptr_indexed(p, 0, x) - -#define read_via_xc_ptr_indexed(x,p,i) asm("ldw %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_byte_via_xc_ptr_indexed(x,p,i) asm("ld8u %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_short_via_xc_ptr_indexed(x,p,i) asm("ld16s %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); - -#define read_via_xc_ptr(x,p) asm("ldw %0, %1[0]":"=r"(x):"r"(p)); -// No immediate ld8u format -#define read_byte_via_xc_ptr(x,p) read_byte_via_xc_ptr_indexed(x, p, 0) -#define read_short_via_xc_ptr(x,p) read_short_via_xc_ptr_indexed(x, p, 0) - -#define GET_SHARED_GLOBAL(x, g) asm volatile("ldw %0, dp[" #g "]":"=r"(x)::"memory") -#define SET_SHARED_GLOBAL(g, v) asm volatile("stw %0, dp[" #g "]"::"r"(v):"memory") - -#endif diff --git a/tests/usb_event.py b/tests/usb_event.py index 2c0f3cc4..85bc24d8 100644 --- a/tests/usb_event.py +++ b/tests/usb_event.py @@ -2,6 +2,7 @@ # This Software is subject to the terms of the XMOS Public Licence: Version 1. from abc import ABC, abstractmethod, abstractproperty + class UsbEvent(ABC): def __init__(self, time=0, interEventDelay=1): # TODO set delay to sensible default self._time = time From b34bc404831497193c430b6bf5e005fe2283387a Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 26 May 2021 09:57:28 +0100 Subject: [PATCH 299/520] Added more USB timing values --- tests/usb_phy.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/usb_phy.py b/tests/usb_phy.py index b4eb177b..c00c76f3 100644 --- a/tests/usb_phy.py +++ b/tests/usb_phy.py @@ -24,7 +24,11 @@ "IDLE_TO_FS_MAX_US": 312, # Spec: 3125 "RESUME_FSK_MIN_US": 200, # Spec: 20000us "RESUME_SE0_US": 1.25, # 1.25uS - 1.5uS -} + 'T_UCHEND': 7000, # Upstream Chirp end time + 'T_UCH': 1000, # Upstream Chirp length + 'T_SIGATT_US': 100000, # Maximum time from Vbus valid to when the device must signal attach + 'T_ATTDB_US': 100000, # Debouce interval. The dives now enters the HS Detection Handshake protocol + } class UsbPhy(xmostest.SimThread): From fe6577d20cc9b06cd3bcb1719a28de476263bb8a Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 26 May 2021 09:57:37 +0100 Subject: [PATCH 300/520] Comment only --- tests/usb_signalling.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/usb_signalling.py b/tests/usb_signalling.py index 73343641..0533aca1 100644 --- a/tests/usb_signalling.py +++ b/tests/usb_signalling.py @@ -20,6 +20,39 @@ def event_count(self): return 1 def drive(self, usb_phy, bus_speed): + + # Check XcvrSel & TermSel low + + # Drive VBUS + + # Check device asserts XcvrSel and TermSel before T_SIGATT + + # Bus state: Idle (FS 'J') + + # Drive bus reset (SE0) after T_ATTDB - This is T0 + + # Check DUT enables HS Transceiver and asserts Chirp K on the bus (XcvrSel low, TxValid high) + # (This needs to be done before T_UCHEND - T_UCH) + + # Check that Chirp K lasts atleast T_UCH + + # Check that Chirp K ends before T_UCHEND + + # if bus_speed == "HS": + # Before end of Chirp K + T_WTDCH assert chirp K on the bus + + # After between T_DCHBIT_MIN and T_DCHBIT_MAX toogle chirp K to chirp J + + # After between T_DCHBIT_MIN and T_DCHBIT_MAX toogle chirp J to chirp K + + # After atleast X chirp pairs ensure DUT de-asserts TermSel to enter HS mode + + # Terminate downstream chirp K-J Sequence (between T_DCHSE0_MAX and T_DCHSE0_MIN + + # Endure DUT enters HS before T0 + T_DRST + + # Drive HS Idle (SE0) on bus + pass From 9694173baa4db1f38c4aac6dcf73f354094109dd Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 26 May 2021 10:28:48 +0100 Subject: [PATCH 301/520] Fixed test build fails --- tests/test_bulk_rx_traffic.py | 3 ++- tests/test_sof_basic.py | 5 ++--- tests/usb_event.py | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/test_bulk_rx_traffic.py b/tests/test_bulk_rx_traffic.py index 7bc5b163..0ad4803d 100644 --- a/tests/test_bulk_rx_traffic.py +++ b/tests/test_bulk_rx_traffic.py @@ -1,13 +1,14 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. + import xmostest from usb_packet import * import usb_packet from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction -from usb_phy import MAX_ENDPOINT_ADDRESS +from usb_phy import USB_MAX_EP_ADDRESS def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): diff --git a/tests/test_sof_basic.py b/tests/test_sof_basic.py index 4df9e9ee..b3354c97 100644 --- a/tests/test_sof_basic.py +++ b/tests/test_sof_basic.py @@ -2,9 +2,8 @@ # Copyright 2019-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. import xmostest -from usb_packet import * -import usb_packet -from helpers import do_usb_test, RunUsbTest, CreateSofToken +from usb_packet import CreateSofToken +from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction diff --git a/tests/usb_event.py b/tests/usb_event.py index 2c0f3cc4..85bc24d8 100644 --- a/tests/usb_event.py +++ b/tests/usb_event.py @@ -2,6 +2,7 @@ # This Software is subject to the terms of the XMOS Public Licence: Version 1. from abc import ABC, abstractmethod, abstractproperty + class UsbEvent(ABC): def __init__(self, time=0, interEventDelay=1): # TODO set delay to sensible default self._time = time From fe99fe69eeadcc0800f0e500c6d65f1065f199f0 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 26 May 2021 17:44:13 +0100 Subject: [PATCH 302/520] Modded test makefiles such that BYPASS_RESET is not the default behaviour --- lib_xud/src/core/XUD_DeviceAttach.xc | 2 +- tests/test_bulk_loopback/Makefile | 2 + tests/test_bulk_rx_basic/Makefile | 2 + tests/test_bulk_rx_basic_badcrc32/Makefile | 2 + tests/test_bulk_rx_basic_badpid/Makefile | 2 + tests/test_bulk_rx_basic_nodata/Makefile | 2 + tests/test_bulk_rx_basic_rxerror/Makefile | 2 + tests/test_bulk_rx_multiep/Makefile | 2 + tests/test_bulk_rx_traffic/Makefile | 2 + tests/test_bulk_tx_badack/Makefile | 2 + tests/test_bulk_tx_basic/Makefile | 2 + tests/test_bulk_tx_basic_short/Makefile | 2 + tests/test_bulk_tx_multiep/Makefile | 2 + tests/test_bulk_tx_noack/Makefile | 2 + tests/test_control_basic_get/Makefile | 3 +- tests/test_control_basic_set/Makefile | 3 +- tests/test_control_basic_short/Makefile | 43 +--------------------- tests/test_invalidtoken/Makefile | 2 + tests/test_iso_loopback/Makefile | 2 + tests/test_iso_rx_basic/Makefile | 2 + tests/test_iso_tx_basic/Makefile | 2 + tests/test_makefile.mak | 1 - tests/test_ping_rx_basic/Makefile | 2 + tests/test_shorttoken/Makefile | 2 + tests/test_sof_badcrc/Makefile | 2 + tests/test_sof_basic/Makefile | 2 + 26 files changed, 49 insertions(+), 45 deletions(-) diff --git a/lib_xud/src/core/XUD_DeviceAttach.xc b/lib_xud/src/core/XUD_DeviceAttach.xc index 232d2e7f..8c94bdca 100755 --- a/lib_xud/src/core/XUD_DeviceAttach.xc +++ b/lib_xud/src/core/XUD_DeviceAttach.xc @@ -1,6 +1,6 @@ // Copyright 2011-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -#if !defined(XUD_BYPASS_RESET) && !defined(XUD_SIM_XSIM) +#if !defined(XUD_BYPASS_RESET) #include #include #include "xud.h" diff --git a/tests/test_bulk_loopback/Makefile b/tests/test_bulk_loopback/Makefile index 6aed3e76..a2c9ee98 100644 --- a/tests/test_bulk_loopback/Makefile +++ b/tests/test_bulk_loopback/Makefile @@ -1 +1,3 @@ +TEST_FLAGS = -DXUD_BYPASS_RESET=1 + include ../test_makefile.mak diff --git a/tests/test_bulk_rx_basic/Makefile b/tests/test_bulk_rx_basic/Makefile index 6aed3e76..a2c9ee98 100644 --- a/tests/test_bulk_rx_basic/Makefile +++ b/tests/test_bulk_rx_basic/Makefile @@ -1 +1,3 @@ +TEST_FLAGS = -DXUD_BYPASS_RESET=1 + include ../test_makefile.mak diff --git a/tests/test_bulk_rx_basic_badcrc32/Makefile b/tests/test_bulk_rx_basic_badcrc32/Makefile index 6aed3e76..a2c9ee98 100644 --- a/tests/test_bulk_rx_basic_badcrc32/Makefile +++ b/tests/test_bulk_rx_basic_badcrc32/Makefile @@ -1 +1,3 @@ +TEST_FLAGS = -DXUD_BYPASS_RESET=1 + include ../test_makefile.mak diff --git a/tests/test_bulk_rx_basic_badpid/Makefile b/tests/test_bulk_rx_basic_badpid/Makefile index 6aed3e76..a2c9ee98 100644 --- a/tests/test_bulk_rx_basic_badpid/Makefile +++ b/tests/test_bulk_rx_basic_badpid/Makefile @@ -1 +1,3 @@ +TEST_FLAGS = -DXUD_BYPASS_RESET=1 + include ../test_makefile.mak diff --git a/tests/test_bulk_rx_basic_nodata/Makefile b/tests/test_bulk_rx_basic_nodata/Makefile index 6aed3e76..a2c9ee98 100644 --- a/tests/test_bulk_rx_basic_nodata/Makefile +++ b/tests/test_bulk_rx_basic_nodata/Makefile @@ -1 +1,3 @@ +TEST_FLAGS = -DXUD_BYPASS_RESET=1 + include ../test_makefile.mak diff --git a/tests/test_bulk_rx_basic_rxerror/Makefile b/tests/test_bulk_rx_basic_rxerror/Makefile index 6aed3e76..a2c9ee98 100644 --- a/tests/test_bulk_rx_basic_rxerror/Makefile +++ b/tests/test_bulk_rx_basic_rxerror/Makefile @@ -1 +1,3 @@ +TEST_FLAGS = -DXUD_BYPASS_RESET=1 + include ../test_makefile.mak diff --git a/tests/test_bulk_rx_multiep/Makefile b/tests/test_bulk_rx_multiep/Makefile index 6aed3e76..a2c9ee98 100644 --- a/tests/test_bulk_rx_multiep/Makefile +++ b/tests/test_bulk_rx_multiep/Makefile @@ -1 +1,3 @@ +TEST_FLAGS = -DXUD_BYPASS_RESET=1 + include ../test_makefile.mak diff --git a/tests/test_bulk_rx_traffic/Makefile b/tests/test_bulk_rx_traffic/Makefile index 6aed3e76..a2c9ee98 100644 --- a/tests/test_bulk_rx_traffic/Makefile +++ b/tests/test_bulk_rx_traffic/Makefile @@ -1 +1,3 @@ +TEST_FLAGS = -DXUD_BYPASS_RESET=1 + include ../test_makefile.mak diff --git a/tests/test_bulk_tx_badack/Makefile b/tests/test_bulk_tx_badack/Makefile index 6aed3e76..a2c9ee98 100644 --- a/tests/test_bulk_tx_badack/Makefile +++ b/tests/test_bulk_tx_badack/Makefile @@ -1 +1,3 @@ +TEST_FLAGS = -DXUD_BYPASS_RESET=1 + include ../test_makefile.mak diff --git a/tests/test_bulk_tx_basic/Makefile b/tests/test_bulk_tx_basic/Makefile index 6aed3e76..a2c9ee98 100644 --- a/tests/test_bulk_tx_basic/Makefile +++ b/tests/test_bulk_tx_basic/Makefile @@ -1 +1,3 @@ +TEST_FLAGS = -DXUD_BYPASS_RESET=1 + include ../test_makefile.mak diff --git a/tests/test_bulk_tx_basic_short/Makefile b/tests/test_bulk_tx_basic_short/Makefile index 6aed3e76..a2c9ee98 100644 --- a/tests/test_bulk_tx_basic_short/Makefile +++ b/tests/test_bulk_tx_basic_short/Makefile @@ -1 +1,3 @@ +TEST_FLAGS = -DXUD_BYPASS_RESET=1 + include ../test_makefile.mak diff --git a/tests/test_bulk_tx_multiep/Makefile b/tests/test_bulk_tx_multiep/Makefile index 6aed3e76..a2c9ee98 100644 --- a/tests/test_bulk_tx_multiep/Makefile +++ b/tests/test_bulk_tx_multiep/Makefile @@ -1 +1,3 @@ +TEST_FLAGS = -DXUD_BYPASS_RESET=1 + include ../test_makefile.mak diff --git a/tests/test_bulk_tx_noack/Makefile b/tests/test_bulk_tx_noack/Makefile index 6aed3e76..a2c9ee98 100644 --- a/tests/test_bulk_tx_noack/Makefile +++ b/tests/test_bulk_tx_noack/Makefile @@ -1 +1,3 @@ +TEST_FLAGS = -DXUD_BYPASS_RESET=1 + include ../test_makefile.mak diff --git a/tests/test_control_basic_get/Makefile b/tests/test_control_basic_get/Makefile index 1dcd7b5d..a2c9ee98 100644 --- a/tests/test_control_basic_get/Makefile +++ b/tests/test_control_basic_get/Makefile @@ -1,2 +1,3 @@ -include ../test_makefile.mak +TEST_FLAGS = -DXUD_BYPASS_RESET=1 +include ../test_makefile.mak diff --git a/tests/test_control_basic_set/Makefile b/tests/test_control_basic_set/Makefile index 1dcd7b5d..a2c9ee98 100644 --- a/tests/test_control_basic_set/Makefile +++ b/tests/test_control_basic_set/Makefile @@ -1,2 +1,3 @@ -include ../test_makefile.mak +TEST_FLAGS = -DXUD_BYPASS_RESET=1 +include ../test_makefile.mak diff --git a/tests/test_control_basic_short/Makefile b/tests/test_control_basic_short/Makefile index f0398897..a2c9ee98 100644 --- a/tests/test_control_basic_short/Makefile +++ b/tests/test_control_basic_short/Makefile @@ -1,42 +1,3 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. +TEST_FLAGS = -DXUD_BYPASS_RESET=1 -TARGET = test.xn - -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name - -APP_NAME = - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. - -SHARED_CODE = ../../shared_src - -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) -DUSB_TILE=tile[0] -DSIMULATION -DARCH_L - -XCC_FLAGS_xs2 = $(COMMON_FLAGS) -DARCH_X200 -DXUD_SERIES_SUPPORT=XUD_X200_SERIES - -ifeq ($(CONFIG),$(filter $(CONFIG),xs2)) - TARGET = test_xs2.xn -endif - - - -# The USED_MODULES variable lists other module used by the application. -USED_MODULES = lib_xud - - -#============================================================================= -# The following part of the Makefile includes the common build infrastructure -# for compiling XMOS applications. You should not need to edit below here. - -XMOS_MAKE_PATH ?= ../.. -include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common +include ../test_makefile.mak diff --git a/tests/test_invalidtoken/Makefile b/tests/test_invalidtoken/Makefile index 6aed3e76..a2c9ee98 100644 --- a/tests/test_invalidtoken/Makefile +++ b/tests/test_invalidtoken/Makefile @@ -1 +1,3 @@ +TEST_FLAGS = -DXUD_BYPASS_RESET=1 + include ../test_makefile.mak diff --git a/tests/test_iso_loopback/Makefile b/tests/test_iso_loopback/Makefile index 6aed3e76..a2c9ee98 100644 --- a/tests/test_iso_loopback/Makefile +++ b/tests/test_iso_loopback/Makefile @@ -1 +1,3 @@ +TEST_FLAGS = -DXUD_BYPASS_RESET=1 + include ../test_makefile.mak diff --git a/tests/test_iso_rx_basic/Makefile b/tests/test_iso_rx_basic/Makefile index 6aed3e76..a2c9ee98 100644 --- a/tests/test_iso_rx_basic/Makefile +++ b/tests/test_iso_rx_basic/Makefile @@ -1 +1,3 @@ +TEST_FLAGS = -DXUD_BYPASS_RESET=1 + include ../test_makefile.mak diff --git a/tests/test_iso_tx_basic/Makefile b/tests/test_iso_tx_basic/Makefile index 6aed3e76..a2c9ee98 100644 --- a/tests/test_iso_tx_basic/Makefile +++ b/tests/test_iso_tx_basic/Makefile @@ -1 +1,3 @@ +TEST_FLAGS = -DXUD_BYPASS_RESET=1 + include ../test_makefile.mak diff --git a/tests/test_makefile.mak b/tests/test_makefile.mak index 3a851317..f991970a 100644 --- a/tests/test_makefile.mak +++ b/tests/test_makefile.mak @@ -27,7 +27,6 @@ COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -X -Wno-timing \ -DXUD_SIM_XSIM=1 \ -DXUD_TEST_SPEED_HS=1 \ - -DXUD_BYPASS_RESET=1 \ -DXUD_STARTUP_ADDRESS=1 #TODO RM ARCH_L define diff --git a/tests/test_ping_rx_basic/Makefile b/tests/test_ping_rx_basic/Makefile index 6aed3e76..a2c9ee98 100644 --- a/tests/test_ping_rx_basic/Makefile +++ b/tests/test_ping_rx_basic/Makefile @@ -1 +1,3 @@ +TEST_FLAGS = -DXUD_BYPASS_RESET=1 + include ../test_makefile.mak diff --git a/tests/test_shorttoken/Makefile b/tests/test_shorttoken/Makefile index 6aed3e76..a2c9ee98 100644 --- a/tests/test_shorttoken/Makefile +++ b/tests/test_shorttoken/Makefile @@ -1 +1,3 @@ +TEST_FLAGS = -DXUD_BYPASS_RESET=1 + include ../test_makefile.mak diff --git a/tests/test_sof_badcrc/Makefile b/tests/test_sof_badcrc/Makefile index 6aed3e76..a2c9ee98 100644 --- a/tests/test_sof_badcrc/Makefile +++ b/tests/test_sof_badcrc/Makefile @@ -1 +1,3 @@ +TEST_FLAGS = -DXUD_BYPASS_RESET=1 + include ../test_makefile.mak diff --git a/tests/test_sof_basic/Makefile b/tests/test_sof_basic/Makefile index 6aed3e76..a2c9ee98 100644 --- a/tests/test_sof_basic/Makefile +++ b/tests/test_sof_basic/Makefile @@ -1 +1,3 @@ +TEST_FLAGS = -DXUD_BYPASS_RESET=1 + include ../test_makefile.mak From 9c4c4f3ccbc8f0132a14cf36ffa6b6d72c1aea30 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 27 May 2021 11:14:38 +0100 Subject: [PATCH 303/520] Start of implementation for device attach test --- tests/usb_signalling.py | 54 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 4 deletions(-) diff --git a/tests/usb_signalling.py b/tests/usb_signalling.py index 0533aca1..d7f3c800 100644 --- a/tests/usb_signalling.py +++ b/tests/usb_signalling.py @@ -13,6 +13,7 @@ def __str__(self): return "DeviceAttach" def expected_output(self, bus_speed, offset=0): + #return "DeviceAttach\n" return self.__str__() + "\n" @property @@ -21,22 +22,68 @@ def event_count(self): def drive(self, usb_phy, bus_speed): + wait = usb_phy.wait + time = usb_phy.xsi.get_time + xsi = usb_phy.xsi + + tConnect_ns = time() + + print(self.__str__() + "\n") + # Check XcvrSel & TermSel low + xcvrsel = xsi.sample_periph_pin(usb_phy._xcvrsel) + termsel = xsi.sample_periph_pin(usb_phy._termsel) - # Drive VBUS + if xcvrsel == 1: + print("ERROR: DUT enabled pull up before valid Vbus (XCVRSel)") - # Check device asserts XcvrSel and TermSel before T_SIGATT + if termsel == 1: + print("ERROR: DUT enabled pull up before valid Vbus (TermSel)") + + # TODO Drive VBUS + + while True: + + if (time() - tConnect_ns) > USB_TIMINGS['T_SIGATT_US']: + print("ERROR: DUT didnt not assert XcvrSel & TermSel quickly enough") + + # Check device asserts XcvrSel and TermSel before T_SIGATT + xcvrsel = xsi.sample_periph_pin(usb_phy._xcvrsel) + termsel = xsi.sample_periph_pin(usb_phy._termsel) + + if xcvrsel == 1 and termsel == 1: + break; # Bus state: Idle (FS 'J') + xsi.drive_periph_pin(usb_phy._ls, USB_LINESTATE["FS_J"]) - # Drive bus reset (SE0) after T_ATTDB - This is T0 + # Drive bus reset (SE0) after T_ATTDB - This is T0 of Figure 25 + wait(USB_TIMINGS['T_ATTDB_US']) + xsi.drive_periph_pin(usb_phy._ls, USB_LINESTATE["SE0"]) # Check DUT enables HS Transceiver and asserts Chirp K on the bus (XcvrSel low, TxValid high) # (This needs to be done before T_UCHEND - T_UCH) + while True: + xcvrsel = xsi.sample_periph_pin(usb_phy._xcvrsel) + txv = xsi.sample_periph_pin(usb_phy._txv) + + if xcvrsel == 1 and txv == 1: + t_ChirpStart_ns = time() + break; # Check that Chirp K lasts atleast T_UCH + while True: + txv = xsi.sample_periph_pin(usb_phy._txv) + + if txv == 0: + t_ChirpEnd_ns = time() + if (t_ChirpEnd_ns - t_ChirpStart_ns) < USB_TIMINGS["T_UCH"]: + print("ERROR: Upstream chirp too short") + break; # Check that Chirp K ends before T_UCHEND + if (t_ChirpEnd - tConnect_ns) > USB_TIMINGS["T_UCHEND"]: + print("ERROR: Upstream chirp finished too late") # if bus_speed == "HS": # Before end of Chirp K + T_WTDCH assert chirp K on the bus @@ -53,7 +100,6 @@ def drive(self, usb_phy, bus_speed): # Drive HS Idle (SE0) on bus - pass class UsbResume(UsbEvent): From 3097691da97a5bad18240cc92e3f3df6a272e1fc Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 27 May 2021 11:35:17 +0100 Subject: [PATCH 304/520] Add missing define to test_suspend_resume Makefile --- tests/test_suspend_resume/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_suspend_resume/Makefile b/tests/test_suspend_resume/Makefile index 6bd91548..6dd0ad9e 100644 --- a/tests/test_suspend_resume/Makefile +++ b/tests/test_suspend_resume/Makefile @@ -1,4 +1,4 @@ -TEST_FLAGS = -DSUSPEND_TIMEOUT_us=300 -DSUSPEND_T_WTWRSTHS_us=20 +TEST_FLAGS = -DSUSPEND_TIMEOUT_us=300 -DSUSPEND_T_WTWRSTHS_us=20 -DXUD_BYPASS_RESET=1 include ../test_makefile.mak From e09d4c7b8a4feeac38e6346f10bc1a118a9fcc65 Mon Sep 17 00:00:00 2001 From: Kevin Yeung Date: Mon, 31 May 2021 17:02:13 +0800 Subject: [PATCH 305/520] move to pytest --- tests/Pyxsim/__init__.py | 134 ++++++++ tests/Pyxsim/pyxsim.py | 448 +++++++++++++++++++++++++++ tests/Pyxsim/testers.py | 114 +++++++ tests/Pyxsim/xe.py | 98 ++++++ tests/Pyxsim/xmostest_subprocess.py | 250 +++++++++++++++ tests/helpers.py | 174 +++++------ tests/test_bulk_loopback.py | 9 +- tests/test_bulk_rx_basic.py | 10 +- tests/test_bulk_rx_basic_badcrc32.py | 11 +- tests/test_bulk_rx_basic_badpid.py | 9 +- tests/test_bulk_rx_basic_nodata.py | 10 +- tests/test_bulk_rx_basic_rxerror.py | 9 +- tests/test_bulk_rx_multiep.py | 10 +- tests/test_bulk_rx_traffic.py | 10 +- tests/test_bulk_tx_badack.py | 9 +- tests/test_bulk_tx_basic.py | 10 +- tests/test_bulk_tx_basic_short.py | 9 +- tests/test_bulk_tx_multiep.py | 10 +- tests/test_bulk_tx_noack.py | 9 +- tests/test_control_basic_get.py | 9 +- tests/test_control_basic_set.py | 9 +- tests/test_invalidtoken.py | 9 +- tests/test_iso_loopback.py | 10 +- tests/test_iso_rx_basic.py | 9 +- tests/test_iso_rxtx_fastpacket.py | 10 +- tests/test_iso_tx_basic.py | 9 +- tests/test_ping_rx_basic.py | 10 +- tests/test_shorttoken.py | 10 +- tests/test_sof_badcrc.py | 9 +- tests/test_sof_basic.py | 9 +- tests/test_suspend_resume.py | 10 +- 31 files changed, 1249 insertions(+), 207 deletions(-) create mode 100644 tests/Pyxsim/__init__.py create mode 100644 tests/Pyxsim/pyxsim.py create mode 100644 tests/Pyxsim/testers.py create mode 100644 tests/Pyxsim/xe.py create mode 100644 tests/Pyxsim/xmostest_subprocess.py diff --git a/tests/Pyxsim/__init__.py b/tests/Pyxsim/__init__.py new file mode 100644 index 00000000..ed3b8f96 --- /dev/null +++ b/tests/Pyxsim/__init__.py @@ -0,0 +1,134 @@ + +""" +Pyxsim pytest framework + +This module provides functions to run tests for XMOS applications and libraries. +""" +import sys +import Pyxsim.pyxsim +from Pyxsim.xmostest_subprocess import call_get_output +import platform +import multiprocessing +import re +import os + +clean_only = False + +# This function is called automatically by the runners +def _build(xe_path, build_config=None, env={}, do_clean = False): + + # Work out the Makefile path + path = None + m = re.match('(.*)/bin/(.*)', xe_path) + if m: + path = m.groups(0)[0] + binpath = m.groups(0)[1] + m = re.match('(.*)/(.*)', binpath) + if m: + build_config=m.groups(0)[0] + + if not path: + msg = "ERROR: Cannot determine path to build: %s\n" % xe_path + sys.stderr.write(msg) + return (False, msg) + + # Copy the environment, to avoid modifying the env of the current shell + my_env = os.environ.copy() + for key in env: + my_env[key] = str(env[key]) + + if clean_only: + cmd = ['xmake', 'clean'] + do_clean = False + else: + cmd = ['xmake', 'all'] + + if do_clean: + call(['xmake', 'clean'], cwd = path, env = my_env) + + if build_config != None: + cmd += ['CONFIG=%s' % build_config] + + output = call_get_output(cmd, cwd = path, env = my_env, + merge_out_and_err = True) + + success = True + for x in output: + s = str(x) + if s.find('Error') != -1: + # if x.find('Error') != -1: + success = False + # if re.match('xmake: \*\*\* .* Stop.', x) != None: + if re.match('xmake: \*\*\* .* Stop.', s) != None: + success = False + + if not success: + sys.stderr.write("ERROR: build failed.\n") + for x in output: + s = str(x) + sys.stderr.write(s) + + return (success, output) + +def do_run_pyxsim(xe, simargs, appargs, simthreads): + xsi = pyxsim.Xsi(xe_path=xe, simargs=simargs, appargs=appargs) + for x in simthreads: + xsi.register_simthread(x) + xsi.run() + xsi.terminate() + +def run_with_pyxsim(xe, simthreads, xscope_io = False, loopback=[], + simargs=[], appargs=[], + suppress_multidrive_messages=False, tester=None, timeout=600, + initial_delay=None, start_after_started=[], + start_after_completed=[]): + + p = multiprocessing.Process(target=do_run_pyxsim, args=(xe, simargs, appargs, simthreads)) + p.start() + p.join(timeout=timeout) + if p.is_alive(): + sys.stderr.write("Simulator timed out\n") + p.terminate() + return None + +def run_tester(caps, tester_list): + separate_word = [index for index, element in enumerate(caps) if element.strip() == "Test done"] + result = [] + if len(separate_word) > 1: + i = 0 + start = 0 + stop = 0 + while(i + +import os, re, struct +from ctypes import cdll, byref, c_void_p, c_char_p, c_int, create_string_buffer +from Pyxsim.xe import Xe +import threading +import traceback +import Pyxsim +import sys +from Pyxsim.xmostest_subprocess import platform_is_windows + +ALL_BITS = 0xffffff + +if platform_is_windows(): + xsi_lib_path = os.path.abspath(os.environ['XCC_EXEC_PREFIX'] + '../lib/xsidevice.dll') +else: + xsi_lib_path = os.path.abspath(os.environ['XCC_EXEC_PREFIX'] + '../lib/libxsidevice.so') + +xsi_lib = cdll.LoadLibrary(xsi_lib_path) + +def xsi_is_valid_port(port): + return (re.match('XS1_PORT_\d+\w', port) != None) + +def xsi_get_port_width(port): + if not xsi_is_valid_port(port): + return None + else: + return int(re.match('^XS1_PORT_(\d+)\w', port).groups(0)[0]) + +class EnumExceptionSet: + + def __init__(self, enum_list, valid_list=[]): + self.enum_list = enum_list + self.valid_list = valid_list + + def __getattr__(self, name): + if name in self.enum_list: + return self.enum_list.index(name) + raise AttributeErr + + def is_valid(self, value): + if value < len(self.enum_list): + enum = self.enum_list[value] + return (enum in self.valid_list) + + def error_if_not_valid(self, value): + if value < len(self.enum_list): + enum = self.enum_list[value] + if not enum in self.valid_list: + raise type('XSI_ERROR_' + enum,(Exception,),{}) + + def error(self, value): + if value < len(self.enum_list): + enum = self.enum_list[value] + raise type('XSI_ERROR_' + enum,(Exception,),{}) + + +XsiStatus = EnumExceptionSet(['OK', + 'DONE', + 'TIMEOUT', + 'INVALID_FILE', + 'INVALID_INSTANCE', + 'INVALID_TILE', + 'INVALID_PACKAGE', + 'INVALID_PIN', + 'INVALID_PORT', + 'MEMORY_ERROR', + 'PSWITCH_ERROR', + 'INVALID_ARGS', + 'NULL_ARG', + 'INCOMPATIBLE_VERSION'], + valid_list = ['OK','DONE']) + + +def parse_port(p): + m = re.match('(tile.*)\:([^\.]*)\.?(\d*)',p) + if m: + tile = m.groups(0)[0] + port = m.groups(0)[1] + bit = m.groups(0)[2] + if bit == '': + bit = None + if bit != None: + bit = int(bit) + else: + raise Pyxsim.XmosTestError("Cannot parse port: %s" % p) + if bit != None: + mask = (1<= time) + self._wait(_resume) + + def _wait_for_port_pins_change(self, ps): + is_driving = [] + vals = [] + ps = [(self._xsi.xe.get_port_pins(p)[0], parse_port(p)) for p in ps] + for ((package, pin, _), (tile, p, bit, mask)) in ps: + d = self._xsi.is_pin_driving(package, pin) + is_driving.append(d) + if d: + v = self._xsi.sample_port_pins(tile, p, mask) + if bit: + v = v >> bit + vals.append(v) + else: + vals.append(0) + def _resume(xsi): + for i in range(len(ps)): + (package, pin, _), (tile, p, bit, mask) = ps[i] + d = xsi.is_pin_driving(package, pin) + if d != is_driving[i]: + return True + if d: + v = xsi.sample_port_pins(tile, p, mask) + if bit: + v = v >> bit + else: + v = 0 + if v != vals[i]: + return True + return False + self._wait(_resume) + + def _wait_for_next_cycle(self): + self._wait(lambda x: True) + + def is_port_driving(self, port): + (package, pin, _) = self._xsi.xe.get_port_pins(port)[0] + return self._xsi.is_pin_driving(package, pin) + + def drive_port_pins(self, port, val): + (tile, p, bit, mask) = parse_port(port) + if bit: + val <<= bit + self._xsi.drive_port_pins(tile, p, mask, val) + + def sample_port_pins(self, port): + (tile, p, bit, mask) = parse_port(port) + val = self._xsi.sample_port_pins(tile, p, mask) + if bit: + val >>= bit + return val + + # TODO make this pin*s* + def drive_periph_pin(self, pin, val): + (periph, pin, mask) = parse_periph_pin(pin) + self._xsi.drive_periph_pin(periph, pin, mask, val) + + # TODO make this pin*s* + def sample_periph_pin(self, pin): + (periph, pin, mask) = parse_periph_pin(pin) + return self._xsi.sample_periph_pin(periph, pin, mask) + + def terminate(self): + self.terminate_flag = True + self._wait(lambda x: False) + + def run(self): + args = self._args + try: + self._fn(*args) + except: + self.had_exception = True + sys.stderr.write("---------Exception in simthread--------------\n") + traceback.print_exc() + sys.stderr.write("---------------------------------------------\n") + self.resume_condition = lambda x: False + self.complete_event.set() + +class Xsi(object): + def __init__(self, xe_path=None, simargs=[], appargs=[]): + self.xsim = c_void_p() + self.xe_path = xe_path + args = " ".join(['"{}"'.format(x) for x in (simargs + [self.xe_path] + appargs)]) + if platform_is_windows: + args = args.replace('\\','/') + c_args = c_char_p(args.encode('utf-8')) + status = xsi_lib.xsi_create(byref(self.xsim), c_args) + self._plugins = [] + self._simthreads = [] + self._time = 0 + + def register_plugin(self, plugin): + self._plugins.append(plugin) + + def register_simthread(self, fn): + if isinstance(fn, tuple): + xs = list(fn) + fn = xs[0] + args = xs[1:] + else: + args = [] + + simthread = SimThreadImpl(self, fn, args) + simthread.daemon = True + self._simthreads.append(simthread) + + + def wait_for_simthread(self, simthread): + simthread.complete_event.wait() + simthread.complete_event.clear() + if simthread.had_exception: + raise Pyxsim.XmosTestError("Simthread encoutered an exception") + + def clock(self): + status = xsi_lib.xsi_clock(self.xsim) + self._time += self._time_step + if XsiStatus.is_valid(status): + for plugin in self._plugins: + plugin.clock(self) + for simthread in self._simthreads: + if simthread.resume_condition(self): + simthread.resume_event.set() + self.wait_for_simthread(simthread) + if simthread.terminate_flag: + return XsiStatus.DONE + + return status + + def get_time(self): + return self._time + + def run(self): + self.xe = Xe(self.xe_path) + self._time_step = float(pow(10,3)) / self.xe.freq + status = XsiStatus.OK + for simthread in self._simthreads: + simthread.start() + self.wait_for_simthread(simthread) + + while (status != XsiStatus.DONE): + status = self.clock() + XsiStatus.error_if_not_valid(status) + + def terminate(self): + status = xsi_lib.xsi_terminate(self.xsim) + XsiStatus.error_if_not_valid(status) + + def sample_pin(self, package, pin): + c_package = c_char_p(package) + c_pin = c_char_p(pin) + c_value = c_int() + status = xsi_lib.xsi_sample_pin(self.xsim, c_package, c_pin, + byref(c_value)) + XsiStatus.error_if_not_valid(status) + return c_value.value + + def sample_port_pins(self, tile, port, mask): + c_tile = c_char_p(tile.encode('utf-8')) + c_port = c_char_p(port.encode('utf-8')) + c_mask = c_int(mask) + c_value = c_int() + status = xsi_lib.xsi_sample_port_pins(self.xsim, c_tile, c_port, + c_mask, byref(c_value)) + XsiStatus.error_if_not_valid(status) + return c_value.value + + def drive_pin(self, package, pin, value): + c_package = c_char_p(package) + c_pin = c_char_p(pin) + c_value = c_int(value) + status = xsi_lib.xsi_drive_pin(self.xsim, c_package, c_pin, + c_value) + XsiStatus.error_if_not_valid(status) + + def drive_port_pins(self, tile, port, mask, value): + c_tile = c_char_p(tile.encode('utf-8')) + c_port = c_char_p(port.encode('utf-8')) + c_mask = c_int(mask) + c_value = c_int(value) + status = xsi_lib.xsi_drive_port_pins(self.xsim, c_tile, c_port, + c_mask, c_value) + XsiStatus.error_if_not_valid(status) + + # TOOD make this pin*s* + def drive_periph_pin(self, periph, pin, mask, value): + c_periph = c_char_p(periph.encode('utf-8')) + c_pin = c_char_p(pin.encode('utf-8')) + c_mask = c_int(mask) + c_value = c_int(value) + status = xsi_lib.xsi_drive_periph_pin(self.xsim, c_periph, c_pin, + c_mask, c_value) + XsiStatus.error_if_not_valid(status) + + # TOOD make this pin*s* + def sample_periph_pin(self, periph, pin, mask): + c_periph = c_char_p(periph.encode('utf-8')) + c_pin = c_char_p(pin.encode('utf-8')) + c_mask = c_int(mask) + c_value = c_int() + status = xsi_lib.xsi_sample_periph_pin(self.xsim, c_periph, c_pin, + c_mask, byref(c_value)) + XsiStatus.error_if_not_valid(status) + return c_value.value + + def is_pin_driving(self, package, pin): + c_package = c_char_p(package) + c_pin = c_char_p(pin) + c_value = c_int() + status = xsi_lib.xsi_is_pin_driving(self.xsim, c_package, c_pin, + byref(c_value)) + XsiStatus.error_if_not_valid(status) + return c_value.value + + def is_port_pins_driving(self, tile, port): + c_tile = c_char_p(tile) + c_port = c_char_p(port) + c_value = c_int() + status = xsi_lib.xsi_is_port_pins_driving(self.xsim, c_tile, c_port, + byref(c_value)) + XsiStatus.error_if_not_valid(status) + return c_value.value + + def read_mem(self, tile, address, num_bytes, return_ctype=False): + c_tile = c_char_p(tile) + c_address = c_int(address) + c_num_bytes = c_int(num_bytes) + buf = create_string_buffer(num_bytes) + status = xsi_lib.xsi_read_mem(self.xsim, c_tile, c_address, + c_num_bytes, buf) + XsiStatus.error_if_not_valid(status) + if return_ctype: + return buf + else: + return list(buf) + + def read_symbol_word(self, tile, symbol, offset=0): + address = self.xe.symtab[tile, symbol] + address += offset + buf = self.read_mem(tile, address, 4, return_ctype=True) + return struct.unpack("= num_expected: + self.record_failure("Length of expected output less than output") + break + + if self._ordered: + if regexp: + match = re.match(expected[line_num]+"$", output[i].strip()) + else: + match = expected[line_num] == output[i].strip() + + if not match: + self.record_failure(("Line %d of output does not match expected\n"+ + " Expected: %s\n"+ + " Actual : %s") + % (line_num, + expected[line_num].strip(), + output[i].strip())) + else: # Unordered testing + stripped = output[i].strip() + if regexp: + match = any(re.match(e+"$", stripped) for e in expected) + else: + match = any(e == stripped for e in expected) + + if not match: + self.record_failure(("Line %d of output not found in expected\n"+ + " Actual : %s") + % (line_num, + output[i].strip())) + + if (num_expected > line_num + 1): + self.record_failure("Length of expected output greater than output") + output = {'output':''.join(output)} + + if not self.result: + output['failures'] = ''.join(self.failures) + + if self.result: + sys.stdout.write("%-30s %-6s %-6s Pass\n" % (test, config.get('arch'), config.get('speed'))) + else: + sys.stderr.write("%-30s %-6s %-6s Fail\n" % (test, config.get('arch'), config.get('speed'))) + + return self.result \ No newline at end of file diff --git a/tests/Pyxsim/xe.py b/tests/Pyxsim/xe.py new file mode 100644 index 00000000..ec8fe4dc --- /dev/null +++ b/tests/Pyxsim/xe.py @@ -0,0 +1,98 @@ +from Pyxsim.xmostest_subprocess import call, call_get_output +import os, tempfile +from xml.dom.minidom import parse +import re +from fractions import gcd + +def lcm(a, b): + return (a * b) // gcd(a, b) + +class Xe: + + def _get_platform_info(self): + call(['xobjdump','--split',self.path], silent=True, cwd=self._tempdir) + xn = parse("%s/platform_def.xn"%self._tempdir) + self._tile_map = {} + self.tiles = [] + lcm_freq = 1 + for node in xn.getElementsByTagName("Node"): + freq = node.getAttribute("SystemFrequency") + if freq: + freq = int(freq.replace("MHz","")) + lcm_freq = lcm(lcm_freq, freq) + cm = {} + for tile in node.getElementsByTagName("Tile"): + self._tile_map[node.getAttribute("Id"), + tile.getAttribute("Number")] = \ + tile.getAttribute("Reference") + self.tiles.append(tile.getAttribute("Reference")) + self.freq = lcm_freq + + config = parse("%s/config.xml"%self._tempdir) + self._port_map = {} + for pin_node in config.getElementsByTagName("Pin"): + name = pin_node.getAttribute("name") + (package, pin) = name.split(":") + for port_node in pin_node.getElementsByTagName("Port"): + port = "tile[%s]:%s" % (port_node.getAttribute("core"), + port_node.getAttribute("name")) + bitnum = int(port_node.getAttribute("bitNum")) + if not port in self._port_map: + self._port_map[port] = [] + self._port_map[port].append((package, pin, bitnum)) + + def get_port_pins(self, port): + m = re.match("([^\.]*)\.(\d*)", port) + if m: + port = m.groups(0)[0] + bit = int(m.groups(0)[1]) + pins = self._port_map[port] + for (package, pin, bitnum) in pins: + if bitnum == bit: + return [(package, pin, bitnum)] + raise Pyxsim.XmosTestError("Cannot find port pins") + else: + return self._port_map[port] + + def _get_symtab(self): + stdout, stderr = call_get_output(['xobjdump','-t',self.path]) + current_tile = None + symtab = {} + for line in stdout: + line = str(line) + if (line == ''): + break + m = re.match(r'Loadable.*for (.*) \(node \"(\d*)\", tile (\d*)', line) + + if m: + current_tile = m.groups(0)[0] + m = re.match(r'(0x[0-9a-fA-F]*).....([^ ]*) *(0x[0-9a-fA-F]*) (.*)$', line) + if m and current_tile != None: + (address, section, size, name) = m.groups(0) + if section != '*ABS*': + address = int(address,0) + symtab[current_tile, name] = address + self.symtab = symtab + + + def __init__(self, path): + if not os.path.isfile(path): + raise IOError("Cannot find file: %s"%path) + self.path = os.path.abspath(path) + self._symtab = {} + self._tempdir = tempfile.mkdtemp() + self._get_platform_info() + self._get_symtab() + + def __del__(self): + if self._tempdir != None: + for root, dirs, files in os.walk(self._tempdir, topdown=False): + for f in files: + p = os.path.join(root,f) + os.remove(p) + for d in dirs: + p = os.path.join(root,d) + os.rmdir(p) + os.rmdir(self._tempdir) + + diff --git a/tests/Pyxsim/xmostest_subprocess.py b/tests/Pyxsim/xmostest_subprocess.py new file mode 100644 index 00000000..128ed340 --- /dev/null +++ b/tests/Pyxsim/xmostest_subprocess.py @@ -0,0 +1,250 @@ +import platform +import re +import subprocess +import sys +import tempfile +import multiprocessing +import time +import os +import signal +import errno + +def pstreekill(process): + pid = process + if platform_is_windows(): + # Try allowing a clean shutdown first + subprocess.call(['taskkill','/t','/pid',str(pid)]) + confirmed_termination = False + timeout = time.time() + 10 # Timeout in seconds + while time.time() < timeout: + # Check the current status of the process + status = subprocess.call(['tasklist','/nh','/fi','"PID eq %s"' % pid]) + if status.startswith("INFO: No tasks are running which match the specified criteria"): + # Process has shutdown + confirmed_termination = True + break + time.sleep(0.1) # Avoid spinning too fast while in the timeout loop + if not confirmed_termination: + # If the process hasn't shutdown politely yet kill it + sys.stdout.write("Force kill PID %d that hasn't responded to kill\n" % pid) + subprocess.call(['taskkill','/t','/f','/pid',str(pid)]) + else: + # Send SIGINT to the process group to notify all processes that we + # are going down now + os.killpg(os.getpgid(pid), signal.SIGINT) + + # Now terminate and join the main process. If the join has not returned + # within 10 seconds then we will have to forcibly kill the process group + process.terminate() + process.join(timeout=10) + + if process.is_alive(): + # If the process hasn't shutdown politely yet kill it + try: + sys.stderr.write("Sending SIGKILL to PID %d that hasn't responded to SIGINT\n" % pid) + os.killpg(os.getpgid(pid), signal.SIGKILL) + except OSError as err: + # ESRCH == No such process - presumably exited since timeout... + if err.errno != errno.ESRCH: + raise + +## Annoying OS incompatability, not sure why this is needed + +def log_debug(msg): + pass + +def platform_is_osx(): + ostype = platform.system() + if re.match('.*Darwin.*', ostype): + return True + else: + return False + +def platform_is_windows(): + ostype = platform.system() + if not re.match('.*Darwin.*', ostype) and re.match('.*[W|w]in.*', ostype): + return True + else: + return False + +if platform_is_windows(): + concat_args = True + use_shell = True + # Windows version of Python 2.7 doesn't support SIGINT + SIGINT = signal.SIGTERM +else: + concat_args = False + use_shell = False + SIGINT = signal.SIGINT + +def quote_string(s): + """ For Windows need to put quotes around arguments with spaces in them + """ + if re.search('\s', s): + return '"%s"' % s + else: + return s + +def Popen(*args, **kwargs): + kwargs['shell'] = use_shell + if concat_args: + args = (' '.join([quote_string(arg) for arg in args[0]]),) + args[1:] + cmd = args[0] + else: + cmd = ' '.join(args[0]) + + log_debug("Run '%s' in %s" % (cmd, kwargs.get('cwd', '.'))) + return subprocess.Popen(*args, **kwargs) + +def wait_with_timeout(p_and_sig, timeout): + (ev, pidv, process) = p_and_sig + process.start() + try: + if timeout: + finished = ev.wait(timeout) + if not finished: + pstreekill(process) + return (not finished, 0) + else: + ev.wait() + return (False, 0) + except KeyboardInterrupt: + pstreekill(process) + + return (False, 0) + +def do_cmd(ev, pidv, *args, **kwargs): + if not platform_is_windows(): + os.setpgid(os.getpid(), 0) + if 'stdout_fname' in kwargs: + fname = kwargs.pop('stdout_fname') + kwargs['stdout'] = open(fname, "w") + if 'stderr_fname' in kwargs: + fname = kwargs.pop('stderr_fname') + kwargs['stderr'] = open(fname, "w") + process = Popen(*args, **kwargs) + pidv.value = process.pid + try: + process.wait() + except KeyboardInterrupt: + # Catch the KeyboardInterrupt raised due to the SIGINT signal + # sent by pstreekill() + pass + ev.set() + +def create_cmd_process(*args, **kwargs): + ev = multiprocessing.Event() + pidv = multiprocessing.Value('d', 0) + args = tuple([ev, pidv] + list(args)) + process = multiprocessing.Process(target=do_cmd, args=args, + kwargs=kwargs) + + return (ev, pidv, process) + +def remove(name): + """ On windows, OS.remove() will cause an exception if the file is still in use. + It is assumed there is a release race, hence the multiple attempts here. + """ + attempt = 0 + while attempt < 3: + try: + os.remove(name) + return + except OSError: + attempt = attempt + 1 + time.sleep(0.1 * attempt) + sys.stdout.write("ERROR: Unable to remove file `%s`\n" % name) + +def call(*args, **kwargs): + """ If silent, then create temporary files to pass stdout and stderr to since + on Windows the less/more-like behaviour waits for a keypress if it goes to stdout. + """ + silent = kwargs.pop('silent', False) + retval = 0 + timeout = None + if 'timeout' in kwargs: + timeout = kwargs['timeout'] + kwargs.pop('timeout') + + if silent: + out = tempfile.NamedTemporaryFile(delete=False) + kwargs['stdout_fname'] = out.name + kwargs['stderr'] = subprocess.STDOUT + + process = create_cmd_process(*args, **kwargs) + (timed_out, retval) = wait_with_timeout(process, timeout) + out.seek(0) + stdout_lines = out.readlines() + out.close() + remove(out.name) + for line in stdout_lines: + line = line.decode('utf-8') + log_debug(' ' + line.rstrip()) + else: + process = create_cmd_process(*args, **kwargs) + (timed_out, retval) = wait_with_timeout(process, timeout) + # Ensure spawned processes are not left running past this point + # There should be no children running now (as they would be orphaned) + process[2].terminate() + process[2].join(timeout=0.1) # Avoid always printing wait message + while process[2].is_alive(): + sys.stdout.write("Waiting for PID %d to terminate\n" % process[2].pid) + process[2].join(timeout=1.0) + + if timeout: + return (timed_out, retval) + else: + return retval + +def call_get_output(*args, **kwargs): + """ Create temporary files to pass stdout and stderr to since on Windows the + less/more-like behaviour waits for a keypress if it goes to stdout. + """ + merge = kwargs.pop('merge_out_and_err', False) + + out = tempfile.NamedTemporaryFile(delete=False) + kwargs['stdout_fname'] = out.name + timeout = None + if 'timeout' in kwargs: + timeout = kwargs['timeout'] + kwargs.pop('timeout') + + if merge: + kwargs['stderr'] = subprocess.STDOUT + else: + err = tempfile.NamedTemporaryFile(delete=False) + stderr_fname = err.name + kwargs['stderr_fname'] = stderr_fname + err.close() + + process = create_cmd_process(*args, **kwargs) + (timed_out, retval) = wait_with_timeout(process, timeout) + out.seek(0) + stdout_lines = out.readlines() + out.close() + remove(out.name) + + for line in stdout_lines: + line = line.decode('utf-8') + log_debug(' ' + line.rstrip()) + + if not merge: + err = open(stderr_fname,"r") + stderr_lines = err.readlines() + err.close() + remove(stderr_fname) + for line in stderr_lines: + line = line.decode('utf-8') + log_debug(' err:' + line.rstrip()) + + if merge: + if timeout: + return (timed_out, stdout_lines) + else: + return stdout_lines + + else: + if timeout: + return (timed_out, stdout_lines, stderr_lines) + else: + return (stdout_lines, stderr_lines) diff --git a/tests/helpers.py b/tests/helpers.py index 26415320..a24339bf 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -1,7 +1,8 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -import xmostest +import Pyxsim +from Pyxsim import testers import os import random import sys @@ -11,12 +12,28 @@ from usb_phy_utmi import UsbPhyUtmi from usb_packet import RxPacket from usb_packet import BusReset - -args = None - -ARCHITECTURE_CHOICES = ["xs2", "xs3"] -BUSSPEED_CHOICES = ["FS", "HS"] - +import pytest +import tempfile +import shutil + +ARCHITECTURE_CHOICES = ['xs2', 'xs3'] +BUSSPEED_CHOICES = ['FS', 'HS'] +args = {'arch':'xs3', + 'trace':False} +XN_FILES = ["test_xs2.xn", "test_xs3.xn"] +clean_only = False + +def copy_common_xn_files(test_dir, path = ".", common_dir = "shared_src", source_dir = "src", xn_files = XN_FILES): + src_dir = os.path.join(test_dir, source_dir) + for xn_file in xn_files: + xn = os.path.join(common_dir, xn_file) + shutil.copy(xn, src_dir) + +def delete_test_specific_xn_files(test_dir, path = ".", source_dir = "src", xn_files = XN_FILES): + src_dir = os.path.join(test_dir, source_dir) + for xn_file in xn_files: + xn = os.path.join(src_dir, xn_file) + os.remove(xn) def create_if_needed(folder): if not os.path.exists(folder): @@ -83,116 +100,83 @@ def get_usb_clk_phy( return (clk, phy) +def run_on_simulator(xe, simthreads, **kwargs): + for k in ['do_xe_prebuild', 'build_env', 'clean_before_build']: + if k in kwargs: + kwargs.pop(k) + return Pyxsim.run_with_pyxsim(xe, simthreads, **kwargs) def run_on(**kwargs): - if not args: - return True - for name, value in kwargs.items(): - arg_value = getattr(args, name) + for name,value in kwargs.items(): + arg_value = args.get(name) if arg_value is not None and value != arg_value: return False return True - def RunUsbTest(test_fn): + + tester_list = [] + testname,extension = os.path.splitext(os.path.basename(__file__)) + seed = random.randint(0, sys.maxsize) - seed = args.seed if args.seed else random.randint(0, sys.maxsize) + data_valid_count = {'FS': 39, "HS": 0} - data_valid_count = {"FS": 39, "HS": 0} + (fd, fname) = tempfile.mkstemp() + old_std = os.fdopen(os.dup(sys.stdout.fileno()), "w") + sys.stdout = os.fdopen(fd, "w") + std_reader = open(fname, "r") for _arch in ARCHITECTURE_CHOICES: for _busspeed in BUSSPEED_CHOICES: if run_on(arch=_arch): if run_on(busspeed=_busspeed): (clk_60, usb_phy) = get_usb_clk_phy(verbose=False, arch=_arch) - test_fn( - _arch, - clk_60, - usb_phy, - USB_DATA_VALID_COUNT[_busspeed], - _busspeed, - seed, - verbose=args.verbose, - ) - - -def do_usb_test( - arch, - clk, - phy, - usb_speed, - sessions, - test_file, - seed, - level="nightly", - extra_tasks=[], - verbose=False, -): + tester_list.extend(test_fn(_arch, clk_60, usb_phy, USB_DATA_VALID_COUNT[_busspeed], _busspeed, seed)) - """Shared test code for all usb tests.""" - testname, extension = os.path.splitext(os.path.basename(test_file)) + captured = std_reader.read() + sys.stdout = old_std + caps = captured.split("\n") + return Pyxsim.run_tester(caps,tester_list) - resources = xmostest.request_resource("xsim") +def do_usb_test(arch, clk, phy, usb_speed, sessions, test_file, seed, + level='nightly', extra_tasks=[], verbose=False): - binary = "{testname}/bin/{arch}/{testname}_{arch}.xe".format( - testname=testname, arch=arch - ) + """ Shared test code for all RX tests using the test_rx application. + """ + testname,extension = os.path.splitext(os.path.basename(test_file)) + tester_list = [] - print(binary) + binary = '{testname}/bin/{arch}/{testname}_{arch}.xe'.format(testname=testname, arch=arch) + copy_common_xn_files(testname) + build_success, build_output = Pyxsim._build(binary) assert len(sessions) == 1, "Multiple sessions not yet supported" - - for session in sessions: - - if args.verbose: - print("Session " + str(sessions.index(session))) - print(str(session)) - - if xmostest.testlevel_is_at_least(xmostest.get_testlevel(), level): - print( - "Running {test}: {arch} arch sending {n} event(s) at {clk} using {speed} (seed {seed})".format( - test=testname, - n=len(session.events), - arch=arch, - clk=clk.get_name(), - speed=usb_speed, - seed=seed, - ) - ) - - phy.session = session - - expect_folder = create_if_needed("expect") - expect_filename = "{folder}/{test}_{arch}.expect".format( - folder=expect_folder, - test=testname, - phy=phy.name, - clk=clk.get_name(), - arch=arch, - ) - - create_expect(arch, session, expect_filename, verbose=verbose) - - tester = xmostest.ComparisonTester( - open(expect_filename), - "lib_xud", - "xud_sim_tests", - testname, - {"clk": clk.get_name(), "arch": arch, "speed": usb_speed}, - ) - - tester.set_min_testlevel(level) - - simargs = get_sim_args(testname, clk, phy, arch) - xmostest.run_on_simulator( - resources["xsim"], - binary, - simthreads=[clk, phy] + extra_tasks, - tester=tester, - simargs=simargs, - ) + if build_success: + for session in sessions: + + phy.session = session + + expect_folder = create_if_needed("expect") + expect_filename = '{folder}/{test}_{arch}.expect'.format( + folder=expect_folder, test=testname, phy=phy.name, clk=clk.get_name(), arch=arch) + + create_expect(arch, session, expect_filename, verbose=verbose) + + tester = testers.ComparisonTester(open(expect_filename), + 'lib_xud', 'xud_sim_tests', testname, + {'clk':clk.get_name(), 'arch':arch, 'speed':usb_speed}) + + tester_list.append(tester) + simargs = get_sim_args(testname, clk, phy, arch) + simthreads = [clk, phy] + extra_tasks + run_on_simulator(binary, simthreads, simargs = simargs) + delete_test_specific_xn_files(testname) + return tester_list + else: + delete_test_specific_xn_files(testname) + return ["Build Failed"] def create_expect(arch, session, filename, verbose=False): @@ -226,7 +210,7 @@ def create_expect(arch, session, filename, verbose=False): def get_sim_args(testname, clk, phy, arch="xs2"): sim_args = [] - if args and args.trace: + if args and args.get('trace'): log_folder = create_if_needed("logs") filename = "{log}/xsim_trace_{test}_{clk}_{arch}".format( diff --git a/tests/test_bulk_loopback.py b/tests/test_bulk_loopback.py index 65a72462..18eb4556 100644 --- a/tests/test_bulk_loopback.py +++ b/tests/test_bulk_loopback.py @@ -1,12 +1,12 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -import xmostest from usb_packet import * import usb_packet from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): @@ -67,7 +67,7 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) ) - do_usb_test( + return do_usb_test( arch, clk, phy, @@ -81,5 +81,6 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) -def runtest(): - RunUsbTest(do_test) +def test_bulk_loopback(): + for result in RunUsbTest(do_test): + assert result diff --git a/tests/test_bulk_rx_basic.py b/tests/test_bulk_rx_basic.py index d7de96dd..13cb65b1 100644 --- a/tests/test_bulk_rx_basic.py +++ b/tests/test_bulk_rx_basic.py @@ -1,13 +1,12 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. - -import xmostest from usb_packet import * import usb_packet from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): @@ -33,7 +32,7 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) ) - do_usb_test( + return do_usb_test( arch, clk, phy, @@ -47,5 +46,6 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) -def runtest(): - RunUsbTest(do_test) +def test_bulk_rx_basic(): + for result in RunUsbTest(do_test): + assert result diff --git a/tests/test_bulk_rx_basic_badcrc32.py b/tests/test_bulk_rx_basic_badcrc32.py index e5390721..8c0377d9 100644 --- a/tests/test_bulk_rx_basic_badcrc32.py +++ b/tests/test_bulk_rx_basic_badcrc32.py @@ -1,15 +1,15 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -import xmostest from usb_packet import * import usb_packet from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest -def test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): +def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): address = 1 ep = 1 @@ -97,7 +97,7 @@ def test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) ) - do_usb_test( + return do_usb_test( arch, clk, phy, @@ -111,5 +111,6 @@ def test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) -def runtest(): - RunUsbTest(test) +def test_bulk_rx_basic_badcrc32(): + for result in RunUsbTest(do_test): + assert result diff --git a/tests/test_bulk_rx_basic_badpid.py b/tests/test_bulk_rx_basic_badpid.py index d2c64b84..672c8eac 100644 --- a/tests/test_bulk_rx_basic_badpid.py +++ b/tests/test_bulk_rx_basic_badpid.py @@ -1,11 +1,11 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -import xmostest from usb_packet import * from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest # Tests out of seq (but valid.. ) data PID def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): @@ -82,7 +82,7 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) ) - do_usb_test( + return do_usb_test( arch, clk, phy, @@ -96,5 +96,6 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) -def runtest(): - RunUsbTest(do_test) +def test_bulk_rx_basic_badpid(): + for result in RunUsbTest(do_test): + assert result diff --git a/tests/test_bulk_rx_basic_nodata.py b/tests/test_bulk_rx_basic_nodata.py index a8c44fd5..bca8028c 100644 --- a/tests/test_bulk_rx_basic_nodata.py +++ b/tests/test_bulk_rx_basic_nodata.py @@ -3,12 +3,11 @@ # This Software is subject to the terms of the XMOS Public Licence: Version 1. # Rx out of seq (but valid.. ) data PID -import xmostest from usb_packet import TokenPacket, USB_PID from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction - +import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): @@ -42,7 +41,7 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): TokenPacket(endpoint=ep, address=address, pid=USB_PID["OUT"]) ) - do_usb_test( + return do_usb_test( arch, clk, phy, @@ -56,5 +55,6 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) -def runtest(): - RunUsbTest(do_test) +def test_bulk_rx_basic_nodata(): + for result in RunUsbTest(do_test): + assert result diff --git a/tests/test_bulk_rx_basic_rxerror.py b/tests/test_bulk_rx_basic_rxerror.py index f7f1725c..66aeda25 100644 --- a/tests/test_bulk_rx_basic_rxerror.py +++ b/tests/test_bulk_rx_basic_rxerror.py @@ -1,12 +1,12 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -import xmostest from usb_packet import * import usb_packet from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): @@ -111,7 +111,7 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) ) - do_usb_test( + return do_usb_test( arch, clk, phy, @@ -125,5 +125,6 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) -def runtest(): - RunUsbTest(do_test) +def test_bulk_rx_basic_rxerror(): + for result in RunUsbTest(do_test): + assert result diff --git a/tests/test_bulk_rx_multiep.py b/tests/test_bulk_rx_multiep.py index d64bcad3..0997174b 100644 --- a/tests/test_bulk_rx_multiep.py +++ b/tests/test_bulk_rx_multiep.py @@ -1,13 +1,12 @@ #!/usr/bin/env python # Copyright 2019-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. - -import xmostest from usb_packet import * import usb_packet from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): @@ -61,7 +60,7 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) ) - do_usb_test( + return do_usb_test( arch, clk, phy, @@ -75,5 +74,6 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) -def runtest(): - RunUsbTest(do_test) +def test_bulk_multiep(): + for result in RunUsbTest(do_test): + assert result diff --git a/tests/test_bulk_rx_traffic.py b/tests/test_bulk_rx_traffic.py index 0ad4803d..d6b56870 100644 --- a/tests/test_bulk_rx_traffic.py +++ b/tests/test_bulk_rx_traffic.py @@ -1,14 +1,13 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. - -import xmostest from usb_packet import * import usb_packet from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction from usb_phy import USB_MAX_EP_ADDRESS +import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): @@ -72,7 +71,7 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): if trafficEp1 > USB_MAX_EP_ADDRESS: trafficEp1 = 0 - do_usb_test( + return do_usb_test( arch, clk, phy, @@ -86,5 +85,6 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) -def runtest(): - RunUsbTest(do_test) +def test_bulk_rx_traffic(): + for result in RunUsbTest(do_test): + assert result diff --git a/tests/test_bulk_tx_badack.py b/tests/test_bulk_tx_badack.py index 7511a407..44a52184 100644 --- a/tests/test_bulk_tx_badack.py +++ b/tests/test_bulk_tx_badack.py @@ -1,11 +1,11 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -import xmostest from usb_packet import TokenPacket, RxDataPacket, TxHandshakePacket, USB_PID from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): @@ -54,7 +54,7 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) ) - do_usb_test( + return do_usb_test( arch, clk, phy, @@ -68,5 +68,6 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) -def runtest(): - RunUsbTest(do_test) +def test_bulk_tx_badack(): + for result in RunUsbTest(do_test): + assert result diff --git a/tests/test_bulk_tx_basic.py b/tests/test_bulk_tx_basic.py index 40a884f8..15fc57ef 100644 --- a/tests/test_bulk_tx_basic.py +++ b/tests/test_bulk_tx_basic.py @@ -1,11 +1,10 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. - -import xmostest from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): @@ -31,7 +30,7 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) ) - do_usb_test( + return do_usb_test( arch, clk, phy, @@ -45,5 +44,6 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) -def runtest(): - RunUsbTest(do_test) +def test_bulk_tx_basic(): + for result in RunUsbTest(do_test): + assert result diff --git a/tests/test_bulk_tx_basic_short.py b/tests/test_bulk_tx_basic_short.py index 1e3d2256..6a88a2e4 100644 --- a/tests/test_bulk_tx_basic_short.py +++ b/tests/test_bulk_tx_basic_short.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -import xmostest from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): @@ -31,7 +31,7 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) ) - do_usb_test( + return do_usb_test( arch, clk, phy, @@ -45,5 +45,6 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) -def runtest(): - RunUsbTest(do_test) +def test_bulk_tx_basic_short(): + for result in RunUsbTest(do_test): + assert result diff --git a/tests/test_bulk_tx_multiep.py b/tests/test_bulk_tx_multiep.py index a3821613..ba5b454c 100644 --- a/tests/test_bulk_tx_multiep.py +++ b/tests/test_bulk_tx_multiep.py @@ -1,11 +1,10 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. - -import xmostest from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): @@ -64,7 +63,7 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) ) - do_usb_test( + return do_usb_test( arch, clk, phy, @@ -78,5 +77,6 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) -def runtest(): - RunUsbTest(do_test) +def test_bulk_tx_multiep(): + for result in RunUsbTest(do_test): + assert result diff --git a/tests/test_bulk_tx_noack.py b/tests/test_bulk_tx_noack.py index 441a480b..abb6fa73 100644 --- a/tests/test_bulk_tx_noack.py +++ b/tests/test_bulk_tx_noack.py @@ -1,11 +1,11 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -import xmostest from usb_packet import USB_PID, TokenPacket, RxDataPacket from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): @@ -51,7 +51,7 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) ) - do_usb_test( + return do_usb_test( arch, clk, phy, @@ -65,5 +65,6 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) -def runtest(): - RunUsbTest(do_test) +def test_bulk_tx_noack(): + for result in RunUsbTest(do_test): + assert result diff --git a/tests/test_control_basic_get.py b/tests/test_control_basic_get.py index 032de41b..a900ef0d 100644 --- a/tests/test_control_basic_get.py +++ b/tests/test_control_basic_get.py @@ -1,7 +1,6 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -import xmostest from usb_packet import ( TokenPacket, TxDataPacket, @@ -13,6 +12,7 @@ from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): @@ -76,7 +76,7 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) session.add_event(RxHandshakePacket(data_valid_count=data_valid_count)) - do_usb_test( + return do_usb_test( arch, clk, phy, @@ -89,5 +89,6 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) -def runtest(): - RunUsbTest(do_test) +def test_control_basic_get(): + for result in RunUsbTest(do_test): + assert result diff --git a/tests/test_control_basic_set.py b/tests/test_control_basic_set.py index 1018caee..4df0d96d 100644 --- a/tests/test_control_basic_set.py +++ b/tests/test_control_basic_set.py @@ -1,7 +1,6 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -import xmostest from usb_packet import ( TokenPacket, TxDataPacket, @@ -13,6 +12,7 @@ from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): @@ -76,7 +76,7 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) session.add_event(TxHandshakePacket(data_valid_count=data_valid_count)) - do_usb_test( + return do_usb_test( arch, clk, phy, @@ -89,5 +89,6 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) -def runtest(): - RunUsbTest(do_test) +def test_control_basic_set(): + for result in RunUsbTest(do_test): + assert result diff --git a/tests/test_invalidtoken.py b/tests/test_invalidtoken.py index 8d3afe2a..42a07bf3 100644 --- a/tests/test_invalidtoken.py +++ b/tests/test_invalidtoken.py @@ -1,7 +1,6 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -import xmostest from usb_packet import ( TokenPacket, TxDataPacket, @@ -13,6 +12,7 @@ from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest # Same as simple RX bulk test but some invalid tokens also included @@ -137,7 +137,7 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) ) - do_usb_test( + return do_usb_test( arch, clk, phy, @@ -150,5 +150,6 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) -def runtest(): - RunUsbTest(do_test) +def test_invalidtoken(): + for result in RunUsbTest(do_test): + assert result diff --git a/tests/test_iso_loopback.py b/tests/test_iso_loopback.py index cf3f14ea..b2346aa2 100644 --- a/tests/test_iso_loopback.py +++ b/tests/test_iso_loopback.py @@ -1,13 +1,12 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. - -import xmostest from usb_packet import * import usb_packet from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): @@ -74,7 +73,7 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) ) - do_usb_test( + return do_usb_test( arch, clk, phy, @@ -88,5 +87,6 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) -def runtest(): - RunUsbTest(do_test) +def test_iso_loopback(): + for result in RunUsbTest(do_test): + assert result diff --git a/tests/test_iso_rx_basic.py b/tests/test_iso_rx_basic.py index bcedf8ab..d41f7c6c 100644 --- a/tests/test_iso_rx_basic.py +++ b/tests/test_iso_rx_basic.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -import xmostest from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): @@ -30,7 +30,7 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) ) - do_usb_test( + return do_usb_test( arch, clk, phy, @@ -44,5 +44,6 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) -def runtest(): - RunUsbTest(do_test) +def test_iso_rx_basic(): + for result in RunUsbTest(do_test): + assert result diff --git a/tests/test_iso_rxtx_fastpacket.py b/tests/test_iso_rxtx_fastpacket.py index 1df2f950..be162a01 100644 --- a/tests/test_iso_rxtx_fastpacket.py +++ b/tests/test_iso_rxtx_fastpacket.py @@ -1,13 +1,12 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. - -import xmostest from usb_packet import * import usb_packet from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): @@ -48,7 +47,7 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) ) - do_usb_test( + return do_usb_test( arch, clk, phy, @@ -62,5 +61,6 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) -def runtest(): - RunUsbTest(do_test) +def test_iso_rxtx_fastpacket(): + for result in RunUsbTest(do_test): + assert result diff --git a/tests/test_iso_tx_basic.py b/tests/test_iso_tx_basic.py index 7c568a9e..b4759b03 100644 --- a/tests/test_iso_tx_basic.py +++ b/tests/test_iso_tx_basic.py @@ -1,10 +1,10 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -import xmostest from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): @@ -30,7 +30,7 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) ) - do_usb_test( + return do_usb_test( arch, clk, phy, @@ -44,5 +44,6 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) -def runtest(): - RunUsbTest(do_test) +def test_iso_tx_basic(): + for result in RunUsbTest(do_test): + assert result diff --git a/tests/test_ping_rx_basic.py b/tests/test_ping_rx_basic.py index ca98243c..72106984 100644 --- a/tests/test_ping_rx_basic.py +++ b/tests/test_ping_rx_basic.py @@ -3,8 +3,6 @@ # This Software is subject to the terms of the XMOS Public Licence: Version 1. # Basic check of PING functionality - -import xmostest from usb_packet import ( TokenPacket, TxDataPacket, @@ -16,6 +14,7 @@ from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): @@ -144,7 +143,7 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) ) - do_usb_test( + return do_usb_test( arch, clk, phy, @@ -157,5 +156,6 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) -def runtest(): - RunUsbTest(do_test) +def test_ping_rx_basic(): + for result in RunUsbTest(do_test): + assert result diff --git a/tests/test_shorttoken.py b/tests/test_shorttoken.py index f84d4dc9..623f5358 100644 --- a/tests/test_shorttoken.py +++ b/tests/test_shorttoken.py @@ -1,12 +1,11 @@ #!/usr/bin/env python # Copyright 2019-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. - -import xmostest from usb_packet import TxPacket, USB_PID from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): @@ -54,7 +53,7 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) ) - do_usb_test( + return do_usb_test( arch, clk, phy, @@ -67,5 +66,6 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) -def runtest(): - RunUsbTest(do_test) +def test_shorttoken(): + for result in RunUsbTest(do_test): + assert result diff --git a/tests/test_sof_badcrc.py b/tests/test_sof_badcrc.py index 7c7084c7..ea1b3392 100644 --- a/tests/test_sof_badcrc.py +++ b/tests/test_sof_badcrc.py @@ -1,12 +1,12 @@ #!/usr/bin/env python # Copyright 2019-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -import xmostest from usb_packet import * import usb_packet from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest # TODO ideally creation of SOF's is moved elsewhere def CreateSofToken(frameNumber, data_valid_count, badCrc=False): @@ -75,7 +75,7 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) ) - do_usb_test( + return do_usb_test( arch, clk, phy, @@ -89,5 +89,6 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) -def runtest(): - RunUsbTest(do_test) +def test_sof_badcrc(): + for result in RunUsbTest(do_test): + assert result diff --git a/tests/test_sof_basic.py b/tests/test_sof_basic.py index b3354c97..11a301fe 100644 --- a/tests/test_sof_basic.py +++ b/tests/test_sof_basic.py @@ -1,11 +1,11 @@ #!/usr/bin/env python # Copyright 2019-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -import xmostest from usb_packet import CreateSofToken from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): @@ -49,7 +49,7 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) ) - do_usb_test( + return do_usb_test( arch, clk, phy, @@ -63,5 +63,6 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) -def runtest(): - RunUsbTest(do_test) +def test_sof_basic(): + for result in RunUsbTest(do_test): + assert result diff --git a/tests/test_suspend_resume.py b/tests/test_suspend_resume.py index ea78ca5b..ceac46bb 100644 --- a/tests/test_suspend_resume.py +++ b/tests/test_suspend_resume.py @@ -1,14 +1,13 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. - -import xmostest import usb_packet from usb_packet import CreateSofToken from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction from usb_signalling import UsbSuspend, UsbResume +import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): @@ -58,7 +57,7 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) ) - do_usb_test( + return do_usb_test( arch, clk, phy, @@ -72,5 +71,6 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) -def runtest(): - RunUsbTest(do_test) +def test_suspend_resume(): + for result in RunUsbTest(do_test): + assert result From a880503a089d9ac2f49014f100132dff12469a02 Mon Sep 17 00:00:00 2001 From: Kevin Yeung Date: Mon, 31 May 2021 19:55:30 +0800 Subject: [PATCH 306/520] separate HS and FS expected file --- tests/helpers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/helpers.py b/tests/helpers.py index a24339bf..a79eb058 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -159,8 +159,8 @@ def do_usb_test(arch, clk, phy, usb_speed, sessions, test_file, seed, phy.session = session expect_folder = create_if_needed("expect") - expect_filename = '{folder}/{test}_{arch}.expect'.format( - folder=expect_folder, test=testname, phy=phy.name, clk=clk.get_name(), arch=arch) + expect_filename = '{folder}/{test}_{arch}_{usb_speed}.expect'.format( + folder=expect_folder, test=testname, phy=phy.name, clk=clk.get_name(), arch=arch, usb_speed=usb_speed) create_expect(arch, session, expect_filename, verbose=verbose) From a0c26db598dd182f66e2e013d0934d4ec729a76d Mon Sep 17 00:00:00 2001 From: Kevin Yeung Date: Mon, 31 May 2021 20:05:11 +0800 Subject: [PATCH 307/520] added pytest instruction to README --- tests/README.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/README.txt b/tests/README.txt index f87b8a1b..bbf5f0ff 100644 --- a/tests/README.txt +++ b/tests/README.txt @@ -5,3 +5,12 @@ folliwing repos xsim xsimutils tools_xmostest + +Run in pytest: +pip install pytest + +To run all tests, simply type: +pytest + +To run specifiC test, type: +pytest test_xx_xx.py From a2dbe10accb18ce030ccc951973d8eef0ad14358 Mon Sep 17 00:00:00 2001 From: Kevin Yeung Date: Wed, 2 Jun 2021 16:42:42 +0800 Subject: [PATCH 308/520] added license and copyright stuff, removed unused codes and code refined --- tests/Pyxsim/__init__.py | 95 ++-- tests/Pyxsim/pyxsim.py | 639 ++++++++++++++------------- tests/Pyxsim/testers.py | 77 ++-- tests/Pyxsim/xe.py | 50 ++- tests/Pyxsim/xmostest_subprocess.py | 124 +++--- tests/README.txt | 7 +- tests/helpers.py | 104 +++-- tests/test_bulk_loopback.py | 1 - tests/test_bulk_rx_basic.py | 1 - tests/test_bulk_rx_basic_badcrc32.py | 1 - tests/test_bulk_rx_basic_badpid.py | 1 - tests/test_bulk_rx_basic_nodata.py | 2 +- tests/test_bulk_rx_basic_rxerror.py | 1 - tests/test_bulk_rx_multiep.py | 1 - tests/test_bulk_rx_traffic.py | 1 - tests/test_bulk_tx_badack.py | 1 - tests/test_bulk_tx_basic.py | 1 - tests/test_bulk_tx_basic_short.py | 1 - tests/test_bulk_tx_multiep.py | 1 - tests/test_bulk_tx_noack.py | 2 - tests/test_control_basic_get.py | 1 - tests/test_control_basic_set.py | 1 - tests/test_invalidtoken.py | 1 - tests/test_iso_loopback.py | 1 - tests/test_iso_rx_basic.py | 2 - tests/test_iso_rxtx_fastpacket.py | 1 - tests/test_iso_tx_basic.py | 1 - tests/test_ping_rx_basic.py | 2 - tests/test_shorttoken.py | 2 - tests/test_sof_badcrc.py | 1 - tests/test_sof_basic.py | 1 - tests/test_suspend_resume.py | 2 - 32 files changed, 613 insertions(+), 514 deletions(-) diff --git a/tests/Pyxsim/__init__.py b/tests/Pyxsim/__init__.py index ed3b8f96..75c4f5c3 100644 --- a/tests/Pyxsim/__init__.py +++ b/tests/Pyxsim/__init__.py @@ -1,4 +1,5 @@ - +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. """ Pyxsim pytest framework @@ -14,18 +15,28 @@ clean_only = False +class XmosTestError(Exception): + """ + This exception is used for any errors that occur whilst calling + functions in the Pyxsim module. + """ + def __init__(self, value): + self.value = value + def __str__(self): + return repr(self.value) + # This function is called automatically by the runners -def _build(xe_path, build_config=None, env={}, do_clean = False): +def _build(xe_path, build_config=None, env={}, do_clean=False): # Work out the Makefile path path = None - m = re.match('(.*)/bin/(.*)', xe_path) + m = re.match("(.*)/bin/(.*)", xe_path) if m: path = m.groups(0)[0] binpath = m.groups(0)[1] - m = re.match('(.*)/(.*)', binpath) + m = re.match("(.*)/(.*)", binpath) if m: - build_config=m.groups(0)[0] + build_config = m.groups(0)[0] if not path: msg = "ERROR: Cannot determine path to build: %s\n" % xe_path @@ -38,28 +49,27 @@ def _build(xe_path, build_config=None, env={}, do_clean = False): my_env[key] = str(env[key]) if clean_only: - cmd = ['xmake', 'clean'] + cmd = ["xmake", "clean"] do_clean = False else: - cmd = ['xmake', 'all'] + cmd = ["xmake", "all"] if do_clean: - call(['xmake', 'clean'], cwd = path, env = my_env) + call(["xmake", "clean"], cwd=path, env=my_env) if build_config != None: - cmd += ['CONFIG=%s' % build_config] + cmd += ["CONFIG=%s" % build_config] - output = call_get_output(cmd, cwd = path, env = my_env, - merge_out_and_err = True) + output = call_get_output(cmd, cwd=path, env=my_env, merge_out_and_err=True) success = True for x in output: s = str(x) - if s.find('Error') != -1: - # if x.find('Error') != -1: + if s.find("Error") != -1: + # if x.find('Error') != -1: success = False # if re.match('xmake: \*\*\* .* Stop.', x) != None: - if re.match('xmake: \*\*\* .* Stop.', s) != None: + if re.match("xmake: \*\*\* .* Stop.", s) != None: success = False if not success: @@ -70,6 +80,7 @@ def _build(xe_path, build_config=None, env={}, do_clean = False): return (success, output) + def do_run_pyxsim(xe, simargs, appargs, simthreads): xsi = pyxsim.Xsi(xe_path=xe, simargs=simargs, appargs=appargs) for x in simthreads: @@ -77,46 +88,62 @@ def do_run_pyxsim(xe, simargs, appargs, simthreads): xsi.run() xsi.terminate() -def run_with_pyxsim(xe, simthreads, xscope_io = False, loopback=[], - simargs=[], appargs=[], - suppress_multidrive_messages=False, tester=None, timeout=600, - initial_delay=None, start_after_started=[], - start_after_completed=[]): - - p = multiprocessing.Process(target=do_run_pyxsim, args=(xe, simargs, appargs, simthreads)) - p.start() - p.join(timeout=timeout) - if p.is_alive(): - sys.stderr.write("Simulator timed out\n") - p.terminate() - return None + +def run_with_pyxsim( + xe, + simthreads, + xscope_io=False, + loopback=[], + simargs=[], + appargs=[], + suppress_multidrive_messages=False, + tester=None, + timeout=600, + initial_delay=None, + start_after_started=[], + start_after_completed=[], +): + + p = multiprocessing.Process( + target=do_run_pyxsim, args=(xe, simargs, appargs, simthreads) + ) + p.start() + p.join(timeout=timeout) + if p.is_alive(): + sys.stderr.write("Simulator timed out\n") + p.terminate() + return None + def run_tester(caps, tester_list): - separate_word = [index for index, element in enumerate(caps) if element.strip() == "Test done"] + separate_word = [ + index for index, element in enumerate(caps) if element.strip() == "Test done" + ] result = [] if len(separate_word) > 1: i = 0 start = 0 stop = 0 - while(i @@ -12,26 +12,32 @@ import sys from Pyxsim.xmostest_subprocess import platform_is_windows -ALL_BITS = 0xffffff +ALL_BITS = 0xFFFFFF if platform_is_windows(): - xsi_lib_path = os.path.abspath(os.environ['XCC_EXEC_PREFIX'] + '../lib/xsidevice.dll') + xsi_lib_path = os.path.abspath( + os.environ["XCC_EXEC_PREFIX"] + "../lib/xsidevice.dll" + ) else: - xsi_lib_path = os.path.abspath(os.environ['XCC_EXEC_PREFIX'] + '../lib/libxsidevice.so') + xsi_lib_path = os.path.abspath( + os.environ["XCC_EXEC_PREFIX"] + "../lib/libxsidevice.so" + ) xsi_lib = cdll.LoadLibrary(xsi_lib_path) + def xsi_is_valid_port(port): - return (re.match('XS1_PORT_\d+\w', port) != None) + return re.match("XS1_PORT_\d+\w", port) != None + def xsi_get_port_width(port): - if not xsi_is_valid_port(port): - return None - else: - return int(re.match('^XS1_PORT_(\d+)\w', port).groups(0)[0]) + if not xsi_is_valid_port(port): + return None + else: + return int(re.match("^XS1_PORT_(\d+)\w", port).groups(0)[0]) -class EnumExceptionSet: +class EnumExceptionSet: def __init__(self, enum_list, valid_list=[]): self.enum_list = enum_list self.valid_list = valid_list @@ -42,237 +48,250 @@ def __getattr__(self, name): raise AttributeErr def is_valid(self, value): - if value < len(self.enum_list): - enum = self.enum_list[value] - return (enum in self.valid_list) + if value < len(self.enum_list): + enum = self.enum_list[value] + return enum in self.valid_list def error_if_not_valid(self, value): if value < len(self.enum_list): enum = self.enum_list[value] if not enum in self.valid_list: - raise type('XSI_ERROR_' + enum,(Exception,),{}) + raise type("XSI_ERROR_" + enum, (Exception,), {}) def error(self, value): - if value < len(self.enum_list): - enum = self.enum_list[value] - raise type('XSI_ERROR_' + enum,(Exception,),{}) - - -XsiStatus = EnumExceptionSet(['OK', - 'DONE', - 'TIMEOUT', - 'INVALID_FILE', - 'INVALID_INSTANCE', - 'INVALID_TILE', - 'INVALID_PACKAGE', - 'INVALID_PIN', - 'INVALID_PORT', - 'MEMORY_ERROR', - 'PSWITCH_ERROR', - 'INVALID_ARGS', - 'NULL_ARG', - 'INCOMPATIBLE_VERSION'], - valid_list = ['OK','DONE']) + if value < len(self.enum_list): + enum = self.enum_list[value] + raise type("XSI_ERROR_" + enum, (Exception,), {}) + + +XsiStatus = EnumExceptionSet( + [ + "OK", + "DONE", + "TIMEOUT", + "INVALID_FILE", + "INVALID_INSTANCE", + "INVALID_TILE", + "INVALID_PACKAGE", + "INVALID_PIN", + "INVALID_PORT", + "MEMORY_ERROR", + "PSWITCH_ERROR", + "INVALID_ARGS", + "NULL_ARG", + "INCOMPATIBLE_VERSION", + ], + valid_list=["OK", "DONE"], +) def parse_port(p): - m = re.match('(tile.*)\:([^\.]*)\.?(\d*)',p) - if m: - tile = m.groups(0)[0] - port = m.groups(0)[1] - bit = m.groups(0)[2] - if bit == '': - bit = None + m = re.match("(tile.*)\:([^\.]*)\.?(\d*)", p) + if m: + tile = m.groups(0)[0] + port = m.groups(0)[1] + bit = m.groups(0)[2] + if bit == "": + bit = None + if bit != None: + bit = int(bit) + else: + raise Pyxsim.XmosTestError("Cannot parse port: %s" % p) if bit != None: - bit = int(bit) - else: - raise Pyxsim.XmosTestError("Cannot parse port: %s" % p) - if bit != None: - mask = (1<= time) - self._wait(_resume) - - def _wait_for_port_pins_change(self, ps): - is_driving = [] - vals = [] - ps = [(self._xsi.xe.get_port_pins(p)[0], parse_port(p)) for p in ps] - for ((package, pin, _), (tile, p, bit, mask)) in ps: - d = self._xsi.is_pin_driving(package, pin) - is_driving.append(d) - if d: - v = self._xsi.sample_port_pins(tile, p, mask) + def __init__(self, xsi, st, args): + def _fn(*args): + st.run(*args) + + super(SimThreadImpl, self).__init__() + self._fn = _fn + self._args = args + self.get_time = xsi.get_time + self.resume_event = threading.Event() + self.complete_event = threading.Event() + self._xsi = xsi + self.had_exception = False + self.terminate_flag = False + st.xsi = self + + def _wait(self, resume_check): + self.resume_condition = resume_check + self.complete_event.set() + self.resume_event.wait() + self.resume_event.clear() + + def _user_wait(self, resume_check): + def _resume(xsi): + return resume_check(self) + + self._wait(_resume) + + def _wait_until(self, time): + def _resume(xsi): + return xsi.get_time() >= time + + self._wait(_resume) + + def _wait_for_port_pins_change(self, ps): + is_driving = [] + vals = [] + ps = [(self._xsi.xe.get_port_pins(p)[0], parse_port(p)) for p in ps] + for ((package, pin, _), (tile, p, bit, mask)) in ps: + d = self._xsi.is_pin_driving(package, pin) + is_driving.append(d) + if d: + v = self._xsi.sample_port_pins(tile, p, mask) + if bit: + v = v >> bit + vals.append(v) + else: + vals.append(0) + + def _resume(xsi): + for i, psval in enumerate(ps): + (package, pin, _), (tile, p, bit, mask) = psval + d = xsi.is_pin_driving(package, pin) + if d != is_driving[i]: + return True + if d: + v = xsi.sample_port_pins(tile, p, mask) + if bit: + v = v >> bit + else: + v = 0 + if v != vals[i]: + return True + return False + + self._wait(_resume) + + def _wait_for_next_cycle(self): + self._wait(lambda x: True) + + def is_port_driving(self, port): + (package, pin, _) = self._xsi.xe.get_port_pins(port)[0] + return self._xsi.is_pin_driving(package, pin) + + def drive_port_pins(self, port, val): + (tile, p, bit, mask) = parse_port(port) if bit: - v = v >> bit - vals.append(v) - else: - vals.append(0) - def _resume(xsi): - for i in range(len(ps)): - (package, pin, _), (tile, p, bit, mask) = ps[i] - d = xsi.is_pin_driving(package, pin) - if d != is_driving[i]: - return True - if d: - v = xsi.sample_port_pins(tile, p, mask) - if bit: - v = v >> bit - else: - v = 0 - if v != vals[i]: - return True - return False - self._wait(_resume) - - def _wait_for_next_cycle(self): - self._wait(lambda x: True) - - def is_port_driving(self, port): - (package, pin, _) = self._xsi.xe.get_port_pins(port)[0] - return self._xsi.is_pin_driving(package, pin) - - def drive_port_pins(self, port, val): - (tile, p, bit, mask) = parse_port(port) - if bit: - val <<= bit - self._xsi.drive_port_pins(tile, p, mask, val) - - def sample_port_pins(self, port): - (tile, p, bit, mask) = parse_port(port) - val = self._xsi.sample_port_pins(tile, p, mask) - if bit: - val >>= bit - return val - - # TODO make this pin*s* - def drive_periph_pin(self, pin, val): - (periph, pin, mask) = parse_periph_pin(pin) - self._xsi.drive_periph_pin(periph, pin, mask, val) - - # TODO make this pin*s* - def sample_periph_pin(self, pin): - (periph, pin, mask) = parse_periph_pin(pin) - return self._xsi.sample_periph_pin(periph, pin, mask) - - def terminate(self): - self.terminate_flag = True - self._wait(lambda x: False) - - def run(self): - args = self._args - try: - self._fn(*args) - except: - self.had_exception = True - sys.stderr.write("---------Exception in simthread--------------\n") - traceback.print_exc() - sys.stderr.write("---------------------------------------------\n") - self.resume_condition = lambda x: False - self.complete_event.set() + val <<= bit + self._xsi.drive_port_pins(tile, p, mask, val) + + def sample_port_pins(self, port): + (tile, p, bit, mask) = parse_port(port) + val = self._xsi.sample_port_pins(tile, p, mask) + if bit: + val >>= bit + return val + + # TODO make this pin*s* + def drive_periph_pin(self, pin, val): + (periph, pin, mask) = parse_periph_pin(pin) + self._xsi.drive_periph_pin(periph, pin, mask, val) + + # TODO make this pin*s* + def sample_periph_pin(self, pin): + (periph, pin, mask) = parse_periph_pin(pin) + return self._xsi.sample_periph_pin(periph, pin, mask) + + def terminate(self): + self.terminate_flag = True + self._wait(lambda x: False) + + def run(self): + args = self._args + try: + self._fn(*args) + except: + self.had_exception = True + sys.stderr.write("---------Exception in simthread--------------\n") + traceback.print_exc() + sys.stderr.write("---------------------------------------------\n") + self.resume_condition = lambda x: False + self.complete_event.set() + class Xsi(object): def __init__(self, xe_path=None, simargs=[], appargs=[]): self.xsim = c_void_p() self.xe_path = xe_path - args = " ".join(['"{}"'.format(x) for x in (simargs + [self.xe_path] + appargs)]) + args = " ".join( + ['"{}"'.format(x) for x in (simargs + [self.xe_path] + appargs)] + ) if platform_is_windows: - args = args.replace('\\','/') - c_args = c_char_p(args.encode('utf-8')) + args = args.replace("\\", "/") + c_args = c_char_p(args.encode("utf-8")) status = xsi_lib.xsi_create(byref(self.xsim), c_args) self._plugins = [] self._simthreads = [] self._time = 0 def register_plugin(self, plugin): - self._plugins.append(plugin) + self._plugins.append(plugin) def register_simthread(self, fn): - if isinstance(fn, tuple): - xs = list(fn) - fn = xs[0] - args = xs[1:] - else: - args = [] - - simthread = SimThreadImpl(self, fn, args) - simthread.daemon = True - self._simthreads.append(simthread) + if isinstance(fn, tuple): + xs = list(fn) + fn = xs[0] + args = xs[1:] + else: + args = [] + simthread = SimThreadImpl(self, fn, args) + simthread.daemon = True + self._simthreads.append(simthread) def wait_for_simthread(self, simthread): - simthread.complete_event.wait() - simthread.complete_event.clear() - if simthread.had_exception: - raise Pyxsim.XmosTestError("Simthread encoutered an exception") + simthread.complete_event.wait() + simthread.complete_event.clear() + if simthread.had_exception: + raise Pyxsim.XmosTestError("Simthread encoutered an exception") def clock(self): status = xsi_lib.xsi_clock(self.xsim) self._time += self._time_step if XsiStatus.is_valid(status): - for plugin in self._plugins: - plugin.clock(self) - for simthread in self._simthreads: - if simthread.resume_condition(self): - simthread.resume_event.set() - self.wait_for_simthread(simthread) - if simthread.terminate_flag: - return XsiStatus.DONE + for plugin in self._plugins: + plugin.clock(self) + for simthread in self._simthreads: + if simthread.resume_condition(self): + simthread.resume_event.set() + self.wait_for_simthread(simthread) + if simthread.terminate_flag: + return XsiStatus.DONE return status def get_time(self): - return self._time + return self._time def run(self): self.xe = Xe(self.xe_path) - self._time_step = float(pow(10,3)) / self.xe.freq + self._time_step = float(pow(10, 3)) / self.xe.freq status = XsiStatus.OK for simthread in self._simthreads: - simthread.start() - self.wait_for_simthread(simthread) + simthread.start() + self.wait_for_simthread(simthread) - while (status != XsiStatus.DONE): + while status != XsiStatus.DONE: status = self.clock() XsiStatus.error_if_not_valid(status) @@ -281,167 +300,167 @@ def terminate(self): XsiStatus.error_if_not_valid(status) def sample_pin(self, package, pin): - c_package = c_char_p(package) - c_pin = c_char_p(pin) - c_value = c_int() - status = xsi_lib.xsi_sample_pin(self.xsim, c_package, c_pin, - byref(c_value)) - XsiStatus.error_if_not_valid(status) - return c_value.value + c_package = c_char_p(package) + c_pin = c_char_p(pin) + c_value = c_int() + status = xsi_lib.xsi_sample_pin(self.xsim, c_package, c_pin, byref(c_value)) + XsiStatus.error_if_not_valid(status) + return c_value.value def sample_port_pins(self, tile, port, mask): - c_tile = c_char_p(tile.encode('utf-8')) - c_port = c_char_p(port.encode('utf-8')) - c_mask = c_int(mask) - c_value = c_int() - status = xsi_lib.xsi_sample_port_pins(self.xsim, c_tile, c_port, - c_mask, byref(c_value)) - XsiStatus.error_if_not_valid(status) - return c_value.value + c_tile = c_char_p(tile.encode("utf-8")) + c_port = c_char_p(port.encode("utf-8")) + c_mask = c_int(mask) + c_value = c_int() + status = xsi_lib.xsi_sample_port_pins( + self.xsim, c_tile, c_port, c_mask, byref(c_value) + ) + XsiStatus.error_if_not_valid(status) + return c_value.value def drive_pin(self, package, pin, value): - c_package = c_char_p(package) - c_pin = c_char_p(pin) - c_value = c_int(value) - status = xsi_lib.xsi_drive_pin(self.xsim, c_package, c_pin, - c_value) - XsiStatus.error_if_not_valid(status) + c_package = c_char_p(package) + c_pin = c_char_p(pin) + c_value = c_int(value) + status = xsi_lib.xsi_drive_pin(self.xsim, c_package, c_pin, c_value) + XsiStatus.error_if_not_valid(status) def drive_port_pins(self, tile, port, mask, value): - c_tile = c_char_p(tile.encode('utf-8')) - c_port = c_char_p(port.encode('utf-8')) - c_mask = c_int(mask) - c_value = c_int(value) - status = xsi_lib.xsi_drive_port_pins(self.xsim, c_tile, c_port, - c_mask, c_value) - XsiStatus.error_if_not_valid(status) - + c_tile = c_char_p(tile.encode("utf-8")) + c_port = c_char_p(port.encode("utf-8")) + c_mask = c_int(mask) + c_value = c_int(value) + status = xsi_lib.xsi_drive_port_pins(self.xsim, c_tile, c_port, c_mask, c_value) + XsiStatus.error_if_not_valid(status) + # TOOD make this pin*s* def drive_periph_pin(self, periph, pin, mask, value): - c_periph = c_char_p(periph.encode('utf-8')) - c_pin = c_char_p(pin.encode('utf-8')) - c_mask = c_int(mask) - c_value = c_int(value) - status = xsi_lib.xsi_drive_periph_pin(self.xsim, c_periph, c_pin, - c_mask, c_value) - XsiStatus.error_if_not_valid(status) + c_periph = c_char_p(periph.encode("utf-8")) + c_pin = c_char_p(pin.encode("utf-8")) + c_mask = c_int(mask) + c_value = c_int(value) + status = xsi_lib.xsi_drive_periph_pin( + self.xsim, c_periph, c_pin, c_mask, c_value + ) + XsiStatus.error_if_not_valid(status) # TOOD make this pin*s* def sample_periph_pin(self, periph, pin, mask): - c_periph = c_char_p(periph.encode('utf-8')) - c_pin = c_char_p(pin.encode('utf-8')) - c_mask = c_int(mask) - c_value = c_int() - status = xsi_lib.xsi_sample_periph_pin(self.xsim, c_periph, c_pin, - c_mask, byref(c_value)) - XsiStatus.error_if_not_valid(status) - return c_value.value + c_periph = c_char_p(periph.encode("utf-8")) + c_pin = c_char_p(pin.encode("utf-8")) + c_mask = c_int(mask) + c_value = c_int() + status = xsi_lib.xsi_sample_periph_pin( + self.xsim, c_periph, c_pin, c_mask, byref(c_value) + ) + XsiStatus.error_if_not_valid(status) + return c_value.value def is_pin_driving(self, package, pin): - c_package = c_char_p(package) - c_pin = c_char_p(pin) - c_value = c_int() - status = xsi_lib.xsi_is_pin_driving(self.xsim, c_package, c_pin, - byref(c_value)) - XsiStatus.error_if_not_valid(status) - return c_value.value + c_package = c_char_p(package) + c_pin = c_char_p(pin) + c_value = c_int() + status = xsi_lib.xsi_is_pin_driving(self.xsim, c_package, c_pin, byref(c_value)) + XsiStatus.error_if_not_valid(status) + return c_value.value def is_port_pins_driving(self, tile, port): - c_tile = c_char_p(tile) - c_port = c_char_p(port) - c_value = c_int() - status = xsi_lib.xsi_is_port_pins_driving(self.xsim, c_tile, c_port, - byref(c_value)) - XsiStatus.error_if_not_valid(status) - return c_value.value + c_tile = c_char_p(tile) + c_port = c_char_p(port) + c_value = c_int() + status = xsi_lib.xsi_is_port_pins_driving( + self.xsim, c_tile, c_port, byref(c_value) + ) + XsiStatus.error_if_not_valid(status) + return c_value.value def read_mem(self, tile, address, num_bytes, return_ctype=False): - c_tile = c_char_p(tile) - c_address = c_int(address) - c_num_bytes = c_int(num_bytes) - buf = create_string_buffer(num_bytes) - status = xsi_lib.xsi_read_mem(self.xsim, c_tile, c_address, - c_num_bytes, buf) - XsiStatus.error_if_not_valid(status) - if return_ctype: - return buf - else: - return list(buf) + c_tile = c_char_p(tile) + c_address = c_int(address) + c_num_bytes = c_int(num_bytes) + buf = create_string_buffer(num_bytes) + status = xsi_lib.xsi_read_mem(self.xsim, c_tile, c_address, c_num_bytes, buf) + XsiStatus.error_if_not_valid(status) + if return_ctype: + return buf + else: + return list(buf) def read_symbol_word(self, tile, symbol, offset=0): - address = self.xe.symtab[tile, symbol] - address += offset - buf = self.read_mem(tile, address, 4, return_ctype=True) - return struct.unpack(" line_num + 1): + if num_expected > line_num + 1: self.record_failure("Length of expected output greater than output") - output = {'output':''.join(output)} + output = {"output": "".join(output)} if not self.result: - output['failures'] = ''.join(self.failures) + output["failures"] = "".join(self.failures) if self.result: - sys.stdout.write("%-30s %-6s %-6s Pass\n" % (test, config.get('arch'), config.get('speed'))) + sys.stdout.write( + "%-30s %-6s %-6s Pass\n" + % (test, config.get("arch"), config.get("speed")) + ) else: - sys.stderr.write("%-30s %-6s %-6s Fail\n" % (test, config.get('arch'), config.get('speed'))) + sys.stderr.write( + "%-30s %-6s %-6s Fail\n" + % (test, config.get("arch"), config.get("speed")) + ) - return self.result \ No newline at end of file + return self.result diff --git a/tests/Pyxsim/xe.py b/tests/Pyxsim/xe.py index ec8fe4dc..37a2fa6d 100644 --- a/tests/Pyxsim/xe.py +++ b/tests/Pyxsim/xe.py @@ -1,41 +1,46 @@ +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. from Pyxsim.xmostest_subprocess import call, call_get_output import os, tempfile from xml.dom.minidom import parse import re from fractions import gcd + def lcm(a, b): return (a * b) // gcd(a, b) -class Xe: +class Xe: def _get_platform_info(self): - call(['xobjdump','--split',self.path], silent=True, cwd=self._tempdir) - xn = parse("%s/platform_def.xn"%self._tempdir) + call(["xobjdump", "--split", self.path], silent=True, cwd=self._tempdir) + xn = parse("%s/platform_def.xn" % self._tempdir) self._tile_map = {} self.tiles = [] lcm_freq = 1 for node in xn.getElementsByTagName("Node"): freq = node.getAttribute("SystemFrequency") if freq: - freq = int(freq.replace("MHz","")) + freq = int(freq.replace("MHz", "")) lcm_freq = lcm(lcm_freq, freq) cm = {} for tile in node.getElementsByTagName("Tile"): - self._tile_map[node.getAttribute("Id"), - tile.getAttribute("Number")] = \ - tile.getAttribute("Reference") + self._tile_map[ + node.getAttribute("Id"), tile.getAttribute("Number") + ] = tile.getAttribute("Reference") self.tiles.append(tile.getAttribute("Reference")) self.freq = lcm_freq - config = parse("%s/config.xml"%self._tempdir) + config = parse("%s/config.xml" % self._tempdir) self._port_map = {} for pin_node in config.getElementsByTagName("Pin"): name = pin_node.getAttribute("name") (package, pin) = name.split(":") for port_node in pin_node.getElementsByTagName("Port"): - port = "tile[%s]:%s" % (port_node.getAttribute("core"), - port_node.getAttribute("name")) + port = "tile[%s]:%s" % ( + port_node.getAttribute("core"), + port_node.getAttribute("name"), + ) bitnum = int(port_node.getAttribute("bitNum")) if not port in self._port_map: self._port_map[port] = [] @@ -45,7 +50,7 @@ def get_port_pins(self, port): m = re.match("([^\.]*)\.(\d*)", port) if m: port = m.groups(0)[0] - bit = int(m.groups(0)[1]) + bit = int(m.groups(0)[1]) pins = self._port_map[port] for (package, pin, bitnum) in pins: if bitnum == bit: @@ -55,44 +60,41 @@ def get_port_pins(self, port): return self._port_map[port] def _get_symtab(self): - stdout, stderr = call_get_output(['xobjdump','-t',self.path]) + stdout, stderr = call_get_output(["xobjdump", "-t", self.path]) current_tile = None symtab = {} for line in stdout: line = str(line) - if (line == ''): + if line == "": break - m = re.match(r'Loadable.*for (.*) \(node \"(\d*)\", tile (\d*)', line) + m = re.match(r"Loadable.*for (.*) \(node \"(\d*)\", tile (\d*)", line) if m: current_tile = m.groups(0)[0] - m = re.match(r'(0x[0-9a-fA-F]*).....([^ ]*) *(0x[0-9a-fA-F]*) (.*)$', line) + m = re.match(r"(0x[0-9a-fA-F]*).....([^ ]*) *(0x[0-9a-fA-F]*) (.*)$", line) if m and current_tile != None: (address, section, size, name) = m.groups(0) - if section != '*ABS*': - address = int(address,0) + if section != "*ABS*": + address = int(address, 0) symtab[current_tile, name] = address self.symtab = symtab - def __init__(self, path): if not os.path.isfile(path): - raise IOError("Cannot find file: %s"%path) + raise IOError("Cannot find file: %s" % path) self.path = os.path.abspath(path) self._symtab = {} self._tempdir = tempfile.mkdtemp() self._get_platform_info() self._get_symtab() - + def __del__(self): if self._tempdir != None: for root, dirs, files in os.walk(self._tempdir, topdown=False): for f in files: - p = os.path.join(root,f) + p = os.path.join(root, f) os.remove(p) for d in dirs: - p = os.path.join(root,d) + p = os.path.join(root, d) os.rmdir(p) os.rmdir(self._tempdir) - - diff --git a/tests/Pyxsim/xmostest_subprocess.py b/tests/Pyxsim/xmostest_subprocess.py index 128ed340..50614704 100644 --- a/tests/Pyxsim/xmostest_subprocess.py +++ b/tests/Pyxsim/xmostest_subprocess.py @@ -1,3 +1,5 @@ +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. import platform import re import subprocess @@ -9,25 +11,28 @@ import signal import errno + def pstreekill(process): - pid = process + pid = process.pid if platform_is_windows(): # Try allowing a clean shutdown first - subprocess.call(['taskkill','/t','/pid',str(pid)]) + subprocess.call(["taskkill", "/t", "/pid", str(pid)]) confirmed_termination = False - timeout = time.time() + 10 # Timeout in seconds + timeout = time.time() + 10 # Timeout in seconds while time.time() < timeout: # Check the current status of the process - status = subprocess.call(['tasklist','/nh','/fi','"PID eq %s"' % pid]) - if status.startswith("INFO: No tasks are running which match the specified criteria"): + status = subprocess.call(["tasklist", "/nh", "/fi", '"PID eq %s"' % pid]) + if status.startswith( + "INFO: No tasks are running which match the specified criteria" + ): # Process has shutdown confirmed_termination = True break - time.sleep(0.1) # Avoid spinning too fast while in the timeout loop + time.sleep(0.1) # Avoid spinning too fast while in the timeout loop if not confirmed_termination: # If the process hasn't shutdown politely yet kill it sys.stdout.write("Force kill PID %d that hasn't responded to kill\n" % pid) - subprocess.call(['taskkill','/t','/f','/pid',str(pid)]) + subprocess.call(["taskkill", "/t", "/f", "/pid", str(pid)]) else: # Send SIGINT to the process group to notify all processes that we # are going down now @@ -41,32 +46,39 @@ def pstreekill(process): if process.is_alive(): # If the process hasn't shutdown politely yet kill it try: - sys.stderr.write("Sending SIGKILL to PID %d that hasn't responded to SIGINT\n" % pid) + sys.stderr.write( + "Sending SIGKILL to PID %d that hasn't responded to SIGINT\n" % pid + ) os.killpg(os.getpgid(pid), signal.SIGKILL) except OSError as err: # ESRCH == No such process - presumably exited since timeout... if err.errno != errno.ESRCH: raise + ## Annoying OS incompatability, not sure why this is needed + def log_debug(msg): pass + def platform_is_osx(): ostype = platform.system() - if re.match('.*Darwin.*', ostype): + if re.match(".*Darwin.*", ostype): return True else: return False + def platform_is_windows(): ostype = platform.system() - if not re.match('.*Darwin.*', ostype) and re.match('.*[W|w]in.*', ostype): + if not re.match(".*Darwin.*", ostype) and re.match(".*[W|w]in.*", ostype): return True else: return False + if platform_is_windows(): concat_args = True use_shell = True @@ -77,25 +89,27 @@ def platform_is_windows(): use_shell = False SIGINT = signal.SIGINT + def quote_string(s): - """ For Windows need to put quotes around arguments with spaces in them - """ - if re.search('\s', s): + """For Windows need to put quotes around arguments with spaces in them""" + if re.search("\s", s): return '"%s"' % s else: return s + def Popen(*args, **kwargs): - kwargs['shell'] = use_shell + kwargs["shell"] = use_shell if concat_args: - args = (' '.join([quote_string(arg) for arg in args[0]]),) + args[1:] + args = (" ".join([quote_string(arg) for arg in args[0]]),) + args[1:] cmd = args[0] else: - cmd = ' '.join(args[0]) + cmd = " ".join(args[0]) - log_debug("Run '%s' in %s" % (cmd, kwargs.get('cwd', '.'))) + log_debug("Run '%s' in %s" % (cmd, kwargs.get("cwd", "."))) return subprocess.Popen(*args, **kwargs) + def wait_with_timeout(p_and_sig, timeout): (ev, pidv, process) = p_and_sig process.start() @@ -113,15 +127,16 @@ def wait_with_timeout(p_and_sig, timeout): return (False, 0) + def do_cmd(ev, pidv, *args, **kwargs): if not platform_is_windows(): os.setpgid(os.getpid(), 0) - if 'stdout_fname' in kwargs: - fname = kwargs.pop('stdout_fname') - kwargs['stdout'] = open(fname, "w") - if 'stderr_fname' in kwargs: - fname = kwargs.pop('stderr_fname') - kwargs['stderr'] = open(fname, "w") + if "stdout_fname" in kwargs: + fname = kwargs.pop("stdout_fname") + kwargs["stdout"] = open(fname, "w") + if "stderr_fname" in kwargs: + fname = kwargs.pop("stderr_fname") + kwargs["stderr"] = open(fname, "w") process = Popen(*args, **kwargs) pidv.value = process.pid try: @@ -132,18 +147,19 @@ def do_cmd(ev, pidv, *args, **kwargs): pass ev.set() + def create_cmd_process(*args, **kwargs): ev = multiprocessing.Event() - pidv = multiprocessing.Value('d', 0) + pidv = multiprocessing.Value("d", 0) args = tuple([ev, pidv] + list(args)) - process = multiprocessing.Process(target=do_cmd, args=args, - kwargs=kwargs) + process = multiprocessing.Process(target=do_cmd, args=args, kwargs=kwargs) return (ev, pidv, process) + def remove(name): - """ On windows, OS.remove() will cause an exception if the file is still in use. - It is assumed there is a release race, hence the multiple attempts here. + """On windows, OS.remove() will cause an exception if the file is still in use. + It is assumed there is a release race, hence the multiple attempts here. """ attempt = 0 while attempt < 3: @@ -155,21 +171,22 @@ def remove(name): time.sleep(0.1 * attempt) sys.stdout.write("ERROR: Unable to remove file `%s`\n" % name) + def call(*args, **kwargs): - """ If silent, then create temporary files to pass stdout and stderr to since - on Windows the less/more-like behaviour waits for a keypress if it goes to stdout. + """If silent, then create temporary files to pass stdout and stderr to since + on Windows the less/more-like behaviour waits for a keypress if it goes to stdout. """ - silent = kwargs.pop('silent', False) + silent = kwargs.pop("silent", False) retval = 0 timeout = None - if 'timeout' in kwargs: - timeout = kwargs['timeout'] - kwargs.pop('timeout') + if "timeout" in kwargs: + timeout = kwargs["timeout"] + kwargs.pop("timeout") if silent: out = tempfile.NamedTemporaryFile(delete=False) - kwargs['stdout_fname'] = out.name - kwargs['stderr'] = subprocess.STDOUT + kwargs["stdout_fname"] = out.name + kwargs["stderr"] = subprocess.STDOUT process = create_cmd_process(*args, **kwargs) (timed_out, retval) = wait_with_timeout(process, timeout) @@ -178,15 +195,15 @@ def call(*args, **kwargs): out.close() remove(out.name) for line in stdout_lines: - line = line.decode('utf-8') - log_debug(' ' + line.rstrip()) + line = line.decode("utf-8") + log_debug(" " + line.rstrip()) else: process = create_cmd_process(*args, **kwargs) (timed_out, retval) = wait_with_timeout(process, timeout) # Ensure spawned processes are not left running past this point # There should be no children running now (as they would be orphaned) process[2].terminate() - process[2].join(timeout=0.1) # Avoid always printing wait message + process[2].join(timeout=0.1) # Avoid always printing wait message while process[2].is_alive(): sys.stdout.write("Waiting for PID %d to terminate\n" % process[2].pid) process[2].join(timeout=1.0) @@ -196,25 +213,26 @@ def call(*args, **kwargs): else: return retval + def call_get_output(*args, **kwargs): - """ Create temporary files to pass stdout and stderr to since on Windows the - less/more-like behaviour waits for a keypress if it goes to stdout. + """Create temporary files to pass stdout and stderr to since on Windows the + less/more-like behaviour waits for a keypress if it goes to stdout. """ - merge = kwargs.pop('merge_out_and_err', False) + merge = kwargs.pop("merge_out_and_err", False) out = tempfile.NamedTemporaryFile(delete=False) - kwargs['stdout_fname'] = out.name + kwargs["stdout_fname"] = out.name timeout = None - if 'timeout' in kwargs: - timeout = kwargs['timeout'] - kwargs.pop('timeout') + if "timeout" in kwargs: + timeout = kwargs["timeout"] + kwargs.pop("timeout") if merge: - kwargs['stderr'] = subprocess.STDOUT + kwargs["stderr"] = subprocess.STDOUT else: err = tempfile.NamedTemporaryFile(delete=False) stderr_fname = err.name - kwargs['stderr_fname'] = stderr_fname + kwargs["stderr_fname"] = stderr_fname err.close() process = create_cmd_process(*args, **kwargs) @@ -225,17 +243,17 @@ def call_get_output(*args, **kwargs): remove(out.name) for line in stdout_lines: - line = line.decode('utf-8') - log_debug(' ' + line.rstrip()) + line = line.decode("utf-8") + log_debug(" " + line.rstrip()) if not merge: - err = open(stderr_fname,"r") + err = open(stderr_fname, "r") stderr_lines = err.readlines() err.close() remove(stderr_fname) for line in stderr_lines: - line = line.decode('utf-8') - log_debug(' err:' + line.rstrip()) + line = line.decode("utf-8") + log_debug(" err:" + line.rstrip()) if merge: if timeout: diff --git a/tests/README.txt b/tests/README.txt index bbf5f0ff..18f27d62 100644 --- a/tests/README.txt +++ b/tests/README.txt @@ -6,11 +6,12 @@ xsim xsimutils tools_xmostest -Run in pytest: +Installation and prerequiste for running pytest +python3 pip install pytest To run all tests, simply type: -pytest +pytest -s -To run specifiC test, type: +To run specific test, type: pytest test_xx_xx.py diff --git a/tests/helpers.py b/tests/helpers.py index a79eb058..9ae4114e 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -16,25 +16,31 @@ import tempfile import shutil -ARCHITECTURE_CHOICES = ['xs2', 'xs3'] -BUSSPEED_CHOICES = ['FS', 'HS'] -args = {'arch':'xs3', - 'trace':False} +ARCHITECTURE_CHOICES = ["xs2", "xs3"] +BUSSPEED_CHOICES = ["FS", "HS"] +args = {"arch": "xs3", "trace": False} XN_FILES = ["test_xs2.xn", "test_xs3.xn"] clean_only = False -def copy_common_xn_files(test_dir, path = ".", common_dir = "shared_src", source_dir = "src", xn_files = XN_FILES): + +def copy_common_xn_files( + test_dir, path=".", common_dir="shared_src", source_dir="src", xn_files=XN_FILES +): src_dir = os.path.join(test_dir, source_dir) for xn_file in xn_files: xn = os.path.join(common_dir, xn_file) shutil.copy(xn, src_dir) -def delete_test_specific_xn_files(test_dir, path = ".", source_dir = "src", xn_files = XN_FILES): + +def delete_test_specific_xn_files( + test_dir, path=".", source_dir="src", xn_files=XN_FILES +): src_dir = os.path.join(test_dir, source_dir) for xn_file in xn_files: xn = os.path.join(src_dir, xn_file) os.remove(xn) + def create_if_needed(folder): if not os.path.exists(folder): os.makedirs(folder) @@ -100,28 +106,31 @@ def get_usb_clk_phy( return (clk, phy) + def run_on_simulator(xe, simthreads, **kwargs): - for k in ['do_xe_prebuild', 'build_env', 'clean_before_build']: + for k in ["do_xe_prebuild", "build_env", "clean_before_build"]: if k in kwargs: kwargs.pop(k) return Pyxsim.run_with_pyxsim(xe, simthreads, **kwargs) + def run_on(**kwargs): - for name,value in kwargs.items(): + for name, value in kwargs.items(): arg_value = args.get(name) if arg_value is not None and value != arg_value: return False return True + def RunUsbTest(test_fn): - + tester_list = [] - testname,extension = os.path.splitext(os.path.basename(__file__)) + testname, extension = os.path.splitext(os.path.basename(__file__)) seed = random.randint(0, sys.maxsize) - data_valid_count = {'FS': 39, "HS": 0} + data_valid_count = {"FS": 39, "HS": 0} (fd, fname) = tempfile.mkstemp() old_std = os.fdopen(os.dup(sys.stdout.fileno()), "w") @@ -133,51 +142,82 @@ def RunUsbTest(test_fn): if run_on(arch=_arch): if run_on(busspeed=_busspeed): (clk_60, usb_phy) = get_usb_clk_phy(verbose=False, arch=_arch) - tester_list.extend(test_fn(_arch, clk_60, usb_phy, USB_DATA_VALID_COUNT[_busspeed], _busspeed, seed)) + tester_list.extend( + test_fn( + _arch, + clk_60, + usb_phy, + USB_DATA_VALID_COUNT[_busspeed], + _busspeed, + seed, + ) + ) captured = std_reader.read() sys.stdout = old_std caps = captured.split("\n") - return Pyxsim.run_tester(caps,tester_list) - -def do_usb_test(arch, clk, phy, usb_speed, sessions, test_file, seed, - level='nightly', extra_tasks=[], verbose=False): + sys.stdout.write("\n") + return Pyxsim.run_tester(caps, tester_list) + + +def do_usb_test( + arch, + clk, + phy, + usb_speed, + sessions, + test_file, + seed, + level="nightly", + extra_tasks=[], + verbose=False, +): - """ Shared test code for all RX tests using the test_rx application. - """ - testname,extension = os.path.splitext(os.path.basename(test_file)) + """Shared test code for all RX tests using the test_rx application.""" + testname, extension = os.path.splitext(os.path.basename(test_file)) tester_list = [] - binary = '{testname}/bin/{arch}/{testname}_{arch}.xe'.format(testname=testname, arch=arch) + binary = "{testname}/bin/{arch}/{testname}_{arch}.xe".format( + testname=testname, arch=arch + ) copy_common_xn_files(testname) build_success, build_output = Pyxsim._build(binary) assert len(sessions) == 1, "Multiple sessions not yet supported" if build_success: for session in sessions: - + phy.session = session expect_folder = create_if_needed("expect") - expect_filename = '{folder}/{test}_{arch}_{usb_speed}.expect'.format( - folder=expect_folder, test=testname, phy=phy.name, clk=clk.get_name(), arch=arch, usb_speed=usb_speed) + expect_filename = "{folder}/{test}_{arch}_{usb_speed}.expect".format( + folder=expect_folder, + test=testname, + phy=phy.name, + clk=clk.get_name(), + arch=arch, + usb_speed=usb_speed, + ) create_expect(arch, session, expect_filename, verbose=verbose) - tester = testers.ComparisonTester(open(expect_filename), - 'lib_xud', 'xud_sim_tests', testname, - {'clk':clk.get_name(), 'arch':arch, 'speed':usb_speed}) + tester = testers.ComparisonTester( + open(expect_filename), + "lib_xud", + "xud_sim_tests", + testname, + {"clk": clk.get_name(), "arch": arch, "speed": usb_speed}, + ) tester_list.append(tester) simargs = get_sim_args(testname, clk, phy, arch) simthreads = [clk, phy] + extra_tasks - run_on_simulator(binary, simthreads, simargs = simargs) - delete_test_specific_xn_files(testname) - return tester_list + run_on_simulator(binary, simthreads, simargs=simargs) else: - delete_test_specific_xn_files(testname) - return ["Build Failed"] + tester_list.append("Build Failed") + delete_test_specific_xn_files(testname) + return tester_list def create_expect(arch, session, filename, verbose=False): @@ -210,7 +250,7 @@ def create_expect(arch, session, filename, verbose=False): def get_sim_args(testname, clk, phy, arch="xs2"): sim_args = [] - if args and args.get('trace'): + if args and args.get("trace"): log_folder = create_if_needed("logs") filename = "{log}/xsim_trace_{test}_{clk}_{arch}".format( diff --git a/tests/test_bulk_loopback.py b/tests/test_bulk_loopback.py index 18eb4556..e0b31c59 100644 --- a/tests/test_bulk_loopback.py +++ b/tests/test_bulk_loopback.py @@ -6,7 +6,6 @@ from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction -import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): diff --git a/tests/test_bulk_rx_basic.py b/tests/test_bulk_rx_basic.py index 13cb65b1..2ed86d17 100644 --- a/tests/test_bulk_rx_basic.py +++ b/tests/test_bulk_rx_basic.py @@ -6,7 +6,6 @@ from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction -import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): diff --git a/tests/test_bulk_rx_basic_badcrc32.py b/tests/test_bulk_rx_basic_badcrc32.py index 8c0377d9..5796afcc 100644 --- a/tests/test_bulk_rx_basic_badcrc32.py +++ b/tests/test_bulk_rx_basic_badcrc32.py @@ -6,7 +6,6 @@ from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction -import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): diff --git a/tests/test_bulk_rx_basic_badpid.py b/tests/test_bulk_rx_basic_badpid.py index 672c8eac..8eef347b 100644 --- a/tests/test_bulk_rx_basic_badpid.py +++ b/tests/test_bulk_rx_basic_badpid.py @@ -5,7 +5,6 @@ from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction -import pytest # Tests out of seq (but valid.. ) data PID def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): diff --git a/tests/test_bulk_rx_basic_nodata.py b/tests/test_bulk_rx_basic_nodata.py index bca8028c..08d6632e 100644 --- a/tests/test_bulk_rx_basic_nodata.py +++ b/tests/test_bulk_rx_basic_nodata.py @@ -7,7 +7,7 @@ from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction -import pytest + def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): diff --git a/tests/test_bulk_rx_basic_rxerror.py b/tests/test_bulk_rx_basic_rxerror.py index 66aeda25..d85e06cc 100644 --- a/tests/test_bulk_rx_basic_rxerror.py +++ b/tests/test_bulk_rx_basic_rxerror.py @@ -6,7 +6,6 @@ from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction -import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): diff --git a/tests/test_bulk_rx_multiep.py b/tests/test_bulk_rx_multiep.py index 0997174b..627d6d5e 100644 --- a/tests/test_bulk_rx_multiep.py +++ b/tests/test_bulk_rx_multiep.py @@ -6,7 +6,6 @@ from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction -import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): diff --git a/tests/test_bulk_rx_traffic.py b/tests/test_bulk_rx_traffic.py index d6b56870..2bb8c889 100644 --- a/tests/test_bulk_rx_traffic.py +++ b/tests/test_bulk_rx_traffic.py @@ -7,7 +7,6 @@ from usb_session import UsbSession from usb_transaction import UsbTransaction from usb_phy import USB_MAX_EP_ADDRESS -import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): diff --git a/tests/test_bulk_tx_badack.py b/tests/test_bulk_tx_badack.py index 44a52184..85577077 100644 --- a/tests/test_bulk_tx_badack.py +++ b/tests/test_bulk_tx_badack.py @@ -5,7 +5,6 @@ from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction -import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): diff --git a/tests/test_bulk_tx_basic.py b/tests/test_bulk_tx_basic.py index 15fc57ef..2c7cfd5c 100644 --- a/tests/test_bulk_tx_basic.py +++ b/tests/test_bulk_tx_basic.py @@ -4,7 +4,6 @@ from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction -import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): diff --git a/tests/test_bulk_tx_basic_short.py b/tests/test_bulk_tx_basic_short.py index 6a88a2e4..548dfe5e 100644 --- a/tests/test_bulk_tx_basic_short.py +++ b/tests/test_bulk_tx_basic_short.py @@ -4,7 +4,6 @@ from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction -import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): diff --git a/tests/test_bulk_tx_multiep.py b/tests/test_bulk_tx_multiep.py index ba5b454c..e0bafe1d 100644 --- a/tests/test_bulk_tx_multiep.py +++ b/tests/test_bulk_tx_multiep.py @@ -4,7 +4,6 @@ from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction -import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): diff --git a/tests/test_bulk_tx_noack.py b/tests/test_bulk_tx_noack.py index abb6fa73..c40ce3b0 100644 --- a/tests/test_bulk_tx_noack.py +++ b/tests/test_bulk_tx_noack.py @@ -5,8 +5,6 @@ from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction -import pytest - def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): diff --git a/tests/test_control_basic_get.py b/tests/test_control_basic_get.py index a900ef0d..71623f3b 100644 --- a/tests/test_control_basic_get.py +++ b/tests/test_control_basic_get.py @@ -12,7 +12,6 @@ from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction -import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): diff --git a/tests/test_control_basic_set.py b/tests/test_control_basic_set.py index 4df0d96d..5e0a79bb 100644 --- a/tests/test_control_basic_set.py +++ b/tests/test_control_basic_set.py @@ -12,7 +12,6 @@ from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction -import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): diff --git a/tests/test_invalidtoken.py b/tests/test_invalidtoken.py index 42a07bf3..b4e9349b 100644 --- a/tests/test_invalidtoken.py +++ b/tests/test_invalidtoken.py @@ -12,7 +12,6 @@ from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction -import pytest # Same as simple RX bulk test but some invalid tokens also included diff --git a/tests/test_iso_loopback.py b/tests/test_iso_loopback.py index b2346aa2..63ee10c7 100644 --- a/tests/test_iso_loopback.py +++ b/tests/test_iso_loopback.py @@ -6,7 +6,6 @@ from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction -import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): diff --git a/tests/test_iso_rx_basic.py b/tests/test_iso_rx_basic.py index d41f7c6c..4ce379c1 100644 --- a/tests/test_iso_rx_basic.py +++ b/tests/test_iso_rx_basic.py @@ -4,8 +4,6 @@ from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction -import pytest - def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): diff --git a/tests/test_iso_rxtx_fastpacket.py b/tests/test_iso_rxtx_fastpacket.py index be162a01..e77a1b9d 100644 --- a/tests/test_iso_rxtx_fastpacket.py +++ b/tests/test_iso_rxtx_fastpacket.py @@ -6,7 +6,6 @@ from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction -import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): diff --git a/tests/test_iso_tx_basic.py b/tests/test_iso_tx_basic.py index b4759b03..6cb93535 100644 --- a/tests/test_iso_tx_basic.py +++ b/tests/test_iso_tx_basic.py @@ -4,7 +4,6 @@ from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction -import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): diff --git a/tests/test_ping_rx_basic.py b/tests/test_ping_rx_basic.py index 72106984..91447184 100644 --- a/tests/test_ping_rx_basic.py +++ b/tests/test_ping_rx_basic.py @@ -14,8 +14,6 @@ from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction -import pytest - def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): diff --git a/tests/test_shorttoken.py b/tests/test_shorttoken.py index 623f5358..263e623e 100644 --- a/tests/test_shorttoken.py +++ b/tests/test_shorttoken.py @@ -5,8 +5,6 @@ from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction -import pytest - def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): diff --git a/tests/test_sof_badcrc.py b/tests/test_sof_badcrc.py index ea1b3392..357a1089 100644 --- a/tests/test_sof_badcrc.py +++ b/tests/test_sof_badcrc.py @@ -6,7 +6,6 @@ from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction -import pytest # TODO ideally creation of SOF's is moved elsewhere def CreateSofToken(frameNumber, data_valid_count, badCrc=False): diff --git a/tests/test_sof_basic.py b/tests/test_sof_basic.py index 11a301fe..a5fcb338 100644 --- a/tests/test_sof_basic.py +++ b/tests/test_sof_basic.py @@ -5,7 +5,6 @@ from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction -import pytest def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): diff --git a/tests/test_suspend_resume.py b/tests/test_suspend_resume.py index ceac46bb..c544d7ca 100644 --- a/tests/test_suspend_resume.py +++ b/tests/test_suspend_resume.py @@ -7,8 +7,6 @@ from usb_session import UsbSession from usb_transaction import UsbTransaction from usb_signalling import UsbSuspend, UsbResume -import pytest - def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): From b8c745bbc81427dd6ab53ecaee6b50a688e1f0fa Mon Sep 17 00:00:00 2001 From: Kevin Yeung Date: Wed, 2 Jun 2021 17:51:18 +0800 Subject: [PATCH 309/520] added a TestError Exception case --- tests/Pyxsim/__init__.py | 10 ---------- tests/Pyxsim/pyxsim.py | 7 ++++--- tests/Pyxsim/testers.py | 9 +++++++++ tests/Pyxsim/xe.py | 3 ++- tests/Pyxsim/xmostest_subprocess.py | 3 +++ 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/tests/Pyxsim/__init__.py b/tests/Pyxsim/__init__.py index 75c4f5c3..105ca9f9 100644 --- a/tests/Pyxsim/__init__.py +++ b/tests/Pyxsim/__init__.py @@ -15,16 +15,6 @@ clean_only = False -class XmosTestError(Exception): - """ - This exception is used for any errors that occur whilst calling - functions in the Pyxsim module. - """ - def __init__(self, value): - self.value = value - def __str__(self): - return repr(self.value) - # This function is called automatically by the runners def _build(xe_path, build_config=None, env={}, do_clean=False): diff --git a/tests/Pyxsim/pyxsim.py b/tests/Pyxsim/pyxsim.py index a273357f..c67108bf 100644 --- a/tests/Pyxsim/pyxsim.py +++ b/tests/Pyxsim/pyxsim.py @@ -6,6 +6,7 @@ import os, re, struct from ctypes import cdll, byref, c_void_p, c_char_p, c_int, create_string_buffer from Pyxsim.xe import Xe +from Pyxsim.testers import TestError import threading import traceback import Pyxsim @@ -96,7 +97,7 @@ def parse_port(p): if bit != None: bit = int(bit) else: - raise Pyxsim.XmosTestError("Cannot parse port: %s" % p) + raise TestError("Cannot parse port: %s" % p) if bit != None: mask = 1 << bit else: @@ -110,7 +111,7 @@ def parse_periph_pin(p): perif = m.groups(0)[0] pin = m.groups(0)[1] else: - raise Pyxsim.XmosTestError("Cannot parse periph pin: %s" % p) + raise TestError("Cannot parse periph pin: %s" % p) mask = ALL_BITS return (perif, pin, mask) @@ -263,7 +264,7 @@ def wait_for_simthread(self, simthread): simthread.complete_event.wait() simthread.complete_event.clear() if simthread.had_exception: - raise Pyxsim.XmosTestError("Simthread encoutered an exception") + raise TestError("Simthread encoutered an exception") def clock(self): status = xsi_lib.xsi_clock(self.xsim) diff --git a/tests/Pyxsim/testers.py b/tests/Pyxsim/testers.py index f18a0607..d4652cdc 100644 --- a/tests/Pyxsim/testers.py +++ b/tests/Pyxsim/testers.py @@ -3,6 +3,15 @@ import re import sys +class TestError(Exception): + """ + This exception is used for any errors that occur whilst calling + functions in the Pyxsim module. + """ + def __init__(self, value): + self.value = value + def __str__(self): + return repr(self.value) class ComparisonTester: """ diff --git a/tests/Pyxsim/xe.py b/tests/Pyxsim/xe.py index 37a2fa6d..5f3c056d 100644 --- a/tests/Pyxsim/xe.py +++ b/tests/Pyxsim/xe.py @@ -1,6 +1,7 @@ # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. from Pyxsim.xmostest_subprocess import call, call_get_output +from Pyxsim.testers import TestError import os, tempfile from xml.dom.minidom import parse import re @@ -55,7 +56,7 @@ def get_port_pins(self, port): for (package, pin, bitnum) in pins: if bitnum == bit: return [(package, pin, bitnum)] - raise Pyxsim.XmosTestError("Cannot find port pins") + raise TestError("Cannot find port pins") else: return self._port_map[port] diff --git a/tests/Pyxsim/xmostest_subprocess.py b/tests/Pyxsim/xmostest_subprocess.py index 50614704..2590b499 100644 --- a/tests/Pyxsim/xmostest_subprocess.py +++ b/tests/Pyxsim/xmostest_subprocess.py @@ -10,6 +10,7 @@ import os import signal import errno +from Pyxsim.testers import TestError def pstreekill(process): @@ -83,6 +84,8 @@ def platform_is_windows(): concat_args = True use_shell = True # Windows version of Python 2.7 doesn't support SIGINT + if sys.version_info < (3, 0): + raise TestError("Doesn't support Python version < 3, please upgrade to Python 3 or higher.") SIGINT = signal.SIGTERM else: concat_args = False From a61fef74bddc32d540ad124cb4549c0fa08a6280 Mon Sep 17 00:00:00 2001 From: Kevin Yeung Date: Wed, 2 Jun 2021 19:56:30 +0800 Subject: [PATCH 310/520] added output capturing class --- tests/helpers.py | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/tests/helpers.py b/tests/helpers.py index 9ae4114e..e5f642bf 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -23,6 +23,20 @@ clean_only = False +class cap_redirect: + def __init__(self): + (self.fd, self.fname) = tempfile.mkstemp() + self.old_std = os.fdopen(os.dup(sys.stdout.fileno()), "w") + sys.stdout = os.fdopen(self.fd, "w") + + def read_output(self): + std_reader = open(self.fname, "r") + return std_reader.read() + + def close_capture(self): + sys.stdout = self.old_std + + def copy_common_xn_files( test_dir, path=".", common_dir="shared_src", source_dir="src", xn_files=XN_FILES ): @@ -132,10 +146,7 @@ def RunUsbTest(test_fn): data_valid_count = {"FS": 39, "HS": 0} - (fd, fname) = tempfile.mkstemp() - old_std = os.fdopen(os.dup(sys.stdout.fileno()), "w") - sys.stdout = os.fdopen(fd, "w") - std_reader = open(fname, "r") + start_cap = cap_redirect() for _arch in ARCHITECTURE_CHOICES: for _busspeed in BUSSPEED_CHOICES: @@ -152,12 +163,11 @@ def RunUsbTest(test_fn): seed, ) ) - - captured = std_reader.read() - sys.stdout = old_std - caps = captured.split("\n") + output = start_cap.read_output() + start_cap.close_capture() + output = output.split("\n") sys.stdout.write("\n") - return Pyxsim.run_tester(caps, tester_list) + return Pyxsim.run_tester(output, tester_list) def do_usb_test( @@ -219,6 +229,7 @@ def do_usb_test( delete_test_specific_xn_files(testname) return tester_list + def create_expect(arch, session, filename, verbose=False): events = session.events From 80c40412c76587be19a03d5fa5f2cb4e780906cf Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 2 Jun 2021 14:57:01 +0100 Subject: [PATCH 311/520] Further updates to device attach test --- lib_xud/module_build_info | 2 +- lib_xud/src/core/XUD_TimingDefines.h | 6 +- tests/test_device_attach/Makefile | 2 +- tests/usb_packet.py | 2 +- tests/usb_phy.py | 37 +++++++-- tests/usb_phy_utmi.py | 2 +- tests/usb_signalling.py | 116 ++++++++++++++++++++------- 7 files changed, 124 insertions(+), 43 deletions(-) diff --git a/lib_xud/module_build_info b/lib_xud/module_build_info index 38e54179..82bdbf7c 100644 --- a/lib_xud/module_build_info +++ b/lib_xud/module_build_info @@ -16,7 +16,7 @@ XCC_FLAGS_dfu_flash.xc = $(MODULE_XCC_FLAGS) -Os XCC_FLAGS_XUD_Client.xc = $(MODULE_XCC_FLAGS) -mno-dual-issue XCC_FLAGS_XUD_Main.xc = $(MODULE_XCC_FLAGS) -mno-dual-issue XCC_FLAGS_XUD_SetDevAddr.xc = $(MODULE_XCC_FLAGS) -mno-dual-issue -XCC_FLAGS_XUD_DeviceAttach.xc = $(MODULE_XCC_FLAGS) -mno-dual-issue -Wno-return-type +#XCC_FLAGS_XUD_DeviceAttach.xc = $(MODULE_XCC_FLAGS) -mno-dual-issue -Wno-return-type XCC_FLAGS_XUD_PhyResetUser.xc = $(MODULE_XCC_FLAGS) -mno-dual-issue XCC_FLAGS_XUD_Support.xc = $(MODULE_XCC_FLAGS) -mno-dual-issue XCC_FLAGS_XUD_IOLoopCall.xc = $(MODULE_XCC_FLAGS) -mno-dual-issue diff --git a/lib_xud/src/core/XUD_TimingDefines.h b/lib_xud/src/core/XUD_TimingDefines.h index c9030013..cf84b828 100755 --- a/lib_xud/src/core/XUD_TimingDefines.h +++ b/lib_xud/src/core/XUD_TimingDefines.h @@ -17,12 +17,10 @@ #define T_UCHEND_T_UCH_us (1000000) // 1000ms #define T_UCHEND_T_UCH (T_UCHEND_T_UCH_us * REF_CLK_FREQ) -#ifdef XUD_TIMING_SHORT -#define T_FILT_ticks (100) -#else +#ifndef T_FILT_us #define T_FILT_us (3) // 2.5us -#define T_FILT_ticks (T_FILT_us * REF_CLK_FREQ) #endif +#define T_FILT_ticks (T_FILT_us * REF_CLK_FREQ) #ifndef SUSPEND_T_WTWRSTHS_us #define SUSPEND_T_WTWRSTHS_us (200) // 200us Time beforechecking for J after asserting XcvrSelect and Termselect: T_WTRSTHS: 100-875us diff --git a/tests/test_device_attach/Makefile b/tests/test_device_attach/Makefile index 6bd91548..9bae1fcc 100644 --- a/tests/test_device_attach/Makefile +++ b/tests/test_device_attach/Makefile @@ -1,4 +1,4 @@ -TEST_FLAGS = -DSUSPEND_TIMEOUT_us=300 -DSUSPEND_T_WTWRSTHS_us=20 +TEST_FLAGS = -DSUSPEND_TIMEOUT_us=300 -DSUSPEND_T_WTWRSTHS_us=20 -DT_FILT_us=1 include ../test_makefile.mak diff --git a/tests/usb_packet.py b/tests/usb_packet.py index 047ae2cb..63eae5ff 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -310,7 +310,7 @@ def drive(self, usb_phy, bus_speed): wait(lambda x: usb_phy._clock.is_low()) if xsi.sample_port_pins(usb_phy._txv) == 0: - # print "TXV low, breaking out of loop" + # TxV low, break out of loop in_rx_packet = False # End of packet diff --git a/tests/usb_phy.py b/tests/usb_phy.py index c00c76f3..1376ff91 100644 --- a/tests/usb_phy.py +++ b/tests/usb_phy.py @@ -19,16 +19,40 @@ "HS_K": 2, } -USB_TIMINGS = { +# TODO want two sets of these, one "spec" and one "fast" for testing +USB_TIMINGS_SPEC = { "IDLE_TO_FS_MIN_US": 300, # Spec: 3000 "IDLE_TO_FS_MAX_US": 312, # Spec: 3125 "RESUME_FSK_MIN_US": 200, # Spec: 20000us "RESUME_SE0_US": 1.25, # 1.25uS - 1.5uS - 'T_UCHEND': 7000, # Upstream Chirp end time - 'T_UCH': 1000, # Upstream Chirp length - 'T_SIGATT_US': 100000, # Maximum time from Vbus valid to when the device must signal attach - 'T_ATTDB_US': 100000, # Debouce interval. The dives now enters the HS Detection Handshake protocol - } + "T_UCHEND": 7000, # Upstream Chirp end time + "T_UCH": 1000, # Upstream Chirp length + "T_WTDCH_US": 100, + "T_SIGATT_US": 100000, # Maximum time from Vbus valid to when the device must signal attach + "T_ATTDB_US": 10, # 100000 Debouce interval. The device now enters the HS Detection Handshake protocol + "T_DCHBIT_MIN_US": 40, + "T_DCHBIT_MAX_US": 60, + "CHIRP_COUNT_MIN": 3, # Minimum chirp pairs DUT must detect before moving into HS mode + "CHIRP_COUNT_MAX": 10, # TODO should these chirp defines be removed and use timing? +} + +USB_TIMINGS_SHORT = { + "IDLE_TO_FS_MIN_US": 300, # Spec: 3000 + "IDLE_TO_FS_MAX_US": 312, # Spec: 3125 + "RESUME_FSK_MIN_US": 200, # Spec: 20000us + "RESUME_SE0_US": 1.25, # 1.25uS - 1.5uS + "T_UCHEND": 7000, # Upstream Chirp end time + "T_UCH": 1000, # Upstream Chirp length + "T_WTDCH_US": 50, + "T_SIGATT_US": 100000, # Maximum time from Vbus valid to when the device must signal attach + "T_ATTDB_US": 10, # 100000 Debouce interval. The device now enters the HS Detection Handshake protocol + "T_DCHBIT_MIN_US": 4, # Spec: 40us + "T_DCHBIT_MAX_US": 6, # Spec: 60us + "CHIRP_COUNT_MIN": 3, # Minimum chirp pairs DUT must detect before moving into HS mode + "CHIRP_COUNT_MAX": 10, # TODO should these chirp defines be removed and use timing? +} + +USB_TIMINGS = USB_TIMINGS_SHORT class UsbPhy(xmostest.SimThread): @@ -159,7 +183,6 @@ def run(self): self.start_test() for i, event in enumerate(self._session.events): - event.drive(self, self._session.bus_speed) print("Test done") diff --git a/tests/usb_phy_utmi.py b/tests/usb_phy_utmi.py index f28690b1..801343db 100644 --- a/tests/usb_phy_utmi.py +++ b/tests/usb_phy_utmi.py @@ -20,7 +20,7 @@ def __init__( xcvrsel, termsel, clock, - initial_delay=60000, + initial_delay=19000, # TODO why can't this be set to a lower value? verbose=False, test_ctrl=None, do_timeout=True, diff --git a/tests/usb_signalling.py b/tests/usb_signalling.py index d7f3c800..01c89c47 100644 --- a/tests/usb_signalling.py +++ b/tests/usb_signalling.py @@ -13,8 +13,14 @@ def __str__(self): return "DeviceAttach" def expected_output(self, bus_speed, offset=0): - #return "DeviceAttach\n" - return self.__str__() + "\n" + # return "DeviceAttach\n" + return ( + self.__str__() + + "\n" + + "DUT Entered FS\n" + + "Received upstream chirp\n" + + "DUT Entered HS mode\n" + ) @property def event_count(self): @@ -23,12 +29,12 @@ def event_count(self): def drive(self, usb_phy, bus_speed): wait = usb_phy.wait - time = usb_phy.xsi.get_time + wait_until_ns = usb_phy.wait_until xsi = usb_phy.xsi + time = xsi.get_time + print("DeviceAttach") tConnect_ns = time() - - print(self.__str__() + "\n") # Check XcvrSel & TermSel low xcvrsel = xsi.sample_periph_pin(usb_phy._xcvrsel) @@ -42,64 +48,118 @@ def drive(self, usb_phy, bus_speed): # TODO Drive VBUS - while True: + while True: - if (time() - tConnect_ns) > USB_TIMINGS['T_SIGATT_US']: + if (time() - tConnect_ns) > USB_TIMINGS["T_SIGATT_US"]: print("ERROR: DUT didnt not assert XcvrSel & TermSel quickly enough") - # Check device asserts XcvrSel and TermSel before T_SIGATT + # Check device asserts XcvrSel and TermSel before T_SIGATT xcvrsel = xsi.sample_periph_pin(usb_phy._xcvrsel) termsel = xsi.sample_periph_pin(usb_phy._termsel) if xcvrsel == 1 and termsel == 1: - break; + break + + print("DUT entered FS") # Bus state: Idle (FS 'J') xsi.drive_periph_pin(usb_phy._ls, USB_LINESTATE["FS_J"]) # Drive bus reset (SE0) after T_ATTDB - This is T0 of Figure 25 - wait(USB_TIMINGS['T_ATTDB_US']) - xsi.drive_periph_pin(usb_phy._ls, USB_LINESTATE["SE0"]) + wait_until_ns(time() + USB_TIMINGS["T_ATTDB_US"] * 1000) + wait(lambda x: usb_phy._clock.is_high()) + wait(lambda x: usb_phy._clock.is_low()) + + xsi.drive_periph_pin(usb_phy._ls, USB_LINESTATE["IDLE"]) # Check DUT enables HS Transceiver and asserts Chirp K on the bus (XcvrSel low, TxValid high) # (This needs to be done before T_UCHEND - T_UCH) while True: xcvrsel = xsi.sample_periph_pin(usb_phy._xcvrsel) - txv = xsi.sample_periph_pin(usb_phy._txv) + txv = xsi.sample_port_pins(usb_phy._txv) + + wait(lambda x: usb_phy._clock.is_high()) + wait(lambda x: usb_phy._clock.is_low()) - if xcvrsel == 1 and txv == 1: + if (xcvrsel == 0) and (txv == 1): t_ChirpStart_ns = time() - break; + break + + print("Received upstream chirp") - # Check that Chirp K lasts atleast T_UCH while True: - txv = xsi.sample_periph_pin(usb_phy._txv) - + + xsi.drive_port_pins(usb_phy._txrdy, 1) + data = xsi.sample_port_pins(usb_phy._txd) + + if data != 0: + print("ERROR: Unexpected data from DUT during upstream chirp") + + wait(lambda x: usb_phy._clock.is_high()) + wait(lambda x: usb_phy._clock.is_low()) + + txv = xsi.sample_port_pins(usb_phy._txv) + if txv == 0: + # End of upstream chirp t_ChirpEnd_ns = time() - if (t_ChirpEnd_ns - t_ChirpStart_ns) < USB_TIMINGS["T_UCH"]: - print("ERROR: Upstream chirp too short") - break; + break + + xsi.drive_port_pins(usb_phy._txrdy, 0) + + # Check that Chirp K lasts atleast T_UCH + if (t_ChirpEnd_ns - t_ChirpStart_ns) < USB_TIMINGS["T_UCH"]: + print("ERROR: Upstream chirp too short") # Check that Chirp K ends before T_UCHEND - if (t_ChirpEnd - tConnect_ns) > USB_TIMINGS["T_UCHEND"]: + if (t_ChirpEnd_ns - tConnect_ns) > USB_TIMINGS["T_UCHEND"]: print("ERROR: Upstream chirp finished too late") - # if bus_speed == "HS": - # Before end of Chirp K + T_WTDCH assert chirp K on the bus + if bus_speed == "HS": + + wait_until_ns(time() + USB_TIMINGS["T_WTDCH_US"] * 1000) + + for chirp_count in range(USB_TIMINGS["CHIRP_COUNT_MIN"]): + + # Before end of Chirp K + T_WTDCH assert chirp K on the bus + xsi.drive_periph_pin(usb_phy._ls, USB_LINESTATE["FS_K"]) + wait_until_ns(time() + USB_TIMINGS["T_DCHBIT_MIN_US"] * 1000) - # After between T_DCHBIT_MIN and T_DCHBIT_MAX toogle chirp K to chirp J + # After between T_DCHBIT_MIN and T_DCHBIT_MAX toogle chirp K to chirp J + xsi.drive_periph_pin(usb_phy._ls, USB_LINESTATE["FS_J"]) + wait_until_ns(time() + USB_TIMINGS["T_DCHBIT_MIN_US"] * 1000) + + # After between T_DCHBIT_MIN and T_DCHBIT_MAX toogle chirp J to chirp K + + # After atleast 3 chirp pairs ensure DUT de-asserts TermSel to enter HS mode + if xsi.sample_periph_pin(usb_phy._termsel) != 0: + print("ERROR: DUT didnt enter HS as expected") + else: + print("DUT entered HS mode") + + for chirp_count in range( + USB_TIMINGS["CHIRP_COUNT_MAX"] - USB_TIMINGS["CHIRP_COUNT_MIN"] + ): - # After between T_DCHBIT_MIN and T_DCHBIT_MAX toogle chirp J to chirp K + # Before end of Chirp K + T_WTDCH assert chirp K on the bus + xsi.drive_periph_pin(usb_phy._ls, USB_LINESTATE["FS_K"]) + wait_until_ns(time() + USB_TIMINGS["T_DCHBIT_MIN_US"] * 1000) - # After atleast X chirp pairs ensure DUT de-asserts TermSel to enter HS mode + # After between T_DCHBIT_MIN and T_DCHBIT_MAX toogle chirp K to chirp J + xsi.drive_periph_pin(usb_phy._ls, USB_LINESTATE["FS_J"]) + wait_until_ns(time() + USB_TIMINGS["T_DCHBIT_MIN_US"] * 1000) # Terminate downstream chirp K-J Sequence (between T_DCHSE0_MAX and T_DCHSE0_MIN - # Endure DUT enters HS before T0 + T_DRST + # Ensure DUT enters HS before T0 + T_DRST # Drive HS Idle (SE0) on bus - + xsi.drive_periph_pin(usb_phy._ls, USB_LINESTATE["IDLE"]) + + # TODO how long to drive SE0 for? + wait_until_ns(time() + 10000) + + return class UsbResume(UsbEvent): From 7c6458d09d459289f8333aaf53fb9c6be34e9da0 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 2 Jun 2021 17:45:07 +0100 Subject: [PATCH 312/520] Removed build warning and fixed up XS3 device attach test fail --- lib_xud/src/core/XUD_DeviceAttach.xc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib_xud/src/core/XUD_DeviceAttach.xc b/lib_xud/src/core/XUD_DeviceAttach.xc index 8c94bdca..5ea58038 100755 --- a/lib_xud/src/core/XUD_DeviceAttach.xc +++ b/lib_xud/src/core/XUD_DeviceAttach.xc @@ -102,18 +102,23 @@ int XUD_DeviceAttachHS(XUD_PwrConfig pwrConfig) break; #ifdef __XS3A__ -#warning J and K definitons are reversed in XS3A +// Note, J and K definitons are reversed in XS3A +#define j_port flag1_port +#define k_port flag0_port +#else +#define k_port flag1_port +#define j_port flag0_port #endif - case detecting_k => flag1_port when pinseq(1):> void @ tx: // K Chirp - flag1_port @ tx + T_FILT_ticks :> tmp; + case detecting_k => k_port when pinseq(1):> void @ tx: // K Chirp + k_port @ tx + T_FILT_ticks :> tmp; if (tmp) { detecting_k = 0; } break; - case !detecting_k => flag0_port when pinseq(1) :> void @ tx: // J Chirp - flag0_port @ tx + T_FILT_ticks :> tmp; + case !detecting_k => j_port when pinseq(1) :> void @ tx: // J Chirp + j_port @ tx + T_FILT_ticks :> tmp; if (tmp == 1) { chirpCount++; // Seen an extra K-J pair From 326d48f74dc2c8db096ffec6d122b458aeb4e985 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 2 Jun 2021 17:45:37 +0100 Subject: [PATCH 313/520] Updated short test timings --- tests/usb_phy.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/usb_phy.py b/tests/usb_phy.py index 1376ff91..73c39009 100644 --- a/tests/usb_phy.py +++ b/tests/usb_phy.py @@ -26,7 +26,7 @@ "RESUME_FSK_MIN_US": 200, # Spec: 20000us "RESUME_SE0_US": 1.25, # 1.25uS - 1.5uS "T_UCHEND": 7000, # Upstream Chirp end time - "T_UCH": 1000, # Upstream Chirp length + "T_UCH_US": 1000, # Upstream Chirp length "T_WTDCH_US": 100, "T_SIGATT_US": 100000, # Maximum time from Vbus valid to when the device must signal attach "T_ATTDB_US": 10, # 100000 Debouce interval. The device now enters the HS Detection Handshake protocol @@ -42,7 +42,7 @@ "RESUME_FSK_MIN_US": 200, # Spec: 20000us "RESUME_SE0_US": 1.25, # 1.25uS - 1.5uS "T_UCHEND": 7000, # Upstream Chirp end time - "T_UCH": 1000, # Upstream Chirp length + "T_UCH_US": 10, # Upstream Chirp length "T_WTDCH_US": 50, "T_SIGATT_US": 100000, # Maximum time from Vbus valid to when the device must signal attach "T_ATTDB_US": 10, # 100000 Debouce interval. The device now enters the HS Detection Handshake protocol From 7c9c932555387de66e48e2202b1d28c6da12fd90 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 2 Jun 2021 17:46:02 +0100 Subject: [PATCH 314/520] Updated to device attach test stimulus --- tests/usb_signalling.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/tests/usb_signalling.py b/tests/usb_signalling.py index 01c89c47..77729a71 100644 --- a/tests/usb_signalling.py +++ b/tests/usb_signalling.py @@ -17,9 +17,9 @@ def expected_output(self, bus_speed, offset=0): return ( self.__str__() + "\n" - + "DUT Entered FS\n" + + "DUT entered FS\n" + "Received upstream chirp\n" - + "DUT Entered HS mode\n" + + "DUT entered HS mode\n" ) @property @@ -40,13 +40,12 @@ def drive(self, usb_phy, bus_speed): xcvrsel = xsi.sample_periph_pin(usb_phy._xcvrsel) termsel = xsi.sample_periph_pin(usb_phy._termsel) - if xcvrsel == 1: - print("ERROR: DUT enabled pull up before valid Vbus (XCVRSel)") + # TODO Drive VBUS and enabled these checks + #if xcvrsel == 1: + # print("ERROR: DUT enabled pull up before valid Vbus (XCVRSel)") - if termsel == 1: - print("ERROR: DUT enabled pull up before valid Vbus (TermSel)") - - # TODO Drive VBUS + #if termsel == 1: + # print("ERROR: DUT enabled pull up before valid Vbus (TermSel)") while True: @@ -108,11 +107,11 @@ def drive(self, usb_phy, bus_speed): xsi.drive_port_pins(usb_phy._txrdy, 0) # Check that Chirp K lasts atleast T_UCH - if (t_ChirpEnd_ns - t_ChirpStart_ns) < USB_TIMINGS["T_UCH"]: + if (t_ChirpEnd_ns - t_ChirpStart_ns) < USB_TIMINGS["T_UCH_US"]*1000: print("ERROR: Upstream chirp too short") # Check that Chirp K ends before T_UCHEND - if (t_ChirpEnd_ns - tConnect_ns) > USB_TIMINGS["T_UCHEND"]: + if (t_ChirpEnd_ns - tConnect_ns) > USB_TIMINGS["T_UCHEND"]*1000: print("ERROR: Upstream chirp finished too late") if bus_speed == "HS": From fc649428b452fa07de33068f36f777f35377e03e Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 2 Jun 2021 17:46:18 +0100 Subject: [PATCH 315/520] Formatting only --- tests/usb_signalling.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/usb_signalling.py b/tests/usb_signalling.py index 77729a71..b3bf2eae 100644 --- a/tests/usb_signalling.py +++ b/tests/usb_signalling.py @@ -41,10 +41,10 @@ def drive(self, usb_phy, bus_speed): termsel = xsi.sample_periph_pin(usb_phy._termsel) # TODO Drive VBUS and enabled these checks - #if xcvrsel == 1: + # if xcvrsel == 1: # print("ERROR: DUT enabled pull up before valid Vbus (XCVRSel)") - #if termsel == 1: + # if termsel == 1: # print("ERROR: DUT enabled pull up before valid Vbus (TermSel)") while True: @@ -107,11 +107,11 @@ def drive(self, usb_phy, bus_speed): xsi.drive_port_pins(usb_phy._txrdy, 0) # Check that Chirp K lasts atleast T_UCH - if (t_ChirpEnd_ns - t_ChirpStart_ns) < USB_TIMINGS["T_UCH_US"]*1000: + if (t_ChirpEnd_ns - t_ChirpStart_ns) < USB_TIMINGS["T_UCH_US"] * 1000: print("ERROR: Upstream chirp too short") # Check that Chirp K ends before T_UCHEND - if (t_ChirpEnd_ns - tConnect_ns) > USB_TIMINGS["T_UCHEND"]*1000: + if (t_ChirpEnd_ns - tConnect_ns) > USB_TIMINGS["T_UCHEND"] * 1000: print("ERROR: Upstream chirp finished too late") if bus_speed == "HS": From 3af385a2384f476739fb8a6f98fd85ab0230d92a Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 2 Jun 2021 17:48:51 +0100 Subject: [PATCH 316/520] Remove usage of old test define --- lib_xud/src/core/XUD_Main.xc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index 711dabba..f347aa36 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -295,7 +295,7 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c if (one) { -#if defined(XUD_SIM_XSIM) || defined(XUD_BYPASS_CONNECT) +#if defined(XUD_BYPASS_CONNECT) reset = 1; #else reset = XUD_Init(); From 30576200623e3e119886e778608ba79fa0d5eafe Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 2 Jun 2021 18:37:53 +0100 Subject: [PATCH 317/520] Quick fix to allow packet and device attach tests to pass (related to start up delay) --- tests/test_device_attach.py | 2 ++ tests/usb_phy.py | 8 ++++++++ tests/usb_phy_utmi.py | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/test_device_attach.py b/tests/test_device_attach.py index 1d9cdd6e..63799647 100644 --- a/tests/test_device_attach.py +++ b/tests/test_device_attach.py @@ -56,6 +56,8 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) ) + phy.initial_delay = 19000 + do_usb_test( arch, clk, diff --git a/tests/usb_phy.py b/tests/usb_phy.py index 73c39009..343a95f0 100644 --- a/tests/usb_phy.py +++ b/tests/usb_phy.py @@ -103,6 +103,14 @@ def __init__( self._expect_loopback = expect_loopback self._dut_exit_time = dut_exit_time + @property + def initial_delay(self): + return self._initial_delay + + @initial_delay.setter + def initial_delay(self, d): + self._initial_delay = d + @property def name(self): return self._name diff --git a/tests/usb_phy_utmi.py b/tests/usb_phy_utmi.py index 801343db..f28690b1 100644 --- a/tests/usb_phy_utmi.py +++ b/tests/usb_phy_utmi.py @@ -20,7 +20,7 @@ def __init__( xcvrsel, termsel, clock, - initial_delay=19000, # TODO why can't this be set to a lower value? + initial_delay=60000, verbose=False, test_ctrl=None, do_timeout=True, From bc7373c415f204b8008502d827ba3347ec9ca21f Mon Sep 17 00:00:00 2001 From: Kevin Yeung Date: Thu, 3 Jun 2021 11:11:44 +0800 Subject: [PATCH 318/520] moved cap_redirect to Pyxsim --- tests/Pyxsim/__init__.py | 15 +++++++++++++++ tests/helpers.py | 18 +----------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/tests/Pyxsim/__init__.py b/tests/Pyxsim/__init__.py index 105ca9f9..6cd0de35 100644 --- a/tests/Pyxsim/__init__.py +++ b/tests/Pyxsim/__init__.py @@ -10,6 +10,7 @@ from Pyxsim.xmostest_subprocess import call_get_output import platform import multiprocessing +import tempfile import re import os @@ -134,6 +135,20 @@ def run_tester(caps, tester_list): return result +class cap_redirect: + def __init__(self): + (self.fd, self.fname) = tempfile.mkstemp() + self.old_std = os.fdopen(os.dup(sys.stdout.fileno()), "w") + sys.stdout = os.fdopen(self.fd, "w") + + def read_output(self): + std_reader = open(self.fname, "r") + return std_reader.read() + + def close_capture(self): + sys.stdout = self.old_std + + class SimThread(object): def run(self, xsi): pass diff --git a/tests/helpers.py b/tests/helpers.py index e5f642bf..3be413f4 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -12,8 +12,6 @@ from usb_phy_utmi import UsbPhyUtmi from usb_packet import RxPacket from usb_packet import BusReset -import pytest -import tempfile import shutil ARCHITECTURE_CHOICES = ["xs2", "xs3"] @@ -23,20 +21,6 @@ clean_only = False -class cap_redirect: - def __init__(self): - (self.fd, self.fname) = tempfile.mkstemp() - self.old_std = os.fdopen(os.dup(sys.stdout.fileno()), "w") - sys.stdout = os.fdopen(self.fd, "w") - - def read_output(self): - std_reader = open(self.fname, "r") - return std_reader.read() - - def close_capture(self): - sys.stdout = self.old_std - - def copy_common_xn_files( test_dir, path=".", common_dir="shared_src", source_dir="src", xn_files=XN_FILES ): @@ -146,7 +130,7 @@ def RunUsbTest(test_fn): data_valid_count = {"FS": 39, "HS": 0} - start_cap = cap_redirect() + start_cap = Pyxsim.cap_redirect() for _arch in ARCHITECTURE_CHOICES: for _busspeed in BUSSPEED_CHOICES: From c7c8320e6b7abd5027c29bd193c93b6c4d4a7915 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 3 Jun 2021 11:06:15 +0100 Subject: [PATCH 319/520] Removed commented out line in module_build_info --- lib_xud/module_build_info | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_xud/module_build_info b/lib_xud/module_build_info index 82bdbf7c..71bac12b 100644 --- a/lib_xud/module_build_info +++ b/lib_xud/module_build_info @@ -16,7 +16,6 @@ XCC_FLAGS_dfu_flash.xc = $(MODULE_XCC_FLAGS) -Os XCC_FLAGS_XUD_Client.xc = $(MODULE_XCC_FLAGS) -mno-dual-issue XCC_FLAGS_XUD_Main.xc = $(MODULE_XCC_FLAGS) -mno-dual-issue XCC_FLAGS_XUD_SetDevAddr.xc = $(MODULE_XCC_FLAGS) -mno-dual-issue -#XCC_FLAGS_XUD_DeviceAttach.xc = $(MODULE_XCC_FLAGS) -mno-dual-issue -Wno-return-type XCC_FLAGS_XUD_PhyResetUser.xc = $(MODULE_XCC_FLAGS) -mno-dual-issue XCC_FLAGS_XUD_Support.xc = $(MODULE_XCC_FLAGS) -mno-dual-issue XCC_FLAGS_XUD_IOLoopCall.xc = $(MODULE_XCC_FLAGS) -mno-dual-issue From d790a0e82a1c43e2c3778c78e0428aff1f827763 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 3 Jun 2021 11:06:23 +0100 Subject: [PATCH 320/520] White space only --- tests/test_device_attach/src/main.xc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_device_attach/src/main.xc b/tests/test_device_attach/src/main.xc index f7e53eb1..de0506d9 100644 --- a/tests/test_device_attach/src/main.xc +++ b/tests/test_device_attach/src/main.xc @@ -38,13 +38,13 @@ int main() par { { - #if defined(XUD_TEST_SPEED_FS) +#if defined(XUD_TEST_SPEED_FS) unsigned speed = XUD_SPEED_FS; - #elif defined(XUD_TEST_SPEED_HS) +#elif defined(XUD_TEST_SPEED_HS) unsigned speed = XUD_SPEED_HS; - #else - #error XUD_TEST_SPEED_XX not defined - #endif +#else +#error XUD_TEST_SPEED_XX not defined +#endif XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, speed, XUD_PWR_BUS); From 5cd7f29ce3134bcd740ba46d7e50e5e13dcecb75 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 3 Jun 2021 11:06:35 +0100 Subject: [PATCH 321/520] Removed extra enumerate --- tests/usb_phy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/usb_phy.py b/tests/usb_phy.py index 343a95f0..8b8a046d 100644 --- a/tests/usb_phy.py +++ b/tests/usb_phy.py @@ -190,7 +190,7 @@ def run(self): self.start_test() - for i, event in enumerate(self._session.events): + for event in self._session.events: event.drive(self, self._session.bus_speed) print("Test done") From 50f379439e6858abc95195ba9f403bf3f0e1ba74 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 3 Jun 2021 11:07:32 +0100 Subject: [PATCH 322/520] Removed superfluous return --- tests/usb_signalling.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/usb_signalling.py b/tests/usb_signalling.py index b3bf2eae..5915e807 100644 --- a/tests/usb_signalling.py +++ b/tests/usb_signalling.py @@ -158,8 +158,6 @@ def drive(self, usb_phy, bus_speed): # TODO how long to drive SE0 for? wait_until_ns(time() + 10000) - return - class UsbResume(UsbEvent): def __init__(self, duration=USB_TIMINGS["RESUME_FSK_MIN_US"], interEventDelay=0): From 7a70f9f501f67227fafd5351791970fd1b61670f Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 3 Jun 2021 20:49:38 +0100 Subject: [PATCH 323/520] Removed use of data_valid_count in do_test since it can be inferred from bus speed --- tests/helpers.py | 8 ++---- tests/test_bulk_loopback.py | 2 +- tests/test_bulk_rx_basic.py | 2 +- tests/test_bulk_rx_basic_badcrc32.py | 2 +- tests/test_bulk_rx_basic_badpid.py | 2 +- tests/test_bulk_rx_basic_nodata.py | 2 +- tests/test_bulk_rx_basic_rxerror.py | 2 +- tests/test_bulk_rx_multiep.py | 2 +- tests/test_bulk_rx_traffic.py | 2 +- tests/test_bulk_tx_badack.py | 8 ++---- tests/test_bulk_tx_basic.py | 2 +- tests/test_bulk_tx_basic_short.py | 2 +- tests/test_bulk_tx_multiep.py | 2 +- tests/test_bulk_tx_noack.py | 3 +- tests/test_control_basic_get.py | 15 ++++------ tests/test_control_basic_set.py | 15 ++++------ tests/test_device_attach.py | 6 ++-- tests/test_invalidtoken.py | 7 +---- tests/test_iso_loopback.py | 2 +- tests/test_iso_rx_basic.py | 2 +- tests/test_iso_rxtx_fastpacket.py | 2 +- tests/test_iso_tx_basic.py | 2 +- tests/test_ping_rx_basic.py | 20 +++++--------- tests/test_shorttoken.py | 3 +- tests/test_sof_badcrc.py | 17 ++++++------ tests/test_sof_basic.py | 12 ++++---- tests/test_suspend_resume.py | 6 ++-- tests/usb_packet.py | 41 +++++++++++----------------- tests/usb_phy.py | 2 -- tests/usb_session.py | 3 +- tests/usb_transaction.py | 2 +- 31 files changed, 78 insertions(+), 120 deletions(-) diff --git a/tests/helpers.py b/tests/helpers.py index 26415320..6f66a762 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -6,11 +6,10 @@ import random import sys from usb_clock import Clock -from usb_phy import UsbPhy, USB_DATA_VALID_COUNT +from usb_phy import UsbPhy from usb_phy_shim import UsbPhyShim from usb_phy_utmi import UsbPhyUtmi -from usb_packet import RxPacket -from usb_packet import BusReset +from usb_packet import RxPacket, USB_DATA_VALID_COUNT args = None @@ -100,8 +99,6 @@ def RunUsbTest(test_fn): seed = args.seed if args.seed else random.randint(0, sys.maxsize) - data_valid_count = {"FS": 39, "HS": 0} - for _arch in ARCHITECTURE_CHOICES: for _busspeed in BUSSPEED_CHOICES: if run_on(arch=_arch): @@ -111,7 +108,6 @@ def RunUsbTest(test_fn): _arch, clk_60, usb_phy, - USB_DATA_VALID_COUNT[_busspeed], _busspeed, seed, verbose=args.verbose, diff --git a/tests/test_bulk_loopback.py b/tests/test_bulk_loopback.py index 65a72462..95add04e 100644 --- a/tests/test_bulk_loopback.py +++ b/tests/test_bulk_loopback.py @@ -9,7 +9,7 @@ from usb_transaction import UsbTransaction -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): +def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ep_loopback = 3 ep_loopback_kill = 2 diff --git a/tests/test_bulk_rx_basic.py b/tests/test_bulk_rx_basic.py index d7de96dd..5ce8241a 100644 --- a/tests/test_bulk_rx_basic.py +++ b/tests/test_bulk_rx_basic.py @@ -10,7 +10,7 @@ from usb_transaction import UsbTransaction -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): +def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ep = 1 address = 1 diff --git a/tests/test_bulk_rx_basic_badcrc32.py b/tests/test_bulk_rx_basic_badcrc32.py index e5390721..69a32217 100644 --- a/tests/test_bulk_rx_basic_badcrc32.py +++ b/tests/test_bulk_rx_basic_badcrc32.py @@ -9,7 +9,7 @@ from usb_transaction import UsbTransaction -def test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): +def test(arch, clk, phy, usb_speed, seed, verbose=False): address = 1 ep = 1 diff --git a/tests/test_bulk_rx_basic_badpid.py b/tests/test_bulk_rx_basic_badpid.py index d2c64b84..005ec760 100644 --- a/tests/test_bulk_rx_basic_badpid.py +++ b/tests/test_bulk_rx_basic_badpid.py @@ -8,7 +8,7 @@ from usb_transaction import UsbTransaction # Tests out of seq (but valid.. ) data PID -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): +def do_test(arch, clk, phy, usb_speed, seed, verbose=False): address = 1 ep = 1 diff --git a/tests/test_bulk_rx_basic_nodata.py b/tests/test_bulk_rx_basic_nodata.py index a8c44fd5..375fb780 100644 --- a/tests/test_bulk_rx_basic_nodata.py +++ b/tests/test_bulk_rx_basic_nodata.py @@ -10,7 +10,7 @@ from usb_transaction import UsbTransaction -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): +def do_test(arch, clk, phy, usb_speed, seed, verbose=False): address = 1 ep = 1 diff --git a/tests/test_bulk_rx_basic_rxerror.py b/tests/test_bulk_rx_basic_rxerror.py index f7f1725c..a11f24c5 100644 --- a/tests/test_bulk_rx_basic_rxerror.py +++ b/tests/test_bulk_rx_basic_rxerror.py @@ -9,7 +9,7 @@ from usb_transaction import UsbTransaction -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): +def do_test(arch, clk, phy, usb_speed, seed, verbose=False): address = 1 ep = 1 diff --git a/tests/test_bulk_rx_multiep.py b/tests/test_bulk_rx_multiep.py index d64bcad3..7f99b484 100644 --- a/tests/test_bulk_rx_multiep.py +++ b/tests/test_bulk_rx_multiep.py @@ -10,7 +10,7 @@ from usb_transaction import UsbTransaction -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): +def do_test(arch, clk, phy, usb_speed, seed, verbose=False): address = 1 diff --git a/tests/test_bulk_rx_traffic.py b/tests/test_bulk_rx_traffic.py index 0ad4803d..5aca5016 100644 --- a/tests/test_bulk_rx_traffic.py +++ b/tests/test_bulk_rx_traffic.py @@ -11,7 +11,7 @@ from usb_phy import USB_MAX_EP_ADDRESS -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): +def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ep = 1 address = 1 diff --git a/tests/test_bulk_tx_badack.py b/tests/test_bulk_tx_badack.py index 7511a407..9745595a 100644 --- a/tests/test_bulk_tx_badack.py +++ b/tests/test_bulk_tx_badack.py @@ -8,7 +8,7 @@ from usb_transaction import UsbTransaction -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): +def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ep = 1 address = 1 @@ -27,20 +27,16 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): pid=USB_PID["IN"], address=address, endpoint=ep, - data_valid_count=data_valid_count, inter_pkt_gap=ied, ) ) session.add_event( RxDataPacket( dataPayload=session.getPayload_in(ep, pktLength, resend=True), - valid_count=data_valid_count, pid=USB_PID["DATA0"], ) ) - session.add_event( - TxHandshakePacket(data_valid_count=data_valid_count, pid=0xFF) - ) + session.add_event(TxHandshakePacket(pid=0xFF)) session.add_event( UsbTransaction( diff --git a/tests/test_bulk_tx_basic.py b/tests/test_bulk_tx_basic.py index 40a884f8..140fb0d1 100644 --- a/tests/test_bulk_tx_basic.py +++ b/tests/test_bulk_tx_basic.py @@ -8,7 +8,7 @@ from usb_transaction import UsbTransaction -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): +def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ep = 1 address = 1 diff --git a/tests/test_bulk_tx_basic_short.py b/tests/test_bulk_tx_basic_short.py index 1e3d2256..a586ba32 100644 --- a/tests/test_bulk_tx_basic_short.py +++ b/tests/test_bulk_tx_basic_short.py @@ -7,7 +7,7 @@ from usb_transaction import UsbTransaction -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): +def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ep = 1 address = 1 diff --git a/tests/test_bulk_tx_multiep.py b/tests/test_bulk_tx_multiep.py index a3821613..2af9e3c1 100644 --- a/tests/test_bulk_tx_multiep.py +++ b/tests/test_bulk_tx_multiep.py @@ -8,7 +8,7 @@ from usb_transaction import UsbTransaction -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): +def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ep = 3 # Note this is a starting EP address = 1 diff --git a/tests/test_bulk_tx_noack.py b/tests/test_bulk_tx_noack.py index 441a480b..f0fd1331 100644 --- a/tests/test_bulk_tx_noack.py +++ b/tests/test_bulk_tx_noack.py @@ -8,7 +8,7 @@ from usb_transaction import UsbTransaction -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): +def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ep = 1 address = 1 @@ -28,7 +28,6 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): pid=USB_PID["IN"], address=address, endpoint=ep, - data_valid_count=data_valid_count, inter_pkt_gap=ied, ) ) diff --git a/tests/test_control_basic_get.py b/tests/test_control_basic_get.py index 032de41b..5188e162 100644 --- a/tests/test_control_basic_get.py +++ b/tests/test_control_basic_get.py @@ -15,7 +15,7 @@ from usb_transaction import UsbTransaction -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): +def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ep = 0 address = 1 @@ -30,17 +30,15 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): pid=USB_PID["SETUP"], address=address, endpoint=ep, - data_valid_count=data_valid_count, ) ) session.add_event( TxDataPacket( dataPayload=session.getPayload_out(ep, 8), - data_valid_count=data_valid_count, pid=USB_PID["DATA0"], ) ) - session.add_event(RxHandshakePacket(data_valid_count=data_valid_count)) + session.add_event(RxHandshakePacket()) # IN transaction # Note, quite big gap to avoid nak @@ -49,18 +47,16 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): pid=USB_PID["IN"], address=address, endpoint=ep, - data_valid_count=data_valid_count, interEventDelay=10000, ) ) session.add_event( RxDataPacket( dataPayload=session.getPayload_in(ep, 10), - data_valid_count=data_valid_count, pid=USB_PID["DATA1"], ) ) - session.add_event(TxHandshakePacket(data_valid_count=data_valid_count)) + session.add_event(TxHandshakePacket()) # Send 0 length OUT transaction session.add_event( @@ -68,13 +64,12 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): pid=USB_PID["OUT"], address=address, endpoint=ep, - data_valid_count=data_valid_count, ) ) session.add_event( - TxDataPacket(data_valid_count=data_valid_count, length=0, pid=USB_PID["DATA1"]) + TxDataPacket(length=0, pid=USB_PID["DATA1"]) ) - session.add_event(RxHandshakePacket(data_valid_count=data_valid_count)) + session.add_event(RxHandshakePacket()) do_usb_test( arch, diff --git a/tests/test_control_basic_set.py b/tests/test_control_basic_set.py index 1018caee..75bc0993 100644 --- a/tests/test_control_basic_set.py +++ b/tests/test_control_basic_set.py @@ -15,7 +15,7 @@ from usb_transaction import UsbTransaction -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): +def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ep = 0 address = 1 @@ -30,17 +30,15 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): pid=USB_PID["SETUP"], address=address, endpoint=ep, - data_valid_count=data_valid_count, ) ) session.add_event( TxDataPacket( dataPayload=session.getPayload_out(ep, 8), - data_valid_count=data_valid_count, pid=USB_PID["DATA0"], ) ) - session.add_event(RxHandshakePacket(data_valid_count=data_valid_count)) + session.add_event(RxHandshakePacket()) # OUT transaction # Note, quite big gap to avoid nak @@ -49,18 +47,16 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): pid=USB_PID["OUT"], address=address, endpoint=ep, - data_valid_count=data_valid_count, interEventDelay=10000, ) ) session.add_event( TxDataPacket( dataPayload=session.getPayload_out(ep, 10), - data_valid_count=data_valid_count, pid=USB_PID["DATA1"], ) ) - session.add_event(RxHandshakePacket(data_valid_count=data_valid_count)) + session.add_event(RxHandshakePacket()) # Expect 0 length IN transaction session.add_event( @@ -68,13 +64,12 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): pid=USB_PID["IN"], address=address, endpoint=ep, - data_valid_count=data_valid_count, ) ) session.add_event( - RxDataPacket(dataPayload=[], valid_count=data_valid_count, pid=USB_PID["DATA1"]) + RxDataPacket(dataPayload=[], pid=USB_PID["DATA1"]) ) - session.add_event(TxHandshakePacket(data_valid_count=data_valid_count)) + session.add_event(TxHandshakePacket()) do_usb_test( arch, diff --git a/tests/test_device_attach.py b/tests/test_device_attach.py index 63799647..f82f663d 100644 --- a/tests/test_device_attach.py +++ b/tests/test_device_attach.py @@ -11,7 +11,7 @@ from usb_signalling import UsbDeviceAttach -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): +def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ep = 1 address = 1 @@ -26,7 +26,7 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): session.add_event(UsbDeviceAttach()) - session.add_event(CreateSofToken(frameNumber, data_valid_count)) + session.add_event(CreateSofToken(frameNumber)) session.add_event( UsbTransaction( @@ -43,7 +43,7 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): frameNumber = frameNumber + 1 pktLength = pktLength + 1 - session.add_event(CreateSofToken(frameNumber, data_valid_count)) + session.add_event(CreateSofToken(frameNumber)) session.add_event( UsbTransaction( session, diff --git a/tests/test_invalidtoken.py b/tests/test_invalidtoken.py index 8d3afe2a..27e1c0b6 100644 --- a/tests/test_invalidtoken.py +++ b/tests/test_invalidtoken.py @@ -17,7 +17,7 @@ # Same as simple RX bulk test but some invalid tokens also included -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): +def do_test(arch, clk, phy, usb_speed, seed, verbose=False): address = 1 ep = 1 @@ -32,7 +32,6 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): pid=USB_PID["RESERVED"], address=address, endpoint=ep, - data_valid_count=data_valid_count, ) ) @@ -42,7 +41,6 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): pid=USB_PID["IN"], address=address + 1, endpoint=ep, - data_valid_count=data_valid_count, ) ) @@ -52,7 +50,6 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): pid=USB_PID["OUT"], address=address + 1, endpoint=ep, - data_valid_count=data_valid_count, ) ) @@ -74,7 +71,6 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): pid=USB_PID["SETUP"], address=address + 2, endpoint=ep, - data_valid_count=data_valid_count, ) ) @@ -98,7 +94,6 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): pid=USB_PID["PING"], address=address + 2, endpoint=ep, - data_valid_count=data_valid_count, ) ) diff --git a/tests/test_iso_loopback.py b/tests/test_iso_loopback.py index cf3f14ea..d52fdf08 100644 --- a/tests/test_iso_loopback.py +++ b/tests/test_iso_loopback.py @@ -10,7 +10,7 @@ from usb_transaction import UsbTransaction -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): +def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ep_loopback = 3 ep_loopback_kill = 2 diff --git a/tests/test_iso_rx_basic.py b/tests/test_iso_rx_basic.py index bcedf8ab..6bc67209 100644 --- a/tests/test_iso_rx_basic.py +++ b/tests/test_iso_rx_basic.py @@ -7,7 +7,7 @@ from usb_transaction import UsbTransaction -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): +def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ep = 2 address = 1 diff --git a/tests/test_iso_rxtx_fastpacket.py b/tests/test_iso_rxtx_fastpacket.py index 1df2f950..3cd446d4 100644 --- a/tests/test_iso_rxtx_fastpacket.py +++ b/tests/test_iso_rxtx_fastpacket.py @@ -10,7 +10,7 @@ from usb_transaction import UsbTransaction -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): +def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ep = 3 address = 1 diff --git a/tests/test_iso_tx_basic.py b/tests/test_iso_tx_basic.py index 7c568a9e..61dce2b3 100644 --- a/tests/test_iso_tx_basic.py +++ b/tests/test_iso_tx_basic.py @@ -7,7 +7,7 @@ from usb_transaction import UsbTransaction -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): +def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ep = 3 address = 1 diff --git a/tests/test_ping_rx_basic.py b/tests/test_ping_rx_basic.py index ca98243c..0a14f149 100644 --- a/tests/test_ping_rx_basic.py +++ b/tests/test_ping_rx_basic.py @@ -18,7 +18,7 @@ from usb_transaction import UsbTransaction -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): +def do_test(arch, clk, phy, usb_speed, seed, verbose=False): address = 1 ep = 1 @@ -33,11 +33,10 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): pid=USB_PID["PING"], address=address, endpoint=2, - data_valid_count=data_valid_count, ) ) session.add_event( - RxHandshakePacket(data_valid_count=data_valid_count, pid=USB_PID["NAK"]) + RxHandshakePacket(pid=USB_PID["NAK"]) ) # And again @@ -46,11 +45,10 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): pid=USB_PID["PING"], address=address, endpoint=2, - data_valid_count=data_valid_count, ) ) session.add_event( - RxHandshakePacket(data_valid_count=data_valid_count, pid=USB_PID["NAK"]) + RxHandshakePacket(pid=USB_PID["NAK"]) ) # Send packet to EP 1, xCORE should mark EP 2 as ready @@ -71,12 +69,11 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): pid=USB_PID["PING"], address=address, endpoint=2, - data_valid_count=data_valid_count, interEventDelay=6000, ) ) session.add_event( - RxHandshakePacket(data_valid_count=data_valid_count, pid=USB_PID["ACK"]) + RxHandshakePacket(pid=USB_PID["ACK"]) ) # And again.. @@ -85,12 +82,11 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): pid=USB_PID["PING"], address=address, endpoint=2, - data_valid_count=data_valid_count, interEventDelay=6000, ) ) session.add_event( - RxHandshakePacket(data_valid_count=data_valid_count, pid=USB_PID["ACK"]) + RxHandshakePacket(pid=USB_PID["ACK"]) ) # Send out to EP 2.. expect ack @@ -112,11 +108,10 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): pid=USB_PID["PING"], address=address, endpoint=2, - data_valid_count=data_valid_count, ) ) session.add_event( - RxHandshakePacket(data_valid_count=data_valid_count, pid=USB_PID["NAK"]) + RxHandshakePacket(pid=USB_PID["NAK"]) ) # And again @@ -125,11 +120,10 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): pid=USB_PID["PING"], address=address, endpoint=2, - data_valid_count=data_valid_count, ) ) session.add_event( - RxHandshakePacket(data_valid_count=data_valid_count, pid=USB_PID["NAK"]) + RxHandshakePacket(pid=USB_PID["NAK"]) ) # Send a packet to EP 1 so the DUT knows it can exit. diff --git a/tests/test_shorttoken.py b/tests/test_shorttoken.py index f84d4dc9..f689d9a6 100644 --- a/tests/test_shorttoken.py +++ b/tests/test_shorttoken.py @@ -9,7 +9,7 @@ from usb_transaction import UsbTransaction -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): +def do_test(arch, clk, phy, usb_speed, seed, verbose=False): address = 1 ep = 1 @@ -36,7 +36,6 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): shorttoken = TxPacket( pid=USB_PID["OUT"], data_bytes=[0x81], - data_valid_count=data_valid_count, interEventDelay=100, ) session.add_event(shorttoken) diff --git a/tests/test_sof_badcrc.py b/tests/test_sof_badcrc.py index 7c7084c7..ef94110f 100644 --- a/tests/test_sof_badcrc.py +++ b/tests/test_sof_badcrc.py @@ -9,7 +9,8 @@ from usb_transaction import UsbTransaction # TODO ideally creation of SOF's is moved elsewhere -def CreateSofToken(frameNumber, data_valid_count, badCrc=False): +def CreateSofToken(frameNumber, badCrc=False): + ep = (frameNumber >> 7) & 0xF address = (frameNumber) & 0x7F @@ -18,7 +19,6 @@ def CreateSofToken(frameNumber, data_valid_count, badCrc=False): pid=USB_PID["SOF"], address=address, endpoint=ep, - data_valid_count=data_valid_count, crc5=0xFF, ) else: @@ -26,13 +26,12 @@ def CreateSofToken(frameNumber, data_valid_count, badCrc=False): pid=USB_PID["SOF"], address=address, endpoint=ep, - data_valid_count=data_valid_count, ) return sofToken -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): +def do_test(arch, clk, phy, usb_speed, seed, verbose=False): address = 1 ep = 1 @@ -54,13 +53,13 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) ) - session.add_event(CreateSofToken(frameNumber, data_valid_count)) - session.add_event(CreateSofToken(frameNumber + 1, data_valid_count)) - session.add_event(CreateSofToken(frameNumber + 2, data_valid_count)) + session.add_event(CreateSofToken(frameNumber)) + session.add_event(CreateSofToken(frameNumber + 1)) + session.add_event(CreateSofToken(frameNumber + 2)) session.add_event( - CreateSofToken(frameNumber + 3, data_valid_count, badCrc=True) + CreateSofToken(frameNumber + 3, badCrc=True) ) # Invalidate the CRC - session.add_event(CreateSofToken(frameNumber + 4, data_valid_count)) + session.add_event(CreateSofToken(frameNumber + 4)) # Finish with valid transaction session.add_event( diff --git a/tests/test_sof_basic.py b/tests/test_sof_basic.py index b3354c97..54ff9a90 100644 --- a/tests/test_sof_basic.py +++ b/tests/test_sof_basic.py @@ -8,7 +8,7 @@ from usb_transaction import UsbTransaction -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): +def do_test(arch, clk, phy, usb_speed, seed, verbose=False): address = 1 ep = 1 @@ -30,11 +30,11 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) ) - session.add_event(CreateSofToken(frameNumber, data_valid_count)) - session.add_event(CreateSofToken(frameNumber + 1, data_valid_count)) - session.add_event(CreateSofToken(frameNumber + 2, data_valid_count)) - session.add_event(CreateSofToken(frameNumber + 3, data_valid_count)) - session.add_event(CreateSofToken(frameNumber + 4, data_valid_count)) + session.add_event(CreateSofToken(frameNumber)) + session.add_event(CreateSofToken(frameNumber + 1)) + session.add_event(CreateSofToken(frameNumber + 2)) + session.add_event(CreateSofToken(frameNumber + 3)) + session.add_event(CreateSofToken(frameNumber + 4)) # Finish with valid transaction session.add_event( diff --git a/tests/test_suspend_resume.py b/tests/test_suspend_resume.py index ea78ca5b..299f454e 100644 --- a/tests/test_suspend_resume.py +++ b/tests/test_suspend_resume.py @@ -11,7 +11,7 @@ from usb_signalling import UsbSuspend, UsbResume -def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): +def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ep = 1 address = 1 @@ -36,7 +36,7 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): ) ) - session.add_event(CreateSofToken(frameNumber, data_valid_count)) + session.add_event(CreateSofToken(frameNumber)) session.add_event(UsbSuspend(350000)) session.add_event(UsbResume()) @@ -44,7 +44,7 @@ def do_test(arch, clk, phy, data_valid_count, usb_speed, seed, verbose=False): frameNumber = frameNumber + 1 pktLength = pktLength + 1 session.add_event( - CreateSofToken(frameNumber, data_valid_count, interEventDelay=2000) + CreateSofToken(frameNumber, interEventDelay=2000) ) session.add_event( UsbTransaction( diff --git a/tests/usb_packet.py b/tests/usb_packet.py index 63eae5ff..1c3b159c 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -59,9 +59,8 @@ """ from usb_event import UsbEvent -import sys -import zlib -import random + +USB_DATA_VALID_COUNT = {"FS": 39, "HS": 0} # In USB clocks RX_TX_DELAY = 20 @@ -85,7 +84,7 @@ } -def CreateSofToken(frameNumber, data_valid_count, badCrc=False, interEventDelay=1000): +def CreateSofToken(frameNumber, badCrc=False, interEventDelay=1000): ep = (frameNumber >> 7) & 0xF address = (frameNumber) & 0x7F @@ -94,7 +93,6 @@ def CreateSofToken(frameNumber, data_valid_count, badCrc=False, interEventDelay= pid=USB_PID["SOF"], address=address, endpoint=ep, - data_valid_count=data_valid_count, crc5=0xFF, interEventDelay=interEventDelay, ) @@ -103,7 +101,6 @@ def CreateSofToken(frameNumber, data_valid_count, badCrc=False, interEventDelay= pid=USB_PID["SOF"], address=address, endpoint=ep, - data_valid_count=data_valid_count, interEventDelay=interEventDelay, ) @@ -226,20 +223,10 @@ def __init__(self, **kwargs): self.pid = kwargs.pop("pid", 0xC3) self.data_bytes = kwargs.pop("data_bytes", None) self.num_data_bytes = kwargs.pop("length", 0) - self._data_valid_count = kwargs.pop("data_valid_count", 0) self.bad_crc = kwargs.pop("bad_crc", False) ied = kwargs.pop("interEventDelay", 500) # TODO RM magic number super(UsbPacket, self).__init__(interEventDelay=ied) - # This is used on HOST->DEVICE (TX) packets to toggle RXValid and DEVICE->HOST (RX) packets to toggle TXReady - @property - def data_valid_count(self): - return self._data_valid_count - - @data_valid_count.setter - def data_valid_count(self, dvc): - self._data_valid_count = dvc - @property def event_count(self): return 1 @@ -357,9 +344,9 @@ def drive(self, usb_phy, bus_speed, verbose=True): # xCore should not be trying to send if we are trying to send.. if xsi.sample_port_pins(usb_phy._txv) == 1: - print("ERROR: Unexpected packet from xCORE") + print("ERROR: Unexpected packet from xCORE (TxPacket 0)") - rxv_count = self.data_valid_count + rxv_count = USB_DATA_VALID_COUNT[bus_speed] usb_phy.wait_until(xsi.get_time() + self.interEventDelay) @@ -384,7 +371,7 @@ def drive(self, usb_phy, bus_speed, verbose=True): # xCore should not be trying to send if we are trying to send.. if xsi.sample_port_pins(usb_phy._txv) == 1: - print("ERROR: Unexpected packet from xCORE") + print("ERROR: Unexpected packet from xCORE (TxPacket 1)") wait(lambda x: usb_phy._clock.is_low()) wait(lambda x: usb_phy._clock.is_high()) @@ -402,12 +389,13 @@ def drive(self, usb_phy, bus_speed, verbose=True): rxv_count = rxv_count - 1 # xCore should not be trying to send if we are trying to send.. - if xsi.sample_port_pins(usb_phy._txv) == 1: - print("ERROR: Unexpected packet from xCORE") + # We assume that the Phy internally blocks the TXValid signal to the Transmit State Machine + # until the Rx packet has completed - # print "Sending byte {0:#x}".format(byte) + # if xsi.sample_port_pins(usb_phy._txv) == 1: + # print("ERROR: Unexpected packet from xCORE (TxPacket 2)") - rxv_count = self.data_valid_count + rxv_count = USB_DATA_VALID_COUNT[bus_speed] # Wait for last byte wait(lambda x: usb_phy._clock.is_high()) @@ -425,8 +413,11 @@ def drive(self, usb_phy, bus_speed, verbose=True): rxa_end_delay = rxa_end_delay - 1 # xCore should not be trying to send if we are trying to send.. - if xsi.sample_port_pins(usb_phy._txv) == 1: - print("ERROR: Unexpected packet from xCORE") + # We assume that the Phy internally blocks the TXValid signal to the Transmit State Machine + # until the Rx packet has completed + + # if xsi.sample_port_pins(usb_phy._txv) == 1: + # print("ERROR: Unexpected packet from xCORE (TxPacket 3)") xsi.drive_periph_pin(usb_phy._rxa, 0) diff --git a/tests/usb_phy.py b/tests/usb_phy.py index 8b8a046d..02b4e281 100644 --- a/tests/usb_phy.py +++ b/tests/usb_phy.py @@ -9,8 +9,6 @@ USB_MAX_EP_ADDRESS = 15 -USB_DATA_VALID_COUNT = {"FS": 39, "HS": 0} - USB_LINESTATE = { "IDLE": 0, "FS_J": 2, diff --git a/tests/usb_session.py b/tests/usb_session.py index aa27f69c..c08cfe2d 100644 --- a/tests/usb_session.py +++ b/tests/usb_session.py @@ -1,7 +1,7 @@ # Copyright 2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1 -from usb_phy import USB_DATA_VALID_COUNT +from usb_packet import USB_DATA_VALID_COUNT import usb_transaction import usb_packet @@ -98,6 +98,7 @@ def add_event(self, e): e.bus_speed = ( self.bus_speed ) # TODO ideally dont need transction to know bus speed + self._events.append(e) def pop_event(self, e): diff --git a/tests/usb_transaction.py b/tests/usb_transaction.py index 3821de54..862ae6dd 100644 --- a/tests/usb_transaction.py +++ b/tests/usb_transaction.py @@ -10,7 +10,7 @@ RxDataPacket, TxHandshakePacket, ) -from usb_phy import USB_DATA_VALID_COUNT +from usb_packet import USB_DATA_VALID_COUNT INTER_TRANSACTION_DELAY = 500 From 2863d96011b57fa95d608b58948dcde1a81d8314 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 7 Jun 2021 11:46:12 +0100 Subject: [PATCH 324/520] Readme fixes for checker --- README.rst | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/README.rst b/README.rst index 12dd0b25..92ed5ab4 100644 --- a/README.rst +++ b/README.rst @@ -27,35 +27,6 @@ Known Issues * SOF tokens are not CRC checked on XS3 based devices (see tests/test_sof_badcrc) -Typical Resource Usage -...................... - -.. resusage:: - - * - configuration: USB device (xCORE-200 series) - - target: XCORE-200-EXPLORER - - flags: -DXUD_SERIES_SUPPORT=XUD_X200_SERIES - - globals: XUD_EpType epTypeTableOut[1] = {XUD_EPTYPE_CTL | XUD_STATUS_ENABLE}; - XUD_EpType epTypeTableIn[1] = {XUD_EPTYPE_CTL | XUD_STATUS_ENABLE}; - - locals: chan c_ep_out[1];chan c_ep_in[1]; - - fn: XUD_Main(c_ep_out, 1, c_ep_in, 1, - null, epTypeTableOut, epTypeTableIn, - null, null, -1 , XUD_SPEED_HS, XUD_PWR_BUS); - - pins: 23 (internal) - - ports: 11 - - * - configuration: USB device (U series) - - target: SLICEKIT-U16 - - flags: -DXUD_SERIES_SUPPORT=XUD_U_SERIES - - globals: XUD_EpType epTypeTableOut[1] = {XUD_EPTYPE_CTL | XUD_STATUS_ENABLE}; - XUD_EpType epTypeTableIn[1] = {XUD_EPTYPE_CTL | XUD_STATUS_ENABLE}; - - locals: chan c_ep_out[1];chan c_ep_in[1]; - - fn: XUD_Main(c_ep_out, 1, c_ep_in, 1, - null, epTypeTableOut, epTypeTableIn, - null, null, -1 , XUD_SPEED_HS, XUD_PWR_BUS); - - pins: 23 (internal) - - ports: 11 - Software version and dependencies ................................. From c37e1e641ad1bd767787b12a6ce3fd5341ee1e9a Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 7 Jun 2021 11:48:31 +0100 Subject: [PATCH 325/520] Update version number on module_build_info --- lib_xud/module_build_info | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xud/module_build_info b/lib_xud/module_build_info index 71bac12b..a7c64780 100644 --- a/lib_xud/module_build_info +++ b/lib_xud/module_build_info @@ -1,4 +1,4 @@ -VERSION = 1.1.2 +VERSION = 2.0.0 MODULE_XCC_FLAGS = $(XCC_FLAGS) \ -O3 \ From f767bbf4fe9b67abd6ae7324d4ce2fd6d8928fa6 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 7 Jun 2021 11:48:57 +0100 Subject: [PATCH 326/520] Licence comment fix --- tests/usb_session.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/usb_session.py b/tests/usb_session.py index c08cfe2d..62634d41 100644 --- a/tests/usb_session.py +++ b/tests/usb_session.py @@ -1,5 +1,5 @@ # Copyright 2021 XMOS LIMITED. -# This Software is subject to the terms of the XMOS Public Licence: Version 1 +# This Software is subject to the terms of the XMOS Public Licence: Version 1. from usb_packet import USB_DATA_VALID_COUNT import usb_transaction From 35437eb7d6efb579952e804b3c14a880c8c3344a Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 7 Jun 2021 11:49:14 +0100 Subject: [PATCH 327/520] Fixes to device attach test --- tests/usb_signalling.py | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/tests/usb_signalling.py b/tests/usb_signalling.py index 5915e807..330bb1cf 100644 --- a/tests/usb_signalling.py +++ b/tests/usb_signalling.py @@ -13,14 +13,13 @@ def __str__(self): return "DeviceAttach" def expected_output(self, bus_speed, offset=0): - # return "DeviceAttach\n" - return ( - self.__str__() - + "\n" - + "DUT entered FS\n" - + "Received upstream chirp\n" - + "DUT entered HS mode\n" - ) + + expected = self.__str__() + "\nDUT entered FS\nReceived upstream chirp\n" + + if bus_speed == "HS": + expected += "DUT entered HS mode\n" + + return expected @property def event_count(self): @@ -152,11 +151,28 @@ def drive(self, usb_phy, bus_speed): # Ensure DUT enters HS before T0 + T_DRST - # Drive HS Idle (SE0) on bus - xsi.drive_periph_pin(usb_phy._ls, USB_LINESTATE["IDLE"]) + # Drive HS Idle (SE0) on bus + xsi.drive_periph_pin(usb_phy._ls, USB_LINESTATE["IDLE"]) + + # TODO how long to drive SE0 for? + wait_until_ns(time() + 10000) + + if bus_speed == "FS": + # Wait for device to timeout and move back into FS mode + while True: + xcvrsel = xsi.sample_periph_pin(usb_phy._xcvrsel) + termsel = xsi.sample_periph_pin(usb_phy._termsel) + + if xcvrsel == 1 and termsel == 1: + wait_until_ns(time() + 10000) + xsi.drive_periph_pin(usb_phy._ls, USB_LINESTATE["FS_J"]) + wait_until_ns(time() + 10000) + break + + wait(lambda x: usb_phy._clock.is_high()) + wait(lambda x: usb_phy._clock.is_low()) + - # TODO how long to drive SE0 for? - wait_until_ns(time() + 10000) class UsbResume(UsbEvent): From 75c53c06c0673915924be6f8db552c873ebf5679 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 7 Jun 2021 11:49:33 +0100 Subject: [PATCH 328/520] Copyright comment --- tests/test_suspend_resume/src/main.xc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_suspend_resume/src/main.xc b/tests/test_suspend_resume/src/main.xc index 23ee09a9..7e4d797e 100644 --- a/tests/test_suspend_resume/src/main.xc +++ b/tests/test_suspend_resume/src/main.xc @@ -1,4 +1,4 @@ -// Copyright 2021 XMOS LIMITED. +// Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include From b1ecffa730e51a97f46c48e2504fca9f3774a9d5 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 7 Jun 2021 11:53:31 +0100 Subject: [PATCH 329/520] Fixes for device attach tests --- lib_xud/src/core/XUD_DeviceAttach.xc | 4 ++++ tests/test_device_attach.py | 2 +- tests/test_device_attach/Makefile | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib_xud/src/core/XUD_DeviceAttach.xc b/lib_xud/src/core/XUD_DeviceAttach.xc index 5ea58038..a3d064dc 100755 --- a/lib_xud/src/core/XUD_DeviceAttach.xc +++ b/lib_xud/src/core/XUD_DeviceAttach.xc @@ -16,7 +16,11 @@ extern out buffered port:32 p_usb_txd; #define TUCHEND_DELAY_us (1500) // 1.5ms #define TUCHEND_DELAY (TUCHEND_DELAY_us * REF_CLK_FREQ) + +#ifndef INVALID_DELAY_us #define INVALID_DELAY_us (2500) // 2.5ms +#endif + #define INVALID_DELAY (INVALID_DELAY_us * REF_CLK_FREQ) extern int resetCount; diff --git a/tests/test_device_attach.py b/tests/test_device_attach.py index f82f663d..06c08a49 100644 --- a/tests/test_device_attach.py +++ b/tests/test_device_attach.py @@ -26,7 +26,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): session.add_event(UsbDeviceAttach()) - session.add_event(CreateSofToken(frameNumber)) + session.add_event(CreateSofToken(frameNumber, interEventDelay=100)) session.add_event( UsbTransaction( diff --git a/tests/test_device_attach/Makefile b/tests/test_device_attach/Makefile index 9bae1fcc..920b679a 100644 --- a/tests/test_device_attach/Makefile +++ b/tests/test_device_attach/Makefile @@ -1,4 +1,4 @@ -TEST_FLAGS = -DSUSPEND_TIMEOUT_us=300 -DSUSPEND_T_WTWRSTHS_us=20 -DT_FILT_us=1 +TEST_FLAGS = -DSUSPEND_TIMEOUT_us=300 -DSUSPEND_T_WTWRSTHS_us=20 -DT_FILT_us=1 -DINVALID_DELAY_us=100 include ../test_makefile.mak From d8a30736785137269cae72e15a57b5e686de26d2 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 7 Jun 2021 12:20:24 +0100 Subject: [PATCH 330/520] Updated changelog version --- CHANGELOG.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 23749d1a..4b1e8d44 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,8 +1,8 @@ lib_xud Change Log ================== -HEAD ----- +2.0.0 +----- * ADDED: Initial support for XS3A based devices * ADDED: Requirement to define XUD_CORE_CLOCK with xcore core clock speed in MHz From 6e70a016a942527a231470058b613a4fc619b2ef Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 7 Jun 2021 12:21:57 +0100 Subject: [PATCH 331/520] Comment only --- tests/test_device_attach.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_device_attach.py b/tests/test_device_attach.py index 06c08a49..d7eaba13 100644 --- a/tests/test_device_attach.py +++ b/tests/test_device_attach.py @@ -1,7 +1,8 @@ -#!/usr/bin/env python # Copyright 2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. +#!/usr/bin/env python + import xmostest import usb_packet from usb_packet import CreateSofToken From 7d505ab10693a09ebebf10a9723612d12cc76b71 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 7 Jun 2021 12:25:08 +0100 Subject: [PATCH 332/520] Removed file failing copyright check --- tests/test_device_attach/src/main.xc | 69 ---------------------------- 1 file changed, 69 deletions(-) delete mode 100644 tests/test_device_attach/src/main.xc diff --git a/tests/test_device_attach/src/main.xc b/tests/test_device_attach/src/main.xc deleted file mode 100644 index de0506d9..00000000 --- a/tests/test_device_attach/src/main.xc +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2021 XMOS LIMITED. -// This Software is subject to the terms of the XMOS Public Licence: Version 1. - -#include -#include -#include -#include "xud.h" -#include "platform.h" -#include "shared.h" - -#define XUD_EP_COUNT_OUT 5 -#define XUD_EP_COUNT_IN 5 - -#ifndef PKT_LENGTH_START -#define PKT_LENGTH_START 10 -#endif - -#ifndef PKT_LENGTH_END -#define PKT_LENGTH_END 11 -#endif - -#ifndef TEST_EP_NUM -#define TEST_EP_NUM 1 -#endif - -/* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; - -#ifdef XUD_SIM_RTL -int testmain() -#else -int main() -#endif -{ - chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - - par - { - { -#if defined(XUD_TEST_SPEED_FS) - unsigned speed = XUD_SPEED_FS; -#elif defined(XUD_TEST_SPEED_HS) - unsigned speed = XUD_SPEED_HS; -#else -#error XUD_TEST_SPEED_XX not defined -#endif - - XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, speed, XUD_PWR_BUS); - } - - { - unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); - - - XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); - XUD_Kill(ep0); - - if(fail) - TerminateFail(fail); - else - TerminatePass(fail); - - } - } - - return 0; -} From 4973b60930e8161cafe9e3f87b171cbae31fd57d Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 7 Jun 2021 12:28:58 +0100 Subject: [PATCH 333/520] Re-added file --- tests/test_device_attach/src/main.xc | 69 ++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 tests/test_device_attach/src/main.xc diff --git a/tests/test_device_attach/src/main.xc b/tests/test_device_attach/src/main.xc new file mode 100644 index 00000000..f7e53eb1 --- /dev/null +++ b/tests/test_device_attach/src/main.xc @@ -0,0 +1,69 @@ +// Copyright 2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. + +#include +#include +#include +#include "xud.h" +#include "platform.h" +#include "shared.h" + +#define XUD_EP_COUNT_OUT 5 +#define XUD_EP_COUNT_IN 5 + +#ifndef PKT_LENGTH_START +#define PKT_LENGTH_START 10 +#endif + +#ifndef PKT_LENGTH_END +#define PKT_LENGTH_END 11 +#endif + +#ifndef TEST_EP_NUM +#define TEST_EP_NUM 1 +#endif + +/* Endpoint type tables */ +XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; +XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; + +#ifdef XUD_SIM_RTL +int testmain() +#else +int main() +#endif +{ + chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + + par + { + { + #if defined(XUD_TEST_SPEED_FS) + unsigned speed = XUD_SPEED_FS; + #elif defined(XUD_TEST_SPEED_HS) + unsigned speed = XUD_SPEED_HS; + #else + #error XUD_TEST_SPEED_XX not defined + #endif + + XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + null, epTypeTableOut, epTypeTableIn, speed, XUD_PWR_BUS); + } + + { + unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); + + + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep0); + + if(fail) + TerminateFail(fail); + else + TerminatePass(fail); + + } + } + + return 0; +} From e4228c29f1aea3381d6d57b5c6b61d86532c37ed Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 7 Jun 2021 14:36:58 +0100 Subject: [PATCH 334/520] Makefile fix for test_iso_rxtx_fastpacket --- tests/test_iso_rxtx_fastpacket/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_iso_rxtx_fastpacket/Makefile b/tests/test_iso_rxtx_fastpacket/Makefile index 6aed3e76..a2c9ee98 100644 --- a/tests/test_iso_rxtx_fastpacket/Makefile +++ b/tests/test_iso_rxtx_fastpacket/Makefile @@ -1 +1,3 @@ +TEST_FLAGS = -DXUD_BYPASS_RESET=1 + include ../test_makefile.mak From dd1c80d5c57b284339572b1eb68c9818e6ef14b2 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 7 Jun 2021 16:32:11 +0100 Subject: [PATCH 335/520] Changelog tidy --- CHANGELOG.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 4b1e8d44..a02d0d36 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,8 +5,10 @@ lib_xud Change Log ----- * ADDED: Initial support for XS3A based devices - * ADDED: Requirement to define XUD_CORE_CLOCK with xcore core clock speed in MHz - * CHANGE: Removed support for XS1-G, and XS1-L (including U series) based devices + * ADDED: Requirement to define XUD_CORE_CLOCK with xcore core clock speed + in MHz + * CHANGE: Removed support for XS1-G, and XS1-L (including U series) based + devices * RESOLVED: Exception when Endpoint marked as disabled * CHANGE: Use common XN files for tests * CHANGE: Use XMOS Public Licence Version 1 From ec784a05c2c7686f360271a636350d6d9435dc33 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 7 Jun 2021 16:36:50 +0100 Subject: [PATCH 336/520] Fixed copyright comments --- tests/test_device_attach.py | 2 +- tests/test_device_attach/src/main.xc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_device_attach.py b/tests/test_device_attach.py index d7eaba13..fa8a5ea3 100644 --- a/tests/test_device_attach.py +++ b/tests/test_device_attach.py @@ -1,4 +1,4 @@ -# Copyright 2021 XMOS LIMITED. +# Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. #!/usr/bin/env python diff --git a/tests/test_device_attach/src/main.xc b/tests/test_device_attach/src/main.xc index f7e53eb1..0ff38feb 100644 --- a/tests/test_device_attach/src/main.xc +++ b/tests/test_device_attach/src/main.xc @@ -1,4 +1,4 @@ -// Copyright 2021 XMOS LIMITED. +// Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include From d958f316b1b86f9df8312926d4d992ccc5ba5f88 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 7 Jun 2021 16:51:51 +0100 Subject: [PATCH 337/520] Updates to documentation to pass checkers --- README.rst | 5 ++--- examples/AN00124_CDC_VCOM_class/README.rst | 2 -- examples/AN00124_CDC_VCOM_class/doc/rst/AN00124.rst | 2 ++ examples/AN00125_mass_storage_class/README.rst | 2 -- examples/AN00125_mass_storage_class/doc/rst/AN00125.rst | 2 ++ examples/AN00126_printer_class/README.rst | 4 ---- examples/AN00126_printer_class/doc/rst/AN00126.rst | 2 ++ examples/AN00127_video_class/README.rst | 2 -- examples/AN00127_video_class/doc/rst/AN00127.rst | 2 ++ examples/AN00129_hid_class/README.rst | 2 -- examples/AN00129_hid_class/doc/rst/AN00129.rst | 2 ++ examples/AN00131_CDC_EDC_class/README.rst | 2 -- examples/AN00131_CDC_EDC_class/doc/rst/AN00131.rst | 2 ++ examples/AN00132_image_class/README.rst | 2 -- examples/AN00132_image_class/doc/rst/AN00132.rst | 2 ++ examples/AN00135_test_and_measurement_class/README.rst | 2 -- .../AN00135_test_and_measurement_class/doc/rst/AN00135.rst | 2 ++ examples/AN00136_vendor_specific/README.rst | 2 -- examples/AN00136_vendor_specific/doc/rst/AN00136.rst | 2 ++ 19 files changed, 20 insertions(+), 23 deletions(-) diff --git a/README.rst b/README.rst index 92ed5ab4..21014643 100644 --- a/README.rst +++ b/README.rst @@ -30,15 +30,14 @@ Known Issues Software version and dependencies ................................. -.. libdeps:: +The CHANGELOG contains information about the current and previous versions. +For a list of direct dependencies, look for DEPENDENT_MODULES in lib_xud/module_build_info. Related application notes ......................... The following application notes use this library: -.. sidebysidelist:: - * AN00125 - USB mass storage device class * AN00126 - USB printer device class * AN00127 - USB video device class diff --git a/examples/AN00124_CDC_VCOM_class/README.rst b/examples/AN00124_CDC_VCOM_class/README.rst index 71597941..3ab6b165 100644 --- a/examples/AN00124_CDC_VCOM_class/README.rst +++ b/examples/AN00124_CDC_VCOM_class/README.rst @@ -1,8 +1,6 @@ USB CDC Class as Virtual Serial Port ==================================== -.. version:: 2.0.2 - Summary ------- diff --git a/examples/AN00124_CDC_VCOM_class/doc/rst/AN00124.rst b/examples/AN00124_CDC_VCOM_class/doc/rst/AN00124.rst index db4ac0f6..a622196e 100644 --- a/examples/AN00124_CDC_VCOM_class/doc/rst/AN00124.rst +++ b/examples/AN00124_CDC_VCOM_class/doc/rst/AN00124.rst @@ -1,3 +1,5 @@ +.. include:: ../../../../lib_xud/doc/rst/version.rst + .. include:: ../../README.rst |newpage| diff --git a/examples/AN00125_mass_storage_class/README.rst b/examples/AN00125_mass_storage_class/README.rst index 1b1714a6..333cd6d0 100644 --- a/examples/AN00125_mass_storage_class/README.rst +++ b/examples/AN00125_mass_storage_class/README.rst @@ -1,8 +1,6 @@ USB Mass Storage Device Class ============================= -.. version:: 2.0.2 - Summary ------- diff --git a/examples/AN00125_mass_storage_class/doc/rst/AN00125.rst b/examples/AN00125_mass_storage_class/doc/rst/AN00125.rst index 4aaf1bcb..b25ba611 100644 --- a/examples/AN00125_mass_storage_class/doc/rst/AN00125.rst +++ b/examples/AN00125_mass_storage_class/doc/rst/AN00125.rst @@ -1,3 +1,5 @@ +.. include:: ../../../../lib_xud/doc/rst/version.rst + .. include:: ../../README.rst |newpage| diff --git a/examples/AN00126_printer_class/README.rst b/examples/AN00126_printer_class/README.rst index 37fdff18..d20cf620 100755 --- a/examples/AN00126_printer_class/README.rst +++ b/examples/AN00126_printer_class/README.rst @@ -1,10 +1,6 @@ USB Printer Device Class ======================== -.. appnote:: AN00126 - -.. version:: 2.0.2 - Summary ------- diff --git a/examples/AN00126_printer_class/doc/rst/AN00126.rst b/examples/AN00126_printer_class/doc/rst/AN00126.rst index 08815090..91a5e1ee 100755 --- a/examples/AN00126_printer_class/doc/rst/AN00126.rst +++ b/examples/AN00126_printer_class/doc/rst/AN00126.rst @@ -1,3 +1,5 @@ +.. include:: ../../../../lib_xud/doc/rst/version.rst + .. include:: ../../README.rst |newpage| diff --git a/examples/AN00127_video_class/README.rst b/examples/AN00127_video_class/README.rst index bc8094d0..1b9b442a 100644 --- a/examples/AN00127_video_class/README.rst +++ b/examples/AN00127_video_class/README.rst @@ -1,8 +1,6 @@ USB Video Class Device ====================== -.. version:: 2.0.2 - Summary ------- diff --git a/examples/AN00127_video_class/doc/rst/AN00127.rst b/examples/AN00127_video_class/doc/rst/AN00127.rst index db7bab11..9d8fdfae 100644 --- a/examples/AN00127_video_class/doc/rst/AN00127.rst +++ b/examples/AN00127_video_class/doc/rst/AN00127.rst @@ -1,3 +1,5 @@ +.. include:: ../../../../lib_xud/doc/rst/version.rst + .. include:: ../../README.rst |newpage| diff --git a/examples/AN00129_hid_class/README.rst b/examples/AN00129_hid_class/README.rst index a17769a1..87d8f7a9 100644 --- a/examples/AN00129_hid_class/README.rst +++ b/examples/AN00129_hid_class/README.rst @@ -1,8 +1,6 @@ USB HID Class ============= -.. version:: 2.0.2 - Summary ------- diff --git a/examples/AN00129_hid_class/doc/rst/AN00129.rst b/examples/AN00129_hid_class/doc/rst/AN00129.rst index bede887a..fadec4df 100644 --- a/examples/AN00129_hid_class/doc/rst/AN00129.rst +++ b/examples/AN00129_hid_class/doc/rst/AN00129.rst @@ -1,3 +1,5 @@ +.. include:: ../../../../lib_xud/doc/rst/version.rst + .. include:: ../../README.rst |newpage| diff --git a/examples/AN00131_CDC_EDC_class/README.rst b/examples/AN00131_CDC_EDC_class/README.rst index d50eefb4..a3bc94ba 100644 --- a/examples/AN00131_CDC_EDC_class/README.rst +++ b/examples/AN00131_CDC_EDC_class/README.rst @@ -1,8 +1,6 @@ USB CDC-ECM Class for Ethernet over USB ======================================= -.. version:: 2.0.2 - Summary ------- diff --git a/examples/AN00131_CDC_EDC_class/doc/rst/AN00131.rst b/examples/AN00131_CDC_EDC_class/doc/rst/AN00131.rst index eedcd974..5be8cf7d 100644 --- a/examples/AN00131_CDC_EDC_class/doc/rst/AN00131.rst +++ b/examples/AN00131_CDC_EDC_class/doc/rst/AN00131.rst @@ -1,3 +1,5 @@ +.. include:: ../../../../lib_xud/doc/rst/version.rst + .. include:: ../../README.rst |newpage| diff --git a/examples/AN00132_image_class/README.rst b/examples/AN00132_image_class/README.rst index 3c7b8c68..c4790e96 100644 --- a/examples/AN00132_image_class/README.rst +++ b/examples/AN00132_image_class/README.rst @@ -1,8 +1,6 @@ USB Image Device Class ====================== -.. version:: 2.0.2 - Summary ------- diff --git a/examples/AN00132_image_class/doc/rst/AN00132.rst b/examples/AN00132_image_class/doc/rst/AN00132.rst index f5ee795f..4b2e6cae 100644 --- a/examples/AN00132_image_class/doc/rst/AN00132.rst +++ b/examples/AN00132_image_class/doc/rst/AN00132.rst @@ -1,3 +1,5 @@ +.. include:: ../../../../lib_xud/doc/rst/version.rst + .. include:: ../../README.rst |newpage| diff --git a/examples/AN00135_test_and_measurement_class/README.rst b/examples/AN00135_test_and_measurement_class/README.rst index ec702c14..a89cce0d 100644 --- a/examples/AN00135_test_and_measurement_class/README.rst +++ b/examples/AN00135_test_and_measurement_class/README.rst @@ -1,8 +1,6 @@ USB Test and Measurement Device =============================== -.. version:: 2.0.2 - Summary ------- diff --git a/examples/AN00135_test_and_measurement_class/doc/rst/AN00135.rst b/examples/AN00135_test_and_measurement_class/doc/rst/AN00135.rst index 053b811b..c9a5ed95 100644 --- a/examples/AN00135_test_and_measurement_class/doc/rst/AN00135.rst +++ b/examples/AN00135_test_and_measurement_class/doc/rst/AN00135.rst @@ -1,3 +1,5 @@ +.. include:: ../../../../lib_xud/doc/rst/version.rst + .. include:: ../../README.rst |newpage| diff --git a/examples/AN00136_vendor_specific/README.rst b/examples/AN00136_vendor_specific/README.rst index e5cc7205..fdf84fb4 100644 --- a/examples/AN00136_vendor_specific/README.rst +++ b/examples/AN00136_vendor_specific/README.rst @@ -1,8 +1,6 @@ USB Vendor Specific Device ========================== -.. version:: 2.1.2 - Summary ------- diff --git a/examples/AN00136_vendor_specific/doc/rst/AN00136.rst b/examples/AN00136_vendor_specific/doc/rst/AN00136.rst index c3583f75..989d11d4 100644 --- a/examples/AN00136_vendor_specific/doc/rst/AN00136.rst +++ b/examples/AN00136_vendor_specific/doc/rst/AN00136.rst @@ -1,3 +1,5 @@ +.. include:: ../../../../lib_xud/doc/rst/version.rst + .. include:: ../../README.rst |newpage| From 7f9b0864f4c14235ed7dee7b11351a1caad0db0a Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 7 Jun 2021 17:02:16 +0100 Subject: [PATCH 338/520] Added version.rst --- lib_xud/doc/rst/version.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 lib_xud/doc/rst/version.rst diff --git a/lib_xud/doc/rst/version.rst b/lib_xud/doc/rst/version.rst new file mode 100644 index 00000000..ecc91957 --- /dev/null +++ b/lib_xud/doc/rst/version.rst @@ -0,0 +1 @@ +.. version:: 2.0.0 From a9033d97668eb3a5d9f1d06f653ca3a4dd02fd1b Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 7 Jun 2021 17:06:25 +0100 Subject: [PATCH 339/520] Whitespace only --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a02d0d36..1332782f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -12,7 +12,7 @@ lib_xud Change Log * RESOLVED: Exception when Endpoint marked as disabled * CHANGE: Use common XN files for tests * CHANGE: Use XMOS Public Licence Version 1 - + 1.1.2 ----- From c5aa78e1808f79aa2f3a66cd2060a287a5a384d5 Mon Sep 17 00:00:00 2001 From: Kevin Yeung Date: Tue, 8 Jun 2021 18:05:25 +0800 Subject: [PATCH 340/520] add license and copyright --- tests/Pyxsim/pyxsim.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/Pyxsim/pyxsim.py b/tests/Pyxsim/pyxsim.py index c67108bf..e9306acc 100644 --- a/tests/Pyxsim/pyxsim.py +++ b/tests/Pyxsim/pyxsim.py @@ -1,7 +1,5 @@ -# Copyright (c) 2011-2021, XMOS Ltd, All rights reserved -# This software is freely distributable under a derivative of the -# University of Illinois/NCSA Open Source License posted in -# LICENSE.txt and at +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. import os, re, struct from ctypes import cdll, byref, c_void_p, c_char_p, c_int, create_string_buffer From ad40c6b897793841ae05c621c86a66e2a5a3c8c2 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 9 Jun 2021 09:19:33 +0100 Subject: [PATCH 341/520] Added missing STALL to USB_PIDS --- tests/usb_packet.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/usb_packet.py b/tests/usb_packet.py index 1c3b159c..a525e622 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -81,6 +81,7 @@ "PING": 0xB4, "RESERVED": 0x0F, "NAK": 0x5A, + "STALL": 0x1E, } From eadf5b1b7d4bc4081e28d0a2aa64de815f38edfe Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 9 Jun 2021 09:19:51 +0100 Subject: [PATCH 342/520] Added option to halt an EP in test framework --- tests/usb_transaction.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/usb_transaction.py b/tests/usb_transaction.py index 862ae6dd..b7cddd9f 100644 --- a/tests/usb_transaction.py +++ b/tests/usb_transaction.py @@ -33,6 +33,7 @@ def __init__( badDataCrc=False, resend=False, rxeAssertDelay_data=0, + halted = False ): # TODO Enums when we move to py3 self._deviceAddress = deviceAddress @@ -43,6 +44,7 @@ def __init__( self._bus_speed = bus_speed self._badDataCrc = badDataCrc self._rxeAssertDelay_data = rxeAssertDelay_data + seld._halted = halted assert endpointType in USB_EP_TYPES assert direction in USB_DIRECTIONS @@ -65,7 +67,7 @@ def __init__( ) # Don't toggle data pid if we had a bad data crc - if self._badDataCrc or self._rxeAssertDelay_data or endpointType == "ISO": + if self._badDataCrc or self._rxeAssertDelay_data or endpointType == "ISO" or halted: togglePid = False else: togglePid = True @@ -103,7 +105,10 @@ def __init__( ) if expectHandshake: - packets.append(RxHandshakePacket()) + if halted: + packets.append(RxHandshakePacket(pid = USB_PID['STALL')) + else: + packets.append(RxHandshakePacket()) self._packets.extend(packets) From 1b1abcf0ab9d8264a77354a7838c274ff6e4f64a Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 9 Jun 2021 09:20:09 +0100 Subject: [PATCH 343/520] Added initial stall test files --- tests/test_stall_basic.py | 59 +++++++++++++++++++++++++ tests/test_stall_basic/Makefile | 3 ++ tests/test_stall_basic/src/main.xc | 69 ++++++++++++++++++++++++++++++ 3 files changed, 131 insertions(+) create mode 100644 tests/test_stall_basic.py create mode 100644 tests/test_stall_basic/Makefile create mode 100644 tests/test_stall_basic/src/main.xc diff --git a/tests/test_stall_basic.py b/tests/test_stall_basic.py new file mode 100644 index 00000000..7f2475d7 --- /dev/null +++ b/tests/test_stall_basic.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python +# Copyright 2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. + +import xmostest +from usb_packet import * +import usb_packet +from helpers import do_usb_test, RunUsbTest +from usb_session import UsbSession +from usb_transaction import UsbTransaction +from usb_phy import USB_MAX_EP_ADDRESS + + +def do_test(arch, clk, phy, usb_speed, seed, verbose=False): + + stalled_eps_out = [0, 2, 4] + stalled_eps_in = [0, 1, 3] + max_ep = 4 + address = 1 + pktLenfth = 10 + + session = UsbSession( + bus_speed=usb_speed, run_enumeration=False, device_address=address + ) + + for ep in range(1): + + halted = False + if ep in stalled_eps_out: + halted = True + + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=pktLength, + halted = halted, + ) + ) + + do_usb_test( + arch, + clk, + phy, + usb_speed, + [session], + __file__, + seed, + level="smoke", + extra_tasks=[], + verbose=verbose, + ) + + +def runtest(): + RunUsbTest(do_test) diff --git a/tests/test_stall_basic/Makefile b/tests/test_stall_basic/Makefile new file mode 100644 index 00000000..a2c9ee98 --- /dev/null +++ b/tests/test_stall_basic/Makefile @@ -0,0 +1,3 @@ +TEST_FLAGS = -DXUD_BYPASS_RESET=1 + +include ../test_makefile.mak diff --git a/tests/test_stall_basic/src/main.xc b/tests/test_stall_basic/src/main.xc new file mode 100644 index 00000000..3dc9ea1a --- /dev/null +++ b/tests/test_stall_basic/src/main.xc @@ -0,0 +1,69 @@ +// Copyright 2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. + +#include +#include +#include +#include "xud.h" +#include "platform.h" +#include "shared.h" + +#define XUD_EP_COUNT_OUT 5 +#define XUD_EP_COUNT_IN 5 + +#ifndef PKT_LENGTH_START +#define PKT_LENGTH_START 10 +#endif + +#ifndef PKT_LENGTH_END +#define PKT_LENGTH_END 19 +#endif + +#ifndef TEST_EP_NUM +#define TEST_EP_NUM 1 +#endif + +/* Endpoint type tables */ +XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; +XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; + +#ifdef XUD_SIM_RTL +int testmain() +#else +int main() +#endif +{ + chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + + par + { + { + #if defined(XUD_TEST_SPEED_FS) + unsigned speed = XUD_SPEED_FS; + #elif defined(XUD_TEST_SPEED_HS) + unsigned speed = XUD_SPEED_HS; + #else + #error XUD_TEST_SPEED_XX not defined + #endif + + XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + null, epTypeTableOut, epTypeTableIn, speed, XUD_PWR_BUS); + } + + { + unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); + + + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep0); + + if(fail) + TerminateFail(fail); + else + TerminatePass(fail); + + } + } + + return 0; +} From b7e983cf16ba901efe0e1eca68aea430bc330035 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 9 Jun 2021 14:48:45 +0100 Subject: [PATCH 344/520] Basic stall test passing. Also some auto-formatting of test files via black. --- tests/shared_src/shared.h | 1 + tests/test_control_basic_get.py | 4 +-- tests/test_control_basic_set.py | 4 +-- tests/test_ping_rx_basic.py | 24 ++++--------- tests/test_stall_basic.py | 58 +++++++++++++++++++----------- tests/test_stall_basic/src/main.xc | 41 ++++++++++++++++----- tests/test_suspend_resume.py | 4 +-- tests/usb_packet.py | 2 +- tests/usb_signalling.py | 6 ++-- tests/usb_transaction.py | 13 ++++--- 10 files changed, 92 insertions(+), 65 deletions(-) diff --git a/tests/shared_src/shared.h b/tests/shared_src/shared.h index 7e101c72..b4eb49f3 100644 --- a/tests/shared_src/shared.h +++ b/tests/shared_src/shared.h @@ -4,6 +4,7 @@ #include #include #include +#include #include "xud.h" unsigned char g_rxDataCheck_[16] = {0}; diff --git a/tests/test_control_basic_get.py b/tests/test_control_basic_get.py index 5188e162..89f2438b 100644 --- a/tests/test_control_basic_get.py +++ b/tests/test_control_basic_get.py @@ -66,9 +66,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): endpoint=ep, ) ) - session.add_event( - TxDataPacket(length=0, pid=USB_PID["DATA1"]) - ) + session.add_event(TxDataPacket(length=0, pid=USB_PID["DATA1"])) session.add_event(RxHandshakePacket()) do_usb_test( diff --git a/tests/test_control_basic_set.py b/tests/test_control_basic_set.py index 75bc0993..6ff7960d 100644 --- a/tests/test_control_basic_set.py +++ b/tests/test_control_basic_set.py @@ -66,9 +66,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): endpoint=ep, ) ) - session.add_event( - RxDataPacket(dataPayload=[], pid=USB_PID["DATA1"]) - ) + session.add_event(RxDataPacket(dataPayload=[], pid=USB_PID["DATA1"])) session.add_event(TxHandshakePacket()) do_usb_test( diff --git a/tests/test_ping_rx_basic.py b/tests/test_ping_rx_basic.py index 0a14f149..a20d79c9 100644 --- a/tests/test_ping_rx_basic.py +++ b/tests/test_ping_rx_basic.py @@ -35,9 +35,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): endpoint=2, ) ) - session.add_event( - RxHandshakePacket(pid=USB_PID["NAK"]) - ) + session.add_event(RxHandshakePacket(pid=USB_PID["NAK"])) # And again session.add_event( @@ -47,9 +45,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): endpoint=2, ) ) - session.add_event( - RxHandshakePacket(pid=USB_PID["NAK"]) - ) + session.add_event(RxHandshakePacket(pid=USB_PID["NAK"])) # Send packet to EP 1, xCORE should mark EP 2 as ready session.add_event( @@ -72,9 +68,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): interEventDelay=6000, ) ) - session.add_event( - RxHandshakePacket(pid=USB_PID["ACK"]) - ) + session.add_event(RxHandshakePacket(pid=USB_PID["ACK"])) # And again.. session.add_event( @@ -85,9 +79,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): interEventDelay=6000, ) ) - session.add_event( - RxHandshakePacket(pid=USB_PID["ACK"]) - ) + session.add_event(RxHandshakePacket(pid=USB_PID["ACK"])) # Send out to EP 2.. expect ack session.add_event( @@ -110,9 +102,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): endpoint=2, ) ) - session.add_event( - RxHandshakePacket(pid=USB_PID["NAK"]) - ) + session.add_event(RxHandshakePacket(pid=USB_PID["NAK"])) # And again session.add_event( @@ -122,9 +112,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): endpoint=2, ) ) - session.add_event( - RxHandshakePacket(pid=USB_PID["NAK"]) - ) + session.add_event(RxHandshakePacket(pid=USB_PID["NAK"])) # Send a packet to EP 1 so the DUT knows it can exit. session.add_event( diff --git a/tests/test_stall_basic.py b/tests/test_stall_basic.py index 7f2475d7..255e6ab5 100644 --- a/tests/test_stall_basic.py +++ b/tests/test_stall_basic.py @@ -8,38 +8,54 @@ from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction -from usb_phy import USB_MAX_EP_ADDRESS def do_test(arch, clk, phy, usb_speed, seed, verbose=False): - stalled_eps_out = [0, 2, 4] - stalled_eps_in = [0, 1, 3] - max_ep = 4 address = 1 - pktLenfth = 10 + pktLength = 10 session = UsbSession( bus_speed=usb_speed, run_enumeration=False, device_address=address ) - for ep in range(1): - - halted = False - if ep in stalled_eps_out: - halted = True - - session.add_event( - UsbTransaction( - session, - deviceAddress=address, - endpointNumber=ep, - endpointType="BULK", - direction="OUT", - dataLength=pktLength, - halted = halted, - ) + ep_ctrl = 2 + ep = 1 + + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=pktLength, + halted=True, + ) + ) + + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=pktLength, + halted=True, ) + ) + + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep_ctrl, + endpointType="BULK", + direction="OUT", + dataLength=pktLength, + ) + ) do_usb_test( arch, diff --git a/tests/test_stall_basic/src/main.xc b/tests/test_stall_basic/src/main.xc index 3dc9ea1a..7ebf087b 100644 --- a/tests/test_stall_basic/src/main.xc +++ b/tests/test_stall_basic/src/main.xc @@ -20,13 +20,39 @@ #endif #ifndef TEST_EP_NUM -#define TEST_EP_NUM 1 +#define TEST_EP_NUM (1) #endif +#ifndef CTRL_EP_NUM +#define CTRL_EP_NUM (2) +#endif + + /* Endpoint type tables */ XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; + +unsigned TestEp_Stall(chanend c_ep_out[XUD_EP_COUNT_OUT], unsigned epNum) +{ + unsigned failed = 0; + uint8_t buffer[1024]; + unsigned length; + + /* Stall EP */ + XUD_ep ep = XUD_InitEp(c_ep_out[TEST_EP_NUM]); + XUD_SetStall(ep); + + XUD_ep ep_ctrl = XUD_InitEp(c_ep_out[CTRL_EP_NUM]); + + XUD_Result_t result = XUD_GetBuffer(ep_ctrl, buffer, length); + + failed = (result != XUD_RES_OKAY); + + return failed; +} + + #ifdef XUD_SIM_RTL int testmain() #else @@ -38,21 +64,20 @@ int main() par { { - #if defined(XUD_TEST_SPEED_FS) +#if defined(XUD_TEST_SPEED_FS) unsigned speed = XUD_SPEED_FS; - #elif defined(XUD_TEST_SPEED_HS) +#elif defined(XUD_TEST_SPEED_HS) unsigned speed = XUD_SPEED_HS; - #else - #error XUD_TEST_SPEED_XX not defined - #endif +#else +#error XUD_TEST_SPEED_XX not defined +#endif XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, speed, XUD_PWR_BUS); } { - unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); - + unsigned fail = TestEp_Stall(c_ep_out, TEST_EP_NUM); XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); XUD_Kill(ep0); diff --git a/tests/test_suspend_resume.py b/tests/test_suspend_resume.py index 299f454e..fc350123 100644 --- a/tests/test_suspend_resume.py +++ b/tests/test_suspend_resume.py @@ -43,9 +43,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): frameNumber = frameNumber + 1 pktLength = pktLength + 1 - session.add_event( - CreateSofToken(frameNumber, interEventDelay=2000) - ) + session.add_event(CreateSofToken(frameNumber, interEventDelay=2000)) session.add_event( UsbTransaction( session, diff --git a/tests/usb_packet.py b/tests/usb_packet.py index a525e622..69d53c16 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -81,7 +81,7 @@ "PING": 0xB4, "RESERVED": 0x0F, "NAK": 0x5A, - "STALL": 0x1E, + "STALL": 0x1E, } diff --git a/tests/usb_signalling.py b/tests/usb_signalling.py index 330bb1cf..0ec304d8 100644 --- a/tests/usb_signalling.py +++ b/tests/usb_signalling.py @@ -13,12 +13,12 @@ def __str__(self): return "DeviceAttach" def expected_output(self, bus_speed, offset=0): - + expected = self.__str__() + "\nDUT entered FS\nReceived upstream chirp\n" if bus_speed == "HS": expected += "DUT entered HS mode\n" - + return expected @property @@ -173,8 +173,6 @@ def drive(self, usb_phy, bus_speed): wait(lambda x: usb_phy._clock.is_low()) - - class UsbResume(UsbEvent): def __init__(self, duration=USB_TIMINGS["RESUME_FSK_MIN_US"], interEventDelay=0): self._duration = duration diff --git a/tests/usb_transaction.py b/tests/usb_transaction.py index b7cddd9f..c3aa68af 100644 --- a/tests/usb_transaction.py +++ b/tests/usb_transaction.py @@ -33,7 +33,7 @@ def __init__( badDataCrc=False, resend=False, rxeAssertDelay_data=0, - halted = False + halted=False, ): # TODO Enums when we move to py3 self._deviceAddress = deviceAddress @@ -44,7 +44,7 @@ def __init__( self._bus_speed = bus_speed self._badDataCrc = badDataCrc self._rxeAssertDelay_data = rxeAssertDelay_data - seld._halted = halted + self._halted = halted assert endpointType in USB_EP_TYPES assert direction in USB_DIRECTIONS @@ -67,7 +67,12 @@ def __init__( ) # Don't toggle data pid if we had a bad data crc - if self._badDataCrc or self._rxeAssertDelay_data or endpointType == "ISO" or halted: + if ( + self._badDataCrc + or self._rxeAssertDelay_data + or endpointType == "ISO" + or halted + ): togglePid = False else: togglePid = True @@ -106,7 +111,7 @@ def __init__( if expectHandshake: if halted: - packets.append(RxHandshakePacket(pid = USB_PID['STALL')) + packets.append(RxHandshakePacket(pid=USB_PID["STALL"])) else: packets.append(RxHandshakePacket()) From 09620fdebc3e2d0f7ca74c30766aed42cdc92c2d Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 9 Jun 2021 14:58:15 +0100 Subject: [PATCH 345/520] Stall test renamed. Added additional stall test. --- ...t_stall_basic.py => test_stall_epready.py} | 0 tests/test_stall_out_basic.py | 75 ++++++++++++++ .../Makefile | 0 .../src/main.xc | 0 tests/test_stall_out_epready/Makefile | 3 + tests/test_stall_out_epready/src/main.xc | 97 +++++++++++++++++++ 6 files changed, 175 insertions(+) rename tests/{test_stall_basic.py => test_stall_epready.py} (100%) create mode 100644 tests/test_stall_out_basic.py rename tests/{test_stall_basic => test_stall_out_basic}/Makefile (100%) rename tests/{test_stall_basic => test_stall_out_basic}/src/main.xc (100%) create mode 100644 tests/test_stall_out_epready/Makefile create mode 100644 tests/test_stall_out_epready/src/main.xc diff --git a/tests/test_stall_basic.py b/tests/test_stall_epready.py similarity index 100% rename from tests/test_stall_basic.py rename to tests/test_stall_epready.py diff --git a/tests/test_stall_out_basic.py b/tests/test_stall_out_basic.py new file mode 100644 index 00000000..d53ac8f8 --- /dev/null +++ b/tests/test_stall_out_basic.py @@ -0,0 +1,75 @@ +#!/usr/bin/env python +# Copyright 2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. + +import xmostest +from usb_packet import * +import usb_packet +from helpers import do_usb_test, RunUsbTest +from usb_session import UsbSession +from usb_transaction import UsbTransaction + + +def do_test(arch, clk, phy, usb_speed, seed, verbose=False): + + address = 1 + pktLength = 10 + + session = UsbSession( + bus_speed=usb_speed, run_enumeration=False, device_address=address + ) + + ep_ctrl = 3 + ep = 2 + + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=pktLength, + halted=True, + ) + ) + + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=pktLength, + halted=True, + ) + ) + + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep_ctrl, + endpointType="BULK", + direction="OUT", + dataLength=pktLength, + ) + ) + + do_usb_test( + arch, + clk, + phy, + usb_speed, + [session], + __file__, + seed, + level="smoke", + extra_tasks=[], + verbose=verbose, + ) + + +def runtest(): + RunUsbTest(do_test) diff --git a/tests/test_stall_basic/Makefile b/tests/test_stall_out_basic/Makefile similarity index 100% rename from tests/test_stall_basic/Makefile rename to tests/test_stall_out_basic/Makefile diff --git a/tests/test_stall_basic/src/main.xc b/tests/test_stall_out_basic/src/main.xc similarity index 100% rename from tests/test_stall_basic/src/main.xc rename to tests/test_stall_out_basic/src/main.xc diff --git a/tests/test_stall_out_epready/Makefile b/tests/test_stall_out_epready/Makefile new file mode 100644 index 00000000..a2c9ee98 --- /dev/null +++ b/tests/test_stall_out_epready/Makefile @@ -0,0 +1,3 @@ +TEST_FLAGS = -DXUD_BYPASS_RESET=1 + +include ../test_makefile.mak diff --git a/tests/test_stall_out_epready/src/main.xc b/tests/test_stall_out_epready/src/main.xc new file mode 100644 index 00000000..0e8aa5b8 --- /dev/null +++ b/tests/test_stall_out_epready/src/main.xc @@ -0,0 +1,97 @@ +// Copyright 2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. + +#include +#include +#include +#include "xud.h" +#include "platform.h" +#include "shared.h" + +#define XUD_EP_COUNT_OUT 5 +#define XUD_EP_COUNT_IN 5 + +#ifndef PKT_LENGTH_START +#define PKT_LENGTH_START 10 +#endif + +#ifndef PKT_LENGTH_END +#define PKT_LENGTH_END 19 +#endif + +#ifndef TEST_EP_NUM +#define TEST_EP_NUM (2) +#endif + +#ifndef CTRL_EP_NUM +#define CTRL_EP_NUM (3) +#endif + + +/* Endpoint type tables */ +XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; +XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; + + +unsigned TestEp_Stall(chanend c_ep_out[XUD_EP_COUNT_OUT], unsigned epNum) +{ + unsigned failed = 0; + uint8_t buffer[1024]; + unsigned length; + + /* Stall EP */ + XUD_ep ep = XUD_InitEp(c_ep_out[TEST_EP_NUM]); + XUD_SetStall(ep); + + /* EP marked ready, XUD should still STALL */ + XUD_Result_t result0 = XUD_GetBuffer(ep, buffer, length); + + XUD_ep ep_ctrl = XUD_InitEp(c_ep_out[CTRL_EP_NUM]); + + XUD_Result_t result1 = XUD_GetBuffer(ep_ctrl, buffer, length); + + failed = (result0 != XUD_RES_OKAY) | (result1 != XUD_RES_OKAY); + + return failed; +} + + +#ifdef XUD_SIM_RTL +int testmain() +#else +int main() +#endif +{ + chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + + par + { + { +#if defined(XUD_TEST_SPEED_FS) + unsigned speed = XUD_SPEED_FS; +#elif defined(XUD_TEST_SPEED_HS) + unsigned speed = XUD_SPEED_HS; +#else +#error XUD_TEST_SPEED_XX not defined +#endif + + XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + null, epTypeTableOut, epTypeTableIn, speed, XUD_PWR_BUS); + } + + { + unsigned fail = TestEp_Stall(c_ep_out, TEST_EP_NUM); + + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep0); + + if(fail) + TerminateFail(fail); + else + TerminatePass(fail); + + } + } + + return 0; +} From 16e81a13d60bbe7afa013ac16bc64d9d70536c80 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 9 Jun 2021 15:10:28 +0100 Subject: [PATCH 346/520] Added IN ep to basic stall test (and renamed appropriately) --- ...stall_out_basic.py => test_stall_basic.py} | 26 +++++++++++++++++-- .../Makefile | 0 .../src/main.xc | 13 ++++++---- tests/usb_transaction.py | 13 ++++++---- 4 files changed, 40 insertions(+), 12 deletions(-) rename tests/{test_stall_out_basic.py => test_stall_basic.py} (75%) rename tests/{test_stall_out_basic => test_stall_basic}/Makefile (100%) rename tests/{test_stall_out_basic => test_stall_basic}/src/main.xc (84%) diff --git a/tests/test_stall_out_basic.py b/tests/test_stall_basic.py similarity index 75% rename from tests/test_stall_out_basic.py rename to tests/test_stall_basic.py index d53ac8f8..42d95b97 100644 --- a/tests/test_stall_out_basic.py +++ b/tests/test_stall_basic.py @@ -19,8 +19,8 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): bus_speed=usb_speed, run_enumeration=False, device_address=address ) - ep_ctrl = 3 - ep = 2 + ep_ctrl = 2 + ep = 1 session.add_event( UsbTransaction( @@ -46,6 +46,28 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) ) + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="IN", + halted=True, + ) + ) + + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="IN", + halted=True, + ) + ) + session.add_event( UsbTransaction( session, diff --git a/tests/test_stall_out_basic/Makefile b/tests/test_stall_basic/Makefile similarity index 100% rename from tests/test_stall_out_basic/Makefile rename to tests/test_stall_basic/Makefile diff --git a/tests/test_stall_out_basic/src/main.xc b/tests/test_stall_basic/src/main.xc similarity index 84% rename from tests/test_stall_out_basic/src/main.xc rename to tests/test_stall_basic/src/main.xc index 7ebf087b..3cb1b20d 100644 --- a/tests/test_stall_out_basic/src/main.xc +++ b/tests/test_stall_basic/src/main.xc @@ -33,15 +33,18 @@ XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, X XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -unsigned TestEp_Stall(chanend c_ep_out[XUD_EP_COUNT_OUT], unsigned epNum) +unsigned TestEp_Stall(chanend c_ep_out[XUD_EP_COUNT_OUT], chanend c_ep_in[XUD_EP_COUNT_IN]) { unsigned failed = 0; uint8_t buffer[1024]; unsigned length; - /* Stall EP */ - XUD_ep ep = XUD_InitEp(c_ep_out[TEST_EP_NUM]); - XUD_SetStall(ep); + /* Stall EPs */ + XUD_ep ep_out = XUD_InitEp(c_ep_out[TEST_EP_NUM]); + XUD_SetStall(ep_out); + + XUD_ep ep_in = XUD_InitEp(c_ep_in[TEST_EP_NUM]); + XUD_SetStall(ep_in); XUD_ep ep_ctrl = XUD_InitEp(c_ep_out[CTRL_EP_NUM]); @@ -77,7 +80,7 @@ int main() } { - unsigned fail = TestEp_Stall(c_ep_out, TEST_EP_NUM); + unsigned fail = TestEp_Stall(c_ep_out, c_ep_in); XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); XUD_Kill(ep0); diff --git a/tests/usb_transaction.py b/tests/usb_transaction.py index c3aa68af..1e2992e2 100644 --- a/tests/usb_transaction.py +++ b/tests/usb_transaction.py @@ -129,9 +129,6 @@ def __init__( ) ) - # Generate packet data payload - packetPayload = session.getPayload_in(endpointNumber, dataLength) - if ( self._badDataCrc or self._rxeAssertDelay_data @@ -144,11 +141,17 @@ def __init__( pid = session.data_pid_in(endpointNumber, togglePid=togglePid) # Add data packet to packets list - self._packets.append(RxDataPacket(pid=pid, dataPayload=packetPayload)) + if not halted: + # Generate packet data payload + packetPayload = session.getPayload_in(endpointNumber, dataLength) + self._packets.append(RxDataPacket(pid=pid, dataPayload=packetPayload)) - if self._endpointType != "ISO": + if self._endpointType != "ISO" and not halted: self._packets.append(TxHandshakePacket()) + if halted: + self._packets.append(RxHandshakePacket(pid=USB_PID["STALL"])) + super(UsbTransaction, self).__init__( time=eventTime, interEventDelay=interEventDelay ) From 9aa89cc4c2ab129102731e978ec9cb6799cf105e Mon Sep 17 00:00:00 2001 From: mbanth Date: Wed, 9 Jun 2021 16:08:26 +0100 Subject: [PATCH 347/520] Remove build warnings --- lib_xud/src/core/XUD_DeviceAttach.xc | 2 ++ lib_xud/src/core/XUD_HAL.xc | 4 ++++ lib_xud/src/core/XUD_Signalling.xc | 10 +++------- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib_xud/src/core/XUD_DeviceAttach.xc b/lib_xud/src/core/XUD_DeviceAttach.xc index a3d064dc..85143181 100755 --- a/lib_xud/src/core/XUD_DeviceAttach.xc +++ b/lib_xud/src/core/XUD_DeviceAttach.xc @@ -149,5 +149,7 @@ int XUD_DeviceAttachHS(XUD_PwrConfig pwrConfig) break; } } + + return -1; } #endif diff --git a/lib_xud/src/core/XUD_HAL.xc b/lib_xud/src/core/XUD_HAL.xc index f8bf7055..1d231c4e 100644 --- a/lib_xud/src/core/XUD_HAL.xc +++ b/lib_xud/src/core/XUD_HAL.xc @@ -43,6 +43,8 @@ unsigned XtlSelFromMhz(unsigned m) while(1); break; } + + return 0b000; } #endif @@ -340,6 +342,7 @@ XUD_LineState_t XUD_HAL_GetLineState(/*XUD_HAL_t &xudHal*/) if(se0) return XUD_LINESTATE_SE0; + return XUD_LINESTATE_SE1; #endif } @@ -375,6 +378,7 @@ unsigned XUD_HAL_WaitForLineStateChange(XUD_LineState_t ¤tLs, unsigned tim return 0; #else #warning TODO for XS2A + return 1; #endif } diff --git a/lib_xud/src/core/XUD_Signalling.xc b/lib_xud/src/core/XUD_Signalling.xc index acbfca91..d6d8dc84 100755 --- a/lib_xud/src/core/XUD_Signalling.xc +++ b/lib_xud/src/core/XUD_Signalling.xc @@ -40,9 +40,6 @@ extern unsigned g_curSpeed; int XUD_Init() { - timer SE0_timer; - unsigned SE0_start_time = 0; - /* Wait for host */ while (1) { @@ -82,6 +79,9 @@ int XUD_Init() } #else + timer SE0_timer; + unsigned SE0_start_time = 0; + select { /* SE0 State */ @@ -129,8 +129,6 @@ int XUD_Suspend(XUD_PwrConfig pwrConfig) timer t; unsigned time; - unsigned rdata = 0; - while (1) { t :> time; @@ -222,8 +220,6 @@ int XUD_Suspend(XUD_PwrConfig pwrConfig) timer t; unsigned time; - unsigned reset = 0; - XUD_LineState_t currentLs = XUD_LINESTATE_J; while(1) From 5bd9857355fd572eb540985c14cff57afd27f860 Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Thu, 10 Jun 2021 11:03:40 +0100 Subject: [PATCH 348/520] Update XUD_DeviceAttach.xc --- lib_xud/src/core/XUD_DeviceAttach.xc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xud/src/core/XUD_DeviceAttach.xc b/lib_xud/src/core/XUD_DeviceAttach.xc index 85143181..3648eb67 100755 --- a/lib_xud/src/core/XUD_DeviceAttach.xc +++ b/lib_xud/src/core/XUD_DeviceAttach.xc @@ -149,7 +149,7 @@ int XUD_DeviceAttachHS(XUD_PwrConfig pwrConfig) break; } } - + // Unreachable return -1; } #endif From 3847b6361464fca659489a1fa2a68c3d2e58c2c2 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 10 Jun 2021 14:10:22 +0100 Subject: [PATCH 349/520] Basic STALL test passing --- tests/test_stall_basic.py | 25 +++++++++++++++++++++++++ tests/test_stall_basic/src/main.xc | 24 +++++++++++++++++------- 2 files changed, 42 insertions(+), 7 deletions(-) diff --git a/tests/test_stall_basic.py b/tests/test_stall_basic.py index 42d95b97..1f3e058d 100644 --- a/tests/test_stall_basic.py +++ b/tests/test_stall_basic.py @@ -22,6 +22,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ep_ctrl = 2 ep = 1 + # Expect test EP's to be halted session.add_event( UsbTransaction( session, @@ -68,6 +69,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) ) + # Valid transaction to another EP informing test code to clear stall session.add_event( UsbTransaction( session, @@ -79,6 +81,29 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) ) + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=pktLength, + interEventDelay=1000, + ) + ) + + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="IN", + dataLength=pktLength, + ) + ) + do_usb_test( arch, clk, diff --git a/tests/test_stall_basic/src/main.xc b/tests/test_stall_basic/src/main.xc index 3cb1b20d..bb0566c1 100644 --- a/tests/test_stall_basic/src/main.xc +++ b/tests/test_stall_basic/src/main.xc @@ -15,10 +15,6 @@ #define PKT_LENGTH_START 10 #endif -#ifndef PKT_LENGTH_END -#define PKT_LENGTH_END 19 -#endif - #ifndef TEST_EP_NUM #define TEST_EP_NUM (1) #endif @@ -36,8 +32,13 @@ XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, X unsigned TestEp_Stall(chanend c_ep_out[XUD_EP_COUNT_OUT], chanend c_ep_in[XUD_EP_COUNT_IN]) { unsigned failed = 0; - uint8_t buffer[1024]; + uint8_t outBuffer[128]; + uint8_t inBuffer[128]; unsigned length; + XUD_Result_t result; + + for(size_t i = 0; i < sizeof(outBuffer); i++) + inBuffer[i] = i; /* Stall EPs */ XUD_ep ep_out = XUD_InitEp(c_ep_out[TEST_EP_NUM]); @@ -48,9 +49,18 @@ unsigned TestEp_Stall(chanend c_ep_out[XUD_EP_COUNT_OUT], chanend c_ep_in[XUD_EP XUD_ep ep_ctrl = XUD_InitEp(c_ep_out[CTRL_EP_NUM]); - XUD_Result_t result = XUD_GetBuffer(ep_ctrl, buffer, length); - + /* Valid transaction on another EP, clear STALL on the test EP's */ + result = XUD_GetBuffer(ep_ctrl, outBuffer, length); failed = (result != XUD_RES_OKAY); + + XUD_ClearStall(ep_out); + XUD_ClearStall(ep_in); + + result = XUD_GetBuffer(ep_out, outBuffer, length); + failed |= (result != XUD_RES_OKAY); + + result = XUD_SetBuffer(ep_in, inBuffer, PKT_LENGTH_START); + failed |= (result != XUD_RES_OKAY); return failed; } From 080135afae902b7bef3b98e46ed9656ad498e53f Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 10 Jun 2021 14:11:43 +0100 Subject: [PATCH 350/520] Comment only --- tests/test_stall_basic/src/main.xc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_stall_basic/src/main.xc b/tests/test_stall_basic/src/main.xc index bb0566c1..0fb0c6b4 100644 --- a/tests/test_stall_basic/src/main.xc +++ b/tests/test_stall_basic/src/main.xc @@ -52,10 +52,12 @@ unsigned TestEp_Stall(chanend c_ep_out[XUD_EP_COUNT_OUT], chanend c_ep_in[XUD_EP /* Valid transaction on another EP, clear STALL on the test EP's */ result = XUD_GetBuffer(ep_ctrl, outBuffer, length); failed = (result != XUD_RES_OKAY); - + + /* Clear stall on the test EP's */ XUD_ClearStall(ep_out); XUD_ClearStall(ep_in); + /* Ensure test EP's now operate as expected */ result = XUD_GetBuffer(ep_out, outBuffer, length); failed |= (result != XUD_RES_OKAY); From 6ce82d2c573a70c9bdf8111b92af7cd344b606c5 Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 11 Jun 2021 10:00:29 +0100 Subject: [PATCH 351/520] Added test_stall_epready (currently fails) --- tests/test_stall_epready.py | 46 +++++++++++ tests/test_stall_epready/Makefile | 3 + tests/test_stall_epready/src/main.xc | 110 +++++++++++++++++++++++++++ 3 files changed, 159 insertions(+) create mode 100644 tests/test_stall_epready/Makefile create mode 100644 tests/test_stall_epready/src/main.xc diff --git a/tests/test_stall_epready.py b/tests/test_stall_epready.py index 255e6ab5..dad0b228 100644 --- a/tests/test_stall_epready.py +++ b/tests/test_stall_epready.py @@ -2,6 +2,8 @@ # Copyright 2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. +# Directed test for (github) issue #58 + import xmostest from usb_packet import * import usb_packet @@ -22,6 +24,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ep_ctrl = 2 ep = 1 + # Expect test EP's to be halted session.add_event( UsbTransaction( session, @@ -47,6 +50,28 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="IN", + halted=True, + ) + ) + + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="IN", + halted=True, + ) + ) + + session.add_event( UsbTransaction( session, deviceAddress=address, @@ -55,6 +80,27 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): direction="OUT", dataLength=pktLength, ) + + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=pktLength, + ) + + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="IN", + dataLength=pktLength, + ) + ) do_usb_test( diff --git a/tests/test_stall_epready/Makefile b/tests/test_stall_epready/Makefile new file mode 100644 index 00000000..a2c9ee98 --- /dev/null +++ b/tests/test_stall_epready/Makefile @@ -0,0 +1,3 @@ +TEST_FLAGS = -DXUD_BYPASS_RESET=1 + +include ../test_makefile.mak diff --git a/tests/test_stall_epready/src/main.xc b/tests/test_stall_epready/src/main.xc new file mode 100644 index 00000000..e3a5d3a6 --- /dev/null +++ b/tests/test_stall_epready/src/main.xc @@ -0,0 +1,110 @@ +// Copyright 2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. + +#include +#include +#include +#include "xud.h" +#include "platform.h" +#include "shared.h" + +#define XUD_EP_COUNT_OUT 5 +#define XUD_EP_COUNT_IN 5 + +#ifndef PKT_LENGTH_START +#define PKT_LENGTH_START 10 +#endif + +#ifndef TEST_EP_NUM +#define TEST_EP_NUM (1) +#endif + +#ifndef CTRL_EP_NUM +#define CTRL_EP_NUM (2) +#endif + + +/* Endpoint type tables */ +XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; +XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; + + +unsigned TestEp_Stall(chanend c_ep_out[XUD_EP_COUNT_OUT], chanend c_ep_in[XUD_EP_COUNT_IN]) +{ + unsigned failed = 0; + uint8_t outBuffer[128]; + uint8_t ctrlBuffer[128]; + uint8_t inBuffer[128]; + unsigned length; + XUD_Result_t result; + + for(size_t i = 0; i < sizeof(outBuffer); i++) + inBuffer[i] = i; + + XUD_ep ep_ctrl = XUD_InitEp(c_ep_out[CTRL_EP_NUM]); + + XUD_ep ep_out = XUD_InitEp(c_ep_out[TEST_EP_NUM]); + XUD_SetStall(ep_out); + + XUD_SetReady_Out(ep_out, outBuffer); + XUD_SetReady_Out(ep_ctrl, ctrlBuffer); + + unsigned loop = 1; + while(loop) + { + select + { + case XUD_GetData_Select(c_ep_out[TEST_EP_NUM], ep_out, length, result): + loop = 0; + break; + + case XUD_GetData_Select(c_ep_out[CTRL_EP_NUM], ep_ctrl, length, result): + XUD_ClearStall(ep_out); + break; + } + failed |= (result != XUD_RES_OKAY); + } + + return failed; +} + + +#ifdef XUD_SIM_RTL +int testmain() +#else +int main() +#endif +{ + chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + + par + { + { +#if defined(XUD_TEST_SPEED_FS) + unsigned speed = XUD_SPEED_FS; +#elif defined(XUD_TEST_SPEED_HS) + unsigned speed = XUD_SPEED_HS; +#else +#error XUD_TEST_SPEED_XX not defined +#endif + + XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + null, epTypeTableOut, epTypeTableIn, speed, XUD_PWR_BUS); + } + + { + unsigned fail = TestEp_Stall(c_ep_out, c_ep_in); + + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep0); + + if(fail) + TerminateFail(fail); + else + TerminatePass(fail); + + } + } + + return 0; +} From c4a239c6b63108c3a2ed603899d7a61770dc1c3c Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 14 Jun 2021 11:34:45 +0100 Subject: [PATCH 352/520] Fix indent issue in test_stall_epready --- tests/test_stall_epready.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_stall_epready.py b/tests/test_stall_epready.py index dad0b228..7aef5263 100644 --- a/tests/test_stall_epready.py +++ b/tests/test_stall_epready.py @@ -71,7 +71,8 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) ) - session.add_event( + # Inform DUT to un halt EP's + session.add_event( UsbTransaction( session, deviceAddress=address, @@ -81,6 +82,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): dataLength=pktLength, ) + # Expect normal transactions session.add_event( UsbTransaction( session, From e4dd3b6bb123e7df3c2032a3f4a87b99c7b1159a Mon Sep 17 00:00:00 2001 From: Kevin Yeung Date: Tue, 15 Jun 2021 15:47:35 +0800 Subject: [PATCH 353/520] fixed missing bracket --- tests/test_stall_epready.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_stall_epready.py b/tests/test_stall_epready.py index 7aef5263..8f9970ff 100644 --- a/tests/test_stall_epready.py +++ b/tests/test_stall_epready.py @@ -81,6 +81,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): direction="OUT", dataLength=pktLength, ) + ) # Expect normal transactions session.add_event( @@ -92,6 +93,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): direction="OUT", dataLength=pktLength, ) + ) session.add_event( UsbTransaction( From ac63cf0096ed95b2dee7c3dbb1ea9a65553edcf0 Mon Sep 17 00:00:00 2001 From: Kevin Yeung Date: Tue, 15 Jun 2021 17:02:09 +0800 Subject: [PATCH 354/520] changes for feature/test_stall --- tests/Pyxsim/__init__.py | 5 ++++- tests/test_stall_basic.py | 9 ++++----- tests/test_stall_epready.py | 9 ++++----- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/tests/Pyxsim/__init__.py b/tests/Pyxsim/__init__.py index 6cd0de35..8c29abad 100644 --- a/tests/Pyxsim/__init__.py +++ b/tests/Pyxsim/__init__.py @@ -111,7 +111,10 @@ def run_tester(caps, tester_list): index for index, element in enumerate(caps) if element.strip() == "Test done" ] result = [] - if len(separate_word) > 1: + if not separate_word: + for test in tester_list: + result.append(test.run(caps)) + elif len(separate_word) > 1: i = 0 start = 0 stop = 0 diff --git a/tests/test_stall_basic.py b/tests/test_stall_basic.py index 1f3e058d..5feebf77 100644 --- a/tests/test_stall_basic.py +++ b/tests/test_stall_basic.py @@ -1,8 +1,6 @@ #!/usr/bin/env python # Copyright 2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. - -import xmostest from usb_packet import * import usb_packet from helpers import do_usb_test, RunUsbTest @@ -104,7 +102,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) ) - do_usb_test( + return do_usb_test( arch, clk, phy, @@ -118,5 +116,6 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) -def runtest(): - RunUsbTest(do_test) +def test_stall_basic(): + for result in RunUsbTest(do_test): + assert result diff --git a/tests/test_stall_epready.py b/tests/test_stall_epready.py index 8f9970ff..c5727629 100644 --- a/tests/test_stall_epready.py +++ b/tests/test_stall_epready.py @@ -3,8 +3,6 @@ # This Software is subject to the terms of the XMOS Public Licence: Version 1. # Directed test for (github) issue #58 - -import xmostest from usb_packet import * import usb_packet from helpers import do_usb_test, RunUsbTest @@ -107,7 +105,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) - do_usb_test( + return do_usb_test( arch, clk, phy, @@ -121,5 +119,6 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) -def runtest(): - RunUsbTest(do_test) +def test_stall_epready(): + for result in RunUsbTest(do_test): + assert result From d85863a6d89b75d2cf4ea25be4966fb595b20c88 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 15 Jun 2021 12:17:15 +0100 Subject: [PATCH 355/520] Test tidies --- tests/test_control_basic_get/src/main.xc | 3 +-- tests/test_control_basic_set/src/main.xc | 4 +--- tests/test_control_repeatedsetup/src/main.xc | 2 +- tests/test_iso_tx_basic/src/main.xc | 17 ++++++++++++++--- tests/test_stall_epready.py | 3 ++- tests/usb_packet.py | 9 +++++---- tests/usb_phy.py | 8 +++++++- tests/usb_signalling.py | 2 +- 8 files changed, 32 insertions(+), 16 deletions(-) diff --git a/tests/test_control_basic_get/src/main.xc b/tests/test_control_basic_get/src/main.xc index 6724df8c..a3139b00 100644 --- a/tests/test_control_basic_get/src/main.xc +++ b/tests/test_control_basic_get/src/main.xc @@ -12,7 +12,6 @@ #include #include "xud.h" #include "platform.h" -#include "xc_ptr.h" #include "shared.h" #define XUD_EP_COUNT_OUT 5 @@ -78,7 +77,7 @@ int main() par { - XUD_Manager(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); diff --git a/tests/test_control_basic_set/src/main.xc b/tests/test_control_basic_set/src/main.xc index f2960459..5c9f8694 100644 --- a/tests/test_control_basic_set/src/main.xc +++ b/tests/test_control_basic_set/src/main.xc @@ -12,7 +12,6 @@ #include #include "xud.h" #include "platform.h" -#include "xc_ptr.h" #include "shared.h" #define XUD_EP_COUNT_OUT 5 @@ -22,7 +21,6 @@ XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; - /* Out EP Should receive some data, perform some test process (crc or similar) to check okay */ /* Answers should be responded to in the IN ep */ @@ -84,7 +82,7 @@ int main() par { - XUD_Manager( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); diff --git a/tests/test_control_repeatedsetup/src/main.xc b/tests/test_control_repeatedsetup/src/main.xc index af070c7a..baa95519 100644 --- a/tests/test_control_repeatedsetup/src/main.xc +++ b/tests/test_control_repeatedsetup/src/main.xc @@ -128,7 +128,7 @@ int main() par { - XUD_Manager( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); diff --git a/tests/test_iso_tx_basic/src/main.xc b/tests/test_iso_tx_basic/src/main.xc index 87d85f0e..8043ffca 100644 --- a/tests/test_iso_tx_basic/src/main.xc +++ b/tests/test_iso_tx_basic/src/main.xc @@ -14,9 +14,13 @@ #include "platform.h" #include "shared.h" +#ifndef XUD_EP_COUNT_OUT +#define XUD_EP_COUNT_OUT (4) +#endif -#define XUD_EP_COUNT_OUT 4 -#define XUD_EP_COUNT_IN 4 +#ifndef XUD_EP_COUNT_IN +#define XUD_EP_COUNT_IN (4) +#endif /* Endpoint type tables */ XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, @@ -31,6 +35,7 @@ XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, int main() { chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + chan c_dummy[DUMMY_THREAD_COUNT]; par { @@ -43,8 +48,14 @@ int main() TestEp_Tx(c_ep_in[3], 3, 10, 14, RUNMODE_DIE); XUD_ep ep_out_0 = XUD_InitEp(c_ep_out[0]); XUD_Kill(ep_out_0); - exit(0); + + for(size_t i = 0; i Date: Tue, 15 Jun 2021 12:17:38 +0100 Subject: [PATCH 356/520] Added dummy threads to iso_tx_basic --- tests/shared_src/shared.h | 29 ++++++++++++-- tests/test_control_basic_get/src/xc_ptr.h | 48 ----------------------- tests/test_iso_rx_basic/src/main.xc | 5 +++ tests/test_iso_tx_basic.py | 1 + 4 files changed, 31 insertions(+), 52 deletions(-) delete mode 100644 tests/test_control_basic_get/src/xc_ptr.h diff --git a/tests/shared_src/shared.h b/tests/shared_src/shared.h index b4eb49f3..eaa06a12 100644 --- a/tests/shared_src/shared.h +++ b/tests/shared_src/shared.h @@ -60,18 +60,20 @@ void TerminatePass(unsigned x) #endif #ifndef PKT_LEN_START -#define PKT_LEN_START 10 +#define PKT_LEN_START (10) #endif #ifndef PKT_LEN_END -#define PKT_LEN_END 21 +#define PKT_LEN_END (21) #endif #ifndef MAX_PKT_COUNT -#define MAX_PKT_COUNT (50) +#define MAX_PKT_COUNT (50) #endif -#define XUD_Manager XUD_Main +#ifndef DUMMY_THEAD_COUNT +#define DUMMY_THREAD_COUNT (4) +#endif typedef enum t_runMode { @@ -196,3 +198,22 @@ int TestEp_Rx(chanend c_out, int epNum, int start, int end) return 0; } +void dummyThread(chanend c) +{ + set_core_fast_mode_on(); + + while(1) + { + inuint(c); + break; + } +} + +void dummyThreads(chanend c[]) +{ + par(size_t i = 0; i < DUMMY_THREAD_COUNT; i++) + { + dummyThread(c[i]); + } +} + diff --git a/tests/test_control_basic_get/src/xc_ptr.h b/tests/test_control_basic_get/src/xc_ptr.h deleted file mode 100644 index 8fa5a04e..00000000 --- a/tests/test_control_basic_get/src/xc_ptr.h +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2016-2021 XMOS LIMITED. -// This Software is subject to the terms of the XMOS Public Licence: Version 1. -#ifndef __xc_ptr__ -#define __xc_ptr__ - -typedef unsigned int xc_ptr; - -// Note that this function is marked as const to avoid the XC -// parallel usage checks, this is only really going to work if this -// is the *only* way the array a is accessed (and everything else uses -// the xc_ptr) -inline xc_ptr array_to_xc_ptr(const unsigned a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -inline xc_ptr char_array_to_xc_ptr(const unsigned char a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -#define write_via_xc_ptr_indexed(p,i,x) asm volatile("stw %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_short_via_xc_ptr_indexed(p,i,x) asm volatile("st16 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) - -#define write_via_xc_ptr(p,x) asm volatile("stw %0, %1[0]"::"r"(x),"r"(p)) -// No immediate st8 format -#define write_byte_via_xc_ptr(p,x) write_byte_via_xc_ptr_indexed(p, 0, x) -#define write_short_via_xc_ptr(p,x) write_short_via_xc_ptr_indexed(p, 0, x) - -#define read_via_xc_ptr_indexed(x,p,i) asm("ldw %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_byte_via_xc_ptr_indexed(x,p,i) asm("ld8u %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_short_via_xc_ptr_indexed(x,p,i) asm("ld16s %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); - -#define read_via_xc_ptr(x,p) asm("ldw %0, %1[0]":"=r"(x):"r"(p)); -// No immediate ld8u format -#define read_byte_via_xc_ptr(x,p) read_byte_via_xc_ptr_indexed(x, p, 0) -#define read_short_via_xc_ptr(x,p) read_short_via_xc_ptr_indexed(x, p, 0) - -#define GET_SHARED_GLOBAL(x, g) asm volatile("ldw %0, dp[" #g "]":"=r"(x)::"memory") -#define SET_SHARED_GLOBAL(g, v) asm volatile("stw %0, dp[" #g "]"::"r"(v):"memory") - -#endif diff --git a/tests/test_iso_rx_basic/src/main.xc b/tests/test_iso_rx_basic/src/main.xc index 3d4839fc..6a7496af 100644 --- a/tests/test_iso_rx_basic/src/main.xc +++ b/tests/test_iso_rx_basic/src/main.xc @@ -22,6 +22,7 @@ #define TEST_EP_NUM 2 #endif + /* Endpoint type tables */ XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, @@ -35,6 +36,7 @@ int main() #endif { chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + chan c_dummy[DUMMY_THREAD_COUNT]; par { @@ -64,6 +66,9 @@ int main() TerminatePass(fail); } + + dummyThreads(c_dummy); + } return 0; diff --git a/tests/test_iso_tx_basic.py b/tests/test_iso_tx_basic.py index 61dce2b3..09f65484 100644 --- a/tests/test_iso_tx_basic.py +++ b/tests/test_iso_tx_basic.py @@ -30,6 +30,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) ) + phy.initial_delay = 100000 do_usb_test( arch, clk, From 7563ba8f045debebe754797e63bd9e9f2c065c7c Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 15 Jun 2021 14:17:15 +0100 Subject: [PATCH 357/520] Fixed import --- tests/usb_signalling.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/usb_signalling.py b/tests/usb_signalling.py index 2ced735b..0ec304d8 100644 --- a/tests/usb_signalling.py +++ b/tests/usb_signalling.py @@ -2,7 +2,7 @@ # This Software is subject to the terms of the XMOS Public Licence: Version 1. from usb_event import UsbEvent -from usb_phy import USB_LINESTATE, USB_TIMINGS_SHORT +from usb_phy import USB_LINESTATE, USB_TIMINGS class UsbDeviceAttach(UsbEvent): From 7f0f1b9cf5ce0f59a34388b6aacb82efd716e6a9 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 15 Jun 2021 14:21:04 +0100 Subject: [PATCH 358/520] Python formatting only --- tests/usb_packet.py | 8 +++++--- tests/usb_phy.py | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/usb_packet.py b/tests/usb_packet.py index 42094ee1..8a9b50d4 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -65,7 +65,7 @@ USB_DATA_VALID_COUNT = {"FS": 39, "HS": 0} # In USB clocks -#RX_TX_DELAY = 20 +# RX_TX_DELAY = 20 RXA_END_DELAY = 2 # Pad delay not currently simulated in xsim for USB or OTP, so add this delay here RXA_START_DELAY = 5 # Taken from RTL sim @@ -246,7 +246,9 @@ def get_pid_str(self): # Rx to host i.e. xCORE Tx class RxPacket(UsbPacket): def __init__(self, **kwargs): - self._timeout = kwargs.pop("timeout", usb_phy.USB_PKT_TIMINGS["TX_TO_RX_PACKET_TIMEOUT"]) + self._timeout = kwargs.pop( + "timeout", usb_phy.USB_PKT_TIMINGS["TX_TO_RX_PACKET_TIMEOUT"] + ) super(RxPacket, self).__init__(**kwargs) @property @@ -577,7 +579,7 @@ def __init__(self, **kwargs): self.pid = kwargs.pop( "pid", 0xD2 ) # Default to ACK (not expect inverted bits on Rx) - #self._timeout = kwargs.pop("timeout", RX_TX_DELAY) # TODO handled by Super() + # self._timeout = kwargs.pop("timeout", RX_TX_DELAY) # TODO handled by Super() def __str__(self): return ( diff --git a/tests/usb_phy.py b/tests/usb_phy.py index 90388a53..604841e2 100644 --- a/tests/usb_phy.py +++ b/tests/usb_phy.py @@ -52,13 +52,14 @@ USB_PKT_TIMINGS_TIGHT = { - "TX_TO_RX_PACKET_TIMEOUT": 14, # Timeout between sending DUT a packet and the expected response (in USB clocks). This is SIE decision time in UTMI spec + "TX_TO_RX_PACKET_TIMEOUT": 14, # Timeout between sending DUT a packet and the expected response (in USB clocks). This is SIE decision time in UTMI spec } USB_TIMINGS = USB_TIMINGS_SHORT USB_PKT_TIMINGS = USB_PKT_TIMINGS_TIGHT + class UsbPhy(xmostest.SimThread): # Time in ns from the last packet being sent until the end of test is signalled to the DUT From 3231bec33d3aa7d4c2ca9a44dbe9f123fe6ee60f Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 15 Jun 2021 15:14:30 +0100 Subject: [PATCH 359/520] Remove old test and fixed copyright comments --- tests/test_stall_basic.py | 2 +- tests/test_stall_basic/src/main.xc | 2 +- tests/test_stall_epready.py | 2 +- tests/test_stall_epready/src/main.xc | 2 +- tests/test_stall_out_epready/Makefile | 3 - tests/test_stall_out_epready/src/main.xc | 97 ------------------------ tests/usb_packet.py | 13 ++-- 7 files changed, 11 insertions(+), 110 deletions(-) delete mode 100644 tests/test_stall_out_epready/Makefile delete mode 100644 tests/test_stall_out_epready/src/main.xc diff --git a/tests/test_stall_basic.py b/tests/test_stall_basic.py index 1f3e058d..985ed1f1 100644 --- a/tests/test_stall_basic.py +++ b/tests/test_stall_basic.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2021 XMOS LIMITED. +# Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. import xmostest diff --git a/tests/test_stall_basic/src/main.xc b/tests/test_stall_basic/src/main.xc index 0fb0c6b4..94ace7f5 100644 --- a/tests/test_stall_basic/src/main.xc +++ b/tests/test_stall_basic/src/main.xc @@ -1,4 +1,4 @@ -// Copyright 2021 XMOS LIMITED. +// Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include diff --git a/tests/test_stall_epready.py b/tests/test_stall_epready.py index 65da69a8..9df2f464 100644 --- a/tests/test_stall_epready.py +++ b/tests/test_stall_epready.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2021 XMOS LIMITED. +# Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. # Directed test for (github) issue #58 diff --git a/tests/test_stall_epready/src/main.xc b/tests/test_stall_epready/src/main.xc index e3a5d3a6..4b4c77c5 100644 --- a/tests/test_stall_epready/src/main.xc +++ b/tests/test_stall_epready/src/main.xc @@ -1,4 +1,4 @@ -// Copyright 2021 XMOS LIMITED. +// Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include diff --git a/tests/test_stall_out_epready/Makefile b/tests/test_stall_out_epready/Makefile deleted file mode 100644 index a2c9ee98..00000000 --- a/tests/test_stall_out_epready/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -TEST_FLAGS = -DXUD_BYPASS_RESET=1 - -include ../test_makefile.mak diff --git a/tests/test_stall_out_epready/src/main.xc b/tests/test_stall_out_epready/src/main.xc deleted file mode 100644 index 0e8aa5b8..00000000 --- a/tests/test_stall_out_epready/src/main.xc +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2021 XMOS LIMITED. -// This Software is subject to the terms of the XMOS Public Licence: Version 1. - -#include -#include -#include -#include "xud.h" -#include "platform.h" -#include "shared.h" - -#define XUD_EP_COUNT_OUT 5 -#define XUD_EP_COUNT_IN 5 - -#ifndef PKT_LENGTH_START -#define PKT_LENGTH_START 10 -#endif - -#ifndef PKT_LENGTH_END -#define PKT_LENGTH_END 19 -#endif - -#ifndef TEST_EP_NUM -#define TEST_EP_NUM (2) -#endif - -#ifndef CTRL_EP_NUM -#define CTRL_EP_NUM (3) -#endif - - -/* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; - - -unsigned TestEp_Stall(chanend c_ep_out[XUD_EP_COUNT_OUT], unsigned epNum) -{ - unsigned failed = 0; - uint8_t buffer[1024]; - unsigned length; - - /* Stall EP */ - XUD_ep ep = XUD_InitEp(c_ep_out[TEST_EP_NUM]); - XUD_SetStall(ep); - - /* EP marked ready, XUD should still STALL */ - XUD_Result_t result0 = XUD_GetBuffer(ep, buffer, length); - - XUD_ep ep_ctrl = XUD_InitEp(c_ep_out[CTRL_EP_NUM]); - - XUD_Result_t result1 = XUD_GetBuffer(ep_ctrl, buffer, length); - - failed = (result0 != XUD_RES_OKAY) | (result1 != XUD_RES_OKAY); - - return failed; -} - - -#ifdef XUD_SIM_RTL -int testmain() -#else -int main() -#endif -{ - chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - - par - { - { -#if defined(XUD_TEST_SPEED_FS) - unsigned speed = XUD_SPEED_FS; -#elif defined(XUD_TEST_SPEED_HS) - unsigned speed = XUD_SPEED_HS; -#else -#error XUD_TEST_SPEED_XX not defined -#endif - - XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, speed, XUD_PWR_BUS); - } - - { - unsigned fail = TestEp_Stall(c_ep_out, TEST_EP_NUM); - - XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); - XUD_Kill(ep0); - - if(fail) - TerminateFail(fail); - else - TerminatePass(fail); - - } - } - - return 0; -} diff --git a/tests/usb_packet.py b/tests/usb_packet.py index 8a9b50d4..beec150c 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -68,21 +68,22 @@ # RX_TX_DELAY = 20 RXA_END_DELAY = 2 # Pad delay not currently simulated in xsim for USB or OTP, so add this delay here RXA_START_DELAY = 5 # Taken from RTL sim +# RX_RX_DELAY = 40 # TODO shoud we have a PID class? # TODO remove the inverted check bits USB_PID = { "OUT": 0xE1, - "IN": 0x69, - "SETUP": 0x2D, - "SOF": 0xA5, - "DATA1": 0x4B, - "DATA0": 0xC3, "ACK": 0xD2, + "DATA0": 0xC3, "PING": 0xB4, - "RESERVED": 0x0F, + "SOF": 0xA5, + "DATA1": 0x4B, + "IN": 0x69, "NAK": 0x5A, + "SETUP": 0x2D, "STALL": 0x1E, + "RESERVED": 0x0F, } From 098f90aff0d0a3d4c56bc80cb4a66068a0601728 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 15 Jun 2021 17:48:53 +0100 Subject: [PATCH 360/520] Added func for waiting for USB clocks. Tightened up for timing constraints. Fixed resulting test fails --- tests/test_bulk_rx_basic_nodata.py | 7 ++++++- tests/test_bulk_tx_badack.py | 2 +- tests/test_bulk_tx_noack.py | 2 +- tests/test_control_basic_get.py | 5 ++--- tests/test_control_basic_set.py | 5 ++--- tests/usb_event.py | 5 +++-- tests/usb_packet.py | 12 ++++++++---- tests/usb_phy.py | 9 +++++++++ 8 files changed, 32 insertions(+), 15 deletions(-) diff --git a/tests/test_bulk_rx_basic_nodata.py b/tests/test_bulk_rx_basic_nodata.py index 375fb780..8b2cf17d 100644 --- a/tests/test_bulk_rx_basic_nodata.py +++ b/tests/test_bulk_rx_basic_nodata.py @@ -39,7 +39,12 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): # Simulate missing data payload if length == 11: session.add_event( - TokenPacket(endpoint=ep, address=address, pid=USB_PID["OUT"]) + TokenPacket( + endpoint=ep, + address=address, + pid=USB_PID["OUT"], + interEventDelay=ied, + ) ) do_usb_test( diff --git a/tests/test_bulk_tx_badack.py b/tests/test_bulk_tx_badack.py index 9745595a..f7e8ecbc 100644 --- a/tests/test_bulk_tx_badack.py +++ b/tests/test_bulk_tx_badack.py @@ -27,7 +27,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): pid=USB_PID["IN"], address=address, endpoint=ep, - inter_pkt_gap=ied, + interEventDelay=ied, ) ) session.add_event( diff --git a/tests/test_bulk_tx_noack.py b/tests/test_bulk_tx_noack.py index f0fd1331..533ba938 100644 --- a/tests/test_bulk_tx_noack.py +++ b/tests/test_bulk_tx_noack.py @@ -28,7 +28,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): pid=USB_PID["IN"], address=address, endpoint=ep, - inter_pkt_gap=ied, + interEventDelay=ied, ) ) session.add_event( diff --git a/tests/test_control_basic_get.py b/tests/test_control_basic_get.py index 89f2438b..03691693 100644 --- a/tests/test_control_basic_get.py +++ b/tests/test_control_basic_get.py @@ -19,6 +19,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ep = 0 address = 1 + ied = 500 session = UsbSession( bus_speed=usb_speed, run_enumeration=False, device_address=address @@ -61,9 +62,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): # Send 0 length OUT transaction session.add_event( TokenPacket( - pid=USB_PID["OUT"], - address=address, - endpoint=ep, + pid=USB_PID["OUT"], address=address, endpoint=ep, interEventDelay=ied ) ) session.add_event(TxDataPacket(length=0, pid=USB_PID["DATA1"])) diff --git a/tests/test_control_basic_set.py b/tests/test_control_basic_set.py index 6ff7960d..9149955b 100644 --- a/tests/test_control_basic_set.py +++ b/tests/test_control_basic_set.py @@ -19,6 +19,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ep = 0 address = 1 + ied = 500 session = UsbSession( bus_speed=usb_speed, run_enumeration=False, device_address=address @@ -61,9 +62,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): # Expect 0 length IN transaction session.add_event( TokenPacket( - pid=USB_PID["IN"], - address=address, - endpoint=ep, + pid=USB_PID["IN"], address=address, endpoint=ep, interEventDelay=ied ) ) session.add_event(RxDataPacket(dataPayload=[], pid=USB_PID["DATA1"])) diff --git a/tests/usb_event.py b/tests/usb_event.py index 85bc24d8..f445eb91 100644 --- a/tests/usb_event.py +++ b/tests/usb_event.py @@ -4,7 +4,7 @@ class UsbEvent(ABC): - def __init__(self, time=0, interEventDelay=1): # TODO set delay to sensible default + def __init__(self, time=0, interEventDelay=None): self._time = time self._interEventDelay = interEventDelay @@ -13,6 +13,7 @@ def __init__(self, time=0, interEventDelay=1): # TODO set delay to sensible def def time(self): return self._time + # NOTE: its not always sensible for an event to used the IED - for example an Rx Packet @property def interEventDelay(self): return self._interEventDelay @@ -32,4 +33,4 @@ def event_count(self): pass def __str__(self): - return "UsbEvent IED: " + str(self.interEventDelay) + return "UsbEvent: IED: " + str(self.interEventDelay) diff --git a/tests/usb_packet.py b/tests/usb_packet.py index beec150c..fd8945b2 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -227,7 +227,7 @@ def __init__(self, **kwargs): self.data_bytes = kwargs.pop("data_bytes", None) self.num_data_bytes = kwargs.pop("length", 0) self.bad_crc = kwargs.pop("bad_crc", False) - ied = kwargs.pop("interEventDelay", 500) # TODO RM magic number + ied = kwargs.pop("interEventDelay", None) super(UsbPacket, self).__init__(interEventDelay=ied) @property @@ -335,7 +335,11 @@ def __init__(self, **kwargs): self.rxa_end_delay = kwargs.pop("rxa_end_delay", RXA_END_DELAY) self.rxe_assert_time = kwargs.pop("rxe_assert_time", 0) self.rxe_assert_length = kwargs.pop("rxe_assert_length", 1) - super(TxPacket, self).__init__(**kwargs) + + ied = kwargs.pop( + "interEventDelay", usb_phy.USB_PKT_TIMINGS["TX_TO_TX_PACKET_DELAY"] + ) + super(TxPacket, self).__init__(**kwargs, interEventDelay=ied) def expected_output(self, bus_speed, offset=0): expected_output = "Packet:\tHOST -> DEVICE\n" @@ -353,7 +357,7 @@ def drive(self, usb_phy, bus_speed, verbose=True): rxv_count = USB_DATA_VALID_COUNT[bus_speed] - usb_phy.wait_until(xsi.get_time() + self.interEventDelay) + usb_phy.wait_for_clocks(self.interEventDelay) print( "Packet:\tHOST -> DEVICE\n\tPID: {0} ({1:#x})".format( @@ -505,7 +509,7 @@ def __init__(self, **kwargs): def __str__(self): return ( super(DataPacket, self).__str__() - + ": RX DataPacket: " + + ": TX DataPacket: " + super(DataPacket, self).get_pid_str() + " " + str(self.data_bytes) diff --git a/tests/usb_phy.py b/tests/usb_phy.py index 604841e2..3cb09545 100644 --- a/tests/usb_phy.py +++ b/tests/usb_phy.py @@ -53,6 +53,7 @@ USB_PKT_TIMINGS_TIGHT = { "TX_TO_RX_PACKET_TIMEOUT": 14, # Timeout between sending DUT a packet and the expected response (in USB clocks). This is SIE decision time in UTMI spec + "TX_TO_TX_PACKET_DELAY": 4, # Delay between transmitting two packets } @@ -189,6 +190,14 @@ def set_clock(self, clock): def drive_error(self, value): self.xsi.drive_port_pins(self._rxer, value) + def wait_for_clocks(self, clockCount): + + delay = clockCount + while delay >= 0: + self.wait(lambda x: self._clock.is_high()) + self.wait(lambda x: self._clock.is_low()) + delay = delay - 1 + def run(self): xsi = self.xsi From 912d00c0b43472938ba4dcd831f10cd22cb81823 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 15 Jun 2021 21:31:30 +0100 Subject: [PATCH 361/520] Fixes to test_stall_epready --- tests/test_stall_epready.py | 1 + tests/test_stall_epready/src/main.xc | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/tests/test_stall_epready.py b/tests/test_stall_epready.py index 9df2f464..0a77211e 100644 --- a/tests/test_stall_epready.py +++ b/tests/test_stall_epready.py @@ -84,6 +84,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) # Expect normal transactions + # DUT will exit after one normal transaction per EP. session.add_event( UsbTransaction( session, diff --git a/tests/test_stall_epready/src/main.xc b/tests/test_stall_epready/src/main.xc index 4b4c77c5..7bb931ba 100644 --- a/tests/test_stall_epready/src/main.xc +++ b/tests/test_stall_epready/src/main.xc @@ -44,22 +44,31 @@ unsigned TestEp_Stall(chanend c_ep_out[XUD_EP_COUNT_OUT], chanend c_ep_in[XUD_EP XUD_ep ep_ctrl = XUD_InitEp(c_ep_out[CTRL_EP_NUM]); XUD_ep ep_out = XUD_InitEp(c_ep_out[TEST_EP_NUM]); + XUD_ep ep_in = XUD_InitEp(c_ep_in[TEST_EP_NUM]); XUD_SetStall(ep_out); + XUD_SetStall(ep_in); XUD_SetReady_Out(ep_out, outBuffer); + XUD_SetReady_In(ep_in, inBuffer, PKT_LENGTH_START); XUD_SetReady_Out(ep_ctrl, ctrlBuffer); - unsigned loop = 1; - while(loop) + unsigned loop0 = 1; + unsigned loop1 = 1; + while(loop0 | loop1) { select { case XUD_GetData_Select(c_ep_out[TEST_EP_NUM], ep_out, length, result): - loop = 0; + loop0 = 0; break; case XUD_GetData_Select(c_ep_out[CTRL_EP_NUM], ep_ctrl, length, result): XUD_ClearStall(ep_out); + XUD_ClearStall(ep_in); + break; + + case XUD_SetData_Select(c_ep_in[TEST_EP_NUM], ep_in, result): + loop1 = 0; break; } failed |= (result != XUD_RES_OKAY); From e75234265f5eb4a311320384d806c220692739a6 Mon Sep 17 00:00:00 2001 From: Kevin Yeung Date: Wed, 16 Jun 2021 15:09:35 +0800 Subject: [PATCH 362/520] improve tester --- tests/Pyxsim/__init__.py | 29 ++++------------------------- tests/helpers.py | 11 ++++++----- tests/usb_phy.py | 1 - 3 files changed, 10 insertions(+), 31 deletions(-) diff --git a/tests/Pyxsim/__init__.py b/tests/Pyxsim/__init__.py index 8c29abad..94e96c68 100644 --- a/tests/Pyxsim/__init__.py +++ b/tests/Pyxsim/__init__.py @@ -107,32 +107,11 @@ def run_with_pyxsim( def run_tester(caps, tester_list): - separate_word = [ - index for index, element in enumerate(caps) if element.strip() == "Test done" - ] result = [] - if not separate_word: - for test in tester_list: - result.append(test.run(caps)) - elif len(separate_word) > 1: - i = 0 - start = 0 - stop = 0 - while i < len(separate_word): - if i == 0: - stop = separate_word[i] + 1 - else: - start = separate_word[i - 1] + 1 - stop = separate_word[i] + 1 - re_cap = caps[start:stop] - if tester_list[i] != "Build Failed": - result.append(tester_list[i].run(re_cap)) - else: - result.append(False) - i += 1 - else: - if tester_list[0] != "Build Failed": - result.append(tester_list[0].run(caps[: separate_word[0] + 1])) + for i, ele in enumerate(caps): + ele.remove("") + if tester_list[i] != "Build Failed": + result.append(tester_list[i].run(ele)) else: result.append(False) return result diff --git a/tests/helpers.py b/tests/helpers.py index c2697ae3..698d68fa 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -124,16 +124,16 @@ def run_on(**kwargs): def RunUsbTest(test_fn): tester_list = [] + output = [] testname, extension = os.path.splitext(os.path.basename(__file__)) seed = random.randint(0, sys.maxsize) - start_cap = Pyxsim.cap_redirect() - for _arch in ARCHITECTURE_CHOICES: for _busspeed in BUSSPEED_CHOICES: if run_on(arch=_arch): if run_on(busspeed=_busspeed): (clk_60, usb_phy) = get_usb_clk_phy(verbose=False, arch=_arch) + start_cap = Pyxsim.cap_redirect() tester_list.extend( test_fn( _arch, @@ -143,9 +143,10 @@ def RunUsbTest(test_fn): seed, ) ) - output = start_cap.read_output() - start_cap.close_capture() - output = output.split("\n") + cap_output = start_cap.read_output() + start_cap.close_capture() + output.append(cap_output.split("\n")) + sys.stdout.write("\n") return Pyxsim.run_tester(output, tester_list) diff --git a/tests/usb_phy.py b/tests/usb_phy.py index 3cb09545..a517ec14 100644 --- a/tests/usb_phy.py +++ b/tests/usb_phy.py @@ -4,7 +4,6 @@ import xmostest import sys import zlib -from usb_packet import RxPacket, TokenPacket, USB_PID import usb_packet USB_MAX_EP_ADDRESS = 15 From 6c45297af2ad2ec7cea0c7b1d999ab596f83843a Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 16 Jun 2021 11:14:40 +0100 Subject: [PATCH 363/520] Added test_ping_stall --- tests/test_ping_stall.py | 95 ++++++++++++++++++++++++++++++ tests/test_ping_stall/Makefile | 3 + tests/test_ping_stall/src/main.xc | 98 +++++++++++++++++++++++++++++++ 3 files changed, 196 insertions(+) create mode 100644 tests/test_ping_stall.py create mode 100644 tests/test_ping_stall/Makefile create mode 100644 tests/test_ping_stall/src/main.xc diff --git a/tests/test_ping_stall.py b/tests/test_ping_stall.py new file mode 100644 index 00000000..ee1dcca3 --- /dev/null +++ b/tests/test_ping_stall.py @@ -0,0 +1,95 @@ +#!/usr/bin/env python +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. + +import xmostest +from usb_packet import * +import usb_packet +from helpers import do_usb_test, RunUsbTest +from usb_session import UsbSession +from usb_transaction import UsbTransaction + + +def do_test(arch, clk, phy, usb_speed, seed, verbose=False): + + address = 1 + pktLength = 10 + + session = UsbSession( + bus_speed=usb_speed, run_enumeration=False, device_address=address + ) + + ep_ctrl = 2 + ep = 1 + + # Ping EP, expect stall + session.add_event( + TokenPacket( + pid=USB_PID["PING"], + address=address, + endpoint=ep, + ) + ) + session.add_event(RxHandshakePacket(pid=USB_PID["STALL"])) + + # And again + session.add_event( + TokenPacket( + pid=USB_PID["PING"], + address=address, + endpoint=ep, + ) + ) + session.add_event(RxHandshakePacket(pid=USB_PID["STALL"])) + + # Valid transaction to another EP informing test code to clear stall + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep_ctrl, + endpointType="BULK", + direction="OUT", + dataLength=pktLength, + ) + ) + + # Expect normal transactions + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=pktLength, + ) + ) + + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=pktLength, + ) + ) + + do_usb_test( + arch, + clk, + phy, + usb_speed, + [session], + __file__, + seed, + level="smoke", + extra_tasks=[], + verbose=verbose, + ) + + +def runtest(): + RunUsbTest(do_test) diff --git a/tests/test_ping_stall/Makefile b/tests/test_ping_stall/Makefile new file mode 100644 index 00000000..a2c9ee98 --- /dev/null +++ b/tests/test_ping_stall/Makefile @@ -0,0 +1,3 @@ +TEST_FLAGS = -DXUD_BYPASS_RESET=1 + +include ../test_makefile.mak diff --git a/tests/test_ping_stall/src/main.xc b/tests/test_ping_stall/src/main.xc new file mode 100644 index 00000000..3d9f6607 --- /dev/null +++ b/tests/test_ping_stall/src/main.xc @@ -0,0 +1,98 @@ +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. + +#include +#include +#include +#include "xud.h" +#include "platform.h" +#include "shared.h" + +#define XUD_EP_COUNT_OUT 5 +#define XUD_EP_COUNT_IN 5 + +#ifndef PKT_LENGTH_START +#define PKT_LENGTH_START 10 +#endif + +#ifndef TEST_EP_NUM +#define TEST_EP_NUM (1) +#endif + +#ifndef CTRL_EP_NUM +#define CTRL_EP_NUM (2) +#endif + +/* Endpoint type tables */ +XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; +XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; + +unsigned TestEp_Stall(chanend c_ep_out[XUD_EP_COUNT_OUT], chanend c_ep_in[XUD_EP_COUNT_IN]) +{ + unsigned failed = 0; + uint8_t outBuffer[128]; + unsigned length; + XUD_Result_t result; + + /* Stall test EP */ + XUD_ep ep_out = XUD_InitEp(c_ep_out[TEST_EP_NUM]); + XUD_SetStall(ep_out); + + XUD_ep ep_ctrl = XUD_InitEp(c_ep_out[CTRL_EP_NUM]); + + /* Valid transaction on another EP, clear STALL on the test EP's */ + result = XUD_GetBuffer(ep_ctrl, outBuffer, length); + failed = (result != XUD_RES_OKAY); + + /* Clear stall on the test EP's */ + XUD_ClearStall(ep_out); + + /* Ensure test EP's now operate as expected */ + result = XUD_GetBuffer(ep_out, outBuffer, length); + failed |= (result != XUD_RES_OKAY); + + result = XUD_GetBuffer(ep_out, outBuffer, length); + failed |= (result != XUD_RES_OKAY); + + return failed; +} + +#ifdef XUD_SIM_RTL +int testmain() +#else +int main() +#endif +{ + chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + + par + { + { +#if defined(XUD_TEST_SPEED_FS) + unsigned speed = XUD_SPEED_FS; +#elif defined(XUD_TEST_SPEED_HS) + unsigned speed = XUD_SPEED_HS; +#else +#error XUD_TEST_SPEED_XX not defined +#endif + + XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + null, epTypeTableOut, epTypeTableIn, speed, XUD_PWR_BUS); + } + + { + unsigned fail = TestEp_Stall(c_ep_out, c_ep_in); + + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep0); + + if(fail) + TerminateFail(fail); + else + TerminatePass(fail); + + } + } + + return 0; +} From e2b6e73cfd966e64057ab43d05bd931b13e1c2d9 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 16 Jun 2021 11:24:52 +0100 Subject: [PATCH 364/520] Removed old commented out constants --- tests/usb_packet.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/usb_packet.py b/tests/usb_packet.py index fd8945b2..eecf93b3 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -65,10 +65,8 @@ USB_DATA_VALID_COUNT = {"FS": 39, "HS": 0} # In USB clocks -# RX_TX_DELAY = 20 RXA_END_DELAY = 2 # Pad delay not currently simulated in xsim for USB or OTP, so add this delay here RXA_START_DELAY = 5 # Taken from RTL sim -# RX_RX_DELAY = 40 # TODO shoud we have a PID class? # TODO remove the inverted check bits From ac3c742b4931eeea3c61a1702817074bfa9a7247 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 17 Jun 2021 11:51:50 +0100 Subject: [PATCH 365/520] Updated test_bulk_rx_basic for basic purest --- tests/test_bulk_rx_basic.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_bulk_rx_basic.py b/tests/test_bulk_rx_basic.py index 2a851752..18056520 100644 --- a/tests/test_bulk_rx_basic.py +++ b/tests/test_bulk_rx_basic.py @@ -6,7 +6,7 @@ from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction - +import pytest def do_test(arch, clk, phy, usb_speed, seed, verbose=False): @@ -44,7 +44,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): verbose=verbose, ) - +@pytest.mark.bulk def test_bulk_rx_basic(): for result in RunUsbTest(do_test): assert result From 37bf9e5433d45fc269c499090793bc04070c82a4 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 17 Jun 2021 12:00:21 +0100 Subject: [PATCH 366/520] Remove old app_test dir --- __app_test/.cproject | 524 ----------------------------------------- __app_test/.project | 76 ------ __app_test/.xproject | 1 - __app_test/LICENSE.rst | 84 ------- __app_test/Makefile | 62 ----- __app_test/README | 9 - __app_test/README.rst | 9 - __app_test/main.xc | 457 ----------------------------------- 8 files changed, 1222 deletions(-) delete mode 100644 __app_test/.cproject delete mode 100644 __app_test/.project delete mode 100644 __app_test/.xproject delete mode 100644 __app_test/LICENSE.rst delete mode 100644 __app_test/Makefile delete mode 100755 __app_test/README delete mode 100644 __app_test/README.rst delete mode 100644 __app_test/main.xc diff --git a/__app_test/.cproject b/__app_test/.cproject deleted file mode 100644 index ac6478f7..00000000 --- a/__app_test/.cproject +++ /dev/null @@ -1,524 +0,0 @@ - - - - - - - - - - - - - - - - - - xmake - - all - true - true - true - - - xmake - - clean - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/__app_test/.project b/__app_test/.project deleted file mode 100644 index 64c2ab83..00000000 --- a/__app_test/.project +++ /dev/null @@ -1,76 +0,0 @@ - - - app_test - - - - - - org.eclipse.cdt.managedbuilder.core.genmakebuilder - clean,full,incremental, - - - ?children? - ?name?=outputEntries\|?children?=?name?=entry\\\\|\\|\|| - - - ?name? - - - - org.eclipse.cdt.make.core.append_environment - true - - - org.eclipse.cdt.make.core.buildArguments - CONFIG=Debug - - - org.eclipse.cdt.make.core.buildCommand - xmake - - - org.eclipse.cdt.make.core.cleanBuildTarget - clean - - - org.eclipse.cdt.make.core.contents - org.eclipse.cdt.make.core.activeConfigSettings - - - org.eclipse.cdt.make.core.enableAutoBuild - false - - - org.eclipse.cdt.make.core.enableCleanBuild - true - - - org.eclipse.cdt.make.core.enableFullBuild - true - - - org.eclipse.cdt.make.core.stopOnError - true - - - org.eclipse.cdt.make.core.useDefaultBuildCmd - false - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - full,incremental, - - - - - - org.eclipse.cdt.core.cnature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - com.xmos.cdt.core.XdeProjectNature - - - diff --git a/__app_test/.xproject b/__app_test/.xproject deleted file mode 100644 index b564e960..00000000 --- a/__app_test/.xproject +++ /dev/null @@ -1 +0,0 @@ -sc_xudXM-002826-SM \ No newline at end of file diff --git a/__app_test/LICENSE.rst b/__app_test/LICENSE.rst deleted file mode 100644 index ca48f20f..00000000 --- a/__app_test/LICENSE.rst +++ /dev/null @@ -1,84 +0,0 @@ -******************************* -XMOS PUBLIC LICENCE: Version 1 -******************************* - -Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. - -**1. Definitions** - -**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. - -**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. - -**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. - -**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. - -**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. - -**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. - -This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. - - -**2. Licence** - -**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: - -2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: - -2.1.1 for personal or academic, non-commercial purposes; or - -2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): - -(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and - -(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). - -The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. - -2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: - -2.2.1 for personal or academic, non-commercial purposes; or - -2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): - -(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; - -(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and - -(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. - -Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. - -2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. - -**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. - -**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. - -**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. - -**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. - -**7. IPR and Ownership** -Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** - -Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). -Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. - -**8. Termination** - -8.1 This Licence will automatically terminate immediately, without notice to you, if: - -(a) you fail to comply with the terms of this Licence; and/or - -(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or - -(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. - -**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. - -**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. - -**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/__app_test/Makefile b/__app_test/Makefile deleted file mode 100644 index 3b9da8f0..00000000 --- a/__app_test/Makefile +++ /dev/null @@ -1,62 +0,0 @@ -#The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. - - -# This example runs on the XS-L1 usb audio board. It doesn't use any of -# the audio functionality and just uses the USB functionality of the board -TARGET = XCORE-200-EXPLORER - -# The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to -# the project name - -APP_NAME = app_test - -# The flags passed to xcc when building the application -# You can also set the following to override flags for a particular language: -# -# XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS -# -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to -# xcc for the final link (mapping) stage. - -XCC_FLAGS = -Wall -O3 -report -fsubword-select -DUSB_CORE=0 -DGLX -DTEST_MODE_SUPPORT -DXUD_SERIES_SUPPORT=1 -#XCC_FLAGS = -Wall -O2 -report -fsubword-select -DUSB_CORE=1 -DXDK - -# The USED_MODULES variable lists other module used by the application. - -USED_MODULES = lib_xud - -MODULE_LIBRARIES = xud_u_sim - -#============================================================================= -# The following part of the Makefile includes the common build infrastructure -# for compiling XMOS applications. You should not need to edit below here. - - -# Use the main Makefile from module_xmos_common -XMOS_MAKE_PATH ?= ../.. -include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common - - -#all: build - -# -# Compile the example -# -# Connect the pins together that map to XS1_PORT_1A and XS1_PORT_1B -# NOTE: Requires the testbench to have been built (src/testbenches/ExampleTestbench) -# -run: - UsbTestbench '--vcd-tracing "-o trace.vcd -ports -pads" ./bin/app_test.xe ' - -runtrace: - UsbTestbench '-t --vcd-tracing "-o trace.vcd -ports -pads -cycles -instructions" ./bin/app_test.xe ' - #--vcd-tracing "-o trace.vcd -pads" app_test.xe - -# -# This will give a list of the pins which correspond to the ports -# -list: - xsim --dump-ios app_test.xe diff --git a/__app_test/README b/__app_test/README deleted file mode 100755 index 0fd47188..00000000 --- a/__app_test/README +++ /dev/null @@ -1,9 +0,0 @@ -This is a xud trest using a xsim testbench. - -To build: - xmake - -To run: - xmake run - -Make sure you have built the TB first! diff --git a/__app_test/README.rst b/__app_test/README.rst deleted file mode 100644 index 3e0884f9..00000000 --- a/__app_test/README.rst +++ /dev/null @@ -1,9 +0,0 @@ - -================ - -:scope: -:description: -:keywords: -:boards: - - diff --git a/__app_test/main.xc b/__app_test/main.xc deleted file mode 100644 index 481d38ad..00000000 --- a/__app_test/main.xc +++ /dev/null @@ -1,457 +0,0 @@ -// Copyright 2012-2021 XMOS LIMITED. -// This Software is subject to the terms of the XMOS Public Licence: Version 1. -/* - * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent - * in both directions between the ports. - * - * NOTE: The src/testbenches/ExampleTestbench must have been compiled for this to run without error. - * - */ -#include -#include -#include -#include "xud.h" -#include "platform.h" -//#include "test.h" -#include "xc_ptr.h" - -#define XUD_EP_COUNT_OUT 5 -#define XUD_EP_COUNT_IN 5 - -extern xc_ptr char_array_to_xc_ptr(const unsigned char a[]); - -/* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, - XUD_EPTYPE_BUL, - XUD_EPTYPE_ISO, - XUD_EPTYPE_BUL, - XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; - -/* USB Port declarations */ -on stdcore[0]: out port p_usb_rst = XS1_PORT_1A; -on stdcore[0]: clock clk = XS1_CLKBLK_3; - -on stdcore[0] : out port p_test = XS1_PORT_1I; - -void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend ?c_usb_test); - -char reportBuffer[] = {0, 0, 0, 0}; - - - -/* - * This function responds to the HID requests - it draws a square using the mouse moving 40 pixels - * in each direction in sequence every 100 requests. - */ -void hid(chanend chan_ep1) -{ - int counter = 0; - int state = 0; - - XUD_ep c_ep1 = XUD_InitEp(chan_ep1); - - counter = 0; - while(1) - { - counter++; - if(counter == 400) - { - if(state == 0) - { - reportBuffer[1] = 40; - reportBuffer[2] = 0; - state+=1; - } - else if(state == 1) - { - reportBuffer[1] = 0; - reportBuffer[2] = 40; - state+=1; - } - else if(state == 2) - { - reportBuffer[1] = -40; - reportBuffer[2] = 0; - state+=1; - } - else if(state == 3) - { - reportBuffer[1] = 0; - reportBuffer[2] = -40; - state = 0; - } - counter = 0; - } - else - { - reportBuffer[1] = 0; - reportBuffer[2] = 0; - } - - if (XUD_SetBuffer(c_ep1, reportBuffer, 4) < 0) - { - XUD_ResetEndpoint(c_ep1, null); - } - } -} - - -void exit(int); - -#define FAIL_RX_DATAERROR 0 - -unsigned fail(int x) -{ - - printstr("\nXCORE: ### FAIL ******"); - switch(x) - { - case FAIL_RX_DATAERROR: - printstr("XCORE RX Data Error\n"); - - break; - - } - - exit(1); -} - -const unsigned char g_rxDataCheck[5] = {1, 1, 1, 1, 1}; -const unsigned char g_txDataCheck[5] = {1, 1, 1, 1, 1}; -unsigned g_txLength[5] = {0,0,0,0,0}; - -xc_ptr p_rxDataCheck; -xc_ptr p_txDataCheck; -xc_ptr p_txLength; - - -#pragma unsafe arrays -int RxDataCheck(unsigned char b[], int l, int epNum) -{ - int fail = 0; - unsigned char x; - - // printstr("##### RX DATA: \n"); - for (int i = 0; i < l; i++) - { - unsigned char y; - read_byte_via_xc_ptr_indexed(y, p_rxDataCheck, epNum); - if(b[i] != y)//g_rxDataCheck[epNum]) - { - printstr("#### Mismatch\n"); - printhexln(b[i]); - printhexln(g_rxDataCheck[epNum]); - printhexln(epNum); - printintln(l); - return 1; - } - - //g_rxDataCheck[epNum]++; - read_byte_via_xc_ptr_indexed(x, p_rxDataCheck, epNum); - x++; - write_byte_via_xc_ptr_indexed(p_rxDataCheck,epNum,x); - } - - return 0; -} - -/* Out EP Should receive some data, perform some test process (crc or similar) to check okay */ -/* Answers should be responded to in the IN ep */ - -#define TYPE_DATA 0 -#define TYPE_CMD 1 - -#define TYPE_DATA 0 -#define TYPE_CMD_SET_TX_LENGTH 1 - - -/* Test packet format: - * 0: Length - * 1: type (cmd/data) - * 2:n-1: Data - */ -#pragma unsafe arrays -void TestEp_out(chanend chan_ep, chanend c_sync, int epNum) -{ - unsigned char buffer[1024]; - int length; - - char x; - - XUD_ep ep = XUD_InitEp(chan_ep); - - int one = 1; - - while(1) - { - - length = XUD_GetBuffer(ep, buffer); - - /* Update tx length to rx length */ - //asm("stw %0, %1[%2]":: "r" (length), "r"(g_txLength), "r"(epNum)); - //g_txLength[epNum] = length; - write_via_xc_ptr_indexed(p_txLength, epNum, x); - - if(RxDataCheck(buffer, length, epNum)) - { - - fail(FAIL_RX_DATAERROR); - } - - - if(one) - { - c_sync <: (int)1; - one = 0; - } - } -} - -#pragma unsafe arrays -void SendTxPacket(XUD_ep ep, int length, int epNum) -{ - unsigned char buffer[1024]; - unsigned char x; - - for (int i = 0; i < length; i++) - { - //buffer[i] = g_txDataCheck[epNum]++; - - //asm("ld8u %0, %1[%2]":"=r"(x):"r"(g_txDataCheck),"r"(epNum)); - read_byte_via_xc_ptr_indexed(x, p_txDataCheck, epNum); - - buffer[i] = x; - x++; - //asm("st8 %0, %1[%2]"::"r"(x),"r"(g_txDataCheck),"r"(epNum)); - write_byte_via_xc_ptr_indexed(p_txDataCheck,epNum,x); - } - - XUD_SetBuffer(ep, buffer, length); -} - - -void TestEp_in(chanend chan_ep, chanend c_sync, int epNum) -{ - unsigned char buffer[1024]; - int y; - unsigned length; - - XUD_ep ep = XUD_InitEp(chan_ep); - - c_sync :> y; - //asm("ldw %0, %1[%2]" : "=r" (length) :"r"(g_txLength), "r" (epNum)); - read_via_xc_ptr_indexed(length, p_txLength, epNum); - - //length = g_txLength[epNum]; - - //printstr("FIRST: "); - //printintln(length); - - SendTxPacket(ep, length, epNum); - - - while(1) - { - read_via_xc_ptr_indexed(length, p_txLength, epNum); - - - if((epNum == 2)&&(length!=0)) - { - } - SendTxPacket(ep, length, epNum); - } - -} - -int TestEp_Control(chanend c_out, chanend c_in, int epNum) -{ - int slength; - int length; - - XUD_ep c_ep0_out = XUD_InitEp(c_out); - XUD_ep c_ep0_in = XUD_InitEp(c_in); - - /* Buffer for Setup data */ - unsigned char buffer[120]; - - while(1) - { - /* Wait for Setup data */ - slength = XUD_GetSetupBuffer(c_ep0_out, c_ep0_in, buffer); - - if(slength != 8) - { - printintln(length); - fail(FAIL_RX_DATAERROR); - } - - if(RxDataCheck(buffer, slength, epNum)) - { - fail(FAIL_RX_DATAERROR); - } - - length = XUD_GetBuffer(c_ep0_out, buffer); - - if(RxDataCheck(buffer, length, epNum)) - { - fail(FAIL_RX_DATAERROR); - } - - - length = XUD_GetBuffer(c_ep0_out, buffer); - if(RxDataCheck(buffer, length, epNum)) - { - fail(FAIL_RX_DATAERROR); - } - - length = XUD_GetBuffer(c_ep0_out, buffer); - if(RxDataCheck(buffer, length, epNum)) - { - fail(FAIL_RX_DATAERROR); - } - - - /* Send 0 length back */ - SendTxPacket(c_ep0_in, 0, epNum); - - /* Wait for Setup data */ - slength = XUD_GetSetupBuffer(c_ep0_out, c_ep0_in, buffer); - - if(slength != 8) - { - printintln(length); - fail(FAIL_RX_DATAERROR); - } - - if(RxDataCheck(buffer, slength, epNum)) - { - fail(FAIL_RX_DATAERROR); - } - - - SendTxPacket(c_ep0_in, length, epNum); - SendTxPacket(c_ep0_in, length, epNum); - SendTxPacket(c_ep0_in, length, epNum); - - length = XUD_GetBuffer(c_ep0_out, buffer); - if(length != 0) - { - fail(FAIL_RX_DATAERROR); - } - - - - - } -} - -void TestEp_select(chanend c_out1, chanend c_out2, chanend c_in1, chanend c_in2) -{ - XUD_ep ep_out1 = XUD_InitEp(c_out1); - XUD_ep ep_out2 = XUD_InitEp(c_out2); - XUD_ep ep_in1 = XUD_InitEp(c_in1); - XUD_ep ep_in2 = XUD_InitEp(c_in2); - - unsigned char buffer1[1024]; - unsigned char buffer1_in[1024]; - unsigned char buffer2[1024]; - unsigned char buffer2_in[1024]; - int tmp; - -#pragma unsafe arrays - for(int i = 0; i < 10; i++) - { - int x; - read_byte_via_xc_ptr_indexed(x, p_txDataCheck, 3); - buffer1_in[i] = x; - x++; - write_byte_via_xc_ptr_indexed(p_txDataCheck,3,x); - } - - XUD_SetReady_Out(ep_out1, buffer1); - XUD_SetReady_Out(ep_out2, buffer2); - XUD_SetReady_In(ep_in1, buffer1_in, 10); - - /* TODO - reset/CT etc */ - while(1) - { - select - { - case XUD_GetData_Select(c_out1, ep_out1, tmp): - - //doRxData - if(RxDataCheck(buffer1, tmp, 3)) - { - fail(FAIL_RX_DATAERROR); - } - - XUD_SetReady_Out(ep_out1, buffer1); - - break; - - case XUD_GetData_Select(c_out2, ep_out2, tmp): - - //doRxData - if(RxDataCheck(buffer2, tmp, 4)) - { - fail(FAIL_RX_DATAERROR); - } - - XUD_SetReady_Out(ep_out2, buffer2); - - break; - - case XUD_SetData_Select(c_in1, ep_in1, tmp): - - for (int i = 0; i < 10; i++) - { - int x; - read_byte_via_xc_ptr_indexed(x, p_txDataCheck, 3); - buffer1_in[i] = x; - x++; - write_byte_via_xc_ptr_indexed(p_txDataCheck,3,x); - } - - XUD_SetReady_In(ep_in1, buffer1_in, 10); - - - - break; - - } - } -} - - -#define USB_CORE 0 -int main() -{ - chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - chan c_sync; - chan c_sync_iso; - - p_rxDataCheck = char_array_to_xc_ptr(g_rxDataCheck); - p_txDataCheck = char_array_to_xc_ptr(g_txDataCheck); - p_txLength = array_to_xc_ptr(g_txLength); - - par - { - - XUD_Manager( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, - p_usb_rst, clk, -1, XUD_SPEED_HS, null); - - TestEp_Control(c_ep_out[0], c_ep_in[0], 0); - -#if (TEST_CRC_BAD) || (TEST_ACK) - TestEp_out(c_ep_out[1], c_sync, 1); - TestEp_in(c_ep_in[1], c_sync, 1); - //TestEp_out(c_ep_out[2], c_sync_iso, 2); - //TestEp_in(c_ep_in[2], c_sync_iso, 2); - TestEp_select(c_ep_out[3], c_ep_out[4], c_ep_in[3], c_ep_in[4]); -#endif - } - - return 0; -} From 57b8a46627dfe15b7c4420c6707e031f9dd4929e Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 18 Jun 2021 16:43:22 +0100 Subject: [PATCH 367/520] Initial work to properly parameterise test_stall_basic --- tests/conftest.py | 41 +++++++++++++++++++++++++++++++++++++++ tests/helpers.py | 39 +++++++++++++++++++------------------ tests/test_shorttoken.py | 3 ++- tests/test_stall_basic.py | 20 +++++++++++++++---- 4 files changed, 79 insertions(+), 24 deletions(-) create mode 100644 tests/conftest.py diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 00000000..315a4870 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,41 @@ + +import pytest + +PARAMS = { + "default": { + "arch":["xs3"], + "ep": [1], + "address": [1], + "bus_speed": ["HS", "FS"], + }, +} + +def pytest_generate_tests(metafunc): + try: + PARAMS = metafunc.module.PARAMS + params = PARAMS["default"] + + except AttributeError: + params = {} + + for name, values in params.items(): + if name in metafunc.fixturenames: + metafunc.parametrize(name, values) + + +@pytest.fixture() +def test_ep(ep: int) -> int: + return ep + +@pytest.fixture() +def test_address(address: int) -> int: + return address + +@pytest.fixture() +def test_bus_speed(bus_speed: str) -> str: + return bus_speed + +@pytest.fixture() +def test_arch(arch: str) -> str: + return arch + diff --git a/tests/helpers.py b/tests/helpers.py index 698d68fa..430482f1 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -121,31 +121,32 @@ def run_on(**kwargs): return True -def RunUsbTest(test_fn): +def RunUsbTest(session, arch, ep, address, bus_speed, test_fn): tester_list = [] output = [] testname, extension = os.path.splitext(os.path.basename(__file__)) seed = random.randint(0, sys.maxsize) - for _arch in ARCHITECTURE_CHOICES: - for _busspeed in BUSSPEED_CHOICES: - if run_on(arch=_arch): - if run_on(busspeed=_busspeed): - (clk_60, usb_phy) = get_usb_clk_phy(verbose=False, arch=_arch) - start_cap = Pyxsim.cap_redirect() - tester_list.extend( - test_fn( - _arch, - clk_60, - usb_phy, - _busspeed, - seed, - ) - ) - cap_output = start_cap.read_output() - start_cap.close_capture() - output.append(cap_output.split("\n")) + #for _arch in ARCHITECTURE_CHOICES: + # for _busspeed in BUSSPEED_CHOICES: + # if run_on(arch=_arch): + # if run_on(busspeed=_busspeed): + (clk_60, usb_phy) = get_usb_clk_phy(verbose=False, arch=arch) + start_cap = Pyxsim.cap_redirect() + tester_list.extend( + test_fn( + session, + arch, + clk_60, + usb_phy, + bus_speed, + seed, + ) + ) + cap_output = start_cap.read_output() + start_cap.close_capture() + output.append(cap_output.split("\n")) sys.stdout.write("\n") return Pyxsim.run_tester(output, tester_list) diff --git a/tests/test_shorttoken.py b/tests/test_shorttoken.py index e2e7c5f0..cd87037a 100644 --- a/tests/test_shorttoken.py +++ b/tests/test_shorttoken.py @@ -5,6 +5,7 @@ from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest def do_test(arch, clk, phy, usb_speed, seed, verbose=False): @@ -63,7 +64,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): extra_tasks=[], ) - +@pytest.mark.xfail def test_shorttoken(): for result in RunUsbTest(do_test): assert result diff --git a/tests/test_stall_basic.py b/tests/test_stall_basic.py index 104faa75..afa5762a 100644 --- a/tests/test_stall_basic.py +++ b/tests/test_stall_basic.py @@ -6,9 +6,13 @@ from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest +from conftest import PARAMS +def gen_test_session(ep, address, usb_speed): -def do_test(arch, clk, phy, usb_speed, seed, verbose=False): + if usb_speed == "FS": + pytest.xfail("Known failure at FS") address = 1 pktLength = 10 @@ -102,12 +106,16 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) ) + return session + +def do_test(sessions, arch, clk, phy, usb_speed, seed, verbose=False): + return do_usb_test( arch, clk, phy, usb_speed, - [session], + sessions, __file__, seed, level="smoke", @@ -116,6 +124,10 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) -def test_stall_basic(): - for result in RunUsbTest(do_test): +def test_stall_basic(test_arch, test_ep, test_address, test_bus_speed): + + session = gen_test_session(test_ep, test_address, test_bus_speed) + + for result in RunUsbTest([session], test_arch, test_ep, test_address, test_bus_speed, do_test): assert result + From ac2f7a6f1ef3bec8a3cbb917f7beca7b9739337f Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 18 Jun 2021 16:54:39 +0100 Subject: [PATCH 368/520] Formatting via black --- tests/Pyxsim/testers.py | 4 ++++ tests/Pyxsim/xmostest_subprocess.py | 4 +++- tests/conftest.py | 8 +++++--- tests/test_bulk_tx_noack.py | 1 + tests/test_iso_tx_basic.py | 3 +-- tests/test_shorttoken.py | 1 + 6 files changed, 15 insertions(+), 6 deletions(-) diff --git a/tests/Pyxsim/testers.py b/tests/Pyxsim/testers.py index d4652cdc..534690e1 100644 --- a/tests/Pyxsim/testers.py +++ b/tests/Pyxsim/testers.py @@ -3,16 +3,20 @@ import re import sys + class TestError(Exception): """ This exception is used for any errors that occur whilst calling functions in the Pyxsim module. """ + def __init__(self, value): self.value = value + def __str__(self): return repr(self.value) + class ComparisonTester: """ This tester will compare ouput against a file and pass a test if diff --git a/tests/Pyxsim/xmostest_subprocess.py b/tests/Pyxsim/xmostest_subprocess.py index 2590b499..130915ae 100644 --- a/tests/Pyxsim/xmostest_subprocess.py +++ b/tests/Pyxsim/xmostest_subprocess.py @@ -85,7 +85,9 @@ def platform_is_windows(): use_shell = True # Windows version of Python 2.7 doesn't support SIGINT if sys.version_info < (3, 0): - raise TestError("Doesn't support Python version < 3, please upgrade to Python 3 or higher.") + raise TestError( + "Doesn't support Python version < 3, please upgrade to Python 3 or higher." + ) SIGINT = signal.SIGTERM else: concat_args = False diff --git a/tests/conftest.py b/tests/conftest.py index 315a4870..1b5f086c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,15 +1,15 @@ - import pytest PARAMS = { "default": { - "arch":["xs3"], + "arch": ["xs3"], "ep": [1], "address": [1], "bus_speed": ["HS", "FS"], }, } + def pytest_generate_tests(metafunc): try: PARAMS = metafunc.module.PARAMS @@ -27,15 +27,17 @@ def pytest_generate_tests(metafunc): def test_ep(ep: int) -> int: return ep + @pytest.fixture() def test_address(address: int) -> int: return address + @pytest.fixture() def test_bus_speed(bus_speed: str) -> str: return bus_speed + @pytest.fixture() def test_arch(arch: str) -> str: return arch - diff --git a/tests/test_bulk_tx_noack.py b/tests/test_bulk_tx_noack.py index fc8435a3..43c8b74c 100644 --- a/tests/test_bulk_tx_noack.py +++ b/tests/test_bulk_tx_noack.py @@ -6,6 +6,7 @@ from usb_session import UsbSession from usb_transaction import UsbTransaction + def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ep = 1 diff --git a/tests/test_iso_tx_basic.py b/tests/test_iso_tx_basic.py index a0f3a624..5aae7c43 100644 --- a/tests/test_iso_tx_basic.py +++ b/tests/test_iso_tx_basic.py @@ -29,9 +29,8 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) ) - phy.initial_delay = 100000 - + return do_usb_test( arch, clk, diff --git a/tests/test_shorttoken.py b/tests/test_shorttoken.py index cd87037a..b53a06da 100644 --- a/tests/test_shorttoken.py +++ b/tests/test_shorttoken.py @@ -64,6 +64,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): extra_tasks=[], ) + @pytest.mark.xfail def test_shorttoken(): for result in RunUsbTest(do_test): From 0c2e073a7a32726bcb0c23cb62e7485ccea46ac5 Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 18 Jun 2021 16:54:52 +0100 Subject: [PATCH 369/520] Further simplify test running --- tests/helpers.py | 27 ++++++++++++--------------- tests/test_stall_basic.py | 21 ++++----------------- 2 files changed, 16 insertions(+), 32 deletions(-) diff --git a/tests/helpers.py b/tests/helpers.py index 430482f1..6a6535db 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -121,33 +121,30 @@ def run_on(**kwargs): return True -def RunUsbTest(session, arch, ep, address, bus_speed, test_fn): +def RunUsbTest(sessions, arch, ep, address, bus_speed, test_file): tester_list = [] output = [] testname, extension = os.path.splitext(os.path.basename(__file__)) seed = random.randint(0, sys.maxsize) - #for _arch in ARCHITECTURE_CHOICES: - # for _busspeed in BUSSPEED_CHOICES: - # if run_on(arch=_arch): - # if run_on(busspeed=_busspeed): (clk_60, usb_phy) = get_usb_clk_phy(verbose=False, arch=arch) start_cap = Pyxsim.cap_redirect() tester_list.extend( - test_fn( - session, - arch, - clk_60, - usb_phy, - bus_speed, - seed, - ) - ) + do_usb_test( + arch, + clk_60, + usb_phy, + bus_speed, + sessions, + test_file, + seed, + ) + ) cap_output = start_cap.read_output() start_cap.close_capture() output.append(cap_output.split("\n")) - + sys.stdout.write("\n") return Pyxsim.run_tester(output, tester_list) diff --git a/tests/test_stall_basic.py b/tests/test_stall_basic.py index afa5762a..ec09017d 100644 --- a/tests/test_stall_basic.py +++ b/tests/test_stall_basic.py @@ -9,6 +9,7 @@ import pytest from conftest import PARAMS + def gen_test_session(ep, address, usb_speed): if usb_speed == "FS": @@ -108,26 +109,12 @@ def gen_test_session(ep, address, usb_speed): return session -def do_test(sessions, arch, clk, phy, usb_speed, seed, verbose=False): - - return do_usb_test( - arch, - clk, - phy, - usb_speed, - sessions, - __file__, - seed, - level="smoke", - extra_tasks=[], - verbose=verbose, - ) - def test_stall_basic(test_arch, test_ep, test_address, test_bus_speed): session = gen_test_session(test_ep, test_address, test_bus_speed) - for result in RunUsbTest([session], test_arch, test_ep, test_address, test_bus_speed, do_test): + for result in RunUsbTest( + [session], test_arch, test_ep, test_address, test_bus_speed, __file__ + ): assert result - From 6ec45e50bd22f1f7021c02554ad9bb7eaa332281 Mon Sep 17 00:00:00 2001 From: Dave Atkinson Date: Mon, 21 Jun 2021 10:42:32 +0100 Subject: [PATCH 370/520] Remove duplicate hid.h file in AN00129. --- examples/AN00129_hid_class/src/hid.h | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 examples/AN00129_hid_class/src/hid.h diff --git a/examples/AN00129_hid_class/src/hid.h b/examples/AN00129_hid_class/src/hid.h deleted file mode 100644 index a6df0f11..00000000 --- a/examples/AN00129_hid_class/src/hid.h +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015-2021 XMOS LIMITED. -// This Software is subject to the terms of the XMOS Public Licence: Version 1. -/* - * @brief Defines from USB Device Class Definition for Human Interface Devices Specification - */ - -/* 7. Requests */ - -/* 7.1 Standard Requests - Class Descriptor Types - High byte of wValue - * The following defines valid types of Class descriptors */ -#define HID_HID 0x2100 -#define HID_REPORT 0x2200 -#define HID_PHYSICAL_DESCRIPTOR 0x2300 -/*0x24 - 0x2F: Reserved */ - -/* 7.2 Class-Specific Requests - bRequest values */ -#define HID_GET_REPORT 0x01 /* Mandatory */ -#define HID_GET_IDLE 0x02 -#define HID_GET_PROTOCOL 0x03 /* Required only for boot devices */ -/* Ox04 - 0x08 reserved */ -#define HID_SET_REPORT 0x09 -#define HID_SET_IDLE 0x0A -#define HID_SET_PROTOCOL 0x0B /* Required only for boot devices */ From a7d90a33e26988865a57f642760e908a3a2b2459 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 21 Jun 2021 14:32:57 +0100 Subject: [PATCH 371/520] Further simplification of test_stall_basic --- tests/helpers.py | 6 ++++-- tests/test_bulk_rx_basic.py | 2 ++ tests/test_stall_basic.py | 4 +--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/helpers.py b/tests/helpers.py index 6a6535db..02c74c96 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -121,13 +121,15 @@ def run_on(**kwargs): return True -def RunUsbTest(sessions, arch, ep, address, bus_speed, test_file): +def RunUsbTest(session_gen_func, arch, ep, address, bus_speed, test_file): tester_list = [] output = [] testname, extension = os.path.splitext(os.path.basename(__file__)) seed = random.randint(0, sys.maxsize) + session = session_gen_func(ep, address, bus_speed) + (clk_60, usb_phy) = get_usb_clk_phy(verbose=False, arch=arch) start_cap = Pyxsim.cap_redirect() tester_list.extend( @@ -136,7 +138,7 @@ def RunUsbTest(sessions, arch, ep, address, bus_speed, test_file): clk_60, usb_phy, bus_speed, - sessions, + [session], test_file, seed, ) diff --git a/tests/test_bulk_rx_basic.py b/tests/test_bulk_rx_basic.py index 18056520..f6e8505e 100644 --- a/tests/test_bulk_rx_basic.py +++ b/tests/test_bulk_rx_basic.py @@ -8,6 +8,7 @@ from usb_transaction import UsbTransaction import pytest + def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ep = 1 @@ -44,6 +45,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): verbose=verbose, ) + @pytest.mark.bulk def test_bulk_rx_basic(): for result in RunUsbTest(do_test): diff --git a/tests/test_stall_basic.py b/tests/test_stall_basic.py index ec09017d..8a96f10b 100644 --- a/tests/test_stall_basic.py +++ b/tests/test_stall_basic.py @@ -112,9 +112,7 @@ def gen_test_session(ep, address, usb_speed): def test_stall_basic(test_arch, test_ep, test_address, test_bus_speed): - session = gen_test_session(test_ep, test_address, test_bus_speed) - for result in RunUsbTest( - [session], test_arch, test_ep, test_address, test_bus_speed, __file__ + gen_test_session, test_arch, test_ep, test_address, test_bus_speed, __file__ ): assert result From 19c24e637c0a636a4766652867badb6c8f25d840 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 21 Jun 2021 14:34:28 +0100 Subject: [PATCH 372/520] Removed unused imports from test_stall_basic --- tests/test_stall_basic.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/test_stall_basic.py b/tests/test_stall_basic.py index 8a96f10b..c0e820af 100644 --- a/tests/test_stall_basic.py +++ b/tests/test_stall_basic.py @@ -1,9 +1,7 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -from usb_packet import * -import usb_packet -from helpers import do_usb_test, RunUsbTest +from helpers import RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction import pytest From 4a2ac40aa91cb4cae4d8c533449f76a6a7dd0f6b Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 21 Jun 2021 14:35:49 +0100 Subject: [PATCH 373/520] Added copyright and licence comment --- tests/conftest.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index 1b5f086c..6235b144 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,3 +1,6 @@ +# Copyright 2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. + import pytest PARAMS = { From 67b30f834fffc3fa94cdcd730dc9f5f41a7426ec Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 21 Jun 2021 15:31:22 +0100 Subject: [PATCH 374/520] usb_phy no longer uses xmostest --- tests/usb_phy.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/usb_phy.py b/tests/usb_phy.py index a517ec14..7f85cbe2 100644 --- a/tests/usb_phy.py +++ b/tests/usb_phy.py @@ -1,7 +1,7 @@ # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. import random -import xmostest +import Pyxsim import sys import zlib import usb_packet @@ -60,7 +60,7 @@ USB_PKT_TIMINGS = USB_PKT_TIMINGS_TIGHT -class UsbPhy(xmostest.SimThread): +class UsbPhy(Pyxsim.SimThread): # Time in ns from the last packet being sent until the end of test is signalled to the DUT END_OF_TEST_TIME = 5000 From 6c0be37c0da614ca5a0d63d5a5447e0a0f96d445 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 21 Jun 2021 15:55:16 +0100 Subject: [PATCH 375/520] =?UTF-8?q?Further=20simplified=20test=5Fstall=5Fb?= =?UTF-8?q?asic:=20RunUsbTest=20now=20in=20test=5Fstall=5Fbasic.=20Each=20?= =?UTF-8?q?test=20now=20just=20needs=20to=20define=20a=20fixture=20?= =?UTF-8?q?=E2=80=9Ctest=5Fsession=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/conftest.py | 39 +++++++++++++++++++++++++++++++++++++++ tests/test_stall_basic.py | 24 ++++++++++++++---------- 2 files changed, 53 insertions(+), 10 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 6235b144..de6183f8 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2,6 +2,13 @@ # This Software is subject to the terms of the XMOS Public Licence: Version 1. import pytest +import os +import random +import sys +import Pyxsim +from Pyxsim import testers +from helpers import get_usb_clk_phy, do_usb_test +import inspect PARAMS = { "default": { @@ -44,3 +51,35 @@ def test_bus_speed(bus_speed: str) -> str: @pytest.fixture() def test_arch(arch: str) -> str: return arch + + +def test_RunUsbTest(test_session, arch, ep, address, bus_speed, test_file): + + tester_list = [] + output = [] + testname, extension = os.path.splitext(os.path.basename(__file__)) + seed = random.randint(0, sys.maxsize) + + (clk_60, usb_phy) = get_usb_clk_phy(verbose=False, arch=arch) + start_cap = Pyxsim.cap_redirect() + tester_list.extend( + do_usb_test( + arch, + clk_60, + usb_phy, + bus_speed, + [test_session], + test_file, + seed, + ) + ) + cap_output = start_cap.read_output() + start_cap.close_capture() + output.append(cap_output.split("\n")) + + sys.stdout.write("\n") + results = Pyxsim.run_tester(output, tester_list) + + # TODO only one result + for result in results: + assert result diff --git a/tests/test_stall_basic.py b/tests/test_stall_basic.py index c0e820af..d052c8a4 100644 --- a/tests/test_stall_basic.py +++ b/tests/test_stall_basic.py @@ -5,19 +5,25 @@ from usb_session import UsbSession from usb_transaction import UsbTransaction import pytest -from conftest import PARAMS +from conftest import PARAMS, test_RunUsbTest +# TODO Can this be moved? +@pytest.fixture +def test_file(): + return __file__ -def gen_test_session(ep, address, usb_speed): - if usb_speed == "FS": +@pytest.fixture +def test_session(ep, address, bus_speed): + + if bus_speed == "FS": pytest.xfail("Known failure at FS") address = 1 pktLength = 10 session = UsbSession( - bus_speed=usb_speed, run_enumeration=False, device_address=address + bus_speed=bus_speed, run_enumeration=False, device_address=address ) ep_ctrl = 2 @@ -108,9 +114,7 @@ def gen_test_session(ep, address, usb_speed): return session -def test_stall_basic(test_arch, test_ep, test_address, test_bus_speed): - - for result in RunUsbTest( - gen_test_session, test_arch, test_ep, test_address, test_bus_speed, __file__ - ): - assert result +# for result in RunUsbTest( +# gen_test_session, test_arch, test_ep, test_address, test_bus_speed, __file__ +# ): +# assert result From 21e5b7338cd28b6e0646dbe93527d82f1bac13a0 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 21 Jun 2021 16:02:04 +0100 Subject: [PATCH 376/520] Test rename ported test_bulk_rx_basic to new test structure --- tests/conftest.py | 2 +- tests/test_bulk_rx_basic.py | 34 +++++++++++----------------------- tests/test_stall_basic.py | 2 +- 3 files changed, 13 insertions(+), 25 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index de6183f8..32b77d96 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -53,7 +53,7 @@ def test_arch(arch: str) -> str: return arch -def test_RunUsbTest(test_session, arch, ep, address, bus_speed, test_file): +def test_RunUsbSession(test_session, arch, ep, address, bus_speed, test_file): tester_list = [] output = [] diff --git a/tests/test_bulk_rx_basic.py b/tests/test_bulk_rx_basic.py index f6e8505e..a5ba383e 100644 --- a/tests/test_bulk_rx_basic.py +++ b/tests/test_bulk_rx_basic.py @@ -1,15 +1,20 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -from usb_packet import * -import usb_packet -from helpers import do_usb_test, RunUsbTest +from helpers import RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction import pytest +from conftest import PARAMS, test_RunUsbSession +# TODO Can this be moved? +@pytest.fixture +def test_file(): + return __file__ -def do_test(arch, clk, phy, usb_speed, seed, verbose=False): + +@pytest.fixture +def test_session(ep, address, bus_speed): ep = 1 address = 1 @@ -17,7 +22,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): end_length = 19 session = UsbSession( - bus_speed=usb_speed, run_enumeration=False, device_address=address + bus_speed=bus_speed, run_enumeration=False, device_address=address ) for pktLength in range(10, end_length + 1): @@ -32,21 +37,4 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) ) - return do_usb_test( - arch, - clk, - phy, - usb_speed, - [session], - __file__, - seed, - level="smoke", - extra_tasks=[], - verbose=verbose, - ) - - -@pytest.mark.bulk -def test_bulk_rx_basic(): - for result in RunUsbTest(do_test): - assert result + return session diff --git a/tests/test_stall_basic.py b/tests/test_stall_basic.py index d052c8a4..bacbb6f6 100644 --- a/tests/test_stall_basic.py +++ b/tests/test_stall_basic.py @@ -5,7 +5,7 @@ from usb_session import UsbSession from usb_transaction import UsbTransaction import pytest -from conftest import PARAMS, test_RunUsbTest +from conftest import PARAMS, test_RunUsbSession # TODO Can this be moved? @pytest.fixture From afc77efe76e3197b4a72b3a7a88c34753d87cbe2 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 21 Jun 2021 16:27:47 +0100 Subject: [PATCH 377/520] Ported more tests to new structure --- .gitignore | 1 + tests/helpers.py | 30 ------------------------ tests/test_bulk_loopback.py | 33 +++++++++----------------- tests/test_bulk_rx_basic.py | 1 - tests/test_bulk_rx_basic_badcrc32.py | 33 +++++++++----------------- tests/test_bulk_rx_basic_badpid.py | 35 +++++++++++----------------- tests/test_bulk_rx_basic_nodata.py | 32 +++++++++---------------- tests/test_bulk_rx_basic_rxerror.py | 34 ++++++++++----------------- tests/test_bulk_rx_multiep.py | 33 +++++++++----------------- tests/test_bulk_rx_traffic.py | 35 ++++++++++------------------ tests/test_bulk_tx_badack.py | 32 ++++++++++--------------- tests/test_bulk_tx_basic.py | 31 +++++++++--------------- tests/test_sof_basic.py | 34 +++++++++++---------------- tests/test_stall_basic.py | 1 - tests/test_suspend_resume.py | 34 ++++++++++----------------- 15 files changed, 130 insertions(+), 269 deletions(-) diff --git a/.gitignore b/.gitignore index 47bb65a6..a8fed707 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,4 @@ tests/log tests/test_**/**test_xs2.xn tests/test_**/**test_xs3.xn **/venv/** +*.gtkw diff --git a/tests/helpers.py b/tests/helpers.py index 02c74c96..c0208254 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -121,36 +121,6 @@ def run_on(**kwargs): return True -def RunUsbTest(session_gen_func, arch, ep, address, bus_speed, test_file): - - tester_list = [] - output = [] - testname, extension = os.path.splitext(os.path.basename(__file__)) - seed = random.randint(0, sys.maxsize) - - session = session_gen_func(ep, address, bus_speed) - - (clk_60, usb_phy) = get_usb_clk_phy(verbose=False, arch=arch) - start_cap = Pyxsim.cap_redirect() - tester_list.extend( - do_usb_test( - arch, - clk_60, - usb_phy, - bus_speed, - [session], - test_file, - seed, - ) - ) - cap_output = start_cap.read_output() - start_cap.close_capture() - output.append(cap_output.split("\n")) - - sys.stdout.write("\n") - return Pyxsim.run_tester(output, tester_list) - - def do_usb_test( arch, clk, diff --git a/tests/test_bulk_loopback.py b/tests/test_bulk_loopback.py index ee7aaa79..43c667df 100644 --- a/tests/test_bulk_loopback.py +++ b/tests/test_bulk_loopback.py @@ -1,22 +1,27 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -from usb_packet import * -import usb_packet -from helpers import do_usb_test, RunUsbTest + from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest +from conftest import PARAMS, test_RunUsbSession +# TODO Can this be moved? +@pytest.fixture +def test_file(): + return __file__ -def do_test(arch, clk, phy, usb_speed, seed, verbose=False): +@pytest.fixture +def test_session(ep, address, bus_speed): ep_loopback = 3 ep_loopback_kill = 2 address = 1 start_length = 10 end_length = 20 session = UsbSession( - bus_speed=usb_speed, run_enumeration=False, device_address=address + bus_speed=bus_speed, run_enumeration=False, device_address=address ) # TODO randomise packet lengths and data @@ -66,20 +71,4 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) ) - return do_usb_test( - arch, - clk, - phy, - usb_speed, - [session], - __file__, - seed, - level="smoke", - extra_tasks=[], - verbose=verbose, - ) - - -def test_bulk_loopback(): - for result in RunUsbTest(do_test): - assert result + return session diff --git a/tests/test_bulk_rx_basic.py b/tests/test_bulk_rx_basic.py index a5ba383e..c909484a 100644 --- a/tests/test_bulk_rx_basic.py +++ b/tests/test_bulk_rx_basic.py @@ -1,7 +1,6 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -from helpers import RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction import pytest diff --git a/tests/test_bulk_rx_basic_badcrc32.py b/tests/test_bulk_rx_basic_badcrc32.py index e72f2076..2a496a93 100644 --- a/tests/test_bulk_rx_basic_badcrc32.py +++ b/tests/test_bulk_rx_basic_badcrc32.py @@ -1,14 +1,19 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -from usb_packet import * -import usb_packet -from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest +from conftest import PARAMS, test_RunUsbSession -def do_test(arch, clk, phy, usb_speed, seed, verbose=False): +@pytest.fixture +def test_file(): + return __file__ + + +@pytest.fixture +def test_session(ep, address, bus_speed): address = 1 ep = 1 @@ -16,7 +21,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): # The large inter-event delays are to give the DUT time to do checking on the fly session = UsbSession( - bus_speed=usb_speed, run_enumeration=False, device_address=address + bus_speed=bus_speed, run_enumeration=False, device_address=address ) # Valid OUT transaction @@ -96,20 +101,4 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) ) - return do_usb_test( - arch, - clk, - phy, - usb_speed, - [session], - __file__, - seed, - level="smoke", - extra_tasks=[], - verbose=verbose, - ) - - -def test_bulk_rx_basic_badcrc32(): - for result in RunUsbTest(do_test): - assert result + return session diff --git a/tests/test_bulk_rx_basic_badpid.py b/tests/test_bulk_rx_basic_badpid.py index 4a5c38ad..8c010139 100644 --- a/tests/test_bulk_rx_basic_badpid.py +++ b/tests/test_bulk_rx_basic_badpid.py @@ -1,19 +1,26 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -from usb_packet import * -from helpers import do_usb_test, RunUsbTest + from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest +from conftest import PARAMS, test_RunUsbSession + +# TODO Can this be moved? +@pytest.fixture +def test_file(): + return __file__ + -# Tests out of seq (but valid.. ) data PID -def do_test(arch, clk, phy, usb_speed, seed, verbose=False): +@pytest.fixture +def test_session(ep, address, bus_speed): address = 1 ep = 1 session = UsbSession( - bus_speed=usb_speed, run_enumeration=False, device_address=address + bus_speed=bus_speed, run_enumeration=False, device_address=address ) # The large inter-frame gap is to give the DUT time to print its output @@ -81,20 +88,4 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) ) - return do_usb_test( - arch, - clk, - phy, - usb_speed, - [session], - __file__, - seed, - level="smoke", - extra_tasks=[], - verbose=verbose, - ) - - -def test_bulk_rx_basic_badpid(): - for result in RunUsbTest(do_test): - assert result + return session diff --git a/tests/test_bulk_rx_basic_nodata.py b/tests/test_bulk_rx_basic_nodata.py index df90e6e4..afc470b9 100644 --- a/tests/test_bulk_rx_basic_nodata.py +++ b/tests/test_bulk_rx_basic_nodata.py @@ -3,13 +3,19 @@ # This Software is subject to the terms of the XMOS Public Licence: Version 1. # Rx out of seq (but valid.. ) data PID -from usb_packet import TokenPacket, USB_PID -from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest +from conftest import PARAMS, test_RunUsbSession +# TODO Can this be moved? +@pytest.fixture +def test_file(): + return __file__ -def do_test(arch, clk, phy, usb_speed, seed, verbose=False): + +@pytest.fixture +def test_session(ep, address, bus_speed): address = 1 ep = 1 @@ -18,7 +24,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ied = 500 session = UsbSession( - bus_speed=usb_speed, run_enumeration=False, device_address=address + bus_speed=bus_speed, run_enumeration=False, device_address=address ) for length in range(10, 15): @@ -46,20 +52,4 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) ) - return do_usb_test( - arch, - clk, - phy, - usb_speed, - [session], - __file__, - seed, - level="smoke", - extra_tasks=[], - verbose=verbose, - ) - - -def test_bulk_rx_basic_nodata(): - for result in RunUsbTest(do_test): - assert result + return session diff --git a/tests/test_bulk_rx_basic_rxerror.py b/tests/test_bulk_rx_basic_rxerror.py index a5069a59..1178f738 100644 --- a/tests/test_bulk_rx_basic_rxerror.py +++ b/tests/test_bulk_rx_basic_rxerror.py @@ -1,14 +1,20 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -from usb_packet import * -import usb_packet -from helpers import do_usb_test, RunUsbTest + from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest +from conftest import PARAMS, test_RunUsbSession + +# TODO Can this be moved? +@pytest.fixture +def test_file(): + return __file__ -def do_test(arch, clk, phy, usb_speed, seed, verbose=False): +@pytest.fixture +def test_session(ep, address, bus_speed): address = 1 ep = 1 @@ -16,7 +22,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ied = 6000 session = UsbSession( - bus_speed=usb_speed, run_enumeration=False, device_address=address + bus_speed=bus_speed, run_enumeration=False, device_address=address ) # Valid OUT transaction @@ -110,20 +116,4 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) ) - return do_usb_test( - arch, - clk, - phy, - usb_speed, - [session], - __file__, - seed, - level="smoke", - extra_tasks=[], - verbose=verbose, - ) - - -def test_bulk_rx_basic_rxerror(): - for result in RunUsbTest(do_test): - assert result + return session diff --git a/tests/test_bulk_rx_multiep.py b/tests/test_bulk_rx_multiep.py index c29e4272..e3e9c43b 100644 --- a/tests/test_bulk_rx_multiep.py +++ b/tests/test_bulk_rx_multiep.py @@ -1,19 +1,24 @@ #!/usr/bin/env python # Copyright 2019-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -from usb_packet import * -import usb_packet -from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest +from conftest import PARAMS, test_RunUsbSession +# TODO Can this be moved? +@pytest.fixture +def test_file(): + return __file__ -def do_test(arch, clk, phy, usb_speed, seed, verbose=False): + +@pytest.fixture +def test_session(ep, address, bus_speed): address = 1 session = UsbSession( - bus_speed=usb_speed, run_enumeration=False, device_address=address + bus_speed=bus_speed, run_enumeration=False, device_address=address ) for pktLength in range(10, 20): @@ -59,20 +64,4 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) ) - return do_usb_test( - arch, - clk, - phy, - usb_speed, - [session], - __file__, - seed, - level="smoke", - extra_tasks=[], - verbose=verbose, - ) - - -def test_bulk_multiep(): - for result in RunUsbTest(do_test): - assert result + return session diff --git a/tests/test_bulk_rx_traffic.py b/tests/test_bulk_rx_traffic.py index b9c34a39..db4f0b4f 100644 --- a/tests/test_bulk_rx_traffic.py +++ b/tests/test_bulk_rx_traffic.py @@ -1,15 +1,20 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -from usb_packet import * -import usb_packet -from helpers import do_usb_test, RunUsbTest + from usb_session import UsbSession from usb_transaction import UsbTransaction -from usb_phy import USB_MAX_EP_ADDRESS +import pytest +from conftest import PARAMS, test_RunUsbSession + +# TODO Can this be moved? +@pytest.fixture +def test_file(): + return __file__ -def do_test(arch, clk, phy, usb_speed, seed, verbose=False): +@pytest.fixture +def test_session(ep, address, bus_speed): ep = 1 address = 1 @@ -21,7 +26,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): trafficEp2 = 0 session = UsbSession( - bus_speed=usb_speed, run_enumeration=False, device_address=address + bus_speed=bus_speed, run_enumeration=False, device_address=address ) for pktLength in range(10, 20): @@ -70,20 +75,4 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): if trafficEp1 > USB_MAX_EP_ADDRESS: trafficEp1 = 0 - return do_usb_test( - arch, - clk, - phy, - usb_speed, - [session], - __file__, - seed, - level="smoke", - extra_tasks=[], - verbose=verbose, - ) - - -def test_bulk_rx_traffic(): - for result in RunUsbTest(do_test): - assert result + return session diff --git a/tests/test_bulk_tx_badack.py b/tests/test_bulk_tx_badack.py index 466bebb1..c563da24 100644 --- a/tests/test_bulk_tx_badack.py +++ b/tests/test_bulk_tx_badack.py @@ -1,13 +1,21 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. + from usb_packet import TokenPacket, RxDataPacket, TxHandshakePacket, USB_PID -from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest +from conftest import PARAMS, test_RunUsbSession + +# TODO Can this be moved? +@pytest.fixture +def test_file(): + return __file__ -def do_test(arch, clk, phy, usb_speed, seed, verbose=False): +@pytest.fixture +def test_session(ep, address, bus_speed): ep = 1 address = 1 @@ -15,7 +23,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ied = 4000 session = UsbSession( - bus_speed=usb_speed, run_enumeration=False, device_address=address + bus_speed=bus_speed, run_enumeration=False, device_address=address ) for pktLength in range(10, 14): @@ -49,20 +57,4 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) ) - return do_usb_test( - arch, - clk, - phy, - usb_speed, - [session], - __file__, - seed, - level="smoke", - extra_tasks=[], - verbose=verbose, - ) - - -def test_bulk_tx_badack(): - for result in RunUsbTest(do_test): - assert result + return session diff --git a/tests/test_bulk_tx_basic.py b/tests/test_bulk_tx_basic.py index 13362ef6..247840a5 100644 --- a/tests/test_bulk_tx_basic.py +++ b/tests/test_bulk_tx_basic.py @@ -1,12 +1,19 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest +from conftest import PARAMS, test_RunUsbSession -def do_test(arch, clk, phy, usb_speed, seed, verbose=False): +@pytest.fixture +def test_file(): + return __file__ + + +@pytest.fixture +def test_session(ep, address, bus_speed): ep = 1 address = 1 @@ -14,7 +21,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): end_length = 19 session = UsbSession( - bus_speed=usb_speed, run_enumeration=False, device_address=address + bus_speed=bus_speed, run_enumeration=False, device_address=address ) for pktLength in range(10, end_length + 1): @@ -29,20 +36,4 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) ) - return do_usb_test( - arch, - clk, - phy, - usb_speed, - [session], - __file__, - seed, - level="smoke", - extra_tasks=[], - verbose=verbose, - ) - - -def test_bulk_tx_basic(): - for result in RunUsbTest(do_test): - assert result + return session diff --git a/tests/test_sof_basic.py b/tests/test_sof_basic.py index 754f8428..1ecd09bf 100644 --- a/tests/test_sof_basic.py +++ b/tests/test_sof_basic.py @@ -1,20 +1,28 @@ #!/usr/bin/env python # Copyright 2019-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -from usb_packet import CreateSofToken -from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +from usb_packet import CreateSofToken +import pytest +from conftest import PARAMS, test_RunUsbSession + + +# TODO Can this be moved? +@pytest.fixture +def test_file(): + return __file__ -def do_test(arch, clk, phy, usb_speed, seed, verbose=False): +@pytest.fixture +def test_session(ep, address, bus_speed): address = 1 ep = 1 frameNumber = 52 # Note, for frame number 52 we expect A5 34 40 on the bus session = UsbSession( - bus_speed=usb_speed, run_enumeration=False, device_address=address + bus_speed=bus_speed, run_enumeration=False, device_address=address ) # Start with a valid transaction */ @@ -48,20 +56,4 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) ) - return do_usb_test( - arch, - clk, - phy, - usb_speed, - [session], - __file__, - seed, - level="smoke", - extra_tasks=[], - verbose=verbose, - ) - - -def test_sof_basic(): - for result in RunUsbTest(do_test): - assert result + return session diff --git a/tests/test_stall_basic.py b/tests/test_stall_basic.py index bacbb6f6..29351a08 100644 --- a/tests/test_stall_basic.py +++ b/tests/test_stall_basic.py @@ -1,7 +1,6 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -from helpers import RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction import pytest diff --git a/tests/test_suspend_resume.py b/tests/test_suspend_resume.py index 78b064ee..670baf51 100644 --- a/tests/test_suspend_resume.py +++ b/tests/test_suspend_resume.py @@ -1,15 +1,21 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -import usb_packet from usb_packet import CreateSofToken -from helpers import do_usb_test, RunUsbTest +from usb_signalling import UsbSuspend, UsbResume from usb_session import UsbSession from usb_transaction import UsbTransaction -from usb_signalling import UsbSuspend, UsbResume +import pytest +from conftest import PARAMS, test_RunUsbSession + +# TODO Can this be moved? +@pytest.fixture +def test_file(): + return __file__ -def do_test(arch, clk, phy, usb_speed, seed, verbose=False): +@pytest.fixture +def test_session(ep, address, bus_speed): ep = 1 address = 1 @@ -19,7 +25,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): frameNumber = 52 # Note, for frame number 52 we expect A5 34 40 on the bus session = UsbSession( - bus_speed=usb_speed, run_enumeration=False, device_address=address + bus_speed=bus_speed, run_enumeration=False, device_address=address ) session.add_event( @@ -54,20 +60,4 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) ) - return do_usb_test( - arch, - clk, - phy, - usb_speed, - [session], - __file__, - seed, - level="smoke", - extra_tasks=[], - verbose=verbose, - ) - - -def test_suspend_resume(): - for result in RunUsbTest(do_test): - assert result + return session From 6b3606386c80e7ccaf3a78e82c2769bf846f8346 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 21 Jun 2021 19:31:56 +0100 Subject: [PATCH 378/520] Ported rest of the tests to new structure --- tests/test_bulk_tx_basic_short.py | 31 +++++++----------- tests/test_bulk_tx_multiep.py | 31 ++++++------------ tests/test_bulk_tx_noack.py | 31 +++++++----------- tests/test_control_basic_get.py | 30 +++++++----------- tests/test_control_basic_set.py | 30 +++++++----------- tests/test_device_attach.py | 39 +++++++++-------------- tests/test_invalidtoken.py | 32 +++++++------------ tests/test_iso_loopback.py | 33 +++++++------------- tests/test_iso_rx_basic.py | 31 +++++++----------- tests/test_iso_rxtx_fastpacket.py | 33 +++++++------------- tests/test_iso_tx_basic.py | 31 +++++++----------- tests/test_ping_rx_basic.py | 30 +++++++----------- tests/test_ping_stall.py | 33 +++++++------------- tests/test_shorttoken.py | 33 ++++++++------------ tests/test_sof_badcrc.py | 52 ++++++------------------------- tests/test_stall_epready.py | 31 +++++++----------- tests/usb_phy.py | 5 +++ tests/usb_session.py | 12 ++++++- 18 files changed, 198 insertions(+), 350 deletions(-) diff --git a/tests/test_bulk_tx_basic_short.py b/tests/test_bulk_tx_basic_short.py index e44b1ef3..bb6a0d6d 100644 --- a/tests/test_bulk_tx_basic_short.py +++ b/tests/test_bulk_tx_basic_short.py @@ -1,12 +1,19 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest +from conftest import PARAMS, test_RunUsbSession +# TODO Can this be moved? +@pytest.fixture +def test_file(): + return __file__ -def do_test(arch, clk, phy, usb_speed, seed, verbose=False): + +@pytest.fixture +def test_session(ep, address, bus_speed): ep = 1 address = 1 @@ -14,7 +21,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): end_length = 7 session = UsbSession( - bus_speed=usb_speed, run_enumeration=False, device_address=address + bus_speed=bus_speed, run_enumeration=False, device_address=address ) for pktLength in range(start_length, end_length + 1): @@ -30,20 +37,4 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) ) - return do_usb_test( - arch, - clk, - phy, - usb_speed, - [session], - __file__, - seed, - level="smoke", - extra_tasks=[], - verbose=verbose, - ) - - -def test_bulk_tx_basic_short(): - for result in RunUsbTest(do_test): - assert result + return session diff --git a/tests/test_bulk_tx_multiep.py b/tests/test_bulk_tx_multiep.py index 12c3a98d..0753b0f5 100644 --- a/tests/test_bulk_tx_multiep.py +++ b/tests/test_bulk_tx_multiep.py @@ -1,19 +1,26 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest +from conftest import PARAMS, test_RunUsbSession +# TODO Can this be moved? +@pytest.fixture +def test_file(): + return __file__ -def do_test(arch, clk, phy, usb_speed, seed, verbose=False): + +@pytest.fixture +def test_session(ep, address, bus_speed): ep = 3 # Note this is a starting EP address = 1 ied = 200 session = UsbSession( - bus_speed=usb_speed, run_enumeration=False, device_address=address + bus_speed=bus_speed, run_enumeration=False, device_address=address ) for pktLength in range(10, 20): @@ -61,21 +68,3 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): interEventDelay=ied, ) ) - - return do_usb_test( - arch, - clk, - phy, - usb_speed, - [session], - __file__, - seed, - level="smoke", - extra_tasks=[], - verbose=verbose, - ) - - -def test_bulk_tx_multiep(): - for result in RunUsbTest(do_test): - assert result diff --git a/tests/test_bulk_tx_noack.py b/tests/test_bulk_tx_noack.py index 43c8b74c..61e61c7a 100644 --- a/tests/test_bulk_tx_noack.py +++ b/tests/test_bulk_tx_noack.py @@ -2,12 +2,19 @@ # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. from usb_packet import USB_PID, TokenPacket, RxDataPacket -from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest +from conftest import PARAMS, test_RunUsbSession +# TODO Can this be moved? +@pytest.fixture +def test_file(): + return __file__ -def do_test(arch, clk, phy, usb_speed, seed, verbose=False): + +@pytest.fixture +def test_session(ep, address, bus_speed): ep = 1 address = 1 @@ -16,7 +23,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ied = 4000 session = UsbSession( - bus_speed=usb_speed, run_enumeration=False, device_address=address + bus_speed=bus_speed, run_enumeration=False, device_address=address ) for pktLength in range(10, 14): @@ -49,20 +56,4 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) ) - return do_usb_test( - arch, - clk, - phy, - usb_speed, - [session], - __file__, - seed, - level="smoke", - extra_tasks=[], - verbose=verbose, - ) - - -def test_bulk_tx_noack(): - for result in RunUsbTest(do_test): - assert result + return session diff --git a/tests/test_control_basic_get.py b/tests/test_control_basic_get.py index 4ce44204..bfbcaf02 100644 --- a/tests/test_control_basic_get.py +++ b/tests/test_control_basic_get.py @@ -9,19 +9,26 @@ RxHandshakePacket, USB_PID, ) -from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest +from conftest import PARAMS, test_RunUsbSession +# TODO Can this be moved? +@pytest.fixture +def test_file(): + return __file__ -def do_test(arch, clk, phy, usb_speed, seed, verbose=False): + +@pytest.fixture +def test_session(ep, address, bus_speed): ep = 0 address = 1 ied = 500 session = UsbSession( - bus_speed=usb_speed, run_enumeration=False, device_address=address + bus_speed=bus_speed, run_enumeration=False, device_address=address ) # SETUP transaction @@ -67,19 +74,4 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): session.add_event(TxDataPacket(length=0, pid=USB_PID["DATA1"])) session.add_event(RxHandshakePacket()) - return do_usb_test( - arch, - clk, - phy, - usb_speed, - [session], - __file__, - seed, - level="smoke", - extra_tasks=[], - ) - - -def test_control_basic_get(): - for result in RunUsbTest(do_test): - assert result + return session diff --git a/tests/test_control_basic_set.py b/tests/test_control_basic_set.py index 225fe800..55af00ee 100644 --- a/tests/test_control_basic_set.py +++ b/tests/test_control_basic_set.py @@ -9,19 +9,26 @@ RxHandshakePacket, USB_PID, ) -from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest +from conftest import PARAMS, test_RunUsbSession +# TODO Can this be moved? +@pytest.fixture +def test_file(): + return __file__ -def do_test(arch, clk, phy, usb_speed, seed, verbose=False): + +@pytest.fixture +def test_session(ep, address, bus_speed): ep = 0 address = 1 ied = 500 session = UsbSession( - bus_speed=usb_speed, run_enumeration=False, device_address=address + bus_speed=bus_speed, run_enumeration=False, device_address=address ) # SETUP transaction @@ -67,19 +74,4 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): session.add_event(RxDataPacket(dataPayload=[], pid=USB_PID["DATA1"])) session.add_event(TxHandshakePacket()) - return do_usb_test( - arch, - clk, - phy, - usb_speed, - [session], - __file__, - seed, - level="smoke", - extra_tasks=[], - ) - - -def test_control_basic_set(): - for result in RunUsbTest(do_test): - assert result + return session diff --git a/tests/test_device_attach.py b/tests/test_device_attach.py index ac635cb4..4453a273 100644 --- a/tests/test_device_attach.py +++ b/tests/test_device_attach.py @@ -1,16 +1,22 @@ # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. - -#!/usr/bin/env python import usb_packet from usb_packet import CreateSofToken -from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction from usb_signalling import UsbDeviceAttach +import pytest +from conftest import PARAMS, test_RunUsbSession + +# TODO Can this be moved? +@pytest.fixture +def test_file(): + return __file__ -def do_test(arch, clk, phy, usb_speed, seed, verbose=False): + +@pytest.fixture +def test_session(ep, address, bus_speed): ep = 1 address = 1 @@ -20,7 +26,10 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): frameNumber = 52 # Note, for frame number 52 we expect A5 34 40 on the bus session = UsbSession( - bus_speed=usb_speed, run_enumeration=False, device_address=address + bus_speed=bus_speed, + run_enumeration=False, + device_address=address, + initial_delay=19000, ) session.add_event(UsbDeviceAttach()) @@ -55,22 +64,4 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) ) - phy.initial_delay = 19000 - - return do_usb_test( - arch, - clk, - phy, - usb_speed, - [session], - __file__, - seed, - level="smoke", - extra_tasks=[], - verbose=verbose, - ) - - -def test_device_attach(): - for result in RunUsbTest(do_test): - assert result + return session diff --git a/tests/test_invalidtoken.py b/tests/test_invalidtoken.py index bf422282..170ffeae 100644 --- a/tests/test_invalidtoken.py +++ b/tests/test_invalidtoken.py @@ -1,6 +1,8 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. +# Same as simple RX bulk test but some invalid tokens also included + from usb_packet import ( TokenPacket, TxDataPacket, @@ -9,20 +11,25 @@ RxHandshakePacket, USB_PID, ) -from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest +from conftest import PARAMS, test_RunUsbSession -# Same as simple RX bulk test but some invalid tokens also included +# TODO Can this be moved? +@pytest.fixture +def test_file(): + return __file__ -def do_test(arch, clk, phy, usb_speed, seed, verbose=False): +@pytest.fixture +def test_session(ep, address, bus_speed): address = 1 ep = 1 session = UsbSession( - bus_speed=usb_speed, run_enumeration=False, device_address=address + bus_speed=bus_speed, run_enumeration=False, device_address=address ) # Reserved/Invalid PID @@ -131,19 +138,4 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) ) - return do_usb_test( - arch, - clk, - phy, - usb_speed, - [session], - __file__, - seed, - level="smoke", - extra_tasks=[], - ) - - -def test_invalidtoken(): - for result in RunUsbTest(do_test): - assert result + return session diff --git a/tests/test_iso_loopback.py b/tests/test_iso_loopback.py index 5397c1f2..efbeb381 100644 --- a/tests/test_iso_loopback.py +++ b/tests/test_iso_loopback.py @@ -1,14 +1,19 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -from usb_packet import * -import usb_packet -from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest +from conftest import PARAMS, test_RunUsbSession +# TODO Can this be moved? +@pytest.fixture +def test_file(): + return __file__ -def do_test(arch, clk, phy, usb_speed, seed, verbose=False): + +@pytest.fixture +def test_session(ep, address, bus_speed): ep_loopback = 3 ep_loopback_kill = 2 @@ -16,7 +21,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): start_length = 200 end_length = 203 session = UsbSession( - bus_speed=usb_speed, run_enumeration=False, device_address=address + bus_speed=bus_speed, run_enumeration=False, device_address=address ) # TODO randomise packet lengths and data @@ -72,20 +77,4 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) ) - return do_usb_test( - arch, - clk, - phy, - usb_speed, - [session], - __file__, - seed, - level="smoke", - extra_tasks=[], - verbose=verbose, - ) - - -def test_iso_loopback(): - for result in RunUsbTest(do_test): - assert result + return session diff --git a/tests/test_iso_rx_basic.py b/tests/test_iso_rx_basic.py index 49569050..ffa044ee 100644 --- a/tests/test_iso_rx_basic.py +++ b/tests/test_iso_rx_basic.py @@ -1,12 +1,19 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest +from conftest import PARAMS, test_RunUsbSession +# TODO Can this be moved? +@pytest.fixture +def test_file(): + return __file__ -def do_test(arch, clk, phy, usb_speed, seed, verbose=False): + +@pytest.fixture +def test_session(ep, address, bus_speed): ep = 2 address = 1 @@ -14,7 +21,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): end_length = 14 session = UsbSession( - bus_speed=usb_speed, run_enumeration=False, device_address=address + bus_speed=bus_speed, run_enumeration=False, device_address=address ) for pktLength in range(10, end_length + 1): @@ -29,20 +36,4 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) ) - return do_usb_test( - arch, - clk, - phy, - usb_speed, - [session], - __file__, - seed, - level="smoke", - extra_tasks=[], - verbose=verbose, - ) - - -def test_iso_rx_basic(): - for result in RunUsbTest(do_test): - assert result + return session diff --git a/tests/test_iso_rxtx_fastpacket.py b/tests/test_iso_rxtx_fastpacket.py index 81c0d308..be7c49e4 100644 --- a/tests/test_iso_rxtx_fastpacket.py +++ b/tests/test_iso_rxtx_fastpacket.py @@ -1,14 +1,19 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -from usb_packet import * -import usb_packet -from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest +from conftest import PARAMS, test_RunUsbSession +# TODO Can this be moved? +@pytest.fixture +def test_file(): + return __file__ -def do_test(arch, clk, phy, usb_speed, seed, verbose=False): + +@pytest.fixture +def test_session(ep, address, bus_speed): ep = 3 address = 1 @@ -16,7 +21,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): end_length = 19 session = UsbSession( - bus_speed=usb_speed, run_enumeration=False, device_address=address + bus_speed=bus_speed, run_enumeration=False, device_address=address ) for pktLength in range(start_length, end_length + 1): @@ -46,20 +51,4 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) ) - return do_usb_test( - arch, - clk, - phy, - usb_speed, - [session], - __file__, - seed, - level="smoke", - extra_tasks=[], - verbose=verbose, - ) - - -def test_iso_rxtx_fastpacket(): - for result in RunUsbTest(do_test): - assert result + return session diff --git a/tests/test_iso_tx_basic.py b/tests/test_iso_tx_basic.py index 5aae7c43..6e7854a9 100644 --- a/tests/test_iso_tx_basic.py +++ b/tests/test_iso_tx_basic.py @@ -1,12 +1,19 @@ #!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest +from conftest import PARAMS, test_RunUsbSession +# TODO Can this be moved? +@pytest.fixture +def test_file(): + return __file__ -def do_test(arch, clk, phy, usb_speed, seed, verbose=False): + +@pytest.fixture +def test_session(ep, address, bus_speed): ep = 3 address = 1 @@ -14,7 +21,7 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): end_length = 14 session = UsbSession( - bus_speed=usb_speed, run_enumeration=False, device_address=address + bus_speed=bus_speed, run_enumeration=False, device_address=address ) for pktLength in range(10, end_length + 1): @@ -31,20 +38,4 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): phy.initial_delay = 100000 - return do_usb_test( - arch, - clk, - phy, - usb_speed, - [session], - __file__, - seed, - level="smoke", - extra_tasks=[], - verbose=verbose, - ) - - -def test_iso_tx_basic(): - for result in RunUsbTest(do_test): - assert result + return session diff --git a/tests/test_ping_rx_basic.py b/tests/test_ping_rx_basic.py index 01313980..94d2d3ad 100644 --- a/tests/test_ping_rx_basic.py +++ b/tests/test_ping_rx_basic.py @@ -11,18 +11,25 @@ RxHandshakePacket, USB_PID, ) -from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest +from conftest import PARAMS, test_RunUsbSession +# TODO Can this be moved? +@pytest.fixture +def test_file(): + return __file__ -def do_test(arch, clk, phy, usb_speed, seed, verbose=False): + +@pytest.fixture +def test_session(ep, address, bus_speed): address = 1 ep = 1 session = UsbSession( - bus_speed=usb_speed, run_enumeration=False, device_address=address + bus_speed=bus_speed, run_enumeration=False, device_address=address ) # Ping EP 2, expect NAK @@ -124,19 +131,4 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) ) - return do_usb_test( - arch, - clk, - phy, - usb_speed, - [session], - __file__, - seed, - level="smoke", - extra_tasks=[], - ) - - -def test_ping_rx_basic(): - for result in RunUsbTest(do_test): - assert result + return session diff --git a/tests/test_ping_stall.py b/tests/test_ping_stall.py index ee1dcca3..9cb1d015 100644 --- a/tests/test_ping_stall.py +++ b/tests/test_ping_stall.py @@ -3,20 +3,26 @@ # This Software is subject to the terms of the XMOS Public Licence: Version 1. import xmostest -from usb_packet import * -import usb_packet -from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +from usb_packet import TokenPacket, USB_PID, RxHandshakePacket +import pytest +from conftest import PARAMS, test_RunUsbSession +# TODO Can this be moved? +@pytest.fixture +def test_file(): + return __file__ -def do_test(arch, clk, phy, usb_speed, seed, verbose=False): + +@pytest.fixture +def test_session(ep, address, bus_speed): address = 1 pktLength = 10 session = UsbSession( - bus_speed=usb_speed, run_enumeration=False, device_address=address + bus_speed=bus_speed, run_enumeration=False, device_address=address ) ep_ctrl = 2 @@ -77,19 +83,4 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) ) - do_usb_test( - arch, - clk, - phy, - usb_speed, - [session], - __file__, - seed, - level="smoke", - extra_tasks=[], - verbose=verbose, - ) - - -def runtest(): - RunUsbTest(do_test) + return session diff --git a/tests/test_shorttoken.py b/tests/test_shorttoken.py index b53a06da..fea5e86a 100644 --- a/tests/test_shorttoken.py +++ b/tests/test_shorttoken.py @@ -2,19 +2,28 @@ # Copyright 2019-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. from usb_packet import TxPacket, USB_PID -from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction import pytest +from conftest import PARAMS, test_RunUsbSession +# TODO Can this be moved? +@pytest.fixture +def test_file(): + return __file__ -def do_test(arch, clk, phy, usb_speed, seed, verbose=False): + +@pytest.fixture +def test_session(ep, address, bus_speed, arch): + + if arch == "xs3": + pytest.xfail("Known failure on xs3") address = 1 ep = 1 session = UsbSession( - bus_speed=usb_speed, run_enumeration=False, device_address=address + bus_speed=bus_speed, run_enumeration=False, device_address=address ) # Start with a valid transaction */ @@ -52,20 +61,4 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) ) - return do_usb_test( - arch, - clk, - phy, - usb_speed, - [session], - __file__, - seed, - level="smoke", - extra_tasks=[], - ) - - -@pytest.mark.xfail -def test_shorttoken(): - for result in RunUsbTest(do_test): - assert result + return session diff --git a/tests/test_sof_badcrc.py b/tests/test_sof_badcrc.py index 7261a8a5..73006971 100644 --- a/tests/test_sof_badcrc.py +++ b/tests/test_sof_badcrc.py @@ -1,43 +1,27 @@ #!/usr/bin/env python # Copyright 2019-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -from usb_packet import * -import usb_packet -from helpers import do_usb_test, RunUsbTest +from usb_packet import TokenPacket, USB_PID, CreateSofToken from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest +from conftest import PARAMS, test_RunUsbSession -# TODO ideally creation of SOF's is moved elsewhere -def CreateSofToken(frameNumber, badCrc=False): - ep = (frameNumber >> 7) & 0xF - address = (frameNumber) & 0x7F - - if badCrc: - return TokenPacket( - pid=USB_PID["SOF"], - address=address, - endpoint=ep, - crc5=0xFF, - ) - else: - return TokenPacket( - pid=USB_PID["SOF"], - address=address, - endpoint=ep, - ) - - return sofToken +@pytest.fixture +def test_file(): + return __file__ -def do_test(arch, clk, phy, usb_speed, seed, verbose=False): +@pytest.fixture +def test_session(ep, address, bus_speed): address = 1 ep = 1 frameNumber = 52 # Note, for frame number 52 we expect A5 34 40 on the bus session = UsbSession( - bus_speed=usb_speed, run_enumeration=False, device_address=address + bus_speed=bus_speed, run_enumeration=False, device_address=address ) # Start with a valid transaction */ @@ -73,20 +57,4 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) ) - return do_usb_test( - arch, - clk, - phy, - usb_speed, - [session], - __file__, - seed, - level="smoke", - extra_tasks=[], - verbose=verbose, - ) - - -def test_sof_badcrc(): - for result in RunUsbTest(do_test): - assert result + return session diff --git a/tests/test_stall_epready.py b/tests/test_stall_epready.py index 8714463a..e43e4b74 100644 --- a/tests/test_stall_epready.py +++ b/tests/test_stall_epready.py @@ -5,18 +5,25 @@ # Directed test for (github) issue #58 from usb_packet import * import usb_packet -from helpers import do_usb_test, RunUsbTest from usb_session import UsbSession from usb_transaction import UsbTransaction +import pytest +from conftest import PARAMS, test_RunUsbSession +# TODO Can this be moved? +@pytest.fixture +def test_file(): + return __file__ -def do_test(arch, clk, phy, usb_speed, seed, verbose=False): + +@pytest.fixture +def test_session(ep, address, bus_speed): address = 1 pktLength = 10 session = UsbSession( - bus_speed=usb_speed, run_enumeration=False, device_address=address + bus_speed=bus_speed, run_enumeration=False, device_address=address ) ep_ctrl = 2 @@ -105,20 +112,4 @@ def do_test(arch, clk, phy, usb_speed, seed, verbose=False): ) ) - return do_usb_test( - arch, - clk, - phy, - usb_speed, - [session], - __file__, - seed, - level="smoke", - extra_tasks=[], - verbose=verbose, - ) - - -def test_stall_epready(): - for result in RunUsbTest(do_test): - assert result + return session diff --git a/tests/usb_phy.py b/tests/usb_phy.py index 7f85cbe2..aab84a1b 100644 --- a/tests/usb_phy.py +++ b/tests/usb_phy.py @@ -201,6 +201,11 @@ def run(self): xsi = self.xsi + # TODO ideally each session could have it's own start up delay rather than modifying the + # phy start up delay + if self._session.initial_delay is not None: + self._initial_delay = self._session.initial_delay + self.start_test() for event in self._session.events: diff --git a/tests/usb_session.py b/tests/usb_session.py index 62634d41..a1852944 100644 --- a/tests/usb_session.py +++ b/tests/usb_session.py @@ -17,8 +17,14 @@ def CounterByte(startVal=0, length=0): class UsbSession(object): def __init__( - self, bus_speed="HS", run_enumeration=False, device_address=0, **kwargs + self, + bus_speed="HS", + run_enumeration=False, + device_address=0, + initial_delay=None, + **kwargs ): + self._initial_delay = initial_delay self._bus_speed = bus_speed self._events = [] self._enumerate = run_enumeration @@ -31,6 +37,10 @@ def __init__( assert run_enumeration == False, "Not yet supported" + @property + def initial_delay(self): + return self._initial_delay + @property def bus_speed(self): return self._bus_speed From c650f7d1a1273cf823d51acc4ac2ff09ef802e41 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 21 Jun 2021 20:09:42 +0100 Subject: [PATCH 379/520] Fixed test errors --- tests/test_bulk_rx_basic_nodata.py | 6 +++--- tests/test_bulk_rx_traffic.py | 2 +- tests/test_bulk_tx_multiep.py | 2 ++ tests/test_iso_tx_basic.py | 7 ++++--- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/tests/test_bulk_rx_basic_nodata.py b/tests/test_bulk_rx_basic_nodata.py index afc470b9..426350e2 100644 --- a/tests/test_bulk_rx_basic_nodata.py +++ b/tests/test_bulk_rx_basic_nodata.py @@ -1,13 +1,13 @@ -#!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. - -# Rx out of seq (but valid.. ) data PID from usb_session import UsbSession from usb_transaction import UsbTransaction +from usb_packet import TokenPacket, USB_PID import pytest from conftest import PARAMS, test_RunUsbSession +# Rx out of seq (but valid.. ) data PID + # TODO Can this be moved? @pytest.fixture def test_file(): diff --git a/tests/test_bulk_rx_traffic.py b/tests/test_bulk_rx_traffic.py index db4f0b4f..fcffab29 100644 --- a/tests/test_bulk_rx_traffic.py +++ b/tests/test_bulk_rx_traffic.py @@ -1,9 +1,9 @@ -#!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. from usb_session import UsbSession from usb_transaction import UsbTransaction +from usb_phy import USB_MAX_EP_ADDRESS import pytest from conftest import PARAMS, test_RunUsbSession diff --git a/tests/test_bulk_tx_multiep.py b/tests/test_bulk_tx_multiep.py index 0753b0f5..3cb8be88 100644 --- a/tests/test_bulk_tx_multiep.py +++ b/tests/test_bulk_tx_multiep.py @@ -68,3 +68,5 @@ def test_session(ep, address, bus_speed): interEventDelay=ied, ) ) + + return session diff --git a/tests/test_iso_tx_basic.py b/tests/test_iso_tx_basic.py index 6e7854a9..d7ca32d2 100644 --- a/tests/test_iso_tx_basic.py +++ b/tests/test_iso_tx_basic.py @@ -21,7 +21,10 @@ def test_session(ep, address, bus_speed): end_length = 14 session = UsbSession( - bus_speed=bus_speed, run_enumeration=False, device_address=address + bus_speed=bus_speed, + run_enumeration=False, + device_address=address, + initial_delay=100000, ) for pktLength in range(10, end_length + 1): @@ -36,6 +39,4 @@ def test_session(ep, address, bus_speed): ) ) - phy.initial_delay = 100000 - return session From 1fb6cbf7d03b385787923c7d98cb559e125c355f Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 21 Jun 2021 20:23:33 +0100 Subject: [PATCH 380/520] xfailed test_bulk_rx_traffic at FS (see issue #183) --- tests/test_bulk_rx_traffic.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test_bulk_rx_traffic.py b/tests/test_bulk_rx_traffic.py index fcffab29..dc1bdd75 100644 --- a/tests/test_bulk_rx_traffic.py +++ b/tests/test_bulk_rx_traffic.py @@ -16,6 +16,9 @@ def test_file(): @pytest.fixture def test_session(ep, address, bus_speed): + if bus_speed == "FS": + pytest.xfail("Known failure at FS") + ep = 1 address = 1 ied = 500 From bcaa959a5a30022a44bfd2c9ee75111471cb5294 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 21 Jun 2021 20:49:51 +0100 Subject: [PATCH 381/520] =?UTF-8?q?Added=20=E2=80=94smoke=20option=20to=20?= =?UTF-8?q?tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/conftest.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 32b77d96..f9d03858 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -8,10 +8,15 @@ import Pyxsim from Pyxsim import testers from helpers import get_usb_clk_phy, do_usb_test -import inspect PARAMS = { "default": { + "arch": ["xs3"], + "ep": [0, 1, 15], + "address": [0, 1, 127], + "bus_speed": ["HS", "FS"], + }, + "smoke": { "arch": ["xs3"], "ep": [1], "address": [1], @@ -19,12 +24,16 @@ }, } +def pytest_addoption(parser): + parser.addoption("--smoke", action="store_true", help="smoke test") def pytest_generate_tests(metafunc): try: PARAMS = metafunc.module.PARAMS - params = PARAMS["default"] - + if metafunc.config.getoption("smoke"): + params = PARAMS.get("smoke", PARAMS["default"]) + else: + params = PARAMS["default"] except AttributeError: params = {} From e2d87d27c8899ec694b02f11ebfb9fc36b3c4766 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 21 Jun 2021 20:49:51 +0100 Subject: [PATCH 382/520] =?UTF-8?q?Added=20=E2=80=94smoke=20option=20to=20?= =?UTF-8?q?tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/conftest.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 32b77d96..f9d03858 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -8,10 +8,15 @@ import Pyxsim from Pyxsim import testers from helpers import get_usb_clk_phy, do_usb_test -import inspect PARAMS = { "default": { + "arch": ["xs3"], + "ep": [0, 1, 15], + "address": [0, 1, 127], + "bus_speed": ["HS", "FS"], + }, + "smoke": { "arch": ["xs3"], "ep": [1], "address": [1], @@ -19,12 +24,16 @@ }, } +def pytest_addoption(parser): + parser.addoption("--smoke", action="store_true", help="smoke test") def pytest_generate_tests(metafunc): try: PARAMS = metafunc.module.PARAMS - params = PARAMS["default"] - + if metafunc.config.getoption("smoke"): + params = PARAMS.get("smoke", PARAMS["default"]) + else: + params = PARAMS["default"] except AttributeError: params = {} From e9973303ec89df3384e0a5a3bf968345037133d3 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 22 Jun 2021 12:54:06 +0100 Subject: [PATCH 383/520] Autoformat --- tests/conftest.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index f9d03858..34d3377a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -24,9 +24,11 @@ }, } + def pytest_addoption(parser): parser.addoption("--smoke", action="store_true", help="smoke test") + def pytest_generate_tests(metafunc): try: PARAMS = metafunc.module.PARAMS From e78d1c111007cb344bc009cc8dd733d3cc5a127c Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 22 Jun 2021 13:05:49 +0100 Subject: [PATCH 384/520] test_file fixture moved to contest (using builtin PyTest request fixture) --- tests/conftest.py | 5 +++++ tests/test_bulk_loopback.py | 6 ------ tests/test_bulk_rx_basic.py | 8 +------- tests/test_bulk_rx_basic_badcrc32.py | 6 ------ tests/test_bulk_rx_basic_badpid.py | 7 ------- tests/test_bulk_tx_basic.py | 7 +------ tests/test_bulk_tx_basic_short.py | 6 ------ tests/test_bulk_tx_multiep.py | 6 ------ tests/test_bulk_tx_noack.py | 7 ------- tests/test_device_attach.py | 7 ------- tests/test_iso_tx_basic.py | 7 ------- tests/test_ping_stall.py | 7 ------- tests/test_suspend_resume.py | 7 ------- 13 files changed, 7 insertions(+), 79 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 34d3377a..df1e9a37 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -64,6 +64,11 @@ def test_arch(arch: str) -> str: return arch +@pytest.fixture +def test_file(request): + return str(request.node.fspath) + + def test_RunUsbSession(test_session, arch, ep, address, bus_speed, test_file): tester_list = [] diff --git a/tests/test_bulk_loopback.py b/tests/test_bulk_loopback.py index 43c667df..202bb9f1 100644 --- a/tests/test_bulk_loopback.py +++ b/tests/test_bulk_loopback.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. @@ -7,11 +6,6 @@ import pytest from conftest import PARAMS, test_RunUsbSession -# TODO Can this be moved? -@pytest.fixture -def test_file(): - return __file__ - @pytest.fixture def test_session(ep, address, bus_speed): diff --git a/tests/test_bulk_rx_basic.py b/tests/test_bulk_rx_basic.py index c909484a..221c2f52 100644 --- a/tests/test_bulk_rx_basic.py +++ b/tests/test_bulk_rx_basic.py @@ -1,17 +1,11 @@ -#!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. + from usb_session import UsbSession from usb_transaction import UsbTransaction import pytest from conftest import PARAMS, test_RunUsbSession -# TODO Can this be moved? -@pytest.fixture -def test_file(): - return __file__ - - @pytest.fixture def test_session(ep, address, bus_speed): diff --git a/tests/test_bulk_rx_basic_badcrc32.py b/tests/test_bulk_rx_basic_badcrc32.py index 2a496a93..ac3a01ae 100644 --- a/tests/test_bulk_rx_basic_badcrc32.py +++ b/tests/test_bulk_rx_basic_badcrc32.py @@ -6,12 +6,6 @@ import pytest from conftest import PARAMS, test_RunUsbSession - -@pytest.fixture -def test_file(): - return __file__ - - @pytest.fixture def test_session(ep, address, bus_speed): diff --git a/tests/test_bulk_rx_basic_badpid.py b/tests/test_bulk_rx_basic_badpid.py index 8c010139..51cee7f3 100644 --- a/tests/test_bulk_rx_basic_badpid.py +++ b/tests/test_bulk_rx_basic_badpid.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. @@ -7,12 +6,6 @@ import pytest from conftest import PARAMS, test_RunUsbSession -# TODO Can this be moved? -@pytest.fixture -def test_file(): - return __file__ - - @pytest.fixture def test_session(ep, address, bus_speed): diff --git a/tests/test_bulk_tx_basic.py b/tests/test_bulk_tx_basic.py index 247840a5..405d993f 100644 --- a/tests/test_bulk_tx_basic.py +++ b/tests/test_bulk_tx_basic.py @@ -1,17 +1,12 @@ -#!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. + from usb_session import UsbSession from usb_transaction import UsbTransaction import pytest from conftest import PARAMS, test_RunUsbSession -@pytest.fixture -def test_file(): - return __file__ - - @pytest.fixture def test_session(ep, address, bus_speed): diff --git a/tests/test_bulk_tx_basic_short.py b/tests/test_bulk_tx_basic_short.py index bb6a0d6d..963c6b46 100644 --- a/tests/test_bulk_tx_basic_short.py +++ b/tests/test_bulk_tx_basic_short.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. from usb_session import UsbSession @@ -6,11 +5,6 @@ import pytest from conftest import PARAMS, test_RunUsbSession -# TODO Can this be moved? -@pytest.fixture -def test_file(): - return __file__ - @pytest.fixture def test_session(ep, address, bus_speed): diff --git a/tests/test_bulk_tx_multiep.py b/tests/test_bulk_tx_multiep.py index 3cb8be88..349457f2 100644 --- a/tests/test_bulk_tx_multiep.py +++ b/tests/test_bulk_tx_multiep.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. from usb_session import UsbSession @@ -6,11 +5,6 @@ import pytest from conftest import PARAMS, test_RunUsbSession -# TODO Can this be moved? -@pytest.fixture -def test_file(): - return __file__ - @pytest.fixture def test_session(ep, address, bus_speed): diff --git a/tests/test_bulk_tx_noack.py b/tests/test_bulk_tx_noack.py index 61e61c7a..aebb7154 100644 --- a/tests/test_bulk_tx_noack.py +++ b/tests/test_bulk_tx_noack.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. from usb_packet import USB_PID, TokenPacket, RxDataPacket @@ -7,12 +6,6 @@ import pytest from conftest import PARAMS, test_RunUsbSession -# TODO Can this be moved? -@pytest.fixture -def test_file(): - return __file__ - - @pytest.fixture def test_session(ep, address, bus_speed): diff --git a/tests/test_device_attach.py b/tests/test_device_attach.py index 4453a273..e4fd3534 100644 --- a/tests/test_device_attach.py +++ b/tests/test_device_attach.py @@ -1,6 +1,5 @@ # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -import usb_packet from usb_packet import CreateSofToken from usb_session import UsbSession from usb_transaction import UsbTransaction @@ -9,12 +8,6 @@ import pytest from conftest import PARAMS, test_RunUsbSession -# TODO Can this be moved? -@pytest.fixture -def test_file(): - return __file__ - - @pytest.fixture def test_session(ep, address, bus_speed): diff --git a/tests/test_iso_tx_basic.py b/tests/test_iso_tx_basic.py index d7ca32d2..6623751d 100644 --- a/tests/test_iso_tx_basic.py +++ b/tests/test_iso_tx_basic.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. from usb_session import UsbSession @@ -6,12 +5,6 @@ import pytest from conftest import PARAMS, test_RunUsbSession -# TODO Can this be moved? -@pytest.fixture -def test_file(): - return __file__ - - @pytest.fixture def test_session(ep, address, bus_speed): diff --git a/tests/test_ping_stall.py b/tests/test_ping_stall.py index 9cb1d015..d957af25 100644 --- a/tests/test_ping_stall.py +++ b/tests/test_ping_stall.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. @@ -9,12 +8,6 @@ import pytest from conftest import PARAMS, test_RunUsbSession -# TODO Can this be moved? -@pytest.fixture -def test_file(): - return __file__ - - @pytest.fixture def test_session(ep, address, bus_speed): diff --git a/tests/test_suspend_resume.py b/tests/test_suspend_resume.py index 670baf51..652ca429 100644 --- a/tests/test_suspend_resume.py +++ b/tests/test_suspend_resume.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. from usb_packet import CreateSofToken @@ -8,12 +7,6 @@ import pytest from conftest import PARAMS, test_RunUsbSession -# TODO Can this be moved? -@pytest.fixture -def test_file(): - return __file__ - - @pytest.fixture def test_session(ep, address, bus_speed): From 6d2bbe94e296a2184eba5bddaff457bd2abe6cee Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 22 Jun 2021 13:07:52 +0100 Subject: [PATCH 385/520] Formatting and removed old test_file fixture still remaining in some tests. --- tests/test_bulk_rx_basic.py | 1 + tests/test_bulk_rx_basic_badcrc32.py | 1 + tests/test_bulk_rx_basic_badpid.py | 1 + tests/test_bulk_tx_noack.py | 1 + tests/test_control_basic_get.py | 6 ------ tests/test_control_basic_set.py | 6 ------ tests/test_device_attach.py | 1 + tests/test_iso_tx_basic.py | 1 + tests/test_ping_stall.py | 1 + tests/test_suspend_resume.py | 1 + 10 files changed, 8 insertions(+), 12 deletions(-) diff --git a/tests/test_bulk_rx_basic.py b/tests/test_bulk_rx_basic.py index 221c2f52..f150554c 100644 --- a/tests/test_bulk_rx_basic.py +++ b/tests/test_bulk_rx_basic.py @@ -6,6 +6,7 @@ import pytest from conftest import PARAMS, test_RunUsbSession + @pytest.fixture def test_session(ep, address, bus_speed): diff --git a/tests/test_bulk_rx_basic_badcrc32.py b/tests/test_bulk_rx_basic_badcrc32.py index ac3a01ae..61f715d0 100644 --- a/tests/test_bulk_rx_basic_badcrc32.py +++ b/tests/test_bulk_rx_basic_badcrc32.py @@ -6,6 +6,7 @@ import pytest from conftest import PARAMS, test_RunUsbSession + @pytest.fixture def test_session(ep, address, bus_speed): diff --git a/tests/test_bulk_rx_basic_badpid.py b/tests/test_bulk_rx_basic_badpid.py index 51cee7f3..d53c2cda 100644 --- a/tests/test_bulk_rx_basic_badpid.py +++ b/tests/test_bulk_rx_basic_badpid.py @@ -6,6 +6,7 @@ import pytest from conftest import PARAMS, test_RunUsbSession + @pytest.fixture def test_session(ep, address, bus_speed): diff --git a/tests/test_bulk_tx_noack.py b/tests/test_bulk_tx_noack.py index aebb7154..d52ea3ce 100644 --- a/tests/test_bulk_tx_noack.py +++ b/tests/test_bulk_tx_noack.py @@ -6,6 +6,7 @@ import pytest from conftest import PARAMS, test_RunUsbSession + @pytest.fixture def test_session(ep, address, bus_speed): diff --git a/tests/test_control_basic_get.py b/tests/test_control_basic_get.py index bfbcaf02..c59af5af 100644 --- a/tests/test_control_basic_get.py +++ b/tests/test_control_basic_get.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. from usb_packet import ( @@ -14,11 +13,6 @@ import pytest from conftest import PARAMS, test_RunUsbSession -# TODO Can this be moved? -@pytest.fixture -def test_file(): - return __file__ - @pytest.fixture def test_session(ep, address, bus_speed): diff --git a/tests/test_control_basic_set.py b/tests/test_control_basic_set.py index 55af00ee..36f2c4b8 100644 --- a/tests/test_control_basic_set.py +++ b/tests/test_control_basic_set.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. from usb_packet import ( @@ -14,11 +13,6 @@ import pytest from conftest import PARAMS, test_RunUsbSession -# TODO Can this be moved? -@pytest.fixture -def test_file(): - return __file__ - @pytest.fixture def test_session(ep, address, bus_speed): diff --git a/tests/test_device_attach.py b/tests/test_device_attach.py index e4fd3534..0d641939 100644 --- a/tests/test_device_attach.py +++ b/tests/test_device_attach.py @@ -8,6 +8,7 @@ import pytest from conftest import PARAMS, test_RunUsbSession + @pytest.fixture def test_session(ep, address, bus_speed): diff --git a/tests/test_iso_tx_basic.py b/tests/test_iso_tx_basic.py index 6623751d..c50845fc 100644 --- a/tests/test_iso_tx_basic.py +++ b/tests/test_iso_tx_basic.py @@ -5,6 +5,7 @@ import pytest from conftest import PARAMS, test_RunUsbSession + @pytest.fixture def test_session(ep, address, bus_speed): diff --git a/tests/test_ping_stall.py b/tests/test_ping_stall.py index d957af25..9e01cb4d 100644 --- a/tests/test_ping_stall.py +++ b/tests/test_ping_stall.py @@ -8,6 +8,7 @@ import pytest from conftest import PARAMS, test_RunUsbSession + @pytest.fixture def test_session(ep, address, bus_speed): diff --git a/tests/test_suspend_resume.py b/tests/test_suspend_resume.py index 652ca429..077b77e2 100644 --- a/tests/test_suspend_resume.py +++ b/tests/test_suspend_resume.py @@ -7,6 +7,7 @@ import pytest from conftest import PARAMS, test_RunUsbSession + @pytest.fixture def test_session(ep, address, bus_speed): From c3c5301d993c14349acc51a375eb80f59b6daf04 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 22 Jun 2021 20:05:00 +0100 Subject: [PATCH 386/520] Moved XUD_STARTUP_ADDRESS after xud_conf.h inclusion --- lib_xud/api/xud.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_xud/api/xud.h b/lib_xud/api/xud.h index ca9a2107..d5517d84 100644 --- a/lib_xud/api/xud.h +++ b/lib_xud/api/xud.h @@ -15,14 +15,14 @@ #define XUD_OPT_SOFTCRC5 (0) #endif -#ifndef XUD_STARTUP_ADDRESS -#define XUD_STARTUP_ADDRESS (0) -#endif - #ifdef __xud_conf_h_exists__ #include "xud_conf.h" #endif +#ifndef XUD_STARTUP_ADDRESS +#define XUD_STARTUP_ADDRESS (0) +#endif + #ifndef __ASSEMBLER__ #include From 763fccb89814685fb02af0be337a64933fbb7148 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 22 Jun 2021 20:05:50 +0100 Subject: [PATCH 387/520] Rough addition of passing test parameters to build of test app --- tests/Pyxsim/__init__.py | 4 +++- tests/conftest.py | 8 +++++--- tests/helpers.py | 15 +++++++++++---- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/tests/Pyxsim/__init__.py b/tests/Pyxsim/__init__.py index 94e96c68..6a607fc6 100644 --- a/tests/Pyxsim/__init__.py +++ b/tests/Pyxsim/__init__.py @@ -17,7 +17,7 @@ clean_only = False # This function is called automatically by the runners -def _build(xe_path, build_config=None, env={}, do_clean=False): +def _build(xe_path, build_config=None, env={}, do_clean=False, build_options=""): # Work out the Makefile path path = None @@ -51,6 +51,8 @@ def _build(xe_path, build_config=None, env={}, do_clean=False): if build_config != None: cmd += ["CONFIG=%s" % build_config] + cmd += [build_options] + output = call_get_output(cmd, cwd=path, env=my_env, merge_out_and_err=True) success = True diff --git a/tests/conftest.py b/tests/conftest.py index df1e9a37..ec333f82 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -12,14 +12,14 @@ PARAMS = { "default": { "arch": ["xs3"], - "ep": [0, 1, 15], + "ep": [1, 2, 5], "address": [0, 1, 127], "bus_speed": ["HS", "FS"], }, "smoke": { "arch": ["xs3"], "ep": [1], - "address": [1], + "address": [0], "bus_speed": ["HS", "FS"], }, } @@ -81,9 +81,11 @@ def test_RunUsbSession(test_session, arch, ep, address, bus_speed, test_file): tester_list.extend( do_usb_test( arch, + ep, + address, + bus_speed, clk_60, usb_phy, - bus_speed, [test_session], test_file, seed, diff --git a/tests/helpers.py b/tests/helpers.py index c0208254..36debbdc 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -123,9 +123,11 @@ def run_on(**kwargs): def do_usb_test( arch, + ep, + address, + bus_speed, clk, phy, - usb_speed, sessions, test_file, seed, @@ -134,6 +136,11 @@ def do_usb_test( verbose=False, ): + # TODO ideally the test would test this somehow + build_options = ( + "CFLAGS=-DTEST_EP_NUM=" + str(ep) + " -DXUD_STARTUP_ADDRESS=" + str(address) + ) + """Shared test code for all RX tests using the test_rx application.""" testname, extension = os.path.splitext(os.path.basename(test_file)) tester_list = [] @@ -142,7 +149,7 @@ def do_usb_test( testname=testname, arch=arch ) copy_common_xn_files(testname) - build_success, build_output = Pyxsim._build(binary) + build_success, build_output = Pyxsim._build(binary, build_options=build_options) assert len(sessions) == 1, "Multiple sessions not yet supported" if build_success: @@ -157,7 +164,7 @@ def do_usb_test( phy=phy.name, clk=clk.get_name(), arch=arch, - usb_speed=usb_speed, + usb_speed=bus_speed, ) create_expect(arch, session, expect_filename, verbose=verbose) @@ -167,7 +174,7 @@ def do_usb_test( "lib_xud", "xud_sim_tests", testname, - {"clk": clk.get_name(), "arch": arch, "speed": usb_speed}, + {"clk": clk.get_name(), "arch": arch, "speed": bus_speed}, ) tester_list.append(tester) From db003b0263c168e70f7492441f5215d07a4c9590 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 22 Jun 2021 20:06:09 +0100 Subject: [PATCH 388/520] Added CFLAGS to test makefile --- tests/test_makefile.mak | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_makefile.mak b/tests/test_makefile.mak index f991970a..ce51f142 100644 --- a/tests/test_makefile.mak +++ b/tests/test_makefile.mak @@ -27,10 +27,10 @@ COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -X -Wno-timing \ -DXUD_SIM_XSIM=1 \ -DXUD_TEST_SPEED_HS=1 \ - -DXUD_STARTUP_ADDRESS=1 + $(CFLAGS) #TODO RM ARCH_L define -XCC_FLAGS_xs2 = $(TEST_FLAGS) $(COMMON_FLAGS) -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -DARCH_L +#XCC_FLAGS_xs2 = $(TEST_FLAGS) $(COMMON_FLAGS) -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -DARCH_L XCC_FLAGS_xs3 = $(TEST_FLAGS) $(COMMON_FLAGS) From cc989e089a0ef091d68569a309b6554f86aae5c0 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 22 Jun 2021 20:06:43 +0100 Subject: [PATCH 389/520] Updated test_bulk_tx_basic and test_bulk_rx_basic to use test params --- tests/shared_src/shared.h | 4 ++- tests/test_bulk_rx_basic.py | 2 -- tests/test_bulk_rx_basic/src/main.xc | 34 +++++++++------------ tests/test_bulk_tx_basic.py | 2 -- tests/test_bulk_tx_basic/src/main.xc | 44 +++++++++++----------------- 5 files changed, 34 insertions(+), 52 deletions(-) diff --git a/tests/shared_src/shared.h b/tests/shared_src/shared.h index eaa06a12..d3da9063 100644 --- a/tests/shared_src/shared.h +++ b/tests/shared_src/shared.h @@ -1,5 +1,7 @@ // Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. +#ifndef _SHARED_H_ +#define _SHARED_H_ #include #include #include @@ -216,4 +218,4 @@ void dummyThreads(chanend c[]) dummyThread(c[i]); } } - +#endif diff --git a/tests/test_bulk_rx_basic.py b/tests/test_bulk_rx_basic.py index f150554c..c72f8990 100644 --- a/tests/test_bulk_rx_basic.py +++ b/tests/test_bulk_rx_basic.py @@ -10,8 +10,6 @@ @pytest.fixture def test_session(ep, address, bus_speed): - ep = 1 - address = 1 start_length = 10 end_length = 19 diff --git a/tests/test_bulk_rx_basic/src/main.xc b/tests/test_bulk_rx_basic/src/main.xc index e2f8be4c..ef2188db 100644 --- a/tests/test_bulk_rx_basic/src/main.xc +++ b/tests/test_bulk_rx_basic/src/main.xc @@ -1,30 +1,25 @@ // Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -#include -#include -#include -#include "xud.h" -#include "platform.h" #include "shared.h" -#define XUD_EP_COUNT_OUT 5 -#define XUD_EP_COUNT_IN 5 +#define EP_COUNT_OUT (6) +#define EP_COUNT_IN (6) #ifndef PKT_LENGTH_START -#define PKT_LENGTH_START 10 +#define PKT_LENGTH_START (10) #endif #ifndef PKT_LENGTH_END -#define PKT_LENGTH_END 19 +#define PKT_LENGTH_END (19) #endif #ifndef TEST_EP_NUM -#define TEST_EP_NUM 1 +#define TEST_EP_NUM (1) #endif /* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; +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}; #ifdef XUD_SIM_RTL int testmain() @@ -32,26 +27,25 @@ int testmain() int main() #endif { - chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; par { { - #if defined(XUD_TEST_SPEED_FS) +#if defined(XUD_TEST_SPEED_FS) unsigned speed = XUD_SPEED_FS; - #elif defined(XUD_TEST_SPEED_HS) +#elif defined(XUD_TEST_SPEED_HS) unsigned speed = XUD_SPEED_HS; - #else - #error XUD_TEST_SPEED_XX not defined - #endif +#else +#error XUD_TEST_SPEED_XX not defined +#endif - XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, speed, XUD_PWR_BUS); } { unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); - XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); XUD_Kill(ep0); diff --git a/tests/test_bulk_tx_basic.py b/tests/test_bulk_tx_basic.py index 405d993f..27e134ed 100644 --- a/tests/test_bulk_tx_basic.py +++ b/tests/test_bulk_tx_basic.py @@ -10,8 +10,6 @@ @pytest.fixture def test_session(ep, address, bus_speed): - ep = 1 - address = 1 start_length = 10 end_length = 19 diff --git a/tests/test_bulk_tx_basic/src/main.xc b/tests/test_bulk_tx_basic/src/main.xc index 790674ec..7a4e24ae 100644 --- a/tests/test_bulk_tx_basic/src/main.xc +++ b/tests/test_bulk_tx_basic/src/main.xc @@ -1,44 +1,35 @@ // Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -/* - * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent - * in both directions between the ports. - * - * NOTE: The src/testbenches/ExampleTestbench must have been compiled for this to run without error. - * - */ -#include -#include -#include -#include "xud.h" -#include "platform.h" -#include "xc_ptr.h" #include "shared.h" #ifndef TEST_EP_NUM -#define TEST_EP_NUM 1 +#define TEST_EP_NUM (1) #endif #ifndef PKT_LENGTH_START -#define PKT_LENGTH_START 10 +#define PKT_LENGTH_START (10) #endif #ifndef PKT_LENGTH_END -#define PKT_LENGTH_END 19 +#define PKT_LENGTH_END (19) #endif -#define XUD_EP_COUNT_OUT 4 -#define XUD_EP_COUNT_IN 4 +#define EP_COUNT_OUT (6) +#define EP_COUNT_IN (6) /* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, +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[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, +XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, + XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, - XUD_EPTYPE_ISO}; + XUD_EPTYPE_BUL, + XUD_EPTYPE_BUL}; #ifdef XUD_SIM_RTL int testmain() @@ -46,19 +37,18 @@ int testmain() int main() #endif { - chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; par { { - #if defined(XUD_TEST_SPEED_FS) +#if defined(XUD_TEST_SPEED_FS) unsigned speed = XUD_SPEED_FS; - #elif defined(XUD_TEST_SPEED_HS) +#elif defined(XUD_TEST_SPEED_HS) unsigned speed = XUD_SPEED_HS; - #endif +#endif - // TODO test is running at 400MHz - XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, speed, XUD_PWR_BUS); } From c700cfd8b35b3ac2a41c5478300dfe580b16053c Mon Sep 17 00:00:00 2001 From: Kevin Yeung Date: Wed, 23 Jun 2021 10:22:18 +0800 Subject: [PATCH 390/520] redirect stderr --- tests/Pyxsim/__init__.py | 11 ++++++++--- tests/conftest.py | 4 +++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/Pyxsim/__init__.py b/tests/Pyxsim/__init__.py index 94e96c68..7e07ae62 100644 --- a/tests/Pyxsim/__init__.py +++ b/tests/Pyxsim/__init__.py @@ -120,15 +120,20 @@ def run_tester(caps, tester_list): class cap_redirect: def __init__(self): (self.fd, self.fname) = tempfile.mkstemp() - self.old_std = os.fdopen(os.dup(sys.stdout.fileno()), "w") + (self.fderr, self.errfname) = tempfile.mkstemp() + self.old_stdout = os.fdopen(os.dup(sys.stdout.fileno()), "w") + self.old_stderr = os.fdopen(os.dup(sys.stderr.fileno()), "w") sys.stdout = os.fdopen(self.fd, "w") + sys.stderr = os.fdopen(self.fderr, "w") def read_output(self): std_reader = open(self.fname, "r") - return std_reader.read() + std_erreader = open(self.errfname, "r") + return std_reader.read(), std_erreader.read() def close_capture(self): - sys.stdout = self.old_std + sys.stdout = self.old_stdout + sys.stderr = self.old_stderr class SimThread(object): diff --git a/tests/conftest.py b/tests/conftest.py index 32b77d96..d7fb0367 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -73,9 +73,11 @@ def test_RunUsbSession(test_session, arch, ep, address, bus_speed, test_file): seed, ) ) - cap_output = start_cap.read_output() + cap_output, cap_error = start_cap.read_output() start_cap.close_capture() output.append(cap_output.split("\n")) + print("error is :") + print(cap_error) sys.stdout.write("\n") results = Pyxsim.run_tester(output, tester_list) From bc94140a36a4af489327d27920edc68e67698ef2 Mon Sep 17 00:00:00 2001 From: Kevin Yeung Date: Wed, 23 Jun 2021 14:02:56 +0800 Subject: [PATCH 391/520] fixed missing capturing --- tests/Pyxsim/__init__.py | 18 ++++++++---------- tests/conftest.py | 7 +++---- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/tests/Pyxsim/__init__.py b/tests/Pyxsim/__init__.py index 7e07ae62..e544647e 100644 --- a/tests/Pyxsim/__init__.py +++ b/tests/Pyxsim/__init__.py @@ -118,22 +118,20 @@ def run_tester(caps, tester_list): class cap_redirect: - def __init__(self): + def __init__(self, std): (self.fd, self.fname) = tempfile.mkstemp() - (self.fderr, self.errfname) = tempfile.mkstemp() - self.old_stdout = os.fdopen(os.dup(sys.stdout.fileno()), "w") - self.old_stderr = os.fdopen(os.dup(sys.stderr.fileno()), "w") + fd_std = std.fileno() + self.old_std = os.fdopen(os.dup(fd_std), "w") + self.std_reader = open(self.fname, "r") + os.dup2(self.fd, fd_std) sys.stdout = os.fdopen(self.fd, "w") - sys.stderr = os.fdopen(self.fderr, "w") def read_output(self): - std_reader = open(self.fname, "r") - std_erreader = open(self.errfname, "r") - return std_reader.read(), std_erreader.read() + # std_reader = open(self.fname, "r") + return self.std_reader.read() def close_capture(self): - sys.stdout = self.old_stdout - sys.stderr = self.old_stderr + sys.stdout = self.old_std class SimThread(object): diff --git a/tests/conftest.py b/tests/conftest.py index d7fb0367..0dbf3632 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -9,6 +9,7 @@ from Pyxsim import testers from helpers import get_usb_clk_phy, do_usb_test import inspect +import time PARAMS = { "default": { @@ -61,7 +62,7 @@ def test_RunUsbSession(test_session, arch, ep, address, bus_speed, test_file): seed = random.randint(0, sys.maxsize) (clk_60, usb_phy) = get_usb_clk_phy(verbose=False, arch=arch) - start_cap = Pyxsim.cap_redirect() + start_cap = Pyxsim.cap_redirect(sys.stdout) tester_list.extend( do_usb_test( arch, @@ -73,11 +74,9 @@ def test_RunUsbSession(test_session, arch, ep, address, bus_speed, test_file): seed, ) ) - cap_output, cap_error = start_cap.read_output() + cap_output = start_cap.read_output() start_cap.close_capture() output.append(cap_output.split("\n")) - print("error is :") - print(cap_error) sys.stdout.write("\n") results = Pyxsim.run_tester(output, tester_list) From a7f66e54a20677297febdd8a133ba4f0877c0c15 Mon Sep 17 00:00:00 2001 From: Kevin Yeung Date: Wed, 23 Jun 2021 14:11:02 +0800 Subject: [PATCH 392/520] removed comment and import --- tests/Pyxsim/__init__.py | 1 - tests/conftest.py | 1 - 2 files changed, 2 deletions(-) diff --git a/tests/Pyxsim/__init__.py b/tests/Pyxsim/__init__.py index e544647e..f047e1e8 100644 --- a/tests/Pyxsim/__init__.py +++ b/tests/Pyxsim/__init__.py @@ -127,7 +127,6 @@ def __init__(self, std): sys.stdout = os.fdopen(self.fd, "w") def read_output(self): - # std_reader = open(self.fname, "r") return self.std_reader.read() def close_capture(self): diff --git a/tests/conftest.py b/tests/conftest.py index 0dbf3632..977af70c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -9,7 +9,6 @@ from Pyxsim import testers from helpers import get_usb_clk_phy, do_usb_test import inspect -import time PARAMS = { "default": { From 6a9e95b951e9f48f63fc7f6004c5ff735c97d651 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 23 Jun 2021 11:44:02 +0100 Subject: [PATCH 393/520] Removed old test header --- tests/test_bulk_loopback/src/xc_ptr.h | 48 ------------------- tests/test_bulk_rx_basic_badpid/src/xc_ptr.h | 48 ------------------- tests/test_bulk_rx_basic_rxerror/src/xc_ptr.h | 48 ------------------- 3 files changed, 144 deletions(-) delete mode 100644 tests/test_bulk_loopback/src/xc_ptr.h delete mode 100644 tests/test_bulk_rx_basic_badpid/src/xc_ptr.h delete mode 100644 tests/test_bulk_rx_basic_rxerror/src/xc_ptr.h diff --git a/tests/test_bulk_loopback/src/xc_ptr.h b/tests/test_bulk_loopback/src/xc_ptr.h deleted file mode 100644 index 8fa5a04e..00000000 --- a/tests/test_bulk_loopback/src/xc_ptr.h +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2016-2021 XMOS LIMITED. -// This Software is subject to the terms of the XMOS Public Licence: Version 1. -#ifndef __xc_ptr__ -#define __xc_ptr__ - -typedef unsigned int xc_ptr; - -// Note that this function is marked as const to avoid the XC -// parallel usage checks, this is only really going to work if this -// is the *only* way the array a is accessed (and everything else uses -// the xc_ptr) -inline xc_ptr array_to_xc_ptr(const unsigned a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -inline xc_ptr char_array_to_xc_ptr(const unsigned char a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -#define write_via_xc_ptr_indexed(p,i,x) asm volatile("stw %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_short_via_xc_ptr_indexed(p,i,x) asm volatile("st16 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) - -#define write_via_xc_ptr(p,x) asm volatile("stw %0, %1[0]"::"r"(x),"r"(p)) -// No immediate st8 format -#define write_byte_via_xc_ptr(p,x) write_byte_via_xc_ptr_indexed(p, 0, x) -#define write_short_via_xc_ptr(p,x) write_short_via_xc_ptr_indexed(p, 0, x) - -#define read_via_xc_ptr_indexed(x,p,i) asm("ldw %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_byte_via_xc_ptr_indexed(x,p,i) asm("ld8u %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_short_via_xc_ptr_indexed(x,p,i) asm("ld16s %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); - -#define read_via_xc_ptr(x,p) asm("ldw %0, %1[0]":"=r"(x):"r"(p)); -// No immediate ld8u format -#define read_byte_via_xc_ptr(x,p) read_byte_via_xc_ptr_indexed(x, p, 0) -#define read_short_via_xc_ptr(x,p) read_short_via_xc_ptr_indexed(x, p, 0) - -#define GET_SHARED_GLOBAL(x, g) asm volatile("ldw %0, dp[" #g "]":"=r"(x)::"memory") -#define SET_SHARED_GLOBAL(g, v) asm volatile("stw %0, dp[" #g "]"::"r"(v):"memory") - -#endif diff --git a/tests/test_bulk_rx_basic_badpid/src/xc_ptr.h b/tests/test_bulk_rx_basic_badpid/src/xc_ptr.h deleted file mode 100644 index 8fa5a04e..00000000 --- a/tests/test_bulk_rx_basic_badpid/src/xc_ptr.h +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2016-2021 XMOS LIMITED. -// This Software is subject to the terms of the XMOS Public Licence: Version 1. -#ifndef __xc_ptr__ -#define __xc_ptr__ - -typedef unsigned int xc_ptr; - -// Note that this function is marked as const to avoid the XC -// parallel usage checks, this is only really going to work if this -// is the *only* way the array a is accessed (and everything else uses -// the xc_ptr) -inline xc_ptr array_to_xc_ptr(const unsigned a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -inline xc_ptr char_array_to_xc_ptr(const unsigned char a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -#define write_via_xc_ptr_indexed(p,i,x) asm volatile("stw %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_short_via_xc_ptr_indexed(p,i,x) asm volatile("st16 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) - -#define write_via_xc_ptr(p,x) asm volatile("stw %0, %1[0]"::"r"(x),"r"(p)) -// No immediate st8 format -#define write_byte_via_xc_ptr(p,x) write_byte_via_xc_ptr_indexed(p, 0, x) -#define write_short_via_xc_ptr(p,x) write_short_via_xc_ptr_indexed(p, 0, x) - -#define read_via_xc_ptr_indexed(x,p,i) asm("ldw %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_byte_via_xc_ptr_indexed(x,p,i) asm("ld8u %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_short_via_xc_ptr_indexed(x,p,i) asm("ld16s %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); - -#define read_via_xc_ptr(x,p) asm("ldw %0, %1[0]":"=r"(x):"r"(p)); -// No immediate ld8u format -#define read_byte_via_xc_ptr(x,p) read_byte_via_xc_ptr_indexed(x, p, 0) -#define read_short_via_xc_ptr(x,p) read_short_via_xc_ptr_indexed(x, p, 0) - -#define GET_SHARED_GLOBAL(x, g) asm volatile("ldw %0, dp[" #g "]":"=r"(x)::"memory") -#define SET_SHARED_GLOBAL(g, v) asm volatile("stw %0, dp[" #g "]"::"r"(v):"memory") - -#endif diff --git a/tests/test_bulk_rx_basic_rxerror/src/xc_ptr.h b/tests/test_bulk_rx_basic_rxerror/src/xc_ptr.h deleted file mode 100644 index 8fa5a04e..00000000 --- a/tests/test_bulk_rx_basic_rxerror/src/xc_ptr.h +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2016-2021 XMOS LIMITED. -// This Software is subject to the terms of the XMOS Public Licence: Version 1. -#ifndef __xc_ptr__ -#define __xc_ptr__ - -typedef unsigned int xc_ptr; - -// Note that this function is marked as const to avoid the XC -// parallel usage checks, this is only really going to work if this -// is the *only* way the array a is accessed (and everything else uses -// the xc_ptr) -inline xc_ptr array_to_xc_ptr(const unsigned a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -inline xc_ptr char_array_to_xc_ptr(const unsigned char a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -#define write_via_xc_ptr_indexed(p,i,x) asm volatile("stw %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_short_via_xc_ptr_indexed(p,i,x) asm volatile("st16 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) - -#define write_via_xc_ptr(p,x) asm volatile("stw %0, %1[0]"::"r"(x),"r"(p)) -// No immediate st8 format -#define write_byte_via_xc_ptr(p,x) write_byte_via_xc_ptr_indexed(p, 0, x) -#define write_short_via_xc_ptr(p,x) write_short_via_xc_ptr_indexed(p, 0, x) - -#define read_via_xc_ptr_indexed(x,p,i) asm("ldw %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_byte_via_xc_ptr_indexed(x,p,i) asm("ld8u %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_short_via_xc_ptr_indexed(x,p,i) asm("ld16s %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); - -#define read_via_xc_ptr(x,p) asm("ldw %0, %1[0]":"=r"(x):"r"(p)); -// No immediate ld8u format -#define read_byte_via_xc_ptr(x,p) read_byte_via_xc_ptr_indexed(x, p, 0) -#define read_short_via_xc_ptr(x,p) read_short_via_xc_ptr_indexed(x, p, 0) - -#define GET_SHARED_GLOBAL(x, g) asm volatile("ldw %0, dp[" #g "]":"=r"(x)::"memory") -#define SET_SHARED_GLOBAL(g, v) asm volatile("stw %0, dp[" #g "]"::"r"(v):"memory") - -#endif From 96987ee6119f5d1625186a1c7ba631cfb3893fff Mon Sep 17 00:00:00 2001 From: Dave Atkinson Date: Thu, 24 Jun 2021 11:02:31 +0100 Subject: [PATCH 394/520] Speed up crc calculations in usb_packet.py --- tests/usb_packet.py | 69 +++++++++++++++------------------------------ 1 file changed, 23 insertions(+), 46 deletions(-) diff --git a/tests/usb_packet.py b/tests/usb_packet.py index eecf93b3..2531622b 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -120,59 +120,38 @@ def reflect(val, numBits): return valRef -def GenCrc16(args): - - data = args - +def GenCrc16(data: bytes): + poly = 0xA001 crc = 0xFFFF - poly = 0x8005 - - for byte in data: - topBit = 1 << 15 - crc ^= reflect(int(byte) & int(0xFF), 8) << 8 - - for k in range(0, 8): - if crc & topBit: - crc = (crc << 1) ^ poly + for b in data: + crc ^= 0xFF & b + for _ in range(0, 8): + if crc & 0x0001: + crc = (crc >> 1) ^ poly else: - crc <<= 1 + crc >>= 1 - # //crc = crc ^0xffff; - crc = reflect(crc, 16) - crc = ~crc - crc = crc & 0xFFFF - # print "CRC: : {0:#x}".format(crc) - return crc + return crc ^ 0xFFFF def GenCrc5(args): - intSize = 32 - elevenBits = args - - poly5 = 0x05 << (intSize - 5) - crc5 = 0x1F << (intSize - 5) - udata = elevenBits << (intSize - 11) - # crc over 11 bits - - iBitcnt = 11 - - while iBitcnt > 0: - if (udata ^ crc5) & (0x1 << (intSize - 1)): # bit4 != bit4? - crc5 <<= 1 - crc5 ^= poly5 + poly = 0x14 + crc = 0x1F + n = args & 0x7FF + i = 11 + + while i > 0: + if (n ^ crc) & 1: + crc = (crc >> 1) ^ poly else: - crc5 <<= 1 - udata <<= 1 - iBitcnt = iBitcnt - 1 - - # Shift back into position - crc5 >>= intSize - 5 + crc >>= 1 + i -= 1 + n >>= 1 # Invert contents to generate crc field - crc5 ^= 0x1F + crc ^= 0x1F - crc5 = reflect(crc5, 5) - return crc5 + return crc # Functions for creating the data contents of packets @@ -527,9 +506,7 @@ def __init__(self, **kwargs): self.address = kwargs.pop("address", 0) # Generate correct crc5 - crc5 = GenCrc5( - reflect(((self.endpoint & 0xF) << 7) | ((self.address & 0x7F) << 0), 11) - ) + crc5 = GenCrc5(((self.endpoint & 0xF) << 7) | ((self.address & 0x7F) << 0)) # Correct crc5 can be overridden self.crc5 = kwargs.pop("crc5", crc5) From 78b4151c6373db082e523476902c10d7bbe94e62 Mon Sep 17 00:00:00 2001 From: Dave Atkinson Date: Thu, 24 Jun 2021 11:18:01 +0100 Subject: [PATCH 395/520] Fix some DeprecationWarning messages. --- tests/Pyxsim/__init__.py | 2 +- tests/Pyxsim/pyxsim.py | 6 +++--- tests/Pyxsim/xe.py | 2 +- tests/Pyxsim/xmostest_subprocess.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/Pyxsim/__init__.py b/tests/Pyxsim/__init__.py index f047e1e8..45ce9ce1 100644 --- a/tests/Pyxsim/__init__.py +++ b/tests/Pyxsim/__init__.py @@ -60,7 +60,7 @@ def _build(xe_path, build_config=None, env={}, do_clean=False): # if x.find('Error') != -1: success = False # if re.match('xmake: \*\*\* .* Stop.', x) != None: - if re.match("xmake: \*\*\* .* Stop.", s) != None: + if re.match(r"xmake: \*\*\* .* Stop.", s) != None: success = False if not success: diff --git a/tests/Pyxsim/pyxsim.py b/tests/Pyxsim/pyxsim.py index e9306acc..6972a3c4 100644 --- a/tests/Pyxsim/pyxsim.py +++ b/tests/Pyxsim/pyxsim.py @@ -26,14 +26,14 @@ def xsi_is_valid_port(port): - return re.match("XS1_PORT_\d+\w", port) != None + return re.match(r"XS1_PORT_\d+\w", port) != None def xsi_get_port_width(port): if not xsi_is_valid_port(port): return None else: - return int(re.match("^XS1_PORT_(\d+)\w", port).groups(0)[0]) + return int(re.match(r"^XS1_PORT_(\d+)\w", port).groups(0)[0]) class EnumExceptionSet: @@ -85,7 +85,7 @@ def error(self, value): def parse_port(p): - m = re.match("(tile.*)\:([^\.]*)\.?(\d*)", p) + m = re.match(r"(tile.*)\:([^\.]*)\.?(\d*)", p) if m: tile = m.groups(0)[0] port = m.groups(0)[1] diff --git a/tests/Pyxsim/xe.py b/tests/Pyxsim/xe.py index 5f3c056d..1a3dc866 100644 --- a/tests/Pyxsim/xe.py +++ b/tests/Pyxsim/xe.py @@ -48,7 +48,7 @@ def _get_platform_info(self): self._port_map[port].append((package, pin, bitnum)) def get_port_pins(self, port): - m = re.match("([^\.]*)\.(\d*)", port) + m = re.match(r"([^\.]*)\.(\d*)", port) if m: port = m.groups(0)[0] bit = int(m.groups(0)[1]) diff --git a/tests/Pyxsim/xmostest_subprocess.py b/tests/Pyxsim/xmostest_subprocess.py index 130915ae..110b3981 100644 --- a/tests/Pyxsim/xmostest_subprocess.py +++ b/tests/Pyxsim/xmostest_subprocess.py @@ -97,7 +97,7 @@ def platform_is_windows(): def quote_string(s): """For Windows need to put quotes around arguments with spaces in them""" - if re.search("\s", s): + if re.search(r"\s", s): return '"%s"' % s else: return s From 7a41c22df8ab611fceca2b191e5ba77a716eafaa Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 24 Jun 2021 11:29:19 +0100 Subject: [PATCH 396/520] Fixes to tests after parameratisation --- tests/conftest.py | 2 +- tests/helpers.py | 1 + tests/test_bulk_loopback.py | 8 +-- tests/test_bulk_loopback/src/main.xc | 38 ++++++-------- tests/test_bulk_rx_basic_badcrc32.py | 3 -- tests/test_bulk_rx_basic_badcrc32/src/main.xc | 25 ++++----- tests/test_bulk_rx_basic_badpid.py | 3 -- tests/test_bulk_rx_basic_badpid/src/main.xc | 35 +++++-------- tests/test_bulk_rx_basic_nodata.py | 8 --- tests/test_bulk_rx_basic_nodata/src/main.xc | 35 +++++-------- tests/test_bulk_rx_basic_rxerror.py | 7 --- tests/test_bulk_rx_basic_rxerror/src/main.xc | 33 +++++------- tests/test_bulk_rx_multiep.py | 14 +++-- tests/test_bulk_rx_multiep/src/main.xc | 42 +++++++-------- tests/test_bulk_rx_traffic.py | 25 +++++---- tests/test_bulk_rx_traffic/src/main.xc | 30 +++++------ tests/test_bulk_tx_badack.py | 8 --- tests/test_bulk_tx_badack/src/main.xc | 46 ++++++----------- tests/test_bulk_tx_basic_short.py | 2 - tests/test_bulk_tx_basic_short/src/main.xc | 43 +++++----------- tests/test_bulk_tx_multiep.py | 8 ++- tests/test_bulk_tx_noack.py | 3 -- tests/test_bulk_tx_noack/src/main.xc | 46 ++++++----------- tests/test_control_basic_get.py | 8 ++- tests/test_control_basic_get/src/main.xc | 30 +++-------- tests/test_control_basic_set.py | 8 ++- tests/test_control_basic_set/src/main.xc | 27 +++------- tests/test_device_attach.py | 9 ++-- tests/test_invalidtoken.py | 11 +--- tests/test_invalidtoken/src/main.xc | 48 ++++++++--------- tests/test_iso_loopback.py | 15 ++---- tests/test_iso_loopback/src/main.xc | 31 ++++------- tests/test_iso_loopback/src/xc_ptr.h | 48 ----------------- tests/test_iso_rx_basic.py | 8 --- tests/test_iso_rx_basic/src/main.xc | 51 +++++++++---------- tests/test_iso_rxtx_fastpacket.py | 8 --- tests/test_iso_rxtx_fastpacket/src/main.xc | 33 ++++-------- tests/test_iso_tx_basic.py | 2 - tests/test_iso_tx_basic/src/main.xc | 47 ++++++++--------- tests/test_iso_tx_basic/src/xc_ptr.h | 48 ----------------- tests/test_ping_rx_basic.py | 34 +++++-------- tests/test_ping_rx_basic/src/main.xc | 36 ++++++------- 42 files changed, 326 insertions(+), 641 deletions(-) delete mode 100644 tests/test_iso_loopback/src/xc_ptr.h delete mode 100644 tests/test_iso_tx_basic/src/xc_ptr.h diff --git a/tests/conftest.py b/tests/conftest.py index 49c2e95a..b08a385b 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -12,7 +12,7 @@ PARAMS = { "default": { "arch": ["xs3"], - "ep": [1, 2, 5], + "ep": [1, 2, 4], "address": [0, 1, 127], "bus_speed": ["HS", "FS"], }, diff --git a/tests/helpers.py b/tests/helpers.py index 36debbdc..051e99ff 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -137,6 +137,7 @@ def do_usb_test( ): # TODO ideally the test would test this somehow + # TODO use dictionary to convert pytest params to defines build_options = ( "CFLAGS=-DTEST_EP_NUM=" + str(ep) + " -DXUD_STARTUP_ADDRESS=" + str(address) ) diff --git a/tests/test_bulk_loopback.py b/tests/test_bulk_loopback.py index 202bb9f1..d5f9765f 100644 --- a/tests/test_bulk_loopback.py +++ b/tests/test_bulk_loopback.py @@ -9,11 +9,13 @@ @pytest.fixture def test_session(ep, address, bus_speed): - ep_loopback = 3 - ep_loopback_kill = 2 - address = 1 + + ep_loopback = ep + ep_loopback_kill = ep + 1 + start_length = 10 end_length = 20 + session = UsbSession( bus_speed=bus_speed, run_enumeration=False, device_address=address ) diff --git a/tests/test_bulk_loopback/src/main.xc b/tests/test_bulk_loopback/src/main.xc index 51da49df..5131b589 100644 --- a/tests/test_bulk_loopback/src/main.xc +++ b/tests/test_bulk_loopback/src/main.xc @@ -1,26 +1,21 @@ // Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. + /* lib_xud simple bulk loopback test */ -#include -#include -#include -#include "xud.h" -#include "platform.h" -#include "xc_ptr.h" +#include "shared.h" -#define XUD_EP_COUNT_OUT 5 -#define XUD_EP_COUNT_IN 5 +#define EP_COUNT_OUT (6) +#define EP_COUNT_IN (6) /* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; - -void exit(int); +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 char g_rxDataCheck[5] = {0, 0, 0, 0, 0}; -unsigned char g_txDataCheck[5] = {0,0,0,0,0,}; -unsigned g_txLength[5] = {0,0,0,0,0}; +#define KILL_EP (TEST_EP_NUM + 1) +#if (KILL_EP >= EP_COUNT_OUT) || (KILL_EP >= EP_COUNT_IN) +#error KILL EP OUT OF RANGE +#endif /* Loopback packets forever */ #pragma unsafe arrays @@ -43,10 +38,9 @@ int TestEp_Bulk(chanend c_out1, chanend c_in1) XUD_GetBuffer(ep_out1, buffer, length); XUD_SetBuffer(ep_in1, buffer, length); } - } -/* Loopback packet and terminate */ +/* Loopback packet and terminate program */ #pragma unsafe arrays int TestEp_Bulk2(chanend c_out, chanend c_in, chanend c_out_0) { @@ -68,22 +62,20 @@ int TestEp_Bulk2(chanend c_out, chanend c_in, chanend c_out_0) exit(0); } -#define USB_CORE 0 int main() { - chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; chan c_sync; chan c_sync_iso; par { - - XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main( c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); - TestEp_Bulk(c_ep_out[3], c_ep_in[3]); - TestEp_Bulk2(c_ep_out[2], c_ep_in[2], c_ep_out[0]); + TestEp_Bulk(c_ep_out[TEST_EP_NUM], c_ep_in[TEST_EP_NUM]); + TestEp_Bulk2(c_ep_out[KILL_EP], c_ep_in[KILL_EP], c_ep_out[0]); } return 0; diff --git a/tests/test_bulk_rx_basic_badcrc32.py b/tests/test_bulk_rx_basic_badcrc32.py index 61f715d0..a72a1b8d 100644 --- a/tests/test_bulk_rx_basic_badcrc32.py +++ b/tests/test_bulk_rx_basic_badcrc32.py @@ -10,9 +10,6 @@ @pytest.fixture def test_session(ep, address, bus_speed): - address = 1 - ep = 1 - # The large inter-event delays are to give the DUT time to do checking on the fly session = UsbSession( diff --git a/tests/test_bulk_rx_basic_badcrc32/src/main.xc b/tests/test_bulk_rx_basic_badcrc32/src/main.xc index 071d7a93..f93e713a 100644 --- a/tests/test_bulk_rx_basic_badcrc32/src/main.xc +++ b/tests/test_bulk_rx_basic_badcrc32/src/main.xc @@ -1,28 +1,23 @@ // Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -#include -#include -#include -#include "xud.h" -#include "platform.h" #include "shared.h" -#define XUD_EP_COUNT_OUT 5 -#define XUD_EP_COUNT_IN 5 - -#define TEST_EP_NUM (1) +#define EP_COUNT_OUT (6) +#define EP_COUNT_IN (6) /* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, +XUD_EpType epTypeTableOut[EP_COUNT_OUT] = {XUD_EPTYPE_CTL, + XUD_EPTYPE_BUL, + XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, - XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, +XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, + XUD_EPTYPE_BUL, + XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, - XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; @@ -61,12 +56,12 @@ int TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_out_0) int main() { - chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; par { - XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); unsafe { diff --git a/tests/test_bulk_rx_basic_badpid.py b/tests/test_bulk_rx_basic_badpid.py index d53c2cda..ac43b9f6 100644 --- a/tests/test_bulk_rx_basic_badpid.py +++ b/tests/test_bulk_rx_basic_badpid.py @@ -10,9 +10,6 @@ @pytest.fixture def test_session(ep, address, bus_speed): - address = 1 - ep = 1 - session = UsbSession( bus_speed=bus_speed, run_enumeration=False, device_address=address ) diff --git a/tests/test_bulk_rx_basic_badpid/src/main.xc b/tests/test_bulk_rx_basic_badpid/src/main.xc index f838ab56..941b8179 100644 --- a/tests/test_bulk_rx_basic_badpid/src/main.xc +++ b/tests/test_bulk_rx_basic_badpid/src/main.xc @@ -1,30 +1,21 @@ // Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -#include -#include -#include -#include "xud.h" -#include "platform.h" #include "shared.h" -#define XUD_EP_COUNT_OUT 5 -#define XUD_EP_COUNT_IN 5 +#define EP_COUNT_OUT (6) +#define EP_COUNT_IN (6) #ifndef PKT_LENGTH_START -#define PKT_LENGTH_START 10 +#define PKT_LENGTH_START (10) #endif #ifndef PKT_LENGTH_END -#define PKT_LENGTH_END 14 -#endif - -#ifndef TEST_EP_NUM -#define TEST_EP_NUM 1 +#define PKT_LENGTH_END (14) #endif /* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; +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}; #ifdef XUD_SIM_RTL int testmain() @@ -32,20 +23,20 @@ int testmain() int main() #endif { - chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; par { { - #if defined(XUD_TEST_SPEED_FS) +#if defined(XUD_TEST_SPEED_FS) unsigned speed = XUD_SPEED_FS; - #elif defined(XUD_TEST_SPEED_HS) +#elif defined(XUD_TEST_SPEED_HS) unsigned speed = XUD_SPEED_HS; - #else - #error XUD_TEST_SPEED_XX not defined - #endif +#else +#error XUD_TEST_SPEED_XX not defined +#endif - XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, speed, XUD_PWR_BUS); } diff --git a/tests/test_bulk_rx_basic_nodata.py b/tests/test_bulk_rx_basic_nodata.py index 426350e2..679acfaf 100644 --- a/tests/test_bulk_rx_basic_nodata.py +++ b/tests/test_bulk_rx_basic_nodata.py @@ -8,18 +8,10 @@ # Rx out of seq (but valid.. ) data PID -# TODO Can this be moved? -@pytest.fixture -def test_file(): - return __file__ - @pytest.fixture def test_session(ep, address, bus_speed): - address = 1 - ep = 1 - # The large inter-event delay is to give the DUT time to perform checking ied = 500 diff --git a/tests/test_bulk_rx_basic_nodata/src/main.xc b/tests/test_bulk_rx_basic_nodata/src/main.xc index 011ac110..c308a1d4 100644 --- a/tests/test_bulk_rx_basic_nodata/src/main.xc +++ b/tests/test_bulk_rx_basic_nodata/src/main.xc @@ -1,30 +1,21 @@ // Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -#include -#include -#include -#include "xud.h" -#include "platform.h" #include "shared.h" -#define XUD_EP_COUNT_OUT 5 -#define XUD_EP_COUNT_IN 5 +#define EP_COUNT_OUT (6) +#define EP_COUNT_IN (6) #ifndef PKT_LENGTH_START -#define PKT_LENGTH_START 10 +#define PKT_LENGTH_START (10) #endif #ifndef PKT_LENGTH_END -#define PKT_LENGTH_END 14 -#endif - -#ifndef TEST_EP_NUM -#define TEST_EP_NUM 1 +#define PKT_LENGTH_END (14) #endif /* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; +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}; #ifdef XUD_SIM_RTL int testmain() @@ -32,20 +23,20 @@ int testmain() int main() #endif { - chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; par { { - #if defined(XUD_TEST_SPEED_FS) +#if defined(XUD_TEST_SPEED_FS) unsigned speed = XUD_SPEED_FS; - #elif defined(XUD_TEST_SPEED_HS) +#elif defined(XUD_TEST_SPEED_HS) unsigned speed = XUD_SPEED_HS; - #else - #error XUD_TEST_SPEED_XX not defined - #endif +#else +#error XUD_TEST_SPEED_XX not defined + #endif - XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, speed, XUD_PWR_BUS); } diff --git a/tests/test_bulk_rx_basic_rxerror.py b/tests/test_bulk_rx_basic_rxerror.py index 1178f738..763278cb 100644 --- a/tests/test_bulk_rx_basic_rxerror.py +++ b/tests/test_bulk_rx_basic_rxerror.py @@ -7,17 +7,10 @@ import pytest from conftest import PARAMS, test_RunUsbSession -# TODO Can this be moved? -@pytest.fixture -def test_file(): - return __file__ - @pytest.fixture def test_session(ep, address, bus_speed): - address = 1 - ep = 1 # Large inter-event delay is to give the DUT time to perform checking ied = 6000 diff --git a/tests/test_bulk_rx_basic_rxerror/src/main.xc b/tests/test_bulk_rx_basic_rxerror/src/main.xc index 87ffcb4c..84357b4b 100644 --- a/tests/test_bulk_rx_basic_rxerror/src/main.xc +++ b/tests/test_bulk_rx_basic_rxerror/src/main.xc @@ -1,14 +1,10 @@ // Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -#include -#include -#include -#include "xud.h" -#include "platform.h" + #include "shared.h" -#define XUD_EP_COUNT_OUT (5) -#define XUD_EP_COUNT_IN (5) +#define EP_COUNT_OUT (6) +#define EP_COUNT_IN (6) #ifndef PKT_LENGTH_START #define PKT_LENGTH_START (10) @@ -18,13 +14,9 @@ #define PKT_LENGTH_END (14) #endif -#ifndef TEST_EP_NUM -#define TEST_EP_NUM (1) -#endif - /* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; +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}; #ifdef XUD_SIM_RTL int testmain() @@ -32,20 +24,20 @@ int testmain() int main() #endif { - chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; par { { - #if defined(XUD_TEST_SPEED_FS) +#if defined(XUD_TEST_SPEED_FS) unsigned speed = XUD_SPEED_FS; - #elif defined(XUD_TEST_SPEED_HS) +#elif defined(XUD_TEST_SPEED_HS) unsigned speed = XUD_SPEED_HS; - #else - #error XUD_TEST_SPEED_XX not defined - #endif +#else +#error XUD_TEST_SPEED_XX not defined +#endif - XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, speed, XUD_PWR_BUS); } @@ -63,6 +55,5 @@ int main() } } - // Unreachable return 0; } diff --git a/tests/test_bulk_rx_multiep.py b/tests/test_bulk_rx_multiep.py index e3e9c43b..631ed722 100644 --- a/tests/test_bulk_rx_multiep.py +++ b/tests/test_bulk_rx_multiep.py @@ -1,22 +1,20 @@ -#!/usr/bin/env python # Copyright 2019-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. from usb_session import UsbSession from usb_transaction import UsbTransaction import pytest from conftest import PARAMS, test_RunUsbSession +from copy import deepcopy -# TODO Can this be moved? -@pytest.fixture -def test_file(): - return __file__ +# EP numbers currently fixed for this test - set in params +PARAMS = deepcopy(PARAMS) +PARAMS["smoke"].update({"ep": [3]}) +PARAMS["default"].update({"ep": [3]}) @pytest.fixture def test_session(ep, address, bus_speed): - address = 1 - session = UsbSession( bus_speed=bus_speed, run_enumeration=False, device_address=address ) @@ -27,7 +25,7 @@ def test_session(ep, address, bus_speed): UsbTransaction( session, deviceAddress=address, - endpointNumber=3, + endpointNumber=ep, endpointType="BULK", direction="OUT", dataLength=pktLength, diff --git a/tests/test_bulk_rx_multiep/src/main.xc b/tests/test_bulk_rx_multiep/src/main.xc index ef7d5631..950eacf1 100644 --- a/tests/test_bulk_rx_multiep/src/main.xc +++ b/tests/test_bulk_rx_multiep/src/main.xc @@ -1,43 +1,43 @@ // Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -/* - * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent - * in both directions between the ports. - * - * NOTE: The src/testbenches/ExampleTestbench must have been compiled for this to run without error. - * - */ -#include -#include -#include -#include "xud.h" -#include "platform.h" #include "shared.h" +#define EP_COUNT_OUT (7) +#define EP_COUNT_IN (7) -#define XUD_EP_COUNT_OUT 7 -#define XUD_EP_COUNT_IN 1 +#define PACKET_LEN_START (10) +#define PACKET_LEN_END (19) -#define PACKET_LEN_START 10 -#define PACKET_LEN_END 19 +/* Check for classes with TEST_EP and traffic EP */ +#if TEST_EP_NUM == 4 +#error +#endif + +#if TEST_EP_NUM == 5 +#error +#endif + +#if TEST_EP_NUM == 6 +#error +#endif /* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL}; +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_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, XUD_EPTYPE_BUL}; int main() { - chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; par { - XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); - TestEp_Rx(c_ep_out[3], 3, PACKET_LEN_START, PACKET_LEN_END); + TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PACKET_LEN_START, PACKET_LEN_END); TestEp_Rx(c_ep_out[4], 4, PACKET_LEN_START, PACKET_LEN_END); TestEp_Rx(c_ep_out[5], 5, PACKET_LEN_START, PACKET_LEN_END); { diff --git a/tests/test_bulk_rx_traffic.py b/tests/test_bulk_rx_traffic.py index dc1bdd75..6c6ce5c4 100644 --- a/tests/test_bulk_rx_traffic.py +++ b/tests/test_bulk_rx_traffic.py @@ -7,11 +7,6 @@ import pytest from conftest import PARAMS, test_RunUsbSession -# TODO Can this be moved? -@pytest.fixture -def test_file(): - return __file__ - @pytest.fixture def test_session(ep, address, bus_speed): @@ -19,12 +14,10 @@ def test_session(ep, address, bus_speed): if bus_speed == "FS": pytest.xfail("Known failure at FS") - ep = 1 - address = 1 ied = 500 - trafficAddress1 = 0 - trafficAddress2 = 127 + trafficAddress1 = (address + 1) % 128 + trafficAddress2 = (address + 127) % 128 trafficEp1 = USB_MAX_EP_ADDRESS trafficEp2 = 0 @@ -71,11 +64,21 @@ def test_session(ep, address, bus_speed): ) trafficEp1 = trafficEp1 - 1 + + # Don't clash with test EP + if trafficEp1 == ep: + trafficEp1 = trafficEp1 - 1 + if trafficEp1 < 0: trafficEp1 = USB_MAX_EP_ADDRESS trafficEp2 + trafficEp2 + 1 - if trafficEp1 > USB_MAX_EP_ADDRESS: - trafficEp1 = 0 + + # Don't clash with test EP + if trafficEp2 == ep: + trafficEp2 = trafficEp1 + 1 + + if trafficEp2 > USB_MAX_EP_ADDRESS: + trafficEp2 = 0 return session diff --git a/tests/test_bulk_rx_traffic/src/main.xc b/tests/test_bulk_rx_traffic/src/main.xc index 12206927..7637be77 100644 --- a/tests/test_bulk_rx_traffic/src/main.xc +++ b/tests/test_bulk_rx_traffic/src/main.xc @@ -1,14 +1,9 @@ // Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -#include -#include -#include -#include "xud.h" -#include "platform.h" #include "shared.h" -#define XUD_EP_COUNT_OUT (5) -#define XUD_EP_COUNT_IN (5) +#define EP_COUNT_OUT (6) +#define EP_COUNT_IN (6) #ifndef PKT_LENGTH_START #define PKT_LENGTH_START (10) @@ -19,12 +14,12 @@ #endif #ifndef TEST_EP_NUM -#define TEST_EP_NUM (1) +#error #endif /* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; +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}; #ifdef XUD_SIM_RTL int testmain() @@ -32,20 +27,20 @@ int testmain() int main() #endif { - chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; par { { - #if defined(XUD_TEST_SPEED_FS) +#if defined(XUD_TEST_SPEED_FS) unsigned speed = XUD_SPEED_FS; - #elif defined(XUD_TEST_SPEED_HS) +#elif defined(XUD_TEST_SPEED_HS) unsigned speed = XUD_SPEED_HS; - #else - #error XUD_TEST_SPEED_XX not defined - #endif +#else +#error XUD_TEST_SPEED_XX not defined +#endif - XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, speed, XUD_PWR_BUS); } @@ -64,6 +59,5 @@ int main() } } - // Unreachable return 0; } diff --git a/tests/test_bulk_tx_badack.py b/tests/test_bulk_tx_badack.py index c563da24..49173cd1 100644 --- a/tests/test_bulk_tx_badack.py +++ b/tests/test_bulk_tx_badack.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. @@ -8,17 +7,10 @@ import pytest from conftest import PARAMS, test_RunUsbSession -# TODO Can this be moved? -@pytest.fixture -def test_file(): - return __file__ - @pytest.fixture def test_session(ep, address, bus_speed): - ep = 1 - address = 1 pktLength = 10 ied = 4000 diff --git a/tests/test_bulk_tx_badack/src/main.xc b/tests/test_bulk_tx_badack/src/main.xc index c64e33ee..0dd033a7 100644 --- a/tests/test_bulk_tx_badack/src/main.xc +++ b/tests/test_bulk_tx_badack/src/main.xc @@ -1,40 +1,28 @@ // Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -/* - * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent - * in both directions between the ports. - * - * NOTE: The src/testbenches/ExampleTestbench must have been compiled for this to run without error. - * - */ -#include -#include -#include -#include "xud.h" -#include "platform.h" #include "shared.h" -#ifndef TEST_EP_NUM -#define TEST_EP_NUM 1 -#endif - #ifndef PKT_LENGTH_START -#define PKT_LENGTH_START 10 +#define PKT_LENGTH_START (10) #endif #ifndef PKT_LENGTH_END -#define PKT_LENGTH_END 13 +#define PKT_LENGTH_END (13) #endif - -#define XUD_EP_COUNT_OUT 4 -#define XUD_EP_COUNT_IN 4 + +#define EP_COUNT_OUT (6) +#define EP_COUNT_IN (6) /* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, +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[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, +XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, + XUD_EPTYPE_BUL, + XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO}; @@ -45,19 +33,17 @@ int testmain() int main() #endif { - chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; par { { - #if defined(XUD_TEST_SPEED_FS) +#if defined(XUD_TEST_SPEED_FS) unsigned speed = XUD_SPEED_FS; - #elif defined(XUD_TEST_SPEED_HS) +#elif defined(XUD_TEST_SPEED_HS) unsigned speed = XUD_SPEED_HS; - #endif - - // TODO test is running at 400MHz - XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, +#endif + XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, speed, XUD_PWR_BUS); } diff --git a/tests/test_bulk_tx_basic_short.py b/tests/test_bulk_tx_basic_short.py index 963c6b46..a5ca6bf0 100644 --- a/tests/test_bulk_tx_basic_short.py +++ b/tests/test_bulk_tx_basic_short.py @@ -9,8 +9,6 @@ @pytest.fixture def test_session(ep, address, bus_speed): - ep = 1 - address = 1 start_length = 0 end_length = 7 diff --git a/tests/test_bulk_tx_basic_short/src/main.xc b/tests/test_bulk_tx_basic_short/src/main.xc index d30636db..b88664e2 100644 --- a/tests/test_bulk_tx_basic_short/src/main.xc +++ b/tests/test_bulk_tx_basic_short/src/main.xc @@ -1,23 +1,7 @@ // Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -/* - * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent - * in both directions between the ports. - * - * NOTE: The src/testbenches/ExampleTestbench must have been compiled for this to run without error. - * - */ -#include -#include -#include -#include "xud.h" -#include "platform.h" #include "shared.h" -#ifndef TEST_EP_NUM -#define TEST_EP_NUM (1) -#endif - #ifndef PKT_LENGTH_START #define PKT_LENGTH_START (0) #endif @@ -26,18 +10,21 @@ #define PKT_LENGTH_END (7) #endif -#define XUD_EP_COUNT_OUT (4) -#define XUD_EP_COUNT_IN (4) +#define EP_COUNT_OUT (6) +#define EP_COUNT_IN (6) -/* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, +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[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, +XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, - XUD_EPTYPE_ISO}; + XUD_EPTYPE_BUL, + XUD_EPTYPE_BUL, + XUD_EPTYPE_BUL}; #ifdef XUD_SIM_RTL int testmain() @@ -45,18 +32,18 @@ int testmain() int main() #endif { - chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; par { { - #if defined(XUD_TEST_SPEED_FS) +#if defined(XUD_TEST_SPEED_FS) unsigned speed = XUD_SPEED_FS; - #elif defined(XUD_TEST_SPEED_HS) +#elif defined(XUD_TEST_SPEED_HS) unsigned speed = XUD_SPEED_HS; - #endif +#endif - XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, speed, XUD_PWR_BUS); } @@ -65,8 +52,6 @@ int main() unsigned fail = TestEp_Tx(c_ep_in[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_DIE); #ifdef XUD_SIM_RTL - /* Note, this test relies on checking at the host side */ - if(fail) TerminateFail(fail); else diff --git a/tests/test_bulk_tx_multiep.py b/tests/test_bulk_tx_multiep.py index 349457f2..b3a3a16f 100644 --- a/tests/test_bulk_tx_multiep.py +++ b/tests/test_bulk_tx_multiep.py @@ -4,13 +4,17 @@ from usb_transaction import UsbTransaction import pytest from conftest import PARAMS, test_RunUsbSession +from copy import deepcopy + +# EP numbers currently fixed for this test - set in params +PARAMS = deepcopy(PARAMS) +for k in PARAMS: + PARAMS[k].update({"ep": [3]}) @pytest.fixture def test_session(ep, address, bus_speed): - ep = 3 # Note this is a starting EP - address = 1 ied = 200 session = UsbSession( diff --git a/tests/test_bulk_tx_noack.py b/tests/test_bulk_tx_noack.py index d52ea3ce..3c265a73 100644 --- a/tests/test_bulk_tx_noack.py +++ b/tests/test_bulk_tx_noack.py @@ -10,9 +10,6 @@ @pytest.fixture def test_session(ep, address, bus_speed): - ep = 1 - address = 1 - # Note, quite big gap to allow checking ied = 4000 diff --git a/tests/test_bulk_tx_noack/src/main.xc b/tests/test_bulk_tx_noack/src/main.xc index c64e33ee..02bb9d72 100644 --- a/tests/test_bulk_tx_noack/src/main.xc +++ b/tests/test_bulk_tx_noack/src/main.xc @@ -1,43 +1,31 @@ // Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -/* - * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent - * in both directions between the ports. - * - * NOTE: The src/testbenches/ExampleTestbench must have been compiled for this to run without error. - * - */ -#include -#include -#include -#include "xud.h" -#include "platform.h" #include "shared.h" -#ifndef TEST_EP_NUM -#define TEST_EP_NUM 1 -#endif - #ifndef PKT_LENGTH_START -#define PKT_LENGTH_START 10 +#define PKT_LENGTH_START (10) #endif #ifndef PKT_LENGTH_END -#define PKT_LENGTH_END 13 +#define PKT_LENGTH_END (13) #endif -#define XUD_EP_COUNT_OUT 4 -#define XUD_EP_COUNT_IN 4 +#define EP_COUNT_OUT (6) +#define EP_COUNT_IN (6) /* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, +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[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, +XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, + XUD_EPTYPE_BUL, + XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, - XUD_EPTYPE_ISO}; + XUD_EPTYPE_BUL}; #ifdef XUD_SIM_RTL int testmain() @@ -45,19 +33,17 @@ int testmain() int main() #endif { - chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; par { { - #if defined(XUD_TEST_SPEED_FS) +#if defined(XUD_TEST_SPEED_FS) unsigned speed = XUD_SPEED_FS; - #elif defined(XUD_TEST_SPEED_HS) +#elif defined(XUD_TEST_SPEED_HS) unsigned speed = XUD_SPEED_HS; - #endif - - // TODO test is running at 400MHz - XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, +#endif + XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, speed, XUD_PWR_BUS); } diff --git a/tests/test_control_basic_get.py b/tests/test_control_basic_get.py index c59af5af..86cb4b1c 100644 --- a/tests/test_control_basic_get.py +++ b/tests/test_control_basic_get.py @@ -12,13 +12,17 @@ from usb_transaction import UsbTransaction import pytest from conftest import PARAMS, test_RunUsbSession +from copy import deepcopy + +# Only test on EP 0 - Update params +PARAMS = deepcopy(PARAMS) +PARAMS["default"].update({"ep": [0]}) +PARAMS["smoke"].update({"ep": [0]}) @pytest.fixture def test_session(ep, address, bus_speed): - ep = 0 - address = 1 ied = 500 session = UsbSession( diff --git a/tests/test_control_basic_get/src/main.xc b/tests/test_control_basic_get/src/main.xc index a3139b00..31e552e8 100644 --- a/tests/test_control_basic_get/src/main.xc +++ b/tests/test_control_basic_get/src/main.xc @@ -1,33 +1,17 @@ // Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -/* - * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent - * in both directions between the ports. - * - * NOTE: The src/testbenches/ExampleTestbench must have been compiled for this to run without error. - * - */ -#include -#include -#include -#include "xud.h" -#include "platform.h" #include "shared.h" -#define XUD_EP_COUNT_OUT 5 -#define XUD_EP_COUNT_IN 5 +#define EP_COUNT_OUT (5) +#define EP_COUNT_IN (5) /* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, +XUD_EpType epTypeTableOut[EP_COUNT_OUT] = {XUD_EPTYPE_CTL, + XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, - XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; - - -/* Out EP Should receive some data, perform some test process (crc or similar) to check okay */ -/* Answers should be responded to in the IN ep */ +XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; int TestEp_Control(XUD_ep c_ep0_out, XUD_ep c_ep0_in, int epNum) @@ -72,12 +56,12 @@ int TestEp_Control(XUD_ep c_ep0_out, XUD_ep c_ep0_in, int epNum) int main() { - chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; par { - XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); diff --git a/tests/test_control_basic_set.py b/tests/test_control_basic_set.py index 36f2c4b8..58ced2d6 100644 --- a/tests/test_control_basic_set.py +++ b/tests/test_control_basic_set.py @@ -12,13 +12,17 @@ from usb_transaction import UsbTransaction import pytest from conftest import PARAMS, test_RunUsbSession +from copy import deepcopy + +# Only test on EP 0 - Update params +PARAMS = deepcopy(PARAMS) +PARAMS["default"].update({"ep": [0]}) +PARAMS["smoke"].update({"ep": [0]}) @pytest.fixture def test_session(ep, address, bus_speed): - ep = 0 - address = 1 ied = 500 session = UsbSession( diff --git a/tests/test_control_basic_set/src/main.xc b/tests/test_control_basic_set/src/main.xc index 5c9f8694..349a7df6 100644 --- a/tests/test_control_basic_set/src/main.xc +++ b/tests/test_control_basic_set/src/main.xc @@ -1,28 +1,13 @@ // Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -/* - * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent - * in both directions between the ports. - * - * NOTE: The src/testbenches/ExampleTestbench must have been compiled for this to run without error. - * - */ -#include -#include -#include -#include "xud.h" -#include "platform.h" #include "shared.h" -#define XUD_EP_COUNT_OUT 5 -#define XUD_EP_COUNT_IN 5 +#define EP_COUNT_OUT (5) +#define EP_COUNT_IN (5) /* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; - -/* Out EP Should receive some data, perform some test process (crc or similar) to check okay */ -/* Answers should be responded to in the IN ep */ +XUD_EpType epTypeTableOut[EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; +XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; int TestEp_Control(chanend c_out, chanend c_in, int epNum) { @@ -77,12 +62,12 @@ int TestEp_Control(chanend c_out, chanend c_in, int epNum) int main() { - chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; par { - XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main( c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); diff --git a/tests/test_device_attach.py b/tests/test_device_attach.py index 0d641939..d4b653e9 100644 --- a/tests/test_device_attach.py +++ b/tests/test_device_attach.py @@ -4,16 +4,19 @@ from usb_session import UsbSession from usb_transaction import UsbTransaction from usb_signalling import UsbDeviceAttach - import pytest from conftest import PARAMS, test_RunUsbSession +from copy import deepcopy + +# Only need to run device attach tests for one ep/address +PARAMS = deepcopy(PARAMS) +for k in PARAMS: + PARAMS[k].update({"ep": [1], "address": [1]}) @pytest.fixture def test_session(ep, address, bus_speed): - ep = 1 - address = 1 start_length = 10 end_length = 12 pktLength = 10 diff --git a/tests/test_invalidtoken.py b/tests/test_invalidtoken.py index 170ffeae..e868c4ed 100644 --- a/tests/test_invalidtoken.py +++ b/tests/test_invalidtoken.py @@ -1,8 +1,7 @@ -#!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -# Same as simple RX bulk test but some invalid tokens also included +# Same as simple RX bulk test but some invalid tokens also included from usb_packet import ( TokenPacket, TxDataPacket, @@ -16,18 +15,10 @@ import pytest from conftest import PARAMS, test_RunUsbSession -# TODO Can this be moved? -@pytest.fixture -def test_file(): - return __file__ - @pytest.fixture def test_session(ep, address, bus_speed): - address = 1 - ep = 1 - session = UsbSession( bus_speed=bus_speed, run_enumeration=False, device_address=address ) diff --git a/tests/test_invalidtoken/src/main.xc b/tests/test_invalidtoken/src/main.xc index 962d7893..e7f09355 100644 --- a/tests/test_invalidtoken/src/main.xc +++ b/tests/test_invalidtoken/src/main.xc @@ -1,33 +1,29 @@ // Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -/* - * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent - * in both directions between the ports. - * - * NOTE: The src/testbenches/ExampleTestbench must have been compiled for this to run without error. - * - */ + #include #include #include #include "xud.h" #include "platform.h" -//#include "test.h" -#include "xc_ptr.h" -//#error +#define EP_COUNT_OUT (6) +#define EP_COUNT_IN (6) -#define XUD_EP_COUNT_OUT 5 -#define XUD_EP_COUNT_IN 5 -//extern xc_ptr char_array_to_xc_ptr(const unsigned char a[]); +XUD_EpType epTypeTableOut[EP_COUNT_OUT] = {XUD_EPTYPE_CTL, + XUD_EPTYPE_BUL, + XUD_EPTYPE_BUL, + XUD_EPTYPE_BUL, + XUD_EPTYPE_BUL, + XUD_EPTYPE_BUL}; -/* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, - XUD_EPTYPE_ISO, - XUD_EPTYPE_BUL, - XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, 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}; void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend ?c_usb_test); @@ -55,9 +51,9 @@ unsigned fail(int x) exit(1); } -unsigned char g_rxDataCheck[5] = {0, 0, 0, 0, 0}; -unsigned char g_txDataCheck[5] = {0,0,0,0,0,}; -unsigned g_txLength[5] = {0,0,0,0,0}; +unsigned char g_rxDataCheck[EP_COUNT_OUT] = {0}; +unsigned char g_txDataCheck[EP_COUNT_IN] = {0}; +unsigned g_txLength[EP_COUNT_IN] = {0}; #pragma unsafe arrays @@ -121,21 +117,19 @@ int TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_out_0) exit(0); } - -#define USB_CORE 0 int main() { - chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; par { - XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main( c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); - TestEp_Bulk(c_ep_out[1], c_ep_in[1], 1, c_ep_out[0]); + TestEp_Bulk(c_ep_out[TEST_EP_NUM], c_ep_in[TEST_EP_NUM], TEST_EP_NUM, c_ep_out[0]); } return 0; diff --git a/tests/test_iso_loopback.py b/tests/test_iso_loopback.py index efbeb381..27ee0ec8 100644 --- a/tests/test_iso_loopback.py +++ b/tests/test_iso_loopback.py @@ -6,18 +6,13 @@ import pytest from conftest import PARAMS, test_RunUsbSession -# TODO Can this be moved? -@pytest.fixture -def test_file(): - return __file__ - @pytest.fixture def test_session(ep, address, bus_speed): - ep_loopback = 3 - ep_loopback_kill = 2 - address = 1 + ep_loopback = ep + ep_loopback_kill = ep + 1 + start_length = 200 end_length = 203 session = UsbSession( @@ -61,7 +56,7 @@ def test_session(ep, address, bus_speed): session, deviceAddress=address, endpointNumber=ep_loopback_kill, - endpointType="BULK", + endpointType="ISO", direction="OUT", dataLength=pktLength, ) @@ -71,7 +66,7 @@ def test_session(ep, address, bus_speed): session, deviceAddress=address, endpointNumber=ep_loopback_kill, - endpointType="BULK", + endpointType="ISO", direction="IN", dataLength=pktLength, ) diff --git a/tests/test_iso_loopback/src/main.xc b/tests/test_iso_loopback/src/main.xc index 4610ef0b..5e95c6dc 100644 --- a/tests/test_iso_loopback/src/main.xc +++ b/tests/test_iso_loopback/src/main.xc @@ -1,30 +1,21 @@ // Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -/* - * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent - * in both directions between the ports. - * - * NOTE: The src/testbenches/ExampleTestbench must have been compiled for this to run without error. - * - */ #include #include #include #include "xud.h" #include "platform.h" -#include "xc_ptr.h" -#define XUD_EP_COUNT_OUT 5 -#define XUD_EP_COUNT_IN 5 +#define EP_COUNT_OUT (6) +#define EP_COUNT_IN (6) /* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL}; - -void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend ?c_usb_test); +XUD_EpType epTypeTableOut[EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO}; +XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO}; void exit(int); +#define KILL_EP_NUM (TEST_EP_NUM +1) /* Loopback packets forever */ #pragma unsafe arrays @@ -36,7 +27,6 @@ int TestEp_LoopbackForever(chanend c_out1, chanend c_in1) XUD_ep ep_out1 = XUD_InitEp(c_out1); XUD_ep ep_in1 = XUD_InitEp(c_in1); - /* Buffer for Setup data */ unsigned char buffer[1024]; while(1) @@ -60,7 +50,6 @@ int TestEp_LoopbackOnce(chanend c_out, chanend c_in, chanend c_out_0) XUD_ep ep_out = XUD_InitEp(c_out); XUD_ep ep_in = XUD_InitEp(c_in); - /* Buffer for Setup data */ unsigned char buffer[1024]; XUD_GetBuffer(ep_out, buffer, length); @@ -70,20 +59,18 @@ int TestEp_LoopbackOnce(chanend c_out, chanend c_in, chanend c_out_0) exit(0); } -#define USB_CORE 0 int main() { - chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; par { - - XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); - TestEp_LoopbackForever(c_ep_out[3], c_ep_in[3]); - TestEp_LoopbackOnce(c_ep_out[2], c_ep_in[2], c_ep_out[0]); + TestEp_LoopbackForever(c_ep_out[TEST_EP_NUM], c_ep_in[TEST_EP_NUM]); + TestEp_LoopbackOnce(c_ep_out[KILL_EP_NUM], c_ep_in[KILL_EP_NUM], c_ep_out[0]); } return 0; diff --git a/tests/test_iso_loopback/src/xc_ptr.h b/tests/test_iso_loopback/src/xc_ptr.h deleted file mode 100644 index 8fa5a04e..00000000 --- a/tests/test_iso_loopback/src/xc_ptr.h +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2016-2021 XMOS LIMITED. -// This Software is subject to the terms of the XMOS Public Licence: Version 1. -#ifndef __xc_ptr__ -#define __xc_ptr__ - -typedef unsigned int xc_ptr; - -// Note that this function is marked as const to avoid the XC -// parallel usage checks, this is only really going to work if this -// is the *only* way the array a is accessed (and everything else uses -// the xc_ptr) -inline xc_ptr array_to_xc_ptr(const unsigned a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -inline xc_ptr char_array_to_xc_ptr(const unsigned char a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -#define write_via_xc_ptr_indexed(p,i,x) asm volatile("stw %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_short_via_xc_ptr_indexed(p,i,x) asm volatile("st16 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) - -#define write_via_xc_ptr(p,x) asm volatile("stw %0, %1[0]"::"r"(x),"r"(p)) -// No immediate st8 format -#define write_byte_via_xc_ptr(p,x) write_byte_via_xc_ptr_indexed(p, 0, x) -#define write_short_via_xc_ptr(p,x) write_short_via_xc_ptr_indexed(p, 0, x) - -#define read_via_xc_ptr_indexed(x,p,i) asm("ldw %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_byte_via_xc_ptr_indexed(x,p,i) asm("ld8u %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_short_via_xc_ptr_indexed(x,p,i) asm("ld16s %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); - -#define read_via_xc_ptr(x,p) asm("ldw %0, %1[0]":"=r"(x):"r"(p)); -// No immediate ld8u format -#define read_byte_via_xc_ptr(x,p) read_byte_via_xc_ptr_indexed(x, p, 0) -#define read_short_via_xc_ptr(x,p) read_short_via_xc_ptr_indexed(x, p, 0) - -#define GET_SHARED_GLOBAL(x, g) asm volatile("ldw %0, dp[" #g "]":"=r"(x)::"memory") -#define SET_SHARED_GLOBAL(g, v) asm volatile("stw %0, dp[" #g "]"::"r"(v):"memory") - -#endif diff --git a/tests/test_iso_rx_basic.py b/tests/test_iso_rx_basic.py index ffa044ee..37e41a4a 100644 --- a/tests/test_iso_rx_basic.py +++ b/tests/test_iso_rx_basic.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. from usb_session import UsbSession @@ -6,17 +5,10 @@ import pytest from conftest import PARAMS, test_RunUsbSession -# TODO Can this be moved? -@pytest.fixture -def test_file(): - return __file__ - @pytest.fixture def test_session(ep, address, bus_speed): - ep = 2 - address = 1 start_length = 10 end_length = 14 diff --git a/tests/test_iso_rx_basic/src/main.xc b/tests/test_iso_rx_basic/src/main.xc index 6a7496af..a8b59742 100644 --- a/tests/test_iso_rx_basic/src/main.xc +++ b/tests/test_iso_rx_basic/src/main.xc @@ -1,33 +1,36 @@ // Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -#include -#include -#include -#include "xud.h" -#include "platform.h" #include "shared.h" -#define XUD_EP_COUNT_OUT 5 -#define XUD_EP_COUNT_IN 5 +#define EP_COUNT_OUT (6) +#define EP_COUNT_IN (6) #ifndef PKT_LENGTH_START -#define PKT_LENGTH_START 10 +#define PKT_LENGTH_START (10) #endif #ifndef PKT_LENGTH_END -#define PKT_LENGTH_END 14 +#define PKT_LENGTH_END (14) #endif #ifndef TEST_EP_NUM -#define TEST_EP_NUM 2 +#error #endif +XUD_EpType epTypeTableOut[EP_COUNT_OUT] = {XUD_EPTYPE_CTL, + XUD_EPTYPE_ISO, + XUD_EPTYPE_ISO, + XUD_EPTYPE_ISO, + XUD_EPTYPE_ISO, + XUD_EPTYPE_ISO}; + +XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, + XUD_EPTYPE_ISO, + XUD_EPTYPE_ISO, + XUD_EPTYPE_ISO, + XUD_EPTYPE_ISO, + XUD_EPTYPE_ISO}; -/* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, - XUD_EPTYPE_BUL, - XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; #ifdef XUD_SIM_RTL int testmain() @@ -35,21 +38,20 @@ int testmain() int main() #endif { - chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - chan c_dummy[DUMMY_THREAD_COUNT]; + chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; par { { - #if defined(XUD_TEST_SPEED_FS) +#if defined(XUD_TEST_SPEED_FS) unsigned speed = XUD_SPEED_FS; - #elif defined(XUD_TEST_SPEED_HS) +#elif defined(XUD_TEST_SPEED_HS) unsigned speed = XUD_SPEED_HS; - #else - #error XUD_TEST_SPEED_XX not defined - #endif +#else +#error XUD_TEST_SPEED_XX not defined +#endif - XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, speed, XUD_PWR_BUS); } @@ -66,9 +68,6 @@ int main() TerminatePass(fail); } - - dummyThreads(c_dummy); - } return 0; diff --git a/tests/test_iso_rxtx_fastpacket.py b/tests/test_iso_rxtx_fastpacket.py index be7c49e4..dc157bc8 100644 --- a/tests/test_iso_rxtx_fastpacket.py +++ b/tests/test_iso_rxtx_fastpacket.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. from usb_session import UsbSession @@ -6,17 +5,10 @@ import pytest from conftest import PARAMS, test_RunUsbSession -# TODO Can this be moved? -@pytest.fixture -def test_file(): - return __file__ - @pytest.fixture def test_session(ep, address, bus_speed): - ep = 3 - address = 1 start_length = 10 end_length = 19 diff --git a/tests/test_iso_rxtx_fastpacket/src/main.xc b/tests/test_iso_rxtx_fastpacket/src/main.xc index d1f5a2e1..97172173 100644 --- a/tests/test_iso_rxtx_fastpacket/src/main.xc +++ b/tests/test_iso_rxtx_fastpacket/src/main.xc @@ -1,51 +1,38 @@ // Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -/* - * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent - * in both directions between the ports. - * - * NOTE: The src/testbenches/ExampleTestbench must have been compiled for this to run without error. - * - */ -#include -#include -#include -#include "xud.h" -#include "platform.h" -#include "xc_ptr.h" #include "shared.h" -#define XUD_EP_COUNT_OUT 5 -#define XUD_EP_COUNT_IN 5 +#define EP_COUNT_OUT (6) +#define EP_COUNT_IN (6) #ifndef PKT_LENGTH_START -#define PKT_LENGTH_START 10 +#define PKT_LENGTH_START (10) #endif #ifndef PKT_LENGTH_END -#define PKT_LENGTH_END 19 +#define PKT_LENGTH_END (19) #endif /* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO}; -XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO}; +XUD_EpType epTypeTableOut[EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO}; +XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO}; int main() { - chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; par { - XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main( c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); - TestEp_Tx(c_ep_in[3], 3, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_DIE); + TestEp_Tx(c_ep_in[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_DIE); { - TestEp_Rx(c_ep_out[3], 3, PKT_LENGTH_START, PKT_LENGTH_END); + TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); XUD_Kill(ep0); exit(0); // TODO should be able to move this out of the par diff --git a/tests/test_iso_tx_basic.py b/tests/test_iso_tx_basic.py index c50845fc..47620c53 100644 --- a/tests/test_iso_tx_basic.py +++ b/tests/test_iso_tx_basic.py @@ -9,8 +9,6 @@ @pytest.fixture def test_session(ep, address, bus_speed): - ep = 3 - address = 1 start_length = 10 end_length = 14 diff --git a/tests/test_iso_tx_basic/src/main.xc b/tests/test_iso_tx_basic/src/main.xc index 8043ffca..4a3d1694 100644 --- a/tests/test_iso_tx_basic/src/main.xc +++ b/tests/test_iso_tx_basic/src/main.xc @@ -1,61 +1,54 @@ // Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -/* - * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent - * in both directions between the ports. - * - * NOTE: The src/testbenches/ExampleTestbench must have been compiled for this to run without error. - * - */ -#include -#include -#include -#include "xud.h" -#include "platform.h" + #include "shared.h" -#ifndef XUD_EP_COUNT_OUT -#define XUD_EP_COUNT_OUT (4) +#ifndef EP_COUNT_OUT +#define EP_COUNT_OUT (6) #endif -#ifndef XUD_EP_COUNT_IN -#define XUD_EP_COUNT_IN (4) +#ifndef EP_COUNT_IN +#define EP_COUNT_IN (6) #endif /* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, +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[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, - XUD_EPTYPE_BUL, - XUD_EPTYPE_BUL, +XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, + XUD_EPTYPE_ISO, + XUD_EPTYPE_ISO, + XUD_EPTYPE_ISO, + XUD_EPTYPE_ISO, XUD_EPTYPE_ISO}; int main() { - chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - chan c_dummy[DUMMY_THREAD_COUNT]; + chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; + //chan c_dummy[DUMMY_THREAD_COUNT]; par { - XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); { - TestEp_Tx(c_ep_in[3], 3, 10, 14, RUNMODE_DIE); + TestEp_Tx(c_ep_in[TEST_EP_NUM], TEST_EP_NUM, 10, 14, RUNMODE_DIE); XUD_ep ep_out_0 = XUD_InitEp(c_ep_out[0]); XUD_Kill(ep_out_0); - for(size_t i = 0; i Date: Thu, 24 Jun 2021 13:26:13 +0100 Subject: [PATCH 397/520] More test fixes. All smoke tests now pass or xfailed --- tests/test_iso_loopback.py | 1 - tests/test_ping_stall.py | 4 +--- tests/test_ping_stall/src/main.xc | 20 ++++++++++---------- tests/test_sof_badcrc.py | 10 +++------- tests/test_sof_basic.py | 8 -------- tests/test_sof_basic/src/main.xc | 12 ++++++------ tests/test_stall_basic.py | 10 +--------- tests/test_stall_basic/src/main.xc | 4 ++-- tests/test_stall_epready.py | 10 +--------- tests/test_stall_epready/src/main.xc | 8 ++++---- tests/test_suspend_resume.py | 2 -- tests/test_suspend_resume/src/main.xc | 6 +++--- 12 files changed, 31 insertions(+), 64 deletions(-) diff --git a/tests/test_iso_loopback.py b/tests/test_iso_loopback.py index 27ee0ec8..f3af6362 100644 --- a/tests/test_iso_loopback.py +++ b/tests/test_iso_loopback.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. from usb_session import UsbSession diff --git a/tests/test_ping_stall.py b/tests/test_ping_stall.py index 9e01cb4d..e4946cda 100644 --- a/tests/test_ping_stall.py +++ b/tests/test_ping_stall.py @@ -12,15 +12,13 @@ @pytest.fixture def test_session(ep, address, bus_speed): - address = 1 pktLength = 10 session = UsbSession( bus_speed=bus_speed, run_enumeration=False, device_address=address ) - ep_ctrl = 2 - ep = 1 + ep_ctrl = ep + 1 # Ping EP, expect stall session.add_event( diff --git a/tests/test_ping_stall/src/main.xc b/tests/test_ping_stall/src/main.xc index 3d9f6607..b66f8466 100644 --- a/tests/test_ping_stall/src/main.xc +++ b/tests/test_ping_stall/src/main.xc @@ -8,26 +8,26 @@ #include "platform.h" #include "shared.h" -#define XUD_EP_COUNT_OUT 5 -#define XUD_EP_COUNT_IN 5 +#define EP_COUNT_OUT (6) +#define EP_COUNT_IN (6) #ifndef PKT_LENGTH_START -#define PKT_LENGTH_START 10 +#define PKT_LENGTH_START (10) #endif #ifndef TEST_EP_NUM -#define TEST_EP_NUM (1) +#error #endif #ifndef CTRL_EP_NUM -#define CTRL_EP_NUM (2) +#define CTRL_EP_NUM (TEST_EP_NUM + 1) #endif /* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; +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 TestEp_Stall(chanend c_ep_out[XUD_EP_COUNT_OUT], chanend c_ep_in[XUD_EP_COUNT_IN]) +unsigned TestEp_Stall(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) { unsigned failed = 0; uint8_t outBuffer[128]; @@ -63,7 +63,7 @@ int testmain() int main() #endif { - chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; par { @@ -76,7 +76,7 @@ int main() #error XUD_TEST_SPEED_XX not defined #endif - XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, speed, XUD_PWR_BUS); } diff --git a/tests/test_sof_badcrc.py b/tests/test_sof_badcrc.py index 73006971..4fa413cf 100644 --- a/tests/test_sof_badcrc.py +++ b/tests/test_sof_badcrc.py @@ -8,16 +8,12 @@ from conftest import PARAMS, test_RunUsbSession -@pytest.fixture -def test_file(): - return __file__ - - @pytest.fixture def test_session(ep, address, bus_speed): - address = 1 - ep = 1 + pytest.xfail("Known failure (on XS3)") + + frameNumber = 52 # Note, for frame number 52 we expect A5 34 40 on the bus session = UsbSession( diff --git a/tests/test_sof_basic.py b/tests/test_sof_basic.py index 1ecd09bf..bbe6ee87 100644 --- a/tests/test_sof_basic.py +++ b/tests/test_sof_basic.py @@ -8,17 +8,9 @@ from conftest import PARAMS, test_RunUsbSession -# TODO Can this be moved? -@pytest.fixture -def test_file(): - return __file__ - - @pytest.fixture def test_session(ep, address, bus_speed): - address = 1 - ep = 1 frameNumber = 52 # Note, for frame number 52 we expect A5 34 40 on the bus session = UsbSession( diff --git a/tests/test_sof_basic/src/main.xc b/tests/test_sof_basic/src/main.xc index 467045b2..275234b7 100644 --- a/tests/test_sof_basic/src/main.xc +++ b/tests/test_sof_basic/src/main.xc @@ -7,12 +7,12 @@ #include "platform.h" #include "shared.h" -#define XUD_EP_COUNT_OUT 5 -#define XUD_EP_COUNT_IN 5 +#define EP_COUNT_OUT 5 +#define EP_COUNT_IN 5 /* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL,XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; +XUD_EpType epTypeTableOut[EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL,XUD_EPTYPE_BUL}; +XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; void exit(int); @@ -77,13 +77,13 @@ unsigned TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_sof) int main() { - chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; chan c_sof; par { - XUD_Main( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main( c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, c_sof, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); diff --git a/tests/test_stall_basic.py b/tests/test_stall_basic.py index 29351a08..052b355d 100644 --- a/tests/test_stall_basic.py +++ b/tests/test_stall_basic.py @@ -6,27 +6,19 @@ import pytest from conftest import PARAMS, test_RunUsbSession -# TODO Can this be moved? -@pytest.fixture -def test_file(): - return __file__ - - @pytest.fixture def test_session(ep, address, bus_speed): if bus_speed == "FS": pytest.xfail("Known failure at FS") - address = 1 pktLength = 10 session = UsbSession( bus_speed=bus_speed, run_enumeration=False, device_address=address ) - ep_ctrl = 2 - ep = 1 + ep_ctrl = ep + 1 # Expect test EP's to be halted session.add_event( diff --git a/tests/test_stall_basic/src/main.xc b/tests/test_stall_basic/src/main.xc index 94ace7f5..efc02b8b 100644 --- a/tests/test_stall_basic/src/main.xc +++ b/tests/test_stall_basic/src/main.xc @@ -16,11 +16,11 @@ #endif #ifndef TEST_EP_NUM -#define TEST_EP_NUM (1) +#error #endif #ifndef CTRL_EP_NUM -#define CTRL_EP_NUM (2) +#define CTRL_EP_NUM (TEST_EP_NUM + 1) #endif diff --git a/tests/test_stall_epready.py b/tests/test_stall_epready.py index e43e4b74..d02dc41a 100644 --- a/tests/test_stall_epready.py +++ b/tests/test_stall_epready.py @@ -10,24 +10,16 @@ import pytest from conftest import PARAMS, test_RunUsbSession -# TODO Can this be moved? -@pytest.fixture -def test_file(): - return __file__ - - @pytest.fixture def test_session(ep, address, bus_speed): - address = 1 pktLength = 10 session = UsbSession( bus_speed=bus_speed, run_enumeration=False, device_address=address ) - ep_ctrl = 2 - ep = 1 + ep_ctrl = ep + 1 # Expect test EP's to be halted session.add_event( diff --git a/tests/test_stall_epready/src/main.xc b/tests/test_stall_epready/src/main.xc index 7bb931ba..c4e227f9 100644 --- a/tests/test_stall_epready/src/main.xc +++ b/tests/test_stall_epready/src/main.xc @@ -8,11 +8,11 @@ #include "platform.h" #include "shared.h" -#define XUD_EP_COUNT_OUT 5 -#define XUD_EP_COUNT_IN 5 +#define XUD_EP_COUNT_OUT (5) +#define XUD_EP_COUNT_IN (5) #ifndef PKT_LENGTH_START -#define PKT_LENGTH_START 10 +#define PKT_LENGTH_START (10) #endif #ifndef TEST_EP_NUM @@ -20,7 +20,7 @@ #endif #ifndef CTRL_EP_NUM -#define CTRL_EP_NUM (2) +#define CTRL_EP_NUM (TEST_EP_NUM + 1) #endif diff --git a/tests/test_suspend_resume.py b/tests/test_suspend_resume.py index 077b77e2..68aff185 100644 --- a/tests/test_suspend_resume.py +++ b/tests/test_suspend_resume.py @@ -11,8 +11,6 @@ @pytest.fixture def test_session(ep, address, bus_speed): - ep = 1 - address = 1 start_length = 10 end_length = 12 pktLength = 10 diff --git a/tests/test_suspend_resume/src/main.xc b/tests/test_suspend_resume/src/main.xc index 7e4d797e..0d6d6e90 100644 --- a/tests/test_suspend_resume/src/main.xc +++ b/tests/test_suspend_resume/src/main.xc @@ -19,12 +19,12 @@ #endif #ifndef TEST_EP_NUM -#define TEST_EP_NUM 1 +#error #endif /* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; +XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; +XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; #ifdef XUD_SIM_RTL int testmain() From 300dab5107b72e1f8e433199a162ddf864d2dcaf Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 24 Jun 2021 13:27:27 +0100 Subject: [PATCH 398/520] Formatting only --- tests/test_sof_badcrc.py | 1 - tests/test_stall_basic.py | 1 + tests/test_stall_epready.py | 1 + 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_sof_badcrc.py b/tests/test_sof_badcrc.py index 4fa413cf..f83558e7 100644 --- a/tests/test_sof_badcrc.py +++ b/tests/test_sof_badcrc.py @@ -12,7 +12,6 @@ def test_session(ep, address, bus_speed): pytest.xfail("Known failure (on XS3)") - frameNumber = 52 # Note, for frame number 52 we expect A5 34 40 on the bus diff --git a/tests/test_stall_basic.py b/tests/test_stall_basic.py index 052b355d..76375317 100644 --- a/tests/test_stall_basic.py +++ b/tests/test_stall_basic.py @@ -6,6 +6,7 @@ import pytest from conftest import PARAMS, test_RunUsbSession + @pytest.fixture def test_session(ep, address, bus_speed): diff --git a/tests/test_stall_epready.py b/tests/test_stall_epready.py index d02dc41a..2615d300 100644 --- a/tests/test_stall_epready.py +++ b/tests/test_stall_epready.py @@ -10,6 +10,7 @@ import pytest from conftest import PARAMS, test_RunUsbSession + @pytest.fixture def test_session(ep, address, bus_speed): From 0f93f73a89ecb1127523fcd328643410dcc340f6 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 24 Jun 2021 14:13:11 +0100 Subject: [PATCH 399/520] Fixed equality check --- tests/Pyxsim/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Pyxsim/__init__.py b/tests/Pyxsim/__init__.py index ee97cd50..f9659991 100644 --- a/tests/Pyxsim/__init__.py +++ b/tests/Pyxsim/__init__.py @@ -48,7 +48,7 @@ def _build(xe_path, build_config=None, env={}, do_clean=False, build_options="") if do_clean: call(["xmake", "clean"], cwd=path, env=my_env) - if build_config != None: + if build_config is not None: cmd += ["CONFIG=%s" % build_config] cmd += [build_options] From f221989f787cf38a17b9b3f436eb2a9e771602d8 Mon Sep 17 00:00:00 2001 From: Dave Atkinson Date: Thu, 24 Jun 2021 14:26:19 +0100 Subject: [PATCH 400/520] Remove xmostest references. --- tests/Pyxsim/__init__.py | 2 +- tests/Pyxsim/pyxsim.py | 6 +- tests/Pyxsim/xe.py | 2 +- tests/Pyxsim/xmostest_subprocess.py | 2 +- tests/runtests.py | 103 ---------------------------- tests/test_ping_stall.py | 1 - tests/usb_clock.py | 4 +- tests/usb_phy_shim.py | 1 - tests/usb_phy_utmi.py | 1 - 9 files changed, 8 insertions(+), 114 deletions(-) delete mode 100755 tests/runtests.py diff --git a/tests/Pyxsim/__init__.py b/tests/Pyxsim/__init__.py index f047e1e8..45ce9ce1 100644 --- a/tests/Pyxsim/__init__.py +++ b/tests/Pyxsim/__init__.py @@ -60,7 +60,7 @@ def _build(xe_path, build_config=None, env={}, do_clean=False): # if x.find('Error') != -1: success = False # if re.match('xmake: \*\*\* .* Stop.', x) != None: - if re.match("xmake: \*\*\* .* Stop.", s) != None: + if re.match(r"xmake: \*\*\* .* Stop.", s) != None: success = False if not success: diff --git a/tests/Pyxsim/pyxsim.py b/tests/Pyxsim/pyxsim.py index e9306acc..6972a3c4 100644 --- a/tests/Pyxsim/pyxsim.py +++ b/tests/Pyxsim/pyxsim.py @@ -26,14 +26,14 @@ def xsi_is_valid_port(port): - return re.match("XS1_PORT_\d+\w", port) != None + return re.match(r"XS1_PORT_\d+\w", port) != None def xsi_get_port_width(port): if not xsi_is_valid_port(port): return None else: - return int(re.match("^XS1_PORT_(\d+)\w", port).groups(0)[0]) + return int(re.match(r"^XS1_PORT_(\d+)\w", port).groups(0)[0]) class EnumExceptionSet: @@ -85,7 +85,7 @@ def error(self, value): def parse_port(p): - m = re.match("(tile.*)\:([^\.]*)\.?(\d*)", p) + m = re.match(r"(tile.*)\:([^\.]*)\.?(\d*)", p) if m: tile = m.groups(0)[0] port = m.groups(0)[1] diff --git a/tests/Pyxsim/xe.py b/tests/Pyxsim/xe.py index 5f3c056d..1a3dc866 100644 --- a/tests/Pyxsim/xe.py +++ b/tests/Pyxsim/xe.py @@ -48,7 +48,7 @@ def _get_platform_info(self): self._port_map[port].append((package, pin, bitnum)) def get_port_pins(self, port): - m = re.match("([^\.]*)\.(\d*)", port) + m = re.match(r"([^\.]*)\.(\d*)", port) if m: port = m.groups(0)[0] bit = int(m.groups(0)[1]) diff --git a/tests/Pyxsim/xmostest_subprocess.py b/tests/Pyxsim/xmostest_subprocess.py index 130915ae..110b3981 100644 --- a/tests/Pyxsim/xmostest_subprocess.py +++ b/tests/Pyxsim/xmostest_subprocess.py @@ -97,7 +97,7 @@ def platform_is_windows(): def quote_string(s): """For Windows need to put quotes around arguments with spaces in them""" - if re.search("\s", s): + if re.search(r"\s", s): return '"%s"' % s else: return s diff --git a/tests/runtests.py b/tests/runtests.py deleted file mode 100755 index 56a2924d..00000000 --- a/tests/runtests.py +++ /dev/null @@ -1,103 +0,0 @@ -#!/usr/bin/env python -# Copyright 2016-2021 XMOS LIMITED. -# This Software is subject to the terms of the XMOS Public Licence: Version 1. -import xmostest -import argparse -import os -import re -import shutil -import helpers -from helpers import ARCHITECTURE_CHOICES, BUSSPEED_CHOICES - -XN_FILES = ["test_xs2.xn", "test_xs3.xn"] - - -def list_test_dirs(args, path=".", pattern="^test_*"): - dirs = os.listdir(path) - test_dirs = [dir for dir in dirs if os.path.isdir(dir) and re.match(pattern, dir)] - return test_dirs - - -def copy_common_xn_files( - args, path=".", common_dir="shared_src", source_dir="src", xn_files=XN_FILES -): - test_dirs = list_test_dirs(args, path) - for test_dir in test_dirs: - src_dir = os.path.join(test_dir, source_dir) - for xn_file in xn_files: - xn = os.path.join(common_dir, xn_file) - shutil.copy(xn, src_dir) - - -def delete_test_specific_xn_files(args, path=".", source_dir="src", xn_files=XN_FILES): - test_dirs = list_test_dirs(args, path) - for test_dir in test_dirs: - src_dir = os.path.join(test_dir, source_dir) - for xn_file in xn_files: - xn = os.path.join(src_dir, xn_file) - os.remove(xn) - - -def prologue(args): - copy_common_xn_files(args) - - -def epilogue(args): - delete_test_specific_xn_files(args) - - -if __name__ == "__main__": - global trace - argparser = argparse.ArgumentParser(description="XMOS lib_xud tests") - argparser.add_argument( - "--trace", action="store_true", help="Run tests with simulator and VCD traces" - ) - argparser.add_argument( - "--arch", - choices=ARCHITECTURE_CHOICES, - type=str, - help="Run tests only on specified xcore architecture", - ) - argparser.add_argument("--seed", type=int, help="The seed", default=None) - argparser.add_argument( - "--verbose", action="store_true", help="Enable verbose tracing in the phy" - ) - argparser.add_argument( - "--busspeed", - choices=BUSSPEED_CHOICES, - type=str, - help="Speed of USB to run test at", - ) - - helpers.args = xmostest.init(argparser) - - prologue(helpers.args) - - try: - xmostest.register_group( - "lib_xud", - "xud_sim_tests", - "XUD simulator tests", - """ -#Tests are performed by running the GPIO library connected to a simulator model -#(written as a python plugin to xsim). The simulator model checks that the pins -#are driven and read by the ports as expected. Tests are run to test the -#following features: -# -# * Inputting on a multibit port with multiple clients using the default pin map -# * Inputting on a multibit port with multiple clients using a specified pin map -# * Inputting on a 1bit port -# * Inputting with timestamps -# * Eventing on a multibit input port -# * Eventing on a 1bit input port -# * Outputting on a multibit port with multiple clients using the default pin map -# * Outputting on a multibit port with multiple clients using a specified pin map -# * Outputting with timestamps -#""", - ) - #''' - xmostest.runtests() - xmostest.finish() - - finally: - epilogue(helpers.args) diff --git a/tests/test_ping_stall.py b/tests/test_ping_stall.py index 9cb1d015..0d725a13 100644 --- a/tests/test_ping_stall.py +++ b/tests/test_ping_stall.py @@ -2,7 +2,6 @@ # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -import xmostest from usb_session import UsbSession from usb_transaction import UsbTransaction from usb_packet import TokenPacket, USB_PID, RxHandshakePacket diff --git a/tests/usb_clock.py b/tests/usb_clock.py index c3bc1a6f..f72fffaf 100644 --- a/tests/usb_clock.py +++ b/tests/usb_clock.py @@ -1,11 +1,11 @@ # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -import xmostest +from Pyxsim import SimThread import sys import zlib -class Clock(xmostest.SimThread): +class Clock(SimThread): CLK_60MHz = 0x0 diff --git a/tests/usb_phy_shim.py b/tests/usb_phy_shim.py index ad369abd..1dfc71e7 100644 --- a/tests/usb_phy_shim.py +++ b/tests/usb_phy_shim.py @@ -1,7 +1,6 @@ # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. import random -import xmostest import sys import zlib from usb_packet import RxPacket, TokenPacket diff --git a/tests/usb_phy_utmi.py b/tests/usb_phy_utmi.py index f28690b1..bdfcd2ee 100644 --- a/tests/usb_phy_utmi.py +++ b/tests/usb_phy_utmi.py @@ -1,6 +1,5 @@ # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. -import xmostest from usb_packet import RxPacket, TokenPacket import usb_packet from usb_phy import UsbPhy From e1fa4107ed0309a19dcc56b4422577d9e676a873 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 24 Jun 2021 17:51:51 +0100 Subject: [PATCH 401/520] Fix to test_sof_basic --- tests/test_sof_basic/src/main.xc | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/tests/test_sof_basic/src/main.xc b/tests/test_sof_basic/src/main.xc index 275234b7..0f7ff9fb 100644 --- a/tests/test_sof_basic/src/main.xc +++ b/tests/test_sof_basic/src/main.xc @@ -1,18 +1,13 @@ // Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -#include -#include -#include -#include "xud.h" -#include "platform.h" #include "shared.h" -#define EP_COUNT_OUT 5 -#define EP_COUNT_IN 5 +#define EP_COUNT_OUT (6) +#define EP_COUNT_IN (6) /* Endpoint type tables */ -XUD_EpType epTypeTableOut[EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL,XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; +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}; void exit(int); @@ -88,7 +83,7 @@ int main() XUD_SPEED_HS, XUD_PWR_BUS); { - unsigned fail = TestEp_Bulk(c_ep_out[1], c_ep_in[1], 1, c_sof); + unsigned fail = TestEp_Bulk(c_ep_out[TEST_EP_NUM], c_ep_in[TEST_EP_NUM], TEST_EP_NUM, c_sof); XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); XUD_Kill(ep0); From 59115f64e702c38683c9051f20beb73917fb6481 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 24 Jun 2021 17:59:44 +0100 Subject: [PATCH 402/520] Fixe to test_stall_basic (Pytest ep number was out of range for the DUT code) --- tests/test_stall_basic/src/main.xc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/test_stall_basic/src/main.xc b/tests/test_stall_basic/src/main.xc index efc02b8b..4426f4e6 100644 --- a/tests/test_stall_basic/src/main.xc +++ b/tests/test_stall_basic/src/main.xc @@ -8,11 +8,11 @@ #include "platform.h" #include "shared.h" -#define XUD_EP_COUNT_OUT 5 -#define XUD_EP_COUNT_IN 5 +#define EP_COUNT_OUT (6) +#define EP_COUNT_IN (6) #ifndef PKT_LENGTH_START -#define PKT_LENGTH_START 10 +#define PKT_LENGTH_START (10) #endif #ifndef TEST_EP_NUM @@ -20,16 +20,16 @@ #endif #ifndef CTRL_EP_NUM -#define CTRL_EP_NUM (TEST_EP_NUM + 1) +#define CTRL_EP_NUM (TEST_EP_NUM + 1) #endif /* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; +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 TestEp_Stall(chanend c_ep_out[XUD_EP_COUNT_OUT], chanend c_ep_in[XUD_EP_COUNT_IN]) +unsigned TestEp_Stall(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) { unsigned failed = 0; uint8_t outBuffer[128]; @@ -74,7 +74,7 @@ int testmain() int main() #endif { - chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; par { @@ -87,7 +87,7 @@ int main() #error XUD_TEST_SPEED_XX not defined #endif - XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, speed, XUD_PWR_BUS); } From f808245c99f3fd07a936dff378a6037dd2953397 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 24 Jun 2021 18:20:00 +0100 Subject: [PATCH 403/520] Fix to tsst_stall_epready (EP param from Pytest out of range for DUT code) --- tests/test_stall_epready/src/main.xc | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/tests/test_stall_epready/src/main.xc b/tests/test_stall_epready/src/main.xc index c4e227f9..ce47f251 100644 --- a/tests/test_stall_epready/src/main.xc +++ b/tests/test_stall_epready/src/main.xc @@ -1,32 +1,27 @@ // Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -#include -#include -#include -#include "xud.h" -#include "platform.h" #include "shared.h" -#define XUD_EP_COUNT_OUT (5) -#define XUD_EP_COUNT_IN (5) +#define XUD_EP_COUNT_OUT (6) +#define XUD_EP_COUNT_IN (6) #ifndef PKT_LENGTH_START -#define PKT_LENGTH_START (10) +#define PKT_LENGTH_START (10) #endif #ifndef TEST_EP_NUM -#define TEST_EP_NUM (1) +#define TEST_EP_NUM (1) #endif #ifndef CTRL_EP_NUM -#define CTRL_EP_NUM (TEST_EP_NUM + 1) +#define CTRL_EP_NUM (TEST_EP_NUM + 1) #endif /* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; +XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; +XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; unsigned TestEp_Stall(chanend c_ep_out[XUD_EP_COUNT_OUT], chanend c_ep_in[XUD_EP_COUNT_IN]) From 5169ded616a9f5ba311b0ece381d3aa5015f978d Mon Sep 17 00:00:00 2001 From: Kevin Yeung Date: Mon, 28 Jun 2021 16:56:13 +0800 Subject: [PATCH 404/520] replace cap_redirect with capsys --- tests/Pyxsim/__init__.py | 17 ----------------- tests/conftest.py | 9 +++++---- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/tests/Pyxsim/__init__.py b/tests/Pyxsim/__init__.py index f9659991..fe188f88 100644 --- a/tests/Pyxsim/__init__.py +++ b/tests/Pyxsim/__init__.py @@ -118,23 +118,6 @@ def run_tester(caps, tester_list): result.append(False) return result - -class cap_redirect: - def __init__(self, std): - (self.fd, self.fname) = tempfile.mkstemp() - fd_std = std.fileno() - self.old_std = os.fdopen(os.dup(fd_std), "w") - self.std_reader = open(self.fname, "r") - os.dup2(self.fd, fd_std) - sys.stdout = os.fdopen(self.fd, "w") - - def read_output(self): - return self.std_reader.read() - - def close_capture(self): - sys.stdout = self.old_std - - class SimThread(object): def run(self, xsi): pass diff --git a/tests/conftest.py b/tests/conftest.py index b08a385b..28633017 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -69,7 +69,7 @@ def test_file(request): return str(request.node.fspath) -def test_RunUsbSession(test_session, arch, ep, address, bus_speed, test_file): +def test_RunUsbSession(test_session, arch, ep, address, bus_speed, test_file, capsys): tester_list = [] output = [] @@ -77,7 +77,7 @@ def test_RunUsbSession(test_session, arch, ep, address, bus_speed, test_file): seed = random.randint(0, sys.maxsize) (clk_60, usb_phy) = get_usb_clk_phy(verbose=False, arch=arch) - start_cap = Pyxsim.cap_redirect(sys.stdout) + # start_cap = Pyxsim.cap_redirect(sys.stdout) tester_list.extend( do_usb_test( arch, @@ -91,8 +91,9 @@ def test_RunUsbSession(test_session, arch, ep, address, bus_speed, test_file): seed, ) ) - cap_output = start_cap.read_output() - start_cap.close_capture() + # cap_output = start_cap.read_output() + # start_cap.close_capture() + cap_output, err = capsys.readouterr() output.append(cap_output.split("\n")) sys.stdout.write("\n") From d22db16c3c1c453dd8a51250e7f5fda74097335c Mon Sep 17 00:00:00 2001 From: Kevin Yeung Date: Mon, 28 Jun 2021 17:29:14 +0800 Subject: [PATCH 405/520] changed capsys to capfd --- tests/conftest.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 28633017..c2ce3d8c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -69,7 +69,7 @@ def test_file(request): return str(request.node.fspath) -def test_RunUsbSession(test_session, arch, ep, address, bus_speed, test_file, capsys): +def test_RunUsbSession(test_session, arch, ep, address, bus_speed, test_file, capfd): tester_list = [] output = [] @@ -77,7 +77,6 @@ def test_RunUsbSession(test_session, arch, ep, address, bus_speed, test_file, ca seed = random.randint(0, sys.maxsize) (clk_60, usb_phy) = get_usb_clk_phy(verbose=False, arch=arch) - # start_cap = Pyxsim.cap_redirect(sys.stdout) tester_list.extend( do_usb_test( arch, @@ -91,9 +90,7 @@ def test_RunUsbSession(test_session, arch, ep, address, bus_speed, test_file, ca seed, ) ) - # cap_output = start_cap.read_output() - # start_cap.close_capture() - cap_output, err = capsys.readouterr() + cap_output, err = capfd.readouterr() output.append(cap_output.split("\n")) sys.stdout.write("\n") @@ -101,4 +98,6 @@ def test_RunUsbSession(test_session, arch, ep, address, bus_speed, test_file, ca # TODO only one result for result in results: + if not result: + print(cap_output) assert result From 73660a8b14aebae946f1bd88c57af906dbded801 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 28 Jun 2021 13:54:26 +0100 Subject: [PATCH 406/520] Fixed for issue #172 (trap on XS2 device) --- lib_xud/src/core/included/XUD_Token_Out_DI.S | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib_xud/src/core/included/XUD_Token_Out_DI.S b/lib_xud/src/core/included/XUD_Token_Out_DI.S index 4e05d8da..04b842ef 100755 --- a/lib_xud/src/core/included/XUD_Token_Out_DI.S +++ b/lib_xud/src/core/included/XUD_Token_Out_DI.S @@ -25,6 +25,9 @@ InformEP_Iso: // Iso EP - no handshake ldw r11, r3[1] // Load EP chanend {out res[r11], r4; ldw r7, sp[STACK_TXCRC_INIT]} // Output datalength (words) & CRC 16 Init (IN) {outt res[r11], r8; ldw r6, sp[STACK_RXCRC_INIT]} // CRC16 init (out) - Needs reseting after an out & Send tail length +#ifndef __XS3A__ + ldw r1, sp[STACK_VTOK_PORT] +#endif #include "XUD_TokenJmp.S" .align FUNCTION_ALIGNMENT From 5eddfdbf677056d1611f940cfcd400ee2cdf82c2 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 28 Jun 2021 14:07:14 +0100 Subject: [PATCH 407/520] Whitespace only --- tests/Pyxsim/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/Pyxsim/__init__.py b/tests/Pyxsim/__init__.py index fe188f88..3c72535d 100644 --- a/tests/Pyxsim/__init__.py +++ b/tests/Pyxsim/__init__.py @@ -118,6 +118,7 @@ def run_tester(caps, tester_list): result.append(False) return result + class SimThread(object): def run(self, xsi): pass From 2b6ec75f9624c1a8d33ed43aecd6aa47aa063785 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 28 Jun 2021 14:10:44 +0100 Subject: [PATCH 408/520] Removed old files --- lib_xud/src/core/XUD_UIFM_PConfig.S | 177 ---------- lib_xud/src/core/XUD_UIFM_RegAccess.S | 46 --- lib_xud/src/core/included/XUD_Token_In.S | 351 -------------------- lib_xud/src/core/included/XUD_Token_Out.S | 161 --------- lib_xud/src/core/included/XUD_Token_Setup.S | 84 ----- 5 files changed, 819 deletions(-) delete mode 100755 lib_xud/src/core/XUD_UIFM_PConfig.S delete mode 100644 lib_xud/src/core/XUD_UIFM_RegAccess.S delete mode 100755 lib_xud/src/core/included/XUD_Token_In.S delete mode 100755 lib_xud/src/core/included/XUD_Token_Out.S delete mode 100644 lib_xud/src/core/included/XUD_Token_Setup.S diff --git a/lib_xud/src/core/XUD_UIFM_PConfig.S b/lib_xud/src/core/XUD_UIFM_PConfig.S deleted file mode 100755 index d08d47c5..00000000 --- a/lib_xud/src/core/XUD_UIFM_PConfig.S +++ /dev/null @@ -1,177 +0,0 @@ -// Copyright 2011-2021 XMOS LIMITED. -// This Software is subject to the terms of the XMOS Public Licence: Version 1. - -// XUD_UIFM_PConfig.S -// Port configuration for UIFM -// Ross Owen - -#include - -// From Autodefines... -#define SETCTRL_LMODE_SHIFT 12 -#define SETCTRL_VALUE_SHIFT 3 -#define SETCTRL_LMODE_PIN_DELAY 7 -#define SETCTRL_LMODE_FALL_DELAY 8 -#define SETCTRL_LMODE_RISE_DELAY 9 -#define SETCTRL_MODE_LONG 7 -#define SETCTRL_MODE_SHIFT 0 - -.text - -/////////////////////////////////////////////////////////////////////////////////////////////////////////// -// -// XUD_UIFM_PortConfig(in port clk_port, out port reg_write_port, in port reg_read_port, -// in port flag0_port, -// in port flag1_port, -// in port flag2_port, -// out port txd_port, in port txd_port); -// - -#define CLK r0 -#define REG_WRITE r1 -#define REG_READ r2 -#define FLAG0 r3 - -.globl XUD_UIFM_PortConfig -.type XUD_UIFM_PortConfig, @function - -.cc_top XUD_UIFM_PortConfig.function -XUD_UIFM_PortConfig: - entsp 16 - stw r10, sp[1] - stw r9, sp[2] - stw r8, sp[3] - stw r7, sp[4] - -//EnableClockBuffers: - //setc res[r0], XS1_SETC_BUF_BUFFERS // Set port to buffered strobed master - //ldc r11, 32 // Set transfer width to 32 bits - //settw res[r0], r11 - -InvertUsbClock: - setc res[r0], XS1_SETC_INV_INVERT - setc res[r0], XS1_SETC_COND_NONE - -ConfigClockBlock: - ldc r10, XS1_CLKBLK_REF // Ideally we don't use clock block 0 but its hardwired - setc res[r10], XS1_SETC_INUSE_ON - //setc res[r10], XS1_SETC_RUN_STOPR - setclk res[r10], r0 // Clock clockblock from usb clock - -DelayFallingEdge: // Delay falling clock block pulse - ldc r8, SETCTRL_LMODE_FALL_DELAY - ldc r11, SETCTRL_LMODE_SHIFT - shl r9, r8, r11 - ldc r11, SETCTRL_VALUE_SHIFT - ldc r7, 1 - shl r8, r7, r11 - or r9, r9, r8 - ldc r8, SETCTRL_MODE_LONG - ldc r11, SETCTRL_MODE_SHIFT - shl r8, r8, r11 - or r9, r9, r8 - setc res[r10], r9 - -DelayRisingEdge: // Delay rising clock block pulse - ldc r8, SETCTRL_LMODE_RISE_DELAY - ldc r11, SETCTRL_LMODE_SHIFT - shl r9, r8, r11 - ldc r11, SETCTRL_VALUE_SHIFT - ldc r7, 0 - shl r8, r7, r11 - or r9, r9, r8 - ldc r8, SETCTRL_MODE_LONG - ldc r11, SETCTRL_MODE_SHIFT - shl r8, r8, r11 - or r9, r9, r8 - setc res[r10], r9 - - - -StartClockBlock: - setc res[r10], XS1_SETC_RUN_STARTR - -ConfigRegWritePort: // UIFM reg write port - setc res[REG_WRITE], XS1_SETC_SDELAY_SDELAY // Sample on falling edge of clock - setclk res[REG_WRITE], r10 // Clock off USB clock-block - ldc r11, 0 // Turn port around - //out res[REG_WRITE], r11 // Caused intermittant issues on some boards (caused d+/d- spike on first reg-write on on occations - - setc res[REG_WRITE], XS1_SETC_BUF_BUFFERS // Set port to buffered strobed master - setc res[REG_WRITE], XS1_SETC_RDY_STROBED - setc res[REG_WRITE], XS1_SETC_MS_MASTER - setc res[REG_WRITE], XS1_SETC_RUN_CLRBUF - -ConfigRegReadPort: // UIFM reg read port - setc res[REG_READ], XS1_SETC_SDELAY_SDELAY - setclk res[REG_READ], r10 - - setc res[REG_READ], XS1_SETC_BUF_BUFFERS - setc res[REG_READ], XS1_SETC_RDY_HANDSHAKE - setc res[REG_READ], XS1_SETC_MS_MASTER - setc res[REG_READ], XS1_SETC_RUN_CLRBUF - -ConfigFlagPort0: // Config UIFM flag port0 - setc res[FLAG0], XS1_SETC_SDELAY_SDELAY - setclk res[FLAG0], r10 - setc res[FLAG0], XS1_SETC_RUN_CLRBUF - -ConfigFlagPort1: // Config UIFM flag port1 - ldw r11, sp[17] // Flag port1: 5th arg - setc res[r11], XS1_SETC_SDELAY_SDELAY - setclk res[r11], r10 - setc res[r11], XS1_SETC_RUN_CLRBUF - setc res[r11], XS1_SETC_COND_EQ - -ConfigFlagPort2: // Config UIFM flag port2 - ldw r11, sp[18] // Flag port2: 6th arg - setc res[r11], XS1_SETC_SDELAY_SDELAY - setclk res[r11], r10 - setc res[r11], XS1_SETC_RUN_CLRBUF - setc res[r11], XS1_SETC_COND_EQ - -ConfigureTxDataPort: - ldw r11, sp[19] - setc res[r11], XS1_SETC_SDELAY_SDELAY - setclk res[r11], r10 - - ldc r9, 0 // Turn port around - out res[r11], r9 - - setc res[r11], XS1_SETC_BUF_BUFFERS - ldc r9, 32 // Set transfer width to 32 bits - settw res[r11], r9 - setc res[r11], XS1_SETC_RDY_HANDSHAKE // Set port to handshaken master - setc res[r11], XS1_SETC_MS_MASTER - - setc res[r11], XS1_SETC_RUN_CLRBUF - -ConfigureRxDataPort: - ldw r11, sp[20] - setc res[r11], XS1_SETC_SDELAY_SDELAY - - setc res[r11], XS1_SETC_BUF_BUFFERS - ldc r9, 32 - settw res[r11], r9 // Set transfer width to 32 bits - setc res[r11], XS1_SETC_RDY_HANDSHAKE - setc res[r11], XS1_SETC_MS_MASTER - - - setclk res[r11], r10 - setc res[r11], XS1_SETC_RUN_CLRBUF - - ldw r10, sp[1] - ldw r9, sp[2] - ldw r8, sp[3] - ldw r7, sp[4] - retsp 16 -.size XUD_UIFM_PortConfig,.-XUD_UIFM_PortConfig -.cc_bottom XUD_UIFM_PortConfig.function -.globl XUD_UIFM_PortConfig.nstackwords -.globl XUD_UIFM_PortConfig.maxthreads -.globl XUD_UIFM_PortConfig.maxtimers -.globl XUD_UIFM_PortConfig.maxchanends -.set XUD_UIFM_PortConfig.nstackwords, 16 -.set XUD_UIFM_PortConfig.maxchanends, 0 -.set XUD_UIFM_PortConfig.maxtimers, 0 -.set XUD_UIFM_PortConfig.maxthreads, 0 diff --git a/lib_xud/src/core/XUD_UIFM_RegAccess.S b/lib_xud/src/core/XUD_UIFM_RegAccess.S deleted file mode 100644 index 4f5134db..00000000 --- a/lib_xud/src/core/XUD_UIFM_RegAccess.S +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2011-2021 XMOS LIMITED. -// This Software is subject to the terms of the XMOS Public Licence: Version 1. -/** XUD_UIFM_RegAccess.S - * @brief Functions for UIFM register read/write - * @author Ross Owen, XMOS Limited - */ - -#include - -#include - -#ifndef GLX -#ifndef XS1_PS_XCORE_CTRL0 -#define XS1_PS_XCORE_CTRL0 0x20b -#endif -#include "XUD_AlignmentDefines.h" - -.text -.globl XUD_UIFM_Enable, "f{ui}(ui)" -.type XUD_UIFM_Enable, @function -.cc_top XUD_UIFM_Enable.function -.align FUNCTION_ALIGNMENT -// void XUD_UIFM_Enable (unsigned mode); -XUD_UIFM_Enable: - ldc r1, XS1_PS_XCORE_CTRL0 - set ps[r1], r0 - - // Sanity check, read back and check - //get r1, ps[r1] - //eq r1, r0, r1 - //ecallf r1 - retsp 0 - -.size XUD_UIFM_Enable, .-XUD_UIFM_Enable -.cc_bottom XUD_UIFM_Enable.function -.globl XUD_UIFM_Enable.nstackwords -.globl XUD_UIFM_Enable.maxchanends -.globl XUD_UIFM_Enable.maxtimers -.globl XUD_UIFM_Enable.maxcores -.set XUD_UIFM_Enable.nstackwords, 0 -.set XUD_UIFM_Enable.maxchanends, 0 -.set XUD_UIFM_Enable.maxtimers, 0 -.set XUD_UIFM_Enable.maxcores, 1 -.set XUD_UIFM_Enable.locnochandec, 1 - -#endif diff --git a/lib_xud/src/core/included/XUD_Token_In.S b/lib_xud/src/core/included/XUD_Token_In.S deleted file mode 100755 index 4698abef..00000000 --- a/lib_xud/src/core/included/XUD_Token_In.S +++ /dev/null @@ -1,351 +0,0 @@ -// Copyright 2011-2021 XMOS LIMITED. -// This Software is subject to the terms of the XMOS Public Licence: Version 1. -#include -#include "XUD_AlignmentDefines.h" - -// Ports -#define RXD r0 -#define RXA r1 -#define TXD r2 - -//.text -// On entry: -// R11: Branch address (now free) -// R10: EP number (used here) -// R9 : CRC16 Poly (used here) -// R8 : -// R7 : -// R6 : ep_pid_sequence_table_IN_A -// R5 : Channel Array -// R4 : -// R3 : 0 -// R2 : TXD -// R1 : Valid Token Port -// R0 : RXD -.align FUNCTION_ALIGNMENT -InNotReady: - ldw r11, sp[SP_EPTYPES_OUT] - ldw r11, r11[r10] // Load EP Type - bt r11, XUD_IN_TxNak - ldc r11, 0xc3 // Create 0-length packet - outpw res[TXD], r11, 24 - -#include "XUD_TokenJmp.S" - -XUD_IN_TxNak: // Non-Iso - ldaw r11, dp[handshakeTable_IN] // Load handshake table - ldw r11, r11[r10] // Load handshake PID - outpw res[TXD], r11, 8 - -#include "XUD_TokenJmp.S" - - - -.align 128 -#ifdef ARCH_L -.skip 92 -//.skip 98 -#else -.skip 78 -#endif -Pid_In: -#ifdef ARCH_L - inpw r10, res[RXD], 8; // Read EP Number - shr r10, r10, 24; // Shift off junk - - in r11, res[r1]; - bt r11, XUD_InvalidToken; // If VALID_TOKEN not high, ignore token - PORT INVERTED! */ -#else - #include "XUD_G_Crc.S" -#endif - //add r3, r4, r10 // IN channel offset (R10: EP number, E4: Num out Eps) - ldaw r3, r10[4] // R3 = R10 + 16 - ldw r4, r5[r3] // Load EP structure address - bf r4, InNotReady // If 0 then not ready... - -In_LoadPid: - ldw r11, r4[4] // Load PID from structure - -InReady: - ldw r8, r4[3] // Load buffer - - ldw r6, r4[7] // Load tail length (bytes) - - ldw r4, r4[6] // Load buffer index - bf r4, SmallTxPacket // Check for Short packet - -.xtabranch TxTail0, TxTail1, TxTail2, TxTail3 - bru r6 // Branch on tail length - -//-------------------------------------------------------------------------- -.align 64 -.skip 0 -TxTail0: - ldw r6, r8[r4] // Load first data word - add r4, r4, 1 // Buffer index increment -XUD_IN_TxPid_Tail0: - outpw res[TXD], r11, 8 // Output PID to port - out res[TXD], r6 // Output first data word - crc32 r7, r6, r9 // Run CRC - bf r4, TxLoop0End -TxLoop0: - ldw r6, r8[r4] // Load last data word - add r4, r4, 1 -TxLoop0_Out: - out res[TXD], r6 // Output last data word - crc32 r7, r6, r9 - bt r4, TxLoop0 -TxLoop0End: // Word aligned data (just output CRC) - crc32 r7, r4, r9 // R4: 0 (from bt) - not r7, r7 - -XUD_IN_TxCrc_Tail0: - outpw res[TXD], r7, 16 // Output CRC - bu DoneTail - -.align 64 -.skip 0 -TxTail1: - ldw r6, r8[r4] // Load first data word - add r4, r4, 1 // Buffer index increment -XUD_IN_TxPid_Tail1: - outpw res[TXD], r11, 8 // Out PID - out res[TXD], r6 - crc32 r7, r6, r9 - bf r4, TxLoop1End -TxLoop1: - ldw r6, r8[r4] // Load last data word - add r4, r4, 1 - out res[TXD], r6 - crc32 r7, r6, r9 - bt r4, TxLoop1 -TxLoop1End: - ldw r6, r8[r4] // Load last data word - outpw res[TXD], r6, 8 - crc8 r7, r6, r6, r9 - crc32 r7, r4, r9 // r4: 0 (from bf) - not r7, r7 - -XUD_IN_TxCrc_Tail1: - outpw res[TXD], r7, 16 - bu DoneTail - -.scheduling off -.align 64 -.skip 0 -TxTail2: - ldw r6, r8[r4] // Load first data word - crc32 r7, r6, r9 -XUD_IN_TxPid_Tail2: - outpw res[TXD], r11, 8 // Out PID - out res[TXD], r6 - add r4, r4, 1 - bf r4, TxLoop2End -TxLoop2: - ldw r6, r8[r4] // Load first data word - add r4, r4, 1 - crc32 r7, r6, r9 - out res[TXD], r6 - bt r4, TxLoop2 - -TxLoop2End: - ldw r6, r8[r4] // Load tail - crc8 r7, r11, r6, r9 - outpw res[TXD], r6, 16 - crc8 r7, r11, r11, r9 - crc32 r7, r4, r9 // r4: 0 (from bf) - not r7, r7 - -XUD_IN_TxCrc_Tail2: - outpw res[TXD], r7, 16 - bu DoneTail - -.align 64 -.skip 0 -TxTail3: - ldw r6, r8[r4] // Load first data word - add r4, r4, 1 -XUD_IN_TxPid_Tail3: - outpw res[TXD], r11, 8 // Out PID - out res[TXD], r6 - crc32 r7, r6, r9 - bf r4, TxLoop3End -TxLoop3: - ldw r6, r8[r4] // Load first data word - add r4, r4, 1 - crc32 r7, r6, r9 - out res[TXD], r6 - bt r4, TxLoop3 -TxLoop3End: - ldw r6, r8[r4] // Load tail - crc8 r7, r11, r6, r9 - outpw res[TXD], r6, 24 - crc8 r7, r11, r11, r9 - crc8 r7, r11, r11, r9 - crc32 r7, r4, r9 // r4: 0 (from bf) - not r7, r7 -XUD_IN_TxCrc_Tail3: - outpw res[TXD], r7, 16 - -.scheduling default -// Wait for handshake... or timeout -DoneTail: - ldw r11, sp[SP_EPTYPES_OUT] - ldw r11, r11[r10] // Load EP Type - bt r11, SetupReceiveHandShake - -InISO: - ldc r9, 0 //TODO - bu DoneTx - -InNonISO: -SetupReceiveHandShake: - ldc r11, 8 - setpsc res[RXD], r11 // Set port shift count (expect 8 bit handshake) - //ldap r11, TxHandShakeReceived - //setv res[RXD], r11 - eeu res[RXD] // Events on RXD always enabled - Can;t be any more due to using events on channels - -SetupTimeout: // Timeout done using another port off same clock block we dont happen to already be using events on. Cunning. - ldw r1, sp[STACK_FLAG0_PORT] // Load saved ValidToken port. Event vector already set. - in r11, res[r1] // Do input and get port time/timestamps - getts r11, res[r1] - ldw r9, dp[g_txHandshakeTimeout] - add r11, r11, r9 - setpt res[r1], r11 // Set port time and enable events - eeu res[r1] - -WaitForHandshake: // Wait for timeout or handshake - .xtabranch TxHandshakeTimeOut, TxHandShakeReceived - waiteu - - -// We sent some data but the host didn't handshake in time. Needs a re-send. -.align FUNCTION_ALIGNMENT -TxHandshakeTimeOut: - in r11, res[r1] // This will clear port time - edu res[r1] - edu res[RXD] - bu BadHandShake - -// Transmitted data, and got something back within the timeout. Check for valid handshake... -.align FUNCTION_ALIGNMENT -TxHandShakeReceived: -XUD_IN_RxAck: - in r11, res[RXD] // Input data from RXD port - clrpt res[r1] // Clear port time on valid token port - edu res[RXD] - shr r11, r11, 24 // Shift off junk data to leave ACK -#if defined(__XS2A__) - ldc r9, USB_PID_ACK // Check for good ACK (L series strips of negated bits from PID) -#else - ldc r9, USB_PIDn_ACK -#endif - xor r9, r11, r9 - edu res[r1] // Disable events on ValidToken port - bt r9, BadHandShake // Invalid handshake received from host. we need to resend... - -DoneTx: - //ldap r11, NextRxWord // Restore RXD event vector - //setv res[RXD], r11 - -ClearInEpReady: // TODO Tidy this up - //ldw r4, sp[(STACK_EXTEND+8)] / Load num out EPs - //add r11, r4, r10 // IN channel offset (R10: EP number) - - ldw r10, r5[r3] // Load the EP struct - stw r9, r5[r3] // Clear the ready - ldw r11, r10[1] // Load channel - out res[r11], r11 // Output word to signal packet sent okay - - bu NextToken - -BadHandShake: // Received a bad (or no)handshake - //ldap r11, NextRxWord // Restore RXD event vector - //setv res[RXD], r11 - bu NextToken - -.align 32 -.skip 28 -SmallTxPacket: - ldw r8, r8[r4] // Load first data word - -.xtabranch TxTail0s, TxTail1s, TxTail2s, TxTail3s - bru r6 // branch taillength - -//-------------------------------------------------------------------------- -.align 64 -.skip 0 -TxTail0s: // We know this is a < 4 byte packet, so is 0 length packet - // So crc = 0. Note our normal crc calculation works for this, it is - //not a special CRC case, but helps with timing. - ldc r8, 0 -XUD_IN_TxPid_TailS0: - outpw res[TXD], r11, 8 // PID - //crc32 r7, r11, r9 // r11: 0 - //not r7, r7 - -XUD_IN_TxCrc_TailS0: - outpw res[TXD], r8, 16 // r5: 0 - bu DoneTail - -.align 64 -.skip 0 -TxTail1s: - ldc r6, 0 - // One tail byte - shl r8, r8, 8 // Concat PID and Data - or r11, r11, r8 - shr r8, r8, 8 - crc8 r7, r4, r8, r9 - crc32 r7, r6, r9 // r5: 0 - not r7, r7 - -XUD_IN_TxPid_TailS1: - outpw res[TXD], r11, 16 // PID - ///outpw res[TXD], r6, 16 -XUD_IN_TxCrc_TailS1: - outpw res[TXD], r7, 16 - bu DoneTail - -.align 64 -.skip 0 -TxTail2s: - ldc r6, 0 - - // Two tail byte - shl r8, r8, 8 - or r11, r11, r8 // r11: D1 | D0 | PID - shr r8, r8, 8 - -XUD_IN_TxPid_TailS2: - outpw res[TXD], r11, 24 - - crc8 r7, r8, r8, r9 - crc8 r7, r8, r8, r9 - crc32 r7, r6, r9 // r6: 0 - not r7, r7 - -XUD_IN_TxCrc_TailS2: - outpw res[TXD], r7, 16 - bu DoneTail - -.align 64 -.skip 0 -TxTail3s: - ldc r6, 0 - // Two tail byte -XUD_IN_TxPid_TailS3: - outpw res[TXD], r11, 8 // PID - outpw res[TXD], r8, 24 - crc8 r7, r8, r8, r9 - crc8 r7, r8, r8, r9 - crc8 r7, r8, r8, r9 - - crc32 r7, r6, r9 // r5: 0 - not r7, r7 - -XUD_IN_TxCrc_TailS3: - outpw res[TXD], r7, 16 - bu DoneTail - diff --git a/lib_xud/src/core/included/XUD_Token_Out.S b/lib_xud/src/core/included/XUD_Token_Out.S deleted file mode 100755 index 764b83d4..00000000 --- a/lib_xud/src/core/included/XUD_Token_Out.S +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright 2011-2021 XMOS LIMITED. -// This Software is subject to the terms of the XMOS Public Licence: Version 1. -// r10: EP number -// OUT Token Packet ----------------------------------------------------------------------------- -// Ports -#include "XUD_AlignmentDefines.h" - -#define RXD r0 -#define TXD r2 - -.align FUNCTION_ALIGNMENT -.skip 0 -Pid_Out: - #include "XUD_CrcAddrCheck.S" - ldw r3, r5[r10] // Load relevant EP pointer - bf r3, XUD_TokenOut_BufferFull - ldw r1, r3[3] // Load buffer from EP structure - -CheckEpTypeOut: - ldw r11, r3[5] // Load EP type - BRFT_ru6 r11, DoOutNonIso // ISO endpoint - -OutReady: - stw r11, r5[r10] // Clear ready straight away - we don't to CRC checking on Iso - else we would have to wait for end of packet - bl doRXData - clre - -InformEP_Iso: // Iso EP - no handshake - ldw r11, r3[1] // Load EP chanend - out res[r11], r4 // Output datalength (words) - outt res[r11], r8 // Send tail length - - ldc r7, 0xf335 // CRC16 init (in) - ldc r6, 0x3334 // CRC16 init (out) - Needs reseting after an out -#ifndef __XS3A__ - ldw r1, sp[STACK_FLAG0_PORT] -#endif - //ldc r4, XUD_MAX_NUM_EP_OUT // This could be shaved if XUD_MAX_NUM_EP's < 12. Now use an LDAW to at 16. - -//------------------------------------------------------------------------------------------------ -#if defined(__XS2A__) - ldaw r10, dp[PidJumpTable] - // Original USB Token: | CRC | EP | ADDR | PID | junk - // Received token is address and CRC checked. - // We receive: | 0000 4-bit EP | 0000 4-bit PID | -XUD_TokenRx_Pid_: - inpw r11, res[RXD], 8 // Read 8 bit PID - shr r11, r11, 24 // Shift off junk - - ldw r10, r10[r11] // Load relevant branch address - -BranchOnTokenPid_: -.xtabranch Pid_Out, Pid_Sof, Pid_In, Pid_Setup, Pid_Sof_NoChan - bau r10 -#else - ldc r4, 16 - -ReadToken_: - inpw r11, res[RXD], 8 // Read 3 byte token from data port | CRC[5] | EP[4] | ADDR[7] | PID[8] | junk - ldaw r10, dp[PidJumpTable] - setpsc res[RXD], r4 - shr r11, r11, 24 - -JumpOnPid_: - ldw r11, r10[r11] - .xtabranch Pid_Out, Pid_Sof, Pid_In, Pid_Setup - bau r11 -#endif - -.align FUNCTION_ALIGNMENT -.skip 0 -DoOutNonIso: - bl doRXData - clre - - eq r1, r6, r11 // Check for good CRC16 - -doRXDataReturn_NonIso: - bf r1, NextTokenAfterOut // Check for bad crc - - ldaw r6, dp[handshakeTable_OUT] // Load the handshake table. - ldw r11, r6[r10] // Get the handshake PID for this EP - ldc r1, USB_PIDn_STALL // as well as the STALL PID - eq r1, r11, r1 // and compare them. - bt r1, XUD_TokenOut_Handshake // If the handshake PID for this EP is STALL, then - // go and send the handshake without clearing ready - // or communicating back to the application that - // the packet has been received. - - ldc r11, USB_PIDn_ACK // Data CRC good, EP not Iso, and EP not halted: Send Ack - outpw res[TXD], r11, 8 - syncr res[TXD] - -StoreTailDataOut: - ldc r11, 0 - stw r11, r5[r10] // Clear ready - ldw r11, r3[1] // Load EP chanend - - out res[r11], r4 // Output datalength (words) - outt res[r11], r8 // Send tail length - - bu NextTokenAfterOut - -// Various Error handling functions ------------------------------------------------------------------- -.align FUNCTION_ALIGNMENT -Err_RxErr: // RxError signal high during data packet receive: - DUALENTSP_lu 0 - clrsr 3 - clre - ldw r10, sp[15] // Read out data from RxE port - in r11, res[r10] - eeu res[r10] - ldw r10, sp[10] - in r11, res[r10] // Wait for rxa low and ignore packet (let transaction timout) - setsr 3 // Re-enable thread interrupts - bu NextToken - -Err_EndpointProblem: - // TODO:Endpoint in trouble (send STALL) or disabled (ignore?)... - bu NextToken - -//Err_BadDataCrc: // Data packet received with bad crc: Ignore; wait for timeout (host will re-send) - //bu NextToken - -Err_BadPidSeq: // Bad pid sequencing (already ACKed good data). Ignore data - bu NextToken - -XUD_TokenOut_BufferFull: - ldw r9, dp[flag1_port] - setc res[r9], XS1_SETC_RUN_CLRBUF - setc res[r9], XS1_SETC_COND_NEQ -XUD_TokenOut_WaitForPacketEnd: // Wait for end of data then send NAK - in r11, res[r9] - setc res[r9], XS1_SETC_COND_EQ - in r11, res[r9] - // TODO: Observe interpacket delay -#ifndef XUD_NAK_ISO_OUT - ldw r4, sp[(STACK_EXTEND+5)] // Load ep type table - ldw r4, r4[r10] // load EP type - bf r4, PrimaryBufferFull_NoNak -#endif - - // LOAD HANDSHAKE PID or STALL - ldaw r6, dp[handshakeTable_OUT] // Load handshake table -XUD_TokenOut_Handshake: - ldw r11, r6[r10] - outpw res[TXD], r11, 8 - syncr res[TXD] - -PrimaryBufferFull_NoNak: - setc res[RXD], XS1_SETC_RUN_CLRBUF - bu NextToken - -// Timedout waiting for data after OUT... go back to waiting for tokens -//OutDataTimeOut: - //clre - //bl ERR_OutDataTimeout - //bu NextToken - - - diff --git a/lib_xud/src/core/included/XUD_Token_Setup.S b/lib_xud/src/core/included/XUD_Token_Setup.S deleted file mode 100644 index aadea792..00000000 --- a/lib_xud/src/core/included/XUD_Token_Setup.S +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2011-2021 XMOS LIMITED. -// This Software is subject to the terms of the XMOS Public Licence: Version 1. -#include "XUD_AlignmentDefines.h" - -.text - -#if 0 -WaitForEndDataPacket: - ldw r10, sp[10] // Load RxA Port ID (r1) - in r11, res[r10] - bt r11, waitforRXALow - setc res[RXD], XS1_SETC_RUN_CLRBUF - bu NextTokenAfterOut -#endif - -// We received a setup token. This is much the same as out token, apart from: -// - Can't NAK a setup -// - Data PID will always be DATA0 -// - Payload will always be 8 bytes - -.align FUNCTION_ALIGNMENT -Pid_Setup: -#ifdef ARCH_L - inpw r10, res[RXD], 8; // Read EP Number - shr r10, r10, 24; // Shift off junk - - in r4, res[r1]; - bt r4, XUD_InvalidToken; // If VALID_TOKEN not high, ignore token - PORT INVERTED -#else - #include "XUD_G_Crc.S" -#endif - ldw r3, r5[r10] // Load relevant EP pointer - bf r3, SBuffFull - ldw r1, r3[3] // Load buffer - - -SetupReady: - //ldw r10, sp[10] // Load RxA Port ID (r1) - // TODO Do a timeout here? - -LoadSetupBuffer: - bl doRXData // RXData writes available data to buffer and does crc check. - // r8: Data tail size (bytes) - clre - eq r1, r6, r11 // Check for good CRC16 - bf r1, NextTokenAfterOut // Check for bad crc - -ClearStall: // CRC OK - // Have received a SETUP so clear any STALL condition on IN/OUT endpoint. - ldaw r11, dp[handshakeTable_OUT] - ldc r6, USB_PIDn_NAK - stw r6, r11[r10] - ldaw r11, dp[handshakeTable_IN] - stw r6, r11[r10] - -SendSetupAck: - ldc r11, USB_PIDn_ACK - outpw res[TXD], r11, 8 - -StoreTailData: // TODO: don't assume setups are 8 bytes + crc - ldc r11, 0 - stw r11, r5[r10] // Clear ready - ldw r11, r3[1] // Load chanend - - out res[r11], r4 - outct res[r11], 0 // Send zero control token for SETUP. Tail ignored since always expect 8 bytes - bu NextTokenAfterOut // Go to next wait for next token - - -SBuffFull: - ldc r11, 0 - ldw r10, sp[10] // Load RxA Port ID (r1) - in r11, res[r10] // RXA event cond = 0 TODO: Wait for RXA high first? - endin r11, res[RXD] - in r11, res[RXD] - - bu NextTokenAfterOut - -BadDataCrcSetup: - mov r0, r1 - bl ERR_BadCrc - outct res[r5], 9 - in r11, res[r5] // TODO should only need CT - bu NextToken From 8693697de1ad60a55c634c0f2cf22e842939d191 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 28 Jun 2021 14:37:22 +0100 Subject: [PATCH 409/520] Header file rename --- lib_xud/src/core/XUD_Main.xc | 2 +- lib_xud/src/core/{XUD_PowerSig.h => XUD_Signalling.h} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename lib_xud/src/core/{XUD_PowerSig.h => XUD_Signalling.h} (100%) diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index f347aa36..78ef97d7 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -25,7 +25,7 @@ void XUD_Error_hex(char errString[], int i_err); #include "XUD_Support.h" #include "XUD_DeviceAttach.h" -#include "XUD_PowerSig.h" +#include "XUD_Signalling.h" #include "XUD_HAL.h" #include "XUD_TimingDefines.h" diff --git a/lib_xud/src/core/XUD_PowerSig.h b/lib_xud/src/core/XUD_Signalling.h similarity index 100% rename from lib_xud/src/core/XUD_PowerSig.h rename to lib_xud/src/core/XUD_Signalling.h From 741a649fe1c42e0b2235a5c4b8831aee125d82d9 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 28 Jun 2021 17:11:30 +0100 Subject: [PATCH 410/520] Resolving merge issues --- tests/test_bulk_rx_fastpacket.py | 42 ---- tests/test_bulk_rx_fastpacket/src/main.xc | 182 ------------------ tests/test_bulk_rx_fastpacket/src/xc_ptr.h | 48 ----- tests/test_bulk_rx_fastpacket_multiep.py | 50 ----- .../src/xc_ptr.h | 48 ----- tests/test_bulk_rxtx_fastpacket.py | 45 ----- tests/test_bulk_tx_basic_noack.py | 109 +++++------ tests/test_bulk_tx_fastpacket.py | 41 ---- 8 files changed, 48 insertions(+), 517 deletions(-) delete mode 100644 tests/test_bulk_rx_fastpacket.py delete mode 100644 tests/test_bulk_rx_fastpacket/src/main.xc delete mode 100644 tests/test_bulk_rx_fastpacket/src/xc_ptr.h delete mode 100644 tests/test_bulk_rx_fastpacket_multiep.py delete mode 100644 tests/test_bulk_rx_fastpacket_multiep/src/xc_ptr.h delete mode 100644 tests/test_bulk_rxtx_fastpacket.py delete mode 100644 tests/test_bulk_tx_fastpacket.py diff --git a/tests/test_bulk_rx_fastpacket.py b/tests/test_bulk_rx_fastpacket.py deleted file mode 100644 index e3583e6e..00000000 --- a/tests/test_bulk_rx_fastpacket.py +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env python -# Copyright 2016-2021 XMOS LIMITED. -# This Software is subject to the terms of the XMOS Public Licence: Version 1. - -import random -import xmostest -from usb_packet import * -from usb_clock import Clock -from helpers import do_rx_test, packet_processing_time, get_dut_address -from helpers import choose_small_frame_size, check_received_packet, runall_rx - -def do_test(arch, clk, phy, seed): - rand = random.Random() - rand.seed(seed) - - dev_address = get_dut_address() - ep_loopback = 3 - - # The inter-frame gap is to give the DUT time to print its output - packets = [] - - data_val = 0; - pkt_length = 20 - data_pid = 0x3 #DATA0 - - for pkt_length in range(10, 20): - - # min 237 - # increased to 277 when SETUP/OUT checking added - AppendOutToken(packets, ep_loopback, inter_pkt_gap=277) - packets.append(TxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) #DATA0 - packets.append(RxHandshakePacket(timeout=9)) - - data_val = data_val + pkt_length - data_pid = data_pid ^ 8 - - do_rx_test(arch, clk, phy, packets, __file__, seed, - level='smoke', extra_tasks=[]) - -def runtest(): - random.seed(1) - runall_rx(do_test) diff --git a/tests/test_bulk_rx_fastpacket/src/main.xc b/tests/test_bulk_rx_fastpacket/src/main.xc deleted file mode 100644 index 9e24c69c..00000000 --- a/tests/test_bulk_rx_fastpacket/src/main.xc +++ /dev/null @@ -1,182 +0,0 @@ -// Copyright 2016-2021 XMOS LIMITED. -// This Software is subject to the terms of the XMOS Public Licence: Version 1. -/* - * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent - * in both directions between the ports. - * - * NOTE: The src/testbenches/ExampleTestbench must have been compiled for this to run without error. - * - */ -#include -#include -#include -#include "xud.h" -#include "platform.h" -#include "xc_ptr.h" - -#define XUD_EP_COUNT_OUT 5 -#define XUD_EP_COUNT_IN 5 - -/* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; - -void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend ?c_usb_test); - -void exit(int); - -#define FAIL_RX_DATAERROR 0 -#define FAIL_RX_LENERROR 1 - -#define PKT_COUNT 10 -#define INITIAL_PKT_LENGTH 10 - -unsigned fail(int x) -{ - - printstr("\nXCORE: ### FAIL ******"); - switch(x) - { - case FAIL_RX_DATAERROR: - printstr("XCORE RX Data Error\n"); - break; - - case FAIL_RX_LENERROR: - printstr("XCORE RX Length Error\n"); - break; - - } - - exit(1); -} - -unsigned char g_rxDataCheck[5] = {0, 0, 0, 0, 0}; -unsigned char g_txDataCheck[5] = {0,0,0,0,0,}; -unsigned g_txLength[5] = {0,0,0,0,0}; - - -#pragma unsafe arrays -void SendTxPacket(XUD_ep ep, int length, int epNum) -{ - unsigned char buffer[1024]; - unsigned char x; - - for (int i = 0; i < length; i++) - { - buffer[i] = g_txDataCheck[epNum]++; - - //asm("ld8u %0, %1[%2]":"=r"(x):"r"(g_txDataCheck),"r"(epNum)); - // read_byte_via_xc_ptr_indexed(x, p_txDataCheck, epNum); - - //buffer[i] = x; - //x++; - //asm("st8 %0, %1[%2]"::"r"(x),"r"(g_txDataCheck),"r"(epNum)); - //write_byte_via_xc_ptr_indexed(p_txDataCheck,epNum,x); - } - - XUD_SetBuffer(ep, buffer, length); -} - - -#pragma unsafe arrays -int RxDataCheck(unsigned char b[], int l, int epNum) -{ - int fail = 0; - unsigned char x; - - for (int i = 0; i < l; i++) - { - unsigned char y; - //read_byte_via_xc_ptr_indexed(y, p_rxDataCheck, epNum); - if(b[i] != g_rxDataCheck[epNum]) - { - printstr("#### Mismatch on EP: "); - printint(epNum); - printstr(". Got:"); - printhex(b[i]); - printstr(" Expected:"); - printhexln(g_rxDataCheck[epNum]); - //printintln(l); // Packet length - return 1; - } - - g_rxDataCheck[epNum]++; - //read_byte_via_xc_ptr_indexed(x, p_rxDataCheck, epNum); - //x++; - //write_byte_via_xc_ptr_indexed(p_rxDataCheck,epNum,x); - } - - return 0; -} - - -#pragma unsafe arrays -int TestEp_Bulk_Tx(chanend c_in1, int epNum1) -{ - XUD_ep ep_in1 = XUD_InitEp(c_in1); - - unsigned char buffer[PKT_COUNT][1024]; - - int counter = 0; - - for(int i = 0; i< PKT_COUNT; i++) - { - //for(int j = 0; j < lengths[i]; j++) - { - // buffer[i] = counter++; - } - } - -} - - -#pragma unsafe arrays -int TestEp_Bulk_Rx(chanend c_out1, int epNum1) -{ - // TODO check rx lengths - - - unsigned int length[PKT_COUNT]; - XUD_Result_t res; - - XUD_ep ep_out1 = XUD_InitEp(c_out1); - - /* Buffer for Setup data */ - unsigned char buffer[PKT_COUNT][1024]; - - /* Receive a bunch of packets quickly, then check them */ -#pragma loop unroll - for(int i = 0; i < PKT_COUNT; i++) - { - XUD_GetBuffer(ep_out1, buffer[i], length[i]); - } -#pragma loop unroll - for(int i = 0; i < PKT_COUNT; i++) - { - RxDataCheck(buffer[i], length[i], epNum1); - } - - exit(0); -} - - -#define USB_CORE 0 -int main() -{ - chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - chan c_sync; - chan c_sync_iso; - - par - { - - XUD_Manager( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, - null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); - - TestEp_Bulk_Rx(c_ep_out[3], 3); - //TestEp_Bulk_Tx(c_ep_in[3], 3); - } - - return 0; -} diff --git a/tests/test_bulk_rx_fastpacket/src/xc_ptr.h b/tests/test_bulk_rx_fastpacket/src/xc_ptr.h deleted file mode 100644 index 8fa5a04e..00000000 --- a/tests/test_bulk_rx_fastpacket/src/xc_ptr.h +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2016-2021 XMOS LIMITED. -// This Software is subject to the terms of the XMOS Public Licence: Version 1. -#ifndef __xc_ptr__ -#define __xc_ptr__ - -typedef unsigned int xc_ptr; - -// Note that this function is marked as const to avoid the XC -// parallel usage checks, this is only really going to work if this -// is the *only* way the array a is accessed (and everything else uses -// the xc_ptr) -inline xc_ptr array_to_xc_ptr(const unsigned a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -inline xc_ptr char_array_to_xc_ptr(const unsigned char a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -#define write_via_xc_ptr_indexed(p,i,x) asm volatile("stw %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_short_via_xc_ptr_indexed(p,i,x) asm volatile("st16 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) - -#define write_via_xc_ptr(p,x) asm volatile("stw %0, %1[0]"::"r"(x),"r"(p)) -// No immediate st8 format -#define write_byte_via_xc_ptr(p,x) write_byte_via_xc_ptr_indexed(p, 0, x) -#define write_short_via_xc_ptr(p,x) write_short_via_xc_ptr_indexed(p, 0, x) - -#define read_via_xc_ptr_indexed(x,p,i) asm("ldw %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_byte_via_xc_ptr_indexed(x,p,i) asm("ld8u %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_short_via_xc_ptr_indexed(x,p,i) asm("ld16s %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); - -#define read_via_xc_ptr(x,p) asm("ldw %0, %1[0]":"=r"(x):"r"(p)); -// No immediate ld8u format -#define read_byte_via_xc_ptr(x,p) read_byte_via_xc_ptr_indexed(x, p, 0) -#define read_short_via_xc_ptr(x,p) read_short_via_xc_ptr_indexed(x, p, 0) - -#define GET_SHARED_GLOBAL(x, g) asm volatile("ldw %0, dp[" #g "]":"=r"(x)::"memory") -#define SET_SHARED_GLOBAL(g, v) asm volatile("stw %0, dp[" #g "]"::"r"(v):"memory") - -#endif diff --git a/tests/test_bulk_rx_fastpacket_multiep.py b/tests/test_bulk_rx_fastpacket_multiep.py deleted file mode 100644 index 8bd918ca..00000000 --- a/tests/test_bulk_rx_fastpacket_multiep.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env python -# Copyright 2016-2021 XMOS LIMITED. -# This Software is subject to the terms of the XMOS Public Licence: Version 1. - -import random -import xmostest -from usb_packet import * -from usb_clock import Clock -from helpers import do_rx_test, packet_processing_time, get_dut_address -from helpers import choose_small_frame_size, check_received_packet, runall_rx - -def do_test(arch, clk, phy, seed): - rand = random.Random() - rand.seed(seed) - - # The inter-frame gap is to give the DUT time to print its output - packets = [] - - data_val = 0; - pkt_length = 20 - data_pid = 0x3 #DATA0 - - for pkt_length in range(10, 20): - - #min 237 - AppendOutToken(packets, 3, inter_pkt_gap=1) - packets.append(TxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) #DATA0 - packets.append(RxHandshakePacket(timeout=9)) - - AppendOutToken(packets, 4, inter_pkt_gap=1) - packets.append(TxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) #DATA0 - packets.append(RxHandshakePacket(timeout=9)) - - AppendOutToken(packets, 5, inter_pkt_gap=0) - packets.append(TxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) #DATA0 - packets.append(RxHandshakePacket(timeout=9)) - - AppendOutToken(packets, 6, inter_pkt_gap=0) - packets.append(TxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) #DATA0 - packets.append(RxHandshakePacket(timeout=9)) - - data_val = data_val + pkt_length - data_pid = data_pid ^ 8 - - do_rx_test(arch, clk, phy, packets, __file__, seed, - level='smoke', extra_tasks=[]) - -def runtest(): - random.seed(1) - runall_rx(do_test) diff --git a/tests/test_bulk_rx_fastpacket_multiep/src/xc_ptr.h b/tests/test_bulk_rx_fastpacket_multiep/src/xc_ptr.h deleted file mode 100644 index 8fa5a04e..00000000 --- a/tests/test_bulk_rx_fastpacket_multiep/src/xc_ptr.h +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2016-2021 XMOS LIMITED. -// This Software is subject to the terms of the XMOS Public Licence: Version 1. -#ifndef __xc_ptr__ -#define __xc_ptr__ - -typedef unsigned int xc_ptr; - -// Note that this function is marked as const to avoid the XC -// parallel usage checks, this is only really going to work if this -// is the *only* way the array a is accessed (and everything else uses -// the xc_ptr) -inline xc_ptr array_to_xc_ptr(const unsigned a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -inline xc_ptr char_array_to_xc_ptr(const unsigned char a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -#define write_via_xc_ptr_indexed(p,i,x) asm volatile("stw %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_short_via_xc_ptr_indexed(p,i,x) asm volatile("st16 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) - -#define write_via_xc_ptr(p,x) asm volatile("stw %0, %1[0]"::"r"(x),"r"(p)) -// No immediate st8 format -#define write_byte_via_xc_ptr(p,x) write_byte_via_xc_ptr_indexed(p, 0, x) -#define write_short_via_xc_ptr(p,x) write_short_via_xc_ptr_indexed(p, 0, x) - -#define read_via_xc_ptr_indexed(x,p,i) asm("ldw %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_byte_via_xc_ptr_indexed(x,p,i) asm("ld8u %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_short_via_xc_ptr_indexed(x,p,i) asm("ld16s %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); - -#define read_via_xc_ptr(x,p) asm("ldw %0, %1[0]":"=r"(x):"r"(p)); -// No immediate ld8u format -#define read_byte_via_xc_ptr(x,p) read_byte_via_xc_ptr_indexed(x, p, 0) -#define read_short_via_xc_ptr(x,p) read_short_via_xc_ptr_indexed(x, p, 0) - -#define GET_SHARED_GLOBAL(x, g) asm volatile("ldw %0, dp[" #g "]":"=r"(x)::"memory") -#define SET_SHARED_GLOBAL(g, v) asm volatile("stw %0, dp[" #g "]"::"r"(v):"memory") - -#endif diff --git a/tests/test_bulk_rxtx_fastpacket.py b/tests/test_bulk_rxtx_fastpacket.py deleted file mode 100644 index 78ab560a..00000000 --- a/tests/test_bulk_rxtx_fastpacket.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python -# Copyright 2016-2021 XMOS LIMITED. -# This Software is subject to the terms of the XMOS Public Licence: Version 1. - -import random -import xmostest -from usb_packet import * -from usb_clock import Clock -from helpers import do_rx_test, packet_processing_time, get_dut_address -from helpers import choose_small_frame_size, check_received_packet, runall_rx - -def do_test(arch, clk, phy, seed): - rand = random.Random() - rand.seed(seed) - - ep = 3 - - packets = [] - - data_val = 0; - pkt_length = 20 - data_pid = 0x3 #DATA0 - - for pkt_length in range(10, 20): - - # < 17 fails for SI - # < 37 fails for DI - AppendOutToken(packets, ep, inter_pkt_gap=37) - packets.append(TxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) #DATA0 - # 9 works for SI - packets.append(RxHandshakePacket(timeout=10)) - - AppendInToken(packets, ep, inter_pkt_gap=0) - packets.append(RxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) - packets.append(TxHandshakePacket()) - - data_val = data_val + pkt_length - data_pid = data_pid ^ 8 - - do_rx_test(arch, clk, phy, packets, __file__, seed, - level='smoke', extra_tasks=[]) - -def runtest(): - random.seed(1) - runall_rx(do_test) diff --git a/tests/test_bulk_tx_basic_noack.py b/tests/test_bulk_tx_basic_noack.py index d087f257..cea92ea5 100644 --- a/tests/test_bulk_tx_basic_noack.py +++ b/tests/test_bulk_tx_basic_noack.py @@ -1,64 +1,51 @@ -#!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. +from usb_packet import USB_PID, TokenPacket, RxDataPacket +from usb_session import UsbSession +from usb_transaction import UsbTransaction +import pytest +from conftest import PARAMS, test_RunUsbSession + + +@pytest.fixture +def test_session(ep, address, bus_speed): + + # Note, quite big gap to allow checking + ied = 4000 + + session = UsbSession( + bus_speed=bus_speed, run_enumeration=False, device_address=address + ) + + for pktLength in range(10, 14): + + if pktLength == 12: + session.add_event( + TokenPacket( + pid=USB_PID["IN"], + address=address, + endpoint=ep, + interEventDelay=ied, + ) + ) + session.add_event( + RxDataPacket( + dataPayload=session.getPayload_in(ep, pktLength, resend=True) + ) + ) + # Missing ACK - simulate CRC fail at host + + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="IN", + dataLength=pktLength, + interEventDelay=ied, + ) + ) + + return session -import random -import xmostest -from usb_packet import * -#import * AppendSetupToken, TxDataPacket, RxDataPacket, TokenPacket, RxHandshakePacket, TxHandshakePacket -from usb_clock import Clock -from helpers import do_rx_test, packet_processing_time, get_dut_address -from helpers import choose_small_frame_size, check_received_packet, runall_rx - - -# Single, setup transaction to EP 0 - -def do_test(arch, tx_clk, tx_phy, seed): - rand = random.Random() - rand.seed(seed) - - dev_address = get_dut_address() - ep = 2 - - # The inter-frame gap is to give the DUT time to print its output - packets = [] - - dataval = 0; - - AppendInToken(packets, ep) - packets.append(RxDataPacket(rand, data_start_val=dataval, length=10, pid=0x3)) #DATA0 - packets.append(TxHandshakePacket()) - - dataval += 10 - AppendInToken(packets, ep, inter_pkt_gap=5000) - packets.append(RxDataPacket(rand, data_start_val=dataval, length=11, pid=0xb)) #DATA1 - packets.append(TxHandshakePacket()) - - #pretend CRC got broken on way to host and dont send ACK - dataval += 11 - AppendInToken(packets, ep, inter_pkt_gap=5000) - packets.append(RxDataPacket(rand, data_start_val=dataval, length=12, pid=0x3)) #DATA0 - #packets.append(TxHandshakePacket()) - - #xCore should resend same packet again.. - AppendInToken(packets, ep, inter_pkt_gap=5000) - packets.append(RxDataPacket(rand, data_start_val=dataval, length=12, pid=0x3)) #DATA0 - packets.append(TxHandshakePacket()) - - dataval += 12 - AppendInToken(packets, ep, inter_pkt_gap=5000) - packets.append(RxDataPacket(rand, data_start_val=dataval, length=13, pid=0xb)) #DATA1 - packets.append(TxHandshakePacket()) - - dataval += 13 - AppendInToken(packets, ep, inter_pkt_gap=5000) - packets.append(RxDataPacket(rand, data_start_val=dataval, length=14, pid=0x3)) #DATA0 - packets.append(TxHandshakePacket()) - - # Note, quite big gap to allow checking. - do_rx_test(arch, tx_clk, tx_phy, packets, __file__, seed, - level='smoke', extra_tasks=[]) - -def runtest(): - random.seed(1) - runall_rx(do_test) diff --git a/tests/test_bulk_tx_fastpacket.py b/tests/test_bulk_tx_fastpacket.py deleted file mode 100644 index dd57ba9f..00000000 --- a/tests/test_bulk_tx_fastpacket.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env python -# Copyright 2016-2021 XMOS LIMITED. -# This Software is subject to the terms of the XMOS Public Licence: Version 1. - -import random -import xmostest -from usb_packet import * -from usb_clock import Clock -from helpers import do_rx_test, packet_processing_time, get_dut_address -from helpers import choose_small_frame_size, check_received_packet, runall_rx - -def do_test(arch, clk, phy, seed): - rand = random.Random() - rand.seed(seed) - - ep = 3 - - # The inter-frame gap is to give the DUT time to print its output - packets = [] - - data_val = 0; - pkt_length = 20 - data_pid = 0x3 #DATA0 - - for pkt_length in range(10, 20): - - #317 lowest for valid data (non-dual issue version) - #337 for initial dual-issue version - AppendInToken(packets, ep, inter_pkt_gap=337) - packets.append(RxDataPacket(rand, data_start_val=data_val, length=pkt_length, pid=data_pid)) - packets.append(TxHandshakePacket()) - - data_val = data_val + pkt_length - data_pid = data_pid ^ 8 - - do_rx_test(arch, clk, phy, packets, __file__, seed, - level='smoke', extra_tasks=[]) - -def runtest(): - random.seed(1) - runall_rx(do_test) From dcce4fadafca4e3e960e0ad6c68a3f36c9d439c9 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 28 Jun 2021 17:19:13 +0100 Subject: [PATCH 411/520] Further post merge tidies --- tests/test_bulk_loopback.py | 1 + tests/test_bulk_rx_basic.py | 1 + tests/test_bulk_rx_basic_badcrc32.py | 1 + tests/test_bulk_rx_basic_badpid.py | 1 + tests/test_bulk_rx_basic_rxerror.py | 1 + tests/test_bulk_rxtx_fastpacket/src/main.xc | 192 ------------------- tests/test_bulk_rxtx_fastpacket/src/xc_ptr.h | 48 ----- tests/test_bulk_tx_basic_noack.py | 1 - tests/test_bulk_tx_basic_noack/src/xc_ptr.h | 48 ----- tests/test_iso_loopback.py | 1 + tests/test_iso_rx_basic.py | 1 + tests/test_iso_tx_basic.py | 1 + tests/usb_packet.py | 1 + 13 files changed, 9 insertions(+), 289 deletions(-) delete mode 100644 tests/test_bulk_rxtx_fastpacket/src/main.xc delete mode 100644 tests/test_bulk_rxtx_fastpacket/src/xc_ptr.h delete mode 100644 tests/test_bulk_tx_basic_noack/src/xc_ptr.h diff --git a/tests/test_bulk_loopback.py b/tests/test_bulk_loopback.py index f2f33370..d5f9765f 100644 --- a/tests/test_bulk_loopback.py +++ b/tests/test_bulk_loopback.py @@ -6,6 +6,7 @@ import pytest from conftest import PARAMS, test_RunUsbSession + @pytest.fixture def test_session(ep, address, bus_speed): diff --git a/tests/test_bulk_rx_basic.py b/tests/test_bulk_rx_basic.py index bc52203f..5a06b8c6 100644 --- a/tests/test_bulk_rx_basic.py +++ b/tests/test_bulk_rx_basic.py @@ -5,6 +5,7 @@ import pytest from conftest import PARAMS, test_RunUsbSession + @pytest.fixture def test_session(ep, address, bus_speed): diff --git a/tests/test_bulk_rx_basic_badcrc32.py b/tests/test_bulk_rx_basic_badcrc32.py index 1a28e24b..a29587d4 100644 --- a/tests/test_bulk_rx_basic_badcrc32.py +++ b/tests/test_bulk_rx_basic_badcrc32.py @@ -5,6 +5,7 @@ import pytest from conftest import PARAMS, test_RunUsbSession + @pytest.fixture def test_session(ep, address, bus_speed): diff --git a/tests/test_bulk_rx_basic_badpid.py b/tests/test_bulk_rx_basic_badpid.py index cbdabca6..ac43b9f6 100644 --- a/tests/test_bulk_rx_basic_badpid.py +++ b/tests/test_bulk_rx_basic_badpid.py @@ -6,6 +6,7 @@ import pytest from conftest import PARAMS, test_RunUsbSession + @pytest.fixture def test_session(ep, address, bus_speed): diff --git a/tests/test_bulk_rx_basic_rxerror.py b/tests/test_bulk_rx_basic_rxerror.py index 310c4407..4385d537 100644 --- a/tests/test_bulk_rx_basic_rxerror.py +++ b/tests/test_bulk_rx_basic_rxerror.py @@ -6,6 +6,7 @@ import pytest from conftest import PARAMS, test_RunUsbSession + @pytest.fixture def test_session(ep, address, bus_speed): diff --git a/tests/test_bulk_rxtx_fastpacket/src/main.xc b/tests/test_bulk_rxtx_fastpacket/src/main.xc deleted file mode 100644 index f4cefde5..00000000 --- a/tests/test_bulk_rxtx_fastpacket/src/main.xc +++ /dev/null @@ -1,192 +0,0 @@ -// Copyright 2016-2021 XMOS LIMITED. -// This Software is subject to the terms of the XMOS Public Licence: Version 1. -/* - * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent - * in both directions between the ports. - * - * NOTE: The src/testbenches/ExampleTestbench must have been compiled for this to run without error. - * - */ -#include -#include -#include -#include "xud.h" -#include "platform.h" -#include "xc_ptr.h" - -#define XUD_EP_COUNT_OUT 5 -#define XUD_EP_COUNT_IN 5 - -/* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; - -void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend ?c_usb_test); - -void exit(int); - -#define FAIL_RX_DATAERROR 0 -#define FAIL_RX_LENERROR 1 - -#define PKT_COUNT 10 -#define INITIAL_PKT_LENGTH 10 - -unsigned fail(int x) -{ - - printstr("\nXCORE: ### FAIL ******"); - switch(x) - { - case FAIL_RX_DATAERROR: - printstr("XCORE RX Data Error\n"); - break; - - case FAIL_RX_LENERROR: - printstr("XCORE RX Length Error\n"); - break; - - } - - exit(1); -} - -unsigned char g_rxDataCheck[5] = {0, 0, 0, 0, 0}; -unsigned char g_txDataCheck[5] = {0,0,0,0,0,}; -unsigned g_txLength[5] = {0,0,0,0,0}; - - -#pragma unsafe arrays -void SendTxPacket(XUD_ep ep, int length, int epNum) -{ - unsigned char buffer[1024]; - unsigned char x; - - for (int i = 0; i < length; i++) - { - buffer[i] = g_txDataCheck[epNum]++; - - //asm("ld8u %0, %1[%2]":"=r"(x):"r"(g_txDataCheck),"r"(epNum)); - // read_byte_via_xc_ptr_indexed(x, p_txDataCheck, epNum); - - //buffer[i] = x; - //x++; - //asm("st8 %0, %1[%2]"::"r"(x),"r"(g_txDataCheck),"r"(epNum)); - //write_byte_via_xc_ptr_indexed(p_txDataCheck,epNum,x); - } - - XUD_SetBuffer(ep, buffer, length); -} - - -#pragma unsafe arrays -int RxDataCheck(unsigned char b[], int l, int epNum) -{ - int fail = 0; - unsigned char x; - - for (int i = 0; i < l; i++) - { - unsigned char y; - //read_byte_via_xc_ptr_indexed(y, p_rxDataCheck, epNum); - if(b[i] != g_rxDataCheck[epNum]) - { - printstr("#### Mismatch on EP: "); - printint(epNum); - printstr(". Got:"); - printhex(b[i]); - printstr(" Expected:"); - printhexln(g_rxDataCheck[epNum]); - //printintln(l); // Packet length - return 1; - } - - g_rxDataCheck[epNum]++; - //read_byte_via_xc_ptr_indexed(x, p_rxDataCheck, epNum); - //x++; - //write_byte_via_xc_ptr_indexed(p_rxDataCheck,epNum,x); - } - - return 0; -} - - -#pragma unsafe arrays -int TestEp_Bulk_Tx(chanend c_in1, int epNum1) -{ - XUD_ep ep_in1 = XUD_InitEp(c_in1); - - unsigned char buffer[PKT_COUNT][1024]; - - int counter = 0; - int length = INITIAL_PKT_LENGTH; - - for(int i = 0; i< PKT_COUNT; i++) - { - for(int j = 0; j < length; j++) - { - buffer[i][j] = counter++; - } - length++; - } - - length = INITIAL_PKT_LENGTH; - -#pragma loop unroll - for(int i = 0; i < PKT_COUNT; i++) - { - XUD_SetBuffer(ep_in1, buffer[i], length++); - } - - exit(0); - -} -#pragma unsafe arrays -int TestEp_Bulk_Rx(chanend c_out1, int epNum1) -{ - // TODO check rx lengths - - unsigned int length[PKT_COUNT]; - XUD_Result_t res; - - XUD_ep ep_out1 = XUD_InitEp(c_out1); - - /* Buffer for Setup data */ - unsigned char buffer[PKT_COUNT][1024]; - - /* Receive a bunch of packets quickly, then check them */ -#pragma loop unroll - for(int i = 0; i < PKT_COUNT; i++) - { - XUD_GetBuffer(ep_out1, buffer[i], length[i]); - } -#pragma loop unroll - for(int i = 0; i < PKT_COUNT; i++) - { - RxDataCheck(buffer[i], length[i], epNum1); - } - - while(1); - -} - - -#define USB_CORE 0 -int main() -{ - chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - chan c_sync; - chan c_sync_iso; - - par - { - - XUD_Manager( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, - null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); - - TestEp_Bulk_Tx(c_ep_in[3], 3); - TestEp_Bulk_Rx(c_ep_out[3], 3); - } - - return 0; -} diff --git a/tests/test_bulk_rxtx_fastpacket/src/xc_ptr.h b/tests/test_bulk_rxtx_fastpacket/src/xc_ptr.h deleted file mode 100644 index 8fa5a04e..00000000 --- a/tests/test_bulk_rxtx_fastpacket/src/xc_ptr.h +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2016-2021 XMOS LIMITED. -// This Software is subject to the terms of the XMOS Public Licence: Version 1. -#ifndef __xc_ptr__ -#define __xc_ptr__ - -typedef unsigned int xc_ptr; - -// Note that this function is marked as const to avoid the XC -// parallel usage checks, this is only really going to work if this -// is the *only* way the array a is accessed (and everything else uses -// the xc_ptr) -inline xc_ptr array_to_xc_ptr(const unsigned a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -inline xc_ptr char_array_to_xc_ptr(const unsigned char a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -#define write_via_xc_ptr_indexed(p,i,x) asm volatile("stw %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_short_via_xc_ptr_indexed(p,i,x) asm volatile("st16 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) - -#define write_via_xc_ptr(p,x) asm volatile("stw %0, %1[0]"::"r"(x),"r"(p)) -// No immediate st8 format -#define write_byte_via_xc_ptr(p,x) write_byte_via_xc_ptr_indexed(p, 0, x) -#define write_short_via_xc_ptr(p,x) write_short_via_xc_ptr_indexed(p, 0, x) - -#define read_via_xc_ptr_indexed(x,p,i) asm("ldw %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_byte_via_xc_ptr_indexed(x,p,i) asm("ld8u %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_short_via_xc_ptr_indexed(x,p,i) asm("ld16s %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); - -#define read_via_xc_ptr(x,p) asm("ldw %0, %1[0]":"=r"(x):"r"(p)); -// No immediate ld8u format -#define read_byte_via_xc_ptr(x,p) read_byte_via_xc_ptr_indexed(x, p, 0) -#define read_short_via_xc_ptr(x,p) read_short_via_xc_ptr_indexed(x, p, 0) - -#define GET_SHARED_GLOBAL(x, g) asm volatile("ldw %0, dp[" #g "]":"=r"(x)::"memory") -#define SET_SHARED_GLOBAL(g, v) asm volatile("stw %0, dp[" #g "]"::"r"(v):"memory") - -#endif diff --git a/tests/test_bulk_tx_basic_noack.py b/tests/test_bulk_tx_basic_noack.py index cea92ea5..3c265a73 100644 --- a/tests/test_bulk_tx_basic_noack.py +++ b/tests/test_bulk_tx_basic_noack.py @@ -48,4 +48,3 @@ def test_session(ep, address, bus_speed): ) return session - diff --git a/tests/test_bulk_tx_basic_noack/src/xc_ptr.h b/tests/test_bulk_tx_basic_noack/src/xc_ptr.h deleted file mode 100644 index 8fa5a04e..00000000 --- a/tests/test_bulk_tx_basic_noack/src/xc_ptr.h +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2016-2021 XMOS LIMITED. -// This Software is subject to the terms of the XMOS Public Licence: Version 1. -#ifndef __xc_ptr__ -#define __xc_ptr__ - -typedef unsigned int xc_ptr; - -// Note that this function is marked as const to avoid the XC -// parallel usage checks, this is only really going to work if this -// is the *only* way the array a is accessed (and everything else uses -// the xc_ptr) -inline xc_ptr array_to_xc_ptr(const unsigned a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -inline xc_ptr char_array_to_xc_ptr(const unsigned char a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -#define write_via_xc_ptr_indexed(p,i,x) asm volatile("stw %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_short_via_xc_ptr_indexed(p,i,x) asm volatile("st16 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) - -#define write_via_xc_ptr(p,x) asm volatile("stw %0, %1[0]"::"r"(x),"r"(p)) -// No immediate st8 format -#define write_byte_via_xc_ptr(p,x) write_byte_via_xc_ptr_indexed(p, 0, x) -#define write_short_via_xc_ptr(p,x) write_short_via_xc_ptr_indexed(p, 0, x) - -#define read_via_xc_ptr_indexed(x,p,i) asm("ldw %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_byte_via_xc_ptr_indexed(x,p,i) asm("ld8u %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_short_via_xc_ptr_indexed(x,p,i) asm("ld16s %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); - -#define read_via_xc_ptr(x,p) asm("ldw %0, %1[0]":"=r"(x):"r"(p)); -// No immediate ld8u format -#define read_byte_via_xc_ptr(x,p) read_byte_via_xc_ptr_indexed(x, p, 0) -#define read_short_via_xc_ptr(x,p) read_short_via_xc_ptr_indexed(x, p, 0) - -#define GET_SHARED_GLOBAL(x, g) asm volatile("ldw %0, dp[" #g "]":"=r"(x)::"memory") -#define SET_SHARED_GLOBAL(g, v) asm volatile("stw %0, dp[" #g "]"::"r"(v):"memory") - -#endif diff --git a/tests/test_iso_loopback.py b/tests/test_iso_loopback.py index 1cfeec65..f3af6362 100644 --- a/tests/test_iso_loopback.py +++ b/tests/test_iso_loopback.py @@ -5,6 +5,7 @@ import pytest from conftest import PARAMS, test_RunUsbSession + @pytest.fixture def test_session(ep, address, bus_speed): diff --git a/tests/test_iso_rx_basic.py b/tests/test_iso_rx_basic.py index 9b7ddf0c..37e41a4a 100644 --- a/tests/test_iso_rx_basic.py +++ b/tests/test_iso_rx_basic.py @@ -5,6 +5,7 @@ import pytest from conftest import PARAMS, test_RunUsbSession + @pytest.fixture def test_session(ep, address, bus_speed): diff --git a/tests/test_iso_tx_basic.py b/tests/test_iso_tx_basic.py index fb49cf8c..47620c53 100644 --- a/tests/test_iso_tx_basic.py +++ b/tests/test_iso_tx_basic.py @@ -5,6 +5,7 @@ import pytest from conftest import PARAMS, test_RunUsbSession + @pytest.fixture def test_session(ep, address, bus_speed): diff --git a/tests/usb_packet.py b/tests/usb_packet.py index bc0c47e0..2531622b 100644 --- a/tests/usb_packet.py +++ b/tests/usb_packet.py @@ -105,6 +105,7 @@ def CreateSofToken(frameNumber, badCrc=False, interEventDelay=1000): interEventDelay=interEventDelay, ) + def reflect(val, numBits): valRef = 0 From 292eaba323c1cc82755c93ae371859bed7c43193 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 28 Jun 2021 18:10:31 +0100 Subject: [PATCH 412/520] Fix to test_bulk_tx_basic_noack --- tests/test_bulk_tx_basic_noack.py | 2 +- tests/test_bulk_tx_basic_noack/Makefile | 3 + tests/test_bulk_tx_basic_noack/src/main.xc | 147 ++++++++------------- 3 files changed, 58 insertions(+), 94 deletions(-) create mode 100644 tests/test_bulk_tx_basic_noack/Makefile diff --git a/tests/test_bulk_tx_basic_noack.py b/tests/test_bulk_tx_basic_noack.py index 3c265a73..4fd309fd 100644 --- a/tests/test_bulk_tx_basic_noack.py +++ b/tests/test_bulk_tx_basic_noack.py @@ -17,7 +17,7 @@ def test_session(ep, address, bus_speed): bus_speed=bus_speed, run_enumeration=False, device_address=address ) - for pktLength in range(10, 14): + for pktLength in range(10, 15): if pktLength == 12: session.add_event( diff --git a/tests/test_bulk_tx_basic_noack/Makefile b/tests/test_bulk_tx_basic_noack/Makefile new file mode 100644 index 00000000..a2c9ee98 --- /dev/null +++ b/tests/test_bulk_tx_basic_noack/Makefile @@ -0,0 +1,3 @@ +TEST_FLAGS = -DXUD_BYPASS_RESET=1 + +include ../test_makefile.mak diff --git a/tests/test_bulk_tx_basic_noack/src/main.xc b/tests/test_bulk_tx_basic_noack/src/main.xc index 30296044..170bed91 100644 --- a/tests/test_bulk_tx_basic_noack/src/main.xc +++ b/tests/test_bulk_tx_basic_noack/src/main.xc @@ -1,113 +1,74 @@ // Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -/* - * Test the use of the ExampleTestbench. Test that the value 0 and 1 can be sent - * in both directions between the ports. - * - * NOTE: The src/testbenches/ExampleTestbench must have been compiled for this to run without error. - * - */ -#include -#include -#include -#include "xud.h" -#include "platform.h" -#include "xc_ptr.h" +#include "shared.h" -#define XUD_EP_COUNT_OUT 3 -#define XUD_EP_COUNT_IN 3 +#ifndef TEST_EP_NUM +#define TEST_EP_NUM (1) +#endif +#ifndef PKT_LENGTH_START +#define PKT_LENGTH_START (10) +#endif + +#ifndef PKT_LENGTH_END +#define PKT_LENGTH_END (14) +#endif + +#define EP_COUNT_OUT (6) +#define EP_COUNT_IN (6) /* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, +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[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, +XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, + XUD_EPTYPE_BUL, + XUD_EPTYPE_BUL, + XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend ?c_usb_test); - -void exit(int); - -#define FAIL_RX_DATAERROR 0 - -unsigned fail(int x) -{ - - printstr("\nXCORE: ### FAIL ******"); - switch(x) - { - case FAIL_RX_DATAERROR: - printstr("XCORE RX Data Error\n"); - - break; - - } - - exit(1); -} - -unsigned char g_rxDataCheck[5] = {0, 0, 0, 0, 0}; -unsigned char g_txDataCheck[5] = {0,0,0,0,0,}; -unsigned g_txLength[5] = {0,0,0,0,0}; - - -#pragma unsafe arrays -void SendTxPacket(XUD_ep ep, int length, int epNum) -{ - unsigned char buffer[1024]; - unsigned char x; - - for (int i = 0; i < length; i++) - { - buffer[i] = g_txDataCheck[epNum]++; - } - - XUD_SetBuffer(ep, buffer, length); -} - -int TestEp_Bulk(chanend c_out, chanend c_in, int epNum) -{ - unsigned int length; - XUD_Result_t res; - - XUD_ep ep_out = XUD_InitEp(c_out); - XUD_ep ep_in = XUD_InitEp(c_in); - - /* Buffer for Setup data */ - unsigned char buffer[1024]; - - for(int i = 10; i <= 14; i++) - { - SendTxPacket(ep_in, i, epNum); - } - - exit(0); -} - - -#define USB_CORE 0 +#ifdef XUD_SIM_RTL +int testmain() +#else int main() +#endif { - chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - chan c_sync; - chan c_sync_iso; - - //p_rxDataCheck = char_array_to_xc_ptr(g_rxDataCheck); - //p_txDataCheck = char_array_to_xc_ptr(g_txDataCheck); - //p_txLength = array_to_xc_ptr(g_txLength); + chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; par { - - XUD_Manager( c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, + { +#if defined(XUD_TEST_SPEED_FS) + unsigned speed = XUD_SPEED_FS; +#elif defined(XUD_TEST_SPEED_HS) + unsigned speed = XUD_SPEED_HS; +#endif + + XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, null, epTypeTableOut, epTypeTableIn, - null, null, -1, XUD_SPEED_HS, XUD_PWR_BUS); - - //TestEp_Control(c_ep_out[0], c_ep_in[0], 0); - - TestEp_Bulk(c_ep_out[2], c_ep_in[2], 1); + speed, XUD_PWR_BUS); + } + + { + unsigned fail = TestEp_Tx(c_ep_in[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_DIE); + +#ifdef XUD_SIM_RTL + /* Note, this test relies on checking at the host side */ + + if(fail) + TerminateFail(fail); + else + TerminatePass(fail); +#endif + + XUD_ep ep_out_0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep_out_0); + exit(0); + } } return 0; From b733a6b811c6b5860a8080bc837a41ce00496ef6 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 28 Jun 2021 18:15:56 +0100 Subject: [PATCH 413/520] Removed duplicated test code --- tests/test_bulk_tx_basic/src/main.xc | 4 -- tests/test_bulk_tx_basic_noack/src/main.xc | 64 +--------------------- 2 files changed, 1 insertion(+), 67 deletions(-) diff --git a/tests/test_bulk_tx_basic/src/main.xc b/tests/test_bulk_tx_basic/src/main.xc index 7a4e24ae..f0792b16 100644 --- a/tests/test_bulk_tx_basic/src/main.xc +++ b/tests/test_bulk_tx_basic/src/main.xc @@ -2,10 +2,6 @@ // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "shared.h" -#ifndef TEST_EP_NUM -#define TEST_EP_NUM (1) -#endif - #ifndef PKT_LENGTH_START #define PKT_LENGTH_START (10) #endif diff --git a/tests/test_bulk_tx_basic_noack/src/main.xc b/tests/test_bulk_tx_basic_noack/src/main.xc index 170bed91..36248119 100644 --- a/tests/test_bulk_tx_basic_noack/src/main.xc +++ b/tests/test_bulk_tx_basic_noack/src/main.xc @@ -2,10 +2,6 @@ // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "shared.h" -#ifndef TEST_EP_NUM -#define TEST_EP_NUM (1) -#endif - #ifndef PKT_LENGTH_START #define PKT_LENGTH_START (10) #endif @@ -14,62 +10,4 @@ #define PKT_LENGTH_END (14) #endif -#define EP_COUNT_OUT (6) -#define EP_COUNT_IN (6) - -/* Endpoint type tables */ -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}; - -#ifdef XUD_SIM_RTL -int testmain() -#else -int main() -#endif -{ - chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; - - par - { - { -#if defined(XUD_TEST_SPEED_FS) - unsigned speed = XUD_SPEED_FS; -#elif defined(XUD_TEST_SPEED_HS) - unsigned speed = XUD_SPEED_HS; -#endif - - XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, - speed, XUD_PWR_BUS); - } - - { - unsigned fail = TestEp_Tx(c_ep_in[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_DIE); - -#ifdef XUD_SIM_RTL - /* Note, this test relies on checking at the host side */ - - if(fail) - TerminateFail(fail); - else - TerminatePass(fail); -#endif - - XUD_ep ep_out_0 = XUD_InitEp(c_ep_out[0]); - XUD_Kill(ep_out_0); - exit(0); - } - } - - return 0; -} +#include "../../test_bulk_tx_basic/src/main.xc" From e5491083d7e29773de374f028f1373985cd2a48d Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 28 Jun 2021 19:00:48 +0100 Subject: [PATCH 414/520] Removed unused file from docs --- lib_xud/doc/rst/resource_usage_summary.rst | 28 ---------------------- 1 file changed, 28 deletions(-) delete mode 100644 lib_xud/doc/rst/resource_usage_summary.rst diff --git a/lib_xud/doc/rst/resource_usage_summary.rst b/lib_xud/doc/rst/resource_usage_summary.rst deleted file mode 100644 index e52c430a..00000000 --- a/lib_xud/doc/rst/resource_usage_summary.rst +++ /dev/null @@ -1,28 +0,0 @@ -Typical Resource Usage ----------------------- - -.. resusage:: - - * - configuration: USB device (xCORE-200 series) - - target: XCORE-200-EXPLORER - - flags: -DXUD_SERIES_SUPPORT=XUD_X200_SERIES - - globals: XUD_EpType epTypeTableOut[1] = {XUD_EPTYPE_CTL | XUD_STATUS_ENABLE}; - XUD_EpType epTypeTableIn[1] = {XUD_EPTYPE_CTL | XUD_STATUS_ENABLE}; - - locals: chan c_ep_out[1];chan c_ep_in[1]; - - fn: XUD_Main(c_ep_out, 1, c_ep_in, 1, - null, epTypeTableOut, epTypeTableIn, - null, null, -1 , XUD_SPEED_HS, XUD_PWR_BUS); - - pins: 23 (internal) - - ports: 11 - - * - configuration: USB device (U series) - - target: SLICEKIT-U16 - - flags: -DXUD_SERIES_SUPPORT=XUD_U_SERIES - - globals: XUD_EpType epTypeTableOut[1] = {XUD_EPTYPE_CTL | XUD_STATUS_ENABLE}; - XUD_EpType epTypeTableIn[1] = {XUD_EPTYPE_CTL | XUD_STATUS_ENABLE}; - - locals: chan c_ep_out[1];chan c_ep_in[1]; - - fn: XUD_Main(c_ep_out, 1, c_ep_in, 1, - null, epTypeTableOut, epTypeTableIn, - null, null, -1 , XUD_SPEED_HS, XUD_PWR_BUS); - - pins: 23 (internal) - - ports: 11 From 6c4ee4308debe9768aed10b24a31b8e10fe415e6 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 29 Jun 2021 13:13:38 +0100 Subject: [PATCH 415/520] Tidied up test param to define generation --- tests/helpers.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/tests/helpers.py b/tests/helpers.py index 051e99ff..b94efb0d 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -121,6 +121,13 @@ def run_on(**kwargs): return True +FIXTURE_TO_DEFINE = { + "ep": "TEST_EP_NUM", + "address": "XUD_STARTUP_ADDRESS", + "dummy_threads": "DUMMY_THREAD_COUNT", +} + + def do_usb_test( arch, ep, @@ -136,11 +143,11 @@ def do_usb_test( verbose=False, ): - # TODO ideally the test would test this somehow - # TODO use dictionary to convert pytest params to defines - build_options = ( - "CFLAGS=-DTEST_EP_NUM=" + str(ep) + " -DXUD_STARTUP_ADDRESS=" + str(address) - ) + build_options_str = "CFLAGS=" + for k, v in FIXTURE_TO_DEFINE.items(): + build_options_str += "-D" + str(v) + "=" + str(locals()[k]) + " " + + build_options = build_options_str """Shared test code for all RX tests using the test_rx application.""" testname, extension = os.path.splitext(os.path.basename(test_file)) From d635bc581c487e03d20fbc08111a301cbecdd4c2 Mon Sep 17 00:00:00 2001 From: Kevin Yeung Date: Tue, 29 Jun 2021 21:28:58 +0800 Subject: [PATCH 416/520] build failure now goes to stderr --- tests/Pyxsim/__init__.py | 2 +- tests/conftest.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/Pyxsim/__init__.py b/tests/Pyxsim/__init__.py index 3c72535d..0dc97c4e 100644 --- a/tests/Pyxsim/__init__.py +++ b/tests/Pyxsim/__init__.py @@ -69,7 +69,7 @@ def _build(xe_path, build_config=None, env={}, do_clean=False, build_options="") sys.stderr.write("ERROR: build failed.\n") for x in output: s = str(x) - sys.stderr.write(s) + sys.stderr.write(s + "\n") return (success, output) diff --git a/tests/conftest.py b/tests/conftest.py index c2ce3d8c..dd739670 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -100,4 +100,5 @@ def test_RunUsbSession(test_session, arch, ep, address, bus_speed, test_file, ca for result in results: if not result: print(cap_output) + sys.stderr.write(err) assert result From 40bf093a0103611ac6561c2ada8ff8e17e15f39f Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 29 Jun 2021 16:06:50 +0100 Subject: [PATCH 417/520] Added dummy threads param to TB --- tests/conftest.py | 12 +++++++++++- tests/helpers.py | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index c2ce3d8c..5650442f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -15,12 +15,14 @@ "ep": [1, 2, 4], "address": [0, 1, 127], "bus_speed": ["HS", "FS"], + "dummy_threads": [0, 4], }, "smoke": { "arch": ["xs3"], "ep": [1], "address": [0], "bus_speed": ["HS", "FS"], + "dummy_threads": [0, 4, 5], }, } @@ -69,7 +71,14 @@ def test_file(request): return str(request.node.fspath) -def test_RunUsbSession(test_session, arch, ep, address, bus_speed, test_file, capfd): +@pytest.fixture() +def test_dummy_threads(dummy_threads: int) -> int: + return dummy_threads + + +def test_RunUsbSession( + test_session, arch, ep, address, bus_speed, dummy_threads, test_file, capfd +): tester_list = [] output = [] @@ -83,6 +92,7 @@ def test_RunUsbSession(test_session, arch, ep, address, bus_speed, test_file, ca ep, address, bus_speed, + dummy_threads, clk_60, usb_phy, [test_session], diff --git a/tests/helpers.py b/tests/helpers.py index b94efb0d..224374c9 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -133,6 +133,7 @@ def do_usb_test( ep, address, bus_speed, + dummy_threads, clk, phy, sessions, From f921e53bba22620bda3cc94c74563e1448a9d6ab Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 29 Jun 2021 16:34:11 +0100 Subject: [PATCH 418/520] Added test_main.xc --- tests/shared_src/test_main.xc | 47 +++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 tests/shared_src/test_main.xc diff --git a/tests/shared_src/test_main.xc b/tests/shared_src/test_main.xc new file mode 100644 index 00000000..8aaaca2e --- /dev/null +++ b/tests/shared_src/test_main.xc @@ -0,0 +1,47 @@ +#ifdef XUD_SIM_RTL +int testmain() +#else +int main() +#endif +{ + chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; + + par + { + { +#if defined(XUD_TEST_SPEED_FS) + unsigned speed = XUD_SPEED_FS; +#elif defined(XUD_TEST_SPEED_HS) + unsigned speed = XUD_SPEED_HS; +#endif + + XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, + null, epTypeTableOut, epTypeTableIn, + speed, XUD_PWR_BUS); + } + + { + unsigned fail = test_func(c_ep_out, c_ep_in); + +#ifdef XUD_SIM_RTL + /* Note, this test relies on checking at the host side */ + if(fail) + TerminateFail(fail); + else + TerminatePass(fail); +#endif + + unsafe{ + unsigned * unsafe p = &g_dummyThreadCount; + *p = 0; + } + XUD_ep ep_out_0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep_out_0); + exit(0); + } + + dummyThreads(); + } + + return 0; +} From aa2e48cea2a61da5582a4fd06593c3b76179f4da Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 29 Jun 2021 16:45:28 +0100 Subject: [PATCH 419/520] Added missing copyright and licence comment --- tests/shared_src/test_main.xc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/shared_src/test_main.xc b/tests/shared_src/test_main.xc index 8aaaca2e..05208b71 100644 --- a/tests/shared_src/test_main.xc +++ b/tests/shared_src/test_main.xc @@ -1,3 +1,6 @@ +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. + #ifdef XUD_SIM_RTL int testmain() #else From f99a6a9a0a13b0f53272d32850cf961b1eaa9807 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 30 Jun 2021 00:10:15 +0100 Subject: [PATCH 420/520] Tests now run dummy (busy) cores. Also improved test code re-use --- tests/conftest.py | 6 +- tests/shared_src/shared.h | 69 ++++++++++++++-- tests/shared_src/test_main.xc | 9 ++- tests/test_bulk_rx_basic/src/main.xc | 48 ++---------- tests/test_bulk_rx_basic_badcrc32/src/main.xc | 78 ++++--------------- tests/test_bulk_rx_basic_badpid/src/main.xc | 42 ++-------- tests/test_bulk_rx_basic_nodata/src/main.xc | 46 ++--------- tests/test_bulk_rx_basic_rxerror/src/main.xc | 45 ++--------- tests/test_bulk_rx_multiep.py | 4 +- tests/test_bulk_rx_multiep/src/main.xc | 34 ++++---- tests/test_bulk_tx_badack/src/main.xc | 54 +++---------- tests/test_bulk_tx_basic/src/main.xc | 47 ++--------- tests/test_bulk_tx_basic_short/src/main.xc | 59 +++----------- tests/test_bulk_tx_multiep.py | 2 +- tests/test_bulk_tx_multiep/src/main.xc | 67 ++++++++-------- tests/test_control_basic_get/src/main.xc | 32 ++------ tests/test_control_basic_set.py | 5 +- tests/test_control_basic_set/src/main.xc | 33 ++------ tests/test_iso_rx_basic/src/main.xc | 61 ++------------- tests/test_iso_tx_basic.py | 5 +- tests/test_iso_tx_basic/src/main.xc | 59 ++++++-------- tests/test_ping_stall/src/main.xc | 56 +------------ tests/test_stall_basic.py | 1 - tests/test_stall_basic/src/main.xc | 41 +--------- tests/test_stall_epready/src/main.xc | 60 +++----------- 25 files changed, 268 insertions(+), 695 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 0158e5fd..f395ac7a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -15,14 +15,16 @@ "ep": [1, 2, 4], "address": [0, 1, 127], "bus_speed": ["HS", "FS"], - "dummy_threads": [0, 4], + "dummy_threads": [0, 4, 5], }, "smoke": { "arch": ["xs3"], "ep": [1], "address": [0], "bus_speed": ["HS", "FS"], - "dummy_threads": [0, 4, 5], + "dummy_threads": [ + 4 + ], # TODO Set to 0 for speed of simulation vs higher for better quality testing.. }, } diff --git a/tests/shared_src/shared.h b/tests/shared_src/shared.h index d3da9063..b9efd1ee 100644 --- a/tests/shared_src/shared.h +++ b/tests/shared_src/shared.h @@ -73,8 +73,9 @@ void TerminatePass(unsigned x) #define MAX_PKT_COUNT (50) #endif -#ifndef DUMMY_THEAD_COUNT -#define DUMMY_THREAD_COUNT (4) +#ifndef TEST_EP_NUM +#warning TEST_EP_NUM not defined +#define TEST_EP_NUM (1) #endif typedef enum t_runMode @@ -108,6 +109,8 @@ int TestEp_Tx(chanend c_in, int epNum1, unsigned start, unsigned end, t_runMode int counter = 0; int length = start; + set_core_fast_mode_on(); + /* Prepare packets */ for(int i = 0; i <= (end-start); i++) { @@ -178,6 +181,8 @@ int TestEp_Rx(chanend c_out, int epNum, int start, int end) /* Buffer for Setup data */ unsigned char buffer[MAX_PKT_COUNT][1024]; + set_core_fast_mode_on(); + /* Receive a bunch of packets quickly, then check them */ #pragma loop unroll for(int i = 0; i <= (end-start); i++) @@ -200,22 +205,72 @@ int TestEp_Rx(chanend c_out, int epNum, int start, int end) return 0; } -void dummyThread(chanend c) +/* Loopback packets forever */ +#pragma unsafe arrays +int TestEp_Loopback(chanend c_out1, chanend c_in1, t_runMode runMode) { + unsigned int length; + XUD_Result_t res; + set_core_fast_mode_on(); + XUD_ep ep_out1 = XUD_InitEp(c_out1); + XUD_ep ep_in1 = XUD_InitEp(c_in1); + + /* Buffer for Setup data */ + unsigned char buffer[1024]; + while(1) { - inuint(c); - break; + XUD_GetBuffer(ep_out1, buffer, length); + XUD_SetBuffer(ep_in1, buffer, length); + + /* Loop back once and return */ + if(runMode == RUNMODE_DIE) + break; + + /* Partial un-roll */ + XUD_GetBuffer(ep_out1, buffer, length); + XUD_SetBuffer(ep_in1, buffer, length); } } -void dummyThreads(chanend c[]) +#ifndef DUMMY_THREAD_COUNT +#error +#warning DUMMY_THREAD_COUNT not defined +#define DUMMY_THREAD_COUNT (0) +#endif + +#if (DUMMY_THREAD_COUNT > 6) +#error DUMMY_THREAD_COUNT too high +#endif + +size_t g_dummyThreadCount = DUMMY_THREAD_COUNT; + +void dummyThread() +{ + unsigned x = 0; + set_core_fast_mode_on(); + + while(g_dummyThreadCount) + { + x++; + } +} + +void dummyThreads() { +#if (DUMMY_THREAD_COUNT > 0) par(size_t i = 0; i < DUMMY_THREAD_COUNT; i++) { - dummyThread(c[i]); + dummyThread(); } +#endif } + + + + + + #endif diff --git a/tests/shared_src/test_main.xc b/tests/shared_src/test_main.xc index 05208b71..fcfcfc27 100644 --- a/tests/shared_src/test_main.xc +++ b/tests/shared_src/test_main.xc @@ -38,9 +38,12 @@ int main() unsigned * unsafe p = &g_dummyThreadCount; *p = 0; } - XUD_ep ep_out_0 = XUD_InitEp(c_ep_out[0]); - XUD_Kill(ep_out_0); - exit(0); + if(TEST_EP_NUM != 0) + { + XUD_ep ep_out_0 = XUD_InitEp(c_ep_out[0]); + XUD_Kill(ep_out_0); + } + exit(0); } dummyThreads(); diff --git a/tests/test_bulk_rx_basic/src/main.xc b/tests/test_bulk_rx_basic/src/main.xc index ef2188db..2a09c8f2 100644 --- a/tests/test_bulk_rx_basic/src/main.xc +++ b/tests/test_bulk_rx_basic/src/main.xc @@ -1,6 +1,5 @@ // Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -#include "shared.h" #define EP_COUNT_OUT (6) #define EP_COUNT_IN (6) @@ -13,50 +12,17 @@ #define PKT_LENGTH_END (19) #endif -#ifndef TEST_EP_NUM -#define TEST_EP_NUM (1) -#endif +#include "shared.h" -/* Endpoint type tables */ 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}; -#ifdef XUD_SIM_RTL -int testmain() -#else -int main() -#endif +unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) { - chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; - - par - { - { -#if defined(XUD_TEST_SPEED_FS) - unsigned speed = XUD_SPEED_FS; -#elif defined(XUD_TEST_SPEED_HS) - unsigned speed = XUD_SPEED_HS; -#else -#error XUD_TEST_SPEED_XX not defined -#endif + unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); - XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, speed, XUD_PWR_BUS); - } - - { - unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); - - XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); - XUD_Kill(ep0); - - if(fail) - TerminateFail(fail); - else - TerminatePass(fail); - - } - } - - return 0; + return fail; } + +#include "test_main.xc" + diff --git a/tests/test_bulk_rx_basic_badcrc32/src/main.xc b/tests/test_bulk_rx_basic_badcrc32/src/main.xc index f93e713a..6d75c0e3 100644 --- a/tests/test_bulk_rx_basic_badcrc32/src/main.xc +++ b/tests/test_bulk_rx_basic_badcrc32/src/main.xc @@ -1,73 +1,27 @@ // Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -#include "shared.h" - -#define EP_COUNT_OUT (6) -#define EP_COUNT_IN (6) - -/* Endpoint type tables */ -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}; - -int TestEp_Bulk(chanend c_out, chanend c_in, int epNum, chanend c_out_0) -{ - unsigned int length; - XUD_Result_t res; - - XUD_ep ep_out_0 = XUD_InitEp(c_out_0); - XUD_ep ep_out = XUD_InitEp(c_out); - XUD_ep ep_in = XUD_InitEp(c_in); +#define EP_COUNT_OUT (6) +#define EP_COUNT_IN (6) - unsigned char buffer[1024]; +#ifndef PKT_LENGTH_START +#define PKT_LENGTH_START (10) +#endif - for(int i = 10; i <= 14; i++) - { - XUD_GetBuffer(ep_out, buffer, length); +#ifndef PKT_LENGTH_END +#define PKT_LENGTH_END (14) +#endif - if(length != i) - { - printintln(length); - printintln(i); - TerminateFail(FAIL_RX_LENERROR); - } - - if(RxDataCheck(buffer, length, epNum, i)) - { - TerminateFail(FAIL_RX_DATAERROR); - } - } - - XUD_Kill(ep_out_0); - exit(0); -} +#include "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}; -int main() +unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) { - chan c_ep_out[EP_COUNT_OUT], 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); - par - { - - XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); - - unsafe { - TestEp_Bulk(c_ep_out[TEST_EP_NUM], c_ep_in[TEST_EP_NUM], TEST_EP_NUM, c_ep_out[0]); - } - } - - return 0; + return fail; } + +#include "test_main.xc" diff --git a/tests/test_bulk_rx_basic_badpid/src/main.xc b/tests/test_bulk_rx_basic_badpid/src/main.xc index 941b8179..dd6a888d 100644 --- a/tests/test_bulk_rx_basic_badpid/src/main.xc +++ b/tests/test_bulk_rx_basic_badpid/src/main.xc @@ -13,45 +13,17 @@ #define PKT_LENGTH_END (14) #endif -/* Endpoint type tables */ +#include "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}; -#ifdef XUD_SIM_RTL -int testmain() -#else -int main() -#endif +unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) { - chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; - - par - { - { -#if defined(XUD_TEST_SPEED_FS) - unsigned speed = XUD_SPEED_FS; -#elif defined(XUD_TEST_SPEED_HS) - unsigned speed = XUD_SPEED_HS; -#else -#error XUD_TEST_SPEED_XX not defined -#endif + unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); - XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, speed, XUD_PWR_BUS); - } - - { - unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); + return fail; +} - XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); - XUD_Kill(ep0); - - if(fail) - TerminateFail(fail); - else - TerminatePass(fail); - } - } +#include "test_main.xc" - return 0; -} diff --git a/tests/test_bulk_rx_basic_nodata/src/main.xc b/tests/test_bulk_rx_basic_nodata/src/main.xc index c308a1d4..6d75c0e3 100644 --- a/tests/test_bulk_rx_basic_nodata/src/main.xc +++ b/tests/test_bulk_rx_basic_nodata/src/main.xc @@ -1,6 +1,5 @@ // Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -#include "shared.h" #define EP_COUNT_OUT (6) #define EP_COUNT_IN (6) @@ -13,45 +12,16 @@ #define PKT_LENGTH_END (14) #endif -/* Endpoint type tables */ +#include "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}; -#ifdef XUD_SIM_RTL -int testmain() -#else -int main() -#endif +unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) { - chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; - - par - { - { -#if defined(XUD_TEST_SPEED_FS) - unsigned speed = XUD_SPEED_FS; -#elif defined(XUD_TEST_SPEED_HS) - unsigned speed = XUD_SPEED_HS; -#else -#error XUD_TEST_SPEED_XX not defined - #endif - - XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, speed, XUD_PWR_BUS); - } - - { - unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); - - XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); - XUD_Kill(ep0); - - if(fail) - TerminateFail(fail); - else - TerminatePass(fail); - } - } - - return 0; + unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); + + return fail; } + +#include "test_main.xc" diff --git a/tests/test_bulk_rx_basic_rxerror/src/main.xc b/tests/test_bulk_rx_basic_rxerror/src/main.xc index 84357b4b..3a5d6326 100644 --- a/tests/test_bulk_rx_basic_rxerror/src/main.xc +++ b/tests/test_bulk_rx_basic_rxerror/src/main.xc @@ -14,46 +14,17 @@ #define PKT_LENGTH_END (14) #endif -/* Endpoint type tables */ +#include "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}; -#ifdef XUD_SIM_RTL -int testmain() -#else -int main() -#endif +unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) { - chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; - - par - { - { -#if defined(XUD_TEST_SPEED_FS) - unsigned speed = XUD_SPEED_FS; -#elif defined(XUD_TEST_SPEED_HS) - unsigned speed = XUD_SPEED_HS; -#else -#error XUD_TEST_SPEED_XX not defined -#endif + unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); - XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, speed, XUD_PWR_BUS); - } - - { - unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); - - XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); - XUD_Kill(ep0); - - if(fail) - TerminateFail(fail); - else - TerminatePass(fail); - - } - } - - return 0; + return fail; } + +#include "test_main.xc" + diff --git a/tests/test_bulk_rx_multiep.py b/tests/test_bulk_rx_multiep.py index 631ed722..6c603537 100644 --- a/tests/test_bulk_rx_multiep.py +++ b/tests/test_bulk_rx_multiep.py @@ -8,8 +8,8 @@ # EP numbers currently fixed for this test - set in params PARAMS = deepcopy(PARAMS) -PARAMS["smoke"].update({"ep": [3]}) -PARAMS["default"].update({"ep": [3]}) +PARAMS["smoke"].update({"ep": [3], "dummy_threads": [0]}) +PARAMS["default"].update({"ep": [3], "dummy_threads": [0]}) @pytest.fixture diff --git a/tests/test_bulk_rx_multiep/src/main.xc b/tests/test_bulk_rx_multiep/src/main.xc index 950eacf1..59f1ce81 100644 --- a/tests/test_bulk_rx_multiep/src/main.xc +++ b/tests/test_bulk_rx_multiep/src/main.xc @@ -8,7 +8,7 @@ #define PACKET_LEN_START (10) #define PACKET_LEN_END (19) -/* Check for classes with TEST_EP and traffic EP */ +/* Check for clashes with TEST_EP and traffic EP */ #if TEST_EP_NUM == 4 #error #endif @@ -25,28 +25,22 @@ 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_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, XUD_EPTYPE_BUL}; -int main() +unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) { - chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; - + unsigned fail[4]; + par { - - XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, - XUD_SPEED_HS, XUD_PWR_BUS); - - - TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PACKET_LEN_START, PACKET_LEN_END); - TestEp_Rx(c_ep_out[4], 4, PACKET_LEN_START, PACKET_LEN_END); - TestEp_Rx(c_ep_out[5], 5, PACKET_LEN_START, PACKET_LEN_END); - { - XUD_ep ep_out_0 = XUD_InitEp(c_ep_out[0]); - TestEp_Rx(c_ep_out[6], 6, PACKET_LEN_START, PACKET_LEN_END); - XUD_Kill(ep_out_0); - exit(0); - } + fail[0] = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PACKET_LEN_START, PACKET_LEN_END); + fail[1] = TestEp_Rx(c_ep_out[4], 4, PACKET_LEN_START, PACKET_LEN_END); + fail[2] = TestEp_Rx(c_ep_out[5], 5, PACKET_LEN_START, PACKET_LEN_END); + fail[3] = TestEp_Rx(c_ep_out[6], 6, PACKET_LEN_START, PACKET_LEN_END); } - return 0; + for(size_t i = 0; i< 4; i++) + fail[0] |= fail[i]; + + return fail[0]; } + +#include "test_main.xc" diff --git a/tests/test_bulk_tx_badack/src/main.xc b/tests/test_bulk_tx_badack/src/main.xc index 0dd033a7..6d1d97a5 100644 --- a/tests/test_bulk_tx_badack/src/main.xc +++ b/tests/test_bulk_tx_badack/src/main.xc @@ -1,6 +1,5 @@ // Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -#include "shared.h" #ifndef PKT_LENGTH_START #define PKT_LENGTH_START (10) @@ -13,11 +12,12 @@ #define EP_COUNT_OUT (6) #define EP_COUNT_IN (6) -/* Endpoint type tables */ +#include "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_BUL, XUD_EPTYPE_BUL}; XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, @@ -25,46 +25,14 @@ XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, - XUD_EPTYPE_ISO}; - -#ifdef XUD_SIM_RTL -int testmain() -#else -int main() -#endif -{ - chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; - - par - { - { -#if defined(XUD_TEST_SPEED_FS) - unsigned speed = XUD_SPEED_FS; -#elif defined(XUD_TEST_SPEED_HS) - unsigned speed = XUD_SPEED_HS; -#endif - XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, - speed, XUD_PWR_BUS); - } + XUD_EPTYPE_BUL}; - { - unsigned fail = TestEp_Tx(c_ep_in[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_DIE); -#ifdef XUD_SIM_RTL - /* Note, this test relies on checking at the host side */ - - if(fail) - TerminateFail(fail); - else - TerminatePass(fail); -#endif - - XUD_ep ep_out_0 = XUD_InitEp(c_ep_out[0]); - XUD_Kill(ep_out_0); - exit(0); - } - } +unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) +{ + unsigned fail = TestEp_Tx(c_ep_in[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_DIE); - return 0; + return fail; } + +#include "test_main.xc" diff --git a/tests/test_bulk_tx_basic/src/main.xc b/tests/test_bulk_tx_basic/src/main.xc index f0792b16..317dba57 100644 --- a/tests/test_bulk_tx_basic/src/main.xc +++ b/tests/test_bulk_tx_basic/src/main.xc @@ -1,6 +1,5 @@ // Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -#include "shared.h" #ifndef PKT_LENGTH_START #define PKT_LENGTH_START (10) @@ -13,7 +12,8 @@ #define EP_COUNT_OUT (6) #define EP_COUNT_IN (6) -/* Endpoint type tables */ +#include "shared.h" + XUD_EpType epTypeTableOut[EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, @@ -27,45 +27,14 @@ XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -#ifdef XUD_SIM_RTL -int testmain() -#else -int main() -#endif -{ - chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; - par - { - { -#if defined(XUD_TEST_SPEED_FS) - unsigned speed = XUD_SPEED_FS; -#elif defined(XUD_TEST_SPEED_HS) - unsigned speed = XUD_SPEED_HS; -#endif - - XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, - speed, XUD_PWR_BUS); - } +unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) +{ + unsigned fail = TestEp_Tx(c_ep_in[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_DIE); - { - unsigned fail = TestEp_Tx(c_ep_in[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_DIE); + return fail; +} -#ifdef XUD_SIM_RTL - /* Note, this test relies on checking at the host side */ +#include "test_main.xc" - if(fail) - TerminateFail(fail); - else - TerminatePass(fail); -#endif - - XUD_ep ep_out_0 = XUD_InitEp(c_ep_out[0]); - XUD_Kill(ep_out_0); - exit(0); - } - } - return 0; -} diff --git a/tests/test_bulk_tx_basic_short/src/main.xc b/tests/test_bulk_tx_basic_short/src/main.xc index b88664e2..310844bd 100644 --- a/tests/test_bulk_tx_basic_short/src/main.xc +++ b/tests/test_bulk_tx_basic_short/src/main.xc @@ -1,6 +1,5 @@ // Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -#include "shared.h" #ifndef PKT_LENGTH_START #define PKT_LENGTH_START (0) @@ -13,56 +12,16 @@ #define EP_COUNT_OUT (6) #define EP_COUNT_IN (6) -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}; - -#ifdef XUD_SIM_RTL -int testmain() -#else -int main() -#endif -{ - chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; +#include "shared.h" - par - { - { -#if defined(XUD_TEST_SPEED_FS) - unsigned speed = XUD_SPEED_FS; -#elif defined(XUD_TEST_SPEED_HS) - unsigned speed = XUD_SPEED_HS; -#endif - - XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, - speed, XUD_PWR_BUS); - } +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 fail = TestEp_Tx(c_ep_in[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_DIE); +unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) +{ + unsigned fail = TestEp_Tx(c_ep_in[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_DIE); + return fail; +} -#ifdef XUD_SIM_RTL - if(fail) - TerminateFail(fail); - else - TerminatePass(fail); -#endif - - XUD_ep ep_out_0 = XUD_InitEp(c_ep_out[0]); - XUD_Kill(ep_out_0); - exit(0); - } - } +#include "test_main.xc" - return 0; -} diff --git a/tests/test_bulk_tx_multiep.py b/tests/test_bulk_tx_multiep.py index b3a3a16f..af36d8e3 100644 --- a/tests/test_bulk_tx_multiep.py +++ b/tests/test_bulk_tx_multiep.py @@ -9,7 +9,7 @@ # EP numbers currently fixed for this test - set in params PARAMS = deepcopy(PARAMS) for k in PARAMS: - PARAMS[k].update({"ep": [3]}) + PARAMS[k].update({"ep": [3], "dummy_threads": [0]}) @pytest.fixture diff --git a/tests/test_bulk_tx_multiep/src/main.xc b/tests/test_bulk_tx_multiep/src/main.xc index fcef402c..2ae6b232 100644 --- a/tests/test_bulk_tx_multiep/src/main.xc +++ b/tests/test_bulk_tx_multiep/src/main.xc @@ -1,47 +1,46 @@ // Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -#include -#include -#include -#include "xud.h" -#include "platform.h" -#include "shared.h" - -#define XUD_EP_COUNT_OUT 5 -#define XUD_EP_COUNT_IN 8 -/* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, - XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; +#define EP_COUNT_OUT (4) +#define EP_COUNT_IN (8) -#define PKT_LENGTH_START 10 -#define PKT_LENGTH_END 19 +#define PKT_LENGTH_START (10) +#define PKT_LENGTH_END (19) +#include "shared.h" -int main() +XUD_EpType epTypeTableOut[EP_COUNT_OUT] = {XUD_EPTYPE_CTL, + 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, + XUD_EPTYPE_BUL, + XUD_EPTYPE_BUL}; + +unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) { - chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; + unsigned fail[4]; par { - - XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, - XUD_SPEED_HS, XUD_PWR_BUS); - - TestEp_Tx(c_ep_in[3], 3, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_LOOP); - TestEp_Tx(c_ep_in[4], 4, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_LOOP); - TestEp_Tx(c_ep_in[5], 5, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_LOOP); - - { - TestEp_Tx(c_ep_in[6], 6, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_DIE); - XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); - XUD_Kill(ep0); - exit(0); - } - + fail[0] = TestEp_Tx(c_ep_in[3], 3, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_DIE); + fail[1] = TestEp_Tx(c_ep_in[4], 4, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_DIE); + fail[2] = TestEp_Tx(c_ep_in[5], 5, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_DIE); + fail[3] = TestEp_Tx(c_ep_in[6], 6, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_DIE); } - return 0; + for(size_t i = 0; i < 4; i++) + fail[0] |= fail[i]; + + return fail[0]; } + +#include "test_main.xc" + + diff --git a/tests/test_control_basic_get/src/main.xc b/tests/test_control_basic_get/src/main.xc index 31e552e8..e5657420 100644 --- a/tests/test_control_basic_get/src/main.xc +++ b/tests/test_control_basic_get/src/main.xc @@ -54,31 +54,15 @@ int TestEp_Control(XUD_ep c_ep0_out, XUD_ep c_ep0_in, int epNum) } } -int main() +unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) { - chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; + XUD_ep c_ep0_out = XUD_InitEp(c_ep_out[0]); + XUD_ep c_ep0_in = XUD_InitEp(c_ep_in[0]); - par - { - - XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, - XUD_SPEED_HS, XUD_PWR_BUS); - - { - XUD_ep c_ep0_out = XUD_InitEp(c_ep_out[0]); - XUD_ep c_ep0_in = XUD_InitEp(c_ep_in[0]); - - int fail = TestEp_Control(c_ep0_out, c_ep0_in, 0); - - XUD_Kill(c_ep0_out); - - if(fail) - TerminateFail(fail); - else - TerminatePass(fail); - } - } + unsigned failed = TestEp_Control(c_ep0_out, c_ep0_in, 0); - return 0; + XUD_Kill(c_ep0_out); + return failed; } +#include "test_main.xc" + diff --git a/tests/test_control_basic_set.py b/tests/test_control_basic_set.py index 58ced2d6..af938ff7 100644 --- a/tests/test_control_basic_set.py +++ b/tests/test_control_basic_set.py @@ -21,10 +21,13 @@ @pytest.fixture -def test_session(ep, address, bus_speed): +def test_session(ep, address, bus_speed, dummy_threads): ied = 500 + if bus_speed == "HS" and dummy_threads > 4: + pytest.xfail("Known fail when dummy threads > 4") + session = UsbSession( bus_speed=bus_speed, run_enumeration=False, device_address=address ) diff --git a/tests/test_control_basic_set/src/main.xc b/tests/test_control_basic_set/src/main.xc index 349a7df6..4ed5b9df 100644 --- a/tests/test_control_basic_set/src/main.xc +++ b/tests/test_control_basic_set/src/main.xc @@ -9,7 +9,7 @@ XUD_EpType epTypeTableOut[EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -int TestEp_Control(chanend c_out, chanend c_in, int epNum) +int TestEp_Control(XUD_ep c_ep0_out, XUD_ep c_ep0_in, int epNum) { unsigned int slength; unsigned int length; @@ -17,9 +17,6 @@ int TestEp_Control(chanend c_out, chanend c_in, int epNum) XUD_Result_t sres; XUD_Result_t res; - XUD_ep c_ep0_out = XUD_InitEp(c_out); - XUD_ep c_ep0_in = XUD_InitEp(c_in); - unsigned char sbuffer[120]; unsigned char buffer[120]; @@ -54,32 +51,18 @@ int TestEp_Control(chanend c_out, chanend c_in, int epNum) return 1; } - XUD_Kill(c_ep0_out); - return 0; } } -int main() +unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) { - chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; - - par - { - - XUD_Main( c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, - XUD_SPEED_HS, XUD_PWR_BUS); + XUD_ep c_ep0_out = XUD_InitEp(c_ep_out[0]); + XUD_ep c_ep0_in = XUD_InitEp(c_ep_in[0]); - { - int fail = TestEp_Control(c_ep_out[0], c_ep_in[0], 0); - - if (fail) - TerminateFail(fail); - else - TerminatePass(fail); + unsigned failed = TestEp_Control(c_ep0_out, c_ep0_in, 0); - exit(0); - } - } + XUD_Kill(c_ep0_out); + return failed; } +#include "test_main.xc" diff --git a/tests/test_iso_rx_basic/src/main.xc b/tests/test_iso_rx_basic/src/main.xc index a8b59742..841edf92 100644 --- a/tests/test_iso_rx_basic/src/main.xc +++ b/tests/test_iso_rx_basic/src/main.xc @@ -13,62 +13,17 @@ #define PKT_LENGTH_END (14) #endif -#ifndef TEST_EP_NUM -#error -#endif - -XUD_EpType epTypeTableOut[EP_COUNT_OUT] = {XUD_EPTYPE_CTL, - XUD_EPTYPE_ISO, - XUD_EPTYPE_ISO, - XUD_EPTYPE_ISO, - XUD_EPTYPE_ISO, - XUD_EPTYPE_ISO}; - -XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, - XUD_EPTYPE_ISO, - XUD_EPTYPE_ISO, - XUD_EPTYPE_ISO, - XUD_EPTYPE_ISO, - XUD_EPTYPE_ISO}; +#include "shared.h" +XUD_EpType epTypeTableOut[EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO}; +XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO}; -#ifdef XUD_SIM_RTL -int testmain() -#else -int main() -#endif +unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) { - chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; - - par - { - { -#if defined(XUD_TEST_SPEED_FS) - unsigned speed = XUD_SPEED_FS; -#elif defined(XUD_TEST_SPEED_HS) - unsigned speed = XUD_SPEED_HS; -#else -#error XUD_TEST_SPEED_XX not defined -#endif - - XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, - speed, XUD_PWR_BUS); - } + unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); - { - unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); + return fail; +} - XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); - XUD_Kill(ep0); - - if(fail) - TerminateFail(fail); - else - TerminatePass(fail); - - } - } +#include "test_main.xc" - return 0; -} diff --git a/tests/test_iso_tx_basic.py b/tests/test_iso_tx_basic.py index 47620c53..cfed76f0 100644 --- a/tests/test_iso_tx_basic.py +++ b/tests/test_iso_tx_basic.py @@ -7,11 +7,14 @@ @pytest.fixture -def test_session(ep, address, bus_speed): +def test_session(ep, address, bus_speed, dummy_threads): start_length = 10 end_length = 14 + if dummy_threads > 3 and bus_speed == "HS": + pytest.xfail("Known failure when dummy_threads > 4 at HS") + session = UsbSession( bus_speed=bus_speed, run_enumeration=False, diff --git a/tests/test_iso_tx_basic/src/main.xc b/tests/test_iso_tx_basic/src/main.xc index 4a3d1694..907f7e9d 100644 --- a/tests/test_iso_tx_basic/src/main.xc +++ b/tests/test_iso_tx_basic/src/main.xc @@ -1,7 +1,4 @@ // Copyright 2016-2021 XMOS LIMITED. -// This Software is subject to the terms of the XMOS Public Licence: Version 1. - -#include "shared.h" #ifndef EP_COUNT_OUT #define EP_COUNT_OUT (6) @@ -11,13 +8,22 @@ #define EP_COUNT_IN (6) #endif -/* Endpoint type tables */ +#ifndef PKT_LENGTH_START +#define PKT_LENGTH_START (10) +#endif + +#ifndef PKT_LENGTH_END +#define PKT_LENGTH_END (14) +#endif + +#include "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_ISO, + XUD_EPTYPE_ISO, + XUD_EPTYPE_ISO, + XUD_EPTYPE_ISO, + XUD_EPTYPE_ISO}; XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO, @@ -25,31 +31,14 @@ XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO}; -int main() + +unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) { - chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; - //chan c_dummy[DUMMY_THREAD_COUNT]; - - par - { - - XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, - XUD_SPEED_HS, XUD_PWR_BUS); - - { - TestEp_Tx(c_ep_in[TEST_EP_NUM], TEST_EP_NUM, 10, 14, RUNMODE_DIE); - XUD_ep ep_out_0 = XUD_InitEp(c_ep_out[0]); - XUD_Kill(ep_out_0); - - //for(size_t i = 0; i -#include -#include -#include "xud.h" -#include "platform.h" -#include "shared.h" - #define EP_COUNT_OUT (6) #define EP_COUNT_IN (6) @@ -15,19 +8,16 @@ #define PKT_LENGTH_START (10) #endif -#ifndef TEST_EP_NUM -#error -#endif - #ifndef CTRL_EP_NUM #define CTRL_EP_NUM (TEST_EP_NUM + 1) #endif -/* Endpoint type tables */ +#include "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 TestEp_Stall(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) +unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) { unsigned failed = 0; uint8_t outBuffer[128]; @@ -57,42 +47,4 @@ unsigned TestEp_Stall(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_I return failed; } -#ifdef XUD_SIM_RTL -int testmain() -#else -int main() -#endif -{ - chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; - - par - { - { -#if defined(XUD_TEST_SPEED_FS) - unsigned speed = XUD_SPEED_FS; -#elif defined(XUD_TEST_SPEED_HS) - unsigned speed = XUD_SPEED_HS; -#else -#error XUD_TEST_SPEED_XX not defined -#endif - - XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, speed, XUD_PWR_BUS); - } - - { - unsigned fail = TestEp_Stall(c_ep_out, c_ep_in); - - XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); - XUD_Kill(ep0); - - if(fail) - TerminateFail(fail); - else - TerminatePass(fail); - - } - } - - return 0; -} +#include "test_main.xc" diff --git a/tests/test_stall_basic.py b/tests/test_stall_basic.py index 76375317..7ee02d3a 100644 --- a/tests/test_stall_basic.py +++ b/tests/test_stall_basic.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # Copyright 2016-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. from usb_session import UsbSession diff --git a/tests/test_stall_basic/src/main.xc b/tests/test_stall_basic/src/main.xc index 4426f4e6..4283bfb6 100644 --- a/tests/test_stall_basic/src/main.xc +++ b/tests/test_stall_basic/src/main.xc @@ -29,7 +29,7 @@ XUD_EpType epTypeTableOut[EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_E 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 TestEp_Stall(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) +unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) { unsigned failed = 0; uint8_t outBuffer[128]; @@ -67,43 +67,6 @@ unsigned TestEp_Stall(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_I return failed; } +#include "test_main.xc" -#ifdef XUD_SIM_RTL -int testmain() -#else -int main() -#endif -{ - chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; - - par - { - { -#if defined(XUD_TEST_SPEED_FS) - unsigned speed = XUD_SPEED_FS; -#elif defined(XUD_TEST_SPEED_HS) - unsigned speed = XUD_SPEED_HS; -#else -#error XUD_TEST_SPEED_XX not defined -#endif - XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, speed, XUD_PWR_BUS); - } - - { - unsigned fail = TestEp_Stall(c_ep_out, c_ep_in); - - XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); - XUD_Kill(ep0); - - if(fail) - TerminateFail(fail); - else - TerminatePass(fail); - - } - } - - return 0; -} diff --git a/tests/test_stall_epready/src/main.xc b/tests/test_stall_epready/src/main.xc index ce47f251..384405c2 100644 --- a/tests/test_stall_epready/src/main.xc +++ b/tests/test_stall_epready/src/main.xc @@ -1,30 +1,29 @@ // Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -#include "shared.h" -#define XUD_EP_COUNT_OUT (6) -#define XUD_EP_COUNT_IN (6) +#define EP_COUNT_OUT (6) +#define EP_COUNT_IN (6) #ifndef PKT_LENGTH_START -#define PKT_LENGTH_START (10) +#define PKT_LENGTH_START (10) #endif #ifndef TEST_EP_NUM -#define TEST_EP_NUM (1) +#define TEST_EP_NUM (1) #endif #ifndef CTRL_EP_NUM -#define CTRL_EP_NUM (TEST_EP_NUM + 1) +#define CTRL_EP_NUM (TEST_EP_NUM + 1) #endif +#include "shared.h" /* Endpoint type tables */ -XUD_EpType epTypeTableOut[XUD_EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; -XUD_EpType epTypeTableIn[XUD_EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; - +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 TestEp_Stall(chanend c_ep_out[XUD_EP_COUNT_OUT], chanend c_ep_in[XUD_EP_COUNT_IN]) +unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) { unsigned failed = 0; uint8_t outBuffer[128]; @@ -72,43 +71,4 @@ unsigned TestEp_Stall(chanend c_ep_out[XUD_EP_COUNT_OUT], chanend c_ep_in[XUD_EP return failed; } - -#ifdef XUD_SIM_RTL -int testmain() -#else -int main() -#endif -{ - chan c_ep_out[XUD_EP_COUNT_OUT], c_ep_in[XUD_EP_COUNT_IN]; - - par - { - { -#if defined(XUD_TEST_SPEED_FS) - unsigned speed = XUD_SPEED_FS; -#elif defined(XUD_TEST_SPEED_HS) - unsigned speed = XUD_SPEED_HS; -#else -#error XUD_TEST_SPEED_XX not defined -#endif - - XUD_Main(c_ep_out, XUD_EP_COUNT_OUT, c_ep_in, XUD_EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, speed, XUD_PWR_BUS); - } - - { - unsigned fail = TestEp_Stall(c_ep_out, c_ep_in); - - XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); - XUD_Kill(ep0); - - if(fail) - TerminateFail(fail); - else - TerminatePass(fail); - - } - } - - return 0; -} +#include "test_main.xc" From 6d32828cd57c84e1f5425ae70b98f953abdf5c42 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 30 Jun 2021 00:10:36 +0100 Subject: [PATCH 421/520] Test fixes. --- tests/test_bulk_loopback/src/main.xc | 29 +++------------------------- tests/test_bulk_tx_basic_short.py | 5 ++++- 2 files changed, 7 insertions(+), 27 deletions(-) diff --git a/tests/test_bulk_loopback/src/main.xc b/tests/test_bulk_loopback/src/main.xc index 5131b589..3ffd79bd 100644 --- a/tests/test_bulk_loopback/src/main.xc +++ b/tests/test_bulk_loopback/src/main.xc @@ -17,28 +17,6 @@ XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_E #error KILL EP OUT OF RANGE #endif -/* Loopback packets forever */ -#pragma unsafe arrays -int TestEp_Bulk(chanend c_out1, chanend c_in1) -{ - unsigned int length; - XUD_Result_t res; - - XUD_ep ep_out1 = XUD_InitEp(c_out1); - XUD_ep ep_in1 = XUD_InitEp(c_in1); - - /* Buffer for Setup data */ - unsigned char buffer[1024]; - - while(1) - { - XUD_GetBuffer(ep_out1, buffer, length); - XUD_SetBuffer(ep_in1, buffer, length); - - XUD_GetBuffer(ep_out1, buffer, length); - XUD_SetBuffer(ep_in1, buffer, length); - } -} /* Loopback packet and terminate program */ #pragma unsafe arrays @@ -57,7 +35,6 @@ int TestEp_Bulk2(chanend c_out, chanend c_in, chanend c_out_0) XUD_GetBuffer(ep_out, buffer, length); XUD_SetBuffer(ep_in, buffer, length); - XUD_Kill(ep_out_0); exit(0); } @@ -65,8 +42,6 @@ int TestEp_Bulk2(chanend c_out, chanend c_in, chanend c_out_0) int main() { chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; - chan c_sync; - chan c_sync_iso; par { @@ -74,8 +49,10 @@ int main() null, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); - TestEp_Bulk(c_ep_out[TEST_EP_NUM], c_ep_in[TEST_EP_NUM]); + TestEp_Loopback(c_ep_out[TEST_EP_NUM], c_ep_in[TEST_EP_NUM], RUNMODE_LOOP); TestEp_Bulk2(c_ep_out[KILL_EP], c_ep_in[KILL_EP], c_ep_out[0]); + + dummyThreads(); } return 0; diff --git a/tests/test_bulk_tx_basic_short.py b/tests/test_bulk_tx_basic_short.py index a5ca6bf0..1ca04ee0 100644 --- a/tests/test_bulk_tx_basic_short.py +++ b/tests/test_bulk_tx_basic_short.py @@ -7,11 +7,14 @@ @pytest.fixture -def test_session(ep, address, bus_speed): +def test_session(ep, address, bus_speed, dummy_threads): start_length = 0 end_length = 7 + if dummy_threads > 3 and bus_speed == "HS": + pytest.xfail("Known failure dummy thread > 3 @ HS") + session = UsbSession( bus_speed=bus_speed, run_enumeration=False, device_address=address ) From 5e31b30b29da88b56645adc0529a98f35ec488e0 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 30 Jun 2021 10:54:19 +0100 Subject: [PATCH 422/520] Added missing licence comment --- tests/test_iso_tx_basic/src/main.xc | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_iso_tx_basic/src/main.xc b/tests/test_iso_tx_basic/src/main.xc index 907f7e9d..2d9ce937 100644 --- a/tests/test_iso_tx_basic/src/main.xc +++ b/tests/test_iso_tx_basic/src/main.xc @@ -1,4 +1,5 @@ // Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. #ifndef EP_COUNT_OUT #define EP_COUNT_OUT (6) From f5e76690bceb099eeda20895d43930119ac9ebea Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 30 Jun 2021 11:51:05 +0100 Subject: [PATCH 423/520] Tidied test readme --- tests/README.txt | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tests/README.txt b/tests/README.txt index 18f27d62..cd5b8f2f 100644 --- a/tests/README.txt +++ b/tests/README.txt @@ -1,11 +1,4 @@ -The xross/feat/usb_shim branches need pulling into the mainlines of the -folliwing repos - -xsim -xsimutils -tools_xmostest - Installation and prerequiste for running pytest python3 pip install pytest From e4293a0385cd3f9c781e87cccd43a21eeeda5fca Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 30 Jun 2021 11:57:11 +0100 Subject: [PATCH 424/520] Remove old testsummary.txt --- tests/testsummary.txt | 44 ------------------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 tests/testsummary.txt diff --git a/tests/testsummary.txt b/tests/testsummary.txt deleted file mode 100644 index 9905b0a2..00000000 --- a/tests/testsummary.txt +++ /dev/null @@ -1,44 +0,0 @@ ------------- -TEST SUMMARY ------------- -lib_xud::xud_sim_tests::test_bulk_loopback[arch=xs3;clk=60Mhz] PASS -lib_xud::xud_sim_tests::test_bulk_loopback[arch=xs2;clk=60Mhz] PASS -lib_xud::xud_sim_tests::test_bulk_rx_basic[arch=xs3;clk=60Mhz] PASS -lib_xud::xud_sim_tests::test_bulk_rx_basic[arch=xs2;clk=60Mhz] PASS -lib_xud::xud_sim_tests::test_bulk_rx_basic_badcrc32[arch=xs3;clk=60Mhz] PASS -lib_xud::xud_sim_tests::test_bulk_rx_basic_badcrc32[arch=xs2;clk=60Mhz] PASS -lib_xud::xud_sim_tests::test_bulk_rx_basic_badpid[arch=xs3;clk=60Mhz] PASS -lib_xud::xud_sim_tests::test_bulk_rx_basic_badpid[arch=xs2;clk=60Mhz] PASS -lib_xud::xud_sim_tests::test_bulk_rx_basic_rxerror[arch=xs3;clk=60Mhz] FAIL -lib_xud::xud_sim_tests::test_bulk_rx_basic_rxerror[arch=xs2;clk=60Mhz] FAIL -lib_xud::xud_sim_tests::test_bulk_rx_fastpacket[arch=xs3;clk=60Mhz] PASS -lib_xud::xud_sim_tests::test_bulk_rx_fastpacket[arch=xs2;clk=60Mhz] PASS -lib_xud::xud_sim_tests::test_bulk_rx_fastpacket_multiep[arch=xs3;clk=60Mhz] PASS -lib_xud::xud_sim_tests::test_bulk_rx_fastpacket_multiep[arch=xs2;clk=60Mhz] PASS -lib_xud::xud_sim_tests::test_bulk_rxtx_fastpacket[arch=xs3;clk=60Mhz] PASS -lib_xud::xud_sim_tests::test_bulk_rxtx_fastpacket[arch=xs2;clk=60Mhz] PASS -lib_xud::xud_sim_tests::test_bulk_tx_basic[arch=xs3;clk=60Mhz] PASS -lib_xud::xud_sim_tests::test_bulk_tx_basic[arch=xs2;clk=60Mhz] PASS -lib_xud::xud_sim_tests::test_bulk_tx_basic_noack[arch=xs3;clk=60Mhz] PASS -lib_xud::xud_sim_tests::test_bulk_tx_basic_noack[arch=xs2;clk=60Mhz] PASS -lib_xud::xud_sim_tests::test_bulk_tx_fastpacket[arch=xs3;clk=60Mhz] PASS -lib_xud::xud_sim_tests::test_bulk_tx_fastpacket[arch=xs2;clk=60Mhz] PASS -lib_xud::xud_sim_tests::test_bulk_tx_fastpacket_multiep[arch=xs3;clk=60Mhz] PASS -lib_xud::xud_sim_tests::test_bulk_tx_fastpacket_multiep[arch=xs2;clk=60Mhz] PASS -lib_xud::xud_sim_tests::test_invalidtoken[arch=xs3;clk=60Mhz] PASS -lib_xud::xud_sim_tests::test_invalidtoken[arch=xs2;clk=60Mhz] PASS -lib_xud::xud_sim_tests::test_iso_loopback[arch=xs3;clk=60Mhz] PASS -lib_xud::xud_sim_tests::test_iso_loopback[arch=xs2;clk=60Mhz] PASS -lib_xud::xud_sim_tests::test_iso_rx_basic[arch=xs3;clk=60Mhz] PASS -lib_xud::xud_sim_tests::test_iso_rx_basic[arch=xs2;clk=60Mhz] PASS -lib_xud::xud_sim_tests::test_iso_rxtx_fastpacket[arch=xs3;clk=60Mhz] PASS -lib_xud::xud_sim_tests::test_iso_rxtx_fastpacket[arch=xs2;clk=60Mhz] FAIL -lib_xud::xud_sim_tests::test_iso_tx_basic[arch=xs3;clk=60Mhz] PASS -lib_xud::xud_sim_tests::test_iso_tx_basic[arch=xs2;clk=60Mhz] PASS -lib_xud::xud_sim_tests::test_ping_rx_basic[arch=xs3;clk=60Mhz] PASS -lib_xud::xud_sim_tests::test_ping_rx_basic[arch=xs2;clk=60Mhz] PASS -lib_xud::xud_sim_tests::test_shorttoken[arch=xs3;clk=60Mhz] FAIL -lib_xud::xud_sim_tests::test_shorttoken[arch=xs2;clk=60Mhz] PASS ------------- -34/38 PASSED ------------- From b159a2dfe29e7bd410dac1d98b6611a82fd0d2bf Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 30 Jun 2021 12:11:15 +0100 Subject: [PATCH 425/520] Removed extra whitespace --- tests/shared_src/shared.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/shared_src/shared.h b/tests/shared_src/shared.h index b9efd1ee..793ac1b2 100644 --- a/tests/shared_src/shared.h +++ b/tests/shared_src/shared.h @@ -267,10 +267,4 @@ void dummyThreads() } #endif } - - - - - - #endif From 5114d0e55d7ad2df8cf4f6f01926098cebe68f30 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 30 Jun 2021 12:14:24 +0100 Subject: [PATCH 426/520] Marked speed const --- tests/shared_src/test_main.xc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/shared_src/test_main.xc b/tests/shared_src/test_main.xc index fcfcfc27..96f6e7f5 100644 --- a/tests/shared_src/test_main.xc +++ b/tests/shared_src/test_main.xc @@ -13,9 +13,9 @@ int main() { { #if defined(XUD_TEST_SPEED_FS) - unsigned speed = XUD_SPEED_FS; + const unsigned speed = XUD_SPEED_FS; #elif defined(XUD_TEST_SPEED_HS) - unsigned speed = XUD_SPEED_HS; + const unsigned speed = XUD_SPEED_HS; #endif XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, From 968c9e49a9b35418e926b97b33c14c7629b72662 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 30 Jun 2021 12:18:15 +0100 Subject: [PATCH 427/520] Whitespace only --- tests/test_bulk_tx_badack/src/main.xc | 9 ++++----- tests/test_bulk_tx_basic/src/main.xc | 9 ++++----- tests/test_bulk_tx_multiep/src/main.xc | 6 +++--- tests/test_iso_tx_basic/src/main.xc | 9 ++++----- 4 files changed, 15 insertions(+), 18 deletions(-) diff --git a/tests/test_bulk_tx_badack/src/main.xc b/tests/test_bulk_tx_badack/src/main.xc index 6d1d97a5..7c6c170f 100644 --- a/tests/test_bulk_tx_badack/src/main.xc +++ b/tests/test_bulk_tx_badack/src/main.xc @@ -16,10 +16,10 @@ 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_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, @@ -27,7 +27,6 @@ XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, 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_Tx(c_ep_in[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_DIE); diff --git a/tests/test_bulk_tx_basic/src/main.xc b/tests/test_bulk_tx_basic/src/main.xc index 317dba57..d273ee68 100644 --- a/tests/test_bulk_tx_basic/src/main.xc +++ b/tests/test_bulk_tx_basic/src/main.xc @@ -16,10 +16,10 @@ 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_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, @@ -27,7 +27,6 @@ XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, 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_Tx(c_ep_in[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_DIE); diff --git a/tests/test_bulk_tx_multiep/src/main.xc b/tests/test_bulk_tx_multiep/src/main.xc index 2ae6b232..61f0a1c2 100644 --- a/tests/test_bulk_tx_multiep/src/main.xc +++ b/tests/test_bulk_tx_multiep/src/main.xc @@ -11,9 +11,9 @@ 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_BUL, + XUD_EPTYPE_BUL}; XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, diff --git a/tests/test_iso_tx_basic/src/main.xc b/tests/test_iso_tx_basic/src/main.xc index 2d9ce937..e44a8988 100644 --- a/tests/test_iso_tx_basic/src/main.xc +++ b/tests/test_iso_tx_basic/src/main.xc @@ -21,10 +21,10 @@ XUD_EpType epTypeTableOut[EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_ISO, - XUD_EPTYPE_ISO, - XUD_EPTYPE_ISO, - XUD_EPTYPE_ISO, - XUD_EPTYPE_ISO}; + XUD_EPTYPE_ISO, + XUD_EPTYPE_ISO, + XUD_EPTYPE_ISO, + XUD_EPTYPE_ISO}; XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO, @@ -32,7 +32,6 @@ XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_ISO, XUD_EPTYPE_ISO}; - unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) { unsigned fail = TestEp_Tx(c_ep_in[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_DIE); From dedbd5c4b4513a3ac10fd531606cba04cc2316aa Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 30 Jun 2021 12:22:38 +0100 Subject: [PATCH 428/520] Changed EP count for test_bulk_tx_multiep --- tests/test_bulk_tx_multiep/src/main.xc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_bulk_tx_multiep/src/main.xc b/tests/test_bulk_tx_multiep/src/main.xc index 61f0a1c2..81d5c067 100644 --- a/tests/test_bulk_tx_multiep/src/main.xc +++ b/tests/test_bulk_tx_multiep/src/main.xc @@ -1,7 +1,7 @@ // Copyright 2016-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -#define EP_COUNT_OUT (4) +#define EP_COUNT_OUT (5) #define EP_COUNT_IN (8) #define PKT_LENGTH_START (10) From 010ae41edba79ba052cd52d0882986142d223b52 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 30 Jun 2021 13:28:56 +0100 Subject: [PATCH 429/520] Used session scoped fixture to setup and tear down tests (copy and delete xn files) --- tests/conftest.py | 51 +++++++++++++++++++++++++++++++++++++++++++++++ tests/helpers.py | 23 +-------------------- 2 files changed, 52 insertions(+), 22 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index f395ac7a..dec11cca 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -8,6 +8,10 @@ import Pyxsim from Pyxsim import testers from helpers import get_usb_clk_phy, do_usb_test +from pathlib import Path +import shutil + +XN_FILES = ["test_xs2.xn", "test_xs3.xn"] PARAMS = { "default": { @@ -114,3 +118,50 @@ def test_RunUsbSession( print(cap_output) sys.stderr.write(err) assert result + + +def copy_common_xn_files( + test_dir, path=".", common_dir="shared_src", source_dir="src", xn_files=XN_FILES +): + src_dir = os.path.join(test_dir, source_dir) + for xn_file in xn_files: + xn = os.path.join(common_dir, xn_file) + shutil.copy(xn, src_dir) + + +def delete_test_specific_xn_files( + test_dir, path=".", source_dir="src", xn_files=XN_FILES +): + src_dir = os.path.join(test_dir, source_dir) + for xn_file in xn_files: + xn = os.path.join(src_dir, xn_file) + os.remove(xn) + + +# Runs after all tests are collected +@pytest.fixture(scope="session", autouse=True) +def copy_xn_files(request): + + session = request.node + + # There will be duplicates (same test name with different params) so treat as set + test_dirs = set([]) + + # Go through collected tests and copy over XN files + for item in session.items: + full_path = item.fspath + test_dir = Path(full_path).with_suffix("") # Strip suffix + test_dir = os.path.basename(test_dir) + test_dirs.add(test_dir) + + for test_dir in test_dirs: + copy_common_xn_files(test_dir) + + def delete_xn_files(): + + # Go through collected tests deleting XN files + for test_dir in test_dirs: + delete_test_specific_xn_files(test_dir) + + # Setup tear down + request.addfinalizer(delete_xn_files) diff --git a/tests/helpers.py b/tests/helpers.py index 224374c9..ba3f0908 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -10,34 +10,14 @@ from usb_phy import UsbPhy from usb_phy_shim import UsbPhyShim from usb_phy_utmi import UsbPhyUtmi -import shutil from usb_packet import RxPacket, USB_DATA_VALID_COUNT ARCHITECTURE_CHOICES = ["xs2", "xs3"] BUSSPEED_CHOICES = ["FS", "HS"] args = {"arch": "xs3", "trace": False} -XN_FILES = ["test_xs2.xn", "test_xs3.xn"] clean_only = False -def copy_common_xn_files( - test_dir, path=".", common_dir="shared_src", source_dir="src", xn_files=XN_FILES -): - src_dir = os.path.join(test_dir, source_dir) - for xn_file in xn_files: - xn = os.path.join(common_dir, xn_file) - shutil.copy(xn, src_dir) - - -def delete_test_specific_xn_files( - test_dir, path=".", source_dir="src", xn_files=XN_FILES -): - src_dir = os.path.join(test_dir, source_dir) - for xn_file in xn_files: - xn = os.path.join(src_dir, xn_file) - os.remove(xn) - - def create_if_needed(folder): if not os.path.exists(folder): os.makedirs(folder) @@ -157,7 +137,7 @@ def do_usb_test( binary = "{testname}/bin/{arch}/{testname}_{arch}.xe".format( testname=testname, arch=arch ) - copy_common_xn_files(testname) + build_success, build_output = Pyxsim._build(binary, build_options=build_options) assert len(sessions) == 1, "Multiple sessions not yet supported" @@ -193,7 +173,6 @@ def do_usb_test( else: tester_list.append("Build Failed") - delete_test_specific_xn_files(testname) return tester_list From bd0cc10ac5b3fae67398dedebb8e9b9cfe77ee4b Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 30 Jun 2021 14:47:06 +0100 Subject: [PATCH 430/520] Made start on fixing multi-processing tests (not yet functional) --- tests/conftest.py | 54 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 38 insertions(+), 16 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index dec11cca..0640b238 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -135,33 +135,55 @@ def delete_test_specific_xn_files( src_dir = os.path.join(test_dir, source_dir) for xn_file in xn_files: xn = os.path.join(src_dir, xn_file) + + print("DELETE: " + str(xn)) + + # TODO ideally we don't need to catch this exception if we only try to delete once + # try: os.remove(xn) + # except OSError: + # pass -# Runs after all tests are collected @pytest.fixture(scope="session", autouse=True) -def copy_xn_files(request): +def worker_id(request): + if hasattr(request.config, "slaveinput"): + return request.config.slaveinput["slaveid"] + else: + # Master means not executing with multiple workers + return "master" - session = request.node - # There will be duplicates (same test name with different params) so treat as set - test_dirs = set([]) +# Runs after all tests are collected +@pytest.fixture(scope="session", autouse=True) +def copy_xn_files(worker_id, request): - # Go through collected tests and copy over XN files - for item in session.items: - full_path = item.fspath - test_dir = Path(full_path).with_suffix("") # Strip suffix - test_dir = os.path.basename(test_dir) - test_dirs.add(test_dir) + # Attempt to only run copy/delete once.. + if worker_id == "master" or worker_id == "gw0": - for test_dir in test_dirs: - copy_common_xn_files(test_dir) + session = request.node - def delete_xn_files(): + # There will be duplicates (same test name with different params) so treat as set + test_dirs = set([]) + + # Go through collected tests and copy over XN files + for item in session.items: + full_path = item.fspath + test_dir = Path(full_path).with_suffix("") # Strip suffix + test_dir = os.path.basename(test_dir) + test_dirs.add(test_dir) - # Go through collected tests deleting XN files for test_dir in test_dirs: - delete_test_specific_xn_files(test_dir) + copy_common_xn_files(test_dir) + + def delete_xn_files(): + + # Run deletion on one process only + if worker_id == "master" or worker_id == "gw0": + + # Go through collected tests deleting XN files + for test_dir in test_dirs: + delete_test_specific_xn_files(test_dir) # Setup tear down request.addfinalizer(delete_xn_files) From d845c14a84f2d2cb4c071ee82909de3bc886d79b Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 30 Jun 2021 16:06:59 +0100 Subject: [PATCH 431/520] Disabled deletion of xn files --- tests/conftest.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 0640b238..46a729e6 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,6 +1,5 @@ # Copyright 2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. - import pytest import os import random @@ -154,7 +153,8 @@ def worker_id(request): return "master" -# Runs after all tests are collected +# Runs after all tests are collected, but before all tests are run +# Note, there is one session per process, to this runs once per process... @pytest.fixture(scope="session", autouse=True) def copy_xn_files(worker_id, request): @@ -186,4 +186,5 @@ def delete_xn_files(): delete_test_specific_xn_files(test_dir) # Setup tear down - request.addfinalizer(delete_xn_files) + # Deletion removed for now - doesn't seem important + #request.addfinalizer(delete_xn_files) From 6e1d552e0326a5b444d761567dd5d897ada2beeb Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 1 Jul 2021 11:34:32 +0100 Subject: [PATCH 432/520] Add support for testing XS3 at 600 and 800MHz --- tests/conftest.py | 23 ++++++++++++------ tests/helpers.py | 7 ++++-- .../{test_xs3.xn => test_xs3_600.xn} | 2 +- tests/shared_src/test_xs3_800.xn | 24 +++++++++++++++++++ tests/test_makefile.mak | 4 ++-- 5 files changed, 48 insertions(+), 12 deletions(-) rename tests/shared_src/{test_xs3.xn => test_xs3_600.xn} (91%) create mode 100644 tests/shared_src/test_xs3_800.xn diff --git a/tests/conftest.py b/tests/conftest.py index 46a729e6..4dc6fc36 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -10,7 +10,7 @@ from pathlib import Path import shutil -XN_FILES = ["test_xs2.xn", "test_xs3.xn"] +XN_FILES = ["test_xs2.xn", "test_xs3_600.xn", "test_xs3_800.xn"] PARAMS = { "default": { @@ -19,15 +19,15 @@ "address": [0, 1, 127], "bus_speed": ["HS", "FS"], "dummy_threads": [0, 4, 5], + "core_freq": [600, 800], }, "smoke": { "arch": ["xs3"], "ep": [1], "address": [0], "bus_speed": ["HS", "FS"], - "dummy_threads": [ - 4 - ], # TODO Set to 0 for speed of simulation vs higher for better quality testing.. + "dummy_threads": [4], + "core_freq": [600], }, } @@ -82,7 +82,15 @@ def test_dummy_threads(dummy_threads: int) -> int: def test_RunUsbSession( - test_session, arch, ep, address, bus_speed, dummy_threads, test_file, capfd + test_session, + arch, + ep, + address, + bus_speed, + dummy_threads, + core_freq, + test_file, + capfd, ): tester_list = [] @@ -98,6 +106,7 @@ def test_RunUsbSession( address, bus_speed, dummy_threads, + core_freq, clk_60, usb_phy, [test_session], @@ -153,7 +162,7 @@ def worker_id(request): return "master" -# Runs after all tests are collected, but before all tests are run +# Runs after all tests are collected, but before all tests are run # Note, there is one session per process, to this runs once per process... @pytest.fixture(scope="session", autouse=True) def copy_xn_files(worker_id, request): @@ -187,4 +196,4 @@ def delete_xn_files(): # Setup tear down # Deletion removed for now - doesn't seem important - #request.addfinalizer(delete_xn_files) + # request.addfinalizer(delete_xn_files) diff --git a/tests/helpers.py b/tests/helpers.py index ba3f0908..f27ceb94 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -114,6 +114,7 @@ def do_usb_test( address, bus_speed, dummy_threads, + core_freq, clk, phy, sessions, @@ -134,8 +135,10 @@ def do_usb_test( testname, extension = os.path.splitext(os.path.basename(test_file)) tester_list = [] - binary = "{testname}/bin/{arch}/{testname}_{arch}.xe".format( - testname=testname, arch=arch + binary = ( + "{testname}/bin/{arch}_{core_freq}/{testname}_{arch}_{core_freq}.xe".format( + testname=testname, arch=arch, core_freq=core_freq + ) ) build_success, build_output = Pyxsim._build(binary, build_options=build_options) diff --git a/tests/shared_src/test_xs3.xn b/tests/shared_src/test_xs3_600.xn similarity index 91% rename from tests/shared_src/test_xs3.xn rename to tests/shared_src/test_xs3_600.xn index 6ea38caf..20e8eeb6 100644 --- a/tests/shared_src/test_xs3.xn +++ b/tests/shared_src/test_xs3_600.xn @@ -9,7 +9,7 @@ - + diff --git a/tests/shared_src/test_xs3_800.xn b/tests/shared_src/test_xs3_800.xn new file mode 100644 index 00000000..15ab41a6 --- /dev/null +++ b/tests/shared_src/test_xs3_800.xn @@ -0,0 +1,24 @@ + + + + tileref tile[2] + + + + + + + + + + + + + + + + + + diff --git a/tests/test_makefile.mak b/tests/test_makefile.mak index ce51f142..2e55723d 100644 --- a/tests/test_makefile.mak +++ b/tests/test_makefile.mak @@ -32,8 +32,8 @@ COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -X #TODO RM ARCH_L define #XCC_FLAGS_xs2 = $(TEST_FLAGS) $(COMMON_FLAGS) -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -DARCH_L -XCC_FLAGS_xs3 = $(TEST_FLAGS) $(COMMON_FLAGS) - +XCC_FLAGS_xs3_600 = $(TEST_FLAGS) $(COMMON_FLAGS) +XCC_FLAGS_xs3_800 = $(TEST_FLAGS) $(COMMON_FLAGS) TARGET = test_$(CONFIG).xn From b9b2bb2327ffe5b3d594e40bd867e41bdf6fcb64 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 1 Jul 2021 11:53:51 +0100 Subject: [PATCH 433/520] Catch IOError exception --- tests/conftest.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 4dc6fc36..74db6d73 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -146,11 +146,10 @@ def delete_test_specific_xn_files( print("DELETE: " + str(xn)) - # TODO ideally we don't need to catch this exception if we only try to delete once - # try: - os.remove(xn) - # except OSError: - # pass + try: + os.remove(xn) + except OSError: + pass @pytest.fixture(scope="session", autouse=True) From a0825397de2831e3d43516b228c84061cb4078d5 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 1 Jul 2021 11:54:45 +0100 Subject: [PATCH 434/520] Update gitignore for new XN files --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index a8fed707..e0379411 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,7 @@ Installs/ tests/bin.txt tests/log tests/test_**/**test_xs2.xn -tests/test_**/**test_xs3.xn +tests/test_**/**test_xs3_600.xn +tests/test_**/**test_xs3_800.xn **/venv/** *.gtkw From 66b694a0fd1a02d88293ae853d286e1480aec40c Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 1 Jul 2021 11:59:32 +0100 Subject: [PATCH 435/520] Removed debug print --- tests/conftest.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 74db6d73..cad3e1cb 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -144,8 +144,6 @@ def delete_test_specific_xn_files( for xn_file in xn_files: xn = os.path.join(src_dir, xn_file) - print("DELETE: " + str(xn)) - try: os.remove(xn) except OSError: From 2ab76b377e7bc41e776886dbe32f4c9e260e55ed Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 1 Jul 2021 12:01:25 +0100 Subject: [PATCH 436/520] Comment only --- tests/conftest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index cad3e1cb..46f15e7e 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -160,7 +160,7 @@ def worker_id(request): # Runs after all tests are collected, but before all tests are run -# Note, there is one session per process, to this runs once per process... +# Note, there is one session per process, so this runs once per process... @pytest.fixture(scope="session", autouse=True) def copy_xn_files(worker_id, request): @@ -176,7 +176,7 @@ def copy_xn_files(worker_id, request): for item in session.items: full_path = item.fspath test_dir = Path(full_path).with_suffix("") # Strip suffix - test_dir = os.path.basename(test_dir) + test_dir = os.path.basename(test_dir) # Strip path leaving filename test_dirs.add(test_dir) for test_dir in test_dirs: From b27e4ccc0f69bc36239114f88ccff21fa29ebe1a Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 1 Jul 2021 13:17:22 +0100 Subject: [PATCH 437/520] Removed xs2 XN file (to shave off some test time) --- tests/conftest.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 46f15e7e..cd859f8b 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -10,7 +10,8 @@ from pathlib import Path import shutil -XN_FILES = ["test_xs2.xn", "test_xs3_600.xn", "test_xs3_800.xn"] +# Note, no current support for XS2 +XN_FILES = ["test_xs3_600.xn", "test_xs3_800.xn"] PARAMS = { "default": { From b5174aa333021c65e25fbbf733b6f55aaddf9653 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 1 Jul 2021 13:18:35 +0100 Subject: [PATCH 438/520] Tidied param modification in test_bulk_rx_multiep --- tests/test_bulk_rx_multiep.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_bulk_rx_multiep.py b/tests/test_bulk_rx_multiep.py index 6c603537..8860b377 100644 --- a/tests/test_bulk_rx_multiep.py +++ b/tests/test_bulk_rx_multiep.py @@ -8,8 +8,8 @@ # EP numbers currently fixed for this test - set in params PARAMS = deepcopy(PARAMS) -PARAMS["smoke"].update({"ep": [3], "dummy_threads": [0]}) -PARAMS["default"].update({"ep": [3], "dummy_threads": [0]}) +for k in PARAMS: + PARAMS[k].update({"ep": [3], "dummy_threads": [0]}) @pytest.fixture From 57b1585d70cd45cc14b5eed2bb417b6b8d9210ef Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 1 Jul 2021 13:20:07 +0100 Subject: [PATCH 439/520] Fixed issue where driving suspend from the TB can end up in infinite loop --- tests/usb_signalling.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/usb_signalling.py b/tests/usb_signalling.py index 0ec304d8..699bcfdf 100644 --- a/tests/usb_signalling.py +++ b/tests/usb_signalling.py @@ -338,12 +338,11 @@ def drive(self, usb_phy, bus_speed): xcvr = xsi.sample_periph_pin(usb_phy._xcvrsel) termsel = xsi.sample_periph_pin(usb_phy._termsel) - # Wait for DUT to move into FS mode + # Check DUT doesn't prematurely move out of FS mode if not (xcvr == 1 and termsel == 1): print("ERROR: DUT moved out of FS mode unexpectly during suspend") time_ns = xsi.get_time() - suspendStartTime_ns - if time_ns == self._duration_ns: - # print("SUSPEND END: " + str(xsi.get_time())) + if time_ns >= self._duration_ns: print("SUSPEND END") break From 90ee33d965c1f3087852f8b4c96df870d86e4ed9 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 1 Jul 2021 14:32:20 +0100 Subject: [PATCH 440/520] =?UTF-8?q?Added=20=E2=80=94-enabletracing=20to=20?= =?UTF-8?q?TB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/conftest.py | 12 +++++++++++- tests/helpers.py | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index cd859f8b..3b2c3088 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -34,7 +34,17 @@ def pytest_addoption(parser): - parser.addoption("--smoke", action="store_true", help="smoke test") + parser.addoption("--smoke", action="store_true", help="Smoke test") + parser.addoption( + "--enabletracing", + action="store_true", + default=False, + help="Run tests with tracing", + ) + + +def pytest_configure(config): + os.environ["enabletracing"] = str(config.getoption("enabletracing")) def pytest_generate_tests(metafunc): diff --git a/tests/helpers.py b/tests/helpers.py index f27ceb94..dbf23f4a 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -210,7 +210,7 @@ def create_expect(arch, session, filename, verbose=False): def get_sim_args(testname, clk, phy, arch="xs2"): sim_args = [] - if args and args.get("trace"): + if bool(os.getenv("enabletracing")): log_folder = create_if_needed("logs") filename = "{log}/xsim_trace_{test}_{clk}_{arch}".format( From 4267c4941fa88fc53b19ef1179f377fe74716953 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 1 Jul 2021 18:14:18 +0100 Subject: [PATCH 441/520] Small tidy ups for review of #38 --- __app_test_mode/Makefile | 7 +- __app_test_mode/README.rst | 4 +- lib_xud/src/core/XUD_CrcAddrCheck.S | 19 -- lib_xud/src/core/XUD_IoLoop.S | 13 -- lib_xud/src/core/XUD_Main.xc | 2 - lib_xud/src/core/XUD_Signalling.xc | 10 +- lib_xud/src/core/XUD_USBTile_Support.S | 14 +- .../src/core/included/XUD_Token_Setup_DI.S | 44 ++-- lib_xud/src/core/xta_pragmas.h | 193 ------------------ 9 files changed, 35 insertions(+), 271 deletions(-) delete mode 100644 lib_xud/src/core/xta_pragmas.h diff --git a/__app_test_mode/Makefile b/__app_test_mode/Makefile index fce5e954..99f8226a 100644 --- a/__app_test_mode/Makefile +++ b/__app_test_mode/Makefile @@ -15,11 +15,10 @@ APP_NAME = app_test_mode # # XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS # -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to +# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to # xcc for the final link (mapping) stage. -# These flags define two build configurations - one for U-series and one for -# the xCORE-200 series. +# These flags define multiple build configurations - one for each test mode FLAGS_COMMON = -O3 -report -save-temps -DXUD_BYPASS_RESET -DXUD_TEST_SPEED_HS -DXUD_BYPASS_CONNECT XCC_FLAGS_TEST_J = $(FLAGS_COMMON) -DTEST_MODE=USB_WINDEX_TEST_J @@ -27,7 +26,7 @@ XCC_FLAGS_TEST_K = $(FLAGS_COMMON) -DTEST_MODE=USB_WINDEX_TEST_K XCC_FLAGS_TEST_SE0_NAK = $(FLAGS_COMMON) -DTEST_MODE=USB_WINDEX_TEST_SE0_NAK XCC_FLAGS_TEST_PACKET = $(FLAGS_COMMON) -DTEST_MODE=USB_WINDEX_TEST_PACKET -# The USED_MODULES variable lists other module used by the application. +# The USED_MODULES variable lists other module used by the application. USED_MODULES = lib_xud #============================================================================= diff --git a/__app_test_mode/README.rst b/__app_test_mode/README.rst index 697a2327..ac35ec06 100644 --- a/__app_test_mode/README.rst +++ b/__app_test_mode/README.rst @@ -12,9 +12,9 @@ This application stand-alone binaries for USB test modes. There are four build c - Test_K - Test_Packet -The application enters it's respective test mode from boot, this removing the requirement to set the mode from a host via the USBHSETT tool. +The application enters it's respective test mode from boot, thus removing the requirement to set the mode from a host via the USBHSETT tool. -Note, you not shouild expect the the device to appear on any USB bus and its probabky not advisable to plug into any standard host. +Note, you not should expect the the device to appear on any USB bus and its probably not advisable to plug into any standard host. This binaries are most commonly used in device characterisation. diff --git a/lib_xud/src/core/XUD_CrcAddrCheck.S b/lib_xud/src/core/XUD_CrcAddrCheck.S index df9c47be..6baf4459 100644 --- a/lib_xud/src/core/XUD_CrcAddrCheck.S +++ b/lib_xud/src/core/XUD_CrcAddrCheck.S @@ -10,7 +10,6 @@ // r10: Extracted EP number #ifdef __XS3A__ -#if 1 {in r10, res[RXD]; sub r1, r8, 5} // ldc r1 11 {shr r10, r10, 16; mkmsk r11, r1} {and r11, r10, r11; shr r4, r10, r1} // r4: Received CRC @@ -26,24 +25,6 @@ bt r10, waitforRXALow0 setc res[RXD], XS1_SETC_RUN_CLRBUF bu Loop_BadPid -#else - in r10, res[RXD] - ldaw r1, dp[crc5Table_Addr] - ldc r8, 30 - lmul r11, r10, r10, r8, r10, r10 // r11 is CRC5, r10 is EP(4):ADDR(7):CRAP(16):0(5) - shr r10, r10, 16 // r10 is 0(16):EP(4):ADDR(7):CRAP(5) - shr r10, r10, 5 // r10 is 0(21):EP(4):ADDR(7) - ld8u r8, r1[r10] // r8 is CRC of r10 - sub r4, r11, r8 // R4 set to 0 in L code with in from valid tok port - {BRFF_ru6 r4, 5; shr r10, r10, 7} // Extract EP number - - ldw r11, sp[STACK_RXA_PORT] // Wait for RXA to gow low (i.e. end of packet) - in r10, res[r11] - bt r10, waitforRXALow0 - setc res[RXD], XS1_SETC_RUN_CLRBUF - bu Loop_BadPid -#endif - #else // __XS2A__ inpw r10, res[RXD], 8; // Read EP Number diff --git a/lib_xud/src/core/XUD_IoLoop.S b/lib_xud/src/core/XUD_IoLoop.S index 207dea0c..d64eebd8 100755 --- a/lib_xud/src/core/XUD_IoLoop.S +++ b/lib_xud/src/core/XUD_IoLoop.S @@ -267,19 +267,6 @@ ConfigRxErrEventVector: setd res[r3], r11 // Set event cond data to 1 eeu res[r3] -#if 0 -SetupOutTimer: - getr r1, XS1_RES_TYPE_TIMER - ecallf r1 - - ldap r11, OutDataTimeOut - setv res[r1], r11 - setc res[r1], XS1_SETC_COND_AFTER - - stw r1, sp[STACK_OUT_TIMER] -#endif - - SetupSuspendResetTimer: getr r10, XS1_RES_TYPE_TIMER ecallf r10 diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index 78ef97d7..4e0c1da2 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -40,8 +40,6 @@ void XUD_UserSuspend(); void XUD_UserResume(); void XUD_PhyReset_User(); -#include "xta_pragmas.h" - #define HS_TX_HANDSHAKE_TIMEOUT (167) #define FS_TX_HANDSHAKE_TIMEOUT (5000) diff --git a/lib_xud/src/core/XUD_Signalling.xc b/lib_xud/src/core/XUD_Signalling.xc index d6d8dc84..736922c2 100755 --- a/lib_xud/src/core/XUD_Signalling.xc +++ b/lib_xud/src/core/XUD_Signalling.xc @@ -1,12 +1,6 @@ // Copyright 2011-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. -/** @file XUD_PowerSig.xc - * @brief Functions for USB power signaling - * @author Ross Owen, XMOS Limited - **/ - #include - #include "xud.h" #include "XUD_Support.h" #include "XUD_USB_Defines.h" @@ -43,9 +37,7 @@ int XUD_Init() /* Wait for host */ while (1) { - #ifdef __XS3A__ - XUD_LineState_t currentLs = XUD_HAL_GetLineState(); switch (currentLs) @@ -121,7 +113,7 @@ int XUD_Init() #ifndef __XS3A__ -/** XUD_DoSuspend +/** XUD_Suspend * @brief Function called when device is suspended. This should include any clock down code etc. * @return True if reset detected during resume */ int XUD_Suspend(XUD_PwrConfig pwrConfig) diff --git a/lib_xud/src/core/XUD_USBTile_Support.S b/lib_xud/src/core/XUD_USBTile_Support.S index ba6fb4a5..8a762dbb 100644 --- a/lib_xud/src/core/XUD_USBTile_Support.S +++ b/lib_xud/src/core/XUD_USBTile_Support.S @@ -23,15 +23,15 @@ XUD_EnableUsbPortMux: .issue_mode single ENTSP_lu6 0 ldc r1, XS1_PS_XCORE_CTRL0 - get r0, ps[r1] + get r0, ps[r1] ldc r2, 2 or r0, r0, r2 set ps[r1], r0 //Sanity check, read back and check - //get r1, ps[r1] - //eq r1, r0, r1 - //ecallf r1 + //get r1, ps[r1] + //eq r1, r0, r1 + //ecallf r1 retsp 0 .size XUD_EnableUsbPortMux, .-XUD_EnableUsbPortMux @@ -57,9 +57,9 @@ XUD_DisableUsbPortMux: set ps[r1], r0 //Sanity check, read back and check - //get r1, ps[r1] - //eq r1, r0, r1 - //ecallf r1 + //get r1, ps[r1] + //eq r1, r0, r1 + //ecallf r1 retsp 0 .size XUD_DisableUsbPortMux, .-XUD_DisableUsbPortMux diff --git a/lib_xud/src/core/included/XUD_Token_Setup_DI.S b/lib_xud/src/core/included/XUD_Token_Setup_DI.S index e96453f5..03e9e762 100644 --- a/lib_xud/src/core/included/XUD_Token_Setup_DI.S +++ b/lib_xud/src/core/included/XUD_Token_Setup_DI.S @@ -14,36 +14,36 @@ Pid_Setup: ldw r1, r3[3] // Load buffer LoadSetupBuffer: - bl doRXData // RXData writes available data to buffer and does crc check. + bl doRXData // RXData writes available data to buffer and does crc check. // r8: Data tail size (bytes) - {clre; eq r1, r6, r11} // Check for good CRC16 - bf r1, NextTokenAfterOut // Check for bad crc + {clre; eq r1, r6, r11} // Check for good CRC16 + bf r1, NextTokenAfterOut // Check for bad crc ClearStall: // CRC OK // Have received a SETUP so clear any STALL condition on IN/OUT endpoint. - ldaw r11, dp[handshakeTable_OUT] // Note, we can speed this up by assuming SETUP only received on EP 0 - ldc r6, USB_PIDn_NAK - stw r6, r11[r10] - ldaw r11, dp[handshakeTable_IN] - stw r6, r11[r10] + ldaw r11, dp[handshakeTable_OUT] // Note, we can speed this up by assuming SETUP only received on EP 0 + ldc r6, USB_PIDn_NAK + stw r6, r11[r10] + ldaw r11, dp[handshakeTable_IN] + stw r6, r11[r10] SendSetupAck: - ldc r11, USB_PIDn_ACK - outpw res[TXD], r11, 8 + ldc r11, USB_PIDn_ACK + outpw res[TXD], r11, 8 StoreTailData: // TODO: don't assume setups are 8 bytes + crc - ldc r11, 0 - stw r11, r5[r10] // Clear ready - ldw r11, r3[1] // Load chanend + ldc r11, 0 + stw r11, r5[r10] // Clear ready + ldw r11, r3[1] // Load chanend - out res[r11], r4 - outct res[r11], 0 // Send zero control token for SETUP. Tail ignored since always expect 8 bytes - bu NextTokenAfterOut // Go to next wait for next token + out res[r11], r4 + outct res[r11], 0 // Send zero control token for SETUP. Tail ignored since always expect 8 bytes + bu NextTokenAfterOut // Go to next wait for next token SBuffFull: - ldc r11, 0 - ldw r10, sp[STACK_RXA_PORT] // Load RxA Port ID (r1) - in r11, res[r10] // RXA event cond = 0 TODO: Wait for RXA high first? - endin r11, res[RXD] - in r11, res[RXD] - bu NextTokenAfterOut + ldc r11, 0 + ldw r10, sp[STACK_RXA_PORT] // Load RxA Port ID (r1) + in r11, res[r10] // RXA event cond = 0 TODO: Wait for RXA high first? + endin r11, res[RXD] + in r11, res[RXD] + bu NextTokenAfterOut diff --git a/lib_xud/src/core/xta_pragmas.h b/lib_xud/src/core/xta_pragmas.h deleted file mode 100644 index 87f41405..00000000 --- a/lib_xud/src/core/xta_pragmas.h +++ /dev/null @@ -1,193 +0,0 @@ -// Copyright 2020-2021 XMOS LIMITED. -// This Software is subject to the terms of the XMOS Public Licence: Version 1. -#if 0 -#pragma xta command "config threads stdcore[0] 6" -#pragma xta command "add exclusion Pid_Out" -#pragma xta command "add exclusion Pid_Setup" -#pragma xta command "add exclusion Pid_Sof" -#pragma xta command "add exclusion Pid_Reserved" -#pragma xta command "add exclusion Pid_Ack" -#pragma xta command "add exclusion Pid_Data0" -#pragma xta command "add exclusion Pid_Ping" -#pragma xta command "add exclusion Pid_Nyet" -#pragma xta command "add exclusion Pid_Data2" -#pragma xta command "add exclusion Pid_Data1" -#pragma xta command "add exclusion Pid_Data0" -#pragma xta command "add exclusion Pid_Datam" -#pragma xta command "add exclusion Pid_Split" -#pragma xta command "add exclusion Pid_Stall" -#pragma xta command "add exclusion Pid_Pre" -#pragma xta command "add exclusion InvalidToken" -#pragma xta command "add exclusion InReady" - -#pragma xta command "analyse path XUD_TokenRx_Pid XUD_TokenRx_Ep" -#pragma xta command "set required - 33 ns" -#endif - - -/* Rx to TX 16 clks required with SMSC phy (14 in spec). SIE Decision Time */ -#if 0 -#pragma xta command "analyse path XUD_TokenRx_Ep XUD_IN_TxNak" -#pragma xta command "set required - 233 ns" -#pragma xta command "add exclusion InNotReady" -#pragma xta command "remove exclusion InReady" - - -#pragma xta command "add exclusion XUD_IN_TxPid_Tail1" -#pragma xta command "add exclusion XUD_IN_TxPid_Tail2" -#pragma xta command "add exclusion XUD_IN_TxPid_Tail3" -#pragma xta command "add exclusion XUD_IN_TxPid_TailS0" -#pragma xta command "add exclusion XUD_IN_TxPid_TailS1" -#pragma xta command "add exclusion XUD_IN_TxPid_TailS2" -#pragma xta command "add exclusion XUD_IN_TxPid_TailS3" -#endif -#if 0 -#pragma xta command "analyse path XUD_TokenRx_Ep XUD_IN_TxPid_Tail0" -#pragma xta command "set required - 266 ns" -#endif - -#if 0 -#pragma xta command "remove exclusion XUD_IN_TxPid_TailS0" -#pragma xta command "add exclusion XUD_IN_TxPid_Tail0" -#pragma xta command "analyse path XUD_TokenRx_Ep XUD_IN_TxPid_TailS0" -#pragma xta command "set required - 266 ns" - -#pragma xta command "remove exclusion XUD_IN_TxPid_Tail1" -#pragma xta command "add exclusion XUD_IN_TxPid_TailS0" -#if 0 -#pragma xta command "analyse path XUD_TokenRx_Ep XUD_IN_TxPid_Tail1" -#pragma xta command "set required - 266 ns" -#endif - -#pragma xta command "remove exclusion XUD_IN_TxPid_TailS1" -#pragma xta command "add exclusion XUD_IN_TxPid_Tail1" -#if 0 -#pragma xta command "analyse path XUD_TokenRx_Ep XUD_IN_TxPid_TailS1" -#pragma xta command "set required - 266 ns" -#endif - -//#pragma xta command "remove exclusion ShortPacket" -//pragma xta command "add exclusion NormalPacket" -//#pragma xta command "analyse path XUD_TokenRx_Ep XUD_IN_TxPid_Short" -//#pragma xta command "set required - 233 ns" - -/* TX TO RX */ -/* Tx IN NAK to Token Rx */ -#pragma xta command "remove exclusion InNotReady" -#pragma xta command "add exclusion InReady" -#if 0 -#pragma xta command "analyse path XUD_TokenRx_Pid XUD_IN_TxNak" -#pragma xta command "set required - 100 ns" -#endif - -/* Tx OUT NAK to Token RX */ -#if 0 -#pragma xta command "analyse path XUD_OUT_TxNak XUD_TokenRx_Pid" -#pragma xta command "set required - 100 ns" -#endif - -/* Tx OUT ACK to Token Tx */ -#if 0 -#pragma xta command "analyse path XUD_OUT_TxAck XUD_TokenRx_Pid" -#pragma xta command "set required - 100 ns" -#endif - -/* Tx IN Data (so crc) to Rx Ack (Non ISO IN) */ -#pragma xta command "add exclusion InNotReady" -#pragma xta command "remove exclusion InReady" -#if 0 -#pragma xta command "add exclusion InISO" -#pragma xta command "add exclusion TxHandshakeTimeOut" -#endif - -#pragma xta command "remove exclusion XUD_IN_TxPid_Tail0" -#pragma xta command "add exclusion XUD_IN_TxPid_TailS1" -#if 0 -#pragma xta command "analyse path XUD_IN_TxCrc_Tail0 XUD_IN_RxAck" -#pragma xta command "set required - 100 ns" -#endif - -#pragma xta command "add exclusion XUD_IN_TxPid_Tail0" -#pragma xta command "remove exclusion XUD_IN_TxPid_Tail1" -#if 0 -#pragma xta command "analyse path XUD_IN_TxCrc_Tail1 XUD_IN_RxAck" -#pragma xta command "set required - 100 ns" -#endif - -#pragma xta command "add exclusion XUD_IN_TxPid_Tail1" -#pragma xta command "remove exclusion XUD_IN_TxPid_TailS0" -#if 0 -#pragma xta command "analyse path XUD_IN_TxCrc_TailS0 XUD_IN_RxAck" -#pragma xta command "set required - 100 ns" -#endif - -#pragma xta command "add exclusion XUD_IN_TxPid_TailS0" -#pragma xta command "remove exclusion XUD_IN_TxPid_TailS1" -#if 0 -#pragma xta command "analyse path XUD_IN_TxCrc_TailS1 XUD_IN_RxAck" -#pragma xta command "set required - 100 ns" -#endif - -/* Tx IN Data (so crc) to Rx Token PID (ISO In) */ -#pragma xta command "remove exclusion InISO" -#pragma xta command "add exclusion InNonISO" - -#if 0 -#pragma xta command "analyse path XUD_IN_TxCrc_Tail0 XUD_TokenRx_Pid" -#pragma xta command "set required - 100 ns" - -#pragma xta command "analyse path XUD_IN_TxCrc_Tail1 XUD_TokenRx_Pid" -#pragma xta command "set required - 100 ns" - -#pragma xta command "analyse path XUD_IN_TxCrc_Tail2 XUD_TokenRx_Pid" -#pragma xta command "set required - 100 ns" - -#pragma xta command "analyse path XUD_IN_TxCrc_Tail3 XUD_TokenRx_Pid" -#pragma xta command "set required - 100 ns" - -#pragma xta command "analyse path XUD_IN_TxCrc_TailS0 XUD_TokenRx_Pid" -#pragma xta command "set required - 100 ns" - -#pragma xta command "analyse path XUD_IN_TxCrc_TailS1 XUD_TokenRx_Pid" -#pragma xta command "set required - 100 ns" - -#pragma xta command "analyse path XUD_IN_TxCrc_TailS2 XUD_TokenRx_Pid" -#pragma xta command "set required - 100 ns" - -#pragma xta command "analyse path XUD_IN_TxCrc_TailS3 XUD_TokenRx_Pid" -#pragma xta command "set required - 100 ns" -#endif - -/* RX TO RX */ -/* Rx SOF to Rx SOF - This is a non-interesting case since timing will be ~125uS */ - -//#pragma xta command "remove exclusion Pid_Sof" -//#pragma xta command "add exclusion Pid_Out" -//#pragma xta command "add exclusion Pid_In" -#if 0 -#pragma xta command "analyse path XUD_TokenRx_Ep XUD_TokenRx_Pid" -#pragma xta command "set required - 50 ns" -#endif - -/* Rx OUT Data end to Rx Token (ISO Out Data) */ -//#pragma xta command "add exclusion OutTail0" -//#pragma xta command "add exclusion OutTail1" -//#pragma xta command "add exclusion OutTail2" -//#pragma xta command "add exclusion OutTail3" -//#pragma xta command "add exclusion OutTail4" -//#pragma xta command "add exclusion OutTail5" -//#pragma xta command "add exclusion ReportBadCrc" -//#pragma xta command "add exclusion DoOutHandShakeOut" -#if 0 -#pragma xta command "analyse path XUD_OUT_RxTail XUD_TokenRx_Pid" -#pragma xta command "set required - 50 ns" -#endif - - -#endif -/* TX INTRA PACKET TIMING */ -#if 0 -#pragma xta command "analyse path XUD_IN_TxPid_Tail0 TxLoop0_Out" -#pragma xta command "set required - 83 ns" -#endif - From 406bb07e8e8e7f551abf6bcee29436b0181a969e Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 1 Jul 2021 18:31:43 +0100 Subject: [PATCH 442/520] More fixed for review #38 --- lib_xud/src/user/client/XUD_EpFuncs.S | 1 - tests/Pyxsim/__init__.py | 1 - tests/{README.txt => README.rst} | 6 +- tests/shared_src/shared.h | 2 +- tests/shared_src/test_main.xc | 12 ++-- tests/shared_src/test_xs2.xn | 5 +- tests/test_bulk_loopback/LICENSE.rst | 84 -------------------------- tests/test_bulk_rx_multiep/src/main.xc | 6 +- tests/test_bulk_tx_noack.py | 50 --------------- tests/test_bulk_tx_noack/LICENSE.rst | 84 -------------------------- tests/test_bulk_tx_noack/Makefile | 3 - tests/test_bulk_tx_noack/src/main.xc | 70 --------------------- tests/test_invalidtoken/src/main.xc | 15 +++-- tests/test_makefile.mak | 3 - 14 files changed, 21 insertions(+), 321 deletions(-) rename tests/{README.txt => README.rst} (73%) delete mode 100644 tests/test_bulk_loopback/LICENSE.rst delete mode 100644 tests/test_bulk_tx_noack.py delete mode 100644 tests/test_bulk_tx_noack/LICENSE.rst delete mode 100644 tests/test_bulk_tx_noack/Makefile delete mode 100644 tests/test_bulk_tx_noack/src/main.xc diff --git a/lib_xud/src/user/client/XUD_EpFuncs.S b/lib_xud/src/user/client/XUD_EpFuncs.S index f354f793..9c33957b 100644 --- a/lib_xud/src/user/client/XUD_EpFuncs.S +++ b/lib_xud/src/user/client/XUD_EpFuncs.S @@ -426,7 +426,6 @@ XUD_GetData_Select_CheckPid: // Check PID bt r11, XUD_GetData_Select_BadPkt XUD_GetData_Select_PidToggle: -//#if (XUD_SERIES_SUPPORT==3) #ifdef __XS3A__ ldc r2, 0x88 #else diff --git a/tests/Pyxsim/__init__.py b/tests/Pyxsim/__init__.py index 0dc97c4e..7ee37d34 100644 --- a/tests/Pyxsim/__init__.py +++ b/tests/Pyxsim/__init__.py @@ -59,7 +59,6 @@ def _build(xe_path, build_config=None, env={}, do_clean=False, build_options="") for x in output: s = str(x) if s.find("Error") != -1: - # if x.find('Error') != -1: success = False # if re.match('xmake: \*\*\* .* Stop.', x) != None: if re.match(r"xmake: \*\*\* .* Stop.", s) != None: diff --git a/tests/README.txt b/tests/README.rst similarity index 73% rename from tests/README.txt rename to tests/README.rst index cd5b8f2f..969a35b6 100644 --- a/tests/README.txt +++ b/tests/README.rst @@ -1,10 +1,12 @@ +Lib_xud Tests +============= + Installation and prerequiste for running pytest -python3 pip install pytest To run all tests, simply type: pytest -s To run specific test, type: -pytest test_xx_xx.py +pytest .py diff --git a/tests/shared_src/shared.h b/tests/shared_src/shared.h index 793ac1b2..846b811a 100644 --- a/tests/shared_src/shared.h +++ b/tests/shared_src/shared.h @@ -74,7 +74,7 @@ void TerminatePass(unsigned x) #endif #ifndef TEST_EP_NUM -#warning TEST_EP_NUM not defined +#warning TEST_EP_NUM not defined, using default value #define TEST_EP_NUM (1) #endif diff --git a/tests/shared_src/test_main.xc b/tests/shared_src/test_main.xc index 96f6e7f5..1886bc66 100644 --- a/tests/shared_src/test_main.xc +++ b/tests/shared_src/test_main.xc @@ -23,17 +23,16 @@ int main() speed, XUD_PWR_BUS); } - { - unsigned fail = test_func(c_ep_out, c_ep_in); + { + unsigned fail = test_func(c_ep_out, c_ep_in); #ifdef XUD_SIM_RTL /* Note, this test relies on checking at the host side */ if(fail) TerminateFail(fail); else - TerminatePass(fail); + TerminatePass(fail); #endif - unsafe{ unsigned * unsafe p = &g_dummyThreadCount; *p = 0; @@ -41,10 +40,9 @@ int main() if(TEST_EP_NUM != 0) { XUD_ep ep_out_0 = XUD_InitEp(c_ep_out[0]); - XUD_Kill(ep_out_0); - } + XUD_Kill(ep_out_0); + } exit(0); - } dummyThreads(); } diff --git a/tests/shared_src/test_xs2.xn b/tests/shared_src/test_xs2.xn index a416f1db..fb2bd70a 100644 --- a/tests/shared_src/test_xs2.xn +++ b/tests/shared_src/test_xs2.xn @@ -27,9 +27,6 @@ - - - @@ -59,7 +56,7 @@ - + diff --git a/tests/test_bulk_loopback/LICENSE.rst b/tests/test_bulk_loopback/LICENSE.rst deleted file mode 100644 index ca48f20f..00000000 --- a/tests/test_bulk_loopback/LICENSE.rst +++ /dev/null @@ -1,84 +0,0 @@ -******************************* -XMOS PUBLIC LICENCE: Version 1 -******************************* - -Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. - -**1. Definitions** - -**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. - -**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. - -**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. - -**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. - -**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. - -**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. - -This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. - - -**2. Licence** - -**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: - -2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: - -2.1.1 for personal or academic, non-commercial purposes; or - -2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): - -(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and - -(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). - -The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. - -2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: - -2.2.1 for personal or academic, non-commercial purposes; or - -2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): - -(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; - -(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and - -(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. - -Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. - -2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. - -**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. - -**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. - -**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. - -**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. - -**7. IPR and Ownership** -Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** - -Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). -Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. - -**8. Termination** - -8.1 This Licence will automatically terminate immediately, without notice to you, if: - -(a) you fail to comply with the terms of this Licence; and/or - -(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or - -(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. - -**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. - -**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. - -**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_bulk_rx_multiep/src/main.xc b/tests/test_bulk_rx_multiep/src/main.xc index 59f1ce81..4e604acc 100644 --- a/tests/test_bulk_rx_multiep/src/main.xc +++ b/tests/test_bulk_rx_multiep/src/main.xc @@ -10,15 +10,15 @@ /* Check for clashes with TEST_EP and traffic EP */ #if TEST_EP_NUM == 4 -#error +#error TEST_EP_NUM clashes with traffic EP #endif #if TEST_EP_NUM == 5 -#error +#error TEST_EP_NUM clashes with traffic EP #endif #if TEST_EP_NUM == 6 -#error +#error TEST_EP_NUM clashes with traffic EP #endif /* Endpoint type tables */ diff --git a/tests/test_bulk_tx_noack.py b/tests/test_bulk_tx_noack.py deleted file mode 100644 index 3c265a73..00000000 --- a/tests/test_bulk_tx_noack.py +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright 2016-2021 XMOS LIMITED. -# This Software is subject to the terms of the XMOS Public Licence: Version 1. -from usb_packet import USB_PID, TokenPacket, RxDataPacket -from usb_session import UsbSession -from usb_transaction import UsbTransaction -import pytest -from conftest import PARAMS, test_RunUsbSession - - -@pytest.fixture -def test_session(ep, address, bus_speed): - - # Note, quite big gap to allow checking - ied = 4000 - - session = UsbSession( - bus_speed=bus_speed, run_enumeration=False, device_address=address - ) - - for pktLength in range(10, 14): - - if pktLength == 12: - session.add_event( - TokenPacket( - pid=USB_PID["IN"], - address=address, - endpoint=ep, - interEventDelay=ied, - ) - ) - session.add_event( - RxDataPacket( - dataPayload=session.getPayload_in(ep, pktLength, resend=True) - ) - ) - # Missing ACK - simulate CRC fail at host - - session.add_event( - UsbTransaction( - session, - deviceAddress=address, - endpointNumber=ep, - endpointType="BULK", - direction="IN", - dataLength=pktLength, - interEventDelay=ied, - ) - ) - - return session diff --git a/tests/test_bulk_tx_noack/LICENSE.rst b/tests/test_bulk_tx_noack/LICENSE.rst deleted file mode 100644 index ca48f20f..00000000 --- a/tests/test_bulk_tx_noack/LICENSE.rst +++ /dev/null @@ -1,84 +0,0 @@ -******************************* -XMOS PUBLIC LICENCE: Version 1 -******************************* - -Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. - -**1. Definitions** - -**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. - -**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. - -**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. - -**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. - -**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. - -**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. - -This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. - - -**2. Licence** - -**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: - -2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: - -2.1.1 for personal or academic, non-commercial purposes; or - -2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): - -(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and - -(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). - -The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. - -2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: - -2.2.1 for personal or academic, non-commercial purposes; or - -2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): - -(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; - -(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and - -(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. - -Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. - -2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. - -**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. - -**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. - -**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. - -**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. - -**7. IPR and Ownership** -Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** - -Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). -Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. - -**8. Termination** - -8.1 This Licence will automatically terminate immediately, without notice to you, if: - -(a) you fail to comply with the terms of this Licence; and/or - -(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or - -(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. - -**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. - -**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. - -**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_bulk_tx_noack/Makefile b/tests/test_bulk_tx_noack/Makefile deleted file mode 100644 index a2c9ee98..00000000 --- a/tests/test_bulk_tx_noack/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -TEST_FLAGS = -DXUD_BYPASS_RESET=1 - -include ../test_makefile.mak diff --git a/tests/test_bulk_tx_noack/src/main.xc b/tests/test_bulk_tx_noack/src/main.xc deleted file mode 100644 index 02bb9d72..00000000 --- a/tests/test_bulk_tx_noack/src/main.xc +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2016-2021 XMOS LIMITED. -// This Software is subject to the terms of the XMOS Public Licence: Version 1. -#include "shared.h" - -#ifndef PKT_LENGTH_START -#define PKT_LENGTH_START (10) -#endif - -#ifndef PKT_LENGTH_END -#define PKT_LENGTH_END (13) -#endif - -#define EP_COUNT_OUT (6) -#define EP_COUNT_IN (6) - -/* Endpoint type tables */ -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}; - -#ifdef XUD_SIM_RTL -int testmain() -#else -int main() -#endif -{ - chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; - - par - { - { -#if defined(XUD_TEST_SPEED_FS) - unsigned speed = XUD_SPEED_FS; -#elif defined(XUD_TEST_SPEED_HS) - unsigned speed = XUD_SPEED_HS; -#endif - XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, - speed, XUD_PWR_BUS); - } - - { - unsigned fail = TestEp_Tx(c_ep_in[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_DIE); - -#ifdef XUD_SIM_RTL - /* Note, this test relies on checking at the host side */ - - if(fail) - TerminateFail(fail); - else - TerminatePass(fail); -#endif - - XUD_ep ep_out_0 = XUD_InitEp(c_ep_out[0]); - XUD_Kill(ep_out_0); - exit(0); - } - } - - return 0; -} diff --git a/tests/test_invalidtoken/src/main.xc b/tests/test_invalidtoken/src/main.xc index e7f09355..8c3dd36c 100644 --- a/tests/test_invalidtoken/src/main.xc +++ b/tests/test_invalidtoken/src/main.xc @@ -10,7 +10,6 @@ #define EP_COUNT_OUT (6) #define EP_COUNT_IN (6) - XUD_EpType epTypeTableOut[EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL, @@ -18,11 +17,11 @@ XUD_EpType epTypeTableOut[EP_COUNT_OUT] = {XUD_EPTYPE_CTL, 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 epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, + XUD_EPTYPE_BUL, + XUD_EPTYPE_BUL, + XUD_EPTYPE_BUL, + XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; void Endpoint0( chanend c_ep0_out, chanend c_ep0_in, chanend ?c_usb_test); @@ -39,11 +38,11 @@ unsigned fail(int x) switch(x) { case FAIL_RX_DATAERROR: - printstr("XCORE RX Data Error\n"); + printstr("XCORE RX Data Error\n"); break; case FAIL_RX_LENERROR: - printstr("XCORE RX Length Error\n"); + printstr("XCORE RX Length Error\n"); break; } diff --git a/tests/test_makefile.mak b/tests/test_makefile.mak index 2e55723d..560f842f 100644 --- a/tests/test_makefile.mak +++ b/tests/test_makefile.mak @@ -29,9 +29,6 @@ COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -X -DXUD_TEST_SPEED_HS=1 \ $(CFLAGS) -#TODO RM ARCH_L define -#XCC_FLAGS_xs2 = $(TEST_FLAGS) $(COMMON_FLAGS) -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -DARCH_L - XCC_FLAGS_xs3_600 = $(TEST_FLAGS) $(COMMON_FLAGS) XCC_FLAGS_xs3_800 = $(TEST_FLAGS) $(COMMON_FLAGS) From 1b07787340ce8268b6b397ec881c9b573f79373b Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 1 Jul 2021 18:54:56 +0100 Subject: [PATCH 443/520] Small fixes after review for #38 --- lib_xud/src/core/XUD_DeviceAttach.xc | 3 +-- lib_xud/src/core/included/XUD_Token_SOF.S | 11 +++++------ lib_xud/src/user/client/XUD_SetDevAddr.xc | 2 +- tests/Pyxsim/pyxsim.py | 2 +- tests/test_sof_basic.py | 1 - 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/lib_xud/src/core/XUD_DeviceAttach.xc b/lib_xud/src/core/XUD_DeviceAttach.xc index 3648eb67..c9da944e 100755 --- a/lib_xud/src/core/XUD_DeviceAttach.xc +++ b/lib_xud/src/core/XUD_DeviceAttach.xc @@ -6,7 +6,6 @@ #include "xud.h" #include "XUD_USB_Defines.h" #include "XUD_TimingDefines.h" -//#include "XUD_Support.h" #include "XUD_HAL.h" extern in port flag0_port; @@ -106,7 +105,7 @@ int XUD_DeviceAttachHS(XUD_PwrConfig pwrConfig) break; #ifdef __XS3A__ -// Note, J and K definitons are reversed in XS3A +// Note, J and K definitions are reversed in XS3A #define j_port flag1_port #define k_port flag0_port #else diff --git a/lib_xud/src/core/included/XUD_Token_SOF.S b/lib_xud/src/core/included/XUD_Token_SOF.S index 119ebe51..e708d04d 100644 --- a/lib_xud/src/core/included/XUD_Token_SOF.S +++ b/lib_xud/src/core/included/XUD_Token_SOF.S @@ -10,7 +10,7 @@ Pid_Sof: shr r10, r10, 24; // Shift off junk in r11, res[r1]; - bt r11, XUD_InvalidToken; // If VALID_TOKEN not high, ignore token + bt r11, XUD_InvalidToken; // If VALID_TOKEN not high, ignore token #else // NOTE: we are not CRC checking SOF's @@ -18,7 +18,7 @@ Pid_Sof: shr r10 , r10, 16 // Shift off port junk ldc r11, 0x7ff // Remove CRC5 and r10, r10, r11 - + #endif clrsr 0x3 ldw r11, sp[STACK_SOFCHAN] @@ -36,7 +36,7 @@ Pid_Sof: setc res[r10], XS1_SETC_COND_AFTER // Re-enable thread interrupts setsr 0x3 - bu Loop_BadPid + bu Loop_BadPid // Received SOF token: Reset suspend/reset detection timer .align FUNCTION_ALIGNMENT @@ -49,11 +49,10 @@ Pid_Sof_NoChan: bt r11, XUD_InvalidToken; /* If VALID_TOKEN not high, ignore token */ #else -//#include "XUD_G_Crc.S" in r10, res[RXD] // Input Frame number #endif clrsr 0x3 - ldw r10, sp[STACK_SUSPEND_TIMER] // Load timer from stack + ldw r10, sp[STACK_SUSPEND_TIMER] // Load timer from stack setc res[r10], XS1_SETC_COND_NONE // Read current time ldw r8, sp[STACK_SUSPEND_TIMEOUT] in r11, res[r10] @@ -62,7 +61,7 @@ Pid_Sof_NoChan: ldw r8, sp[STACK_SUSPEND_TIMEOUT] setc res[r10], XS1_SETC_COND_AFTER // Re-enable thread interrupts setsr 0x3 - bu Loop_BadPid + bu Loop_BadPid diff --git a/lib_xud/src/user/client/XUD_SetDevAddr.xc b/lib_xud/src/user/client/XUD_SetDevAddr.xc index 1c412c2b..7c4605c8 100644 --- a/lib_xud/src/user/client/XUD_SetDevAddr.xc +++ b/lib_xud/src/user/client/XUD_SetDevAddr.xc @@ -12,7 +12,7 @@ void XUD_SetCrcTableAddr(unsigned addr); XUD_Result_t XUD_SetDevAddr(unsigned addr) { #ifdef __XS3A__ - /* XS1A (XS1-G) and XS3: Modify CRC table for current address */ + /* XS3: Modify CRC table for current address */ XUD_SetCrcTableAddr(addr); #else /* Set device address in UIFM */ diff --git a/tests/Pyxsim/pyxsim.py b/tests/Pyxsim/pyxsim.py index 6972a3c4..e8a15a40 100644 --- a/tests/Pyxsim/pyxsim.py +++ b/tests/Pyxsim/pyxsim.py @@ -284,7 +284,7 @@ def get_time(self): def run(self): self.xe = Xe(self.xe_path) - self._time_step = float(pow(10, 3)) / self.xe.freq + self._time_step = 1000.0 / self.xe.freq status = XsiStatus.OK for simthread in self._simthreads: simthread.start() diff --git a/tests/test_sof_basic.py b/tests/test_sof_basic.py index bbe6ee87..e2f2edae 100644 --- a/tests/test_sof_basic.py +++ b/tests/test_sof_basic.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # Copyright 2019-2021 XMOS LIMITED. # This Software is subject to the terms of the XMOS Public Licence: Version 1. from usb_session import UsbSession From b8ec0c898a74353f9d1f7b457af38be2a73d0ecb Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 1 Jul 2021 19:06:15 +0100 Subject: [PATCH 444/520] Remove tabs --- lib_xud/src/core/XUD_Main.xc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index 4e0c1da2..e2db3206 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -241,11 +241,11 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c #ifdef __XS3A__ set_pad_delay(flag1_port, 3); #else - set_pad_delay(flag1_port, 2); + set_pad_delay(flag1_port, 2); #endif start_clock(tx_usb_clk); - start_clock(rx_usb_clk); + start_clock(rx_usb_clk); configure_out_port_handshake(p_usb_txd, tx_readyin, tx_readyout, tx_usb_clk, 0); configure_in_port_strobed_slave(p_usb_rxd, rx_rdy, rx_usb_clk); @@ -419,7 +419,7 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c noExit = XUD_LLD_IoLoop(p_usb_rxd, flag1_port, p_usb_txd, flag0_port, flag2_port, epTypeTableOut, epTypeTableIn, epChans, noEpOut, c_sof); set_thread_fast_mode_off(); - + if(!noExit) break; } From f0a3e8867802d752a2020c3669ea831335e08338 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 1 Jul 2021 19:07:42 +0100 Subject: [PATCH 445/520] Removed tabs --- lib_xud/src/core/XUD_TestMode.xc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_xud/src/core/XUD_TestMode.xc b/lib_xud/src/core/XUD_TestMode.xc index a380f69a..9d4a79aa 100644 --- a/lib_xud/src/core/XUD_TestMode.xc +++ b/lib_xud/src/core/XUD_TestMode.xc @@ -55,16 +55,16 @@ int XUD_UsbTestModeHandler(unsigned cmd) break; case USB_WINDEX_TEST_SE0_NAK: - - XUD_HAL_EnterMode_PeripheralHighSpeed(); + + XUD_HAL_EnterMode_PeripheralHighSpeed(); - /* Drop into asm to deal with this mode */ + /* Drop into asm to deal with this mode */ XUD_UsbTestSE0(); break; case USB_WINDEX_TEST_PACKET: { - XUD_HAL_EnterMode_PeripheralHighSpeed(); + XUD_HAL_EnterMode_PeripheralHighSpeed(); // Repetitively transmit specific test packet forever. // Timings must still meet minimum interpacket gap From af57232dd6ec9236de3eb665eb2ce4887b759650 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 1 Jul 2021 19:32:05 +0100 Subject: [PATCH 446/520] Removed skip 0 --- lib_xud/src/core/XUD_CRC5_Table.S | 1 - lib_xud/src/core/XUD_CRC5_Table_Addr.S | 1 - 2 files changed, 2 deletions(-) diff --git a/lib_xud/src/core/XUD_CRC5_Table.S b/lib_xud/src/core/XUD_CRC5_Table.S index c8e941e3..57d18dc5 100755 --- a/lib_xud/src/core/XUD_CRC5_Table.S +++ b/lib_xud/src/core/XUD_CRC5_Table.S @@ -10,7 +10,6 @@ .type crc5Table, @object .cc_top crc5Table.func, crc5Table .align 4 -.skip 0 crc5Table: .byte 0x2 .byte 0x1d diff --git a/lib_xud/src/core/XUD_CRC5_Table_Addr.S b/lib_xud/src/core/XUD_CRC5_Table_Addr.S index eec473b3..43390e3a 100755 --- a/lib_xud/src/core/XUD_CRC5_Table_Addr.S +++ b/lib_xud/src/core/XUD_CRC5_Table_Addr.S @@ -10,7 +10,6 @@ .type crc5Table_Addr, @object .cc_top crc5Table_Addr.func, crc5Table_Addr .align 4 -.skip 0 crc5Table_Addr: .byte 0x2 .byte 0x1d From cb596bc5a23daeb1401378ef74f51abddf797bbf Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 1 Jul 2021 20:24:45 +0100 Subject: [PATCH 447/520] Revert changes to fix #58 --- lib_xud/src/core/included/XUD_Token_In_DI.S | 158 +++++++++----------- 1 file changed, 73 insertions(+), 85 deletions(-) mode change 100755 => 100644 lib_xud/src/core/included/XUD_Token_In_DI.S diff --git a/lib_xud/src/core/included/XUD_Token_In_DI.S b/lib_xud/src/core/included/XUD_Token_In_DI.S old mode 100755 new mode 100644 index 9b558de3..9ab398c5 --- a/lib_xud/src/core/included/XUD_Token_In_DI.S +++ b/lib_xud/src/core/included/XUD_Token_In_DI.S @@ -23,42 +23,33 @@ // R1 : Valid Token Port // R0 : RXD .align FUNCTION_ALIGNMENT -Pid_In: - #include "XUD_CrcAddrCheck.S" - ldaw r3, r10[4] // R3 = R10 + 16 - ldw r4, r5[r3] // Load EP structure address into R4 - - - ldw r11, sp[STACK_EPTYPES_IN] - ldw r11, r11[r10] // Load EP Type into R11 - bt r11, In_NonIso // If the type is non-zero then it is not isochronous - bt r4, In_LoadPid // If the EP structure address is not 0, and the - // EP type is iso, then we are ready to send. - ldc r11, 0xc3 // Otherwise, create 0-length packet - outpw res[TXD], r11, 24 +InNotReady: + ldw r11, sp[STACK_EPTYPES_IN] + ldw r11, r11[r10] // Load EP Type + bt r11, XUD_IN_TxNak + ldc r11, 0xc3 // Create 0-length packet + outpw res[TXD], r11, 24 #include "XUD_TokenJmp.S" -In_NonIso: +XUD_IN_TxNak: // Non-Iso ldaw r11, dp[handshakeTable_IN] // Load handshake table - ldw r11, r11[r10] // Load handshake PID into R11 - {bf r4, In_TxHandshake // If the EP structure address is 0, and the EP type - // is not iso, then send the PID from the handshake table. - ldc r8, USB_PIDn_STALL} // If the EP is ready, then compare the STALL PID - eq r8, r11, r8 // with the PID in the handshake table. - bf r8, In_LoadPid // If it's not a STALL, then we are ready to send. - // Otherwise, send the PID from the handshake table. -In_TxHandshake: + ldw r11, r11[r10] // Load handshake PID outpw res[TXD], r11, 8 #include "XUD_TokenJmp.S" +.align FUNCTION_ALIGNMENT +Pid_In: + #include "XUD_CrcAddrCheck.S" + ldaw r3, r10[4] // R3 = R10 + 16 + ldw r4, r5[r3] // Load EP structure address + bf r4, InNotReady // If 0 then not ready... + In_LoadPid: ldw r11, r4[4] // Load PID from structure InReady: ldw r8, r4[3] // Load buffer - ldw r6, r4[7] // Load tail length (bytes) - ldw r4, r4[6] // Load buffer index bf r4, SmallTxPacket // Check for Short packet @@ -97,44 +88,44 @@ DoneTail: bu DoneTx SetupReceiveHandShake: - ldc r11, 8 - setpsc res[RXD], r11 // Set port shift count (expect 8 bit handshake) - eeu res[RXD] // Events on RXD always enabled - Can;t be any more due to using events on channels + ldc r11, 8 + setpsc res[RXD], r11 // Set port shift count (expect 8 bit handshake) + eeu res[RXD] // Events on RXD always enabled - Can't be any more due to using events on channels -SetupTimeout: // Timeout done using another port we dont happen to already be using events on. Cunning. +SetupTimeout: // Timeout done using another port we don't happen to already be using events on. Cunning. #ifdef __XS2A__ - ldw r1, sp[STACK_VTOK_PORT] // Load saved ValidToken port. Event vector already set. + ldw r1, sp[STACK_VTOK_PORT] // Load saved ValidToken port. Event vector already set. #else - ldw r1, dp[rx_rdy] // TODO load from stack + ldw r1, dp[rx_rdy] // TODO load from stack #endif - in r11, res[r1] // Do input and get port time/timestamps - getts r11, res[r1] - ldw r9, dp[g_txHandshakeTimeout] - add r11, r11, r9 - setpt res[r1], r11 // Set port time and enable events - eeu res[r1] - -WaitForHandshake: // Wait for timeout or handshake - .xtabranch TxHandshakeTimeOut, TxHandShakeReceived + in r11, res[r1] // Do input and get port time/timestamps + getts r11, res[r1] + ldw r9, dp[g_txHandshakeTimeout] + add r11, r11, r9 + setpt res[r1], r11 // Set port time and enable events + eeu res[r1] + +WaitForHandshake: // Wait for timeout or handshake waiteu // We sent some data but the host didn't handshake in time. Needs a re-send. .align FUNCTION_ALIGNMENT TxHandshakeTimeOut: - in r11, res[r1] // This will clear port time - edu res[r1] - {edu res[RXD]; bu BadHandshake} + in r11, res[r1] // This will clear port time + + edu res[r1] + {edu res[RXD]; bu BadHandshake} // Transmitted data, and got something back within the timeout. Check for valid handshake... .align FUNCTION_ALIGNMENT TxHandShakeReceived: XUD_IN_RxAck: - in r11, res[RXD] // Input data from RXD port - clrpt res[r1] // Clear port time on valid token port + in r11, res[RXD] // Input data from RXD port + clrpt res[r1] // Clear port time on valid token port - {edu res[RXD]; shr r11, r11, 24} // Shift off junk data to leave ACK + {edu res[RXD]; shr r11, r11, 24} // Shift off junk data to leave ACK #if defined(__XS2A__) - ldc r9, USB_PID_ACK // Check for good ACK (L series strips of negated bits from PID) + ldc r9, USB_PID_ACK // Check for good ACK (L series strips of negated bits from PID) #else ldc r9, USB_PIDn_ACK #endif @@ -147,71 +138,69 @@ XUD_IN_RxAck: DoneTx: -ClearInEpReady: // TODO Tidy this up - ldc r9, 0 // TODO - ldw r10, r5[r3] // Load the EP struct - stw r9, r5[r3] // Clear the ready - ldw r11, r10[1] // Load channel - out res[r11], r11 // Output word to signal packet sent okay - bu NextToken +ClearInEpReady: // TODO Tidy this up + ldc r9, 0 // TODO + ldw r10, r5[r3] // Load the EP struct + stw r9, r5[r3] // Clear the ready + ldw r11, r10[1] // Load channel + out res[r11], r11 // Output word to signal packet sent okay + bu NextToken BadHandshake: - bu NextToken + bu NextToken .align 64 .skip 56 SmallTxPacket: - ldw r8, r8[r4] // Load first data word - bru r6 // branch taillength + ldw r8, r8[r4] // Load first data word + bru r6 // branch taillength -//-------------------------------------------------------------------------- .align 32 .skip 0 -TxTail0s: // We know this is a < 4 byte packet, so is 0 length packet - // So crc = 0. Note our normal crc calculation works for this, it is - // Not a special CRC case, but helps with timing. - ldc r8, 0 +TxTail0s: // We know this is a < 4 byte packet, so is 0 length packet + // So crc = 0. Note our normal crc calculation works for this, it is + // Not a special CRC case, but helps with timing. XUD_IN_TxPid_TailS0: - outpw res[TXD], r11, 8 // PID + outpw res[TXD], r11, 8 // PID XUD_IN_TxCrc_TailS0: - outpw res[TXD], r8, 16 // Output CRC + outpw res[TXD], r4, 16 // Output CRC (r4: 0) bu DoneTail .align 32 .skip 0 -TxTail1s: // One tail byte - shl r6, r8, 8 // Concat PID and Data - or r11, r11, r6 - crc8 r7, r8, r8, r9 - crc32 r7, r4, r9 // r4: 0 - not r7, r7 +TxTail1s: // One tail byte + shl r6, r8, 8 // Concat PID and Data + or r11, r11, r6 + crc8 r7, r8, r8, r9 + crc32 r7, r4, r9 // r4: 0 + not r7, r7 XUD_IN_TxPid_TailS1: - outpw res[TXD], r11, 16 // PID + outpw res[TXD], r11, 16 // PID XUD_IN_TxCrc_TailS1: - outpw res[TXD], r7, 16 - bu DoneTail + outpw res[TXD], r7, 16 + bu DoneTail .align 32 .skip 0 -TxTail2s: // Two tail byte - crcn r7, r8, r9, r6 +TxTail2s: // Two tail byte + crcn r7, r8, r9, r6 shl r6, r8, 8 - crc32 r7, r4, r9 // r4: 0 + crc32 r7, r4, r9 // r4: 0 {not r7, r7; or r11, r11, r6} XUD_IN_TxPid_TailS2: - outpw res[TXD], r11, 24 // Output PID and 2 bytes of data + outpw res[TXD], r11, 24 // Output PID and 2 bytes of data XUD_IN_TxCrc_TailS2: - outpw res[TXD], r7, 16 // Output CRC16 + outpw res[TXD], r7, 16 // Output CRC16 bu DoneTail .align 32 .skip 0 -TxTail3s: // Three tail byte +TxTail3s: // Three tail byte XUD_IN_TxPid_TailS3: - outpw res[TXD], r11, 8 // PID + outpw res[TXD], r11, 8 // PID outpw res[TXD], r8, 24 crcn r7, r8, r9, r6 - crc32 r7, r4, r9 // r4: 0 + crc32 r7, r4, r9 // r4: 0 not r7, r7 XUD_IN_TxCrc_TailS3: outpw res[TXD], r7, 16 @@ -219,14 +208,13 @@ XUD_IN_TxCrc_TailS3: .align 32 .skip 0 -TxTail4s: // Four tail byte +TxTail4s: // Four tail byte XUD_IN_TxPid_TailS4: - outpw res[TXD], r11, 8 // PID + outpw res[TXD], r11, 8 // PID out res[TXD], r8 - crc32 r7, r8, r9 - crc32 r7, r4, r9 // r4: 0 + crc32 r7, r8, r9 + crc32 r7, r4, r9 // r4: 0 not r7, r7 XUD_IN_TxCrc_TailS4: outpw res[TXD], r7, 16 bu DoneTail - From cba5117ce5d5bdf35b1496b1e3812610eef9b1bc Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 1 Jul 2021 21:20:43 +0100 Subject: [PATCH 448/520] Tidy up white space in XUD_Token_In_DI.S. Shave inst from 0 byte packet. --- lib_xud/src/core/included/XUD_Token_In_DI.S | 110 +++++++++++--------- 1 file changed, 60 insertions(+), 50 deletions(-) mode change 100644 => 100755 lib_xud/src/core/included/XUD_Token_In_DI.S diff --git a/lib_xud/src/core/included/XUD_Token_In_DI.S b/lib_xud/src/core/included/XUD_Token_In_DI.S old mode 100644 new mode 100755 index 9ab398c5..87798bc0 --- a/lib_xud/src/core/included/XUD_Token_In_DI.S +++ b/lib_xud/src/core/included/XUD_Token_In_DI.S @@ -8,7 +8,7 @@ #define RXA r1 #define TXD r2 -//.text +.text // On entry: // R11: Branch address (now free) // R10: EP number (used here) @@ -23,35 +23,42 @@ // R1 : Valid Token Port // R0 : RXD .align FUNCTION_ALIGNMENT -InNotReady: - ldw r11, sp[STACK_EPTYPES_IN] - ldw r11, r11[r10] // Load EP Type - bt r11, XUD_IN_TxNak - ldc r11, 0xc3 // Create 0-length packet - outpw res[TXD], r11, 24 +Pid_In: + #include "XUD_CrcAddrCheck.S" + ldaw r3, r10[4] // R3 = R10 + 16 + ldw r4, r5[r3] // Load EP structure address into R4 + + + ldw r11, sp[STACK_EPTYPES_IN] + ldw r11, r11[r10] // Load EP Type into R11 + bt r11, In_NonIso // If the type is non-zero then it is not isochronous + bt r4, In_LoadPid // If the EP structure address is not 0, and the + // EP type is iso, then we are ready to send. + ldc r11, 0xc3 // Otherwise, create 0-length packet + outpw res[TXD], r11, 24 #include "XUD_TokenJmp.S" -XUD_IN_TxNak: // Non-Iso +In_NonIso: ldaw r11, dp[handshakeTable_IN] // Load handshake table - ldw r11, r11[r10] // Load handshake PID + ldw r11, r11[r10] // Load handshake PID into R11 + {bf r4, In_TxHandshake // If the EP structure address is 0, and the EP type + // is not iso, then send the PID fro:setm the handshake table. + ldc r8, USB_PIDn_STALL} // If the EP is ready, then compare the STALL PID + eq r8, r11, r8 // with the PID in the handshake table. + bf r8, In_LoadPid // If it's not a STALL, then we are ready to send. + // Otherwise, send the PID from the handshake table. +In_TxHandshake: outpw res[TXD], r11, 8 #include "XUD_TokenJmp.S" -.align FUNCTION_ALIGNMENT -Pid_In: - #include "XUD_CrcAddrCheck.S" - ldaw r3, r10[4] // R3 = R10 + 16 - ldw r4, r5[r3] // Load EP structure address - bf r4, InNotReady // If 0 then not ready... - In_LoadPid: ldw r11, r4[4] // Load PID from structure InReady: ldw r8, r4[3] // Load buffer ldw r6, r4[7] // Load tail length (bytes) - ldw r4, r4[6] // Load buffer index - bf r4, SmallTxPacket // Check for Short packet + ldw r4, r4[6] // Load data length + bf r4, SmallTxPacket // Check for "short" packet XUD_IN_Tx: outpw res[TXD], r11, 8 // Out PID @@ -90,9 +97,9 @@ DoneTail: SetupReceiveHandShake: ldc r11, 8 setpsc res[RXD], r11 // Set port shift count (expect 8 bit handshake) - eeu res[RXD] // Events on RXD always enabled - Can't be any more due to using events on channels + eeu res[RXD] // Events on RXD always enabled - Can;t be any more due to using events on channels -SetupTimeout: // Timeout done using another port we don't happen to already be using events on. Cunning. +SetupTimeout: // Timeout done using another port we dont happen to already be using events on. Cunning. #ifdef __XS2A__ ldw r1, sp[STACK_VTOK_PORT] // Load saved ValidToken port. Event vector already set. #else @@ -108,32 +115,33 @@ SetupTimeout: // Timeout done using another WaitForHandshake: // Wait for timeout or handshake waiteu + // We sent some data but the host didn't handshake in time. Needs a re-send. .align FUNCTION_ALIGNMENT TxHandshakeTimeOut: in r11, res[r1] // This will clear port time - edu res[r1] {edu res[RXD]; bu BadHandshake} + // Transmitted data, and got something back within the timeout. Check for valid handshake... .align FUNCTION_ALIGNMENT TxHandShakeReceived: XUD_IN_RxAck: in r11, res[RXD] // Input data from RXD port - clrpt res[r1] // Clear port time on valid token port + clrpt res[r1] // Clear port time on valid token port {edu res[RXD]; shr r11, r11, 24} // Shift off junk data to leave ACK #if defined(__XS2A__) - ldc r9, USB_PID_ACK // Check for good ACK (L series strips of negated bits from PID) + ldc r9, USB_PID_ACK // Check for good ACK (L series strips of negated bits from PID) #else - ldc r9, USB_PIDn_ACK + ldc r9, USB_PIDn_ACK #endif - xor r9, r11, r9 + xor r9, r11, r9 #ifdef __XS2A__ {edu res[r1]; bt r9, BadHandshake} // Disable events on ValidToken port #else - {bt r9, BadHandshake} + {bt r9, BadHandshake} #endif DoneTx: @@ -147,60 +155,61 @@ ClearInEpReady: // TODO Tidy this up bu NextToken BadHandshake: - bu NextToken + bu NextToken .align 64 .skip 56 SmallTxPacket: - ldw r8, r8[r4] // Load first data word - bru r6 // branch taillength + ldw r8, r8[r4] // Load first data word + bru r6 // branch taillength +//-------------------------------------------------------------------------- .align 32 .skip 0 -TxTail0s: // We know this is a < 4 byte packet, so is 0 length packet - // So crc = 0. Note our normal crc calculation works for this, it is - // Not a special CRC case, but helps with timing. +TxTail0s: // We know this is a < 4 byte packet, so is 0 length packet + // So crc = 0. Note our normal crc calculation works for this, it is + // Not a special CRC case, but helps with timing. XUD_IN_TxPid_TailS0: - outpw res[TXD], r11, 8 // PID + outpw res[TXD], r11, 8 // PID XUD_IN_TxCrc_TailS0: - outpw res[TXD], r4, 16 // Output CRC (r4: 0) + outpw res[TXD], r4, 16 // Output CRC (R4: 0) bu DoneTail .align 32 .skip 0 -TxTail1s: // One tail byte - shl r6, r8, 8 // Concat PID and Data +TxTail1s: // One tail byte + shl r6, r8, 8 // Concat PID and Data or r11, r11, r6 crc8 r7, r8, r8, r9 - crc32 r7, r4, r9 // r4: 0 + crc32 r7, r4, r9 // r4: 0 not r7, r7 XUD_IN_TxPid_TailS1: - outpw res[TXD], r11, 16 // PID + outpw res[TXD], r11, 16 // PID XUD_IN_TxCrc_TailS1: outpw res[TXD], r7, 16 bu DoneTail .align 32 .skip 0 -TxTail2s: // Two tail byte - crcn r7, r8, r9, r6 +TxTail2s: // Two tail byte + crcn r7, r8, r9, r6 shl r6, r8, 8 - crc32 r7, r4, r9 // r4: 0 + crc32 r7, r4, r9 // r4: 0 {not r7, r7; or r11, r11, r6} XUD_IN_TxPid_TailS2: - outpw res[TXD], r11, 24 // Output PID and 2 bytes of data + outpw res[TXD], r11, 24 // Output PID and 2 bytes of data XUD_IN_TxCrc_TailS2: - outpw res[TXD], r7, 16 // Output CRC16 + outpw res[TXD], r7, 16 // Output CRC16 bu DoneTail .align 32 .skip 0 -TxTail3s: // Three tail byte +TxTail3s: // Three tail byte XUD_IN_TxPid_TailS3: - outpw res[TXD], r11, 8 // PID + outpw res[TXD], r11, 8 // PID outpw res[TXD], r8, 24 crcn r7, r8, r9, r6 - crc32 r7, r4, r9 // r4: 0 + crc32 r7, r4, r9 // r4: 0 not r7, r7 XUD_IN_TxCrc_TailS3: outpw res[TXD], r7, 16 @@ -208,13 +217,14 @@ XUD_IN_TxCrc_TailS3: .align 32 .skip 0 -TxTail4s: // Four tail byte +TxTail4s: // Four tail byte XUD_IN_TxPid_TailS4: - outpw res[TXD], r11, 8 // PID + outpw res[TXD], r11, 8 // PID out res[TXD], r8 - crc32 r7, r8, r9 - crc32 r7, r4, r9 // r4: 0 + crc32 r7, r8, r9 + crc32 r7, r4, r9 // r4: 0 not r7, r7 XUD_IN_TxCrc_TailS4: outpw res[TXD], r7, 16 bu DoneTail + From aeb966b015301c50ccd05b69602c45bc7c20d506 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 1 Jul 2021 23:41:44 +0100 Subject: [PATCH 449/520] Remove old file --- tests/test_bulk_rx_basic/src/xc_ptr.h | 48 --------------------------- 1 file changed, 48 deletions(-) delete mode 100644 tests/test_bulk_rx_basic/src/xc_ptr.h diff --git a/tests/test_bulk_rx_basic/src/xc_ptr.h b/tests/test_bulk_rx_basic/src/xc_ptr.h deleted file mode 100644 index 8fa5a04e..00000000 --- a/tests/test_bulk_rx_basic/src/xc_ptr.h +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2016-2021 XMOS LIMITED. -// This Software is subject to the terms of the XMOS Public Licence: Version 1. -#ifndef __xc_ptr__ -#define __xc_ptr__ - -typedef unsigned int xc_ptr; - -// Note that this function is marked as const to avoid the XC -// parallel usage checks, this is only really going to work if this -// is the *only* way the array a is accessed (and everything else uses -// the xc_ptr) -inline xc_ptr array_to_xc_ptr(const unsigned a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -inline xc_ptr char_array_to_xc_ptr(const unsigned char a[]) -{ - xc_ptr x; - asm("mov %0, %1":"=r"(x):"r"(a)); - return x; -} - -#define write_via_xc_ptr_indexed(p,i,x) asm volatile("stw %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_byte_via_xc_ptr_indexed(p,i,x) asm volatile("st8 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) -#define write_short_via_xc_ptr_indexed(p,i,x) asm volatile("st16 %0, %1[%2]"::"r"(x),"r"(p),"r"(i)) - -#define write_via_xc_ptr(p,x) asm volatile("stw %0, %1[0]"::"r"(x),"r"(p)) -// No immediate st8 format -#define write_byte_via_xc_ptr(p,x) write_byte_via_xc_ptr_indexed(p, 0, x) -#define write_short_via_xc_ptr(p,x) write_short_via_xc_ptr_indexed(p, 0, x) - -#define read_via_xc_ptr_indexed(x,p,i) asm("ldw %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_byte_via_xc_ptr_indexed(x,p,i) asm("ld8u %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); -#define read_short_via_xc_ptr_indexed(x,p,i) asm("ld16s %0, %1[%2]":"=r"(x):"r"(p),"r"(i)); - -#define read_via_xc_ptr(x,p) asm("ldw %0, %1[0]":"=r"(x):"r"(p)); -// No immediate ld8u format -#define read_byte_via_xc_ptr(x,p) read_byte_via_xc_ptr_indexed(x, p, 0) -#define read_short_via_xc_ptr(x,p) read_short_via_xc_ptr_indexed(x, p, 0) - -#define GET_SHARED_GLOBAL(x, g) asm volatile("ldw %0, dp[" #g "]":"=r"(x)::"memory") -#define SET_SHARED_GLOBAL(g, v) asm volatile("stw %0, dp[" #g "]"::"r"(v):"memory") - -#endif From 1733628f25908defad2b05cae9c07dd32d088d61 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 1 Jul 2021 23:42:06 +0100 Subject: [PATCH 450/520] Remove old XTA pragma --- lib_xud/src/core/XUD_TokenJmp.S | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib_xud/src/core/XUD_TokenJmp.S b/lib_xud/src/core/XUD_TokenJmp.S index adf434b4..67b98592 100644 --- a/lib_xud/src/core/XUD_TokenJmp.S +++ b/lib_xud/src/core/XUD_TokenJmp.S @@ -8,8 +8,6 @@ shr r11, r11, 24 // Shift off junk ldw r10, r10[r11] // Load relevant branch address - -.xtabranch Pid_Out, Pid_Sof, Pid_In, Pid_Setup, Pid_Sof_NoChan bau r10 #else //__XS3A__ ldaw r10, dp[PidJumpTable] @@ -19,7 +17,7 @@ {setpsc res[RXD], r8; shr r11, r11, 24} ldw r11, r10[r11] -.xtabranch Pid_Out, Pid_Sof, Pid_In, Pid_Setup - bau r11 + bau r11 // Branch to Pid_Out, Pid_Sof, Pid_In, Pid_Setup etc + #endif From c8328ffd26e353ba42788b6b367e0f456b083a56 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 1 Jul 2021 23:44:07 +0100 Subject: [PATCH 451/520] Re-ordered instructions for single byte Tx packets for timing. Also fixed some white space issues. --- lib_xud/src/core/included/XUD_Token_In_DI.S | 24 ++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib_xud/src/core/included/XUD_Token_In_DI.S b/lib_xud/src/core/included/XUD_Token_In_DI.S index 87798bc0..027224ea 100755 --- a/lib_xud/src/core/included/XUD_Token_In_DI.S +++ b/lib_xud/src/core/included/XUD_Token_In_DI.S @@ -177,39 +177,39 @@ XUD_IN_TxCrc_TailS0: .align 32 .skip 0 -TxTail1s: // One tail byte - shl r6, r8, 8 // Concat PID and Data +TxTail1s: // One tail byte + shl r6, r8, 8 // Concat PID and Data or r11, r11, r6 +XUD_IN_TxPid_TailS1: + outpw res[TXD], r11, 16 // PID crc8 r7, r8, r8, r9 - crc32 r7, r4, r9 // r4: 0 + crc32 r7, r4, r9 // r4: 0 not r7, r7 -XUD_IN_TxPid_TailS1: - outpw res[TXD], r11, 16 // PID XUD_IN_TxCrc_TailS1: outpw res[TXD], r7, 16 bu DoneTail .align 32 .skip 0 -TxTail2s: // Two tail byte +TxTail2s: // Two tail byte crcn r7, r8, r9, r6 shl r6, r8, 8 - crc32 r7, r4, r9 // r4: 0 + crc32 r7, r4, r9 // r4: 0 {not r7, r7; or r11, r11, r6} XUD_IN_TxPid_TailS2: - outpw res[TXD], r11, 24 // Output PID and 2 bytes of data + outpw res[TXD], r11, 24 // Output PID and 2 bytes of data XUD_IN_TxCrc_TailS2: - outpw res[TXD], r7, 16 // Output CRC16 + outpw res[TXD], r7, 16 // Output CRC16 bu DoneTail .align 32 .skip 0 -TxTail3s: // Three tail byte +TxTail3s: // Three tail byte XUD_IN_TxPid_TailS3: - outpw res[TXD], r11, 8 // PID + outpw res[TXD], r11, 8 // PID outpw res[TXD], r8, 24 crcn r7, r8, r9, r6 - crc32 r7, r4, r9 // r4: 0 + crc32 r7, r4, r9 // r4: 0 not r7, r7 XUD_IN_TxCrc_TailS3: outpw res[TXD], r7, 16 From 2de26f0bedf3ba2431d2fc62bd3c5e6db2e2de86 Mon Sep 17 00:00:00 2001 From: xross Date: Thu, 1 Jul 2021 23:44:30 +0100 Subject: [PATCH 452/520] Fixed missing import --- tests/Pyxsim/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Pyxsim/__init__.py b/tests/Pyxsim/__init__.py index 0dc97c4e..34db755d 100644 --- a/tests/Pyxsim/__init__.py +++ b/tests/Pyxsim/__init__.py @@ -7,7 +7,7 @@ """ import sys import Pyxsim.pyxsim -from Pyxsim.xmostest_subprocess import call_get_output +from Pyxsim.xmostest_subprocess import call_get_output, call import platform import multiprocessing import tempfile From 75635fc5e92a9ce90a8a23d3f3753ea53425fd01 Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 2 Jul 2021 10:12:13 +0100 Subject: [PATCH 453/520] Fixess to app_test_mode README --- __app_test_mode/README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/__app_test_mode/README.rst b/__app_test_mode/README.rst index ac35ec06..733fa4fd 100644 --- a/__app_test_mode/README.rst +++ b/__app_test_mode/README.rst @@ -5,7 +5,7 @@ app_test_mode Summary ------- -This application stand-alone binaries for USB test modes. There are four build configurations, one for each USB test modes: +This application provide stand-alone binaries for USB test modes. There are four build configurations, one for each of the four USB Test Modes: - Test_SE0_NAK - Test_J @@ -16,6 +16,6 @@ The application enters it's respective test mode from boot, thus removing the re Note, you not should expect the the device to appear on any USB bus and its probably not advisable to plug into any standard host. -This binaries are most commonly used in device characterisation. +These binaries are most commonly used in device characterisation. From c03b03a419f56ebe0ca8a37997be42380360ed20 Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 2 Jul 2021 10:44:45 +0100 Subject: [PATCH 454/520] Removed trace from args (now command line) --- tests/helpers.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/helpers.py b/tests/helpers.py index dbf23f4a..05d95e41 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -14,7 +14,7 @@ ARCHITECTURE_CHOICES = ["xs2", "xs3"] BUSSPEED_CHOICES = ["FS", "HS"] -args = {"arch": "xs3", "trace": False} +args = {"arch": "xs3"} clean_only = False @@ -141,7 +141,11 @@ def do_usb_test( ) ) - build_success, build_output = Pyxsim._build(binary, build_options=build_options) + # Since we use the same src with different defines (setting CFLAGS) we need to clean + # TODO can we avoid this with build configs or similar? + build_success, build_output = Pyxsim._build( + binary, do_clean=True, build_options=build_options + ) assert len(sessions) == 1, "Multiple sessions not yet supported" if build_success: From 14563627e68d2f1f78d08d7c858d343e9374d9a0 Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 2 Jul 2021 10:45:36 +0100 Subject: [PATCH 455/520] Load PID jump table from stack (1 inst shaved) --- lib_xud/src/core/XUD_IoLoop.S | 15 ++------------- lib_xud/src/core/XUD_TokenJmp.S | 4 ++-- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/lib_xud/src/core/XUD_IoLoop.S b/lib_xud/src/core/XUD_IoLoop.S index 207dea0c..eeccc082 100755 --- a/lib_xud/src/core/XUD_IoLoop.S +++ b/lib_xud/src/core/XUD_IoLoop.S @@ -51,6 +51,7 @@ suspend_t_wtwrsths: #define STACK_RXCRC_TAIL3 (19) #define STACK_TXCRC_INIT (20) #define STACK_RXCRC_INIT (21) +#define STACK_PIDJUMPTABLE (22) // Params #define STACK_VTOK_PORT (STACK_EXTEND + 1) @@ -257,6 +258,7 @@ ConfigSofJump: stw r11, r10[r9] #endif ConfigSofJump_Done: + stw r10, sp[STACK_PIDJUMPTABLE] ConfigRxErrEventVector: setc res[r3], XS1_SETC_COND_EQ @@ -267,19 +269,6 @@ ConfigRxErrEventVector: setd res[r3], r11 // Set event cond data to 1 eeu res[r3] -#if 0 -SetupOutTimer: - getr r1, XS1_RES_TYPE_TIMER - ecallf r1 - - ldap r11, OutDataTimeOut - setv res[r1], r11 - setc res[r1], XS1_SETC_COND_AFTER - - stw r1, sp[STACK_OUT_TIMER] -#endif - - SetupSuspendResetTimer: getr r10, XS1_RES_TYPE_TIMER ecallf r10 diff --git a/lib_xud/src/core/XUD_TokenJmp.S b/lib_xud/src/core/XUD_TokenJmp.S index 67b98592..19fb0507 100644 --- a/lib_xud/src/core/XUD_TokenJmp.S +++ b/lib_xud/src/core/XUD_TokenJmp.S @@ -10,8 +10,8 @@ ldw r10, r10[r11] // Load relevant branch address bau r10 #else //__XS3A__ - ldaw r10, dp[PidJumpTable] - ldc r8, 16 + {ldw r10, sp[STACK_PIDJUMPTABLE] + ldc r8, 16} inpw r11, res[RXD], 8 // Read 3 byte token from data port | CRC[5] | EP[4] | ADDR[7] | PID[8] | junk {setpsc res[RXD], r8; shr r11, r11, 24} From 73943d3cf919758b953690d062b72b3c24210bb7 Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 2 Jul 2021 10:45:59 +0100 Subject: [PATCH 456/520] Discard output from cleaning DUT bin --- tests/Pyxsim/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Pyxsim/__init__.py b/tests/Pyxsim/__init__.py index 34db755d..8ec4f03c 100644 --- a/tests/Pyxsim/__init__.py +++ b/tests/Pyxsim/__init__.py @@ -7,7 +7,7 @@ """ import sys import Pyxsim.pyxsim -from Pyxsim.xmostest_subprocess import call_get_output, call +from Pyxsim.xmostest_subprocess import call_get_output import platform import multiprocessing import tempfile @@ -46,7 +46,7 @@ def _build(xe_path, build_config=None, env={}, do_clean=False, build_options="") cmd = ["xmake", "all"] if do_clean: - call(["xmake", "clean"], cwd=path, env=my_env) + clean_output = call_get_output(["xmake", "clean"], cwd=path, env=my_env) if build_config is not None: cmd += ["CONFIG=%s" % build_config] From 2d71fd3b79f030c875223ec758b82b79d1c35043 Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 2 Jul 2021 11:21:50 +0100 Subject: [PATCH 457/520] Re-ordered ISO/Ready checks to fix #204. --- lib_xud/src/core/included/XUD_Token_In_DI.S | 42 ++++++++++----------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/lib_xud/src/core/included/XUD_Token_In_DI.S b/lib_xud/src/core/included/XUD_Token_In_DI.S index 027224ea..2e86ea50 100755 --- a/lib_xud/src/core/included/XUD_Token_In_DI.S +++ b/lib_xud/src/core/included/XUD_Token_In_DI.S @@ -31,9 +31,9 @@ Pid_In: ldw r11, sp[STACK_EPTYPES_IN] ldw r11, r11[r10] // Load EP Type into R11 - bt r11, In_NonIso // If the type is non-zero then it is not isochronous bt r4, In_LoadPid // If the EP structure address is not 0, and the // EP type is iso, then we are ready to send. + bt r11, In_NonIso // Non-zero EP type means isochronous ldc r11, 0xc3 // Otherwise, create 0-length packet outpw res[TXD], r11, 24 #include "XUD_TokenJmp.S" @@ -52,45 +52,45 @@ In_TxHandshake: #include "XUD_TokenJmp.S" In_LoadPid: - ldw r11, r4[4] // Load PID from structure + ldw r11, r4[4] // Load PID from structure InReady: - ldw r8, r4[3] // Load buffer - ldw r6, r4[7] // Load tail length (bytes) - ldw r4, r4[6] // Load data length - bf r4, SmallTxPacket // Check for "short" packet + ldw r8, r4[3] // Load buffer + ldw r6, r4[7] // Load tail length (bytes) + ldw r4, r4[6] // Load data length + bf r4, SmallTxPacket // Check for "short" packet XUD_IN_Tx: - outpw res[TXD], r11, 8 // Out PID - ldw r11, r8[r4] // Load first data word + outpw res[TXD], r11, 8 // Out PID + ldw r11, r8[r4] // Load first data word XUD_IN_TxPid: - out res[TXD], r11 - crc32_inc r7, r11, r9, r4, 1 - bf r4, XUD_IN_TxLoopEnd + out res[TXD], r11 + crc32_inc r7, r11, r9, r4, 1 + bf r4, XUD_IN_TxLoopEnd XUD_IN_TxLoop: - ldw r11, r8[r4] // Load first data word - crc32_inc r7, r11, r9, r4, 1 - {out res[TXD], r11; bt r4, XUD_IN_TxLoop} + ldw r11, r8[r4] // Load first data word + crc32_inc r7, r11, r9, r4, 1 + {out res[TXD], r11; bt r4, XUD_IN_TxLoop} XUD_IN_TxLoopEnd: - ldw r11, r8[r4] // Load tail - crcn r7, r11, r9, r6 - outpw res[TXD], r11, r6 + ldw r11, r8[r4] // Load tail + crcn r7, r11, r9, r6 + outpw res[TXD], r11, r6 XUD_IN_TxLoopEnd_CrcCalc: - crc32 r7, r4, r9 // r4: 0 (from bf) - not r7, r7 + crc32 r7, r4, r9 // r4: 0 (from bf) + not r7, r7 XUD_IN_TxCrc: - outpw res[TXD], r7, 16 // Output 16-bit CRC + outpw res[TXD], r7, 16 // Output 16-bit CRC .scheduling default // Wait for handshake... or timeout DoneTail: ldw r11, sp[STACK_EPTYPES_IN] - ldw r11, r11[r10] // Load EP Type + ldw r11, r11[r10] // Load EP Type bt r11, SetupReceiveHandShake bu DoneTx From 6f252092cdb4d152b90b34b26fb129ab92539c95 Mon Sep 17 00:00:00 2001 From: xross Date: Fri, 2 Jul 2021 11:24:46 +0100 Subject: [PATCH 458/520] Comment fix only --- lib_xud/src/core/included/XUD_Token_In_DI.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xud/src/core/included/XUD_Token_In_DI.S b/lib_xud/src/core/included/XUD_Token_In_DI.S index 2e86ea50..f8fb6c00 100755 --- a/lib_xud/src/core/included/XUD_Token_In_DI.S +++ b/lib_xud/src/core/included/XUD_Token_In_DI.S @@ -42,7 +42,7 @@ In_NonIso: ldaw r11, dp[handshakeTable_IN] // Load handshake table ldw r11, r11[r10] // Load handshake PID into R11 {bf r4, In_TxHandshake // If the EP structure address is 0, and the EP type - // is not iso, then send the PID fro:setm the handshake table. + // is not iso, then send the PID from the handshake table. ldc r8, USB_PIDn_STALL} // If the EP is ready, then compare the STALL PID eq r8, r11, r8 // with the PID in the handshake table. bf r8, In_LoadPid // If it's not a STALL, then we are ready to send. From 940ad505c449747ba40a7cf38bf79856aa7e20d5 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 5 Jul 2021 20:46:10 +0100 Subject: [PATCH 459/520] Fixed time slip in TB --- tests/usb_clock.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/tests/usb_clock.py b/tests/usb_clock.py index f72fffaf..46e6a21f 100644 --- a/tests/usb_clock.py +++ b/tests/usb_clock.py @@ -13,23 +13,24 @@ def __init__(self, port, clk): self._running = True self._clk = clk if clk == self.CLK_60MHz: - self._period = float(1000000000) / 60000000 + self._period = float(1000000000.0 / 60000000.0) self._name = "60Mhz" - self._bit_time = 5 # TODO else: raise ValueError("Unsupported Clock Frequency") - self._min_ifg = 96 * self._bit_time self._val = 0 self._port = port def run(self): + + time = self.xsi.get_time() + while True: - self.wait_until(self.xsi.get_time() + self._period / 2) + + time += self._period / 2 + self.wait_until(time) self._val = 1 - self._val if self._running: - # print "{}".format(self._val) - # self.xsi.drive_port_pins(self._port, self._val) self.xsi.drive_periph_pin(self._port, self._val) @property @@ -52,12 +53,6 @@ def get_rate(self): def get_name(self): return self._name - def get_min_ifg(self): - return self._min_ifg - - def get_bit_time(self): - return self._bit_time - def stop(self): print("**** CLOCK STOP ****") self._running = False From f4c5f8dcf8ccc0bb8b52a83b2cbf610ca9931e78 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 5 Jul 2021 21:01:53 +0100 Subject: [PATCH 460/520] Quick hack to properly account for core frequency when generating USB clock (see #218) --- tests/usb_clock.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/usb_clock.py b/tests/usb_clock.py index 46e6a21f..d210d345 100644 --- a/tests/usb_clock.py +++ b/tests/usb_clock.py @@ -14,6 +14,10 @@ def __init__(self, port, clk): self._clk = clk if clk == self.CLK_60MHz: self._period = float(1000000000.0 / 60000000.0) + + # Quick hack to fix up clock freqency (hardcoded for 600MHz) + # TODO multiply period by core period - get freq from xe + self._period *= (1.0 / 600.0) * 1000 self._name = "60Mhz" else: raise ValueError("Unsupported Clock Frequency") From f67b14b9f201d3e0bec40d251f07df89d9df8424 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 5 Jul 2021 21:03:00 +0100 Subject: [PATCH 461/520] Removed extra test --- tests/test_bulk_tx_noack.py | 50 ----------------- tests/test_bulk_tx_noack/LICENSE.rst | 84 ---------------------------- tests/test_bulk_tx_noack/Makefile | 3 - tests/test_bulk_tx_noack/src/main.xc | 70 ----------------------- 4 files changed, 207 deletions(-) delete mode 100644 tests/test_bulk_tx_noack.py delete mode 100644 tests/test_bulk_tx_noack/LICENSE.rst delete mode 100644 tests/test_bulk_tx_noack/Makefile delete mode 100644 tests/test_bulk_tx_noack/src/main.xc diff --git a/tests/test_bulk_tx_noack.py b/tests/test_bulk_tx_noack.py deleted file mode 100644 index 3c265a73..00000000 --- a/tests/test_bulk_tx_noack.py +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright 2016-2021 XMOS LIMITED. -# This Software is subject to the terms of the XMOS Public Licence: Version 1. -from usb_packet import USB_PID, TokenPacket, RxDataPacket -from usb_session import UsbSession -from usb_transaction import UsbTransaction -import pytest -from conftest import PARAMS, test_RunUsbSession - - -@pytest.fixture -def test_session(ep, address, bus_speed): - - # Note, quite big gap to allow checking - ied = 4000 - - session = UsbSession( - bus_speed=bus_speed, run_enumeration=False, device_address=address - ) - - for pktLength in range(10, 14): - - if pktLength == 12: - session.add_event( - TokenPacket( - pid=USB_PID["IN"], - address=address, - endpoint=ep, - interEventDelay=ied, - ) - ) - session.add_event( - RxDataPacket( - dataPayload=session.getPayload_in(ep, pktLength, resend=True) - ) - ) - # Missing ACK - simulate CRC fail at host - - session.add_event( - UsbTransaction( - session, - deviceAddress=address, - endpointNumber=ep, - endpointType="BULK", - direction="IN", - dataLength=pktLength, - interEventDelay=ied, - ) - ) - - return session diff --git a/tests/test_bulk_tx_noack/LICENSE.rst b/tests/test_bulk_tx_noack/LICENSE.rst deleted file mode 100644 index ca48f20f..00000000 --- a/tests/test_bulk_tx_noack/LICENSE.rst +++ /dev/null @@ -1,84 +0,0 @@ -******************************* -XMOS PUBLIC LICENCE: Version 1 -******************************* - -Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. - -**1. Definitions** - -**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. - -**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. - -**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. - -**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. - -**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. - -**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. - -This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. - - -**2. Licence** - -**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: - -2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: - -2.1.1 for personal or academic, non-commercial purposes; or - -2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): - -(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and - -(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). - -The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. - -2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: - -2.2.1 for personal or academic, non-commercial purposes; or - -2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): - -(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; - -(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and - -(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. - -Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. - -2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. - -**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. - -**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. - -**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. - -**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. - -**7. IPR and Ownership** -Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** - -Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). -Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. - -**8. Termination** - -8.1 This Licence will automatically terminate immediately, without notice to you, if: - -(a) you fail to comply with the terms of this Licence; and/or - -(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or - -(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. - -**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. - -**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. - -**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_bulk_tx_noack/Makefile b/tests/test_bulk_tx_noack/Makefile deleted file mode 100644 index a2c9ee98..00000000 --- a/tests/test_bulk_tx_noack/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -TEST_FLAGS = -DXUD_BYPASS_RESET=1 - -include ../test_makefile.mak diff --git a/tests/test_bulk_tx_noack/src/main.xc b/tests/test_bulk_tx_noack/src/main.xc deleted file mode 100644 index 02bb9d72..00000000 --- a/tests/test_bulk_tx_noack/src/main.xc +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2016-2021 XMOS LIMITED. -// This Software is subject to the terms of the XMOS Public Licence: Version 1. -#include "shared.h" - -#ifndef PKT_LENGTH_START -#define PKT_LENGTH_START (10) -#endif - -#ifndef PKT_LENGTH_END -#define PKT_LENGTH_END (13) -#endif - -#define EP_COUNT_OUT (6) -#define EP_COUNT_IN (6) - -/* Endpoint type tables */ -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}; - -#ifdef XUD_SIM_RTL -int testmain() -#else -int main() -#endif -{ - chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; - - par - { - { -#if defined(XUD_TEST_SPEED_FS) - unsigned speed = XUD_SPEED_FS; -#elif defined(XUD_TEST_SPEED_HS) - unsigned speed = XUD_SPEED_HS; -#endif - XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, - speed, XUD_PWR_BUS); - } - - { - unsigned fail = TestEp_Tx(c_ep_in[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END, RUNMODE_DIE); - -#ifdef XUD_SIM_RTL - /* Note, this test relies on checking at the host side */ - - if(fail) - TerminateFail(fail); - else - TerminatePass(fail); -#endif - - XUD_ep ep_out_0 = XUD_InitEp(c_ep_out[0]); - XUD_Kill(ep_out_0); - exit(0); - } - } - - return 0; -} From 28742b857e24c66eaca652759c8d078882180e0c Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 5 Jul 2021 21:03:21 +0100 Subject: [PATCH 462/520] Removed old files from module_build_info --- lib_xud/module_build_info | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib_xud/module_build_info b/lib_xud/module_build_info index a7c64780..a089bc44 100644 --- a/lib_xud/module_build_info +++ b/lib_xud/module_build_info @@ -44,12 +44,9 @@ EXCLUDE_FILES += XUD_CrcAddrCheck.S \ XUD_G_Crc.S \ XUD_PidJumpTable.S \ XUD_RxData.S \ - XUD_Token_In.S \ XUD_Token_In_DI.S \ - XUD_Token_Out.S \ XUD_Token_Out_DI.S \ XUD_Token_Ping.S \ XUD_Token_SOF.S \ - XUD_Token_Setup.S \ XUD_Token_Setup_DI.S \ XUD_TokenJmp.S From 660e459b46d3816d6fe0595d4df9490948852f08 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 5 Jul 2021 21:03:45 +0100 Subject: [PATCH 463/520] Remove old param --- tests/test_bulk_tx_basic_short.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_bulk_tx_basic_short.py b/tests/test_bulk_tx_basic_short.py index 1ca04ee0..b40be0a7 100644 --- a/tests/test_bulk_tx_basic_short.py +++ b/tests/test_bulk_tx_basic_short.py @@ -27,7 +27,6 @@ def test_session(ep, address, bus_speed, dummy_threads): endpointNumber=ep, endpointType="BULK", direction="IN", - eventTime=10, dataLength=pktLength, ) ) From 018f525ccd2e4abe956d6a57ca9d4578acae8914 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 5 Jul 2021 21:17:57 +0100 Subject: [PATCH 464/520] Remove old code --- lib_xud/src/core/XUD_CrcAddrCheck.S | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/lib_xud/src/core/XUD_CrcAddrCheck.S b/lib_xud/src/core/XUD_CrcAddrCheck.S index df9c47be..6baf4459 100644 --- a/lib_xud/src/core/XUD_CrcAddrCheck.S +++ b/lib_xud/src/core/XUD_CrcAddrCheck.S @@ -10,7 +10,6 @@ // r10: Extracted EP number #ifdef __XS3A__ -#if 1 {in r10, res[RXD]; sub r1, r8, 5} // ldc r1 11 {shr r10, r10, 16; mkmsk r11, r1} {and r11, r10, r11; shr r4, r10, r1} // r4: Received CRC @@ -26,24 +25,6 @@ bt r10, waitforRXALow0 setc res[RXD], XS1_SETC_RUN_CLRBUF bu Loop_BadPid -#else - in r10, res[RXD] - ldaw r1, dp[crc5Table_Addr] - ldc r8, 30 - lmul r11, r10, r10, r8, r10, r10 // r11 is CRC5, r10 is EP(4):ADDR(7):CRAP(16):0(5) - shr r10, r10, 16 // r10 is 0(16):EP(4):ADDR(7):CRAP(5) - shr r10, r10, 5 // r10 is 0(21):EP(4):ADDR(7) - ld8u r8, r1[r10] // r8 is CRC of r10 - sub r4, r11, r8 // R4 set to 0 in L code with in from valid tok port - {BRFF_ru6 r4, 5; shr r10, r10, 7} // Extract EP number - - ldw r11, sp[STACK_RXA_PORT] // Wait for RXA to gow low (i.e. end of packet) - in r10, res[r11] - bt r10, waitforRXALow0 - setc res[RXD], XS1_SETC_RUN_CLRBUF - bu Loop_BadPid -#endif - #else // __XS2A__ inpw r10, res[RXD], 8; // Read EP Number From 650bbda396ddf6ab093b9c5324b3e6f8852007a5 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 5 Jul 2021 21:19:29 +0100 Subject: [PATCH 465/520] Fixed issue with PID jumpstable address sometimes not saved to stack. Address of handshakeTable_IN now on stack. --- lib_xud/src/core/XUD_IoLoop.S | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib_xud/src/core/XUD_IoLoop.S b/lib_xud/src/core/XUD_IoLoop.S index eeccc082..b088c148 100755 --- a/lib_xud/src/core/XUD_IoLoop.S +++ b/lib_xud/src/core/XUD_IoLoop.S @@ -52,6 +52,7 @@ suspend_t_wtwrsths: #define STACK_TXCRC_INIT (20) #define STACK_RXCRC_INIT (21) #define STACK_PIDJUMPTABLE (22) +#define STACK_HANDSHAKETABLEIN (23) // Params #define STACK_VTOK_PORT (STACK_EXTEND + 1) @@ -248,9 +249,9 @@ CrcRxResidualsOnStack: ConfigSofJump: ldw r11, sp[STACK_SOFCHAN] + ldaw r10, dp[PidJumpTable] bt r11, ConfigSofJump_Done ldap r11, Pid_Sof_NoChan - ldaw r10, dp[PidJumpTable] #ifdef __XS2A__ stw r11, r10[5] #else @@ -259,6 +260,8 @@ ConfigSofJump: #endif ConfigSofJump_Done: stw r10, sp[STACK_PIDJUMPTABLE] + ldaw r10, dp[handshakeTable_IN] // Load handshake table + stw r10, sp[STACK_HANDSHAKETABLEIN] ConfigRxErrEventVector: setc res[r3], XS1_SETC_COND_EQ From d9bc67c256bd8fc88cdf251e55ad4f1e1c4435e6 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 5 Jul 2021 21:20:36 +0100 Subject: [PATCH 466/520] Clock delays in sim fixed --- lib_xud/src/core/XUD_Main.xc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index 78ef97d7..e7ea3307 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -226,9 +226,7 @@ static int XUD_Manager_loop(XUD_chan epChans0[], XUD_chan epChans[], chanend ?c set_port_inv(p_usb_clk); set_port_sample_delay(p_usb_clk); -#if defined(XUD_SIM_XSIM) - set_clock_fall_delay(tx_usb_clk, TX_FALL_DELAY+5); -#else +#if !defined(XUD_SIM_XSIM) //This delay controls the capture of rdy set_clock_rise_delay(tx_usb_clk, TX_RISE_DELAY); From 2ff6f5e428d134cc637b9437b75dcbeb4ee32ad4 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 5 Jul 2021 21:21:48 +0100 Subject: [PATCH 467/520] Added g_stallTable_IN. Fixed whitespace issue. --- lib_xud/src/core/XUD_Main.xc | 1 + lib_xud/src/user/client/XUD_EpFuncs.S | 23 ++++++++++++++++------- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index e7ea3307..9ff0adec 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -105,6 +105,7 @@ extern unsigned XUD_LLD_IoLoop( int epCount, chanend? c_sof) ; unsigned handshakeTable_IN[USB_MAX_NUM_EP_IN]; +unsigned g_stallTable_IN[USB_MAX_NUM_EP_IN] = {1}; unsigned handshakeTable_OUT[USB_MAX_NUM_EP_OUT]; unsigned sentReset=0; diff --git a/lib_xud/src/user/client/XUD_EpFuncs.S b/lib_xud/src/user/client/XUD_EpFuncs.S index f354f793..d497f11f 100644 --- a/lib_xud/src/user/client/XUD_EpFuncs.S +++ b/lib_xud/src/user/client/XUD_EpFuncs.S @@ -285,9 +285,9 @@ XUD_GetDataSetupData_ResetPid: // We must reset PID toggling on XUD_SetData: #if defined(__XS2A__) || defined(__XS3A__) .issue_mode single - ENTSP_lu6 8 + ENTSP_lu6 8 #else - entsp 8 + entsp 8 #endif stw r5, sp[5] stw r10, sp[6] @@ -545,13 +545,18 @@ XUD_SetStallByAddr: ENTSP_lu6 0 #endif ldc r2, USB_PIDn_STALL - ldc r11, 0x80 // Check for IN bit + ldc r11, 0x80 // Check for IN bit and r11, r11, r0 bf r11, XUD_SetStallByAddr_OUT ldaw r1, dp[handshakeTable_IN] mkmsk r11, 7 and r11, r11, r0 stw r2, r1[r11] + + ldc r2, 0 + ldaw r1, dp[g_stallTable_IN] // Mark stall table with zero entry + stw r2, r1[r11] + retsp 0 XUD_SetStallByAddr_OUT: ldaw r1, dp[handshakeTable_OUT] @@ -589,15 +594,19 @@ XUD_SetStallByAddr_OUT: XUD_ClearStallByAddr: ENTSP_lu6 0 ldc r2, USB_PIDn_NAK - ldc r11, 0x80 // Check for IN bit + ldc r11, 0x80 // Check for IN bit and r11, r11, r0 bf r11, XUD_ClearStallByAddr_OUT - ldaw r1, dp[handshakeTable_IN] // Reset Handshake + ldaw r1, dp[handshakeTable_IN] // Reset Handshake mkmsk r11, 7 and r11, r11, r0 stw r2, r1[r11] - // Calc offset for data pid - ldaw r0, r11[4] // Assume MAX_NUM_EP_OUT is 16 here! (r0 = r0 + 4 * 4) + + ldaw r1, dp[g_stallTable_IN] + stw r2, r1[r11] // Mark stable with non-zero entry + + // Calc offset for data pid + ldaw r0, r11[4] // Assume MAX_NUM_EP_OUT is 16 here! (r0 = r0 + 4 * 4) ldc r1, USB_PIDn_DATA0 bu XUD_ClearStallByAddr_ResetDataPid From 933dda1c1975a09871bc52813de10078295219b3 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 5 Jul 2021 21:24:33 +0100 Subject: [PATCH 468/520] Opts to XUD_Token_In_DI. Speed improvements to stall handling. --- lib_xud/src/core/included/XUD_Token_In_DI.S | 130 ++++++++++---------- 1 file changed, 62 insertions(+), 68 deletions(-) diff --git a/lib_xud/src/core/included/XUD_Token_In_DI.S b/lib_xud/src/core/included/XUD_Token_In_DI.S index f8fb6c00..b94439f6 100755 --- a/lib_xud/src/core/included/XUD_Token_In_DI.S +++ b/lib_xud/src/core/included/XUD_Token_In_DI.S @@ -8,7 +8,6 @@ #define RXA r1 #define TXD r2 -.text // On entry: // R11: Branch address (now free) // R10: EP number (used here) @@ -20,84 +19,81 @@ // R4 : // R3 : 0 // R2 : TXD -// R1 : Valid Token Port +// R1 : Valid Token Port (XS2 only) // R0 : RXD .align FUNCTION_ALIGNMENT -Pid_In: - #include "XUD_CrcAddrCheck.S" - ldaw r3, r10[4] // R3 = R10 + 16 - ldw r4, r5[r3] // Load EP structure address into R4 - - - ldw r11, sp[STACK_EPTYPES_IN] - ldw r11, r11[r10] // Load EP Type into R11 - bt r4, In_LoadPid // If the EP structure address is not 0, and the - // EP type is iso, then we are ready to send. - bt r11, In_NonIso // Non-zero EP type means isochronous - ldc r11, 0xc3 // Otherwise, create 0-length packet - outpw res[TXD], r11, 24 +XUD_IN_NotReady: + ldw r11, sp[STACK_EPTYPES_IN] + ldw r11, r11[r10] // Load EP Type + bt r11, XUD_IN_TxNak + ldc r11, 0xc3 // Create 0-length packet + outpw res[TXD], r11, 24 #include "XUD_TokenJmp.S" -In_NonIso: +XUD_IN_TxNak: // Non-Iso ldaw r11, dp[handshakeTable_IN] // Load handshake table - ldw r11, r11[r10] // Load handshake PID into R11 - {bf r4, In_TxHandshake // If the EP structure address is 0, and the EP type - // is not iso, then send the PID from the handshake table. - ldc r8, USB_PIDn_STALL} // If the EP is ready, then compare the STALL PID - eq r8, r11, r8 // with the PID in the handshake table. - bf r8, In_LoadPid // If it's not a STALL, then we are ready to send. - // Otherwise, send the PID from the handshake table. -In_TxHandshake: + ldw r11, r11[r10] // Load handshake PID outpw res[TXD], r11, 8 #include "XUD_TokenJmp.S" -In_LoadPid: +.align FUNCTION_ALIGNMENT +Pid_In: + #include "XUD_CrcAddrCheck.S" + ldaw r3, r10[4] // R3 = R10 + 16 + ldw r4, r5[r3] // Load EP structure address + + ldaw r1, dp[g_stallTable_IN] + ldw r11, r1[r10] + or r11, r11, r4 + + bf r11, XUD_IN_NotReady // Note, user could potentially stall an ISO EP. + ldw r11, r4[4] // Load PID from structure -InReady: +XUD_IN_Ready: ldw r8, r4[3] // Load buffer ldw r6, r4[7] // Load tail length (bytes) - ldw r4, r4[6] // Load data length - bf r4, SmallTxPacket // Check for "short" packet + ldw r4, r4[6] // Load data length (words) + bf r4, XUD_IN_SmallTxPacket // Check for Short packet XUD_IN_Tx: outpw res[TXD], r11, 8 // Out PID ldw r11, r8[r4] // Load first data word XUD_IN_TxPid: - out res[TXD], r11 - crc32_inc r7, r11, r9, r4, 1 - bf r4, XUD_IN_TxLoopEnd + out res[TXD], r11 + crc32_inc r7, r11, r9, r4, 1 + bf r4, XUD_IN_TxLoopEnd XUD_IN_TxLoop: - ldw r11, r8[r4] // Load first data word - crc32_inc r7, r11, r9, r4, 1 - {out res[TXD], r11; bt r4, XUD_IN_TxLoop} + ldw r11, r8[r4] // Load first data word + crc32_inc r7, r11, r9, r4, 1 + {out res[TXD], r11; bt r4, XUD_IN_TxLoop} XUD_IN_TxLoopEnd: - ldw r11, r8[r4] // Load tail - crcn r7, r11, r9, r6 - outpw res[TXD], r11, r6 + ldw r11, r8[r4] // Load tail + crcn r7, r11, r9, r6 XUD_IN_TxLoopEnd_CrcCalc: - crc32 r7, r4, r9 // r4: 0 (from bf) - not r7, r7 + crc32 r7, r4, r9 // r4: 0 (from bf) + outpw res[TXD], r11, r6 + not r7, r7 XUD_IN_TxCrc: - outpw res[TXD], r7, 16 // Output 16-bit CRC + outpw res[TXD], r7, 16 // Output 16-bit CRC .scheduling default // Wait for handshake... or timeout DoneTail: ldw r11, sp[STACK_EPTYPES_IN] - ldw r11, r11[r10] // Load EP Type + ldw r11, r11[r10] // Load EP Type bt r11, SetupReceiveHandShake bu DoneTx SetupReceiveHandShake: - ldc r11, 8 - setpsc res[RXD], r11 // Set port shift count (expect 8 bit handshake) - eeu res[RXD] // Events on RXD always enabled - Can;t be any more due to using events on channels + ldc r11, 8 + setpsc res[RXD], r11 // Set port shift count (expect 8 bit handshake) + eeu res[RXD] // Events on RXD always enabled - Can;t be any more due to using events on channels SetupTimeout: // Timeout done using another port we dont happen to already be using events on. Cunning. #ifdef __XS2A__ @@ -113,9 +109,9 @@ SetupTimeout: // Timeout done using another eeu res[r1] WaitForHandshake: // Wait for timeout or handshake + .xtabranch TxHandshakeTimeOut, TxHandShakeReceived waiteu - // We sent some data but the host didn't handshake in time. Needs a re-send. .align FUNCTION_ALIGNMENT TxHandshakeTimeOut: @@ -123,7 +119,6 @@ TxHandshakeTimeOut: edu res[r1] {edu res[RXD]; bu BadHandshake} - // Transmitted data, and got something back within the timeout. Check for valid handshake... .align FUNCTION_ALIGNMENT TxHandShakeReceived: @@ -139,7 +134,7 @@ XUD_IN_RxAck: #endif xor r9, r11, r9 #ifdef __XS2A__ - {edu res[r1]; bt r9, BadHandshake} // Disable events on ValidToken port + {edu res[r1]; bt r9, BadHandshake} // Disable events on ValidToken port #else {bt r9, BadHandshake} #endif @@ -159,20 +154,20 @@ BadHandshake: .align 64 .skip 56 -SmallTxPacket: - ldw r8, r8[r4] // Load first data word - bru r6 // branch taillength +XUD_IN_SmallTxPacket: + ldw r8, r8[r4] // Load first data word + bru r6 // Branch on tail-length //-------------------------------------------------------------------------- .align 32 .skip 0 -TxTail0s: // We know this is a < 4 byte packet, so is 0 length packet - // So crc = 0. Note our normal crc calculation works for this, it is - // Not a special CRC case, but helps with timing. +TxTail0s: // We know this is a < 4 byte packet, so is 0 length packet + // So crc = 0. Note our normal crc calculation works for this, it is + // Not a special CRC case, but helps with timing. XUD_IN_TxPid_TailS0: - outpw res[TXD], r11, 8 // PID + outpw res[TXD], r11, 8 // PID XUD_IN_TxCrc_TailS0: - outpw res[TXD], r4, 16 // Output CRC (R4: 0) + outpw res[TXD], r4, 16 // Output CRC bu DoneTail .align 32 @@ -180,36 +175,36 @@ XUD_IN_TxCrc_TailS0: TxTail1s: // One tail byte shl r6, r8, 8 // Concat PID and Data or r11, r11, r6 -XUD_IN_TxPid_TailS1: - outpw res[TXD], r11, 16 // PID crc8 r7, r8, r8, r9 - crc32 r7, r4, r9 // r4: 0 + crc32 r7, r4, r9 // r4: 0 not r7, r7 +XUD_IN_TxPid_TailS1: + outpw res[TXD], r11, 16 // PID XUD_IN_TxCrc_TailS1: outpw res[TXD], r7, 16 bu DoneTail .align 32 .skip 0 -TxTail2s: // Two tail byte - crcn r7, r8, r9, r6 +TxTail2s: // Two tail byte + crcn r7, r8, r9, r6 shl r6, r8, 8 - crc32 r7, r4, r9 // r4: 0 + crc32 r7, r4, r9 // r4: 0 {not r7, r7; or r11, r11, r6} XUD_IN_TxPid_TailS2: - outpw res[TXD], r11, 24 // Output PID and 2 bytes of data + outpw res[TXD], r11, 24 // Output PID and 2 bytes of data XUD_IN_TxCrc_TailS2: - outpw res[TXD], r7, 16 // Output CRC16 + outpw res[TXD], r7, 16 // Output CRC16 bu DoneTail .align 32 .skip 0 -TxTail3s: // Three tail byte +TxTail3s: // Three tail byte XUD_IN_TxPid_TailS3: - outpw res[TXD], r11, 8 // PID + outpw res[TXD], r11, 8 // PID outpw res[TXD], r8, 24 crcn r7, r8, r9, r6 - crc32 r7, r4, r9 // r4: 0 + crc32 r7, r4, r9 // r4: 0 not r7, r7 XUD_IN_TxCrc_TailS3: outpw res[TXD], r7, 16 @@ -221,10 +216,9 @@ TxTail4s: // Four tail byte XUD_IN_TxPid_TailS4: outpw res[TXD], r11, 8 // PID out res[TXD], r8 - crc32 r7, r8, r9 + crc32 r7, r8, r9 crc32 r7, r4, r9 // r4: 0 not r7, r7 XUD_IN_TxCrc_TailS4: outpw res[TXD], r7, 16 bu DoneTail - From c9ac32beedc072b05a16b64251db16959b861a6d Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 5 Jul 2021 21:30:56 +0100 Subject: [PATCH 469/520] Slight tidy of Token_IN_DI --- lib_xud/src/core/included/XUD_Token_In_DI.S | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib_xud/src/core/included/XUD_Token_In_DI.S b/lib_xud/src/core/included/XUD_Token_In_DI.S index b94439f6..81bb914f 100755 --- a/lib_xud/src/core/included/XUD_Token_In_DI.S +++ b/lib_xud/src/core/included/XUD_Token_In_DI.S @@ -39,8 +39,8 @@ XUD_IN_TxNak: // Non-Iso .align FUNCTION_ALIGNMENT Pid_In: #include "XUD_CrcAddrCheck.S" - ldaw r3, r10[4] // R3 = R10 + 16 - ldw r4, r5[r3] // Load EP structure address + ldaw r3, r10[4] // R3 = R10 + 16 + ldw r4, r5[r3] // Load EP structure address ldaw r1, dp[g_stallTable_IN] ldw r11, r1[r10] @@ -88,12 +88,12 @@ DoneTail: ldw r11, sp[STACK_EPTYPES_IN] ldw r11, r11[r10] // Load EP Type bt r11, SetupReceiveHandShake - bu DoneTx + bu XUD_IN_DoneTx SetupReceiveHandShake: - ldc r11, 8 - setpsc res[RXD], r11 // Set port shift count (expect 8 bit handshake) - eeu res[RXD] // Events on RXD always enabled - Can;t be any more due to using events on channels + ldc r11, 8 + setpsc res[RXD], r11 // Set port shift count (expect 8 bit handshake) + eeu res[RXD] // Events on RXD always enabled - Can;t be any more due to using events on channels SetupTimeout: // Timeout done using another port we dont happen to already be using events on. Cunning. #ifdef __XS2A__ @@ -139,7 +139,7 @@ XUD_IN_RxAck: {bt r9, BadHandshake} #endif -DoneTx: +XUD_IN_DoneTx: ClearInEpReady: // TODO Tidy this up ldc r9, 0 // TODO From b141a474886df0bc5d6bb948af762c536bd879d1 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 5 Jul 2021 21:32:09 +0100 Subject: [PATCH 470/520] Mods to test params (added nightly but not currently used) --- tests/conftest.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 3b2c3088..2064e0c3 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -10,11 +10,11 @@ from pathlib import Path import shutil -# Note, no current support for XS2 +# Note, no current support for XS2 so don't copy XS2 xn files XN_FILES = ["test_xs3_600.xn", "test_xs3_800.xn"] PARAMS = { - "default": { + "nightly": { "arch": ["xs3"], "ep": [1, 2, 4], "address": [0, 1, 127], @@ -22,11 +22,19 @@ "dummy_threads": [0, 4, 5], "core_freq": [600, 800], }, + "default": { + "arch": ["xs3"], + "ep": [1, 2, 4], + "address": [0, 1, 127], + "bus_speed": ["HS", "FS"], + "dummy_threads": [0, 4, 5], + "core_freq": [600], + }, "smoke": { "arch": ["xs3"], - "ep": [1], + "ep": [2], "address": [0], - "bus_speed": ["HS", "FS"], + "bus_speed": ["HS"], "dummy_threads": [4], "core_freq": [600], }, From 475b69db47dff4c359ba960c7d1ea9bea3106b28 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 5 Jul 2021 21:38:12 +0100 Subject: [PATCH 471/520] Removed commented out xfail --- tests/test_bulk_tx_basic_short.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_bulk_tx_basic_short.py b/tests/test_bulk_tx_basic_short.py index b40be0a7..b1b57587 100644 --- a/tests/test_bulk_tx_basic_short.py +++ b/tests/test_bulk_tx_basic_short.py @@ -12,8 +12,8 @@ def test_session(ep, address, bus_speed, dummy_threads): start_length = 0 end_length = 7 - if dummy_threads > 3 and bus_speed == "HS": - pytest.xfail("Known failure dummy thread > 3 @ HS") + # if dummy_threads > 3 and bus_speed == "HS": + # pytest.xfail("Known failure dummy thread > 3 @ HS") session = UsbSession( bus_speed=bus_speed, run_enumeration=False, device_address=address From 3cc257a04f290ab3b90e91e334d95d4c8e8ff82a Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 5 Jul 2021 21:42:32 +0100 Subject: [PATCH 472/520] Remove commented out fail --- tests/test_control_basic_set.py | 4 ++-- tests/test_iso_tx_basic.py | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/test_control_basic_set.py b/tests/test_control_basic_set.py index af938ff7..fa269d5c 100644 --- a/tests/test_control_basic_set.py +++ b/tests/test_control_basic_set.py @@ -25,8 +25,8 @@ def test_session(ep, address, bus_speed, dummy_threads): ied = 500 - if bus_speed == "HS" and dummy_threads > 4: - pytest.xfail("Known fail when dummy threads > 4") + # if bus_speed == "HS" and dummy_threads > 4: + # pytest.xfail("Known fail when dummy threads > 4") session = UsbSession( bus_speed=bus_speed, run_enumeration=False, device_address=address diff --git a/tests/test_iso_tx_basic.py b/tests/test_iso_tx_basic.py index cfed76f0..1a65d543 100644 --- a/tests/test_iso_tx_basic.py +++ b/tests/test_iso_tx_basic.py @@ -12,9 +12,6 @@ def test_session(ep, address, bus_speed, dummy_threads): start_length = 10 end_length = 14 - if dummy_threads > 3 and bus_speed == "HS": - pytest.xfail("Known failure when dummy_threads > 4 at HS") - session = UsbSession( bus_speed=bus_speed, run_enumeration=False, From 3a03a085d3d29d2387ca44b7edd18ed1028936c5 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 5 Jul 2021 22:08:08 +0100 Subject: [PATCH 473/520] Removed hard-coded core-freq from TB USB clock --- tests/helpers.py | 5 +++-- tests/usb_clock.py | 7 ++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/tests/helpers.py b/tests/helpers.py index 05d95e41..3b643346 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -25,6 +25,7 @@ def create_if_needed(folder): def get_usb_clk_phy( + coreFreqMhz, verbose=True, test_ctrl=None, do_timeout=True, @@ -35,7 +36,7 @@ def get_usb_clk_phy( ): if arch == "xs2": - clk = Clock("XS1_USB_CLK", Clock.CLK_60MHz) + clk = Clock("XS1_USB_CLK", Clock.CLK_60MHz, coreFreqMhz) phy = UsbPhyUtmi( "XS1_USB_RXD", "XS1_USB_RXA", # rxa @@ -57,7 +58,7 @@ def get_usb_clk_phy( ) elif arch == "xs3": - clk = Clock("XS1_USB_CLK", Clock.CLK_60MHz) + clk = Clock("XS1_USB_CLK", Clock.CLK_60MHz, coreFreqMhz) phy = UsbPhyUtmi( "XS1_USB_RXD", "XS1_USB_RXA", # rxa diff --git a/tests/usb_clock.py b/tests/usb_clock.py index d210d345..a39a59f8 100644 --- a/tests/usb_clock.py +++ b/tests/usb_clock.py @@ -9,15 +9,12 @@ class Clock(SimThread): CLK_60MHz = 0x0 - def __init__(self, port, clk): + def __init__(self, port, clk, coreFreq_Mhz): self._running = True self._clk = clk if clk == self.CLK_60MHz: self._period = float(1000000000.0 / 60000000.0) - - # Quick hack to fix up clock freqency (hardcoded for 600MHz) - # TODO multiply period by core period - get freq from xe - self._period *= (1.0 / 600.0) * 1000 + self._period *= (1.0 / coreFreq_Mhz) * 1000.0 self._name = "60Mhz" else: raise ValueError("Unsupported Clock Frequency") From b95e5c2e6a744409a0df83f400dc26fb0a5a0f03 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 6 Jul 2021 00:20:46 +0100 Subject: [PATCH 474/520] Fixed check --- lib_xud/src/core/XUD_Main.xc | 2 +- lib_xud/src/core/included/XUD_Token_In_DI.S | 5 ++--- lib_xud/src/user/client/XUD_EpFuncs.S | 6 +++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib_xud/src/core/XUD_Main.xc b/lib_xud/src/core/XUD_Main.xc index 9ff0adec..30399ba7 100755 --- a/lib_xud/src/core/XUD_Main.xc +++ b/lib_xud/src/core/XUD_Main.xc @@ -105,7 +105,7 @@ extern unsigned XUD_LLD_IoLoop( int epCount, chanend? c_sof) ; unsigned handshakeTable_IN[USB_MAX_NUM_EP_IN]; -unsigned g_stallTable_IN[USB_MAX_NUM_EP_IN] = {1}; +unsigned g_stallTable_IN[USB_MAX_NUM_EP_IN] = {0}; unsigned handshakeTable_OUT[USB_MAX_NUM_EP_OUT]; unsigned sentReset=0; diff --git a/lib_xud/src/core/included/XUD_Token_In_DI.S b/lib_xud/src/core/included/XUD_Token_In_DI.S index 81bb914f..326a4eb3 100755 --- a/lib_xud/src/core/included/XUD_Token_In_DI.S +++ b/lib_xud/src/core/included/XUD_Token_In_DI.S @@ -41,12 +41,11 @@ Pid_In: #include "XUD_CrcAddrCheck.S" ldaw r3, r10[4] // R3 = R10 + 16 ldw r4, r5[r3] // Load EP structure address + bf r4, XUD_IN_NotReady ldaw r1, dp[g_stallTable_IN] ldw r11, r1[r10] - or r11, r11, r4 - - bf r11, XUD_IN_NotReady // Note, user could potentially stall an ISO EP. + bt r11, XUD_IN_NotReady // Note, user could potentially stall an ISO EP. ldw r11, r4[4] // Load PID from structure diff --git a/lib_xud/src/user/client/XUD_EpFuncs.S b/lib_xud/src/user/client/XUD_EpFuncs.S index d497f11f..b9aed1e5 100644 --- a/lib_xud/src/user/client/XUD_EpFuncs.S +++ b/lib_xud/src/user/client/XUD_EpFuncs.S @@ -553,8 +553,7 @@ XUD_SetStallByAddr: and r11, r11, r0 stw r2, r1[r11] - ldc r2, 0 - ldaw r1, dp[g_stallTable_IN] // Mark stall table with zero entry + ldaw r1, dp[g_stallTable_IN] // Mark stall table with non-zero entry stw r2, r1[r11] retsp 0 @@ -603,7 +602,8 @@ XUD_ClearStallByAddr: stw r2, r1[r11] ldaw r1, dp[g_stallTable_IN] - stw r2, r1[r11] // Mark stable with non-zero entry + ldc r2, 0 + stw r2, r1[r11] // Mark stall with zero entry // Calc offset for data pid ldaw r0, r11[4] // Assume MAX_NUM_EP_OUT is 16 here! (r0 = r0 + 4 * 4) From 39b0048ed54901b2b268b074a69065a3bd0ba4cd Mon Sep 17 00:00:00 2001 From: Dave Atkinson Date: Tue, 6 Jul 2021 09:46:32 +0100 Subject: [PATCH 475/520] Fix bcdHID value. --- examples/AN00129_hid_class/src/endpoint0.xc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/AN00129_hid_class/src/endpoint0.xc b/examples/AN00129_hid_class/src/endpoint0.xc index 60bbafee..6aa13dae 100644 --- a/examples/AN00129_hid_class/src/endpoint0.xc +++ b/examples/AN00129_hid_class/src/endpoint0.xc @@ -81,8 +81,8 @@ static unsigned char cfgDesc[] = { 0x09, /* 0 bLength. Note this is currently replicated in hidDescriptor[] below */ 0x21, /* 1 bDescriptorType (HID) */ - 0x10, /* 2 bcdHID */ - 0x11, /* 3 bcdHID */ + 0x11, /* 2 bcdHID */ + 0x01, /* 3 bcdHID */ 0x00, /* 4 bCountryCode */ 0x01, /* 5 bNumDescriptors */ 0x22, /* 6 bDescriptorType[0] (Report) */ @@ -102,8 +102,8 @@ static unsigned char hidDescriptor[] = { 0x09, /* 0 bLength */ 0x21, /* 1 bDescriptorType (HID) */ - 0x10, /* 2 bcdHID */ - 0x11, /* 3 bcdHID */ + 0x11, /* 2 bcdHID */ + 0x01, /* 3 bcdHID */ 0x00, /* 4 bCountryCode */ 0x01, /* 5 bNumDescriptors */ 0x22, /* 6 bDescriptorType[0] (Report) */ From b63678185e3d47aedde1fcf0e0a0c04ab0efb526 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 6 Jul 2021 11:15:49 +0100 Subject: [PATCH 476/520] Restrict dummyThreads for test_bulk_loopback --- tests/test_bulk_loopback.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/test_bulk_loopback.py b/tests/test_bulk_loopback.py index d5f9765f..9f8b9d1e 100644 --- a/tests/test_bulk_loopback.py +++ b/tests/test_bulk_loopback.py @@ -5,6 +5,11 @@ from usb_transaction import UsbTransaction import pytest from conftest import PARAMS, test_RunUsbSession +from copy import deepcopy + +PARAMS = deepcopy(PARAMS) +for k in PARAMS: + PARAMS[k].update({"dummy_threads": [4]}) @pytest.fixture From 1c1bbbd6151d4d1edd43b05310439c15762879c4 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 6 Jul 2021 11:18:56 +0100 Subject: [PATCH 477/520] Update test params and use core freq for test call --- tests/conftest.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 2064e0c3..945a5329 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -19,7 +19,7 @@ "ep": [1, 2, 4], "address": [0, 1, 127], "bus_speed": ["HS", "FS"], - "dummy_threads": [0, 4, 5], + "dummy_threads": [0, 5, 6], "core_freq": [600, 800], }, "default": { @@ -27,15 +27,15 @@ "ep": [1, 2, 4], "address": [0, 1, 127], "bus_speed": ["HS", "FS"], - "dummy_threads": [0, 4, 5], + "dummy_threads": [0, 5, 6], "core_freq": [600], }, "smoke": { "arch": ["xs3"], - "ep": [2], + "ep": [1, 2], "address": [0], "bus_speed": ["HS"], - "dummy_threads": [4], + "dummy_threads": [6], "core_freq": [600], }, } @@ -117,7 +117,8 @@ def test_RunUsbSession( testname, extension = os.path.splitext(os.path.basename(__file__)) seed = random.randint(0, sys.maxsize) - (clk_60, usb_phy) = get_usb_clk_phy(verbose=False, arch=arch) + # TODO it would be good to sanity check core_freq == xe.freq + (clk_60, usb_phy) = get_usb_clk_phy(core_freq, verbose=False, arch=arch) tester_list.extend( do_usb_test( arch, From 2731b9a73e2e86ecd1e384276b41701634bea44c Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 6 Jul 2021 11:27:49 +0100 Subject: [PATCH 478/520] Removed commented out xfail --- tests/test_bulk_tx_basic_short.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/test_bulk_tx_basic_short.py b/tests/test_bulk_tx_basic_short.py index b1b57587..949d302d 100644 --- a/tests/test_bulk_tx_basic_short.py +++ b/tests/test_bulk_tx_basic_short.py @@ -12,9 +12,6 @@ def test_session(ep, address, bus_speed, dummy_threads): start_length = 0 end_length = 7 - # if dummy_threads > 3 and bus_speed == "HS": - # pytest.xfail("Known failure dummy thread > 3 @ HS") - session = UsbSession( bus_speed=bus_speed, run_enumeration=False, device_address=address ) From ae969940b2c2138c78ad071c24cac0cc245d12e9 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 6 Jul 2021 13:58:16 +0100 Subject: [PATCH 479/520] Fixed error in test timeout --- tests/usb_phy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/usb_phy.py b/tests/usb_phy.py index aab84a1b..da07462b 100644 --- a/tests/usb_phy.py +++ b/tests/usb_phy.py @@ -153,7 +153,7 @@ def end_test(self): if self._do_timeout: # Allow time for a maximum sized packet to arrive - timeout_time = self._clock.get_bit_time() * 1522 * 8 + timeout_time = self._clock.period_ns * 1024 if self._expect_loopback: # If looping back then take into account all the data From 2555c3183a8379f17d8602d5dcee70cff2c9b2ca Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 6 Jul 2021 14:31:10 +0100 Subject: [PATCH 480/520] Tests now build to different bins based on params. This allows removal of the clean step on every test run. Also should allow execution of tests on multiple processed. --- tests/Pyxsim/__init__.py | 4 ++-- tests/helpers.py | 17 +++++++++++++---- tests/shared_src/shared.h | 17 ++++++++--------- tests/shared_src/test_main.xc | 1 + tests/test_makefile.mak | 24 +++++++++++------------- 5 files changed, 35 insertions(+), 28 deletions(-) diff --git a/tests/Pyxsim/__init__.py b/tests/Pyxsim/__init__.py index 974febbe..ceff7eeb 100644 --- a/tests/Pyxsim/__init__.py +++ b/tests/Pyxsim/__init__.py @@ -17,7 +17,7 @@ clean_only = False # This function is called automatically by the runners -def _build(xe_path, build_config=None, env={}, do_clean=False, build_options=""): +def _build(xe_path, build_config=None, env={}, do_clean=False, build_options=[]): # Work out the Makefile path path = None @@ -51,7 +51,7 @@ def _build(xe_path, build_config=None, env={}, do_clean=False, build_options="") if build_config is not None: cmd += ["CONFIG=%s" % build_config] - cmd += [build_options] + cmd += build_options output = call_get_output(cmd, cwd=path, env=my_env, merge_out_and_err=True) diff --git a/tests/helpers.py b/tests/helpers.py index 3b643346..8abd49dc 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -103,9 +103,11 @@ def run_on(**kwargs): FIXTURE_TO_DEFINE = { + "core_freq": "TEST_FREQ", + "arch": "TEST_ARCH", + "dummy_threads": "TEST_DTHREADS", "ep": "TEST_EP_NUM", "address": "XUD_STARTUP_ADDRESS", - "dummy_threads": "DUMMY_THREAD_COUNT", } @@ -125,20 +127,27 @@ def do_usb_test( extra_tasks=[], verbose=False, ): + build_options = [] + # Flags for makefile + for k, v in FIXTURE_TO_DEFINE.items(): + build_options += [str(v) + "=" + str(locals()[k])] + + # Defines for DUT code + # TODO shoud the makefile set thease based on the above? build_options_str = "CFLAGS=" for k, v in FIXTURE_TO_DEFINE.items(): build_options_str += "-D" + str(v) + "=" + str(locals()[k]) + " " - build_options = build_options_str + build_options = build_options + [build_options_str] """Shared test code for all RX tests using the test_rx application.""" testname, extension = os.path.splitext(os.path.basename(test_file)) tester_list = [] binary = ( - "{testname}/bin/{arch}_{core_freq}/{testname}_{arch}_{core_freq}.xe".format( - testname=testname, arch=arch, core_freq=core_freq + "{testname}/bin/{arch}_{core_freq}_{dummy_threads}_{ep}/{testname}_{arch}_{core_freq}_{dummy_threads}_{ep}.xe".format( + testname=testname, arch=arch, core_freq=core_freq, dummy_threads=dummy_threads, ep=ep ) ) diff --git a/tests/shared_src/shared.h b/tests/shared_src/shared.h index 846b811a..eda08a01 100644 --- a/tests/shared_src/shared.h +++ b/tests/shared_src/shared.h @@ -235,17 +235,16 @@ int TestEp_Loopback(chanend c_out1, chanend c_in1, t_runMode runMode) } } -#ifndef DUMMY_THREAD_COUNT -#error -#warning DUMMY_THREAD_COUNT not defined -#define DUMMY_THREAD_COUNT (0) +#ifndef TEST_DTHREADS +#warning TEST_DTHREADS not defined +#define TEST_DTHREADS (0) #endif -#if (DUMMY_THREAD_COUNT > 6) -#error DUMMY_THREAD_COUNT too high +#if (TEST_DTHREADS > 6) +#error TEST_DTHREADS too high #endif -size_t g_dummyThreadCount = DUMMY_THREAD_COUNT; +size_t g_dummyThreadCount = TEST_DTHREADS; void dummyThread() { @@ -260,8 +259,8 @@ void dummyThread() void dummyThreads() { -#if (DUMMY_THREAD_COUNT > 0) - par(size_t i = 0; i < DUMMY_THREAD_COUNT; i++) +#if (TEST_DTHREADS > 0) + par(size_t i = 0; i < TEST_DTHREADS; i++) { dummyThread(); } diff --git a/tests/shared_src/test_main.xc b/tests/shared_src/test_main.xc index 1886bc66..a1d2a465 100644 --- a/tests/shared_src/test_main.xc +++ b/tests/shared_src/test_main.xc @@ -43,6 +43,7 @@ int main() XUD_Kill(ep_out_0); } exit(0); + } dummyThreads(); } diff --git a/tests/test_makefile.mak b/tests/test_makefile.mak index 560f842f..e5d33f09 100644 --- a/tests/test_makefile.mak +++ b/tests/test_makefile.mak @@ -1,9 +1,3 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. - -#TARGET = test.xn - # The APP_NAME variable determines the name of the final .xe file. It should # not include the .xe postfix. If left blank the name will default to # the project name @@ -20,19 +14,23 @@ APP_NAME = SHARED_CODE = ../../shared_src -TEST_FLAGS ?= - -COMMON_FLAGS = -g -report -DDEBUG_PRINT_ENABLE -save-temps -O3 -Xmapper --map -Xmapper MAPFILE -I$(SHARED_CODE) \ +COMMON_FLAGS = -DDEBUG_PRINT_ENABLE \ + -O3 \ + -I$(SHARED_CODE) \ -DUSB_TILE=tile[0] \ - -Wno-timing \ -DXUD_SIM_XSIM=1 \ -DXUD_TEST_SPEED_HS=1 \ $(CFLAGS) -XCC_FLAGS_xs3_600 = $(TEST_FLAGS) $(COMMON_FLAGS) -XCC_FLAGS_xs3_800 = $(TEST_FLAGS) $(COMMON_FLAGS) +TEST_FLAGS ?= + +XCC_FLAGS_$(TEST_ARCH)_$(TEST_FREQ)_$(TEST_DTHREADS)_$(TEST_EP_NUM) = $(TEST_FLAGS) $(COMMON_FLAGS) + +# The TARGET variable determines what target system the application is +# compiled for. It either refers to an XN file in the source directories +# or a valid argument for the --target option when compiling. -TARGET = test_$(CONFIG).xn +TARGET = test_$(TEST_ARCH)_$(TEST_FREQ).xn # The USED_MODULES variable lists other module used by the application. USED_MODULES = lib_xud From d91eaf368b393ccfc88b1035a0da976842a233a5 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 6 Jul 2021 14:31:23 +0100 Subject: [PATCH 481/520] Disabled clean step --- tests/helpers.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/helpers.py b/tests/helpers.py index 8abd49dc..bb7942dc 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -151,10 +151,9 @@ def do_usb_test( ) ) - # Since we use the same src with different defines (setting CFLAGS) we need to clean - # TODO can we avoid this with build configs or similar? + # Do not need to clean since different build will different params go to separate binaries build_success, build_output = Pyxsim._build( - binary, do_clean=True, build_options=build_options + binary, do_clean=False, build_options=build_options ) assert len(sessions) == 1, "Multiple sessions not yet supported" From c2928f3da3727a9ea5405feae0d4727804b91923 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 6 Jul 2021 14:31:57 +0100 Subject: [PATCH 482/520] Added checks for definition of makefile test defines --- tests/test_makefile.mak | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/test_makefile.mak b/tests/test_makefile.mak index e5d33f09..118508e3 100644 --- a/tests/test_makefile.mak +++ b/tests/test_makefile.mak @@ -24,6 +24,22 @@ COMMON_FLAGS = -DDEBUG_PRINT_ENABLE \ TEST_FLAGS ?= +ifndef TEST_ARCH +$(error TEST_ARCH is not set) +endif + +ifndef TEST_FREQ +$(error TEST_FREQ is not set) +endif + +ifndef TEST_DTHREADS +$(error TEST_DTHREADS is not set) +endif + +ifndef TEST_EP_NUM +$(error TEST_EP_NUM is not set) +endif + XCC_FLAGS_$(TEST_ARCH)_$(TEST_FREQ)_$(TEST_DTHREADS)_$(TEST_EP_NUM) = $(TEST_FLAGS) $(COMMON_FLAGS) # The TARGET variable determines what target system the application is From 711946351c16e07d5f155647faf29f87a9f9f189 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 6 Jul 2021 14:33:35 +0100 Subject: [PATCH 483/520] Formatting only --- tests/helpers.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/helpers.py b/tests/helpers.py index bb7942dc..7d8d75b3 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -145,10 +145,12 @@ def do_usb_test( testname, extension = os.path.splitext(os.path.basename(test_file)) tester_list = [] - binary = ( - "{testname}/bin/{arch}_{core_freq}_{dummy_threads}_{ep}/{testname}_{arch}_{core_freq}_{dummy_threads}_{ep}.xe".format( - testname=testname, arch=arch, core_freq=core_freq, dummy_threads=dummy_threads, ep=ep - ) + binary = "{testname}/bin/{arch}_{core_freq}_{dummy_threads}_{ep}/{testname}_{arch}_{core_freq}_{dummy_threads}_{ep}.xe".format( + testname=testname, + arch=arch, + core_freq=core_freq, + dummy_threads=dummy_threads, + ep=ep, ) # Do not need to clean since different build will different params go to separate binaries From 01665c6f9dce6c8362326e352378e99b24326edc Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 6 Jul 2021 14:42:43 +0100 Subject: [PATCH 484/520] Add address to test params/makefile --- tests/helpers.py | 3 ++- tests/test_makefile.mak | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/helpers.py b/tests/helpers.py index 7d8d75b3..1b700f7f 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -145,12 +145,13 @@ def do_usb_test( testname, extension = os.path.splitext(os.path.basename(test_file)) tester_list = [] - binary = "{testname}/bin/{arch}_{core_freq}_{dummy_threads}_{ep}/{testname}_{arch}_{core_freq}_{dummy_threads}_{ep}.xe".format( + binary = "{testname}/bin/{arch}_{core_freq}_{dummy_threads}_{ep}_{address}/{testname}_{arch}_{core_freq}_{dummy_threads}_{ep}_{address}.xe".format( testname=testname, arch=arch, core_freq=core_freq, dummy_threads=dummy_threads, ep=ep, + address=address, ) # Do not need to clean since different build will different params go to separate binaries diff --git a/tests/test_makefile.mak b/tests/test_makefile.mak index 118508e3..13501762 100644 --- a/tests/test_makefile.mak +++ b/tests/test_makefile.mak @@ -40,7 +40,11 @@ ifndef TEST_EP_NUM $(error TEST_EP_NUM is not set) endif -XCC_FLAGS_$(TEST_ARCH)_$(TEST_FREQ)_$(TEST_DTHREADS)_$(TEST_EP_NUM) = $(TEST_FLAGS) $(COMMON_FLAGS) +ifndef XUD_STARTUP_ADDRESS +$(error XUD_STARTUP_ADDRESS is not set) +endif + +XCC_FLAGS_$(TEST_ARCH)_$(TEST_FREQ)_$(TEST_DTHREADS)_$(TEST_EP_NUM)_$(XUD_STARTUP_ADDRESS) = $(TEST_FLAGS) $(COMMON_FLAGS) # The TARGET variable determines what target system the application is # compiled for. It either refers to an XN file in the source directories From 5c3f6779457f05e375c269bfe2eab59af8058b56 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 6 Jul 2021 14:56:57 +0100 Subject: [PATCH 485/520] Updated smoke and default test params --- tests/conftest.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 945a5329..39281710 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -24,16 +24,16 @@ }, "default": { "arch": ["xs3"], - "ep": [1, 2, 4], - "address": [0, 1, 127], + "ep": [1, 2], + "address": [0, 1], "bus_speed": ["HS", "FS"], - "dummy_threads": [0, 5, 6], + "dummy_threads": [0, 6], "core_freq": [600], }, "smoke": { "arch": ["xs3"], - "ep": [1, 2], - "address": [0], + "ep": [1], + "address": [1], "bus_speed": ["HS"], "dummy_threads": [6], "core_freq": [600], From 29a592a2d1d0f1bbe2a464880507e9f0862e5bb7 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 6 Jul 2021 14:58:36 +0100 Subject: [PATCH 486/520] Enabled support for extended test params --- tests/conftest.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 39281710..4792ed61 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -14,7 +14,7 @@ XN_FILES = ["test_xs3_600.xn", "test_xs3_800.xn"] PARAMS = { - "nightly": { + "extended": { "arch": ["xs3"], "ep": [1, 2, 4], "address": [0, 1, 127], @@ -43,6 +43,7 @@ def pytest_addoption(parser): parser.addoption("--smoke", action="store_true", help="Smoke test") + parser.addoption("--extended", action="store_true", help="Extended test") parser.addoption( "--enabletracing", action="store_true", @@ -60,6 +61,8 @@ def pytest_generate_tests(metafunc): PARAMS = metafunc.module.PARAMS if metafunc.config.getoption("smoke"): params = PARAMS.get("smoke", PARAMS["default"]) + if metafunc.config.getoption("extended"): + params = PARAMS.get("extended", PARAMS["default"]) else: params = PARAMS["default"] except AttributeError: From 86da0cf9a4b7a4ccb9794acfe453314ef6be59c9 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 6 Jul 2021 15:20:08 +0100 Subject: [PATCH 487/520] Update requirements.txt --- requirements.txt | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 99e7dd7b..e9aace0d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,7 +17,31 @@ # pip-install this one as editable using this repository's setup.py file. The # same modules should appear in the setup.py list as given below. -flake8==3.8.3 +appdirs==1.4.3 +attrs==21.2.0 +black==21.5b1 +click==8.0.0 +distlib==0.3.0 +execnet==1.9.0 +filelock==3.0.12 +importlib-metadata==1.6.0 +iniconfig==1.1.1 +mypy-extensions==0.4.3 +packaging==20.9 +pathspec==0.8.1 +pluggy==0.13.1 +py==1.10.0 +pyparsing==2.4.7 +pytest==6.2.4 +pytest-forked==1.3.0 +pytest-xdist==2.3.0 +regex==2021.4.4 +six==1.14.0 +toml==0.10.2 +typed-ast==1.4.3 +typing-extensions==3.10.0.0 +virtualenv==20.0.15 +zipp==3.1.0 # Development dependencies # From 53d601fc71a84c076547faecf172866d491b46ce Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 6 Jul 2021 15:22:04 +0100 Subject: [PATCH 488/520] Updated requirements.txt --- requirements.txt | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/requirements.txt b/requirements.txt index e9aace0d..c60167e7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,31 +17,9 @@ # pip-install this one as editable using this repository's setup.py file. The # same modules should appear in the setup.py list as given below. -appdirs==1.4.3 -attrs==21.2.0 black==21.5b1 -click==8.0.0 -distlib==0.3.0 -execnet==1.9.0 -filelock==3.0.12 -importlib-metadata==1.6.0 -iniconfig==1.1.1 -mypy-extensions==0.4.3 -packaging==20.9 -pathspec==0.8.1 -pluggy==0.13.1 -py==1.10.0 -pyparsing==2.4.7 pytest==6.2.4 -pytest-forked==1.3.0 pytest-xdist==2.3.0 -regex==2021.4.4 -six==1.14.0 -toml==0.10.2 -typed-ast==1.4.3 -typing-extensions==3.10.0.0 -virtualenv==20.0.15 -zipp==3.1.0 # Development dependencies # From f2ea4a2de820cbdf62ceb129d55218f2313ef823 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 6 Jul 2021 15:56:56 +0100 Subject: [PATCH 489/520] Fixed tab --- tests/shared_src/test_main.xc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/shared_src/test_main.xc b/tests/shared_src/test_main.xc index a1d2a465..32d13a0b 100644 --- a/tests/shared_src/test_main.xc +++ b/tests/shared_src/test_main.xc @@ -43,7 +43,7 @@ int main() XUD_Kill(ep_out_0); } exit(0); - } + } dummyThreads(); } From e0af79df694580c263857054e4e472bb8e0943fc Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 6 Jul 2021 19:22:35 +0100 Subject: [PATCH 490/520] Fix whitespace only --- lib_xud/src/core/included/XUD_Token_In_DI.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xud/src/core/included/XUD_Token_In_DI.S b/lib_xud/src/core/included/XUD_Token_In_DI.S index 326a4eb3..846ceda6 100755 --- a/lib_xud/src/core/included/XUD_Token_In_DI.S +++ b/lib_xud/src/core/included/XUD_Token_In_DI.S @@ -92,7 +92,7 @@ DoneTail: SetupReceiveHandShake: ldc r11, 8 setpsc res[RXD], r11 // Set port shift count (expect 8 bit handshake) - eeu res[RXD] // Events on RXD always enabled - Can;t be any more due to using events on channels + eeu res[RXD] // Events on RXD always enabled - Can;t be any more due to using events on channels SetupTimeout: // Timeout done using another port we dont happen to already be using events on. Cunning. #ifdef __XS2A__ From 05dc8dc75703a464ff3f7fcc22ccb91e99909e6f Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 6 Jul 2021 20:06:17 +0100 Subject: [PATCH 491/520] Improved debug output on test fail --- tests/Pyxsim/testers.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/Pyxsim/testers.py b/tests/Pyxsim/testers.py index 534690e1..68405b4e 100644 --- a/tests/Pyxsim/testers.py +++ b/tests/Pyxsim/testers.py @@ -128,7 +128,10 @@ def run(self, output): ) if num_expected > line_num + 1: - self.record_failure("Length of expected output greater than output") + self.record_failure( + "Length of expected output greater than output\nMissing:\n" + + "\n".join(expected[line_num + 1 :]) + ) output = {"output": "".join(output)} if not self.result: From 0d1ef3690f768f5b350207dcbd45d5824e16ba12 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 7 Jul 2021 09:44:12 +0100 Subject: [PATCH 492/520] Added check for mutually excluding smoke/extended options --- tests/conftest.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 4792ed61..b573ee52 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -56,12 +56,18 @@ def pytest_configure(config): os.environ["enabletracing"] = str(config.getoption("enabletracing")) +# TODO: this is deprecated, find a better way +def pytest_cmdline_preparse(config, args): + if "--smoke" in args and "--extended" in args: + raise pytest.UsageError('Only one of "--smoke" and "--extended" can be used') + + def pytest_generate_tests(metafunc): try: PARAMS = metafunc.module.PARAMS if metafunc.config.getoption("smoke"): params = PARAMS.get("smoke", PARAMS["default"]) - if metafunc.config.getoption("extended"): + elif metafunc.config.getoption("extended"): params = PARAMS.get("extended", PARAMS["default"]) else: params = PARAMS["default"] From e6c97d9a2992f77165539742d675073b4aa7d13b Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 7 Jul 2021 11:49:57 +0100 Subject: [PATCH 493/520] Removed unused test code. Tidied up end of test code. --- tests/helpers.py | 6 ------ tests/usb_phy.py | 32 ++------------------------------ tests/usb_phy_utmi.py | 4 ---- 3 files changed, 2 insertions(+), 40 deletions(-) diff --git a/tests/helpers.py b/tests/helpers.py index 1b700f7f..73c833ca 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -27,10 +27,8 @@ def create_if_needed(folder): def get_usb_clk_phy( coreFreqMhz, verbose=True, - test_ctrl=None, do_timeout=True, complete_fn=None, - expect_loopback=False, dut_exit_time=350000, arch="xs2", ): @@ -50,10 +48,8 @@ def get_usb_clk_phy( "XS1_USB_TERMSEL", clk, verbose=verbose, - test_ctrl=test_ctrl, do_timeout=do_timeout, complete_fn=complete_fn, - expect_loopback=expect_loopback, dut_exit_time=dut_exit_time, ) @@ -72,10 +68,8 @@ def get_usb_clk_phy( "XS1_USB_TERMSEL", clk, verbose=verbose, - test_ctrl=test_ctrl, do_timeout=do_timeout, complete_fn=complete_fn, - expect_loopback=expect_loopback, dut_exit_time=dut_exit_time, ) diff --git a/tests/usb_phy.py b/tests/usb_phy.py index da07462b..ac21367a 100644 --- a/tests/usb_phy.py +++ b/tests/usb_phy.py @@ -62,7 +62,7 @@ class UsbPhy(Pyxsim.SimThread): - # Time in ns from the last packet being sent until the end of test is signalled to the DUT + # Time in ns from the last event packet being sent until the end of test END_OF_TEST_TIME = 5000 def __init__( @@ -81,14 +81,11 @@ def __init__( clock, initial_delay, verbose, - test_ctrl, do_timeout, complete_fn, - expect_loopback, dut_exit_time, ): self._name = name - self._test_ctrl = test_ctrl self._rxd = rxd # Rx data self._rxa = rxa # Rx Active self._rxdv = rxdv # Rx valid @@ -105,7 +102,6 @@ def __init__( self._verbose = verbose self._do_timeout = do_timeout self._complete_fn = complete_fn - self._expect_loopback = expect_loopback self._dut_exit_time = dut_exit_time @property @@ -148,34 +144,10 @@ def end_test(self): if self._complete_fn: self._complete_fn(self) - # Give the DUT a reasonable time to process the packet + # Give the DUT a reasonable time to process the last packet self.wait_until(self.xsi.get_time() + self.END_OF_TEST_TIME) if self._do_timeout: - # Allow time for a maximum sized packet to arrive - timeout_time = self._clock.period_ns * 1024 - - if self._expect_loopback: - # If looping back then take into account all the data - total_packet_bytes = sum( - [len(packet.get_bytes()) for packet in self._session.events] - ) - total_data_bits = total_packet_bytes * 8 - - # Allow 2 cycles per bit - timeout_time += 2 * total_data_bits - - # The clock ticks are 2ns long - timeout_time *= 2 - - # The events are copied to and from the user application - timeout_time *= 2 - - self.wait_until(self.xsi.get_time() + timeout_time) - - if self._test_ctrl: - # Indicate to the DUT that the test has finished - self.xsi.drive_port_pins(self._test_ctrl, 1) # Allow time for the DUT to exit self.wait_until(self.xsi.get_time() + self._dut_exit_time) diff --git a/tests/usb_phy_utmi.py b/tests/usb_phy_utmi.py index bdfcd2ee..bd1bfdae 100644 --- a/tests/usb_phy_utmi.py +++ b/tests/usb_phy_utmi.py @@ -21,10 +21,8 @@ def __init__( clock, initial_delay=60000, verbose=False, - test_ctrl=None, do_timeout=True, complete_fn=None, - expect_loopback=True, dut_exit_time=25000, ): @@ -45,9 +43,7 @@ def __init__( clock, initial_delay, verbose, - test_ctrl, do_timeout, complete_fn, - expect_loopback, dut_exit_time, ) From 10cc8aafe04601f0155706318c218033aed55977 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 7 Jul 2021 11:54:07 +0100 Subject: [PATCH 494/520] =?UTF-8?q?Added=20some=20delay=20before=20test=5F?= =?UTF-8?q?bulk=5Frx=5Ftraffic=20DUT=20code=20exits.=20This=20allows=20tim?= =?UTF-8?q?e=20for=20TB=20to=20finish=20sending=20any=20=E2=80=9Ctraffic?= =?UTF-8?q?=E2=80=9D=20data.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_bulk_rx_traffic.py | 3 --- tests/test_bulk_rx_traffic/src/main.xc | 8 ++++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/test_bulk_rx_traffic.py b/tests/test_bulk_rx_traffic.py index 6c6ce5c4..5394c88e 100644 --- a/tests/test_bulk_rx_traffic.py +++ b/tests/test_bulk_rx_traffic.py @@ -11,9 +11,6 @@ @pytest.fixture def test_session(ep, address, bus_speed): - if bus_speed == "FS": - pytest.xfail("Known failure at FS") - ied = 500 trafficAddress1 = (address + 1) % 128 diff --git a/tests/test_bulk_rx_traffic/src/main.xc b/tests/test_bulk_rx_traffic/src/main.xc index 7637be77..609c3f38 100644 --- a/tests/test_bulk_rx_traffic/src/main.xc +++ b/tests/test_bulk_rx_traffic/src/main.xc @@ -48,6 +48,14 @@ int main() { unsigned fail = TestEp_Rx(c_ep_out[TEST_EP_NUM], TEST_EP_NUM, PKT_LENGTH_START, PKT_LENGTH_END); + /* Give some time for the traffic EP transactions to be sent */ + { + timer t; + unsigned time; + t :> time; + t when timerafter(time + 10000) :> int _; + } + XUD_ep ep0 = XUD_InitEp(c_ep_out[0]); XUD_Kill(ep0); From c59f00da0f1d389999ffca2dddb0273f8635ddc1 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 7 Jul 2021 12:12:21 +0100 Subject: [PATCH 495/520] Removed core count warning for XS3 (should remain for XS2) --- lib_xud/src/user/client/XUD_EpFuncs.S | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib_xud/src/user/client/XUD_EpFuncs.S b/lib_xud/src/user/client/XUD_EpFuncs.S index 709b23c9..95c0e1b6 100644 --- a/lib_xud/src/user/client/XUD_EpFuncs.S +++ b/lib_xud/src/user/client/XUD_EpFuncs.S @@ -7,7 +7,7 @@ #include "XUD_USB_Defines.h" #include "XUD_AlignmentDefines.h" -#if !defined __XS2A__ +#if defined __XS2A__ .set too_many_cores, main.maxcores > 6 .assert 0, too_many_cores, "Warning: More than 6 cores used on a tile. Ensure this is not the case on tile running XUD." #endif @@ -22,7 +22,6 @@ ep_info_address: .cc_bottom ep_info_address.data - //int XUD_GetSetupData(XUD_ep e_out, unsigned buffer[], unsigned &length); // r0 r1 r2 .text From 95653e0d492a586627dba270ec6c6ce975dc2c9a Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 7 Jul 2021 12:29:08 +0100 Subject: [PATCH 496/520] Increased dut_exit_time since other delays now removed. --- tests/usb_phy_utmi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/usb_phy_utmi.py b/tests/usb_phy_utmi.py index bd1bfdae..0437e134 100644 --- a/tests/usb_phy_utmi.py +++ b/tests/usb_phy_utmi.py @@ -23,7 +23,7 @@ def __init__( verbose=False, do_timeout=True, complete_fn=None, - dut_exit_time=25000, + dut_exit_time=30000, ): self._do_tokens = False From a6e4f859986b5ffca2697c5227cdca49b913c248 Mon Sep 17 00:00:00 2001 From: Dave Atkinson Date: Wed, 7 Jul 2021 17:13:36 +0100 Subject: [PATCH 497/520] Remove unneeded .xn file. --- .../AN00129_hid_class/src/mic_array_ref.xn | 84 ------------------- 1 file changed, 84 deletions(-) delete mode 100644 examples/AN00129_hid_class/src/mic_array_ref.xn diff --git a/examples/AN00129_hid_class/src/mic_array_ref.xn b/examples/AN00129_hid_class/src/mic_array_ref.xn deleted file mode 100644 index dc790657..00000000 --- a/examples/AN00129_hid_class/src/mic_array_ref.xn +++ /dev/null @@ -1,84 +0,0 @@ - - - Board - XS2 MC Audio - - tileref tile[2] - tileref usb_tile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From ee48ba5f945ffffa6080ceda6d06601d228b7e9d Mon Sep 17 00:00:00 2001 From: Dave Atkinson Date: Wed, 7 Jul 2021 17:19:44 +0100 Subject: [PATCH 498/520] Modified makefile configs to match other demos. --- examples/AN00129_hid_class/Makefile | 38 ++++++++++++++--------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/examples/AN00129_hid_class/Makefile b/examples/AN00129_hid_class/Makefile index 5d8ac82e..8b92460a 100644 --- a/examples/AN00129_hid_class/Makefile +++ b/examples/AN00129_hid_class/Makefile @@ -1,17 +1,7 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. - -# In this case, the target depends on the build configuration. -ifeq ($(CONFIG),X200) -TARGET = XCORE-200-EXPLORER -else -TARGET = XCORE-AI-EXPLORER-NO-DDR.xn -endif - # The APP_NAME variable determines the name of the final .xe file. It should -# not include the .xe postfix. If left blank the name will default to +# not include the .xe postfix. If left blank the name will default to # the project name + APP_NAME = app_hid_mouse_demo # The flags passed to xcc when building the application @@ -19,16 +9,26 @@ APP_NAME = app_hid_mouse_demo # # XCC_XC_FLAGS, XCC_C_FLAGS, XCC_ASM_FLAGS, XCC_CPP_FLAGS # -# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to +# If the variable XCC_MAP_FLAGS is set it overrides the flags passed to # xcc for the final link (mapping) stage. -# These flags define two build configurations - one for U-series and one for -# the xCORE-200 series. +BUILD_FLAGS = -O3 -g -report + +XCC_FLAGS_xcore200 = $(BUILD_FLAGS) -DXUD_SERIES_SUPPORT=XUD_X200_SERIES +XCC_FLAGS_xcoreai = $(BUILD_FLAGS) -XCC_FLAGS_X200 = -O3 -report -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -XCC_FLAGS_AI = -O3 -report +# The TARGET variable determines what target system the application is +# compiled for. It either refers to an XN file in the source directories +# or a valid argument for the --target option when compiling. + +ifeq ($(CONFIG),xcoreai) +TARGET = XCORE-AI-EXPLORER-NO-DDR +else +TARGET = XCORE-200-EXPLORER +endif + +# The USED_MODULES variable lists other module used by the application. -# The USED_MODULES variable lists other module used by the application. USED_MODULES = lib_xud #============================================================================= @@ -37,5 +37,3 @@ USED_MODULES = lib_xud XMOS_MAKE_PATH ?= ../.. include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common - - From 598580f13594fd970b8c24ccbfa4c70b9a30f9c9 Mon Sep 17 00:00:00 2001 From: Kevin Yeung Date: Mon, 12 Jul 2021 11:40:00 +0800 Subject: [PATCH 499/520] arg bugs fixed --- tests/conftest.py | 2 +- tests/helpers.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 4792ed61..19bb1be3 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -61,7 +61,7 @@ def pytest_generate_tests(metafunc): PARAMS = metafunc.module.PARAMS if metafunc.config.getoption("smoke"): params = PARAMS.get("smoke", PARAMS["default"]) - if metafunc.config.getoption("extended"): + elif metafunc.config.getoption("extended"): params = PARAMS.get("extended", PARAMS["default"]) else: params = PARAMS["default"] diff --git a/tests/helpers.py b/tests/helpers.py index 1b700f7f..2e2020aa 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -226,7 +226,7 @@ def create_expect(arch, session, filename, verbose=False): def get_sim_args(testname, clk, phy, arch="xs2"): sim_args = [] - if bool(os.getenv("enabletracing")): + if eval(os.getenv("enabletracing")): log_folder = create_if_needed("logs") filename = "{log}/xsim_trace_{test}_{clk}_{arch}".format( From 3c247609c38371eeb0f80b57518b9dfa82c8b3c8 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 12 Jul 2021 12:33:02 +0100 Subject: [PATCH 500/520] White space only --- lib_xud/src/core/included/XUD_Token_Setup_DI.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xud/src/core/included/XUD_Token_Setup_DI.S b/lib_xud/src/core/included/XUD_Token_Setup_DI.S index 03e9e762..4f6a03bf 100644 --- a/lib_xud/src/core/included/XUD_Token_Setup_DI.S +++ b/lib_xud/src/core/included/XUD_Token_Setup_DI.S @@ -14,7 +14,7 @@ Pid_Setup: ldw r1, r3[3] // Load buffer LoadSetupBuffer: - bl doRXData // RXData writes available data to buffer and does crc check. + bl doRXData // RXData writes available data to buffer and does crc check. // r8: Data tail size (bytes) {clre; eq r1, r6, r11} // Check for good CRC16 bf r1, NextTokenAfterOut // Check for bad crc From c831d6ff07527e48b73c4fd51c0055b580a5684a Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 12 Jul 2021 12:33:37 +0100 Subject: [PATCH 501/520] Added directed tests for issue #227 --- tests/test_control_basic_set.py | 1 + tests/test_stall_control.py | 157 +++++++++++++++++++++++++++ tests/test_stall_control/Makefile | 3 + tests/test_stall_control/src/main.xc | 79 ++++++++++++++ 4 files changed, 240 insertions(+) create mode 100644 tests/test_stall_control.py create mode 100644 tests/test_stall_control/Makefile create mode 100644 tests/test_stall_control/src/main.xc diff --git a/tests/test_control_basic_set.py b/tests/test_control_basic_set.py index fa269d5c..589c9e85 100644 --- a/tests/test_control_basic_set.py +++ b/tests/test_control_basic_set.py @@ -18,6 +18,7 @@ PARAMS = deepcopy(PARAMS) PARAMS["default"].update({"ep": [0]}) PARAMS["smoke"].update({"ep": [0]}) +PARAMS["extended"].update({"ep": [0]}) @pytest.fixture diff --git a/tests/test_stall_control.py b/tests/test_stall_control.py new file mode 100644 index 00000000..6fac9f28 --- /dev/null +++ b/tests/test_stall_control.py @@ -0,0 +1,157 @@ +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. +from usb_packet import ( + TokenPacket, + TxDataPacket, + RxDataPacket, + TxHandshakePacket, + RxHandshakePacket, + USB_PID, +) +from usb_session import UsbSession +from usb_transaction import UsbTransaction +import pytest +from conftest import PARAMS, test_RunUsbSession +from copy import deepcopy + +# Only test on EP 0 - Update params +PARAMS = deepcopy(PARAMS) +PARAMS["default"].update({"ep": [0]}) +PARAMS["smoke"].update({"ep": [0]}) +PARAMS["extended"].update({"ep": [0]}) + + +@pytest.fixture +def test_session(ep, address, bus_speed, dummy_threads): + + ied = 500 + pktLength = 10 + + session = UsbSession( + bus_speed=bus_speed, run_enumeration=False, device_address=address + ) + + #### Ctrl transaction 0 + + # SETUP transaction + session.add_event( + TokenPacket( + pid=USB_PID["SETUP"], + address=address, + endpoint=ep, + ) + ) + session.add_event( + TxDataPacket( + dataPayload=session.getPayload_out(ep, 8), + pid=USB_PID["DATA0"], + ) + ) + session.add_event(RxHandshakePacket()) + + # OUT transaction + # Note, quite big gap to avoid nak + session.add_event( + TokenPacket( + pid=USB_PID["OUT"], + address=address, + endpoint=ep, + interEventDelay=10000, + ) + ) + session.add_event( + TxDataPacket( + dataPayload=session.getPayload_out(ep, 10), + pid=USB_PID["DATA1"], + ) + ) + session.add_event(RxHandshakePacket()) + + # Expect 0 length IN transaction + session.add_event( + TokenPacket( + pid=USB_PID["IN"], address=address, endpoint=ep, interEventDelay=ied + ) + ) + session.add_event(RxDataPacket(dataPayload=[], pid=USB_PID["DATA1"])) + session.add_event(TxHandshakePacket()) + + #### Ctrl transaction 1 + + # SETUP transaction + session.add_event( + TokenPacket( + pid=USB_PID["SETUP"], + address=address, + endpoint=ep, + interEventDelay=10000, + ) + ) + session.add_event( + TxDataPacket( + dataPayload=session.getPayload_out(ep, 8), + pid=USB_PID["DATA0"], + ) + ) + session.add_event(RxHandshakePacket()) + + # Check that the EP is now Halted + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="IN", + dataLength=pktLength, + halted=True, + interEventDelay=1000, + ) + ) + + #### Ctrl transaction 2 + + # SETUP transaction + session.add_event( + TokenPacket( + pid=USB_PID["SETUP"], + address=address, + endpoint=ep, + interEventDelay=10000, + ) + ) + session.add_event( + TxDataPacket( + dataPayload=session.getPayload_out(ep, 8), + pid=USB_PID["DATA0"], + ) + ) + session.add_event(RxHandshakePacket()) + + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="IN", + dataLength=pktLength, + halted=False, + interEventDelay=1000, + ) + ) + + session.add_event( + UsbTransaction( + session, + deviceAddress=address, + endpointNumber=ep, + endpointType="BULK", + direction="OUT", + dataLength=0, + halted=False, + interEventDelay=1000, + ) + ) + + return session diff --git a/tests/test_stall_control/Makefile b/tests/test_stall_control/Makefile new file mode 100644 index 00000000..a2c9ee98 --- /dev/null +++ b/tests/test_stall_control/Makefile @@ -0,0 +1,3 @@ +TEST_FLAGS = -DXUD_BYPASS_RESET=1 + +include ../test_makefile.mak diff --git a/tests/test_stall_control/src/main.xc b/tests/test_stall_control/src/main.xc new file mode 100644 index 00000000..72541d00 --- /dev/null +++ b/tests/test_stall_control/src/main.xc @@ -0,0 +1,79 @@ +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. +#include "shared.h" + +#define EP_COUNT_OUT (5) +#define EP_COUNT_IN (5) + +/* Endpoint type tables */ +XUD_EpType epTypeTableOut[EP_COUNT_OUT] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; +XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL, XUD_EPTYPE_BUL, XUD_EPTYPE_ISO, XUD_EPTYPE_BUL, XUD_EPTYPE_BUL}; + +int TestEp_Control(XUD_ep ep0_out, XUD_ep ep0_in, int epNum) +{ + unsigned int slength; + unsigned int length; + + XUD_Result_t sres; + XUD_Result_t res; + + unsigned char sbuffer[120]; + unsigned char buffer[120]; + + /* Wait for Setup data */ + sres = XUD_GetSetupBuffer(ep0_out, sbuffer, slength); + + res = XUD_GetBuffer(ep0_out, buffer, length); + + res = SendTxPacket(ep0_in, 0, epNum); + + /* Checking for the Setup */ + if(sres != XUD_RES_OKAY) + { + return 1; + } + + if(RxDataCheck(sbuffer, slength, epNum, 8)) + { + return 1; + } + + /* Checking for the OUT buffer */ + if(res != XUD_RES_OKAY) + { + return 1; + } + + if(RxDataCheck(buffer, length, epNum, 10)) + { + return 1; + } + + sres = XUD_GetSetupBuffer(ep0_out, sbuffer, slength); + + /* Stall the EP(s) as if the request was not recognised */ + XUD_SetStall(ep0_out); + XUD_SetStall(ep0_in); + + /* Check that EP is un-Halted on a SETUP */ + sres = XUD_GetSetupBuffer(ep0_out, sbuffer, slength); + + res = SendTxPacket(ep0_in, 10, epNum); + + res = XUD_GetBuffer(ep0_out, buffer, length); + + return 0; +} + +unsigned test_func(chanend c_ep_out[EP_COUNT_OUT], chanend c_ep_in[EP_COUNT_IN]) +{ + XUD_ep ep0_out = XUD_InitEp(c_ep_out[0]); + XUD_ep ep0_in = XUD_InitEp(c_ep_in[0]); + + unsigned failed = TestEp_Control(ep0_out, ep0_in, 0); + + XUD_Kill(ep0_out); + + return failed; +} +#include "test_main.xc" From 093fc8972b7f3311b4596f157409ab7c7e3e33b3 Mon Sep 17 00:00:00 2001 From: xross Date: Mon, 12 Jul 2021 17:07:36 +0100 Subject: [PATCH 502/520] Fix for issue #227 (Also fixes to test) --- lib_xud/src/core/included/XUD_Token_Setup_DI.S | 9 +++++---- tests/test_stall_control.py | 6 ++++-- tests/usb_session.py | 16 ++++++++++++++-- tests/usb_transaction.py | 5 ++++- 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/lib_xud/src/core/included/XUD_Token_Setup_DI.S b/lib_xud/src/core/included/XUD_Token_Setup_DI.S index 4f6a03bf..fbd72316 100644 --- a/lib_xud/src/core/included/XUD_Token_Setup_DI.S +++ b/lib_xud/src/core/included/XUD_Token_Setup_DI.S @@ -24,16 +24,18 @@ ClearStall: // CRC OK ldaw r11, dp[handshakeTable_OUT] // Note, we can speed this up by assuming SETUP only received on EP 0 ldc r6, USB_PIDn_NAK stw r6, r11[r10] - ldaw r11, dp[handshakeTable_IN] + {ldw r11, sp[STACK_HANDSHAKETABLEIN] + ldc r1, 0} stw r6, r11[r10] + ldaw r11, dp[g_stallTable_IN] + stw r1, r11[r10] SendSetupAck: ldc r11, USB_PIDn_ACK outpw res[TXD], r11, 8 StoreTailData: // TODO: don't assume setups are 8 bytes + crc - ldc r11, 0 - stw r11, r5[r10] // Clear ready + stw r1, r5[r10] // Clear ready ldw r11, r3[1] // Load chanend out res[r11], r4 @@ -41,7 +43,6 @@ StoreTailData: // TODO: don't assume setups are bu NextTokenAfterOut // Go to next wait for next token SBuffFull: - ldc r11, 0 ldw r10, sp[STACK_RXA_PORT] // Load RxA Port ID (r1) in r11, res[r10] // RXA event cond = 0 TODO: Wait for RXA high first? endin r11, res[RXD] diff --git a/tests/test_stall_control.py b/tests/test_stall_control.py index 6fac9f28..1705dd42 100644 --- a/tests/test_stall_control.py +++ b/tests/test_stall_control.py @@ -101,7 +101,7 @@ def test_session(ep, address, bus_speed, dummy_threads): session, deviceAddress=address, endpointNumber=ep, - endpointType="BULK", + endpointType="CONTROL", direction="IN", dataLength=pktLength, halted=True, @@ -133,11 +133,12 @@ def test_session(ep, address, bus_speed, dummy_threads): session, deviceAddress=address, endpointNumber=ep, - endpointType="BULK", + endpointType="CONTROL", direction="IN", dataLength=pktLength, halted=False, interEventDelay=1000, + resetDataPid=True, ) ) @@ -151,6 +152,7 @@ def test_session(ep, address, bus_speed, dummy_threads): dataLength=0, halted=False, interEventDelay=1000, + resetDataPid=True, ) ) diff --git a/tests/usb_session.py b/tests/usb_session.py index a1852944..dcc789dd 100644 --- a/tests/usb_session.py +++ b/tests/usb_session.py @@ -85,13 +85,25 @@ def _pid_toggle(self, pid_table, n): else: pid_table[n] = usb_packet.USB_PID["DATA0"] - def data_pid_in(self, n, togglePid=True): + def data_pid_in(self, n, togglePid=True, resetDataPid=False): + + if resetDataPid: + self._pidTable_in[n] = usb_packet.USB_PID["DATA1"] + pid = self._pidTable_in[n] + return pid + pid = self._pidTable_in[n] if togglePid: self._pid_toggle(self._pidTable_in, n) return pid - def data_pid_out(self, n, togglePid=True): + def data_pid_out(self, n, togglePid=True, resetDataPid=False): + + if resetDataPid: + self._pidTable_out[n] = usb_packet.USB_PID["DATA1"] + pid = self._pidTable_out[n] + return pid + pid = self._pidTable_out[n] if togglePid: self._pid_toggle(self._pidTable_out, n) diff --git a/tests/usb_transaction.py b/tests/usb_transaction.py index 1e2992e2..7bfdbd5d 100644 --- a/tests/usb_transaction.py +++ b/tests/usb_transaction.py @@ -34,6 +34,7 @@ def __init__( resend=False, rxeAssertDelay_data=0, halted=False, + resetDataPid=False, ): # TODO Enums when we move to py3 self._deviceAddress = deviceAddress @@ -97,7 +98,9 @@ def __init__( endpointNumber, dataLength, resend=resend ) - pid = session.data_pid_out(endpointNumber, togglePid=togglePid) + pid = session.data_pid_out( + endpointNumber, togglePid=togglePid, resetDataPid=resetDataPid + ) # Add data packet to packets list packets.append( From 9c0d4a4b476818fe026a30c5f5717f94a2e46907 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 13 Jul 2021 10:47:43 +0100 Subject: [PATCH 503/520] Fix for #231 --- tests/test_control_basic_get.py | 4 ++-- tests/test_control_basic_set.py | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/test_control_basic_get.py b/tests/test_control_basic_get.py index 86cb4b1c..57f40c2a 100644 --- a/tests/test_control_basic_get.py +++ b/tests/test_control_basic_get.py @@ -16,8 +16,8 @@ # Only test on EP 0 - Update params PARAMS = deepcopy(PARAMS) -PARAMS["default"].update({"ep": [0]}) -PARAMS["smoke"].update({"ep": [0]}) +for k in PARAMS: + PARAMS[k].update({"ep": [0]}) @pytest.fixture diff --git a/tests/test_control_basic_set.py b/tests/test_control_basic_set.py index 589c9e85..b34ae639 100644 --- a/tests/test_control_basic_set.py +++ b/tests/test_control_basic_set.py @@ -16,9 +16,8 @@ # Only test on EP 0 - Update params PARAMS = deepcopy(PARAMS) -PARAMS["default"].update({"ep": [0]}) -PARAMS["smoke"].update({"ep": [0]}) -PARAMS["extended"].update({"ep": [0]}) +for k in PARAMS: + PARAMS[k].update({"ep": [0]}) @pytest.fixture From 436ef7de46eb28bad7b24ca8f1bc8573b84bd2da Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 13 Jul 2021 11:57:22 +0100 Subject: [PATCH 504/520] Removed some extra licence files --- tests/test_control_basic_get/LICENSE.rst | 84 ------------------------ tests/test_control_basic_set/LICENSE.rst | 84 ------------------------ 2 files changed, 168 deletions(-) delete mode 100644 tests/test_control_basic_get/LICENSE.rst delete mode 100644 tests/test_control_basic_set/LICENSE.rst diff --git a/tests/test_control_basic_get/LICENSE.rst b/tests/test_control_basic_get/LICENSE.rst deleted file mode 100644 index ca48f20f..00000000 --- a/tests/test_control_basic_get/LICENSE.rst +++ /dev/null @@ -1,84 +0,0 @@ -******************************* -XMOS PUBLIC LICENCE: Version 1 -******************************* - -Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. - -**1. Definitions** - -**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. - -**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. - -**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. - -**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. - -**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. - -**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. - -This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. - - -**2. Licence** - -**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: - -2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: - -2.1.1 for personal or academic, non-commercial purposes; or - -2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): - -(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and - -(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). - -The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. - -2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: - -2.2.1 for personal or academic, non-commercial purposes; or - -2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): - -(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; - -(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and - -(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. - -Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. - -2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. - -**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. - -**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. - -**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. - -**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. - -**7. IPR and Ownership** -Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** - -Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). -Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. - -**8. Termination** - -8.1 This Licence will automatically terminate immediately, without notice to you, if: - -(a) you fail to comply with the terms of this Licence; and/or - -(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or - -(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. - -**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. - -**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. - -**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_control_basic_set/LICENSE.rst b/tests/test_control_basic_set/LICENSE.rst deleted file mode 100644 index ca48f20f..00000000 --- a/tests/test_control_basic_set/LICENSE.rst +++ /dev/null @@ -1,84 +0,0 @@ -******************************* -XMOS PUBLIC LICENCE: Version 1 -******************************* - -Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. - -**1. Definitions** - -**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. - -**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. - -**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. - -**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. - -**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. - -**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. - -This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. - - -**2. Licence** - -**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: - -2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: - -2.1.1 for personal or academic, non-commercial purposes; or - -2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): - -(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and - -(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). - -The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. - -2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: - -2.2.1 for personal or academic, non-commercial purposes; or - -2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): - -(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; - -(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and - -(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. - -Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. - -2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. - -**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. - -**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. - -**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. - -**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. - -**7. IPR and Ownership** -Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** - -Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). -Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. - -**8. Termination** - -8.1 This Licence will automatically terminate immediately, without notice to you, if: - -(a) you fail to comply with the terms of this Licence; and/or - -(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or - -(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. - -**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. - -**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. - -**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. From 0c79ac0e1a126ceca1c20b52d0e135044fc81039 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 13 Jul 2021 12:12:04 +0100 Subject: [PATCH 505/520] Removed extra licence files --- tests/test_bulk_rx_basic/LICENSE.rst | 84 ------------------- tests/test_bulk_rx_basic_badcrc32/LICENSE.rst | 84 ------------------- tests/test_bulk_rx_basic_badpid/LICENSE.rst | 84 ------------------- tests/test_bulk_rx_basic_nodata/LICENSE.rst | 84 ------------------- tests/test_bulk_rx_basic_rxerror/LICENSE.rst | 84 ------------------- tests/test_bulk_rx_multiep/LICENSE.rst | 84 ------------------- tests/test_bulk_rx_traffic/LICENSE.rst | 84 ------------------- tests/test_bulk_tx_badack/LICENSE.rst | 84 ------------------- tests/test_bulk_tx_basic/LICENSE.rst | 84 ------------------- tests/test_bulk_tx_basic_short/LICENSE.rst | 84 ------------------- tests/test_bulk_tx_multiep/LICENSE.rst | 84 ------------------- tests/test_control_basic_badcrc32/LICENSE.rst | 84 ------------------- tests/test_control_basic_short/LICENSE.rst | 84 ------------------- tests/test_control_repeatedsetup/LICENSE.rst | 84 ------------------- tests/test_invalidtoken/LICENSE.rst | 84 ------------------- tests/test_iso_loopback/LICENSE.rst | 84 ------------------- tests/test_iso_rx_basic/LICENSE.rst | 84 ------------------- tests/test_iso_rxtx_fastpacket/LICENSE.rst | 84 ------------------- tests/test_iso_tx_basic/LICENSE.rst | 84 ------------------- tests/test_ping_rx_basic/LICENSE.rst | 84 ------------------- tests/test_shorttoken/LICENSE.rst | 84 ------------------- tests/test_sof_badcrc/LICENSE.rst | 84 ------------------- tests/test_sof_basic/LICENSE.rst | 84 ------------------- 23 files changed, 1932 deletions(-) delete mode 100644 tests/test_bulk_rx_basic/LICENSE.rst delete mode 100644 tests/test_bulk_rx_basic_badcrc32/LICENSE.rst delete mode 100644 tests/test_bulk_rx_basic_badpid/LICENSE.rst delete mode 100644 tests/test_bulk_rx_basic_nodata/LICENSE.rst delete mode 100644 tests/test_bulk_rx_basic_rxerror/LICENSE.rst delete mode 100644 tests/test_bulk_rx_multiep/LICENSE.rst delete mode 100644 tests/test_bulk_rx_traffic/LICENSE.rst delete mode 100644 tests/test_bulk_tx_badack/LICENSE.rst delete mode 100644 tests/test_bulk_tx_basic/LICENSE.rst delete mode 100644 tests/test_bulk_tx_basic_short/LICENSE.rst delete mode 100644 tests/test_bulk_tx_multiep/LICENSE.rst delete mode 100644 tests/test_control_basic_badcrc32/LICENSE.rst delete mode 100644 tests/test_control_basic_short/LICENSE.rst delete mode 100644 tests/test_control_repeatedsetup/LICENSE.rst delete mode 100644 tests/test_invalidtoken/LICENSE.rst delete mode 100644 tests/test_iso_loopback/LICENSE.rst delete mode 100644 tests/test_iso_rx_basic/LICENSE.rst delete mode 100644 tests/test_iso_rxtx_fastpacket/LICENSE.rst delete mode 100644 tests/test_iso_tx_basic/LICENSE.rst delete mode 100644 tests/test_ping_rx_basic/LICENSE.rst delete mode 100644 tests/test_shorttoken/LICENSE.rst delete mode 100644 tests/test_sof_badcrc/LICENSE.rst delete mode 100644 tests/test_sof_basic/LICENSE.rst diff --git a/tests/test_bulk_rx_basic/LICENSE.rst b/tests/test_bulk_rx_basic/LICENSE.rst deleted file mode 100644 index ca48f20f..00000000 --- a/tests/test_bulk_rx_basic/LICENSE.rst +++ /dev/null @@ -1,84 +0,0 @@ -******************************* -XMOS PUBLIC LICENCE: Version 1 -******************************* - -Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. - -**1. Definitions** - -**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. - -**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. - -**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. - -**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. - -**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. - -**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. - -This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. - - -**2. Licence** - -**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: - -2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: - -2.1.1 for personal or academic, non-commercial purposes; or - -2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): - -(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and - -(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). - -The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. - -2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: - -2.2.1 for personal or academic, non-commercial purposes; or - -2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): - -(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; - -(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and - -(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. - -Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. - -2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. - -**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. - -**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. - -**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. - -**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. - -**7. IPR and Ownership** -Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** - -Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). -Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. - -**8. Termination** - -8.1 This Licence will automatically terminate immediately, without notice to you, if: - -(a) you fail to comply with the terms of this Licence; and/or - -(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or - -(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. - -**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. - -**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. - -**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_bulk_rx_basic_badcrc32/LICENSE.rst b/tests/test_bulk_rx_basic_badcrc32/LICENSE.rst deleted file mode 100644 index ca48f20f..00000000 --- a/tests/test_bulk_rx_basic_badcrc32/LICENSE.rst +++ /dev/null @@ -1,84 +0,0 @@ -******************************* -XMOS PUBLIC LICENCE: Version 1 -******************************* - -Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. - -**1. Definitions** - -**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. - -**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. - -**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. - -**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. - -**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. - -**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. - -This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. - - -**2. Licence** - -**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: - -2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: - -2.1.1 for personal or academic, non-commercial purposes; or - -2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): - -(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and - -(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). - -The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. - -2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: - -2.2.1 for personal or academic, non-commercial purposes; or - -2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): - -(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; - -(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and - -(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. - -Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. - -2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. - -**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. - -**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. - -**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. - -**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. - -**7. IPR and Ownership** -Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** - -Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). -Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. - -**8. Termination** - -8.1 This Licence will automatically terminate immediately, without notice to you, if: - -(a) you fail to comply with the terms of this Licence; and/or - -(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or - -(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. - -**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. - -**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. - -**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_bulk_rx_basic_badpid/LICENSE.rst b/tests/test_bulk_rx_basic_badpid/LICENSE.rst deleted file mode 100644 index ca48f20f..00000000 --- a/tests/test_bulk_rx_basic_badpid/LICENSE.rst +++ /dev/null @@ -1,84 +0,0 @@ -******************************* -XMOS PUBLIC LICENCE: Version 1 -******************************* - -Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. - -**1. Definitions** - -**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. - -**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. - -**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. - -**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. - -**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. - -**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. - -This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. - - -**2. Licence** - -**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: - -2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: - -2.1.1 for personal or academic, non-commercial purposes; or - -2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): - -(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and - -(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). - -The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. - -2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: - -2.2.1 for personal or academic, non-commercial purposes; or - -2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): - -(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; - -(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and - -(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. - -Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. - -2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. - -**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. - -**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. - -**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. - -**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. - -**7. IPR and Ownership** -Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** - -Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). -Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. - -**8. Termination** - -8.1 This Licence will automatically terminate immediately, without notice to you, if: - -(a) you fail to comply with the terms of this Licence; and/or - -(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or - -(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. - -**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. - -**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. - -**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_bulk_rx_basic_nodata/LICENSE.rst b/tests/test_bulk_rx_basic_nodata/LICENSE.rst deleted file mode 100644 index ca48f20f..00000000 --- a/tests/test_bulk_rx_basic_nodata/LICENSE.rst +++ /dev/null @@ -1,84 +0,0 @@ -******************************* -XMOS PUBLIC LICENCE: Version 1 -******************************* - -Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. - -**1. Definitions** - -**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. - -**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. - -**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. - -**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. - -**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. - -**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. - -This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. - - -**2. Licence** - -**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: - -2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: - -2.1.1 for personal or academic, non-commercial purposes; or - -2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): - -(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and - -(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). - -The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. - -2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: - -2.2.1 for personal or academic, non-commercial purposes; or - -2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): - -(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; - -(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and - -(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. - -Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. - -2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. - -**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. - -**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. - -**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. - -**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. - -**7. IPR and Ownership** -Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** - -Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). -Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. - -**8. Termination** - -8.1 This Licence will automatically terminate immediately, without notice to you, if: - -(a) you fail to comply with the terms of this Licence; and/or - -(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or - -(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. - -**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. - -**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. - -**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_bulk_rx_basic_rxerror/LICENSE.rst b/tests/test_bulk_rx_basic_rxerror/LICENSE.rst deleted file mode 100644 index ca48f20f..00000000 --- a/tests/test_bulk_rx_basic_rxerror/LICENSE.rst +++ /dev/null @@ -1,84 +0,0 @@ -******************************* -XMOS PUBLIC LICENCE: Version 1 -******************************* - -Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. - -**1. Definitions** - -**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. - -**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. - -**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. - -**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. - -**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. - -**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. - -This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. - - -**2. Licence** - -**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: - -2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: - -2.1.1 for personal or academic, non-commercial purposes; or - -2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): - -(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and - -(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). - -The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. - -2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: - -2.2.1 for personal or academic, non-commercial purposes; or - -2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): - -(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; - -(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and - -(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. - -Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. - -2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. - -**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. - -**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. - -**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. - -**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. - -**7. IPR and Ownership** -Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** - -Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). -Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. - -**8. Termination** - -8.1 This Licence will automatically terminate immediately, without notice to you, if: - -(a) you fail to comply with the terms of this Licence; and/or - -(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or - -(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. - -**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. - -**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. - -**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_bulk_rx_multiep/LICENSE.rst b/tests/test_bulk_rx_multiep/LICENSE.rst deleted file mode 100644 index ca48f20f..00000000 --- a/tests/test_bulk_rx_multiep/LICENSE.rst +++ /dev/null @@ -1,84 +0,0 @@ -******************************* -XMOS PUBLIC LICENCE: Version 1 -******************************* - -Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. - -**1. Definitions** - -**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. - -**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. - -**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. - -**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. - -**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. - -**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. - -This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. - - -**2. Licence** - -**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: - -2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: - -2.1.1 for personal or academic, non-commercial purposes; or - -2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): - -(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and - -(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). - -The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. - -2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: - -2.2.1 for personal or academic, non-commercial purposes; or - -2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): - -(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; - -(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and - -(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. - -Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. - -2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. - -**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. - -**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. - -**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. - -**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. - -**7. IPR and Ownership** -Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** - -Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). -Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. - -**8. Termination** - -8.1 This Licence will automatically terminate immediately, without notice to you, if: - -(a) you fail to comply with the terms of this Licence; and/or - -(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or - -(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. - -**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. - -**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. - -**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_bulk_rx_traffic/LICENSE.rst b/tests/test_bulk_rx_traffic/LICENSE.rst deleted file mode 100644 index ca48f20f..00000000 --- a/tests/test_bulk_rx_traffic/LICENSE.rst +++ /dev/null @@ -1,84 +0,0 @@ -******************************* -XMOS PUBLIC LICENCE: Version 1 -******************************* - -Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. - -**1. Definitions** - -**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. - -**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. - -**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. - -**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. - -**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. - -**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. - -This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. - - -**2. Licence** - -**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: - -2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: - -2.1.1 for personal or academic, non-commercial purposes; or - -2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): - -(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and - -(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). - -The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. - -2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: - -2.2.1 for personal or academic, non-commercial purposes; or - -2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): - -(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; - -(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and - -(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. - -Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. - -2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. - -**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. - -**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. - -**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. - -**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. - -**7. IPR and Ownership** -Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** - -Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). -Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. - -**8. Termination** - -8.1 This Licence will automatically terminate immediately, without notice to you, if: - -(a) you fail to comply with the terms of this Licence; and/or - -(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or - -(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. - -**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. - -**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. - -**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_bulk_tx_badack/LICENSE.rst b/tests/test_bulk_tx_badack/LICENSE.rst deleted file mode 100644 index ca48f20f..00000000 --- a/tests/test_bulk_tx_badack/LICENSE.rst +++ /dev/null @@ -1,84 +0,0 @@ -******************************* -XMOS PUBLIC LICENCE: Version 1 -******************************* - -Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. - -**1. Definitions** - -**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. - -**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. - -**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. - -**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. - -**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. - -**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. - -This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. - - -**2. Licence** - -**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: - -2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: - -2.1.1 for personal or academic, non-commercial purposes; or - -2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): - -(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and - -(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). - -The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. - -2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: - -2.2.1 for personal or academic, non-commercial purposes; or - -2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): - -(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; - -(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and - -(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. - -Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. - -2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. - -**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. - -**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. - -**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. - -**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. - -**7. IPR and Ownership** -Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** - -Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). -Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. - -**8. Termination** - -8.1 This Licence will automatically terminate immediately, without notice to you, if: - -(a) you fail to comply with the terms of this Licence; and/or - -(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or - -(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. - -**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. - -**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. - -**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_bulk_tx_basic/LICENSE.rst b/tests/test_bulk_tx_basic/LICENSE.rst deleted file mode 100644 index ca48f20f..00000000 --- a/tests/test_bulk_tx_basic/LICENSE.rst +++ /dev/null @@ -1,84 +0,0 @@ -******************************* -XMOS PUBLIC LICENCE: Version 1 -******************************* - -Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. - -**1. Definitions** - -**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. - -**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. - -**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. - -**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. - -**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. - -**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. - -This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. - - -**2. Licence** - -**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: - -2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: - -2.1.1 for personal or academic, non-commercial purposes; or - -2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): - -(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and - -(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). - -The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. - -2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: - -2.2.1 for personal or academic, non-commercial purposes; or - -2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): - -(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; - -(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and - -(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. - -Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. - -2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. - -**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. - -**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. - -**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. - -**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. - -**7. IPR and Ownership** -Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** - -Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). -Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. - -**8. Termination** - -8.1 This Licence will automatically terminate immediately, without notice to you, if: - -(a) you fail to comply with the terms of this Licence; and/or - -(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or - -(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. - -**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. - -**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. - -**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_bulk_tx_basic_short/LICENSE.rst b/tests/test_bulk_tx_basic_short/LICENSE.rst deleted file mode 100644 index ca48f20f..00000000 --- a/tests/test_bulk_tx_basic_short/LICENSE.rst +++ /dev/null @@ -1,84 +0,0 @@ -******************************* -XMOS PUBLIC LICENCE: Version 1 -******************************* - -Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. - -**1. Definitions** - -**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. - -**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. - -**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. - -**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. - -**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. - -**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. - -This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. - - -**2. Licence** - -**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: - -2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: - -2.1.1 for personal or academic, non-commercial purposes; or - -2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): - -(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and - -(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). - -The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. - -2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: - -2.2.1 for personal or academic, non-commercial purposes; or - -2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): - -(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; - -(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and - -(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. - -Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. - -2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. - -**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. - -**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. - -**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. - -**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. - -**7. IPR and Ownership** -Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** - -Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). -Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. - -**8. Termination** - -8.1 This Licence will automatically terminate immediately, without notice to you, if: - -(a) you fail to comply with the terms of this Licence; and/or - -(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or - -(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. - -**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. - -**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. - -**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_bulk_tx_multiep/LICENSE.rst b/tests/test_bulk_tx_multiep/LICENSE.rst deleted file mode 100644 index ca48f20f..00000000 --- a/tests/test_bulk_tx_multiep/LICENSE.rst +++ /dev/null @@ -1,84 +0,0 @@ -******************************* -XMOS PUBLIC LICENCE: Version 1 -******************************* - -Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. - -**1. Definitions** - -**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. - -**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. - -**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. - -**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. - -**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. - -**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. - -This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. - - -**2. Licence** - -**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: - -2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: - -2.1.1 for personal or academic, non-commercial purposes; or - -2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): - -(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and - -(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). - -The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. - -2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: - -2.2.1 for personal or academic, non-commercial purposes; or - -2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): - -(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; - -(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and - -(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. - -Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. - -2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. - -**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. - -**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. - -**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. - -**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. - -**7. IPR and Ownership** -Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** - -Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). -Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. - -**8. Termination** - -8.1 This Licence will automatically terminate immediately, without notice to you, if: - -(a) you fail to comply with the terms of this Licence; and/or - -(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or - -(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. - -**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. - -**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. - -**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_control_basic_badcrc32/LICENSE.rst b/tests/test_control_basic_badcrc32/LICENSE.rst deleted file mode 100644 index ca48f20f..00000000 --- a/tests/test_control_basic_badcrc32/LICENSE.rst +++ /dev/null @@ -1,84 +0,0 @@ -******************************* -XMOS PUBLIC LICENCE: Version 1 -******************************* - -Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. - -**1. Definitions** - -**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. - -**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. - -**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. - -**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. - -**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. - -**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. - -This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. - - -**2. Licence** - -**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: - -2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: - -2.1.1 for personal or academic, non-commercial purposes; or - -2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): - -(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and - -(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). - -The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. - -2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: - -2.2.1 for personal or academic, non-commercial purposes; or - -2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): - -(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; - -(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and - -(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. - -Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. - -2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. - -**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. - -**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. - -**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. - -**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. - -**7. IPR and Ownership** -Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** - -Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). -Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. - -**8. Termination** - -8.1 This Licence will automatically terminate immediately, without notice to you, if: - -(a) you fail to comply with the terms of this Licence; and/or - -(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or - -(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. - -**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. - -**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. - -**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_control_basic_short/LICENSE.rst b/tests/test_control_basic_short/LICENSE.rst deleted file mode 100644 index ca48f20f..00000000 --- a/tests/test_control_basic_short/LICENSE.rst +++ /dev/null @@ -1,84 +0,0 @@ -******************************* -XMOS PUBLIC LICENCE: Version 1 -******************************* - -Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. - -**1. Definitions** - -**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. - -**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. - -**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. - -**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. - -**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. - -**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. - -This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. - - -**2. Licence** - -**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: - -2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: - -2.1.1 for personal or academic, non-commercial purposes; or - -2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): - -(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and - -(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). - -The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. - -2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: - -2.2.1 for personal or academic, non-commercial purposes; or - -2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): - -(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; - -(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and - -(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. - -Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. - -2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. - -**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. - -**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. - -**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. - -**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. - -**7. IPR and Ownership** -Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** - -Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). -Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. - -**8. Termination** - -8.1 This Licence will automatically terminate immediately, without notice to you, if: - -(a) you fail to comply with the terms of this Licence; and/or - -(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or - -(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. - -**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. - -**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. - -**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_control_repeatedsetup/LICENSE.rst b/tests/test_control_repeatedsetup/LICENSE.rst deleted file mode 100644 index ca48f20f..00000000 --- a/tests/test_control_repeatedsetup/LICENSE.rst +++ /dev/null @@ -1,84 +0,0 @@ -******************************* -XMOS PUBLIC LICENCE: Version 1 -******************************* - -Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. - -**1. Definitions** - -**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. - -**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. - -**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. - -**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. - -**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. - -**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. - -This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. - - -**2. Licence** - -**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: - -2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: - -2.1.1 for personal or academic, non-commercial purposes; or - -2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): - -(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and - -(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). - -The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. - -2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: - -2.2.1 for personal or academic, non-commercial purposes; or - -2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): - -(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; - -(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and - -(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. - -Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. - -2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. - -**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. - -**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. - -**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. - -**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. - -**7. IPR and Ownership** -Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** - -Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). -Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. - -**8. Termination** - -8.1 This Licence will automatically terminate immediately, without notice to you, if: - -(a) you fail to comply with the terms of this Licence; and/or - -(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or - -(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. - -**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. - -**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. - -**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_invalidtoken/LICENSE.rst b/tests/test_invalidtoken/LICENSE.rst deleted file mode 100644 index ca48f20f..00000000 --- a/tests/test_invalidtoken/LICENSE.rst +++ /dev/null @@ -1,84 +0,0 @@ -******************************* -XMOS PUBLIC LICENCE: Version 1 -******************************* - -Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. - -**1. Definitions** - -**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. - -**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. - -**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. - -**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. - -**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. - -**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. - -This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. - - -**2. Licence** - -**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: - -2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: - -2.1.1 for personal or academic, non-commercial purposes; or - -2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): - -(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and - -(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). - -The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. - -2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: - -2.2.1 for personal or academic, non-commercial purposes; or - -2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): - -(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; - -(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and - -(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. - -Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. - -2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. - -**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. - -**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. - -**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. - -**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. - -**7. IPR and Ownership** -Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** - -Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). -Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. - -**8. Termination** - -8.1 This Licence will automatically terminate immediately, without notice to you, if: - -(a) you fail to comply with the terms of this Licence; and/or - -(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or - -(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. - -**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. - -**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. - -**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_iso_loopback/LICENSE.rst b/tests/test_iso_loopback/LICENSE.rst deleted file mode 100644 index ca48f20f..00000000 --- a/tests/test_iso_loopback/LICENSE.rst +++ /dev/null @@ -1,84 +0,0 @@ -******************************* -XMOS PUBLIC LICENCE: Version 1 -******************************* - -Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. - -**1. Definitions** - -**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. - -**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. - -**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. - -**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. - -**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. - -**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. - -This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. - - -**2. Licence** - -**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: - -2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: - -2.1.1 for personal or academic, non-commercial purposes; or - -2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): - -(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and - -(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). - -The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. - -2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: - -2.2.1 for personal or academic, non-commercial purposes; or - -2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): - -(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; - -(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and - -(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. - -Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. - -2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. - -**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. - -**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. - -**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. - -**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. - -**7. IPR and Ownership** -Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** - -Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). -Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. - -**8. Termination** - -8.1 This Licence will automatically terminate immediately, without notice to you, if: - -(a) you fail to comply with the terms of this Licence; and/or - -(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or - -(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. - -**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. - -**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. - -**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_iso_rx_basic/LICENSE.rst b/tests/test_iso_rx_basic/LICENSE.rst deleted file mode 100644 index ca48f20f..00000000 --- a/tests/test_iso_rx_basic/LICENSE.rst +++ /dev/null @@ -1,84 +0,0 @@ -******************************* -XMOS PUBLIC LICENCE: Version 1 -******************************* - -Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. - -**1. Definitions** - -**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. - -**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. - -**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. - -**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. - -**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. - -**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. - -This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. - - -**2. Licence** - -**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: - -2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: - -2.1.1 for personal or academic, non-commercial purposes; or - -2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): - -(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and - -(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). - -The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. - -2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: - -2.2.1 for personal or academic, non-commercial purposes; or - -2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): - -(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; - -(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and - -(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. - -Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. - -2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. - -**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. - -**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. - -**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. - -**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. - -**7. IPR and Ownership** -Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** - -Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). -Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. - -**8. Termination** - -8.1 This Licence will automatically terminate immediately, without notice to you, if: - -(a) you fail to comply with the terms of this Licence; and/or - -(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or - -(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. - -**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. - -**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. - -**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_iso_rxtx_fastpacket/LICENSE.rst b/tests/test_iso_rxtx_fastpacket/LICENSE.rst deleted file mode 100644 index ca48f20f..00000000 --- a/tests/test_iso_rxtx_fastpacket/LICENSE.rst +++ /dev/null @@ -1,84 +0,0 @@ -******************************* -XMOS PUBLIC LICENCE: Version 1 -******************************* - -Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. - -**1. Definitions** - -**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. - -**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. - -**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. - -**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. - -**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. - -**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. - -This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. - - -**2. Licence** - -**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: - -2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: - -2.1.1 for personal or academic, non-commercial purposes; or - -2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): - -(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and - -(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). - -The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. - -2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: - -2.2.1 for personal or academic, non-commercial purposes; or - -2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): - -(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; - -(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and - -(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. - -Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. - -2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. - -**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. - -**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. - -**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. - -**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. - -**7. IPR and Ownership** -Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** - -Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). -Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. - -**8. Termination** - -8.1 This Licence will automatically terminate immediately, without notice to you, if: - -(a) you fail to comply with the terms of this Licence; and/or - -(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or - -(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. - -**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. - -**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. - -**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_iso_tx_basic/LICENSE.rst b/tests/test_iso_tx_basic/LICENSE.rst deleted file mode 100644 index ca48f20f..00000000 --- a/tests/test_iso_tx_basic/LICENSE.rst +++ /dev/null @@ -1,84 +0,0 @@ -******************************* -XMOS PUBLIC LICENCE: Version 1 -******************************* - -Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. - -**1. Definitions** - -**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. - -**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. - -**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. - -**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. - -**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. - -**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. - -This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. - - -**2. Licence** - -**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: - -2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: - -2.1.1 for personal or academic, non-commercial purposes; or - -2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): - -(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and - -(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). - -The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. - -2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: - -2.2.1 for personal or academic, non-commercial purposes; or - -2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): - -(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; - -(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and - -(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. - -Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. - -2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. - -**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. - -**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. - -**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. - -**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. - -**7. IPR and Ownership** -Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** - -Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). -Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. - -**8. Termination** - -8.1 This Licence will automatically terminate immediately, without notice to you, if: - -(a) you fail to comply with the terms of this Licence; and/or - -(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or - -(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. - -**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. - -**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. - -**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_ping_rx_basic/LICENSE.rst b/tests/test_ping_rx_basic/LICENSE.rst deleted file mode 100644 index ca48f20f..00000000 --- a/tests/test_ping_rx_basic/LICENSE.rst +++ /dev/null @@ -1,84 +0,0 @@ -******************************* -XMOS PUBLIC LICENCE: Version 1 -******************************* - -Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. - -**1. Definitions** - -**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. - -**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. - -**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. - -**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. - -**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. - -**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. - -This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. - - -**2. Licence** - -**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: - -2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: - -2.1.1 for personal or academic, non-commercial purposes; or - -2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): - -(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and - -(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). - -The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. - -2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: - -2.2.1 for personal or academic, non-commercial purposes; or - -2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): - -(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; - -(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and - -(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. - -Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. - -2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. - -**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. - -**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. - -**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. - -**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. - -**7. IPR and Ownership** -Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** - -Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). -Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. - -**8. Termination** - -8.1 This Licence will automatically terminate immediately, without notice to you, if: - -(a) you fail to comply with the terms of this Licence; and/or - -(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or - -(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. - -**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. - -**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. - -**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_shorttoken/LICENSE.rst b/tests/test_shorttoken/LICENSE.rst deleted file mode 100644 index ca48f20f..00000000 --- a/tests/test_shorttoken/LICENSE.rst +++ /dev/null @@ -1,84 +0,0 @@ -******************************* -XMOS PUBLIC LICENCE: Version 1 -******************************* - -Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. - -**1. Definitions** - -**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. - -**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. - -**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. - -**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. - -**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. - -**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. - -This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. - - -**2. Licence** - -**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: - -2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: - -2.1.1 for personal or academic, non-commercial purposes; or - -2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): - -(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and - -(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). - -The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. - -2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: - -2.2.1 for personal or academic, non-commercial purposes; or - -2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): - -(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; - -(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and - -(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. - -Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. - -2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. - -**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. - -**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. - -**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. - -**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. - -**7. IPR and Ownership** -Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** - -Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). -Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. - -**8. Termination** - -8.1 This Licence will automatically terminate immediately, without notice to you, if: - -(a) you fail to comply with the terms of this Licence; and/or - -(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or - -(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. - -**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. - -**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. - -**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_sof_badcrc/LICENSE.rst b/tests/test_sof_badcrc/LICENSE.rst deleted file mode 100644 index ca48f20f..00000000 --- a/tests/test_sof_badcrc/LICENSE.rst +++ /dev/null @@ -1,84 +0,0 @@ -******************************* -XMOS PUBLIC LICENCE: Version 1 -******************************* - -Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. - -**1. Definitions** - -**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. - -**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. - -**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. - -**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. - -**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. - -**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. - -This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. - - -**2. Licence** - -**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: - -2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: - -2.1.1 for personal or academic, non-commercial purposes; or - -2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): - -(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and - -(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). - -The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. - -2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: - -2.2.1 for personal or academic, non-commercial purposes; or - -2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): - -(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; - -(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and - -(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. - -Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. - -2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. - -**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. - -**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. - -**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. - -**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. - -**7. IPR and Ownership** -Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** - -Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). -Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. - -**8. Termination** - -8.1 This Licence will automatically terminate immediately, without notice to you, if: - -(a) you fail to comply with the terms of this Licence; and/or - -(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or - -(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. - -**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. - -**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. - -**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. diff --git a/tests/test_sof_basic/LICENSE.rst b/tests/test_sof_basic/LICENSE.rst deleted file mode 100644 index ca48f20f..00000000 --- a/tests/test_sof_basic/LICENSE.rst +++ /dev/null @@ -1,84 +0,0 @@ -******************************* -XMOS PUBLIC LICENCE: Version 1 -******************************* - -Subject to the conditions and limitations below, permission is hereby granted by XMOS LIMITED (“XMOS”), free of charge, to any person or entity obtaining a copy of the XMOS Software. - -**1. Definitions** - -**“Applicable Patent Rights”** means: (a) where XMOS is the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to XMOS and (ii) that cover subject matter contained in the Software, but only to the extent it is necessary to use, reproduce or distribute the Software without infringement; and (b) where you are the grantor of the rights, (i) claims of patents that are now or in future owned by or assigned to you and (ii) that cover the subject matter contained in your Derivatives, taken alone or in combination with the Software. - -**“Compiled Code”** means any compiled, binary, machine readable or executable version of the Source Code. - -**“Contributor”** means any person or entity that creates or contributes to the creation of Derivatives. - -**“Derivatives”** means any addition to, deletion from and/or change to the substance, structure of the Software, any previous Derivatives, the combination of the Derivatives and the Software and/or any respective portions thereof. - -**“Source Code”** means the human readable code that is suitable for making modifications but excluding any Compiled Code. - -**“Software”** means the software and associated documentation files which XMOS makes available and which contain a notice identifying the software as original XMOS software and referring to the software being subject to the terms of this XMOS Public Licence. - -This Licence refers to XMOS Software and does not relate to any XMOS hardware or devices which are protected by intellectual property rights (including patent and trade marks) which may be sold to you under a separate agreement. - - -**2. Licence** - -**Permitted Uses, Conditions and Restrictions.** Subject to the conditions below, XMOS grants you a worldwide, royalty free, non-exclusive licence, to the extent of any Patent Rights to do the following: - -2.1 **Unmodified Software.** You may use, copy, display, publish, distribute and make available unmodified copies of the Software: - -2.1.1 for personal or academic, non-commercial purposes; or - -2.1.2 for commercial purposes provided the Software is at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.1.1 and 2.1.2): - -(a) you must retain and reproduce in all copies of the Software the copyright and proprietary notices and disclaimers of XMOS as they appear in the Software, and keep intact all notices and disclaimers in the Software files that refer to this Licence; and - -(b) you must include a copy of this Licence with every copy of the Software and documentation you publish, distribute and make available and you may not offer or impose any terms on such Software that alter or restrict this Licence or the intent of such Licence, except as permitted below (Additional Terms). - -The licence above does not include any Compiled Code which XMOS may make available under a separate support and licence agreement. - -2.2 **Derivatives.** You may create and modify Derivatives and use, copy, display, publish, distribute and make available Derivatives: - -2.2.1 for personal or academic, non-commercial purposes; or - -2.2.2 for commercial purposes, provided the Derivatives are at all times used on a device designed, licensed or developed by XMOS and, provided that in each instance (2.2.1 and 2.2.2): - -(a) you must comply with the terms of clause 2.1 with respect to the Derivatives; - -(b) you must copy (to the extent it doesn’t already exist) the notice below in each file of the Derivatives, and ensure all the modified files carry prominent notices stating that you have changed the files and the date of any change; and - -(c) if you sublicence, distribute or otherwise make the Software and/or the Derivatives available for commercial purposes, you must provide that the Software and Derivatives are at all times used on a device designed, licensed or developed by XMOS. - -Without limitation to these terms and clause 3 below, the Source Code and Compiled Code to your Derivatives may at your discretion (but without obligation) be released, copied, displayed, published, distributed and made available; and if you elect to do so, it must be under the terms of this Licence including the terms of the licence at clauses 2.2.1, 2.2.2 and clause 3 below. - -2.3 **Distribution of Executable Versions.** If you distribute or make available Derivatives, you must include a prominent notice in the code itself as well as in all related documentation, stating that the Source Code of the Software from which the Derivatives are based is available under the terms of this Licence, with information on how and where to obtain such Source Code. - -**3. Your Grant of Rights.** In consideration and as a condition to this Licence, you grant to any person or entity receiving or distributing any Derivatives, a non-exclusive, royalty free, perpetual, irrevocable license under your Applicable Patent Rights and all other intellectual property rights owned or controlled by you, to use, copy, display, publish, distribute and make available your Derivatives of the same scope and extent as XMOS’s licence under clause 2.2 above. - -**4. Combined Products.** You may create a combined product by combining Software, Derivatives and other code not covered by this Licence as a single application or product. In such instance, you must comply with the requirements of this Licence for any portion of the Software and/or Derivatives. - -**5. Additional Terms.** You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the term of this Licence (“Additional Terms”) to any legitimate recipients of the Software and/or Derivatives. The terms on which you provide such Additional Terms are on your sole responsibility and you shall indemnify, defend and hold XMOS harmless against any claims asserted against XMOS. - -**6. New Versions.** XMOS may publish revised and/or new versions of this Licence from time to time to accommodate changes to the Licence terms, new versions, updates and bug fixes of the Software. Each version will be given a distinguishing version number. Once Software has been published under a particular version of this Licence, you may continue to use it under the terms of that version. You may also choose to use the latest version of the Software under any subsequent version published by XMOS. Only XMOS shall have the right to modify these terms. - -**7. IPR and Ownership** -Any rights, including all intellectual property rights and all trademarks not expressly granted herein are reserved in full by the authors or copyright holders. Any requests for additional permissions by XMOS including any rights to use XMOS trademarks, should be made (without obligation) to XMOS at **support@xmos.com** - -Nothing herein shall limit any rights that XMOS is otherwise entitled to under the doctrines of patent exhaustion, implied license, or legal estoppel. Neither the name of the authors, the copyright holders or any contributors may be used to endorse or promote any Derivatives from this Software without specific written permission. Any attempt to deal with the Software which does not comply with this Licence shall be void and shall automatically terminate any rights granted under this licence (including any licence of any intellectual property rights granted herein). -Subject to the licences granted under this Licence any Contributor retains all rights, title and interest in and to any Derivatives made by Contributor subject to the underlying rights of XMOS in the Software. XMOS shall retain all rights, title and interest in the Software and any Derivatives made by XMOS (“XMOS Derivatives”). XMOS Derivatives will not automatically be subject to this Licence and XMOS shall be entitled to licence such rights on any terms (without obligation) as it sees fit. - -**8. Termination** - -8.1 This Licence will automatically terminate immediately, without notice to you, if: - -(a) you fail to comply with the terms of this Licence; and/or - -(b) you directly or indirectly commence any action for patent or intellectual property right infringement against XMOS, or any parent, group, affiliate or subsidiary of XMOS; provided XMOS did not first commence an action or patent infringement against you in that instance; and/or - -(c) the terms of this Licence are held by any court of competent jurisdiction to be unenforceable in whole or in part. - -**9. Critical Applications.** Unless XMOS has agreed in writing with you an agreement specifically governing use of the Goods in military, aerospace, automotive or medically related functions (collectively and individually hereinafter referred to as "Special Use"), any permitted use of the Software excludes Special Use. Notwithstanding any agreement between XMOS and you for Special Use, Special Use shall be at your own risk, and you shall fully indemnify XMOS against any damages, losses, costs and claims (direct and indirect) arising out of any Special Use. - -**10. NO WARRANTY OR SUPPORT.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL XMOS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, WARRANTY, CIVIL TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE INCLUDING GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOT WITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE. IN SOME JURISDICTIONS PARTIES ARE UNABLE TO LIMIT LIABILTY IN THIS WAY, IF THIS APPLIES TO YOUR JURISDICTION THIS LIABILITY CLAUSE ABOVE MAY NOT APPLY. NOTWITHSTANDING THE ABOVE, IN NO EVENT SHALL XMOS’s TOTAL LIABILITY TO YOU FOR ALL DAMAGES, LOSS OR OTHERWISE EXCEED $50. - -**11. Governing Law and Jurisdiction.** This Licence constitutes the entire agreement between the parties with respect to the subject matter hereof. The Licence shall be governed by the laws of England and the conflict of laws and UN Convention on Contracts for the International Sale of Goods, shall not apply. From 12ac07460414929e39bd896898320403d199580e Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 13 Jul 2021 12:12:29 +0100 Subject: [PATCH 506/520] Added test_control_traffic --- tests/test_control_traffic.py | 117 +++++++++++++++++++++++++ tests/test_control_traffic/Makefile | 3 + tests/test_control_traffic/src/main.xc | 6 ++ 3 files changed, 126 insertions(+) create mode 100644 tests/test_control_traffic.py create mode 100644 tests/test_control_traffic/Makefile create mode 100644 tests/test_control_traffic/src/main.xc diff --git a/tests/test_control_traffic.py b/tests/test_control_traffic.py new file mode 100644 index 00000000..b4238218 --- /dev/null +++ b/tests/test_control_traffic.py @@ -0,0 +1,117 @@ +# Copyright 2016-2021 XMOS LIMITED. +# This Software is subject to the terms of the XMOS Public Licence: Version 1. +from usb_packet import ( + TokenPacket, + TxDataPacket, + RxDataPacket, + TxHandshakePacket, + RxHandshakePacket, + USB_PID, +) +from usb_session import UsbSession +from usb_transaction import UsbTransaction +import pytest +from conftest import PARAMS, test_RunUsbSession +from copy import deepcopy + +# Only test on EP 0 - Update params +PARAMS = deepcopy(PARAMS) +PARAMS["default"].update({"ep": [0]}) +PARAMS["smoke"].update({"ep": [0]}) + + +@pytest.fixture +def test_session(ep, address, bus_speed): + + ied = 500 + + trafficAddress1 = (address + 1) % 128 + trafficAddress2 = (address + 127) % 128 + + session = UsbSession( + bus_speed=bus_speed, run_enumeration=False, device_address=address + ) + + # SETUP to another address (Note, DUT would not see ACK) + session.add_event( + TokenPacket( + pid=USB_PID["SETUP"], + address=trafficAddress1, + endpoint=ep, + ) + ) + session.add_event( + TxDataPacket( + dataPayload=[1, 2, 3, 4, 5, 6, 7, 8], + pid=USB_PID["DATA0"], + ) + ) + + # SETUP transaction to DUT + session.add_event( + TokenPacket( + pid=USB_PID["SETUP"], + address=address, + endpoint=ep, + ) + ) + session.add_event( + TxDataPacket( + dataPayload=session.getPayload_out(ep, 8), + pid=USB_PID["DATA0"], + ) + ) + session.add_event(RxHandshakePacket()) + + # IN transaction + # Note, quite big gap to avoid nak + session.add_event( + TokenPacket( + pid=USB_PID["IN"], + address=address, + endpoint=ep, + interEventDelay=10000, + ) + ) + session.add_event( + RxDataPacket( + dataPayload=session.getPayload_in(ep, 10), + pid=USB_PID["DATA1"], + ) + ) + session.add_event(TxHandshakePacket()) + + # SETUP to another address (Note, DUT would not see ACK) + session.add_event( + TokenPacket( + pid=USB_PID["SETUP"], + address=trafficAddress2, + endpoint=ep, + ) + ) + session.add_event( + TxDataPacket( + dataPayload=[1, 2, 3, 4, 5, 6, 7, 8], + pid=USB_PID["DATA0"], + ) + ) + + session.add_event( + TokenPacket( + pid=USB_PID["IN"], + address=trafficAddress2, + endpoint=ep, + interEventDelay=1000, + ) + ) + + # Send 0 length OUT transaction + session.add_event( + TokenPacket( + pid=USB_PID["OUT"], address=address, endpoint=ep, interEventDelay=ied + ) + ) + session.add_event(TxDataPacket(length=0, pid=USB_PID["DATA1"])) + session.add_event(RxHandshakePacket()) + + return session diff --git a/tests/test_control_traffic/Makefile b/tests/test_control_traffic/Makefile new file mode 100644 index 00000000..a2c9ee98 --- /dev/null +++ b/tests/test_control_traffic/Makefile @@ -0,0 +1,3 @@ +TEST_FLAGS = -DXUD_BYPASS_RESET=1 + +include ../test_makefile.mak diff --git a/tests/test_control_traffic/src/main.xc b/tests/test_control_traffic/src/main.xc new file mode 100644 index 00000000..46893c3f --- /dev/null +++ b/tests/test_control_traffic/src/main.xc @@ -0,0 +1,6 @@ +// Copyright 2016-2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. +#include "shared.h" + +#include "../test_control_basic_get/src/main.xc" + From b706b9a628a2ed0e90e5120d37f0a2e3013a0a2d Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 13 Jul 2021 16:10:27 +0100 Subject: [PATCH 507/520] Fixed params for test_control_traffic --- tests/test_control_traffic.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_control_traffic.py b/tests/test_control_traffic.py index b4238218..37f38ce4 100644 --- a/tests/test_control_traffic.py +++ b/tests/test_control_traffic.py @@ -16,8 +16,8 @@ # Only test on EP 0 - Update params PARAMS = deepcopy(PARAMS) -PARAMS["default"].update({"ep": [0]}) -PARAMS["smoke"].update({"ep": [0]}) +for v in PARAMS.values(): + v.update({"ep": [0]}) @pytest.fixture From 5e7a7c73849a478254a4c9f0e17acaa0499f9ed2 Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 13 Jul 2021 17:08:51 +0100 Subject: [PATCH 508/520] Add dependancies to python/setup.py --- python/setup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/setup.py b/python/setup.py index 78c9b74f..3b904ab7 100644 --- a/python/setup.py +++ b/python/setup.py @@ -13,7 +13,9 @@ name="lib_xud", packages=setuptools.find_packages(), install_requires=[ - "flake8~=3.8", + "black~=21.5", + "pytest~=6.2", + "pytest-xdist~=2.3", ], dependency_links=[], ) From 99492b069cb6ac7d5f22291220b0f08d1138ec0f Mon Sep 17 00:00:00 2001 From: xross Date: Tue, 13 Jul 2021 19:37:15 +0100 Subject: [PATCH 509/520] Attempt to fix checks --- python/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/setup.py b/python/setup.py index 3b904ab7..f75dc662 100644 --- a/python/setup.py +++ b/python/setup.py @@ -13,7 +13,7 @@ name="lib_xud", packages=setuptools.find_packages(), install_requires=[ - "black~=21.5", + "black~=21.5b1", "pytest~=6.2", "pytest-xdist~=2.3", ], From 887311f44d45b485f98a10900fb46675f3394a73 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 14 Jul 2021 10:53:16 +0100 Subject: [PATCH 510/520] Tidy AN00129 makefile --- examples/AN00129_hid_class/Makefile | 31 +++++++++++++++-------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/examples/AN00129_hid_class/Makefile b/examples/AN00129_hid_class/Makefile index 5d8ac82e..c8044941 100644 --- a/examples/AN00129_hid_class/Makefile +++ b/examples/AN00129_hid_class/Makefile @@ -1,14 +1,3 @@ -# The TARGET variable determines what target system the application is -# compiled for. It either refers to an XN file in the source directories -# or a valid argument for the --target option when compiling. - -# In this case, the target depends on the build configuration. -ifeq ($(CONFIG),X200) -TARGET = XCORE-200-EXPLORER -else -TARGET = XCORE-AI-EXPLORER-NO-DDR.xn -endif - # The APP_NAME variable determines the name of the final .xe file. It should # not include the .xe postfix. If left blank the name will default to # the project name @@ -22,15 +11,27 @@ APP_NAME = app_hid_mouse_demo # If the variable XCC_MAP_FLAGS is set it overrides the flags passed to # xcc for the final link (mapping) stage. -# These flags define two build configurations - one for U-series and one for -# the xCORE-200 series. +# These flags define two build configurations - one for xCORE-200 and one for +# the xCORE.AI series. +BUILD_FLAGS = -O3 -report -XCC_FLAGS_X200 = -O3 -report -DXUD_SERIES_SUPPORT=XUD_X200_SERIES -XCC_FLAGS_AI = -O3 -report +XCC_FLAGS_200 = $(BUILD_FLAGS) -DXUD_CORE_CLOCK=500 +XCC_FLAGS_AI = $(BUILD_FLAGS) -DXUD_CORE_CLOCK=600 # The USED_MODULES variable lists other module used by the application. USED_MODULES = lib_xud +# The TARGET variable determines what target system the application is +# compiled for. It either refers to an XN file in the source directories +# or a valid argument for the --target option when compiling. + +# In this case, the target depends on the build configuration. +ifeq ($(CONFIG),AI) +TARGET = XCORE-AI-EXPLORER +else +TARGET = XCORE-200-EXPLORER +endif + #============================================================================= # The following part of the Makefile includes the common build infrastructure # for compiling XMOS applications. You should not need to edit below here. From 62c173abd0382e099183e3f2f25afc817fc10a69 Mon Sep 17 00:00:00 2001 From: xross Date: Wed, 14 Jul 2021 11:27:46 +0100 Subject: [PATCH 511/520] Removed #warning for XS2 --- lib_xud/src/core/XUD_HAL.xc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib_xud/src/core/XUD_HAL.xc b/lib_xud/src/core/XUD_HAL.xc index 1d231c4e..8865167b 100644 --- a/lib_xud/src/core/XUD_HAL.xc +++ b/lib_xud/src/core/XUD_HAL.xc @@ -53,7 +53,6 @@ unsigned int XUD_EnableUsbPortMux(); void XUD_HAL_EnableUsb(unsigned pwrConfig) { /* For xCORE-200 enable USB port muxing before enabling phy etc */ - // TODO inline ASM here XUD_EnableUsbPortMux(); //setps(XS1_PS_XCORE_CTRL0, UIFM_MODE); #ifndef XUD_SIM_XSIM @@ -377,10 +376,10 @@ unsigned XUD_HAL_WaitForLineStateChange(XUD_LineState_t ¤tLs, unsigned tim currentLs = LinesToLineState(dp, dm); return 0; #else - #warning TODO for XS2A + //TODO XUD_HAL_WaitForLineStateChange() not implemented for XS2 + //Note, this is not currently used for XS2 return 1; #endif - } void XUD_HAL_SetDeviceAddress(unsigned char address) From eb7f80b512c4c0e44d3f743895334d3e57445a27 Mon Sep 17 00:00:00 2001 From: Dave Atkinson Date: Wed, 14 Jul 2021 18:32:15 +0100 Subject: [PATCH 512/520] HID demo fixed on linux (x86_64 & arm), tested on mac, win, and across xcore{ai,200} arches. --- examples/AN00129_hid_class/src/endpoint0.xc | 72 +++++++++------------ 1 file changed, 32 insertions(+), 40 deletions(-) diff --git a/examples/AN00129_hid_class/src/endpoint0.xc b/examples/AN00129_hid_class/src/endpoint0.xc index 6aa13dae..3f235f48 100644 --- a/examples/AN00129_hid_class/src/endpoint0.xc +++ b/examples/AN00129_hid_class/src/endpoint0.xc @@ -86,7 +86,7 @@ static unsigned char cfgDesc[] = { 0x00, /* 4 bCountryCode */ 0x01, /* 5 bNumDescriptors */ 0x22, /* 6 bDescriptorType[0] (Report) */ - 0x48, /* 7 wDescriptorLength */ + 0x32, /* 7 wDescriptorLength */ 0x00, /* 8 wDescriptorLength */ 0x07, /* 0 bLength */ @@ -95,7 +95,7 @@ static unsigned char cfgDesc[] = { 0x03, /* 3 bmAttributes */ 0x40, /* 4 wMaxPacketSize */ 0x00, /* 5 wMaxPacketSize */ - 0x01 /* 6 bInterval */ + 0x0a /* 6 bInterval */ }; static unsigned char hidDescriptor[] = @@ -107,50 +107,42 @@ static unsigned char hidDescriptor[] = 0x00, /* 4 bCountryCode */ 0x01, /* 5 bNumDescriptors */ 0x22, /* 6 bDescriptorType[0] (Report) */ - 0x48, /* 7 wDescriptorLength */ + 0x32, /* 7 wDescriptorLength */ 0x00, /* 8 wDescriptorLength */ }; /* HID Report Descriptor */ static unsigned char hidReportDescriptor[] = { - 0x05, 0x01, // Usage page (desktop) - 0x09, 0x02, // Usage (mouse) - 0xA1, 0x01, // Collection (app) - 0x05, 0x09, // Usage page (buttons) - 0x19, 0x01, - 0x29, 0x03, - 0x15, 0x00, // Logical min (0) - 0x25, 0x01, // Logical max (1) - 0x95, 0x03, // Report count (3) - 0x75, 0x01, // Report size (1) - 0x81, 0x02, // Input (Data, Absolute) - 0x95, 0x01, // Report count (1) - 0x75, 0x05, // Report size (5) - 0x81, 0x03, // Input (Absolute, Constant) - 0x05, 0x01, // Usage page (desktop) - 0x09, 0x01, // Usage (pointer) - 0xA1, 0x00, // Collection (phys) - 0x09, 0x30, // Usage (x) - 0x09, 0x31, // Usage (y) - 0x15, 0x81, // Logical min (-127) - 0x25, 0x7F, // Logical max (127) - 0x75, 0x08, // Report size (8) - 0x95, 0x02, // Report count (2) - 0x81, 0x06, // Input (Data, Rel=0x6, Abs=0x2) - 0xC0, // End collection - 0x09, 0x38, // Usage (Wheel) - 0x95, 0x01, // Report count (1) - 0x81, 0x02, // Input (Data, Relative) - 0x09, 0x3C, // Usage (Motion Wakeup) - 0x15, 0x00, // Logical min (0) - 0x25, 0x01, // Logical max (1) - 0x75, 0x01, // Report size (1) - 0x95, 0x01, // Report count (1) - 0xB1, 0x22, // Feature (No preferred, Variable) - 0x95, 0x07, // Report count (7) - 0xB1, 0x01, // Feature (Constant) - 0xC0 // End collection + 0x05, 0x01, /* Usage Page (Generic Desktop) */ + 0x09, 0x02, /* Usage (Mouse) */ + 0xA1, 0x01, /* Collection (Application) */ + 0x09, 0x01, /* Usage (Pointer) */ + 0xA1, 0x00, /* Collection (Physical) */ + 0x05, 0x09, /* Usage Page (Buttons) */ + 0x19, 0x01, /* Usage Minimum (01) */ + 0x29, 0x03, /* Usage Maximum (03) */ + 0x15, 0x00, /* Logical Minimum (0) */ + 0x25, 0x01, /* Logical Maximum (1) */ + 0x95, 0x03, /* Report Count (3) */ + 0x75, 0x01, /* Report Size (1) */ + 0x81, 0x02, /* Input (Data,Variable,Absolute); 3 button bits */ + 0x95, 0x01, /* Report Count (1) */ + 0x75, 0x05, /* Report Size (5) */ + 0x81, 0x01, /* Input(Constant); 5 bit padding */ + 0x05, 0x01, /* Usage Page (Generic Desktop) */ + 0x09, 0x30, /* Usage (X) */ + 0x09, 0x31, /* Usage (Y) */ + 0x15, 0x81, /* Logical Minimum (-127) */ + 0x25, 0x7F, /* Logical Maximum (127) */ + 0x75, 0x08, /* Report Size (8) */ + 0x95, 0x02, /* Report Count (2) */ + 0x81, 0x06, /* Input (Data,Variable,Relative); 2 position bytes (X & Y) */ + //0x95, 0x01, /* Report Count (1) */ + //0x75, 0x05, /* Report Size (8) */ + //0x81, 0x01, /* Input(Constant); 8 bit padding */ + 0xC0, /* End Collection */ + 0xC0 /* End Collection */ }; unsafe{ From c55491b28221a4a364139c867f327abd1b5aef95 Mon Sep 17 00:00:00 2001 From: Dave Atkinson Date: Wed, 14 Jul 2021 18:34:04 +0100 Subject: [PATCH 513/520] Remove commented data. --- examples/AN00129_hid_class/src/endpoint0.xc | 3 --- 1 file changed, 3 deletions(-) diff --git a/examples/AN00129_hid_class/src/endpoint0.xc b/examples/AN00129_hid_class/src/endpoint0.xc index 3f235f48..836a4457 100644 --- a/examples/AN00129_hid_class/src/endpoint0.xc +++ b/examples/AN00129_hid_class/src/endpoint0.xc @@ -138,9 +138,6 @@ static unsigned char hidReportDescriptor[] = 0x75, 0x08, /* Report Size (8) */ 0x95, 0x02, /* Report Count (2) */ 0x81, 0x06, /* Input (Data,Variable,Relative); 2 position bytes (X & Y) */ - //0x95, 0x01, /* Report Count (1) */ - //0x75, 0x05, /* Report Size (8) */ - //0x81, 0x01, /* Input(Constant); 8 bit padding */ 0xC0, /* End Collection */ 0xC0 /* End Collection */ }; From 902d4188c59a131c0ca06e55149a065668635b42 Mon Sep 17 00:00:00 2001 From: Dave Atkinson Date: Thu, 15 Jul 2021 09:29:55 +0100 Subject: [PATCH 514/520] Remove duplicate HID definitions. --- examples/AN00129_hid_class/src/endpoint0.xc | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/examples/AN00129_hid_class/src/endpoint0.xc b/examples/AN00129_hid_class/src/endpoint0.xc index 836a4457..da18beca 100644 --- a/examples/AN00129_hid_class/src/endpoint0.xc +++ b/examples/AN00129_hid_class/src/endpoint0.xc @@ -12,27 +12,6 @@ #define VENDOR_ID 0x20B1 #define PRODUCT_ID 0x1010 -/* Standard HID Request Defines */ - -/* 7. Requests */ - -/* 7.1 Standard Requests - Class Descriptor Types - High byte of wValue - * The following defines valid types of Class descriptors */ - -#define HID_HID 0x2100 -#define HID_REPORT 0x2200 -#define HID_PHYSICAL_DESCRIPTOR 0x2300 -/* 0x24 - 0x2F: Reserved */ - -/* 7.2 Class-Specific Requests - bRequest values */ -#define HID_GET_REPORT 0x01 /* Mandatory */ -#define HID_GET_IDLE 0x02 -#define HID_GET_PROTOCOL 0x03 /* Required only for boot devices */ -/* Ox04 - 0x08 reserved */ -#define HID_SET_REPORT 0x09 -#define HID_SET_IDLE 0x0A -#define HID_SET_PROTOCOL 0x0B /* Required only for boot devices */ - /* Device Descriptor */ static unsigned char devDesc[] = { From fa21dafd06dbc67e828930573e3f319640231596 Mon Sep 17 00:00:00 2001 From: Dave Atkinson Date: Thu, 15 Jul 2021 09:57:16 +0100 Subject: [PATCH 515/520] Fix hid_mouse() to send correct buffer length, and only when data has changed. --- examples/AN00129_hid_class/src/main.xc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/AN00129_hid_class/src/main.xc b/examples/AN00129_hid_class/src/main.xc index 0235a212..bb18b233 100644 --- a/examples/AN00129_hid_class/src/main.xc +++ b/examples/AN00129_hid_class/src/main.xc @@ -68,10 +68,10 @@ void hid_mouse(chanend chan_ep_hid) p_reportBuffer[2] = -40; state = 0; } - } - /* Send the buffer off to the host. Note this will return when complete */ - XUD_SetBuffer(ep_hid, (char *) p_reportBuffer, 4); + /* Send the buffer off to the host. Note this will return when complete */ + XUD_SetBuffer(ep_hid, (char *) p_reportBuffer, 3); + } } } } From 278935891ce1733240812ee1dea150565ab17a2a Mon Sep 17 00:00:00 2001 From: Dave Atkinson Date: Thu, 15 Jul 2021 09:59:33 +0100 Subject: [PATCH 516/520] Corrected code indentation. --- examples/AN00129_hid_class/src/endpoint0.xc | 8 -- examples/AN00129_hid_class/src/main.xc | 85 ++++++++++----------- 2 files changed, 42 insertions(+), 51 deletions(-) diff --git a/examples/AN00129_hid_class/src/endpoint0.xc b/examples/AN00129_hid_class/src/endpoint0.xc index da18beca..4b3f0ee3 100644 --- a/examples/AN00129_hid_class/src/endpoint0.xc +++ b/examples/AN00129_hid_class/src/endpoint0.xc @@ -295,11 +295,3 @@ void Endpoint0(chanend chan_ep0_out, chanend chan_ep0_in) } } } -//: - - - - - - - diff --git a/examples/AN00129_hid_class/src/main.xc b/examples/AN00129_hid_class/src/main.xc index bb18b233..0e410312 100644 --- a/examples/AN00129_hid_class/src/main.xc +++ b/examples/AN00129_hid_class/src/main.xc @@ -32,47 +32,47 @@ void hid_mouse(chanend chan_ep_hid) while (1) { - /* Unsafe region so we can use shared memory. */ - unsafe { - char * unsafe p_reportBuffer = g_reportBuffer; - int x; - p_reportBuffer[1] = 0; - p_reportBuffer[2] = 0; - - /* Move the pointer around in a square (relative) */ - counter++; - if (counter >= 500) - { - counter = 0; - if (state == 0) + /* Unsafe region so we can use shared memory. */ + unsafe { + char * unsafe p_reportBuffer = g_reportBuffer; + int x; + p_reportBuffer[1] = 0; + p_reportBuffer[2] = 0; + + /* Move the pointer around in a square (relative) */ + counter++; + if (counter >= 500) { - p_reportBuffer[1] = 40; - p_reportBuffer[2] = 0; - state+=1; + counter = 0; + if (state == 0) + { + p_reportBuffer[1] = 40; + p_reportBuffer[2] = 0; + state+=1; + } + else if (state == 1) + { + p_reportBuffer[1] = 0; + p_reportBuffer[2] = 40; + state+=1; + } + else if (state == 2) + { + p_reportBuffer[1] = -40; + p_reportBuffer[2] = 0; + state+=1; + } + else if (state == 3) + { + p_reportBuffer[1] = 0; + p_reportBuffer[2] = -40; + state = 0; + } + + /* Send the buffer off to the host. Note this will return when complete */ + XUD_SetBuffer(ep_hid, (char *) p_reportBuffer, 3); } - else if (state == 1) - { - p_reportBuffer[1] = 0; - p_reportBuffer[2] = 40; - state+=1; - } - else if (state == 2) - { - p_reportBuffer[1] = -40; - p_reportBuffer[2] = 0; - state+=1; - } - else if (state == 3) - { - p_reportBuffer[1] = 0; - p_reportBuffer[2] = -40; - state = 0; - } - - /* Send the buffer off to the host. Note this will return when complete */ - XUD_SetBuffer(ep_hid, (char *) p_reportBuffer, 3); } - } } } @@ -88,13 +88,12 @@ int main() par { - on tile[0]: XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, - null, epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); - - on tile[0]: Endpoint0(c_ep_out[0], c_ep_in[0]); + on tile[0]: XUD_Main(c_ep_out, EP_COUNT_OUT, c_ep_in, EP_COUNT_IN, null, + epTypeTableOut, epTypeTableIn, XUD_SPEED_HS, XUD_PWR_BUS); - on tile[0]: hid_mouse(c_ep_in[1]); + on tile[0]: Endpoint0(c_ep_out[0], c_ep_in[0]); + on tile[0]: hid_mouse(c_ep_in[1]); } return 0; From 13af8c9a581ac70606ce98a3c2da1afebfa8e269 Mon Sep 17 00:00:00 2001 From: Dave Atkinson Date: Thu, 15 Jul 2021 10:21:58 +0100 Subject: [PATCH 517/520] Refactored global buffer definition. --- examples/AN00129_hid_class/src/endpoint0.xc | 50 +++++++++++---------- examples/AN00129_hid_class/src/hid_defs.h | 9 ++++ examples/AN00129_hid_class/src/main.xc | 7 +-- 3 files changed, 40 insertions(+), 26 deletions(-) create mode 100644 examples/AN00129_hid_class/src/hid_defs.h diff --git a/examples/AN00129_hid_class/src/endpoint0.xc b/examples/AN00129_hid_class/src/endpoint0.xc index 4b3f0ee3..c0050f67 100644 --- a/examples/AN00129_hid_class/src/endpoint0.xc +++ b/examples/AN00129_hid_class/src/endpoint0.xc @@ -6,6 +6,7 @@ #include #include "xud_device.h" #include "hid.h" +#include "hid_defs.h" /* USB HID Device Product Defines */ #define BCD_DEVICE 0x1000 @@ -96,28 +97,28 @@ static unsigned char hidReportDescriptor[] = 0x05, 0x01, /* Usage Page (Generic Desktop) */ 0x09, 0x02, /* Usage (Mouse) */ 0xA1, 0x01, /* Collection (Application) */ - 0x09, 0x01, /* Usage (Pointer) */ - 0xA1, 0x00, /* Collection (Physical) */ - 0x05, 0x09, /* Usage Page (Buttons) */ - 0x19, 0x01, /* Usage Minimum (01) */ - 0x29, 0x03, /* Usage Maximum (03) */ - 0x15, 0x00, /* Logical Minimum (0) */ - 0x25, 0x01, /* Logical Maximum (1) */ - 0x95, 0x03, /* Report Count (3) */ - 0x75, 0x01, /* Report Size (1) */ - 0x81, 0x02, /* Input (Data,Variable,Absolute); 3 button bits */ - 0x95, 0x01, /* Report Count (1) */ - 0x75, 0x05, /* Report Size (5) */ - 0x81, 0x01, /* Input(Constant); 5 bit padding */ - 0x05, 0x01, /* Usage Page (Generic Desktop) */ - 0x09, 0x30, /* Usage (X) */ - 0x09, 0x31, /* Usage (Y) */ - 0x15, 0x81, /* Logical Minimum (-127) */ - 0x25, 0x7F, /* Logical Maximum (127) */ - 0x75, 0x08, /* Report Size (8) */ - 0x95, 0x02, /* Report Count (2) */ - 0x81, 0x06, /* Input (Data,Variable,Relative); 2 position bytes (X & Y) */ - 0xC0, /* End Collection */ + 0x09, 0x01, /* Usage (Pointer) */ + 0xA1, 0x00, /* Collection (Physical) */ + 0x05, 0x09, /* Usage Page (Buttons) */ + 0x19, 0x01, /* Usage Minimum (01) */ + 0x29, 0x03, /* Usage Maximum (03) */ + 0x15, 0x00, /* Logical Minimum (0) */ + 0x25, 0x01, /* Logical Maximum (1) */ + 0x95, 0x03, /* Report Count (3) */ + 0x75, 0x01, /* Report Size (1) */ + 0x81, 0x02, /* Input (Data,Variable,Absolute); 3 button bits */ + 0x95, 0x01, /* Report Count (1) */ + 0x75, 0x05, /* Report Size (5) */ + 0x81, 0x01, /* Input(Constant); 5 bit padding */ + 0x05, 0x01, /* Usage Page (Generic Desktop) */ + 0x09, 0x30, /* Usage (X) */ + 0x09, 0x31, /* Usage (Y) */ + 0x15, 0x81, /* Logical Minimum (-127) */ + 0x25, 0x7F, /* Logical Maximum (127) */ + 0x75, 0x08, /* Report Size (8) */ + 0x95, 0x02, /* Report Count (2) */ + 0x81, 0x06, /* Input (Data,Variable,Relative); 2 position bytes (X & Y) */ + 0xC0, /* End Collection */ 0xC0 /* End Collection */ }; @@ -132,7 +133,10 @@ static char * unsafe stringDescriptors[]= }; } -extern unsigned char g_reportBuffer[4]; +/* It is essential that HID_REPORT_BUFFER_SIZE, defined in hid_defs.h, matches the */ +/* infered length of the report described in hidReportDescriptor above. In this case */ +/* it is three bytes, three button bits padded to a byte, plus a byte each for X & Y */ +unsigned char g_reportBuffer[HID_REPORT_BUFFER_SIZE] = {0, 0, 0}; /* HID Class Requests */ XUD_Result_t HidInterfaceClassRequests(XUD_ep c_ep0_out, XUD_ep c_ep0_in, USB_SetupPacket_t sp) diff --git a/examples/AN00129_hid_class/src/hid_defs.h b/examples/AN00129_hid_class/src/hid_defs.h new file mode 100644 index 00000000..2867394c --- /dev/null +++ b/examples/AN00129_hid_class/src/hid_defs.h @@ -0,0 +1,9 @@ + +#ifndef HID_DEFS_H +#define HID_DEFS_H + +/* Global report buffer */ +#define HID_REPORT_BUFFER_SIZE 3 +extern char g_reportBuffer[HID_REPORT_BUFFER_SIZE]; + +#endif // HID_DEFS_H diff --git a/examples/AN00129_hid_class/src/main.xc b/examples/AN00129_hid_class/src/main.xc index 0e410312..bd356684 100644 --- a/examples/AN00129_hid_class/src/main.xc +++ b/examples/AN00129_hid_class/src/main.xc @@ -1,6 +1,7 @@ // Copyright 2015-2021 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "xud_device.h" +#include "hid_defs.h" /* Number of Endpoints used by this app */ #define EP_COUNT_OUT 1 @@ -16,7 +17,7 @@ XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL | XUD_STATUS_ENABLE, X void Endpoint0(chanend c_ep0_out, chanend c_ep0_in); /* Global report buffer, global since used by Endpoint0 core */ -unsigned char g_reportBuffer[4] = {0, 0, 0, 0}; +extern unsigned char g_reportBuffer[]; /* * This function responds to the HID requests @@ -30,7 +31,7 @@ void hid_mouse(chanend chan_ep_hid) XUD_ep ep_hid = XUD_InitEp(chan_ep_hid); - while (1) + for(;;) { /* Unsafe region so we can use shared memory. */ unsafe { @@ -70,7 +71,7 @@ void hid_mouse(chanend chan_ep_hid) } /* Send the buffer off to the host. Note this will return when complete */ - XUD_SetBuffer(ep_hid, (char *) p_reportBuffer, 3); + XUD_SetBuffer(ep_hid, (char *) p_reportBuffer, sizeof(g_reportBuffer)); } } } From 98ef49af4983feef5c4236564a11716983317a3c Mon Sep 17 00:00:00 2001 From: Dave Atkinson Date: Thu, 15 Jul 2021 10:45:38 +0100 Subject: [PATCH 518/520] Refactor hid_mouse(). * Use symbolic constants. * Reduce scope of unsafe code. --- examples/AN00129_hid_class/src/main.xc | 86 +++++++++++++------------- 1 file changed, 44 insertions(+), 42 deletions(-) diff --git a/examples/AN00129_hid_class/src/main.xc b/examples/AN00129_hid_class/src/main.xc index bd356684..439b2147 100644 --- a/examples/AN00129_hid_class/src/main.xc +++ b/examples/AN00129_hid_class/src/main.xc @@ -16,9 +16,6 @@ XUD_EpType epTypeTableIn[EP_COUNT_IN] = {XUD_EPTYPE_CTL | XUD_STATUS_ENABLE, X /* Prototype for Endpoint0 function in endpoint0.xc */ void Endpoint0(chanend c_ep0_out, chanend c_ep0_in); -/* Global report buffer, global since used by Endpoint0 core */ -extern unsigned char g_reportBuffer[]; - /* * This function responds to the HID requests * - It draws a square using the mouse moving 40 pixels in each direction @@ -26,66 +23,71 @@ extern unsigned char g_reportBuffer[]; */ void hid_mouse(chanend chan_ep_hid) { - int counter = 0; - int state = 0; - + unsigned int counter = 0; + enum {RIGHT, DOWN, LEFT, UP} state = RIGHT; + XUD_ep ep_hid = XUD_InitEp(chan_ep_hid); for(;;) { - /* Unsafe region so we can use shared memory. */ - unsafe { - char * unsafe p_reportBuffer = g_reportBuffer; + /* Move the pointer around in a square (relative) */ + if(counter++ >= 500) + { int x; - p_reportBuffer[1] = 0; - p_reportBuffer[2] = 0; + int y; + + switch(state) { + case RIGHT: + x = 40; + y = 0; + state = DOWN; + break; + + case DOWN: + x = 0; + y = 40; + state = LEFT; + break; + + case LEFT: + x = -40; + y = 0; + state = UP; + break; + + case UP: + default: + x = 0; + y = -40; + state = RIGHT; + break; + } - /* Move the pointer around in a square (relative) */ - counter++; - if (counter >= 500) - { - counter = 0; - if (state == 0) - { - p_reportBuffer[1] = 40; - p_reportBuffer[2] = 0; - state+=1; - } - else if (state == 1) - { - p_reportBuffer[1] = 0; - p_reportBuffer[2] = 40; - state+=1; - } - else if (state == 2) - { - p_reportBuffer[1] = -40; - p_reportBuffer[2] = 0; - state+=1; - } - else if (state == 3) - { - p_reportBuffer[1] = 0; - p_reportBuffer[2] = -40; - state = 0; - } + /* Unsafe region so we can use shared memory. */ + unsafe { + /* global buffer 'g_reportBuffer' defined in hid_defs.h */ + char * unsafe p_reportBuffer = g_reportBuffer; + + p_reportBuffer[1] = x; + p_reportBuffer[2] = y; /* Send the buffer off to the host. Note this will return when complete */ XUD_SetBuffer(ep_hid, (char *) p_reportBuffer, sizeof(g_reportBuffer)); + counter = 0; } } } } - /* The main function runs three cores: the XUD manager, Endpoint 0, and a HID endpoint. An array of * channels is used for both IN and OUT endpoints, endpoint zero requires both, HID requires just an * IN endpoint to send HID reports to the host. */ int main() { - chan c_ep_out[EP_COUNT_OUT], c_ep_in[EP_COUNT_IN]; + chan c_ep_out[EP_COUNT_OUT]; + chan c_ep_in[EP_COUNT_IN]; par { From 345eae9087dc518aeeb5a1a15400ac91a41191c1 Mon Sep 17 00:00:00 2001 From: Dave Atkinson Date: Thu, 15 Jul 2021 11:05:40 +0100 Subject: [PATCH 519/520] Update copyright info in hid_defs.h. --- examples/AN00129_hid_class/src/hid_defs.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/AN00129_hid_class/src/hid_defs.h b/examples/AN00129_hid_class/src/hid_defs.h index 2867394c..d246a16e 100644 --- a/examples/AN00129_hid_class/src/hid_defs.h +++ b/examples/AN00129_hid_class/src/hid_defs.h @@ -1,4 +1,9 @@ +// Copyright 2021 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. +/* + * @brief Defines shared data for HID example threads. + */ #ifndef HID_DEFS_H #define HID_DEFS_H From 87859dfe9b95bb98296b527167971fa7d4fa91d2 Mon Sep 17 00:00:00 2001 From: Dave Atkinson Date: Thu, 15 Jul 2021 14:30:51 +0100 Subject: [PATCH 520/520] Fix incorrect line references in .rst file. --- examples/AN00129_hid_class/doc/rst/AN00129.rst | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/examples/AN00129_hid_class/doc/rst/AN00129.rst b/examples/AN00129_hid_class/doc/rst/AN00129.rst index fadec4df..18582b7e 100644 --- a/examples/AN00129_hid_class/doc/rst/AN00129.rst +++ b/examples/AN00129_hid_class/doc/rst/AN00129.rst @@ -70,15 +70,9 @@ To start using the USB library, you need to add ``lib_xud`` to your ``Makefile`` USED_MODULES = ... lib_xud -You also have to add a define to the build to say which variant of the -USB library you want. In this case, the example is for the U-Series -USB library. So the following is in the ``Makefile``:: +You can then access the USB functions in your source code via the xud_device.h header file:: - XCC_FLAGS = ... -DXUD_SERIES_SUPPORT=XUD_U_SERIES - -You can then access the USB functions in your source code via the usb.h header file:: - - #include + #include "xud_device.h" The application main() function ............................... @@ -197,7 +191,7 @@ USB HID Class requests Inside ``endpoint0.xc`` there is a function for handling the USB HID device class specific requests. The code for handling these requests is shown as follows: .. literalinclude:: endpoint0.xc - :lines: 167-224 + :lines: 142-198 These HID specific requests are implemented by the application as they do not form part of the standard requests which have to be accepted by all device classes via endpoint0. @@ -209,7 +203,7 @@ USB HID Class Endpoint0 The function ``Endpoint0()`` contains the code for dealing with device requests made from the host to the standard endpoint0 which is present in all USB devices. In addition to requests required for all devices, the code handles the requests specific to the HID class. .. literalinclude:: endpoint0.xc - :lines: 260-306 + :lines: 201-301 |newpage| @@ -219,7 +213,7 @@ Reporting HID mouse data to the host The application endpoint for reporting mouse movement data to the host machine is implemented in the file ``main.xc``. This is contained within the function ``hid_mouse()`` which is shown below: .. literalinclude:: main.xc - :lines: 22-81 + :lines: 24-80 From this you can see the following.