Merge branch 'develop' into feature/configurable_rate_res

This commit is contained in:
Keith Au
2020-02-14 17:05:57 +08:00
3 changed files with 63 additions and 2 deletions

View File

@@ -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: Ability to read or modify vendor and product IDs
* ADDED: Support of variable USB sampling frequency
0.2.1

View File

@@ -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 Product ID value
*
* \return Product ID value
*/
unsigned short XUA_Endpoint0_getProductId();
#endif
#endif

View File

@@ -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
@@ -214,6 +214,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_)
{