From 0b5ddbd85e5413d0cf10fd69fdab21a678bea5e0 Mon Sep 17 00:00:00 2001 From: Keith Au Date: Wed, 19 Feb 2020 16:52:52 +0800 Subject: [PATCH 1/5] fixed typo of comments --- lib_xua/src/core/endpoint0/xua_endpoint0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index 18ae1ee6..cce5a9c9 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -352,7 +352,7 @@ void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioCont cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME] = get_usb_to_device_bit_res() >> 3; //sub frame rate = bit rate /8 cfgDesc_Audio1[USB_AS_OUT_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME + 1] = (get_usb_to_device_bit_res() & 0xff); //bit resolution - const unsigned num_of_usb_descriptor_freq=3; //This should be =3 according to the comments "sing a value of <=2 or > 7 for num_freqs_a1 causes enumeration issues on Windows" in xua_ep0_descriptors.h + const unsigned num_of_usb_descriptor_freq=3; //This should be =3 according to the comments "using a value of <=2 or > 7 for num_freqs_a1 causes enumeration issues on Windows" in xua_ep0_descriptors.h int i=0; for(i=0;i Date: Fri, 28 Feb 2020 10:48:46 +0800 Subject: [PATCH 2/5] changed define name USB_DESCRIPTOR_OVERRIDE_RATE_RES to XUA_USB_DESCRIPTOR_OVERWRITE_RATE_RES --- lib_xua/src/core/buffer/decouple/decouple.xc | 4 ++-- lib_xua/src/core/endpoint0/xua_endpoint0.c | 4 ++-- lib_xua/src/core/endpoint0/xua_ep0_descriptors.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib_xua/src/core/buffer/decouple/decouple.xc b/lib_xua/src/core/buffer/decouple/decouple.xc index b6dffe51..d501ad9f 100644 --- a/lib_xua/src/core/buffer/decouple/decouple.xc +++ b/lib_xua/src/core/buffer/decouple/decouple.xc @@ -17,7 +17,7 @@ #endif #define MAX(x,y) ((x)>(y) ? (x) : (y)) -#if(defined USB_DESCRIPTOR_OVERRIDE_RATE_RES) +#if(defined XUA_USB_DESCRIPTOR_OVERWRITE_RATE_RES) extern uint32_t get_usb_to_device_rate(); extern uint32_t get_device_to_usb_rate(); extern uint32_t get_usb_to_device_bit_res(); @@ -165,7 +165,7 @@ int g_maxPacketSize = MAX_DEVICE_AUD_PACKET_SIZE_IN_FS; void handle_audio_request(chanend c_mix_out) { int space_left; -#if(defined USB_DESCRIPTOR_OVERRIDE_RATE_RES) +#if(defined XUA_USB_DESCRIPTOR_OVERWRITE_RATE_RES) g_curSubSlot_Out = get_usb_to_device_bit_res() >> 3; g_curSubSlot_In = get_device_to_usb_bit_res() >> 3; #endif diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index cce5a9c9..972f4a61 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -65,7 +65,7 @@ extern void device_reboot(void); #include "xua_hid.h" #endif -#if(defined USB_DESCRIPTOR_OVERRIDE_RATE_RES) +#if(defined XUA_USB_DESCRIPTOR_OVERWRITE_RATE_RES) extern uint32_t get_usb_to_device_rate(); extern uint32_t get_device_to_usb_rate(); extern uint32_t get_usb_to_device_bit_res(); @@ -344,7 +344,7 @@ void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioCont } #endif -#ifdef USB_DESCRIPTOR_OVERRIDE_RATE_RES //change USB descriptor frequencies and bit resolution values here +#ifdef XUA_USB_DESCRIPTOR_OVERWRITE_RATE_RES //change USB descriptor frequencies and bit resolution values here cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME] = get_device_to_usb_bit_res() >> 3; //sub frame rate = bit rate /8 cfgDesc_Audio1[USB_AS_IN_INTERFACE_DESCRIPTOR_OFFSET_SUB_FRAME + 1] = (get_device_to_usb_bit_res() & 0xff); //bit resolution diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index c66c6dba..5e51b3dd 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -2367,7 +2367,7 @@ const unsigned num_freqs_a1 = MAX(3, (0 #define CFG_TOTAL_LENGTH_A1 (18 + AC_TOTAL_LENGTH + (INPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + (OUTPUT_INTERFACES_A1 * (49 + num_freqs_a1 * 3)) + CONTROL_INTERFACE_BYTES + DFU_INTERFACE_BYTES + HID_INTERFACE_BYTES) #endif -#ifdef USB_DESCRIPTOR_OVERRIDE_RATE_RES +#ifdef XUA_USB_DESCRIPTOR_OVERWRITE_RATE_RES #define AS_INTERFACE_BYTES (7) #define INTERFACE_DESCRIPTOR_BYTES (9) #define AS_FORMAT_TYPE_BYTES (17) From d3f2220be48d1a4a7b2b90316dd78237b3f2a6c6 Mon Sep 17 00:00:00 2001 From: Keith Au Date: Fri, 28 Feb 2020 15:53:27 +0800 Subject: [PATCH 3/5] added xua_api.h for extern declaration of get/set_usb_to/from_device_rate/res APIs and removed from c/xc files --- lib_xua/api/xua_api.h | 18 ++++++++++++++++++ lib_xua/src/core/buffer/decouple/decouple.xc | 7 +------ lib_xua/src/core/endpoint0/xua_endpoint0.c | 9 ++------- 3 files changed, 21 insertions(+), 13 deletions(-) create mode 100644 lib_xua/api/xua_api.h diff --git a/lib_xua/api/xua_api.h b/lib_xua/api/xua_api.h new file mode 100644 index 00000000..f3d3c735 --- /dev/null +++ b/lib_xua/api/xua_api.h @@ -0,0 +1,18 @@ +// Copyright (c) 2017-2020, XMOS Ltd, All rights reserved + +#ifndef __XUA_API_H__ +#define __XUA_API_H__ + +#if __XC__ +extern void set_usb_to_device_rate(uint32_t rate); +extern void set_device_to_usb_rate(uint32_t rate); +extern void set_usb_to_device_bit_res(uint32_t rate); +extern void set_device_to_usb_bit_res(uint32_t rate); +#endif + +extern uint32_t get_usb_to_device_rate(); +extern uint32_t get_device_to_usb_rate(); +extern uint32_t get_usb_to_device_bit_res(); +extern uint32_t get_device_to_usb_bit_res(); + +#endif //__XUA_API_H__ diff --git a/lib_xua/src/core/buffer/decouple/decouple.xc b/lib_xua/src/core/buffer/decouple/decouple.xc index d501ad9f..ae6d8ed5 100644 --- a/lib_xua/src/core/buffer/decouple/decouple.xc +++ b/lib_xua/src/core/buffer/decouple/decouple.xc @@ -7,6 +7,7 @@ #include "interrupt.h" #include "xua_commands.h" #include "xud.h" +#include "xua_api.h" #ifdef NATIVE_DSD #include "usbaudio20.h" /* Defines from the USB Audio 2.0 Specifications */ @@ -17,12 +18,6 @@ #endif #define MAX(x,y) ((x)>(y) ? (x) : (y)) -#if(defined XUA_USB_DESCRIPTOR_OVERWRITE_RATE_RES) -extern uint32_t get_usb_to_device_rate(); -extern uint32_t get_device_to_usb_rate(); -extern uint32_t get_usb_to_device_bit_res(); -extern uint32_t get_device_to_usb_bit_res(); -#endif /* TODO use SLOTSIZE to potentially save memory */ /* Note we could improve on this, for one subslot is set to 4 */ diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index 972f4a61..0a5dbcac 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -29,6 +29,8 @@ #include "dsd_support.h" #endif +#include "xua_api.h" + #ifndef __XC__ /* Support for xCORE channels in C */ #define null 0 @@ -65,13 +67,6 @@ extern void device_reboot(void); #include "xua_hid.h" #endif -#if(defined XUA_USB_DESCRIPTOR_OVERWRITE_RATE_RES) -extern uint32_t get_usb_to_device_rate(); -extern uint32_t get_device_to_usb_rate(); -extern uint32_t get_usb_to_device_bit_res(); -extern uint32_t get_device_to_usb_bit_res(); -#endif - unsigned int DFU_mode_active = 0; // 0 - App active, 1 - DFU active /* Global volume and mute tables */ From dbaf66fdb286e8d35a49fb9ae6d604ed3bae61e3 Mon Sep 17 00:00:00 2001 From: Keith Au Date: Fri, 28 Feb 2020 17:08:58 +0800 Subject: [PATCH 4/5] removed #if XC check --- lib_xua/api/xua_api.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib_xua/api/xua_api.h b/lib_xua/api/xua_api.h index f3d3c735..460c4008 100644 --- a/lib_xua/api/xua_api.h +++ b/lib_xua/api/xua_api.h @@ -3,12 +3,10 @@ #ifndef __XUA_API_H__ #define __XUA_API_H__ -#if __XC__ extern void set_usb_to_device_rate(uint32_t rate); extern void set_device_to_usb_rate(uint32_t rate); extern void set_usb_to_device_bit_res(uint32_t rate); extern void set_device_to_usb_bit_res(uint32_t rate); -#endif extern uint32_t get_usb_to_device_rate(); extern uint32_t get_device_to_usb_rate(); From cd8e46308f802befe78261938beae3d25bf64b31 Mon Sep 17 00:00:00 2001 From: Keith Au Date: Fri, 28 Feb 2020 17:14:47 +0800 Subject: [PATCH 5/5] renamed xua_api.h to xua_usb_params_funcs.h --- lib_xua/api/{xua_api.h => xua_usb_params_funcs.h} | 0 lib_xua/src/core/buffer/decouple/decouple.xc | 2 +- lib_xua/src/core/endpoint0/xua_endpoint0.c | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename lib_xua/api/{xua_api.h => xua_usb_params_funcs.h} (100%) diff --git a/lib_xua/api/xua_api.h b/lib_xua/api/xua_usb_params_funcs.h similarity index 100% rename from lib_xua/api/xua_api.h rename to lib_xua/api/xua_usb_params_funcs.h diff --git a/lib_xua/src/core/buffer/decouple/decouple.xc b/lib_xua/src/core/buffer/decouple/decouple.xc index ae6d8ed5..f217b0e4 100644 --- a/lib_xua/src/core/buffer/decouple/decouple.xc +++ b/lib_xua/src/core/buffer/decouple/decouple.xc @@ -7,7 +7,7 @@ #include "interrupt.h" #include "xua_commands.h" #include "xud.h" -#include "xua_api.h" +#include "xua_usb_params_funcs.h" #ifdef NATIVE_DSD #include "usbaudio20.h" /* Defines from the USB Audio 2.0 Specifications */ diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index 0a5dbcac..2a183c72 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -29,7 +29,7 @@ #include "dsd_support.h" #endif -#include "xua_api.h" +#include "xua_usb_params_funcs.h" #ifndef __XC__ /* Support for xCORE channels in C */