Add commands to configure USB bcdDevice version

This commit is contained in:
Larry Snizek
2020-03-02 16:02:26 +00:00
parent 2175103510
commit 40ab0b563c
3 changed files with 24 additions and 1 deletions

View File

@@ -21,6 +21,7 @@ lib_xua Change Log
events, to report Key-phrase detection as AC Search, and to report end-call events, to report Key-phrase detection as AC Search, and to report end-call
detection as AC Stop detection as AC Stop
* ADDED: Ability to read or modify vendor and product IDs * ADDED: Ability to read or modify vendor and product IDs
* ADDED: Ability to read or modify bcdDevice
* ADDED: Override USB descriptor with sampling frequency and * ADDED: Override USB descriptor with sampling frequency and
bit-resolution set at boot time. bit-resolution set at boot time.

View File

@@ -52,5 +52,9 @@ unsigned short XUA_Endpoint0_getVendorId();
*/ */
unsigned short XUA_Endpoint0_getProductId(); unsigned short XUA_Endpoint0_getProductId();
unsigned short XUA_Endpoint0_getBcdDevice();
void XUA_Endpoint0_setBcdDevice(unsigned short bcdDevice);
#endif #endif
#endif #endif

View File

@@ -237,7 +237,7 @@ unsigned short XUA_Endpoint0_getVendorId() {
} }
unsigned short XUA_Endpoint0_getProductId() { unsigned short XUA_Endpoint0_getProductId() {
unsigned short pid; unsigned short pid;
#if (AUDIO_CLASS == 1) #if (AUDIO_CLASS == 1)
pid = devDesc_Audio1.idProduct; pid = devDesc_Audio1.idProduct;
#else #else
@@ -246,6 +246,24 @@ unsigned short XUA_Endpoint0_getProductId() {
return pid; return pid;
} }
unsigned short XUA_Endpoint0_getBcdDevice() {
unsigned short bcd;
#if (AUDIO_CLASS == 1)
bcd = devDesc_Audio1.bcdDevice;
#else
bcd = devDesc_Audio2.bcdDevice;
#endif // AUDIO_CLASS == 1}
return bcd;
}
void XUA_Endpoint0_setBcdDevice(unsigned short bcd) {
#if (AUDIO_CLASS == 1)
devDesc_Audio1.bcdDevice = bcd;
#else
devDesc_Audio2.bcdDevice = bcd;
#endif // AUDIO_CLASS == 1}
}
void XUA_Endpoint0_init(chanend c_ep0_out, chanend c_ep0_in, chanend c_audioControl, 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_) chanend c_mix_ctl, chanend c_clk_ctl, chanend c_EANativeTransport_ctrl, CLIENT_INTERFACE(i_dfu, dfuInterface) VENDOR_REQUESTS_PARAMS_DEC_)
{ {