diff --git a/tests/test_sync/src/debug_conf.h b/tests/test_sync/src/debug_conf.h deleted file mode 100644 index aadb0014..00000000 --- a/tests/test_sync/src/debug_conf.h +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2016-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__ - -#define DEBUG_PRINT_ENABLE_MAIN 1 -#define DEBUG_PRINT_ENABLE_AUDIO_IO 0 - -#endif // __debug_conf_h__ diff --git a/tests/test_sync/src/usb_device.h b/tests/test_sync/src/usb_device.h deleted file mode 100644 index 1f5aaa89..00000000 --- a/tests/test_sync/src/usb_device.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2016-2021 XMOS LIMITED. -// This Software is subject to the terms of the XMOS Public Licence: Version 1. -#ifndef __usb_device_h__ -#define __usb_device_h__ - -#include -#include -#include "usb_std_requests.h" -#include "xud.h" - -XUD_Result_t USB_GetSetupPacket(XUD_ep ep_out, XUD_ep ep_in, REFERENCE_PARAM(USB_SetupPacket_t, sp)); - -XUD_Result_t USB_StandardRequests(XUD_ep ep_out, XUD_ep ep_in, - NULLABLE_ARRAY_OF(unsigned char, devDesc_hs), int devDescLength_hs, - NULLABLE_ARRAY_OF(unsigned char, cfgDesc_hs), int cfgDescLength_hs, - NULLABLE_ARRAY_OF(unsigned char, devDesc_fs), int devDescLength_fs, - NULLABLE_ARRAY_OF(unsigned char, cfgDesc_fs), int cfgDescLength_fs, -#ifdef __XC__ - char * unsafe strDescs[], -#else - char * strDescs[], -#endif - int strDescsLength, REFERENCE_PARAM(USB_SetupPacket_t, sp), XUD_BusSpeed_t usbBusSpeed); - -#endif // __usb_device_h__ diff --git a/tests/test_sync.py b/tests/test_sync_clk_basic.py similarity index 95% rename from tests/test_sync.py rename to tests/test_sync_clk_basic.py index 45c9ae22..1b01b049 100644 --- a/tests/test_sync.py +++ b/tests/test_sync_clk_basic.py @@ -42,7 +42,7 @@ def do_test(test_file, options, capfd): return result -def test_sync(test_file, options, capfd): +def test_sync_clk_basic(test_file, options, capfd): result = do_test(test_file, options, capfd) diff --git a/tests/test_sync/Makefile b/tests/test_sync_clk_basic/Makefile similarity index 62% rename from tests/test_sync/Makefile rename to tests/test_sync_clk_basic/Makefile index e175efba..274573d6 100644 --- a/tests/test_sync/Makefile +++ b/tests/test_sync_clk_basic/Makefile @@ -1,9 +1,11 @@ -XCC_FLAGS = -O3 -g -DXUD_CORE_CLOCK=600 -save-temps -DUSB_TILE=tile[0] -DLOCAL_CLOCK_INCREMENT=10000 -DLOCAL_CLOCK_MARGIN=100 +TEST_FLAGS ?= + +XCC_FLAGS = -O3 -g -DXUD_CORE_CLOCK=600 -save-temps -DUSB_TILE=tile[0] -DLOCAL_CLOCK_INCREMENT=10000 -DLOCAL_CLOCK_MARGIN=100 $(TEST_FLAGS) TARGET = test_xs3_600.xn -USED_MODULES = lib_xua lib_xud lib_logging +USED_MODULES = lib_xua XMOS_MAKE_PATH ?= ../.. -include $(XMOS_MAKE_PATH)/xcommon/module_xcommon/build/Makefile.common diff --git a/tests/test_sync/src/main.xc b/tests/test_sync_clk_basic/src/main.xc similarity index 91% rename from tests/test_sync/src/main.xc rename to tests/test_sync_clk_basic/src/main.xc index 12c6509d..65864421 100644 --- a/tests/test_sync/src/main.xc +++ b/tests/test_sync_clk_basic/src/main.xc @@ -15,7 +15,7 @@ out port p_pll_ref = XS1_PORT_1A; in port p_off_mclk = XS1_PORT_1M; -in port p_pll_loop = XS1_PORT_1B; +in port p_pll_loop = XS1_PORT_1B; /* Note, this is externally looped back using the loopback plugin */ /* Purely for debug/viewing on VCD */ out port p_test = XS1_PORT_1C; @@ -23,6 +23,10 @@ out port p_test = XS1_PORT_1C; /* To speed this test up we divide all delays by 10. This is also the case for the delays in the clock generation code */ #define SOF_PERIOD_TICKS (12500/10) +#ifndef MISSING_SOFS +#define MISSING SOFS (8) +#endif + void exit(int); void delay(unsigned d) @@ -74,11 +78,13 @@ void fake_xud(chanend c_out[], chanend c_in[], chanend c_sof) SetupEndpoints(c_out, EP_COUNT_OUT, c_in, EP_COUNT_IN, epTypeTableOut, epTypeTableIn); - driveSofs(c_sof, 24); + driveSofs(c_sof, 32); p_test <: 0; + /* Sim missing SOFs */ - delay(SOF_PERIOD_TICKS*8); + delay(SOF_PERIOD_TICKS*MISSING_SOFS); + p_test <: 1; driveSofs(c_sof, 16); @@ -112,6 +118,7 @@ void checker() int period = t1-t0; + /* Check the period of the reference clock we are generating */ if(period > (EXPECTED_PERIOD + MARGIN)) { printstr("Period too long: "); diff --git a/tests/test_sync/src/test_xs3_600.xn b/tests/test_sync_clk_basic/src/test_xs3_600.xn similarity index 100% rename from tests/test_sync/src/test_xs3_600.xn rename to tests/test_sync_clk_basic/src/test_xs3_600.xn diff --git a/tests/test_sync/src/xua_conf.h b/tests/test_sync_clk_basic/src/xua_conf.h similarity index 100% rename from tests/test_sync/src/xua_conf.h rename to tests/test_sync_clk_basic/src/xua_conf.h diff --git a/tests/test_sync_clk_plugin.py b/tests/test_sync_clk_plugin.py new file mode 100644 index 00000000..628484e8 --- /dev/null +++ b/tests/test_sync_clk_plugin.py @@ -0,0 +1,19 @@ +import pytest +import Pyxsim +from Pyxsim import testers +import os +import sys + +from test_sync_clk_basic import do_test + +@pytest.fixture() +def test_file(request): + return str(request.node.fspath) + +def test_sync_clk_plugin(test_file, options, capfd): + + #pytest.xfail("This is a known failure due to issue #275") + + result = do_test(test_file, options, capfd) + + assert result diff --git a/tests/test_sync_clk_plugin/Makefile b/tests/test_sync_clk_plugin/Makefile new file mode 100644 index 00000000..e02143c8 --- /dev/null +++ b/tests/test_sync_clk_plugin/Makefile @@ -0,0 +1,3 @@ +TEST_FLAGS = -DMISSING_SOFS=4 + +include ../test_sync_clk_basic/Makefile diff --git a/tests/test_sync_clk_plugin/src/main.xc b/tests/test_sync_clk_plugin/src/main.xc new file mode 100644 index 00000000..b968732b --- /dev/null +++ b/tests/test_sync_clk_plugin/src/main.xc @@ -0,0 +1,2 @@ + +#include "../test_sync_clk_basic/src/main.xc" diff --git a/tests/test_sync_clk_plugin/src/test_xs3_600.xn b/tests/test_sync_clk_plugin/src/test_xs3_600.xn new file mode 100644 index 00000000..20e8eeb6 --- /dev/null +++ b/tests/test_sync_clk_plugin/src/test_xs3_600.xn @@ -0,0 +1,24 @@ + + + + tileref tile[2] + + + + + + + + + + + + + + + + + + diff --git a/tests/test_sync_clk_plugin/src/xua_conf.h b/tests/test_sync_clk_plugin/src/xua_conf.h new file mode 100644 index 00000000..616262b7 --- /dev/null +++ b/tests/test_sync_clk_plugin/src/xua_conf.h @@ -0,0 +1,44 @@ +// Copyright 2016-2022 XMOS LIMITED. +// This Software is subject to the terms of the XMOS Public Licence: Version 1. +#ifndef _XUA_CONF_H_ +#define _XUA_CONF_H_ + +#define NUM_USB_CHAN_OUT (2) +#define NUM_USB_CHAN_IN (2) +#define I2S_CHANS_DAC (2) +#define I2S_CHANS_ADC (2) + +#define XUA_SYNCMODE XUA_SYNCMODE_SYNC +#define UAC_FORCE_FEEDBACK_EP (0) + +#define EXCLUDE_USB_AUDIO_MAIN +#define XUA_NUM_PDM_MICS 0 +#define XUD_TILE 1 +#define AUDIO_IO_TILE 0 +#define MIXER 0 + +#ifndef MCLK_441 +#define MCLK_441 (512 * 44100) +#endif + +#ifndef MCLK_48 +#define MCLK_48 (512 * 48000) +#endif + +#define MIN_FREQ (44100) +#define MAX_FREQ (192000) +#define SPDIF_TX_INDEX 0 +#define VENDOR_STR "XMOS" +#define VENDOR_ID 0x20B1 +#define PRODUCT_STR_A2 "Test device" +#define PRODUCT_STR_A1 "Test device" +#define PID_AUDIO_1 1 +#define PID_AUDIO_2 2 +#define AUDIO_CLASS 2 +#define AUDIO_CLASS_FALLBACK 0 +#define BCD_DEVICE 0x1234 +#define XUA_DFU_EN 0 +#define MIC_DUAL_ENABLED 1 //Use single thread, dual PDM mic +#define XUA_MIC_FRAME_SIZE 240 + +#endif