From 31bb86c161b099c82b42ae8ba588446d89dd96c2 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Wed, 11 Dec 2019 16:02:16 +0000 Subject: [PATCH 01/22] First changes to move to a USB HID design that allows some degree of boot-time configurability. These changes are far from complete. They build successfully, but have received very little bench testing. --- lib_xua/src/core/buffer/ep/ep_buffer.xc | 2 +- lib_xua/src/core/user/hid/user_hid.h | 48 +++++++++++++++++++------ lib_xua/src/hid/hid.xc | 26 +++++++++++++- lib_xua/src/hid/xua_hid.h | 16 +++++++++ 4 files changed, 80 insertions(+), 12 deletions(-) diff --git a/lib_xua/src/core/buffer/ep/ep_buffer.xc b/lib_xua/src/core/buffer/ep/ep_buffer.xc index 45e08da3..3e28a2e5 100644 --- a/lib_xua/src/core/buffer/ep/ep_buffer.xc +++ b/lib_xua/src/core/buffer/ep/ep_buffer.xc @@ -880,7 +880,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out, case XUD_SetData_Select(c_hid, ep_hid, result): { g_hidData[0]=0; - UserReadHIDData(g_hidData); + g_hidData[0]=UserHIDGetData(); XUD_SetReady_In(ep_hid, g_hidData, 1); } break; diff --git a/lib_xua/src/core/user/hid/user_hid.h b/lib_xua/src/core/user/hid/user_hid.h index 7d67b00c..35d2578d 100644 --- a/lib_xua/src/core/user/hid/user_hid.h +++ b/lib_xua/src/core/user/hid/user_hid.h @@ -3,21 +3,49 @@ #ifndef __USER_HID_H__ #define __USER_HID_H__ -/* These defines relate to the HID report desc - do not mod */ -#define HID_CONTROL_PLAYPAUSE_SHIFT 0x00 -#define HID_CONTROL_NEXT_SHIFT 0x01 -#define HID_CONTROL_PREV_SHIFT 0x02 -#define HID_CONTROL_VOLUP_SHIFT 0x03 -#define HID_CONTROL_VOLDN_SHIFT 0x04 -#define HID_CONTROL_MUTE_SHIFT 0x05 +/* These enumerated constants relate to the HID report desc - do not mod */ +typedef enum hidEventId_t { + HID_EVENT_ID_GPI0 = 0, + HID_EVENT_ID_GPI1, + HID_EVENT_ID_GPI2, + HID_EVENT_ID_GPI3, + HID_EVENT_ID_EVT0, + HID_EVENT_ID_EVT1, + HID_EVENT_ID_EVT2, + HID_EVENT_ID_EVT3, + HID_EVENT_ID_EVT4, + HID_EVENT_ID_EVT5, + HID_EVENT_ID_EVT6, + HID_EVENT_ID_EVT7, + HID_EVENT_ID_EVT8, + HID_EVENT_ID_EVT9, + HID_EVENT_ID_EVT10, + HID_EVENT_ID_EVT11, + HID_EVENT_ID_EVT12, + HID_EVENT_ID_EVT13, + HID_EVENT_ID_EVT14, + HID_EVENT_ID_EVT15, + HID_EVENT_ID_EVT16, + HID_EVENT_ID_EVT17, + HID_EVENT_ID_EVT18, + HID_EVENT_ID_EVT19, + HID_EVENT_ID_EVT20, + HID_EVENT_ID_EVT21, + HID_EVENT_ID_EVT22, + HID_EVENT_ID_EVT23, + HID_EVENT_ID_EVT24, + HID_EVENT_ID_EVT25, + HID_EVENT_ID_EVT26, + HID_EVENT_ID_EVT27 +} hidEventId_t; #define HID_DATA_SIZE 1 #if( 0 < HID_CONTROLS ) -void UserInitHIDData( void ); -void UserReadHIDData( unsigned char hidData[ HID_DATA_SIZE ]); -void UserSetHIDData( const unsigned hidData ); +unsigned UserHIDGetData( void ); +void UserHIDInit( void ); +void UserHIDRegisterEvent( const hidEventId_t hidEventId, const int * hidEventData, const unsigned hidEventDataSize ); #endif /* ( 0 < HID_CONTROLS ) */ #endif /* __USER_HID_H__ */ diff --git a/lib_xua/src/hid/hid.xc b/lib_xua/src/hid/hid.xc index 854b78d3..906fd1ec 100644 --- a/lib_xua/src/hid/hid.xc +++ b/lib_xua/src/hid/hid.xc @@ -9,12 +9,17 @@ #if( 0 < HID_CONTROLS ) #define MS_IN_TICKS 100000U -static unsigned s_hidIdleActive = 0U; +static unsigned s_hidChangePending = 0U; static unsigned s_hidCurrentPeriod = ENDPOINT_INT_INTERVAL_IN_HID * MS_IN_TICKS; +static unsigned s_hidIdleActive = 0U; static unsigned s_hidIndefiniteDuration = 0U; static unsigned s_hidNextReportTime = 0U; static unsigned s_hidReportTime = 0U; +unsafe { + volatile unsigned * unsafe s_hidChangePendingPtr = &s_hidChangePending; +} + static unsigned HidCalcNewReportTime( const unsigned currentPeriod, const unsigned reportTime, const unsigned reportToSetIdleInterval, const unsigned newPeriod ); static unsigned HidCalcReportToSetIdleInterval( const unsigned reportTime ); static unsigned HidFindSetIdleActivationPoint( const unsigned currentPeriod, const unsigned timeWithinPeriod ); @@ -51,6 +56,18 @@ XUD_Result_t HidInterfaceClassRequests( return result; } +void HidClearChangePending( void ) +{ + unsafe { + *s_hidChangePendingPtr = 0U; + } +} + +unsigned HidIsChangePending( void ) +{ + return( s_hidChangePending != 0 ); +} + unsigned HidIsSetIdleSilenced( void ) { unsigned isSilenced = s_hidIdleActive; @@ -67,6 +84,13 @@ unsigned HidIsSetIdleSilenced( void ) return isSilenced; } +void HidSetChangePending( void ) +{ + unsafe { + *s_hidChangePendingPtr = 1; + } +} + /** * \brief Calculate the timer value for sending the next HID Report. * diff --git a/lib_xua/src/hid/xua_hid.h b/lib_xua/src/hid/xua_hid.h index 63469054..9e620788 100644 --- a/lib_xua/src/hid/xua_hid.h +++ b/lib_xua/src/hid/xua_hid.h @@ -40,6 +40,17 @@ XUD_Result_t HidInterfaceClassRequests( XUD_ep c_ep0_in, REFERENCE_PARAM( USB_SetupPacket_t, sp )); +/** + * \brief Register that previously changed HID Report data has reported + * to the USB Host. + */ +void HidClearChangePending( void ); + +/** + * \brief Indicate if a change to the HID Report data has been received. + */ +unsigned HidIsChangePending( void ); + /** * \brief Indicate whether to send a HID Report based on elapsed time. * @@ -58,4 +69,9 @@ XUD_Result_t HidInterfaceClassRequests( */ unsigned HidIsSetIdleSilenced( void ); +/** + * \brief Register that a change to the HID Report data has been received. + */ +void HidSetChangePending( void ); + #endif // __XUA_HID_H__ From e5389e434846e50e34b164df27c2ad80f2b918d9 Mon Sep 17 00:00:00 2001 From: mbanth Date: Fri, 13 Dec 2019 18:17:36 +0000 Subject: [PATCH 02/22] Added support for AC Stop (End Call), Volume Increment and Volume Decrement bit fields in the HID report. --- CHANGELOG.rst | 2 ++ lib_xua/src/core/endpoint0/xua_ep0_descriptors.h | 9 ++++++--- lib_xua/src/core/user/hid/user_hid.h | 10 ++++------ 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d8b82f4a..d653a370 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -11,6 +11,8 @@ lib_xua Change Log microphone operation * FIXED: Descriptors for XUA_ADAPTIVE incorrectly defined for IN endpoint * ADDED: Guards to user_hid.h and xua_hid.h + * ADDED: UAC1 HID support for AC Stop (End Call), Volume Increment and + Volume Decrement 0.2.1 ----- diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index fcc1e45b..8abd18e9 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -573,9 +573,12 @@ unsigned char hidReportDescriptor[] = /* Voice Command usage as per request #HUT 0x0a, 0x00, 0x02, /* Usage (Generic GUI Application Controls) */ 0xa1, 0x02, /* Collection (Logical) */ 0x0a, 0x21, 0x02, /* Usage (AC Search) */ - 0x95, 0x01, /* Report Count (1) */ + 0x0a, 0x26, 0x02, /* Usage (AC Stop) */ + 0x09, 0xe9, /* Usage (Volume Increment) */ + 0x09, 0xea, /* Usage (Volume Decrement) */ + 0x95, 0x04, /* Report Count (4) */ 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ - 0x95, 0x07, /* Report Count (7) */ + 0x95, 0x04, /* Report Count (4) */ 0x81, 0x01, /* Input (Cnst, Ary, Abs) */ 0xc0, /* End collection (Logical) */ 0xc0 /* End collection (Application) */ @@ -2884,7 +2887,7 @@ unsigned char cfgDesc_Audio1[] = 0x00, /* 4 bCountryCode */ 0x01, /* 5 bNumDescriptors */ 0x22, /* 6 bDescriptorType[0] (Report) */ - 0x1E, /* 7 wDescriptorLength[0] */ + 0x25, /* 7 wDescriptorLength[0] */ 0x00, /* 8 wDescriptorLength[0] */ /* HID Endpoint descriptor (IN) */ diff --git a/lib_xua/src/core/user/hid/user_hid.h b/lib_xua/src/core/user/hid/user_hid.h index 7d67b00c..79b420a3 100644 --- a/lib_xua/src/core/user/hid/user_hid.h +++ b/lib_xua/src/core/user/hid/user_hid.h @@ -4,12 +4,10 @@ #define __USER_HID_H__ /* These defines relate to the HID report desc - do not mod */ -#define HID_CONTROL_PLAYPAUSE_SHIFT 0x00 -#define HID_CONTROL_NEXT_SHIFT 0x01 -#define HID_CONTROL_PREV_SHIFT 0x02 -#define HID_CONTROL_VOLUP_SHIFT 0x03 -#define HID_CONTROL_VOLDN_SHIFT 0x04 -#define HID_CONTROL_MUTE_SHIFT 0x05 +#define HID_CONTROL_KEYWORD_SHIFT 0x00 +#define HID_CONTROL_ENDCALL_SHIFT 0x01 +#define HID_CONTROL_VOLUP_SHIFT 0x02 +#define HID_CONTROL_VOLDN_SHIFT 0x03 #define HID_DATA_SIZE 1 From 1ee146ef608c65250c27f01563c72a531b468ab2 Mon Sep 17 00:00:00 2001 From: mbanth Date: Mon, 16 Dec 2019 12:33:59 +0000 Subject: [PATCH 03/22] Define each active bit field separately. --- lib_xua/src/core/endpoint0/xua_ep0_descriptors.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 8abd18e9..1461fc16 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -572,11 +572,14 @@ unsigned char hidReportDescriptor[] = /* Voice Command usage as per request #HUT 0xa1, 0x01, /* Collection (Application) */ 0x0a, 0x00, 0x02, /* Usage (Generic GUI Application Controls) */ 0xa1, 0x02, /* Collection (Logical) */ + 0x95, 0x01, /* Report Count (1) */ 0x0a, 0x21, 0x02, /* Usage (AC Search) */ + 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ 0x0a, 0x26, 0x02, /* Usage (AC Stop) */ + 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ 0x09, 0xe9, /* Usage (Volume Increment) */ + 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ 0x09, 0xea, /* Usage (Volume Decrement) */ - 0x95, 0x04, /* Report Count (4) */ 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ 0x95, 0x04, /* Report Count (4) */ 0x81, 0x01, /* Input (Cnst, Ary, Abs) */ @@ -2887,7 +2890,7 @@ unsigned char cfgDesc_Audio1[] = 0x00, /* 4 bCountryCode */ 0x01, /* 5 bNumDescriptors */ 0x22, /* 6 bDescriptorType[0] (Report) */ - 0x25, /* 7 wDescriptorLength[0] */ + 0x2B, /* 7 wDescriptorLength[0] */ 0x00, /* 8 wDescriptorLength[0] */ /* HID Endpoint descriptor (IN) */ From 9f1e9735b8a55d6bec7e861090fdbd1f6ad99f96 Mon Sep 17 00:00:00 2001 From: mbanth Date: Mon, 16 Dec 2019 14:53:38 +0000 Subject: [PATCH 04/22] Remove unnecessary Input statements. --- lib_xua/src/core/endpoint0/xua_ep0_descriptors.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 1461fc16..319d3fd4 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -574,11 +574,8 @@ unsigned char hidReportDescriptor[] = /* Voice Command usage as per request #HUT 0xa1, 0x02, /* Collection (Logical) */ 0x95, 0x01, /* Report Count (1) */ 0x0a, 0x21, 0x02, /* Usage (AC Search) */ - 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ 0x0a, 0x26, 0x02, /* Usage (AC Stop) */ - 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ 0x09, 0xe9, /* Usage (Volume Increment) */ - 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ 0x09, 0xea, /* Usage (Volume Decrement) */ 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ 0x95, 0x04, /* Report Count (4) */ @@ -2890,7 +2887,7 @@ unsigned char cfgDesc_Audio1[] = 0x00, /* 4 bCountryCode */ 0x01, /* 5 bNumDescriptors */ 0x22, /* 6 bDescriptorType[0] (Report) */ - 0x2B, /* 7 wDescriptorLength[0] */ + 0x25, /* 7 wDescriptorLength[0] */ 0x00, /* 8 wDescriptorLength[0] */ /* HID Endpoint descriptor (IN) */ From 8b6f6bc8e1b7cd6f847e2e64aabd4f35ac672877 Mon Sep 17 00:00:00 2001 From: mbanth Date: Mon, 16 Dec 2019 15:13:53 +0000 Subject: [PATCH 05/22] Revert "Remove unnecessary Input statements." This reverts commit 9f1e9735b8a55d6bec7e861090fdbd1f6ad99f96. --- lib_xua/src/core/endpoint0/xua_ep0_descriptors.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 319d3fd4..1461fc16 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -574,8 +574,11 @@ unsigned char hidReportDescriptor[] = /* Voice Command usage as per request #HUT 0xa1, 0x02, /* Collection (Logical) */ 0x95, 0x01, /* Report Count (1) */ 0x0a, 0x21, 0x02, /* Usage (AC Search) */ + 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ 0x0a, 0x26, 0x02, /* Usage (AC Stop) */ + 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ 0x09, 0xe9, /* Usage (Volume Increment) */ + 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ 0x09, 0xea, /* Usage (Volume Decrement) */ 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ 0x95, 0x04, /* Report Count (4) */ @@ -2887,7 +2890,7 @@ unsigned char cfgDesc_Audio1[] = 0x00, /* 4 bCountryCode */ 0x01, /* 5 bNumDescriptors */ 0x22, /* 6 bDescriptorType[0] (Report) */ - 0x25, /* 7 wDescriptorLength[0] */ + 0x2B, /* 7 wDescriptorLength[0] */ 0x00, /* 8 wDescriptorLength[0] */ /* HID Endpoint descriptor (IN) */ From 538f2be5b41b74c39b977b927d19363d5e371957 Mon Sep 17 00:00:00 2001 From: mbanth Date: Wed, 18 Dec 2019 12:09:11 +0000 Subject: [PATCH 06/22] Modify the interface to the User HID functionality. Setting the HID data use to occur through a global variable. It now occurs through a function call. A list of general HID events has been provided as well. --- lib_xua/src/core/buffer/ep/ep_buffer.xc | 4 +-- lib_xua/src/core/user/hid/user_hid.h | 41 ++++++++++++++++++++++--- 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/lib_xua/src/core/buffer/ep/ep_buffer.xc b/lib_xua/src/core/buffer/ep/ep_buffer.xc index 3e28a2e5..97984b85 100644 --- a/lib_xua/src/core/buffer/ep/ep_buffer.xc +++ b/lib_xua/src/core/buffer/ep/ep_buffer.xc @@ -21,7 +21,7 @@ #if( 0 < HID_CONTROLS ) #include "user_hid.h" -unsigned char g_hidData[1] = {0}; +unsigned char g_hidData[HID_DATA_BYTES] = {0}; #endif void GetADCCounts(unsigned samFreq, int &min, int &mid, int &max); @@ -880,7 +880,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out, case XUD_SetData_Select(c_hid, ep_hid, result): { g_hidData[0]=0; - g_hidData[0]=UserHIDGetData(); + UserHIDGetData(g_hidData); XUD_SetReady_In(ep_hid, g_hidData, 1); } break; diff --git a/lib_xua/src/core/user/hid/user_hid.h b/lib_xua/src/core/user/hid/user_hid.h index 35d2578d..5288ee7b 100644 --- a/lib_xua/src/core/user/hid/user_hid.h +++ b/lib_xua/src/core/user/hid/user_hid.h @@ -3,7 +3,13 @@ #ifndef __USER_HID_H__ #define __USER_HID_H__ -/* These enumerated constants relate to the HID report desc - do not mod */ +/** + * \brief HID event identifiers + * + * This enumeration defines a constant value for each HID event. + * It defines one value for each of the four GPI pins supported in the standard voice products. + * It defines a further 28 values for generic events. + */ typedef enum hidEventId_t { HID_EVENT_ID_GPI0 = 0, HID_EVENT_ID_GPI1, @@ -39,13 +45,40 @@ typedef enum hidEventId_t { HID_EVENT_ID_EVT27 } hidEventId_t; -#define HID_DATA_SIZE 1 +#define HID_DATA_BYTES 4 #if( 0 < HID_CONTROLS ) -unsigned UserHIDGetData( void ); +/** + * \brief Get the data for the next HID report + * + * \note This function returns the HID data as a list of unsigned char because the + * \c XUD_SetReady_In() accepts data for transmission to the USB Host using + * this type. + * + * \param{out} hidData The HID data + */ +void UserHIDGetData( unsigned char hidData[ HID_DATA_BYTES ]); + +/** + * \brief Initialize HID processing + */ void UserHIDInit( void ); -void UserHIDRegisterEvent( const hidEventId_t hidEventId, const int * hidEventData, const unsigned hidEventDataSize ); + +/** + * \brief Record that a HID event has occurred + * + * \param{in} hidEventId The identifier of an event which has occurred + * \param{in} hidEventData A list of data associated with the event + * \param{in} hidEventDataSize The length of the event data list + * + * \note At present, this function only takes a single element of event data, i.e. + * hidEventDataSize must equal 1. + * + * \note At present, this function treats the event data as a Boolean flag. + * Zero means False; all other values mean True. + */ +void UserHIDRecordEvent( const hidEventId_t hidEventId, const int * hidEventData, const unsigned hidEventDataSize ); #endif /* ( 0 < HID_CONTROLS ) */ #endif /* __USER_HID_H__ */ From d81af18d1fddf85278ca392065336195bff97854 Mon Sep 17 00:00:00 2001 From: mbanth Date: Thu, 19 Dec 2019 09:52:13 +0000 Subject: [PATCH 07/22] Revert "Modify the interface to the User HID functionality." This reverts commit 538f2be5b41b74c39b977b927d19363d5e371957. On branch feature/hid_4bit_reliance_jan_demo Changes to be committed: modified: lib_xua/src/core/buffer/ep/ep_buffer.xc modified: lib_xua/src/core/user/hid/user_hid.h --- lib_xua/src/core/buffer/ep/ep_buffer.xc | 4 +-- lib_xua/src/core/user/hid/user_hid.h | 41 +++---------------------- 2 files changed, 6 insertions(+), 39 deletions(-) diff --git a/lib_xua/src/core/buffer/ep/ep_buffer.xc b/lib_xua/src/core/buffer/ep/ep_buffer.xc index 97984b85..3e28a2e5 100644 --- a/lib_xua/src/core/buffer/ep/ep_buffer.xc +++ b/lib_xua/src/core/buffer/ep/ep_buffer.xc @@ -21,7 +21,7 @@ #if( 0 < HID_CONTROLS ) #include "user_hid.h" -unsigned char g_hidData[HID_DATA_BYTES] = {0}; +unsigned char g_hidData[1] = {0}; #endif void GetADCCounts(unsigned samFreq, int &min, int &mid, int &max); @@ -880,7 +880,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out, case XUD_SetData_Select(c_hid, ep_hid, result): { g_hidData[0]=0; - UserHIDGetData(g_hidData); + g_hidData[0]=UserHIDGetData(); XUD_SetReady_In(ep_hid, g_hidData, 1); } break; diff --git a/lib_xua/src/core/user/hid/user_hid.h b/lib_xua/src/core/user/hid/user_hid.h index 5288ee7b..35d2578d 100644 --- a/lib_xua/src/core/user/hid/user_hid.h +++ b/lib_xua/src/core/user/hid/user_hid.h @@ -3,13 +3,7 @@ #ifndef __USER_HID_H__ #define __USER_HID_H__ -/** - * \brief HID event identifiers - * - * This enumeration defines a constant value for each HID event. - * It defines one value for each of the four GPI pins supported in the standard voice products. - * It defines a further 28 values for generic events. - */ +/* These enumerated constants relate to the HID report desc - do not mod */ typedef enum hidEventId_t { HID_EVENT_ID_GPI0 = 0, HID_EVENT_ID_GPI1, @@ -45,40 +39,13 @@ typedef enum hidEventId_t { HID_EVENT_ID_EVT27 } hidEventId_t; -#define HID_DATA_BYTES 4 +#define HID_DATA_SIZE 1 #if( 0 < HID_CONTROLS ) -/** - * \brief Get the data for the next HID report - * - * \note This function returns the HID data as a list of unsigned char because the - * \c XUD_SetReady_In() accepts data for transmission to the USB Host using - * this type. - * - * \param{out} hidData The HID data - */ -void UserHIDGetData( unsigned char hidData[ HID_DATA_BYTES ]); - -/** - * \brief Initialize HID processing - */ +unsigned UserHIDGetData( void ); void UserHIDInit( void ); - -/** - * \brief Record that a HID event has occurred - * - * \param{in} hidEventId The identifier of an event which has occurred - * \param{in} hidEventData A list of data associated with the event - * \param{in} hidEventDataSize The length of the event data list - * - * \note At present, this function only takes a single element of event data, i.e. - * hidEventDataSize must equal 1. - * - * \note At present, this function treats the event data as a Boolean flag. - * Zero means False; all other values mean True. - */ -void UserHIDRecordEvent( const hidEventId_t hidEventId, const int * hidEventData, const unsigned hidEventDataSize ); +void UserHIDRegisterEvent( const hidEventId_t hidEventId, const int * hidEventData, const unsigned hidEventDataSize ); #endif /* ( 0 < HID_CONTROLS ) */ #endif /* __USER_HID_H__ */ From 6eb30c56468582351877ff676c5c827cc2701c61 Mon Sep 17 00:00:00 2001 From: mbanth Date: Fri, 20 Dec 2019 13:37:54 +0000 Subject: [PATCH 08/22] Replace the HID Report descriptor with one that uses the Usage values specified by Reliance in their Reliance Jio Infocomm Limited, RJIL Devices, VoicePoD, Technical Requirements Document, Rev. No. 2.0, Date 18-12-2019. --- .../src/core/endpoint0/xua_ep0_descriptors.h | 32 +++++++------------ 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 1461fc16..74319030 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -564,26 +564,18 @@ unsigned char devQualDesc_Null[] = #if( 0 < HID_CONTROLS ) unsigned char hidReportDescriptor[] = /* Voice Command usage as per request #HUTRR45 */ { - 0x15, 0x01, /* Logical Minimum (1) */ - 0x25, 0x01, /* Logical Maximum (1) */ - 0x75, 0x01, /* Report Size (1) */ - 0x05, 0x0c, /* Usage Page (Consumer Device) */ - 0x09, 0x01, /* Usage (Consumer Control) */ + 0x05, 0x01, /* Usage Page (Generic Desktop) */ + 0x09, 0x06, /* Usage (Keyboard) */ 0xa1, 0x01, /* Collection (Application) */ - 0x0a, 0x00, 0x02, /* Usage (Generic GUI Application Controls) */ - 0xa1, 0x02, /* Collection (Logical) */ - 0x95, 0x01, /* Report Count (1) */ - 0x0a, 0x21, 0x02, /* Usage (AC Search) */ - 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ - 0x0a, 0x26, 0x02, /* Usage (AC Stop) */ - 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ - 0x09, 0xe9, /* Usage (Volume Increment) */ - 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ - 0x09, 0xea, /* Usage (Volume Decrement) */ - 0x81, 0x40, /* Input (Data, Ary, Abs, Nul) */ + 0x75, 0x01, /* Report Size (1) */ 0x95, 0x04, /* Report Count (4) */ - 0x81, 0x01, /* Input (Cnst, Ary, Abs) */ - 0xc0, /* End collection (Logical) */ + 0x05, 0x07, /* Usage Page (Key Codes) */ + 0x19, 0x70, /* Usage Minimum (Keyboard F21) */ + 0x29, 0x73, /* Usage Maximum (Keyboard F24) */ + 0x15, 0x00, /* Logical Minimum (0) */ + 0x25, 0x01, /* Logical Maximum (1) */ + 0x81, 0x02, /* Input (Data, Var, Abs, No Wrap, Lin, Pref, No Nul) */ + 0x81, 0x01, /* Input (Cnst, Ary, Abs, No Wrap, Lin, Pref, No Nul) */ 0xc0 /* End collection (Application) */ }; #endif @@ -2669,7 +2661,7 @@ unsigned char cfgDesc_Audio1[] = (FS_STREAM_FORMAT_OUTPUT_1_MAXPACKETSIZE&0xff), /* 4 wMaxPacketSize (Typically 294 bytes)*/ (FS_STREAM_FORMAT_OUTPUT_1_MAXPACKETSIZE&0xff00)>>8, /* 5 wMaxPacketSize */ 0x01, /* bInterval */ - 0x00, /* bRefresh */ + 0x00, /* bRefresh */ #if (NUM_USB_CHAN_IN == 0) || defined(UAC_FORCE_FEEDBACK_EP) ENDPOINT_ADDRESS_IN_FEEDBACK, /* bSynchAdddress - address of EP used to communicate sync info */ #else /* Bi-directional in/out device */ @@ -2890,7 +2882,7 @@ unsigned char cfgDesc_Audio1[] = 0x00, /* 4 bCountryCode */ 0x01, /* 5 bNumDescriptors */ 0x22, /* 6 bDescriptorType[0] (Report) */ - 0x2B, /* 7 wDescriptorLength[0] */ + 0x19, /* 7 wDescriptorLength[0] */ 0x00, /* 8 wDescriptorLength[0] */ /* HID Endpoint descriptor (IN) */ From 67764fb0e8f29f7329c26dc1cabe871c5cea6ea6 Mon Sep 17 00:00:00 2001 From: mbanth Date: Mon, 6 Jan 2020 17:13:58 +0000 Subject: [PATCH 09/22] Update change log. --- CHANGELOG.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d653a370..b68c4154 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -13,6 +13,8 @@ lib_xua Change Log * ADDED: Guards to user_hid.h and xua_hid.h * ADDED: UAC1 HID support for AC Stop (End Call), Volume Increment and Volume Decrement + * CHANGE: UAC1 HID to report function keys f21 through f24 as specified + by customer 0.2.1 ----- From ad453c8a821c07378bc94d3a90e15daba4b4b99b Mon Sep 17 00:00:00 2001 From: mbanth Date: Mon, 6 Jan 2020 17:22:57 +0000 Subject: [PATCH 10/22] Update change log to keep Jenkins happy. --- CHANGELOG.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b68c4154..b77784ce 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -13,8 +13,8 @@ lib_xua Change Log * ADDED: Guards to user_hid.h and xua_hid.h * ADDED: UAC1 HID support for AC Stop (End Call), Volume Increment and Volume Decrement - * CHANGE: UAC1 HID to report function keys f21 through f24 as specified - by customer + * CHANGE: UAC1 HID to report function keys f21 through f24 as specified by + customer 0.2.1 ----- From a2ff2897f9ef039215f48ee9cf9d13a27764bf84 Mon Sep 17 00:00:00 2001 From: mbanth Date: Tue, 7 Jan 2020 11:52:24 +0000 Subject: [PATCH 11/22] Update license to new year. --- LICENSE.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE.txt b/LICENSE.txt index 19f8e7cc..d4acef94 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ Software Release License Agreement -Copyright (c) 2011-2019, XMOS, All rights reserved. +Copyright (c) 2011-2020, XMOS, All rights reserved. BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. From f189f02c0290f56390dd630c11c081798fa91e8e Mon Sep 17 00:00:00 2001 From: mbanth Date: Tue, 7 Jan 2020 14:58:08 +0000 Subject: [PATCH 12/22] Revert "Revert "Modify the interface to the User HID functionality."" This reverts commit d81af18d1fddf85278ca392065336195bff97854. --- lib_xua/src/core/buffer/ep/ep_buffer.xc | 4 +-- lib_xua/src/core/user/hid/user_hid.h | 41 ++++++++++++++++++++++--- 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/lib_xua/src/core/buffer/ep/ep_buffer.xc b/lib_xua/src/core/buffer/ep/ep_buffer.xc index 3e28a2e5..97984b85 100644 --- a/lib_xua/src/core/buffer/ep/ep_buffer.xc +++ b/lib_xua/src/core/buffer/ep/ep_buffer.xc @@ -21,7 +21,7 @@ #if( 0 < HID_CONTROLS ) #include "user_hid.h" -unsigned char g_hidData[1] = {0}; +unsigned char g_hidData[HID_DATA_BYTES] = {0}; #endif void GetADCCounts(unsigned samFreq, int &min, int &mid, int &max); @@ -880,7 +880,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out, case XUD_SetData_Select(c_hid, ep_hid, result): { g_hidData[0]=0; - g_hidData[0]=UserHIDGetData(); + UserHIDGetData(g_hidData); XUD_SetReady_In(ep_hid, g_hidData, 1); } break; diff --git a/lib_xua/src/core/user/hid/user_hid.h b/lib_xua/src/core/user/hid/user_hid.h index 35d2578d..5288ee7b 100644 --- a/lib_xua/src/core/user/hid/user_hid.h +++ b/lib_xua/src/core/user/hid/user_hid.h @@ -3,7 +3,13 @@ #ifndef __USER_HID_H__ #define __USER_HID_H__ -/* These enumerated constants relate to the HID report desc - do not mod */ +/** + * \brief HID event identifiers + * + * This enumeration defines a constant value for each HID event. + * It defines one value for each of the four GPI pins supported in the standard voice products. + * It defines a further 28 values for generic events. + */ typedef enum hidEventId_t { HID_EVENT_ID_GPI0 = 0, HID_EVENT_ID_GPI1, @@ -39,13 +45,40 @@ typedef enum hidEventId_t { HID_EVENT_ID_EVT27 } hidEventId_t; -#define HID_DATA_SIZE 1 +#define HID_DATA_BYTES 4 #if( 0 < HID_CONTROLS ) -unsigned UserHIDGetData( void ); +/** + * \brief Get the data for the next HID report + * + * \note This function returns the HID data as a list of unsigned char because the + * \c XUD_SetReady_In() accepts data for transmission to the USB Host using + * this type. + * + * \param{out} hidData The HID data + */ +void UserHIDGetData( unsigned char hidData[ HID_DATA_BYTES ]); + +/** + * \brief Initialize HID processing + */ void UserHIDInit( void ); -void UserHIDRegisterEvent( const hidEventId_t hidEventId, const int * hidEventData, const unsigned hidEventDataSize ); + +/** + * \brief Record that a HID event has occurred + * + * \param{in} hidEventId The identifier of an event which has occurred + * \param{in} hidEventData A list of data associated with the event + * \param{in} hidEventDataSize The length of the event data list + * + * \note At present, this function only takes a single element of event data, i.e. + * hidEventDataSize must equal 1. + * + * \note At present, this function treats the event data as a Boolean flag. + * Zero means False; all other values mean True. + */ +void UserHIDRecordEvent( const hidEventId_t hidEventId, const int * hidEventData, const unsigned hidEventDataSize ); #endif /* ( 0 < HID_CONTROLS ) */ #endif /* __USER_HID_H__ */ From 8f2509845aafc5d7ccb39e988cb3323cf855ff4f Mon Sep 17 00:00:00 2001 From: mbanth Date: Wed, 8 Jan 2020 11:09:03 +0000 Subject: [PATCH 13/22] Update change log. --- CHANGELOG.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b77784ce..2bc5f24b 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -15,6 +15,8 @@ lib_xua Change Log Volume Decrement * CHANGE: UAC1 HID to report function keys f21 through f24 as specified by customer + * CHANGE: HID interface for user to set and clear events from global + variable to function 0.2.1 ----- From 6e184af8992f7dbb5af7efa573ef25116f36b279 Mon Sep 17 00:00:00 2001 From: mbanth Date: Thu, 16 Jan 2020 12:07:24 +0000 Subject: [PATCH 14/22] Update copyright date range. --- lib_xua/LICENSE.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_xua/LICENSE.txt b/lib_xua/LICENSE.txt index 3932a9ae..37950686 100644 --- a/lib_xua/LICENSE.txt +++ b/lib_xua/LICENSE.txt @@ -1,6 +1,6 @@ Software Release License Agreement -Copyright (c) 2017-2019, XMOS, All rights reserved. +Copyright (c) 2017-2020, XMOS, All rights reserved. BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. @@ -30,7 +30,7 @@ The headings in this License do not affect its interpretation. Save where the co Unless the context otherwise requires: -- references to XMOS and the Customer include their permitted successors and assigns; +- references to XMOS and the Customer include their permitted successors and assigns; - references to statutory provisions include those statutory provisions as amended or re-enacted; and - references to any gender include all genders. @@ -58,12 +58,12 @@ The Customer will adhere to all applicable import and export laws and regulation The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. -XMOS will own all intellectual property rights in the XMOS Modifications. +XMOS will own all intellectual property rights in the XMOS Modifications. The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. 7. Support -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. +Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. 8. Warranty and Disclaimer From 7530591a64105dcd5c918c0372408f0ee27bf660 Mon Sep 17 00:00:00 2001 From: mbanth Date: Thu, 16 Jan 2020 12:18:33 +0000 Subject: [PATCH 15/22] Put trailing white space back because the License file check currently fails if it's missing. --- lib_xua/LICENSE.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_xua/LICENSE.txt b/lib_xua/LICENSE.txt index 37950686..7f5e44ce 100644 --- a/lib_xua/LICENSE.txt +++ b/lib_xua/LICENSE.txt @@ -30,7 +30,7 @@ The headings in this License do not affect its interpretation. Save where the co Unless the context otherwise requires: -- references to XMOS and the Customer include their permitted successors and assigns; +- references to XMOS and the Customer include their permitted successors and assigns; - references to statutory provisions include those statutory provisions as amended or re-enacted; and - references to any gender include all genders. @@ -58,12 +58,12 @@ The Customer will adhere to all applicable import and export laws and regulation The Customer will own all intellectual property rights in the Licensee Modifications but will undertake to provide XMOS with any fixes made to correct any bugs found in the XMOS Software on a non-exclusive, perpetual and royalty free license basis. -XMOS will own all intellectual property rights in the XMOS Modifications. +XMOS will own all intellectual property rights in the XMOS Modifications. The Customer may only use the Licensee Modifications and XMOS Modifications on, or in relation to, XMOS Hardware. 7. Support -Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. +Support of the XMOS Software may be provided by XMOS pursuant to a separate support agreement. 8. Warranty and Disclaimer From 16138c2d429690be4986c7559403f3afb95cd458 Mon Sep 17 00:00:00 2001 From: mbanth Date: Thu, 16 Jan 2020 12:27:25 +0000 Subject: [PATCH 16/22] Update copyright date range. --- lib_xua/src/core/buffer/ep/ep_buffer.xc | 2 +- lib_xua/src/core/user/hid/user_hid.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_xua/src/core/buffer/ep/ep_buffer.xc b/lib_xua/src/core/buffer/ep/ep_buffer.xc index 97984b85..ae58ef83 100644 --- a/lib_xua/src/core/buffer/ep/ep_buffer.xc +++ b/lib_xua/src/core/buffer/ep/ep_buffer.xc @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved #include "xua.h" #if XUA_USB_EN #include diff --git a/lib_xua/src/core/user/hid/user_hid.h b/lib_xua/src/core/user/hid/user_hid.h index 5288ee7b..e2d64c7d 100644 --- a/lib_xua/src/core/user/hid/user_hid.h +++ b/lib_xua/src/core/user/hid/user_hid.h @@ -1,4 +1,4 @@ -// Copyright (c) 2013-2019, XMOS Ltd, All rights reserved +// Copyright (c) 2013-2020, XMOS Ltd, All rights reserved #ifndef __USER_HID_H__ #define __USER_HID_H__ From 97e6ae42690574e81b469962a3e7286983e1b201 Mon Sep 17 00:00:00 2001 From: mbanth Date: Fri, 17 Jan 2020 11:55:19 +0000 Subject: [PATCH 17/22] Shift bit flags to reflect the change to generic HID events. Use AC Search to report Wake-phrase detection and AC Stop to report End Call detection. --- .../src/core/endpoint0/xua_ep0_descriptors.h | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 74319030..566bc436 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -569,13 +569,21 @@ unsigned char hidReportDescriptor[] = /* Voice Command usage as per request #HUT 0xa1, 0x01, /* Collection (Application) */ 0x75, 0x01, /* Report Size (1) */ 0x95, 0x04, /* Report Count (4) */ - 0x05, 0x07, /* Usage Page (Key Codes) */ - 0x19, 0x70, /* Usage Minimum (Keyboard F21) */ - 0x29, 0x73, /* Usage Maximum (Keyboard F24) */ 0x15, 0x00, /* Logical Minimum (0) */ - 0x25, 0x01, /* Logical Maximum (1) */ - 0x81, 0x02, /* Input (Data, Var, Abs, No Wrap, Lin, Pref, No Nul) */ + 0x25, 0x00, /* Logical Maximum (0) */ 0x81, 0x01, /* Input (Cnst, Ary, Abs, No Wrap, Lin, Pref, No Nul) */ + 0x95, 0x01, /* Report Count (1) */ + 0x25, 0x01, /* Logical Maximum (1) */ + 0x05, 0x0C, /* Usage Page (Consumer) */ + 0x0a, 0x21, 0x02, /* Usage (AC Search) */ + 0x81, 0x02, /* Input (Data, Var, Abs, No Wrap, Lin, Pref, No Nul) */ + 0x0a, 0x26, 0x02, /* Usage (AC Stop) */ + 0x81, 0x02, /* Input (Data, Var, Abs, No Wrap, Lin, Pref, No Nul) */ + 0x95, 0x02, /* Report Count (2) */ + 0x05, 0x07, /* Usage Page (Key Codes) */ + 0x19, 0x72, /* Usage Minimum (Keyboard F23) */ + 0x29, 0x73, /* Usage Maximum (Keyboard F24) */ + 0x81, 0x02, /* Input (Data, Var, Abs, No Wrap, Lin, Pref, No Nul) */ 0xc0 /* End collection (Application) */ }; #endif @@ -2882,7 +2890,7 @@ unsigned char cfgDesc_Audio1[] = 0x00, /* 4 bCountryCode */ 0x01, /* 5 bNumDescriptors */ 0x22, /* 6 bDescriptorType[0] (Report) */ - 0x19, /* 7 wDescriptorLength[0] */ + 0x2B, /* 7 wDescriptorLength[0] */ 0x00, /* 8 wDescriptorLength[0] */ /* HID Endpoint descriptor (IN) */ From 90edaebc6e4ba9f458db0abf86758906188dc442 Mon Sep 17 00:00:00 2001 From: mbanth Date: Fri, 17 Jan 2020 13:13:28 +0000 Subject: [PATCH 18/22] Add comment to change log --- CHANGELOG.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2bc5f24b..f2aa6a1e 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -17,6 +17,9 @@ lib_xua Change Log customer * CHANGE: HID interface for user to set and clear events from global variable to function + * 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 0.2.1 ----- From dac71e8b38eff92525fd740f9e0538630daec0b3 Mon Sep 17 00:00:00 2001 From: mbanth Date: Fri, 17 Jan 2020 13:16:26 +0000 Subject: [PATCH 19/22] Update copyright date range --- lib_xua/src/core/endpoint0/xua_ep0_descriptors.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 566bc436..d91dbe7a 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved /** * @file xua_ep0_descriptors.h * @brief Device Descriptors From 4e13f9e442efd34100977c81abfe9a612065834f Mon Sep 17 00:00:00 2001 From: shuchitak Date: Tue, 21 Jan 2020 11:32:36 +0000 Subject: [PATCH 20/22] added an invalid event type --- lib_xua/src/core/user/hid/user_hid.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib_xua/src/core/user/hid/user_hid.h b/lib_xua/src/core/user/hid/user_hid.h index e2d64c7d..91b32290 100644 --- a/lib_xua/src/core/user/hid/user_hid.h +++ b/lib_xua/src/core/user/hid/user_hid.h @@ -42,7 +42,8 @@ typedef enum hidEventId_t { HID_EVENT_ID_EVT24, HID_EVENT_ID_EVT25, HID_EVENT_ID_EVT26, - HID_EVENT_ID_EVT27 + HID_EVENT_ID_EVT27, + HID_EVENT_ID_INVALID = 0xffffffff, } hidEventId_t; #define HID_DATA_BYTES 4 From ae2f19224e667c56c33b47a4d7d9520808fb34be Mon Sep 17 00:00:00 2001 From: Larry Snizek Date: Tue, 21 Jan 2020 16:12:38 +0000 Subject: [PATCH 21/22] Expose DFU detach timeout value --- lib_xua/api/xua_conf_default.h | 7 ++++++- lib_xua/src/core/endpoint0/xua_ep0_descriptors.h | 8 ++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lib_xua/api/xua_conf_default.h b/lib_xua/api/xua_conf_default.h index 9bfa7bbd..490647cc 100644 --- a/lib_xua/api/xua_conf_default.h +++ b/lib_xua/api/xua_conf_default.h @@ -1445,6 +1445,12 @@ enum USBEndpointNumber_Out #error Bad DEFAULT_MCLK_FREQ #endif +/* DFU functional descriptor wDetachTimeOut field (milliseconds) + * Time for device to wait for bus reset after DETACH request before reverting to idle state */ +#ifndef DFU_DETACH_TIME_OUT +#define DFU_DETACH_TIME_OUT 250 +#endif + #if ((MCLK_441 % MIN_FREQ) == 0) #define MIN_FREQ_44 MIN_FREQ #define MIN_FREQ_48 ((48000 * 512)/((44100 * 512)/MIN_FREQ)) @@ -1466,4 +1472,3 @@ enum USBEndpointNumber_Out #if (CODEC_MASTER == 1) && (DSD_CHANS_DAC != 0) #error CODEC_MASTER with DSD is currently unsupported #endif - diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 1461fc16..76245fac 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -2068,8 +2068,8 @@ USB_Config_Descriptor_Audio2_t cfgDesc_Audio2= 0x09, /* 0 Size */ 0x21, /* 1 bDescriptorType : DFU FUNCTIONAL */ 0x07, /* 2 bmAttributes */ - 0xFA, /* 3 wDetachTimeOut */ - 0x00, /* 4 wDetachTimeOut */ + DFU_DETACH_TIME_OUT & 0xFF, /* 3 wDetachTimeOut */ + (DFU_DETACH_TIME_OUT >> 8) & 0xFF, /* 4 wDetachTimeOut */ 0x40, /* 5 wTransferSize */ 0x00, /* 6 wTransferSize */ 0x10, /* 7 bcdDFUVersion */ @@ -2849,8 +2849,8 @@ unsigned char cfgDesc_Audio1[] = 0x09, /* 0 Size */ 0x21, /* 1 bDescriptorType : DFU FUNCTIONAL */ 0x07, /* 2 bmAttributes */ - 0xFA, /* 3 wDetachTimeOut */ - 0x00, /* 4 wDetachTimeOut */ + DFU_DETACH_TIME_OUT & 0xFF, /* 3 wDetachTimeOut */ + (DFU_DETACH_TIME_OUT >> 8) & 0xFF, /* 4 wDetachTimeOut */ 0x40, /* 5 wTransferSize */ 0x00, /* 6 wTransferSize */ 0x10, /* 7 bcdDFUVersion */ From 86667227980740d82f135def26f2f24509c33a2f Mon Sep 17 00:00:00 2001 From: Larry Snizek Date: Tue, 21 Jan 2020 16:45:54 +0000 Subject: [PATCH 22/22] Library checks --- LICENSE.txt | 2 +- lib_xua/LICENSE.txt | 2 +- lib_xua/api/xua_conf_default.h | 2 +- lib_xua/src/core/endpoint0/xua_ep0_descriptors.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index 19f8e7cc..d4acef94 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ Software Release License Agreement -Copyright (c) 2011-2019, XMOS, All rights reserved. +Copyright (c) 2011-2020, XMOS, All rights reserved. BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. diff --git a/lib_xua/LICENSE.txt b/lib_xua/LICENSE.txt index 3932a9ae..7f5e44ce 100644 --- a/lib_xua/LICENSE.txt +++ b/lib_xua/LICENSE.txt @@ -1,6 +1,6 @@ Software Release License Agreement -Copyright (c) 2017-2019, XMOS, All rights reserved. +Copyright (c) 2017-2020, XMOS, All rights reserved. BY ACCESSING, USING, INSTALLING OR DOWNLOADING THE XMOS SOFTWARE, YOU AGREE TO BE BOUND BY THE FOLLOWING TERMS. IF YOU DO NOT AGREE TO THESE, DO NOT ATTEMPT TO DOWNLOAD, ACCESS OR USE THE XMOS Software. diff --git a/lib_xua/api/xua_conf_default.h b/lib_xua/api/xua_conf_default.h index 490647cc..79aa061b 100644 --- a/lib_xua/api/xua_conf_default.h +++ b/lib_xua/api/xua_conf_default.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved /* * @brief Defines relating to device configuration and customisation of lib_xua * @author Ross Owen, XMOS Limited diff --git a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h index 76245fac..eb71309e 100644 --- a/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h +++ b/lib_xua/src/core/endpoint0/xua_ep0_descriptors.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011-2019, XMOS Ltd, All rights reserved +// Copyright (c) 2011-2020, XMOS Ltd, All rights reserved /** * @file xua_ep0_descriptors.h * @brief Device Descriptors