From 7c8e64ee87c8d19616b5538a30414d34d7355deb Mon Sep 17 00:00:00 2001 From: Ross Owen Date: Tue, 1 Jul 2014 16:03:06 +0100 Subject: [PATCH 1/2] Addition of XUD_PWR_CFG define (required for role-switch) --- module_usb_audio/devicedefines.h | 8 ++++++++ module_usb_audio/main.xc | 10 ++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/module_usb_audio/devicedefines.h b/module_usb_audio/devicedefines.h index ba69ec1c..0edeecf0 100644 --- a/module_usb_audio/devicedefines.h +++ b/module_usb_audio/devicedefines.h @@ -769,6 +769,14 @@ #endif #endif +#ifndef XUD_PWR_CFG + #ifdef SELF_POWERED + #define XUD_PWR_CFG XUD_PWR_SELF + #else + #define XUD_PWR_CFG XUD_PWR_BUS + #endif +#endif + /* Mixer defines */ /** diff --git a/module_usb_audio/main.xc b/module_usb_audio/main.xc index 5559f4ad..6ef44601 100755 --- a/module_usb_audio/main.xc +++ b/module_usb_audio/main.xc @@ -224,12 +224,6 @@ void xscope_user_init() } #endif -#ifdef SELF_POWERED -#define pwrConfig XUD_PWR_SELF -#else -#define pwrConfig XUD_PWR_BUS -#endif - /* Core USB Audio functions - must be called on the Tile connected to the USB Phy */ void usb_audio_core(chanend c_mix_out #ifdef MIDI @@ -262,11 +256,11 @@ void usb_audio_core(chanend c_mix_out #if (AUDIO_CLASS==2) XUD_Manager(c_xud_out, ENDPOINT_COUNT_OUT, c_xud_in, ENDPOINT_COUNT_IN, c_sof, epTypeTableOut, epTypeTableIn, p_usb_rst, - clk, 1, XUD_SPEED_HS, pwrConfig); + clk, 1, XUD_SPEED_HS, XUD_PWR_CFG); #else XUD_Manager(c_xud_out, ENDPOINT_COUNT_OUT, c_xud_in, ENDPOINT_COUNT_IN, c_sof, epTypeTableOut, epTypeTableIn, p_usb_rst, - clk, 1, XUD_SPEED_FS, pwrConfig); + clk, 1, XUD_SPEED_FS, XUD_PWR_CFG); #endif /* USB Packet buffering Core */ From 97987767b27ea2b263e29da1b6d8190406433d5e Mon Sep 17 00:00:00 2001 From: ed-xmos Date: Wed, 9 Jul 2014 14:55:08 +0100 Subject: [PATCH 2/2] Fix to ensure port clocking clock block is 0 to avoid lockup on DSD->PCM mode --- module_usb_audio/ports/audioports.xc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/module_usb_audio/ports/audioports.xc b/module_usb_audio/ports/audioports.xc index 28e0a77a..147da417 100644 --- a/module_usb_audio/ports/audioports.xc +++ b/module_usb_audio/ports/audioports.xc @@ -35,6 +35,18 @@ unsigned int divide) /* Note this call to stop_clock() will pause forever if the port clocking the clock-block is not low. * deliver() should return with this being the case */ + /* get the port id of the clock block source and set it to zero */ + { + unsigned clockResId; + unsigned portResId; + asm("add %0, %1, %2": "=r"(clockResId):"r"(clk_audio_bclk), "r"(0)); + portResId = getps(clockResId | (XS1_RES_PS_CLKSRC << 4) ); + if(portResId != 1) + asm("out res[%0], %1":: "r"(portResId), "r"(0)); + } + + + stop_clock(clk_audio_bclk); if(!isnull(p_lrclk))