From bef8fad109d226c8a6565ed1af212243fbb50f55 Mon Sep 17 00:00:00 2001 From: lucianom Date: Fri, 7 Feb 2020 19:17:24 +0000 Subject: [PATCH 1/4] Add new API functions for VID and PID --- CHANGELOG.rst | 1 + lib_xua/api/xua_endpoint0.h | 26 ++++++++++++++- lib_xua/src/core/endpoint0/xua_endpoint0.c | 38 +++++++++++++++++++++- 3 files changed, 63 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index f2aa6a1e..e2ff343b 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -20,6 +20,7 @@ lib_xua Change Log * CHANGE HID report descriptor to use generic events instead of GPI events, to report Key-phrase detection as AC Search, and to report end-call detection as AC Stop + * ADDED: Enndpoint0 API functions to read and write Vendor and Product IDs 0.2.1 ----- diff --git a/lib_xua/api/xua_endpoint0.h b/lib_xua/api/xua_endpoint0.h index ed3ffda2..70782c85 100644 --- a/lib_xua/api/xua_endpoint0.h +++ b/lib_xua/api/xua_endpoint0.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2018, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved #ifndef _XUA_ENDPOINT0_H_ #define _XUA_ENDPOINT0_H_ @@ -28,5 +28,29 @@ void XUA_Endpoint0(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioCtrl, chanend ?c_mix_ctl,chanend ?c_clk_ctl, chanend ?c_EANativeTransport_ctr, client interface i_dfu ?dfuInterface VENDOR_REQUESTS_PARAMS_DEC_); +/** Function to set the Vendor ID value + * + * \param vid vendor ID value to set +*/ +void XUA_Endpoint0_setVendorId(unsigned short vid); + +/** Function to set the Product ID value + * + * \param pid Product ID value to set +*/ +void XUA_Endpoint0_setProductId(unsigned short pid); + +/** Function to get the Vendor ID value + * + * \return Vendor ID value +*/ +unsigned short XUA_Endpoint0_getVendorId(); + +/** Function to get the Vendor ID value + * + * \return Product ID value +*/ +unsigned short XUA_Endpoint0_getProductId(); + #endif #endif diff --git a/lib_xua/src/core/endpoint0/xua_endpoint0.c b/lib_xua/src/core/endpoint0/xua_endpoint0.c index 91576287..e62f5fb8 100755 --- a/lib_xua/src/core/endpoint0/xua_endpoint0.c +++ b/lib_xua/src/core/endpoint0/xua_endpoint0.c @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved /** * @brief Implements endpoint zero for an USB Audio 1.0/2.0 device * @author Ross Owen, XMOS Semiconductor @@ -207,6 +207,42 @@ const unsigned g_chanCount_In_HS[INPUT_FORMAT_COUNT] = {HS_STREAM_FORMAT_I XUD_ep ep0_out; XUD_ep ep0_in; +void XUA_Endpoint0_setVendorId(unsigned short vid) { +#if (AUDIO_CLASS == 1) + devDesc_Audio1.idVendor = vid; +#else + devDesc_Audio2.idVendor = vid; +#endif // AUDIO_CLASS == 1} +} + +void XUA_Endpoint0_setProductId(unsigned short pid) { +#if (AUDIO_CLASS == 1) + devDesc_Audio1.idProduct = pid; +#else + devDesc_Audio2.idProduct = pid; +#endif // AUDIO_CLASS == 1} +} + +unsigned short XUA_Endpoint0_getVendorId() { + unsigned short vid; +#if (AUDIO_CLASS == 1) + vid = devDesc_Audio1.idVendor; +#else + vid = devDesc_Audio2.idVendor; +#endif // AUDIO_CLASS == 1} + return vid; +} + +unsigned short XUA_Endpoint0_getProductId() { + unsigned short pid; +#if (AUDIO_CLASS == 1) + pid = devDesc_Audio1.idProduct; +#else + pid = devDesc_Audio2.idProduct; +#endif // AUDIO_CLASS == 1} + return pid; +} + void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl, chanend c_mix_ctl, chanend c_clk_ctl, chanend c_EANativeTransport_ctrl, CLIENT_INTERFACE(i_dfu, dfuInterface) VENDOR_REQUESTS_PARAMS_DEC_) { From f1b6a0b90340a3979dd21bf43fb99d2b13570793 Mon Sep 17 00:00:00 2001 From: lucianom Date: Tue, 11 Feb 2020 16:53:38 +0000 Subject: [PATCH 2/4] Fix typo --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e2ff343b..da37d4a4 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -20,7 +20,7 @@ lib_xua Change Log * CHANGE HID report descriptor to use generic events instead of GPI events, to report Key-phrase detection as AC Search, and to report end-call detection as AC Stop - * ADDED: Enndpoint0 API functions to read and write Vendor and Product IDs + * ADDED: Endpoint0 API functions to read and write Vendor and Product IDs 0.2.1 ----- From c8da4ca8f6923013cd2795fad56f6a482d155bdd Mon Sep 17 00:00:00 2001 From: lucianom Date: Tue, 11 Feb 2020 16:54:48 +0000 Subject: [PATCH 3/4] Fix typo --- lib_xua/api/xua_endpoint0.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/api/xua_endpoint0.h b/lib_xua/api/xua_endpoint0.h index 70782c85..c741225f 100644 --- a/lib_xua/api/xua_endpoint0.h +++ b/lib_xua/api/xua_endpoint0.h @@ -46,7 +46,7 @@ void XUA_Endpoint0_setProductId(unsigned short pid); */ unsigned short XUA_Endpoint0_getVendorId(); -/** Function to get the Vendor ID value +/** Function to get the Product ID value * * \return Product ID value */ From 035970c7a96a13e9b484bc19c47232ff9fd14c15 Mon Sep 17 00:00:00 2001 From: lucianom Date: Wed, 12 Feb 2020 09:27:32 +0000 Subject: [PATCH 4/4] Fix description --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index da37d4a4..fc73742f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -20,7 +20,7 @@ lib_xua Change Log * CHANGE HID report descriptor to use generic events instead of GPI events, to report Key-phrase detection as AC Search, and to report end-call detection as AC Stop - * ADDED: Endpoint0 API functions to read and write Vendor and Product IDs + * ADDED: Ability to read or modify vendor and product IDs 0.2.1 -----