From 1ae9c554771f25a9d5aff3edf107008794e4cacf Mon Sep 17 00:00:00 2001 From: Angel Cascarino Date: Tue, 4 Jan 2022 12:37:05 +0000 Subject: [PATCH 01/43] Added hardware locks --- lib_xua/src/hid/hid_report.c | 52 +++++++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 3 deletions(-) diff --git a/lib_xua/src/hid/hid_report.c b/lib_xua/src/hid/hid_report.c index a647204e..4e75fbdf 100644 --- a/lib_xua/src/hid/hid_report.c +++ b/lib_xua/src/hid/hid_report.c @@ -9,6 +9,7 @@ #include "descriptor_defs.h" #include "xua_hid_report.h" #include "hid_report_descriptor.h" +#include "hwlock.h" #define HID_REPORT_ITEM_LOCATION_SIZE ( 1 ) @@ -18,6 +19,9 @@ /* * Each element in s_hidChangePending corresponds to an element in hidReports. */ + +hwlock_t hidStaticVarLock = hwlock_alloc(); + static unsigned s_hidChangePending[ HID_REPORT_COUNT ]; static unsigned char s_hidReportDescriptor[ HID_REPORT_DESCRIPTOR_MAX_LENGTH ]; static size_t s_hidReportDescriptorLength; @@ -134,30 +138,36 @@ static size_t hidTranslateItem( const USB_HID_Short_Item_t* inPtr, unsigned char void hidCalcNextReportTime( const unsigned id ) { + hwlock_acquire(hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { if( id == hidGetElementReportId( hidReports[ idx ]->location )) { s_hidNextReportTime[ idx ] = s_hidReportTime[ idx ] + s_hidCurrentPeriod[ idx ]; } } + hwlock_release(hidStaticVarLock); } void hidCaptureReportTime( const unsigned id, const unsigned time ) { + hwlock_acquire(hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { if( id == hidGetElementReportId( hidReports[ idx ]->location )) { s_hidReportTime[ idx ] = time; } } + hwlock_release(hidStaticVarLock); } void hidClearChangePending( const unsigned id ) { + hwlock_acquire(hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx) { if(( id == 0U ) || ( id == hidGetElementReportId( hidReports[ idx ]->location ))) { s_hidChangePending[ idx ] = 0U; break; } } + hwlock_release(hidStaticVarLock); } static unsigned hidGetElementBitLocation( const unsigned short location ) @@ -202,7 +212,9 @@ static unsigned hidGetItemType( const unsigned char header ) return bType; } -unsigned hidGetNextReportTime( const unsigned id ) { +unsigned hidGetNextReportTime( const unsigned id ) +{ + hwlock_acquire(hidStaticVarLock); unsigned retVal = 0U; for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { @@ -210,28 +222,35 @@ unsigned hidGetNextReportTime( const unsigned id ) { retVal = s_hidNextReportTime[ idx ]; } } + hwlock_release(hidStaticVarLock); return retVal; } unsigned hidIsReportDescriptorPrepared( void ) { + hwlock_acquire(hidStaticVarLock); return s_hidReportDescriptorPrepared; + hwlock_release(hidStaticVarLock); } unsigned char* hidGetReportDescriptor( void ) { unsigned char* retVal = NULL; + hwlock_acquire(hidStaticVarLock); if( s_hidReportDescriptorPrepared ) { retVal = s_hidReportDescriptor; } + hwlock_release(hidStaticVarLock); return retVal; } size_t hidGetReportDescriptorLength( void ) { + hwlock_acquire(hidStaticVarLock); size_t retVal = ( s_hidReportDescriptorPrepared ) ? s_hidReportDescriptorLength : 0U; + hwlock_release(hidStaticVarLock); return retVal; } @@ -320,6 +339,7 @@ unsigned hidGetReportItem( size_t hidGetReportLength( const unsigned id ) { + hwlock_acquire(hidStaticVarLock); size_t retVal = 0U; if( s_hidReportDescriptorPrepared ) { for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { @@ -328,11 +348,13 @@ size_t hidGetReportLength( const unsigned id ) } } } + hwlock_release(hidStaticVarLock); return retVal; } unsigned hidGetReportPeriod( const unsigned id ) { + hwlock_acquire(hidStaticVarLock); unsigned retVal = 0U; for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx) { if( id == hidGetElementReportId( hidReports[ idx ]->location )) { @@ -340,10 +362,13 @@ unsigned hidGetReportPeriod( const unsigned id ) break; } } + hwlock_release(hidStaticVarLock); return retVal; } -unsigned hidGetReportTime( const unsigned id ) { +unsigned hidGetReportTime( const unsigned id ) +{ + hwlock_acquire(hidStaticVarLock); unsigned retVal = 0U; for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { @@ -351,6 +376,7 @@ unsigned hidGetReportTime( const unsigned id ) { retVal = s_hidReportTime[ idx ]; } } + hwlock_release(hidStaticVarLock); return retVal; } @@ -368,6 +394,7 @@ static unsigned hidGetUsagePage( const unsigned id ) unsigned hidIsChangePending( const unsigned id ) { + hwlock_acquire(hidStaticVarLock); unsigned retVal = 0U; for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx) { if( id == 0U && s_hidChangePending[ idx ] != 0U ) { @@ -377,11 +404,13 @@ unsigned hidIsChangePending( const unsigned id ) break; } } + hwlock_release(hidStaticVarLock); return retVal; } unsigned hidIsIdleActive( const unsigned id ) { + hwlock_acquire(hidStaticVarLock); unsigned retVal = 0U; if( 0U == id ) { retVal = 1U; @@ -395,11 +424,13 @@ unsigned hidIsIdleActive( const unsigned id ) break; } } - return retVal; + hwlock_release(hidStaticVarLock); + return retVal; } void hidPrepareReportDescriptor( void ) { + hwlock_acquire(hidStaticVarLock); if( !s_hidReportDescriptorPrepared ) { s_hidReportDescriptorLength = 0U; unsigned char* ptr = s_hidReportDescriptor; @@ -410,49 +441,60 @@ void hidPrepareReportDescriptor( void ) s_hidReportDescriptorPrepared = 1U; } + hwlock_release(hidStaticVarLock); } void hidReportInit( void ) { + hwlock_acquire(hidStaticVarLock); for( unsigned idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { s_hidCurrentPeriod[ idx ] = ENDPOINT_INT_INTERVAL_IN_HID * MS_IN_TICKS; } memset( s_hidIdleActive, 0, sizeof( s_hidIdleActive ) ); memset( s_hidChangePending, 0, sizeof( s_hidChangePending ) ); + hwlock_release(hidStaticVarLock); } void hidResetReportDescriptor( void ) { + hwlock_acquire(hidStaticVarLock); s_hidReportDescriptorPrepared = 0U; + hwlock_release(hidStaticVarLock); } void hidSetChangePending( const unsigned id ) { + hwlock_acquire(hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx) { if( id == hidGetElementReportId( hidReports[ idx ]->location )) { s_hidChangePending[ idx ] = 1U; break; } } + hwlock_release(hidStaticVarLock); } void hidSetIdle( const unsigned id, const unsigned state ) { + hwlock_acquire(hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx) { if( id == hidGetElementReportId( hidReports[ idx ]->location )) { s_hidIdleActive[ idx ] = ( state != 0U ); break; } } + hwlock_release(hidStaticVarLock); } void hidSetNextReportTime( const unsigned id, const unsigned time ) { + hwlock_acquire(hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { if( id == hidGetElementReportId( hidReports[ idx ]->location )) { s_hidNextReportTime[ idx ] = time; } } + hwlock_release(hidStaticVarLock); } unsigned hidSetReportItem( @@ -464,6 +506,7 @@ unsigned hidSetReportItem( const unsigned char data[] ) { + hwlock_acquire(hidStaticVarLock); unsigned retVal = HID_STATUS_IN_USE; if( !s_hidReportDescriptorPrepared ) { @@ -511,17 +554,20 @@ unsigned hidSetReportItem( } } + hwlock_release(hidStaticVarLock); return retVal; } void hidSetReportPeriod( const unsigned id, const unsigned period ) { + hwlock_acquire(hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx) { if( id == hidGetElementReportId( hidReports[ idx ]->location )) { s_hidCurrentPeriod[ idx ] = period; break; } } + hwlock_release(hidStaticVarLock); } static size_t hidTranslateItem( const USB_HID_Short_Item_t* inPtr, unsigned char** outPtrPtr ) From fa9d483d2f40b33133edb8f21d073b1112fc5691 Mon Sep 17 00:00:00 2001 From: Angel Cascarino Date: Tue, 4 Jan 2022 13:23:15 +0000 Subject: [PATCH 02/43] Updated hwlock allocation --- lib_xua/src/hid/hid_report.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib_xua/src/hid/hid_report.c b/lib_xua/src/hid/hid_report.c index 4e75fbdf..19aa2eae 100644 --- a/lib_xua/src/hid/hid_report.c +++ b/lib_xua/src/hid/hid_report.c @@ -20,7 +20,8 @@ * Each element in s_hidChangePending corresponds to an element in hidReports. */ -hwlock_t hidStaticVarLock = hwlock_alloc(); +hwlock_t hidStaticVarLock; +hidStaticVarLock = hwlock_alloc(); static unsigned s_hidChangePending[ HID_REPORT_COUNT ]; static unsigned char s_hidReportDescriptor[ HID_REPORT_DESCRIPTOR_MAX_LENGTH ]; From 911c8c51f28f0ee91e58c88a6aefe5a23da63f55 Mon Sep 17 00:00:00 2001 From: Angel Cascarino Date: Tue, 4 Jan 2022 13:48:48 +0000 Subject: [PATCH 03/43] Change initialisation of hwlock --- lib_xua/src/hid/hid_report.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib_xua/src/hid/hid_report.c b/lib_xua/src/hid/hid_report.c index 19aa2eae..9017ec63 100644 --- a/lib_xua/src/hid/hid_report.c +++ b/lib_xua/src/hid/hid_report.c @@ -21,7 +21,6 @@ */ hwlock_t hidStaticVarLock; -hidStaticVarLock = hwlock_alloc(); static unsigned s_hidChangePending[ HID_REPORT_COUNT ]; static unsigned char s_hidReportDescriptor[ HID_REPORT_DESCRIPTOR_MAX_LENGTH ]; @@ -447,6 +446,8 @@ void hidPrepareReportDescriptor( void ) void hidReportInit( void ) { + hidStaticVarLock = hwlock_alloc(); + hwlock_acquire(hidStaticVarLock); for( unsigned idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { s_hidCurrentPeriod[ idx ] = ENDPOINT_INT_INTERVAL_IN_HID * MS_IN_TICKS; From 55de7a8abd25e7a3ed1eec4e066078448e741c53 Mon Sep 17 00:00:00 2001 From: Angel Cascarino Date: Tue, 4 Jan 2022 14:07:06 +0000 Subject: [PATCH 04/43] Removed locks from hidSetReportItem --- lib_xua/src/hid/hid_report.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib_xua/src/hid/hid_report.c b/lib_xua/src/hid/hid_report.c index 9017ec63..60dbed35 100644 --- a/lib_xua/src/hid/hid_report.c +++ b/lib_xua/src/hid/hid_report.c @@ -508,7 +508,6 @@ unsigned hidSetReportItem( const unsigned char data[] ) { - hwlock_acquire(hidStaticVarLock); unsigned retVal = HID_STATUS_IN_USE; if( !s_hidReportDescriptorPrepared ) { @@ -555,8 +554,6 @@ unsigned hidSetReportItem( } } } - - hwlock_release(hidStaticVarLock); return retVal; } From cd0248c162586fdde386935b9a797f3dde03bbb0 Mon Sep 17 00:00:00 2001 From: Angel Cascarino Date: Tue, 4 Jan 2022 14:19:54 +0000 Subject: [PATCH 05/43] Removed locks in isReportDesciptorPrepared --- lib_xua/src/hid/hid_report.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib_xua/src/hid/hid_report.c b/lib_xua/src/hid/hid_report.c index 60dbed35..be5534eb 100644 --- a/lib_xua/src/hid/hid_report.c +++ b/lib_xua/src/hid/hid_report.c @@ -228,9 +228,7 @@ unsigned hidGetNextReportTime( const unsigned id ) unsigned hidIsReportDescriptorPrepared( void ) { - hwlock_acquire(hidStaticVarLock); return s_hidReportDescriptorPrepared; - hwlock_release(hidStaticVarLock); } unsigned char* hidGetReportDescriptor( void ) From 3988906e39f76e760123054f49283b1f8b263853 Mon Sep 17 00:00:00 2001 From: mbanth Date: Wed, 5 Jan 2022 14:58:04 +0000 Subject: [PATCH 06/43] Add locks around references to included static variables. --- lib_xua/src/hid/hid_report.c | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/lib_xua/src/hid/hid_report.c b/lib_xua/src/hid/hid_report.c index be5534eb..3785518b 100644 --- a/lib_xua/src/hid/hid_report.c +++ b/lib_xua/src/hid/hid_report.c @@ -228,7 +228,10 @@ unsigned hidGetNextReportTime( const unsigned id ) unsigned hidIsReportDescriptorPrepared( void ) { - return s_hidReportDescriptorPrepared; + hwlock_acquire(hidStaticVarLock); + unsigned retVal = s_hidReportDescriptorPrepared; + hwlock_release(hidStaticVarLock); + return retVal; } unsigned char* hidGetReportDescriptor( void ) @@ -255,25 +258,31 @@ size_t hidGetReportDescriptorLength( void ) unsigned hidGetReportIdLimit ( void ) { unsigned retVal = 0U; + hwlock_acquire(hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { unsigned reportId = hidGetElementReportId( hidReports[ idx ]->location ); if( reportId >= retVal ) { retVal = reportId + 1; } } + hwlock_release(hidStaticVarLock); return retVal; } unsigned hidIsReportIdInUse ( void ) { + hwlock_acquire(hidStaticVarLock); if ( hidGetElementReportId( hidReports[ 0 ]->location ) ) { + hwlock_release(hidStaticVarLock); return 1; } + hwlock_release(hidStaticVarLock); return 0; } unsigned hidIsReportIdValid ( unsigned id ) { size_t retVal = 0; + hwlock_acquire(hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { unsigned reportId = hidGetElementReportId( hidReports[ idx ]->location ); if( reportId == id ) { @@ -282,12 +291,14 @@ unsigned hidIsReportIdValid ( unsigned id ) { } } + hwlock_release(hidStaticVarLock); return retVal; } unsigned hidGetNextValidReportId ( unsigned idPrev ) { size_t retIndex = 0; + hwlock_acquire(hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { unsigned reportId = hidGetElementReportId( hidReports[ idx ]->location ); if( reportId == idPrev ) { @@ -296,7 +307,9 @@ unsigned hidGetNextValidReportId ( unsigned idPrev ) { } } - return hidGetElementReportId( hidReports[ retIndex ]->location ); + unsigned retVal = hidGetElementReportId( hidReports[ retIndex ]->location ); + hwlock_release(hidStaticVarLock); + return retVal; } #define HID_CONFIGURABLE_ELEMENT_COUNT ( sizeof hidConfigurableElements / sizeof ( USB_HID_Report_Element_t* )) @@ -311,7 +324,10 @@ unsigned hidGetReportItem( { unsigned retVal = HID_STATUS_BAD_ID; for( size_t elementIdx = 0U; elementIdx < HID_CONFIGURABLE_ELEMENT_COUNT; ++elementIdx ) { + hwlock_acquire(hidStaticVarLock); USB_HID_Report_Element_t element = *hidConfigurableElements[ elementIdx ]; + hwlock_release(hidStaticVarLock); + unsigned bBit = hidGetElementBitLocation( element.location ); unsigned bByte = hidGetElementByteLocation( element.location ); unsigned bId = hidGetElementReportId( element.location ); @@ -374,6 +390,7 @@ unsigned hidGetReportTime( const unsigned id ) retVal = s_hidReportTime[ idx ]; } } + hwlock_release(hidStaticVarLock); return retVal; } @@ -381,19 +398,24 @@ unsigned hidGetReportTime( const unsigned id ) static unsigned hidGetUsagePage( const unsigned id ) { unsigned retVal = 0U; + hwlock_acquire(hidStaticVarLock); + for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx) { if( id == hidGetElementReportId( hidReports[ idx ]->location )) { retVal = hidReports[ idx ]->item.data[ 0 ]; break; } } + + hwlock_release(hidStaticVarLock); return retVal; } unsigned hidIsChangePending( const unsigned id ) { - hwlock_acquire(hidStaticVarLock); unsigned retVal = 0U; + hwlock_acquire(hidStaticVarLock); + for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx) { if( id == 0U && s_hidChangePending[ idx ] != 0U ) { retVal = 1; @@ -402,18 +424,19 @@ unsigned hidIsChangePending( const unsigned id ) break; } } + hwlock_release(hidStaticVarLock); return retVal; } unsigned hidIsIdleActive( const unsigned id ) { - hwlock_acquire(hidStaticVarLock); unsigned retVal = 0U; if( 0U == id ) { retVal = 1U; } + hwlock_acquire(hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx) { if( id == 0U ) { retVal &= ( s_hidIdleActive[ idx ] != 0U ); @@ -520,7 +543,10 @@ unsigned hidSetReportItem( retVal = HID_STATUS_BAD_HEADER; } else { for( size_t elementIdx = 0U; elementIdx < HID_CONFIGURABLE_ELEMENT_COUNT; ++elementIdx ) { + hwlock_acquire(hidStaticVarLock); USB_HID_Report_Element_t element = *hidConfigurableElements[ elementIdx ]; + hwlock_release(hidStaticVarLock); + unsigned bBit = hidGetElementBitLocation( element.location ); unsigned bByte = hidGetElementByteLocation( element.location ); unsigned bId = hidGetElementReportId( element.location ); @@ -543,7 +569,9 @@ unsigned hidSetReportItem( element.item.data[ dataIdx ] = 0U; } + hwlock_acquire(hidStaticVarLock); *hidConfigurableElements[ elementIdx ] = element; + hwlock_release(hidStaticVarLock); retVal = HID_STATUS_GOOD; break; } From 7a0cfca2805909397a1408437e60f9dd54ee78d2 Mon Sep 17 00:00:00 2001 From: mbanth Date: Wed, 5 Jan 2022 17:01:28 +0000 Subject: [PATCH 07/43] Experiment with obtaining the time used in HidIsSetIdleSilenced() from outside of the function --- lib_xua/src/core/buffer/ep/ep_buffer.xc | 10 +++++++--- lib_xua/src/hid/hid.xc | 6 +++--- lib_xua/src/hid/xua_hid.h | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/lib_xua/src/core/buffer/ep/ep_buffer.xc b/lib_xua/src/core/buffer/ep/ep_buffer.xc index e2f81ef4..93781ca9 100644 --- a/lib_xua/src/core/buffer/ep/ep_buffer.xc +++ b/lib_xua/src/core/buffer/ep/ep_buffer.xc @@ -392,6 +392,10 @@ void XUA_Buffer_Ep(register chanend c_aud_out, #endif #endif + timer tmr; + unsigned loopTime; + tmr :> loopTime; + while(1) { XUD_Result_t result; @@ -894,14 +898,13 @@ void XUA_Buffer_Ep(register chanend c_aud_out, #if( 0 < HID_CONTROLS ) /* HID Report Data */ - case (hidIsChangePending(0U) || !HidIsSetIdleSilenced(0U)) => XUD_SetData_Select(c_hid, ep_hid, result): + case (hidIsChangePending(0U) || !HidIsSetIdleSilenced(0U, loopTime)) => XUD_SetData_Select(c_hid, ep_hid, result): { - timer tmr; unsigned reportTime; tmr :> reportTime; for(unsigned id = hidIsReportIdInUse(); id < hidGetReportIdLimit(); ++id) { - if(0U == id || (hidIsChangePending(id) || !HidIsSetIdleSilenced(id))) { + if(0U == id || (hidIsChangePending(id) || !HidIsSetIdleSilenced(id, reportTime))) { hidCaptureReportTime(id, reportTime); int hidDataLength = (int) UserHIDGetData(id, g_hidData); XUD_SetReady_In(ep_hid, g_hidData, hidDataLength); @@ -1122,6 +1125,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out, } + tmr :> loopTime; } } #endif /* XUA_USB_EN */ diff --git a/lib_xua/src/hid/hid.xc b/lib_xua/src/hid/hid.xc index 0c09d609..3559e6c8 100644 --- a/lib_xua/src/hid/hid.xc +++ b/lib_xua/src/hid/hid.xc @@ -35,16 +35,16 @@ XUD_Result_t HidInterfaceClassRequests( return result; } -unsigned HidIsSetIdleSilenced( const unsigned id ) +unsigned HidIsSetIdleSilenced( const unsigned id, const unsigned currentTime ) { unsigned isSilenced = hidIsIdleActive( id ); if( !isSilenced ) { - unsigned currentTime; +// unsigned currentTime; // Use inline assembly to access the time without creating a side-effect. // The mapper complains if the time comes from an XC timer because this function is called in the guard of a select case. // Appearently the use of a timer creates a side-effect that prohibits the operation of the select functionality. - asm volatile( "gettime %0" : "=r" ( currentTime )); +// asm volatile( "gettime %0" : "=r" ( currentTime )); isSilenced = ( 0U == hidGetReportPeriod( id ) || ( timeafter( hidGetNextReportTime( id ), currentTime ))); } diff --git a/lib_xua/src/hid/xua_hid.h b/lib_xua/src/hid/xua_hid.h index 6e5d31b2..f7bc9448 100644 --- a/lib_xua/src/hid/xua_hid.h +++ b/lib_xua/src/hid/xua_hid.h @@ -41,6 +41,6 @@ XUD_Result_t HidInterfaceClassRequests( * \retval 1 -- Do not send the HID Report * \retval 0 -- Send the HID Report */ -unsigned HidIsSetIdleSilenced( const unsigned id ); +unsigned HidIsSetIdleSilenced( const unsigned id, const unsigned currentTime ); #endif // __XUA_HID_H__ From 737c5bd7d07f7e5e37c0d4b00c0da3f0505bebe2 Mon Sep 17 00:00:00 2001 From: mbanth Date: Wed, 5 Jan 2022 17:52:07 +0000 Subject: [PATCH 08/43] Manually revert to capture the current time within the HidIsSetIdleSilenced() function --- lib_xua/src/core/buffer/ep/ep_buffer.xc | 8 ++------ lib_xua/src/hid/hid.xc | 6 +++--- lib_xua/src/hid/xua_hid.h | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/lib_xua/src/core/buffer/ep/ep_buffer.xc b/lib_xua/src/core/buffer/ep/ep_buffer.xc index 93781ca9..ac1a233c 100644 --- a/lib_xua/src/core/buffer/ep/ep_buffer.xc +++ b/lib_xua/src/core/buffer/ep/ep_buffer.xc @@ -393,8 +393,6 @@ void XUA_Buffer_Ep(register chanend c_aud_out, #endif timer tmr; - unsigned loopTime; - tmr :> loopTime; while(1) { @@ -898,13 +896,13 @@ void XUA_Buffer_Ep(register chanend c_aud_out, #if( 0 < HID_CONTROLS ) /* HID Report Data */ - case (hidIsChangePending(0U) || !HidIsSetIdleSilenced(0U, loopTime)) => XUD_SetData_Select(c_hid, ep_hid, result): + case (hidIsChangePending(0U) || !HidIsSetIdleSilenced(0U)) => XUD_SetData_Select(c_hid, ep_hid, result): { unsigned reportTime; tmr :> reportTime; for(unsigned id = hidIsReportIdInUse(); id < hidGetReportIdLimit(); ++id) { - if(0U == id || (hidIsChangePending(id) || !HidIsSetIdleSilenced(id, reportTime))) { + if(0U == id || (hidIsChangePending(id) || !HidIsSetIdleSilenced(id))) { hidCaptureReportTime(id, reportTime); int hidDataLength = (int) UserHIDGetData(id, g_hidData); XUD_SetReady_In(ep_hid, g_hidData, hidDataLength); @@ -1124,8 +1122,6 @@ void XUA_Buffer_Ep(register chanend c_aud_out, } - - tmr :> loopTime; } } #endif /* XUA_USB_EN */ diff --git a/lib_xua/src/hid/hid.xc b/lib_xua/src/hid/hid.xc index 3559e6c8..0c09d609 100644 --- a/lib_xua/src/hid/hid.xc +++ b/lib_xua/src/hid/hid.xc @@ -35,16 +35,16 @@ XUD_Result_t HidInterfaceClassRequests( return result; } -unsigned HidIsSetIdleSilenced( const unsigned id, const unsigned currentTime ) +unsigned HidIsSetIdleSilenced( const unsigned id ) { unsigned isSilenced = hidIsIdleActive( id ); if( !isSilenced ) { -// unsigned currentTime; + unsigned currentTime; // Use inline assembly to access the time without creating a side-effect. // The mapper complains if the time comes from an XC timer because this function is called in the guard of a select case. // Appearently the use of a timer creates a side-effect that prohibits the operation of the select functionality. -// asm volatile( "gettime %0" : "=r" ( currentTime )); + asm volatile( "gettime %0" : "=r" ( currentTime )); isSilenced = ( 0U == hidGetReportPeriod( id ) || ( timeafter( hidGetNextReportTime( id ), currentTime ))); } diff --git a/lib_xua/src/hid/xua_hid.h b/lib_xua/src/hid/xua_hid.h index f7bc9448..6e5d31b2 100644 --- a/lib_xua/src/hid/xua_hid.h +++ b/lib_xua/src/hid/xua_hid.h @@ -41,6 +41,6 @@ XUD_Result_t HidInterfaceClassRequests( * \retval 1 -- Do not send the HID Report * \retval 0 -- Send the HID Report */ -unsigned HidIsSetIdleSilenced( const unsigned id, const unsigned currentTime ); +unsigned HidIsSetIdleSilenced( const unsigned id ); #endif // __XUA_HID_H__ From a18e5a976fe20c0874a886689f32692e140a5d3a Mon Sep 17 00:00:00 2001 From: Angel Cascarino Date: Fri, 7 Jan 2022 17:30:27 +0000 Subject: [PATCH 09/43] Change hwlock to swlock in hid_report.c --- lib_xua/src/hid/hid_report.c | 118 +++++++++++++++++------------------ 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/lib_xua/src/hid/hid_report.c b/lib_xua/src/hid/hid_report.c index 3785518b..1607d7b1 100644 --- a/lib_xua/src/hid/hid_report.c +++ b/lib_xua/src/hid/hid_report.c @@ -9,18 +9,20 @@ #include "descriptor_defs.h" #include "xua_hid_report.h" #include "hid_report_descriptor.h" -#include "hwlock.h" +#include "swlock.h" #define HID_REPORT_ITEM_LOCATION_SIZE ( 1 ) #define HID_REPORT_DESCRIPTOR_ITEM_COUNT ( sizeof hidReportDescriptorItems / sizeof ( USB_HID_Short_Item_t* )) #define HID_REPORT_DESCRIPTOR_MAX_LENGTH ( HID_REPORT_DESCRIPTOR_ITEM_COUNT * \ ( sizeof ( USB_HID_Short_Item_t ) - HID_REPORT_ITEM_LOCATION_SIZE )) + +swlock_t hidStaticVarLock = SWLOCK_INITIAL_VALUE; + /* * Each element in s_hidChangePending corresponds to an element in hidReports. */ -hwlock_t hidStaticVarLock; static unsigned s_hidChangePending[ HID_REPORT_COUNT ]; static unsigned char s_hidReportDescriptor[ HID_REPORT_DESCRIPTOR_MAX_LENGTH ]; @@ -138,36 +140,36 @@ static size_t hidTranslateItem( const USB_HID_Short_Item_t* inPtr, unsigned char void hidCalcNextReportTime( const unsigned id ) { - hwlock_acquire(hidStaticVarLock); + swlock_acquire(hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { if( id == hidGetElementReportId( hidReports[ idx ]->location )) { s_hidNextReportTime[ idx ] = s_hidReportTime[ idx ] + s_hidCurrentPeriod[ idx ]; } } - hwlock_release(hidStaticVarLock); + swlock_release(hidStaticVarLock); } void hidCaptureReportTime( const unsigned id, const unsigned time ) { - hwlock_acquire(hidStaticVarLock); + swlock_acquire(hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { if( id == hidGetElementReportId( hidReports[ idx ]->location )) { s_hidReportTime[ idx ] = time; } } - hwlock_release(hidStaticVarLock); + swlock_release(hidStaticVarLock); } void hidClearChangePending( const unsigned id ) { - hwlock_acquire(hidStaticVarLock); + swlock_acquire(hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx) { if(( id == 0U ) || ( id == hidGetElementReportId( hidReports[ idx ]->location ))) { s_hidChangePending[ idx ] = 0U; break; } } - hwlock_release(hidStaticVarLock); + swlock_release(hidStaticVarLock); } static unsigned hidGetElementBitLocation( const unsigned short location ) @@ -214,7 +216,7 @@ static unsigned hidGetItemType( const unsigned char header ) unsigned hidGetNextReportTime( const unsigned id ) { - hwlock_acquire(hidStaticVarLock); + swlock_acquire(hidStaticVarLock); unsigned retVal = 0U; for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { @@ -222,67 +224,67 @@ unsigned hidGetNextReportTime( const unsigned id ) retVal = s_hidNextReportTime[ idx ]; } } - hwlock_release(hidStaticVarLock); + swlock_release(hidStaticVarLock); return retVal; } unsigned hidIsReportDescriptorPrepared( void ) { - hwlock_acquire(hidStaticVarLock); + swlock_acquire(hidStaticVarLock); unsigned retVal = s_hidReportDescriptorPrepared; - hwlock_release(hidStaticVarLock); + swlock_release(hidStaticVarLock); return retVal; } unsigned char* hidGetReportDescriptor( void ) { unsigned char* retVal = NULL; - hwlock_acquire(hidStaticVarLock); + swlock_acquire(hidStaticVarLock); if( s_hidReportDescriptorPrepared ) { retVal = s_hidReportDescriptor; } - hwlock_release(hidStaticVarLock); + swlock_release(hidStaticVarLock); return retVal; } size_t hidGetReportDescriptorLength( void ) { - hwlock_acquire(hidStaticVarLock); + swlock_acquire(hidStaticVarLock); size_t retVal = ( s_hidReportDescriptorPrepared ) ? s_hidReportDescriptorLength : 0U; - hwlock_release(hidStaticVarLock); + swlock_release(hidStaticVarLock); return retVal; } unsigned hidGetReportIdLimit ( void ) { unsigned retVal = 0U; - hwlock_acquire(hidStaticVarLock); + swlock_acquire(hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { unsigned reportId = hidGetElementReportId( hidReports[ idx ]->location ); if( reportId >= retVal ) { retVal = reportId + 1; } } - hwlock_release(hidStaticVarLock); + swlock_release(hidStaticVarLock); return retVal; } unsigned hidIsReportIdInUse ( void ) { - hwlock_acquire(hidStaticVarLock); + swlock_acquire(hidStaticVarLock); if ( hidGetElementReportId( hidReports[ 0 ]->location ) ) { - hwlock_release(hidStaticVarLock); + swlock_release(hidStaticVarLock); return 1; } - hwlock_release(hidStaticVarLock); + swlock_release(hidStaticVarLock); return 0; } unsigned hidIsReportIdValid ( unsigned id ) { size_t retVal = 0; - hwlock_acquire(hidStaticVarLock); + swlock_acquire(hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { unsigned reportId = hidGetElementReportId( hidReports[ idx ]->location ); if( reportId == id ) { @@ -291,14 +293,14 @@ unsigned hidIsReportIdValid ( unsigned id ) { } } - hwlock_release(hidStaticVarLock); + swlock_release(hidStaticVarLock); return retVal; } unsigned hidGetNextValidReportId ( unsigned idPrev ) { size_t retIndex = 0; - hwlock_acquire(hidStaticVarLock); + swlock_acquire(hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { unsigned reportId = hidGetElementReportId( hidReports[ idx ]->location ); if( reportId == idPrev ) { @@ -308,7 +310,7 @@ unsigned hidGetNextValidReportId ( unsigned idPrev ) { } unsigned retVal = hidGetElementReportId( hidReports[ retIndex ]->location ); - hwlock_release(hidStaticVarLock); + swlock_release(hidStaticVarLock); return retVal; } @@ -324,9 +326,9 @@ unsigned hidGetReportItem( { unsigned retVal = HID_STATUS_BAD_ID; for( size_t elementIdx = 0U; elementIdx < HID_CONFIGURABLE_ELEMENT_COUNT; ++elementIdx ) { - hwlock_acquire(hidStaticVarLock); + swlock_acquire(hidStaticVarLock); USB_HID_Report_Element_t element = *hidConfigurableElements[ elementIdx ]; - hwlock_release(hidStaticVarLock); + swlock_release(hidStaticVarLock); unsigned bBit = hidGetElementBitLocation( element.location ); unsigned bByte = hidGetElementByteLocation( element.location ); @@ -353,7 +355,7 @@ unsigned hidGetReportItem( size_t hidGetReportLength( const unsigned id ) { - hwlock_acquire(hidStaticVarLock); + swlock_acquire(hidStaticVarLock); size_t retVal = 0U; if( s_hidReportDescriptorPrepared ) { for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { @@ -362,13 +364,13 @@ size_t hidGetReportLength( const unsigned id ) } } } - hwlock_release(hidStaticVarLock); + swlock_release(hidStaticVarLock); return retVal; } unsigned hidGetReportPeriod( const unsigned id ) { - hwlock_acquire(hidStaticVarLock); + swlock_acquire(hidStaticVarLock); unsigned retVal = 0U; for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx) { if( id == hidGetElementReportId( hidReports[ idx ]->location )) { @@ -376,13 +378,13 @@ unsigned hidGetReportPeriod( const unsigned id ) break; } } - hwlock_release(hidStaticVarLock); + swlock_release(hidStaticVarLock); return retVal; } unsigned hidGetReportTime( const unsigned id ) { - hwlock_acquire(hidStaticVarLock); + swlock_acquire(hidStaticVarLock); unsigned retVal = 0U; for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { @@ -391,14 +393,14 @@ unsigned hidGetReportTime( const unsigned id ) } } - hwlock_release(hidStaticVarLock); + swlock_release(hidStaticVarLock); return retVal; } static unsigned hidGetUsagePage( const unsigned id ) { unsigned retVal = 0U; - hwlock_acquire(hidStaticVarLock); + swlock_acquire(hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx) { if( id == hidGetElementReportId( hidReports[ idx ]->location )) { @@ -407,14 +409,14 @@ static unsigned hidGetUsagePage( const unsigned id ) } } - hwlock_release(hidStaticVarLock); + swlock_release(hidStaticVarLock); return retVal; } unsigned hidIsChangePending( const unsigned id ) { unsigned retVal = 0U; - hwlock_acquire(hidStaticVarLock); + swlock_acquire(hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx) { if( id == 0U && s_hidChangePending[ idx ] != 0U ) { @@ -425,7 +427,7 @@ unsigned hidIsChangePending( const unsigned id ) } } - hwlock_release(hidStaticVarLock); + swlock_release(hidStaticVarLock); return retVal; } @@ -436,7 +438,7 @@ unsigned hidIsIdleActive( const unsigned id ) retVal = 1U; } - hwlock_acquire(hidStaticVarLock); + swlock_acquire(hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx) { if( id == 0U ) { retVal &= ( s_hidIdleActive[ idx ] != 0U ); @@ -445,13 +447,13 @@ unsigned hidIsIdleActive( const unsigned id ) break; } } - hwlock_release(hidStaticVarLock); + swlock_release(hidStaticVarLock); return retVal; } void hidPrepareReportDescriptor( void ) { - hwlock_acquire(hidStaticVarLock); + swlock_acquire(hidStaticVarLock); if( !s_hidReportDescriptorPrepared ) { s_hidReportDescriptorLength = 0U; unsigned char* ptr = s_hidReportDescriptor; @@ -462,62 +464,60 @@ void hidPrepareReportDescriptor( void ) s_hidReportDescriptorPrepared = 1U; } - hwlock_release(hidStaticVarLock); + swlock_release(hidStaticVarLock); } void hidReportInit( void ) { - hidStaticVarLock = hwlock_alloc(); - - hwlock_acquire(hidStaticVarLock); + swlock_acquire(hidStaticVarLock); for( unsigned idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { s_hidCurrentPeriod[ idx ] = ENDPOINT_INT_INTERVAL_IN_HID * MS_IN_TICKS; } memset( s_hidIdleActive, 0, sizeof( s_hidIdleActive ) ); memset( s_hidChangePending, 0, sizeof( s_hidChangePending ) ); - hwlock_release(hidStaticVarLock); + swlock_release(hidStaticVarLock); } void hidResetReportDescriptor( void ) { - hwlock_acquire(hidStaticVarLock); + swlock_acquire(hidStaticVarLock); s_hidReportDescriptorPrepared = 0U; - hwlock_release(hidStaticVarLock); + swlock_release(hidStaticVarLock); } void hidSetChangePending( const unsigned id ) { - hwlock_acquire(hidStaticVarLock); + swlock_acquire(hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx) { if( id == hidGetElementReportId( hidReports[ idx ]->location )) { s_hidChangePending[ idx ] = 1U; break; } } - hwlock_release(hidStaticVarLock); + swlock_release(hidStaticVarLock); } void hidSetIdle( const unsigned id, const unsigned state ) { - hwlock_acquire(hidStaticVarLock); + swlock_acquire(hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx) { if( id == hidGetElementReportId( hidReports[ idx ]->location )) { s_hidIdleActive[ idx ] = ( state != 0U ); break; } } - hwlock_release(hidStaticVarLock); + swlock_release(hidStaticVarLock); } void hidSetNextReportTime( const unsigned id, const unsigned time ) { - hwlock_acquire(hidStaticVarLock); + swlock_acquire(hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { if( id == hidGetElementReportId( hidReports[ idx ]->location )) { s_hidNextReportTime[ idx ] = time; } } - hwlock_release(hidStaticVarLock); + swlock_release(hidStaticVarLock); } unsigned hidSetReportItem( @@ -543,9 +543,9 @@ unsigned hidSetReportItem( retVal = HID_STATUS_BAD_HEADER; } else { for( size_t elementIdx = 0U; elementIdx < HID_CONFIGURABLE_ELEMENT_COUNT; ++elementIdx ) { - hwlock_acquire(hidStaticVarLock); + swlock_acquire(hidStaticVarLock); USB_HID_Report_Element_t element = *hidConfigurableElements[ elementIdx ]; - hwlock_release(hidStaticVarLock); + swlock_release(hidStaticVarLock); unsigned bBit = hidGetElementBitLocation( element.location ); unsigned bByte = hidGetElementByteLocation( element.location ); @@ -569,9 +569,9 @@ unsigned hidSetReportItem( element.item.data[ dataIdx ] = 0U; } - hwlock_acquire(hidStaticVarLock); + swlock_acquire(hidStaticVarLock); *hidConfigurableElements[ elementIdx ] = element; - hwlock_release(hidStaticVarLock); + swlock_release(hidStaticVarLock); retVal = HID_STATUS_GOOD; break; } @@ -585,14 +585,14 @@ unsigned hidSetReportItem( void hidSetReportPeriod( const unsigned id, const unsigned period ) { - hwlock_acquire(hidStaticVarLock); + swlock_acquire(hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx) { if( id == hidGetElementReportId( hidReports[ idx ]->location )) { s_hidCurrentPeriod[ idx ] = period; break; } } - hwlock_release(hidStaticVarLock); + swlock_release(hidStaticVarLock); } static size_t hidTranslateItem( const USB_HID_Short_Item_t* inPtr, unsigned char** outPtrPtr ) From c352ed1132124aeada198ed499835a6448e4deaf Mon Sep 17 00:00:00 2001 From: Angel Cascarino Date: Fri, 7 Jan 2022 17:46:25 +0000 Subject: [PATCH 10/43] Alphabetise main functions in hid_report.c --- lib_xua/src/hid/hid_report.c | 68 ++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/lib_xua/src/hid/hid_report.c b/lib_xua/src/hid/hid_report.c index 1607d7b1..b45f18f2 100644 --- a/lib_xua/src/hid/hid_report.c +++ b/lib_xua/src/hid/hid_report.c @@ -228,14 +228,6 @@ unsigned hidGetNextReportTime( const unsigned id ) return retVal; } -unsigned hidIsReportDescriptorPrepared( void ) -{ - swlock_acquire(hidStaticVarLock); - unsigned retVal = s_hidReportDescriptorPrepared; - swlock_release(hidStaticVarLock); - return retVal; -} - unsigned char* hidGetReportDescriptor( void ) { unsigned char* retVal = NULL; @@ -271,32 +263,6 @@ unsigned hidGetReportIdLimit ( void ) { return retVal; } -unsigned hidIsReportIdInUse ( void ) { - swlock_acquire(hidStaticVarLock); - if ( hidGetElementReportId( hidReports[ 0 ]->location ) ) { - swlock_release(hidStaticVarLock); - return 1; - } - swlock_release(hidStaticVarLock); - return 0; -} - -unsigned hidIsReportIdValid ( unsigned id ) { - size_t retVal = 0; - - swlock_acquire(hidStaticVarLock); - for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { - unsigned reportId = hidGetElementReportId( hidReports[ idx ]->location ); - if( reportId == id ) { - retVal = 1; - break; - } - } - - swlock_release(hidStaticVarLock); - return retVal; -} - unsigned hidGetNextValidReportId ( unsigned idPrev ) { size_t retIndex = 0; @@ -451,6 +417,40 @@ unsigned hidIsIdleActive( const unsigned id ) return retVal; } +unsigned hidIsReportDescriptorPrepared( void ) +{ + swlock_acquire(hidStaticVarLock); + unsigned retVal = s_hidReportDescriptorPrepared; + swlock_release(hidStaticVarLock); + return retVal; +} + +unsigned hidIsReportIdInUse ( void ) { + swlock_acquire(hidStaticVarLock); + if ( hidGetElementReportId( hidReports[ 0 ]->location ) ) { + swlock_release(hidStaticVarLock); + return 1; + } + swlock_release(hidStaticVarLock); + return 0; +} + +unsigned hidIsReportIdValid ( unsigned id ) { + size_t retVal = 0; + + swlock_acquire(hidStaticVarLock); + for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { + unsigned reportId = hidGetElementReportId( hidReports[ idx ]->location ); + if( reportId == id ) { + retVal = 1; + break; + } + } + + swlock_release(hidStaticVarLock); + return retVal; +} + void hidPrepareReportDescriptor( void ) { swlock_acquire(hidStaticVarLock); From 9f667d96f8ee0c856f39a2a1a1ac5b9d7335af32 Mon Sep 17 00:00:00 2001 From: xmos-jenkins Date: Tue, 11 Jan 2022 11:23:28 +0000 Subject: [PATCH 11/43] Added alternative hidIsGetIdleSilenced function --- lib_xua/src/hid/hid.xc | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/lib_xua/src/hid/hid.xc b/lib_xua/src/hid/hid.xc index 0c09d609..3f81bd07 100644 --- a/lib_xua/src/hid/hid.xc +++ b/lib_xua/src/hid/hid.xc @@ -37,20 +37,40 @@ XUD_Result_t HidInterfaceClassRequests( unsigned HidIsSetIdleSilenced( const unsigned id ) { - unsigned isSilenced = hidIsIdleActive( id ); - - if( !isSilenced ) { unsigned currentTime; // Use inline assembly to access the time without creating a side-effect. // The mapper complains if the time comes from an XC timer because this function is called in the guard of a select case. // Appearently the use of a timer creates a side-effect that prohibits the operation of the select functionality. asm volatile( "gettime %0" : "=r" ( currentTime )); - isSilenced = ( 0U == hidGetReportPeriod( id ) || ( timeafter( hidGetNextReportTime( id ), currentTime ))); - } - return isSilenced; + unsigned isSilenced = timeafter(hidGetNextReportTime( id ), currentTime); + + // Calling hidGetReportPeriod with an ID of 0 is meaningless if we are using + // report IDs. + if (!hidIsReportIdInUse() || (id != 0)) + { + isSilenced |= ( 0U == hidGetReportPeriod( id ) ); + } + + return isSilenced; } +//unsigned HidIsSetIdleSilenced( const unsigned id ) +//{ +// unsigned isSilenced = hidIsIdleActive( id ); +// +// if( !isSilenced ) { +// unsigned currentTime; +// // Use inline assembly to access the time without creating a side-effect. +// // The mapper complains if the time comes from an XC timer because this function is called in the guard of a select case. +// // Appearently the use of a timer creates a side-effect that prohibits the operation of the select functionality. +// asm volatile( "gettime %0" : "=r" ( currentTime )); +// isSilenced = ( 0U == hidGetReportPeriod( id ) || ( timeafter( hidGetNextReportTime( id ), currentTime ))); +// } +// +// return isSilenced; +//} + /** * \brief Calculate the timer value for sending the next HID Report. * From d40ede152575e803e4815941aff994fb37213467 Mon Sep 17 00:00:00 2001 From: xmos-jenkins Date: Tue, 11 Jan 2022 11:32:14 +0000 Subject: [PATCH 12/43] Merged in older changes --- lib_xua/src/hid/hid_report.c | 42 ++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/lib_xua/src/hid/hid_report.c b/lib_xua/src/hid/hid_report.c index b45f18f2..54cd83fd 100644 --- a/lib_xua/src/hid/hid_report.c +++ b/lib_xua/src/hid/hid_report.c @@ -23,7 +23,6 @@ swlock_t hidStaticVarLock = SWLOCK_INITIAL_VALUE; * Each element in s_hidChangePending corresponds to an element in hidReports. */ - static unsigned s_hidChangePending[ HID_REPORT_COUNT ]; static unsigned char s_hidReportDescriptor[ HID_REPORT_DESCRIPTOR_MAX_LENGTH ]; static size_t s_hidReportDescriptorLength; @@ -214,13 +213,17 @@ static unsigned hidGetItemType( const unsigned char header ) return bType; } -unsigned hidGetNextReportTime( const unsigned id ) +unsigned hidGetNextReportTime( const unsigned id ) { swlock_acquire(hidStaticVarLock); - unsigned retVal = 0U; + unsigned retVal = (id == 0U) ? s_hidNextReportTime[0] : 0U; for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { - if( id == hidGetElementReportId( hidReports[ idx ]->location )) { + if (id == 0U) + { + unsigned nextReportTime = s_hidNextReportTime[ idx ]; + retVal = (nextReportTime < retVal) ? nextReportTime : retVal; + } else if( id == hidGetElementReportId( hidReports[ idx ]->location )) { retVal = s_hidNextReportTime[ idx ]; } } @@ -228,6 +231,25 @@ unsigned hidGetNextReportTime( const unsigned id ) return retVal; } +//unsigned hidGetNextReportTime( const unsigned id ) { +// unsigned retVal = 0U; +// +// for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { +// if( id == hidGetElementReportId( hidReports[ idx ]->location )) { +// retVal = s_hidNextReportTime[ idx ]; +// } +// } +// return retVal; +//} + +unsigned hidIsReportDescriptorPrepared( void ) +{ + swlock_acquire(hidStaticVarLock); + unsigned retVal = s_hidReportDescriptorPrepared; + swlock_release(hidStaticVarLock); + return retVal; +} + unsigned char* hidGetReportDescriptor( void ) { unsigned char* retVal = NULL; @@ -265,7 +287,6 @@ unsigned hidGetReportIdLimit ( void ) { unsigned hidGetNextValidReportId ( unsigned idPrev ) { size_t retIndex = 0; - swlock_acquire(hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { unsigned reportId = hidGetElementReportId( hidReports[ idx ]->location ); @@ -471,7 +492,7 @@ void hidReportInit( void ) { swlock_acquire(hidStaticVarLock); for( unsigned idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { - s_hidCurrentPeriod[ idx ] = ENDPOINT_INT_INTERVAL_IN_HID * MS_IN_TICKS; + s_hidCurrentPeriod[ idx ] = ENDPOINT_INT_INTERVAL_IN_HID * MS_IN_TICKS * HID_REPORT_COUNT; } memset( s_hidIdleActive, 0, sizeof( s_hidIdleActive ) ); memset( s_hidChangePending, 0, sizeof( s_hidChangePending ) ); @@ -529,6 +550,13 @@ unsigned hidSetReportItem( const unsigned char data[] ) { + + if (!lockAllocated) + { + hidStaticVarLock = hwlock_alloc(); + lockAllocated = 1; + } + unsigned retVal = HID_STATUS_IN_USE; if( !s_hidReportDescriptorPrepared ) { @@ -867,4 +895,4 @@ unsigned hidReportValidate( void ) } else { return hidReportValidateInfoStruct( &info ); } -} \ No newline at end of file +} From 36d325a457b761ac0049616e1916d6b4d7beb172 Mon Sep 17 00:00:00 2001 From: Angel Cascarino Date: Tue, 11 Jan 2022 11:40:31 +0000 Subject: [PATCH 13/43] Fixed swlock change --- lib_xua/src/hid/hid_report.c | 116 +++++++++++++++++------------------ 1 file changed, 58 insertions(+), 58 deletions(-) diff --git a/lib_xua/src/hid/hid_report.c b/lib_xua/src/hid/hid_report.c index 54cd83fd..0b7f9704 100644 --- a/lib_xua/src/hid/hid_report.c +++ b/lib_xua/src/hid/hid_report.c @@ -139,36 +139,36 @@ static size_t hidTranslateItem( const USB_HID_Short_Item_t* inPtr, unsigned char void hidCalcNextReportTime( const unsigned id ) { - swlock_acquire(hidStaticVarLock); + swlock_acquire(&hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { if( id == hidGetElementReportId( hidReports[ idx ]->location )) { s_hidNextReportTime[ idx ] = s_hidReportTime[ idx ] + s_hidCurrentPeriod[ idx ]; } } - swlock_release(hidStaticVarLock); + swlock_release(&hidStaticVarLock); } void hidCaptureReportTime( const unsigned id, const unsigned time ) { - swlock_acquire(hidStaticVarLock); + swlock_acquire(&hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { if( id == hidGetElementReportId( hidReports[ idx ]->location )) { s_hidReportTime[ idx ] = time; } } - swlock_release(hidStaticVarLock); + swlock_release(&hidStaticVarLock); } void hidClearChangePending( const unsigned id ) { - swlock_acquire(hidStaticVarLock); + swlock_acquire(&hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx) { if(( id == 0U ) || ( id == hidGetElementReportId( hidReports[ idx ]->location ))) { s_hidChangePending[ idx ] = 0U; break; } } - swlock_release(hidStaticVarLock); + swlock_release(&hidStaticVarLock); } static unsigned hidGetElementBitLocation( const unsigned short location ) @@ -215,7 +215,7 @@ static unsigned hidGetItemType( const unsigned char header ) unsigned hidGetNextReportTime( const unsigned id ) { - swlock_acquire(hidStaticVarLock); + swlock_acquire(&hidStaticVarLock); unsigned retVal = (id == 0U) ? s_hidNextReportTime[0] : 0U; for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { @@ -227,7 +227,7 @@ unsigned hidGetNextReportTime( const unsigned id ) retVal = s_hidNextReportTime[ idx ]; } } - swlock_release(hidStaticVarLock); + swlock_release(&hidStaticVarLock); return retVal; } @@ -244,50 +244,50 @@ unsigned hidGetNextReportTime( const unsigned id ) unsigned hidIsReportDescriptorPrepared( void ) { - swlock_acquire(hidStaticVarLock); + swlock_acquire(&hidStaticVarLock); unsigned retVal = s_hidReportDescriptorPrepared; - swlock_release(hidStaticVarLock); + swlock_release(&hidStaticVarLock); return retVal; } unsigned char* hidGetReportDescriptor( void ) { unsigned char* retVal = NULL; - swlock_acquire(hidStaticVarLock); + swlock_acquire(&hidStaticVarLock); if( s_hidReportDescriptorPrepared ) { retVal = s_hidReportDescriptor; } - swlock_release(hidStaticVarLock); + swlock_release(&hidStaticVarLock); return retVal; } size_t hidGetReportDescriptorLength( void ) { - swlock_acquire(hidStaticVarLock); + swlock_acquire(&hidStaticVarLock); size_t retVal = ( s_hidReportDescriptorPrepared ) ? s_hidReportDescriptorLength : 0U; - swlock_release(hidStaticVarLock); + swlock_release(&hidStaticVarLock); return retVal; } unsigned hidGetReportIdLimit ( void ) { unsigned retVal = 0U; - swlock_acquire(hidStaticVarLock); + swlock_acquire(&hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { unsigned reportId = hidGetElementReportId( hidReports[ idx ]->location ); if( reportId >= retVal ) { retVal = reportId + 1; } } - swlock_release(hidStaticVarLock); + swlock_release(&hidStaticVarLock); return retVal; } unsigned hidGetNextValidReportId ( unsigned idPrev ) { size_t retIndex = 0; - swlock_acquire(hidStaticVarLock); + swlock_acquire(&hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { unsigned reportId = hidGetElementReportId( hidReports[ idx ]->location ); if( reportId == idPrev ) { @@ -297,7 +297,7 @@ unsigned hidGetNextValidReportId ( unsigned idPrev ) { } unsigned retVal = hidGetElementReportId( hidReports[ retIndex ]->location ); - swlock_release(hidStaticVarLock); + swlock_release(&hidStaticVarLock); return retVal; } @@ -313,9 +313,9 @@ unsigned hidGetReportItem( { unsigned retVal = HID_STATUS_BAD_ID; for( size_t elementIdx = 0U; elementIdx < HID_CONFIGURABLE_ELEMENT_COUNT; ++elementIdx ) { - swlock_acquire(hidStaticVarLock); + swlock_acquire(&hidStaticVarLock); USB_HID_Report_Element_t element = *hidConfigurableElements[ elementIdx ]; - swlock_release(hidStaticVarLock); + swlock_release(&hidStaticVarLock); unsigned bBit = hidGetElementBitLocation( element.location ); unsigned bByte = hidGetElementByteLocation( element.location ); @@ -342,7 +342,7 @@ unsigned hidGetReportItem( size_t hidGetReportLength( const unsigned id ) { - swlock_acquire(hidStaticVarLock); + swlock_acquire(&hidStaticVarLock); size_t retVal = 0U; if( s_hidReportDescriptorPrepared ) { for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { @@ -351,13 +351,13 @@ size_t hidGetReportLength( const unsigned id ) } } } - swlock_release(hidStaticVarLock); + swlock_release(&hidStaticVarLock); return retVal; } unsigned hidGetReportPeriod( const unsigned id ) { - swlock_acquire(hidStaticVarLock); + swlock_acquire(&hidStaticVarLock); unsigned retVal = 0U; for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx) { if( id == hidGetElementReportId( hidReports[ idx ]->location )) { @@ -365,13 +365,13 @@ unsigned hidGetReportPeriod( const unsigned id ) break; } } - swlock_release(hidStaticVarLock); + swlock_release(&hidStaticVarLock); return retVal; } unsigned hidGetReportTime( const unsigned id ) { - swlock_acquire(hidStaticVarLock); + swlock_acquire(&hidStaticVarLock); unsigned retVal = 0U; for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { @@ -380,14 +380,14 @@ unsigned hidGetReportTime( const unsigned id ) } } - swlock_release(hidStaticVarLock); + swlock_release(&hidStaticVarLock); return retVal; } static unsigned hidGetUsagePage( const unsigned id ) { unsigned retVal = 0U; - swlock_acquire(hidStaticVarLock); + swlock_acquire(&hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx) { if( id == hidGetElementReportId( hidReports[ idx ]->location )) { @@ -396,14 +396,14 @@ static unsigned hidGetUsagePage( const unsigned id ) } } - swlock_release(hidStaticVarLock); + swlock_release(&hidStaticVarLock); return retVal; } unsigned hidIsChangePending( const unsigned id ) { unsigned retVal = 0U; - swlock_acquire(hidStaticVarLock); + swlock_acquire(&hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx) { if( id == 0U && s_hidChangePending[ idx ] != 0U ) { @@ -414,7 +414,7 @@ unsigned hidIsChangePending( const unsigned id ) } } - swlock_release(hidStaticVarLock); + swlock_release(&hidStaticVarLock); return retVal; } @@ -425,7 +425,7 @@ unsigned hidIsIdleActive( const unsigned id ) retVal = 1U; } - swlock_acquire(hidStaticVarLock); + swlock_acquire(&hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx) { if( id == 0U ) { retVal &= ( s_hidIdleActive[ idx ] != 0U ); @@ -434,32 +434,32 @@ unsigned hidIsIdleActive( const unsigned id ) break; } } - swlock_release(hidStaticVarLock); + swlock_release(&hidStaticVarLock); return retVal; } unsigned hidIsReportDescriptorPrepared( void ) { - swlock_acquire(hidStaticVarLock); + swlock_acquire(&hidStaticVarLock); unsigned retVal = s_hidReportDescriptorPrepared; - swlock_release(hidStaticVarLock); + swlock_release(&hidStaticVarLock); return retVal; } unsigned hidIsReportIdInUse ( void ) { - swlock_acquire(hidStaticVarLock); + swlock_acquire(&hidStaticVarLock); if ( hidGetElementReportId( hidReports[ 0 ]->location ) ) { - swlock_release(hidStaticVarLock); + swlock_release(&hidStaticVarLock); return 1; } - swlock_release(hidStaticVarLock); + swlock_release(&hidStaticVarLock); return 0; } unsigned hidIsReportIdValid ( unsigned id ) { size_t retVal = 0; - swlock_acquire(hidStaticVarLock); + swlock_acquire(&hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { unsigned reportId = hidGetElementReportId( hidReports[ idx ]->location ); if( reportId == id ) { @@ -468,13 +468,13 @@ unsigned hidIsReportIdValid ( unsigned id ) { } } - swlock_release(hidStaticVarLock); + swlock_release(&hidStaticVarLock); return retVal; } void hidPrepareReportDescriptor( void ) { - swlock_acquire(hidStaticVarLock); + swlock_acquire(&hidStaticVarLock); if( !s_hidReportDescriptorPrepared ) { s_hidReportDescriptorLength = 0U; unsigned char* ptr = s_hidReportDescriptor; @@ -485,60 +485,60 @@ void hidPrepareReportDescriptor( void ) s_hidReportDescriptorPrepared = 1U; } - swlock_release(hidStaticVarLock); + swlock_release(&hidStaticVarLock); } void hidReportInit( void ) { - swlock_acquire(hidStaticVarLock); + swlock_acquire(&hidStaticVarLock); for( unsigned idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { s_hidCurrentPeriod[ idx ] = ENDPOINT_INT_INTERVAL_IN_HID * MS_IN_TICKS * HID_REPORT_COUNT; } memset( s_hidIdleActive, 0, sizeof( s_hidIdleActive ) ); memset( s_hidChangePending, 0, sizeof( s_hidChangePending ) ); - swlock_release(hidStaticVarLock); + swlock_release(&hidStaticVarLock); } void hidResetReportDescriptor( void ) { - swlock_acquire(hidStaticVarLock); + swlock_acquire(&hidStaticVarLock); s_hidReportDescriptorPrepared = 0U; - swlock_release(hidStaticVarLock); + swlock_release(&hidStaticVarLock); } void hidSetChangePending( const unsigned id ) { - swlock_acquire(hidStaticVarLock); + swlock_acquire(&hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx) { if( id == hidGetElementReportId( hidReports[ idx ]->location )) { s_hidChangePending[ idx ] = 1U; break; } } - swlock_release(hidStaticVarLock); + swlock_release(&hidStaticVarLock); } void hidSetIdle( const unsigned id, const unsigned state ) { - swlock_acquire(hidStaticVarLock); + swlock_acquire(&hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx) { if( id == hidGetElementReportId( hidReports[ idx ]->location )) { s_hidIdleActive[ idx ] = ( state != 0U ); break; } } - swlock_release(hidStaticVarLock); + swlock_release(&hidStaticVarLock); } void hidSetNextReportTime( const unsigned id, const unsigned time ) { - swlock_acquire(hidStaticVarLock); + swlock_acquire(&hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { if( id == hidGetElementReportId( hidReports[ idx ]->location )) { s_hidNextReportTime[ idx ] = time; } } - swlock_release(hidStaticVarLock); + swlock_release(&hidStaticVarLock); } unsigned hidSetReportItem( @@ -553,7 +553,7 @@ unsigned hidSetReportItem( if (!lockAllocated) { - hidStaticVarLock = hwlock_alloc(); + &hidStaticVarLock = hwlock_alloc(); lockAllocated = 1; } @@ -571,9 +571,9 @@ unsigned hidSetReportItem( retVal = HID_STATUS_BAD_HEADER; } else { for( size_t elementIdx = 0U; elementIdx < HID_CONFIGURABLE_ELEMENT_COUNT; ++elementIdx ) { - swlock_acquire(hidStaticVarLock); + swlock_acquire(&hidStaticVarLock); USB_HID_Report_Element_t element = *hidConfigurableElements[ elementIdx ]; - swlock_release(hidStaticVarLock); + swlock_release(&hidStaticVarLock); unsigned bBit = hidGetElementBitLocation( element.location ); unsigned bByte = hidGetElementByteLocation( element.location ); @@ -597,9 +597,9 @@ unsigned hidSetReportItem( element.item.data[ dataIdx ] = 0U; } - swlock_acquire(hidStaticVarLock); + swlock_acquire(&hidStaticVarLock); *hidConfigurableElements[ elementIdx ] = element; - swlock_release(hidStaticVarLock); + swlock_release(&hidStaticVarLock); retVal = HID_STATUS_GOOD; break; } @@ -613,14 +613,14 @@ unsigned hidSetReportItem( void hidSetReportPeriod( const unsigned id, const unsigned period ) { - swlock_acquire(hidStaticVarLock); + swlock_acquire(&hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx) { if( id == hidGetElementReportId( hidReports[ idx ]->location )) { s_hidCurrentPeriod[ idx ] = period; break; } } - swlock_release(hidStaticVarLock); + swlock_release(&hidStaticVarLock); } static size_t hidTranslateItem( const USB_HID_Short_Item_t* inPtr, unsigned char** outPtrPtr ) From 5bb44c54e1945591d96e71e9fa2f66bb405cc058 Mon Sep 17 00:00:00 2001 From: Angel Cascarino Date: Tue, 11 Jan 2022 11:42:41 +0000 Subject: [PATCH 14/43] Fixed the fix for swlock work --- lib_xua/src/hid/hid_report.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/lib_xua/src/hid/hid_report.c b/lib_xua/src/hid/hid_report.c index 0b7f9704..0308c9ed 100644 --- a/lib_xua/src/hid/hid_report.c +++ b/lib_xua/src/hid/hid_report.c @@ -242,14 +242,6 @@ unsigned hidGetNextReportTime( const unsigned id ) // return retVal; //} -unsigned hidIsReportDescriptorPrepared( void ) -{ - swlock_acquire(&hidStaticVarLock); - unsigned retVal = s_hidReportDescriptorPrepared; - swlock_release(&hidStaticVarLock); - return retVal; -} - unsigned char* hidGetReportDescriptor( void ) { unsigned char* retVal = NULL; @@ -550,13 +542,6 @@ unsigned hidSetReportItem( const unsigned char data[] ) { - - if (!lockAllocated) - { - &hidStaticVarLock = hwlock_alloc(); - lockAllocated = 1; - } - unsigned retVal = HID_STATUS_IN_USE; if( !s_hidReportDescriptorPrepared ) { From eebd438620fa891c22653133c0ff80511392f4a2 Mon Sep 17 00:00:00 2001 From: Angel Cascarino Date: Tue, 11 Jan 2022 11:56:29 +0000 Subject: [PATCH 15/43] Update module_build_info --- lib_xua/module_build_info | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib_xua/module_build_info b/lib_xua/module_build_info index e566c11b..9175f815 100644 --- a/lib_xua/module_build_info +++ b/lib_xua/module_build_info @@ -4,7 +4,8 @@ DEPENDENT_MODULES = lib_logging(>=3.0.0) \ lib_xassert(>=4.0.0) \ lib_xud(>=2.0.1) \ lib_spdif(>=4.0.0) \ - lib_mic_array(>=4.0.0) + lib_mic_array(>=4.0.0) \ + lib_locks(>=2.0.3) MODULE_XCC_FLAGS = $(XCC_FLAGS) \ -O3 \ From ff86ac8d2a1565204f0fdcfa9e44dd75163813ac Mon Sep 17 00:00:00 2001 From: Angel Cascarino Date: Tue, 11 Jan 2022 12:26:00 +0000 Subject: [PATCH 16/43] Added debug printing --- lib_xua/src/hid/hid.xc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib_xua/src/hid/hid.xc b/lib_xua/src/hid/hid.xc index 3f81bd07..bc42d1dd 100644 --- a/lib_xua/src/hid/hid.xc +++ b/lib_xua/src/hid/hid.xc @@ -9,6 +9,10 @@ #include "xua_hid.h" #include "xua_hid_report.h" +#define DEBUG_UNIT HID_XC +#define DEBUG_PRINT_ENABLE_HID_XC 1 +#include "debug_print.h" + #if( 0 < HID_CONTROLS ) static unsigned HidCalcNewReportTime( const unsigned currentPeriod, const unsigned reportTime, const unsigned reportToSetIdleInterval, const unsigned newPeriod ); static unsigned HidCalcReportToSetIdleInterval( const unsigned reportTime ); @@ -42,8 +46,12 @@ unsigned HidIsSetIdleSilenced( const unsigned id ) // The mapper complains if the time comes from an XC timer because this function is called in the guard of a select case. // Appearently the use of a timer creates a side-effect that prohibits the operation of the select functionality. asm volatile( "gettime %0" : "=r" ( currentTime )); - - unsigned isSilenced = timeafter(hidGetNextReportTime( id ), currentTime); + unsigned nextTime = hidGetNextReportTime( id ); + unsigned isSilenced = timeafter(nextTime, currentTime); + if (!isSilenced) + { + debug_printf("%d\n", nextTime); + } // Calling hidGetReportPeriod with an ID of 0 is meaningless if we are using // report IDs. From d7b41cd35f6fd04c4987c617e1f22cf0c5b3872a Mon Sep 17 00:00:00 2001 From: mbanth Date: Tue, 11 Jan 2022 14:22:03 +0000 Subject: [PATCH 17/43] Update copyright date range --- lib_xua/src/core/buffer/ep/ep_buffer.xc | 2 +- lib_xua/src/hid/hid.xc | 2 +- lib_xua/src/hid/hid_report.c | 2 +- lib_xua/src/hid/xua_hid.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_xua/src/core/buffer/ep/ep_buffer.xc b/lib_xua/src/core/buffer/ep/ep_buffer.xc index ac1a233c..fa79f198 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 2011-2021 XMOS LIMITED. +// Copyright 2011-2022 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include "xua.h" #if XUA_USB_EN diff --git a/lib_xua/src/hid/hid.xc b/lib_xua/src/hid/hid.xc index bc42d1dd..1ceeaa8e 100644 --- a/lib_xua/src/hid/hid.xc +++ b/lib_xua/src/hid/hid.xc @@ -1,4 +1,4 @@ -// Copyright 2019-2021 XMOS LIMITED. +// Copyright 2019-2022 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include diff --git a/lib_xua/src/hid/hid_report.c b/lib_xua/src/hid/hid_report.c index 0308c9ed..937d885e 100644 --- a/lib_xua/src/hid/hid_report.c +++ b/lib_xua/src/hid/hid_report.c @@ -1,4 +1,4 @@ -// Copyright 2021 XMOS LIMITED. +// Copyright 2021-2022 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include diff --git a/lib_xua/src/hid/xua_hid.h b/lib_xua/src/hid/xua_hid.h index 6e5d31b2..6730a57e 100644 --- a/lib_xua/src/hid/xua_hid.h +++ b/lib_xua/src/hid/xua_hid.h @@ -1,4 +1,4 @@ -// Copyright 2019-2021 XMOS LIMITED. +// Copyright 2019-2022 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. /** From 93721f314456f164a130b392d187621bf78acaa6 Mon Sep 17 00:00:00 2001 From: mbanth Date: Tue, 11 Jan 2022 14:24:32 +0000 Subject: [PATCH 18/43] Added missing dependency change log entry --- CHANGELOG.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 518aab7b..be25c651 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -10,6 +10,10 @@ lib_xua Change Log * CHANGED: Renamed the HID API file xua_hid_report_descriptor.h to xua_hid_report.h + * Changes to dependencies: + + - lib_locks: Added dependency 2.1.0 + 2.1.1 ----- From ec87a43dbfb8cf7958ac10f7991f15db8486c730 Mon Sep 17 00:00:00 2001 From: Angel Cascarino Date: Tue, 11 Jan 2022 15:56:32 +0000 Subject: [PATCH 19/43] Removed "0 means all" logic throughout --- lib_xua/src/hid/hid.xc | 48 +++++++++------------------------- lib_xua/src/hid/hid_report.c | 50 ++++++++---------------------------- 2 files changed, 22 insertions(+), 76 deletions(-) diff --git a/lib_xua/src/hid/hid.xc b/lib_xua/src/hid/hid.xc index bc42d1dd..90cadb90 100644 --- a/lib_xua/src/hid/hid.xc +++ b/lib_xua/src/hid/hid.xc @@ -41,44 +41,20 @@ XUD_Result_t HidInterfaceClassRequests( unsigned HidIsSetIdleSilenced( const unsigned id ) { - unsigned currentTime; - // Use inline assembly to access the time without creating a side-effect. - // The mapper complains if the time comes from an XC timer because this function is called in the guard of a select case. - // Appearently the use of a timer creates a side-effect that prohibits the operation of the select functionality. - asm volatile( "gettime %0" : "=r" ( currentTime )); - unsigned nextTime = hidGetNextReportTime( id ); - unsigned isSilenced = timeafter(nextTime, currentTime); - if (!isSilenced) - { - debug_printf("%d\n", nextTime); - } + unsigned isSilenced = hidIsIdleActive( id ); - // Calling hidGetReportPeriod with an ID of 0 is meaningless if we are using - // report IDs. - if (!hidIsReportIdInUse() || (id != 0)) - { - isSilenced |= ( 0U == hidGetReportPeriod( id ) ); - } - - return isSilenced; + if( !isSilenced ) { + unsigned currentTime; + // Use inline assembly to access the time without creating a side-effect. + // The mapper complains if the time comes from an XC timer because this function is called in the guard of a select case. + // Appearently the use of a timer creates a side-effect that prohibits the operation of the select functionality. + asm volatile( "gettime %0" : "=r" ( currentTime )); + isSilenced = ( 0U == hidGetReportPeriod( id ) || ( timeafter( hidGetNextReportTime( id ), currentTime ))); + } + + return isSilenced; } -//unsigned HidIsSetIdleSilenced( const unsigned id ) -//{ -// unsigned isSilenced = hidIsIdleActive( id ); -// -// if( !isSilenced ) { -// unsigned currentTime; -// // Use inline assembly to access the time without creating a side-effect. -// // The mapper complains if the time comes from an XC timer because this function is called in the guard of a select case. -// // Appearently the use of a timer creates a side-effect that prohibits the operation of the select functionality. -// asm volatile( "gettime %0" : "=r" ( currentTime )); -// isSilenced = ( 0U == hidGetReportPeriod( id ) || ( timeafter( hidGetNextReportTime( id ), currentTime ))); -// } -// -// return isSilenced; -//} - /** * \brief Calculate the timer value for sending the next HID Report. * @@ -176,7 +152,7 @@ static void HidUpdateReportPeriod( unsigned reportId, unsigned reportDuration ) hidSetNextReportTime( reportId, nextReportTime ); currentPeriod = reportDuration * MS_IN_TICKS; } else { - currentPeriod = ENDPOINT_INT_INTERVAL_IN_HID * MS_IN_TICKS; + currentPeriod = ENDPOINT_INT_INTERVAL_IN_HID * MS_IN_TICKS * HID_REPORT_COUNT; } hidSetReportPeriod( reportId, currentPeriod ); diff --git a/lib_xua/src/hid/hid_report.c b/lib_xua/src/hid/hid_report.c index 0308c9ed..cc1d2cb6 100644 --- a/lib_xua/src/hid/hid_report.c +++ b/lib_xua/src/hid/hid_report.c @@ -136,6 +136,9 @@ static unsigned hidGetUsagePage( const unsigned id ); */ static size_t hidTranslateItem( const USB_HID_Short_Item_t* inPtr, unsigned char** outPtrPtr ); +unsigned hidAreReportIdsInUse ( void ) { + return !hidIsReportIdInUse(0U); +} void hidCalcNextReportTime( const unsigned id ) { @@ -213,35 +216,19 @@ static unsigned hidGetItemType( const unsigned char header ) return bType; } -unsigned hidGetNextReportTime( const unsigned id ) -{ +unsigned hidGetNextReportTime( const unsigned id ) { swlock_acquire(&hidStaticVarLock); - unsigned retVal = (id == 0U) ? s_hidNextReportTime[0] : 0U; + unsigned retVal = 0U; - for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { - if (id == 0U) - { - unsigned nextReportTime = s_hidNextReportTime[ idx ]; - retVal = (nextReportTime < retVal) ? nextReportTime : retVal; - } else if( id == hidGetElementReportId( hidReports[ idx ]->location )) { + for ( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { + if( id == hidGetElementReportId( hidReports[ idx ]->location )) { retVal = s_hidNextReportTime[ idx ]; } - } + } swlock_release(&hidStaticVarLock); return retVal; } -//unsigned hidGetNextReportTime( const unsigned id ) { -// unsigned retVal = 0U; -// -// for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx ) { -// if( id == hidGetElementReportId( hidReports[ idx ]->location )) { -// retVal = s_hidNextReportTime[ idx ]; -// } -// } -// return retVal; -//} - unsigned char* hidGetReportDescriptor( void ) { unsigned char* retVal = NULL; @@ -398,9 +385,7 @@ unsigned hidIsChangePending( const unsigned id ) swlock_acquire(&hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx) { - if( id == 0U && s_hidChangePending[ idx ] != 0U ) { - retVal = 1; - } else if( id == hidGetElementReportId( hidReports[ idx ]->location )) { + if( id == hidGetElementReportId( hidReports[ idx ]->location )) { retVal = ( s_hidChangePending[ idx ] != 0U ); break; } @@ -413,15 +398,10 @@ unsigned hidIsChangePending( const unsigned id ) unsigned hidIsIdleActive( const unsigned id ) { unsigned retVal = 0U; - if( 0U == id ) { - retVal = 1U; - } swlock_acquire(&hidStaticVarLock); for( size_t idx = 0U; idx < HID_REPORT_COUNT; ++idx) { - if( id == 0U ) { - retVal &= ( s_hidIdleActive[ idx ] != 0U ); - } else if( id == hidGetElementReportId( hidReports[ idx ]->location )) { + if( id == hidGetElementReportId( hidReports[ idx ]->location )) { retVal = ( s_hidIdleActive[ idx ] != 0U ); break; } @@ -438,16 +418,6 @@ unsigned hidIsReportDescriptorPrepared( void ) return retVal; } -unsigned hidIsReportIdInUse ( void ) { - swlock_acquire(&hidStaticVarLock); - if ( hidGetElementReportId( hidReports[ 0 ]->location ) ) { - swlock_release(&hidStaticVarLock); - return 1; - } - swlock_release(&hidStaticVarLock); - return 0; -} - unsigned hidIsReportIdValid ( unsigned id ) { size_t retVal = 0; From 147b5fb7f793f756f46d90966967ee8122c95afc Mon Sep 17 00:00:00 2001 From: Angel Cascarino Date: Tue, 11 Jan 2022 15:58:42 +0000 Subject: [PATCH 20/43] Corrected hidAreReportIDsInUse --- lib_xua/src/hid/hid_report.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/src/hid/hid_report.c b/lib_xua/src/hid/hid_report.c index e1adef10..b6ab341d 100644 --- a/lib_xua/src/hid/hid_report.c +++ b/lib_xua/src/hid/hid_report.c @@ -137,7 +137,7 @@ static unsigned hidGetUsagePage( const unsigned id ); static size_t hidTranslateItem( const USB_HID_Short_Item_t* inPtr, unsigned char** outPtrPtr ); unsigned hidAreReportIdsInUse ( void ) { - return !hidIsReportIdInUse(0U); + return !hidIsReportIdValid(0U); } void hidCalcNextReportTime( const unsigned id ) From a4041389039fb3bc9a739679c3e49f71a66589da Mon Sep 17 00:00:00 2001 From: Angel Cascarino Date: Tue, 11 Jan 2022 16:06:11 +0000 Subject: [PATCH 21/43] Removed "reset" ability of UpdateReportPeriod In the event where an invalid reportDuration is supplied, previously HidUpdateReportPeriod would reset the period for the specified ID to ENDPOINT_INT_INTERVAL_IN_HID * MS_IN_TICKS. As the default period is now application-specific, hid.xc cannot know what the appropriate value is, and so this has been removed. --- lib_xua/src/hid/hid.xc | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib_xua/src/hid/hid.xc b/lib_xua/src/hid/hid.xc index 4cf860e5..015d94ec 100644 --- a/lib_xua/src/hid/hid.xc +++ b/lib_xua/src/hid/hid.xc @@ -151,8 +151,6 @@ static void HidUpdateReportPeriod( unsigned reportId, unsigned reportDuration ) unsigned nextReportTime = HidCalcNewReportTime( currentPeriod, reportTime, reportToSetIdleInterval, reportDuration * MS_IN_TICKS ); hidSetNextReportTime( reportId, nextReportTime ); currentPeriod = reportDuration * MS_IN_TICKS; - } else { - currentPeriod = ENDPOINT_INT_INTERVAL_IN_HID * MS_IN_TICKS * HID_REPORT_COUNT; } hidSetReportPeriod( reportId, currentPeriod ); From 46f516ddbc04a2c8f253e9a610dbf5ead63a5d17 Mon Sep 17 00:00:00 2001 From: Angel Cascarino Date: Tue, 11 Jan 2022 16:10:21 +0000 Subject: [PATCH 22/43] Updated header --- lib_xua/src/hid/xua_hid_report.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lib_xua/src/hid/xua_hid_report.h b/lib_xua/src/hid/xua_hid_report.h index e05810da..6f59e152 100644 --- a/lib_xua/src/hid/xua_hid_report.h +++ b/lib_xua/src/hid/xua_hid_report.h @@ -113,6 +113,19 @@ typedef struct unsigned short location; } USB_HID_Report_Element_t; +/** + * @brief Does the application use Report IDs? + * + * If the application is not using Report IDs, then the id value that is passed around + * everywhere can just be zero. Otherwise zero is an invalid ID that has a special meaning + * in some cases (read the documentation for each function). + * + * @return Boolean + * @retval 1 Report IDs are in use + * @retval 0 Report IDs are not in use + */ +unsigned hidAreReportIdsInUse ( void ); + /** * \brief Register that a previously changed HID Report data has been sent * to the USB Host. @@ -190,19 +203,6 @@ size_t hidGetReportDescriptorLength( void ); */ unsigned hidGetReportIdLimit ( void ); -/** - * @brief Does the application use Report IDs? - * - * If the application is not using Report IDs, then the id value that is passed around - * everywhere can just be zero. Otherwise zero is an invalid ID that has a special meaning - * in some cases (read the documentation for each function). - * - * @return Boolean - * @retval 1 Report IDs are in use - * @retval 0 Report IDs are not in use - */ -unsigned hidIsReportIdInUse ( void ); - /** * @brief Is the provided report ID valid for passing to other functions. * From 9863b37ead354f6e5bba18f20342e17b9b1e7877 Mon Sep 17 00:00:00 2001 From: Angel Cascarino Date: Tue, 11 Jan 2022 16:12:05 +0000 Subject: [PATCH 23/43] Remove ref. to IsReportIdInUse in ep_buffer --- lib_xua/src/core/buffer/ep/ep_buffer.xc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/src/core/buffer/ep/ep_buffer.xc b/lib_xua/src/core/buffer/ep/ep_buffer.xc index fa79f198..f6165f04 100644 --- a/lib_xua/src/core/buffer/ep/ep_buffer.xc +++ b/lib_xua/src/core/buffer/ep/ep_buffer.xc @@ -901,7 +901,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out, unsigned reportTime; tmr :> reportTime; - for(unsigned id = hidIsReportIdInUse(); id < hidGetReportIdLimit(); ++id) { + for(unsigned id = hidAreReportIdsInUse(); id < hidGetReportIdLimit(); ++id) { if(0U == id || (hidIsChangePending(id) || !HidIsSetIdleSilenced(id))) { hidCaptureReportTime(id, reportTime); int hidDataLength = (int) UserHIDGetData(id, g_hidData); From 5fa86dabbb785292b7d37777704aa1dea7ef2bfb Mon Sep 17 00:00:00 2001 From: Angel Cascarino Date: Tue, 11 Jan 2022 16:27:28 +0000 Subject: [PATCH 24/43] Updated unit tests to remove "reportAll" tests --- .../test_multi_report/test_hid_multi_report.c | 31 +------------------ .../xua_unit_tests/src/test_simple/test_hid.c | 2 +- 2 files changed, 2 insertions(+), 31 deletions(-) diff --git a/tests/xua_unit_tests/src/test_multi_report/test_hid_multi_report.c b/tests/xua_unit_tests/src/test_multi_report/test_hid_multi_report.c index bad4c699..43dc4d2a 100644 --- a/tests/xua_unit_tests/src/test_multi_report/test_hid_multi_report.c +++ b/tests/xua_unit_tests/src/test_multi_report/test_hid_multi_report.c @@ -59,7 +59,7 @@ void test_validate_report( void ) { } void test_reportid_in_use( void ) { - unsigned reportIdInUse = hidIsReportIdInUse(); + unsigned reportIdInUse = hidAreReportIdsInUse(); TEST_ASSERT_EQUAL_UINT( 1, reportIdInUse ); } @@ -775,7 +775,6 @@ void test_initial_modification_with_subsequent_verification_2( void ) //setIdle and associated timing functionality tests void test_set_idle( void ) { - unsigned reportIdAll = 0; unsigned reportId = 1; unsigned reportId2 = 2; @@ -785,23 +784,16 @@ void test_set_idle( void ) setIdle = hidIsIdleActive( reportId2 ); TEST_ASSERT_EQUAL_UINT( 0, setIdle ); - setIdle = hidIsIdleActive( reportIdAll ); - TEST_ASSERT_EQUAL_UINT( 0, setIdle ); - hidSetIdle( reportId, 1 ); setIdle = hidIsIdleActive( reportId ); TEST_ASSERT_EQUAL_UINT( 1, setIdle ); - setIdle = hidIsIdleActive( reportIdAll ); - TEST_ASSERT_EQUAL_UINT( 0, setIdle ); - setIdle = hidIsIdleActive( reportId2 ); TEST_ASSERT_EQUAL_UINT( 0, setIdle ); } void test_set_all_idle( void ) { - unsigned reportIdAll = 0; unsigned reportId = 1; unsigned reportId2 = 2; @@ -811,22 +803,14 @@ void test_set_all_idle( void ) setIdle = hidIsIdleActive( reportId2 ); TEST_ASSERT_EQUAL_UINT( 0, setIdle ); - setIdle = hidIsIdleActive( reportIdAll ); - TEST_ASSERT_EQUAL_UINT( 0, setIdle ); - for ( reportId = 1; reportId <= HID_REPORT_COUNT; ++reportId ) { hidSetIdle( reportId, 1 ); setIdle = hidIsIdleActive( reportId ); TEST_ASSERT_EQUAL_UINT( 1, setIdle ); - } - - setIdle = hidIsIdleActive( reportIdAll ); - TEST_ASSERT_EQUAL_UINT( 1, setIdle ); } void test_change_pending( void ) { - unsigned reportIdAll = 0; unsigned reportId = 1; unsigned reportId2 = 2; @@ -836,39 +820,26 @@ void test_change_pending( void ) changePending = hidIsChangePending( reportId2 ); TEST_ASSERT_EQUAL_UINT( 0, changePending ); - changePending = hidIsChangePending( reportIdAll ); - TEST_ASSERT_EQUAL_UINT( 0, changePending ); - hidSetChangePending( reportId ); changePending = hidIsChangePending( reportId ); TEST_ASSERT_EQUAL_UINT( 1, changePending ); - changePending = hidIsChangePending( reportIdAll ); - TEST_ASSERT_EQUAL_UINT( 1, changePending ); - changePending = hidIsChangePending( reportId2 ); TEST_ASSERT_EQUAL_UINT( 0, changePending ); } void test_change_pending_all( void ) { - unsigned reportIdAll = 0; unsigned reportId = 1; unsigned changePending = hidIsChangePending( reportId ); TEST_ASSERT_EQUAL_UINT( 0, changePending ); - changePending = hidIsChangePending( reportIdAll ); - TEST_ASSERT_EQUAL_UINT( 0, changePending ); - for ( reportId = 1; reportId <= HID_REPORT_COUNT; ++reportId ) { hidSetChangePending( reportId ); changePending = hidIsChangePending( reportId ); TEST_ASSERT_EQUAL_UINT( 1, changePending ); } - - changePending = hidIsChangePending( reportIdAll ); - TEST_ASSERT_EQUAL_UINT( 1, changePending ); } void test_report_time( void ) diff --git a/tests/xua_unit_tests/src/test_simple/test_hid.c b/tests/xua_unit_tests/src/test_simple/test_hid.c index 856edd79..b9598643 100644 --- a/tests/xua_unit_tests/src/test_simple/test_hid.c +++ b/tests/xua_unit_tests/src/test_simple/test_hid.c @@ -46,7 +46,7 @@ void test_validate_report( void ) { } void test_reportid_in_use( void ) { - unsigned reportIdInUse = hidIsReportIdInUse(); + unsigned reportIdInUse = hidAreReportIdsInUse(); TEST_ASSERT_EQUAL_UINT( 0, reportIdInUse ); } From 692c4ee7ed177a313c1315200e837272d8bdd4d6 Mon Sep 17 00:00:00 2001 From: Angel Cascarino Date: Tue, 11 Jan 2022 16:31:07 +0000 Subject: [PATCH 25/43] Missed brace --- .../xua_unit_tests/src/test_multi_report/test_hid_multi_report.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/xua_unit_tests/src/test_multi_report/test_hid_multi_report.c b/tests/xua_unit_tests/src/test_multi_report/test_hid_multi_report.c index 43dc4d2a..a0011d19 100644 --- a/tests/xua_unit_tests/src/test_multi_report/test_hid_multi_report.c +++ b/tests/xua_unit_tests/src/test_multi_report/test_hid_multi_report.c @@ -807,6 +807,7 @@ void test_set_all_idle( void ) hidSetIdle( reportId, 1 ); setIdle = hidIsIdleActive( reportId ); TEST_ASSERT_EQUAL_UINT( 1, setIdle ); + } } void test_change_pending( void ) From 45ab34552111aae03627c4eec6aaf137ac9575ff Mon Sep 17 00:00:00 2001 From: Angel Cascarino Date: Tue, 11 Jan 2022 16:35:44 +0000 Subject: [PATCH 26/43] Update copyright --- lib_xua/src/hid/xua_hid_report.h | 2 +- .../src/test_multi_report/test_hid_multi_report.c | 2 +- tests/xua_unit_tests/src/test_simple/test_hid.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_xua/src/hid/xua_hid_report.h b/lib_xua/src/hid/xua_hid_report.h index 6f59e152..58c45b3c 100644 --- a/lib_xua/src/hid/xua_hid_report.h +++ b/lib_xua/src/hid/xua_hid_report.h @@ -1,4 +1,4 @@ -// Copyright 2021 XMOS LIMITED. +// Copyright 2021-2022 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. /** diff --git a/tests/xua_unit_tests/src/test_multi_report/test_hid_multi_report.c b/tests/xua_unit_tests/src/test_multi_report/test_hid_multi_report.c index a0011d19..a024dcda 100644 --- a/tests/xua_unit_tests/src/test_multi_report/test_hid_multi_report.c +++ b/tests/xua_unit_tests/src/test_multi_report/test_hid_multi_report.c @@ -1,4 +1,4 @@ -// Copyright 2021 XMOS LIMITED. +// Copyright 2021-2022 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include diff --git a/tests/xua_unit_tests/src/test_simple/test_hid.c b/tests/xua_unit_tests/src/test_simple/test_hid.c index b9598643..f530efc7 100644 --- a/tests/xua_unit_tests/src/test_simple/test_hid.c +++ b/tests/xua_unit_tests/src/test_simple/test_hid.c @@ -1,4 +1,4 @@ -// Copyright 2021 XMOS LIMITED. +// Copyright 2021-2022 XMOS LIMITED. // This Software is subject to the terms of the XMOS Public Licence: Version 1. #include #include From c60da7fd82d393b7c0a86141483c5318a3b5fa4c Mon Sep 17 00:00:00 2001 From: Angel Cascarino Date: Tue, 11 Jan 2022 17:57:18 +0000 Subject: [PATCH 27/43] Reversed renaming function to avoid upversioning --- lib_xua/src/core/buffer/ep/ep_buffer.xc | 2 +- lib_xua/src/hid/hid_report.c | 2 +- lib_xua/src/hid/xua_hid_report.h | 2 +- .../src/test_multi_report/test_hid_multi_report.c | 2 +- tests/xua_unit_tests/src/test_simple/test_hid.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib_xua/src/core/buffer/ep/ep_buffer.xc b/lib_xua/src/core/buffer/ep/ep_buffer.xc index f6165f04..fa79f198 100644 --- a/lib_xua/src/core/buffer/ep/ep_buffer.xc +++ b/lib_xua/src/core/buffer/ep/ep_buffer.xc @@ -901,7 +901,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out, unsigned reportTime; tmr :> reportTime; - for(unsigned id = hidAreReportIdsInUse(); id < hidGetReportIdLimit(); ++id) { + for(unsigned id = hidIsReportIdInUse(); id < hidGetReportIdLimit(); ++id) { if(0U == id || (hidIsChangePending(id) || !HidIsSetIdleSilenced(id))) { hidCaptureReportTime(id, reportTime); int hidDataLength = (int) UserHIDGetData(id, g_hidData); diff --git a/lib_xua/src/hid/hid_report.c b/lib_xua/src/hid/hid_report.c index b6ab341d..02c8122c 100644 --- a/lib_xua/src/hid/hid_report.c +++ b/lib_xua/src/hid/hid_report.c @@ -136,7 +136,7 @@ static unsigned hidGetUsagePage( const unsigned id ); */ static size_t hidTranslateItem( const USB_HID_Short_Item_t* inPtr, unsigned char** outPtrPtr ); -unsigned hidAreReportIdsInUse ( void ) { +unsigned hidIsReportIdInUse ( void ) { return !hidIsReportIdValid(0U); } diff --git a/lib_xua/src/hid/xua_hid_report.h b/lib_xua/src/hid/xua_hid_report.h index 58c45b3c..24ed3e8e 100644 --- a/lib_xua/src/hid/xua_hid_report.h +++ b/lib_xua/src/hid/xua_hid_report.h @@ -124,7 +124,7 @@ typedef struct * @retval 1 Report IDs are in use * @retval 0 Report IDs are not in use */ -unsigned hidAreReportIdsInUse ( void ); +unsigned hidIsReportIdInUse ( void ); /** * \brief Register that a previously changed HID Report data has been sent diff --git a/tests/xua_unit_tests/src/test_multi_report/test_hid_multi_report.c b/tests/xua_unit_tests/src/test_multi_report/test_hid_multi_report.c index a024dcda..d5f01760 100644 --- a/tests/xua_unit_tests/src/test_multi_report/test_hid_multi_report.c +++ b/tests/xua_unit_tests/src/test_multi_report/test_hid_multi_report.c @@ -59,7 +59,7 @@ void test_validate_report( void ) { } void test_reportid_in_use( void ) { - unsigned reportIdInUse = hidAreReportIdsInUse(); + unsigned reportIdInUse = hidIsReportIdInUse(); TEST_ASSERT_EQUAL_UINT( 1, reportIdInUse ); } diff --git a/tests/xua_unit_tests/src/test_simple/test_hid.c b/tests/xua_unit_tests/src/test_simple/test_hid.c index f530efc7..3bd930bc 100644 --- a/tests/xua_unit_tests/src/test_simple/test_hid.c +++ b/tests/xua_unit_tests/src/test_simple/test_hid.c @@ -46,7 +46,7 @@ void test_validate_report( void ) { } void test_reportid_in_use( void ) { - unsigned reportIdInUse = hidAreReportIdsInUse(); + unsigned reportIdInUse = hidIsReportIdInUse(); TEST_ASSERT_EQUAL_UINT( 0, reportIdInUse ); } From 662b24386d50182284508fd4904f444327c2277f Mon Sep 17 00:00:00 2001 From: lucianom Date: Wed, 12 Jan 2022 12:28:44 +0000 Subject: [PATCH 28/43] Use test view --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 61fd5394..75b3fefe 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,7 +6,8 @@ pipeline { agent none environment { REPO = 'lib_xua' - VIEW = getViewName(REPO) + VIEW = 'lib_xua_test_locks' + // VIEW = getViewName(REPO) } options { skipDefaultCheckout() From 4d68b26b429d7cd3f36a2a4ba1e1aa5cf6b74bd5 Mon Sep 17 00:00:00 2001 From: lucianom Date: Wed, 12 Jan 2022 12:37:33 +0000 Subject: [PATCH 29/43] Remove dependency to lib_locks --- lib_xua/module_build_info | 1 - 1 file changed, 1 deletion(-) diff --git a/lib_xua/module_build_info b/lib_xua/module_build_info index 9175f815..282e5402 100644 --- a/lib_xua/module_build_info +++ b/lib_xua/module_build_info @@ -5,7 +5,6 @@ DEPENDENT_MODULES = lib_logging(>=3.0.0) \ lib_xud(>=2.0.1) \ lib_spdif(>=4.0.0) \ lib_mic_array(>=4.0.0) \ - lib_locks(>=2.0.3) MODULE_XCC_FLAGS = $(XCC_FLAGS) \ -O3 \ From 9b0e541e95a5b1fe2df5f54afda8bf026cd823db Mon Sep 17 00:00:00 2001 From: lucianom Date: Wed, 12 Jan 2022 12:51:43 +0000 Subject: [PATCH 30/43] Revert "Use test view" 662b24386d50182284508fd4904f444327c2277f --- Jenkinsfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 75b3fefe..61fd5394 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,8 +6,7 @@ pipeline { agent none environment { REPO = 'lib_xua' - VIEW = 'lib_xua_test_locks' - // VIEW = getViewName(REPO) + VIEW = getViewName(REPO) } options { skipDefaultCheckout() From 64cbd072f43cce9bf090856c2930955ff18a04f0 Mon Sep 17 00:00:00 2001 From: lucianom Date: Wed, 12 Jan 2022 12:51:51 +0000 Subject: [PATCH 31/43] Revert "Remove dependency to lib_locks" 4d68b26b429d7cd3f36a2a4ba1e1aa5cf6b74bd5 --- lib_xua/module_build_info | 1 + 1 file changed, 1 insertion(+) diff --git a/lib_xua/module_build_info b/lib_xua/module_build_info index 282e5402..9175f815 100644 --- a/lib_xua/module_build_info +++ b/lib_xua/module_build_info @@ -5,6 +5,7 @@ DEPENDENT_MODULES = lib_logging(>=3.0.0) \ lib_xud(>=2.0.1) \ lib_spdif(>=4.0.0) \ lib_mic_array(>=4.0.0) \ + lib_locks(>=2.0.3) MODULE_XCC_FLAGS = $(XCC_FLAGS) \ -O3 \ From 37ce235594a0b19e20d9efa86142065d7f31b06f Mon Sep 17 00:00:00 2001 From: lucianom Date: Wed, 12 Jan 2022 14:30:30 +0000 Subject: [PATCH 32/43] Add dummy module_locks --- module_locks/README.rst | 7 +++++++ module_locks/module_build_info | 1 + 2 files changed, 8 insertions(+) create mode 100644 module_locks/README.rst create mode 100644 module_locks/module_build_info diff --git a/module_locks/README.rst b/module_locks/README.rst new file mode 100644 index 00000000..ecde319a --- /dev/null +++ b/module_locks/README.rst @@ -0,0 +1,7 @@ +module_locks Readme +=================== + +:scope: Dummy module +:description: Allows compiling legacy_tests in lib_xua with lib_locks. sc_i2c is used in the tests and it requires module_locks from sc_util, but the definitions in sc_utils conflict with the ones in lib_locks. +:keywords: dummy +:boards: XMOS Dev Kit diff --git a/module_locks/module_build_info b/module_locks/module_build_info new file mode 100644 index 00000000..d90ffd43 --- /dev/null +++ b/module_locks/module_build_info @@ -0,0 +1 @@ +# Dummy module used in legacy_tests. See README.rst for more details. From 6b0688d23e075bf89ba9998fc8255b6f7fde9fa1 Mon Sep 17 00:00:00 2001 From: Angel Cascarino Date: Wed, 12 Jan 2022 14:47:40 +0000 Subject: [PATCH 33/43] Updated ep_buffer to match 3610's xua_buffer_lite --- lib_xua/src/core/buffer/ep/ep_buffer.xc | 345 ++++++++++++------------ 1 file changed, 177 insertions(+), 168 deletions(-) diff --git a/lib_xua/src/core/buffer/ep/ep_buffer.xc b/lib_xua/src/core/buffer/ep/ep_buffer.xc index fa79f198..c04b90ec 100644 --- a/lib_xua/src/core/buffer/ep/ep_buffer.xc +++ b/lib_xua/src/core/buffer/ep/ep_buffer.xc @@ -373,15 +373,13 @@ void XUA_Buffer_Ep(register chanend c_aud_out, #endif #if( 0 < HID_CONTROLS ) - UserHIDInit(); while (!hidIsReportDescriptorPrepared()) ; - /* Get the a report - we don't really care which it is, so long as there's some data we can grab. */ - int hidReportLength = (int) UserHIDGetData(hidGetNextValidReportId(0), g_hidData); - - XUD_SetReady_In(ep_hid, g_hidData, hidReportLength); + UserHIDInit(); + unsigned hid_ready_flag = 0U; + unsigned hid_ready_id = 0U; #endif @@ -759,169 +757,160 @@ void XUA_Buffer_Ep(register chanend c_aud_out, #endif #ifdef MIDI - case XUD_GetData_Select(c_midi_from_host, ep_midi_from_host, length, result): + case XUD_GetData_Select(c_midi_from_host, ep_midi_from_host, length, result): - if((result == XUD_RES_OKAY) && (length > 0)) - { - /* Get buffer data from host - MIDI OUT from host always into a single buffer */ - midi_data_remaining_to_device = length; - - midi_from_host_rdptr = midi_from_host_buffer; - - if (midi_data_remaining_to_device) + if((result == XUD_RES_OKAY) && (length > 0)) { - read_via_xc_ptr(datum, midi_from_host_rdptr); - outuint(c_midi, datum); - midi_from_host_rdptr += 4; - midi_data_remaining_to_device -= 4; - } - } - break; + /* Get buffer data from host - MIDI OUT from host always into a single buffer */ + midi_data_remaining_to_device = length; - /* MIDI IN to host */ - case XUD_SetData_Select(c_midi_to_host, ep_midi_to_host, result): + midi_from_host_rdptr = midi_from_host_buffer; - /* The buffer has been sent to the host, so we can ack the midi thread */ - if (midi_data_collected_from_device != 0) - { - /* Swap the collecting and sending buffer */ - swap(midi_to_host_buffer_being_collected, midi_to_host_buffer_being_sent); - - /* Request to send packet */ - XUD_SetReady_InPtr(ep_midi_to_host, midi_to_host_buffer_being_sent, midi_data_collected_from_device); - - /* Mark as waiting for host to poll us */ - midi_waiting_on_send_to_host = 1; - /* Reset the collected data count */ - midi_data_collected_from_device = 0; - } - else - { - midi_waiting_on_send_to_host = 0; - } - break; -#endif - -#ifdef IAP - /* IAP OUT from host. Datalength writen to tmp */ - case XUD_GetData_Select(c_iap_from_host, ep_iap_from_host, length, result): - - if((result == XUD_RES_OKAY) && (length > 0)) - { - iap_data_remaining_to_device = length; - - if(iap_data_remaining_to_device) - { - // Send length first so iAP thread knows how much data to expect - // Don't expect ack from this to make it simpler - outuint(c_iap, iap_data_remaining_to_device); - - /* Send out first byte in buffer */ - datum_iap = iap_from_host_buffer[0]; - outuint(c_iap, datum_iap); - - /* Set read ptr to next byte in buffer */ - iap_from_host_rdptr = 1; - iap_data_remaining_to_device -= 1; - } - } - break; - - /* IAP IN to host */ - case XUD_SetData_Select(c_iap_to_host, ep_iap_to_host, result): - - if(result == XUD_RES_RST) - { - XUD_ResetEndpoint(ep_iap_to_host, null); -#ifdef IAP_INT_EP - XUD_ResetEndpoint(ep_iap_to_host_int, null); -#endif - iap_send_reset(c_iap); - iap_draining_chan = 1; // Drain c_iap until a reset is sent back - iap_data_collected_from_device = 0; - iap_data_remaining_to_device = -1; - iap_expected_data_length = 0; - iap_from_host_rdptr = 0; - } - else - { - /* Send out an iAP packet to host, ACK last msg from iAP to let it know we can move on..*/ - iap_send_ack(c_iap); - } - break; /* IAP IN to host */ - -#ifdef IAP_INT_EP - case XUD_SetData_Select(c_iap_to_host_int, ep_iap_to_host_int, result): - - /* Do nothing.. */ - /* Note, could get a reset notification here, but deal with it in the case above */ - break; -#endif - -#ifdef IAP_EA_NATIVE_TRANS - /* iAP EA Native Transport OUT from host */ - case XUD_GetData_Select(c_iap_ea_native_out, ep_iap_ea_native_out, iap_ea_native_rx_length, result): - if ((result == XUD_RES_OKAY) && iap_ea_native_rx_length > 0) - { - // Notify EA Protocol user code we have iOS app data from XUD - iAP2_EANativeTransport_writeToChan_start(c_iap_ea_native_data, EA_NATIVE_SEND_DATA); - } - break; - - /* iAP EA Native Transport IN to host */ - case XUD_SetData_Select(c_iap_ea_native_in, ep_iap_ea_native_in, result): - switch (result) - { - case XUD_RES_RST: - XUD_ResetEndpoint(ep_iap_ea_native_in, null); - // Notify user code of USB reset to allow any state to be cleared - iAP2_EANativeTransport_writeToChan_start(c_iap_ea_native_data, EA_NATIVE_SEND_CONTROL); - // Set up the control flag to send to EA Protocol user code when it responds - iap_ea_native_control_flag = EA_NATIVE_RESET; - iap_ea_native_control_to_send = 1; - break; - - case XUD_RES_OKAY: // EA Protocol user data successfully passed to XUD - // Notify user code - iAP2_EANativeTransport_writeToChan_start(c_iap_ea_native_data, EA_NATIVE_SEND_CONTROL); - // Set up the control flag to send to EA Protocol user code when it responds - iap_ea_native_control_flag = EA_NATIVE_DATA_SENT; - iap_ea_native_control_to_send = 1; - break; - } - break; - //:: -#endif -#endif - -#if( 0 < HID_CONTROLS ) - /* HID Report Data */ - case (hidIsChangePending(0U) || !HidIsSetIdleSilenced(0U)) => XUD_SetData_Select(c_hid, ep_hid, result): - { - unsigned reportTime; - tmr :> reportTime; - - for(unsigned id = hidIsReportIdInUse(); id < hidGetReportIdLimit(); ++id) { - if(0U == id || (hidIsChangePending(id) || !HidIsSetIdleSilenced(id))) { - hidCaptureReportTime(id, reportTime); - int hidDataLength = (int) UserHIDGetData(id, g_hidData); - XUD_SetReady_In(ep_hid, g_hidData, hidDataLength); - hidCalcNextReportTime(id); - hidClearChangePending(id); - break; + if (midi_data_remaining_to_device) + { + read_via_xc_ptr(datum, midi_from_host_rdptr); + outuint(c_midi, datum); + midi_from_host_rdptr += 4; + midi_data_remaining_to_device -= 4; } } - } - break; -#endif + break; -#ifdef MIDI - /* Received word from MIDI thread - Check for ACK or Data */ + /* MIDI IN to host */ + case XUD_SetData_Select(c_midi_to_host, ep_midi_to_host, result): + + /* The buffer has been sent to the host, so we can ack the midi thread */ + if (midi_data_collected_from_device != 0) + { + /* Swap the collecting and sending buffer */ + swap(midi_to_host_buffer_being_collected, midi_to_host_buffer_being_sent); + + /* Request to send packet */ + XUD_SetReady_InPtr(ep_midi_to_host, midi_to_host_buffer_being_sent, midi_data_collected_from_device); + + /* Mark as waiting for host to poll us */ + midi_waiting_on_send_to_host = 1; + /* Reset the collected data count */ + midi_data_collected_from_device = 0; + } + else + { + midi_waiting_on_send_to_host = 0; + } + break; + #endif + + #ifdef IAP + /* IAP OUT from host. Datalength writen to tmp */ + case XUD_GetData_Select(c_iap_from_host, ep_iap_from_host, length, result): + + if((result == XUD_RES_OKAY) && (length > 0)) + { + iap_data_remaining_to_device = length; + + if(iap_data_remaining_to_device) + { + // Send length first so iAP thread knows how much data to expect + // Don't expect ack from this to make it simpler + outuint(c_iap, iap_data_remaining_to_device); + + /* Send out first byte in buffer */ + datum_iap = iap_from_host_buffer[0]; + outuint(c_iap, datum_iap); + + /* Set read ptr to next byte in buffer */ + iap_from_host_rdptr = 1; + iap_data_remaining_to_device -= 1; + } + } + break; + + /* IAP IN to host */ + case XUD_SetData_Select(c_iap_to_host, ep_iap_to_host, result): + + if(result == XUD_RES_RST) + { + XUD_ResetEndpoint(ep_iap_to_host, null); + #ifdef IAP_INT_EP + XUD_ResetEndpoint(ep_iap_to_host_int, null); + #endif + iap_send_reset(c_iap); + iap_draining_chan = 1; // Drain c_iap until a reset is sent back + iap_data_collected_from_device = 0; + iap_data_remaining_to_device = -1; + iap_expected_data_length = 0; + iap_from_host_rdptr = 0; + } + else + { + /* Send out an iAP packet to host, ACK last msg from iAP to let it know we can move on..*/ + iap_send_ack(c_iap); + } + break; /* IAP IN to host */ + + #ifdef IAP_INT_EP + case XUD_SetData_Select(c_iap_to_host_int, ep_iap_to_host_int, result): + + /* Do nothing.. */ + /* Note, could get a reset notification here, but deal with it in the case above */ + break; + #endif + + #ifdef IAP_EA_NATIVE_TRANS + /* iAP EA Native Transport OUT from host */ + case XUD_GetData_Select(c_iap_ea_native_out, ep_iap_ea_native_out, iap_ea_native_rx_length, result): + if ((result == XUD_RES_OKAY) && iap_ea_native_rx_length > 0) + { + // Notify EA Protocol user code we have iOS app data from XUD + iAP2_EANativeTransport_writeToChan_start(c_iap_ea_native_data, EA_NATIVE_SEND_DATA); + } + break; + + /* iAP EA Native Transport IN to host */ + case XUD_SetData_Select(c_iap_ea_native_in, ep_iap_ea_native_in, result): + switch (result) + { + case XUD_RES_RST: + XUD_ResetEndpoint(ep_iap_ea_native_in, null); + // Notify user code of USB reset to allow any state to be cleared + iAP2_EANativeTransport_writeToChan_start(c_iap_ea_native_data, EA_NATIVE_SEND_CONTROL); + // Set up the control flag to send to EA Protocol user code when it responds + iap_ea_native_control_flag = EA_NATIVE_RESET; + iap_ea_native_control_to_send = 1; + break; + + case XUD_RES_OKAY: // EA Protocol user data successfully passed to XUD + // Notify user code + iAP2_EANativeTransport_writeToChan_start(c_iap_ea_native_data, EA_NATIVE_SEND_CONTROL); + // Set up the control flag to send to EA Protocol user code when it responds + iap_ea_native_control_flag = EA_NATIVE_DATA_SENT; + iap_ea_native_control_to_send = 1; + break; + } + break; + //:: + #endif + #endif + + #if( 0 < HID_CONTROLS ) + /* HID Report Data */ + case XUD_SetData_Select(c_hid, ep_hid, result): + hid_ready_flag = 0U; + unsigned reportTime; + tmr :> reportTime; + hidCaptureReportTime(hid_ready_id, reportTime); + hidCalcNextReportTime(hid_ready_id); + hidClearChangePending(hid_ready_id); + break; + #endif + + #ifdef MIDI + /* Received word from MIDI thread - Check for ACK or Data */ case midi_get_ack_or_data(c_midi, is_ack, datum): if (is_ack) { /* An ack from the midi/uart thread means it has accepted some data we sent it - * we are okay to send another word */ + * we are okay to send another word */ if (midi_data_remaining_to_device <= 0) { /* We have read an entire packet - Mark ready to receive another */ @@ -966,9 +955,9 @@ void XUA_Buffer_Ep(register chanend c_aud_out, } } break; -#endif /* ifdef MIDI */ + #endif /* ifdef MIDI */ -#ifdef IAP + #ifdef IAP /* Received word from iap thread - Check for ACK or Data */ case iap_get_ack_or_reset_or_data(c_iap, is_ack_iap, is_reset, datum_iap): @@ -986,7 +975,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out, if (is_ack_iap) { /* An ack from the iap/uart thread means it has accepted some data we sent it - * we are okay to send another word */ + * we are okay to send another word */ if (iap_data_remaining_to_device == 0) { /* We have read an entire packet - Mark ready to receive another */ @@ -1019,7 +1008,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out, } else { - // Too many events from device - drop + // Too many events from device - drop } /* Once we have the whole message, sent it to host */ @@ -1027,16 +1016,16 @@ void XUA_Buffer_Ep(register chanend c_aud_out, if (iap_data_collected_from_device == iap_expected_data_length) { XUD_Result_t result1 = XUD_RES_OKAY, result2; -#ifdef IAP_INT_EP + #ifdef IAP_INT_EP result1 = XUD_SetReady_In(ep_iap_to_host_int, gc_zero_buffer, 0); -#endif + #endif result2 = XUD_SetReady_In(ep_iap_to_host, iap_to_host_buffer, iap_data_collected_from_device); if((result1 == XUD_RES_RST) || (result2 == XUD_RES_RST)) { -#ifdef IAP_INT_EP + #ifdef IAP_INT_EP XUD_ResetEndpoint(ep_iap_to_host_int, null); -#endif + #endif XUD_ResetEndpoint(ep_iap_to_host, null); iap_send_reset(c_iap); iap_draining_chan = 1; // Drain c_iap until a reset is sent back @@ -1057,7 +1046,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out, } break; -# if IAP_EA_NATIVE_TRANS + # if IAP_EA_NATIVE_TRANS /* Change of EA Native Transport interface setting */ case inuint_byref(c_iap_ea_native_ctrl, iap_ea_native_interface_alt_setting): /* Handshake */ @@ -1108,13 +1097,33 @@ void XUA_Buffer_Ep(register chanend c_aud_out, case EA_NATIVE_SEND_DATA: // Unsolicited data from user core for IN ep iAP2_EANativeTransport_readFromChan_data(c_iap_ea_native_data, - iap_ea_native_tx_buffer, - iap_ea_native_tx_length); + iap_ea_native_tx_buffer, + iap_ea_native_tx_length); // Mark the IN EP as ready now we have all the data XUD_SetReady_In(ep_iap_ea_native_in, iap_ea_native_tx_buffer, iap_ea_native_tx_length); break; } break; + + default: +#if ( 0 < HID_CONTROLS ) + if (!hid_ready_flag) + { + for (unsigned id = hidIsReportIdInUse(); id < hidGetReportIdLimit(); id++) + { + if ( hidIsChangePending(id) || !HidIsSetIdleSilenced(id) ) + { + int hidDataLength = (int) UserHIDGetData(id, g_hidData); + XUD_SetReady_In(ep_hid, g_hidData, hidDataLength); + + hid_ready_id = id; + hid_ready_flag = 1U; + break; + } + } + } +#endif + break; //:: #endif From 418622c593c0c64abe10c8ddf10c3e49f0ef12c9 Mon Sep 17 00:00:00 2001 From: Angel Cascarino Date: Wed, 12 Jan 2022 14:49:00 +0000 Subject: [PATCH 34/43] Disable debug printing in hid.xc --- lib_xua/src/hid/hid.xc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/src/hid/hid.xc b/lib_xua/src/hid/hid.xc index 015d94ec..e05d78f6 100644 --- a/lib_xua/src/hid/hid.xc +++ b/lib_xua/src/hid/hid.xc @@ -10,7 +10,7 @@ #include "xua_hid_report.h" #define DEBUG_UNIT HID_XC -#define DEBUG_PRINT_ENABLE_HID_XC 1 +#define DEBUG_PRINT_ENABLE_HID_XC 0 #include "debug_print.h" #if( 0 < HID_CONTROLS ) From d33397164b32c0c0b655badd66c687bc7455241c Mon Sep 17 00:00:00 2001 From: Angel Cascarino Date: Wed, 12 Jan 2022 15:30:43 +0000 Subject: [PATCH 35/43] Whitespace changes in ep_buffer.xc --- lib_xua/src/core/buffer/ep/ep_buffer.xc | 58 ++++++++++++------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/lib_xua/src/core/buffer/ep/ep_buffer.xc b/lib_xua/src/core/buffer/ep/ep_buffer.xc index c04b90ec..b0d1bbc7 100644 --- a/lib_xua/src/core/buffer/ep/ep_buffer.xc +++ b/lib_xua/src/core/buffer/ep/ep_buffer.xc @@ -93,7 +93,7 @@ unsigned int fb_clocks[4]; void XUA_Buffer( register chanend c_aud_out, #if (NUM_USB_CHAN_IN > 0) - register chanend c_aud_in, + register chanend c_aud_in, #endif #if (NUM_USB_CHAN_IN == 0) || defined (UAC_FORCE_FEEDBACK_EP) chanend c_aud_fb, @@ -198,7 +198,7 @@ unsafe{volatile unsigned * unsafe masterClockFreq_ptr;} */ void XUA_Buffer_Ep(register chanend c_aud_out, #if (NUM_USB_CHAN_IN > 0) - register chanend c_aud_in, + register chanend c_aud_in, #endif #if (NUM_USB_CHAN_IN == 0) || defined (UAC_FORCE_FEEDBACK_EP) chanend c_aud_fb, @@ -448,9 +448,9 @@ void XUA_Buffer_Ep(register chanend c_aud_out, if(receivedSampleFreq != AUDIO_STOP_FOR_DFU) { sampleFreq = receivedSampleFreq; - #ifdef FB_TOLERANCE_TEST +#ifdef FB_TOLERANCE_TEST expected_fb = ((sampleFreq * 0x2000) / frameTime); - #endif +#endif /* Reset FB */ /* Note, Endpoint 0 will hold off host for a sufficient period to allow our feedback * to stabilise (i.e. sofCount == 128 to fire) */ @@ -711,7 +711,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out, #endif sofCount++; } - break; + break; #if (NUM_USB_CHAN_IN > 0) /* Sent audio packet DEVICE -> HOST */ @@ -720,7 +720,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out, /* Inform stream that buffer sent */ SET_SHARED_GLOBAL0(g_aud_to_host_flag, bufferIn+1); } - break; + break; #endif #if (NUM_USB_CHAN_OUT > 0) @@ -741,7 +741,7 @@ void XUA_Buffer_Ep(register chanend c_aud_out, XUD_SetReady_In(ep_aud_fb, (fb_clocks, unsigned char[]), 3); } } - break; + break; #endif /* Received Audio packet HOST -> DEVICE. Datalength written to length */ case XUD_GetData_Select(c_aud_out, ep_aud_out, length, result): @@ -797,10 +797,10 @@ void XUA_Buffer_Ep(register chanend c_aud_out, { midi_waiting_on_send_to_host = 0; } - break; - #endif + break; +#endif - #ifdef IAP +#ifdef IAP /* IAP OUT from host. Datalength writen to tmp */ case XUD_GetData_Select(c_iap_from_host, ep_iap_from_host, length, result): @@ -831,9 +831,9 @@ void XUA_Buffer_Ep(register chanend c_aud_out, if(result == XUD_RES_RST) { XUD_ResetEndpoint(ep_iap_to_host, null); - #ifdef IAP_INT_EP +#ifdef IAP_INT_EP XUD_ResetEndpoint(ep_iap_to_host_int, null); - #endif +#endif iap_send_reset(c_iap); iap_draining_chan = 1; // Drain c_iap until a reset is sent back iap_data_collected_from_device = 0; @@ -848,15 +848,15 @@ void XUA_Buffer_Ep(register chanend c_aud_out, } break; /* IAP IN to host */ - #ifdef IAP_INT_EP +#ifdef IAP_INT_EP case XUD_SetData_Select(c_iap_to_host_int, ep_iap_to_host_int, result): /* Do nothing.. */ /* Note, could get a reset notification here, but deal with it in the case above */ break; - #endif +#endif - #ifdef IAP_EA_NATIVE_TRANS +#ifdef IAP_EA_NATIVE_TRANS /* iAP EA Native Transport OUT from host */ case XUD_GetData_Select(c_iap_ea_native_out, ep_iap_ea_native_out, iap_ea_native_rx_length, result): if ((result == XUD_RES_OKAY) && iap_ea_native_rx_length > 0) @@ -889,10 +889,10 @@ void XUA_Buffer_Ep(register chanend c_aud_out, } break; //:: - #endif - #endif +#endif +#endif - #if( 0 < HID_CONTROLS ) +#if( 0 < HID_CONTROLS ) /* HID Report Data */ case XUD_SetData_Select(c_hid, ep_hid, result): hid_ready_flag = 0U; @@ -901,10 +901,10 @@ void XUA_Buffer_Ep(register chanend c_aud_out, hidCaptureReportTime(hid_ready_id, reportTime); hidCalcNextReportTime(hid_ready_id); hidClearChangePending(hid_ready_id); - break; - #endif + break; +#endif - #ifdef MIDI +#ifdef MIDI /* Received word from MIDI thread - Check for ACK or Data */ case midi_get_ack_or_data(c_midi, is_ack, datum): if (is_ack) @@ -955,9 +955,9 @@ void XUA_Buffer_Ep(register chanend c_aud_out, } } break; - #endif /* ifdef MIDI */ +#endif /* ifdef MIDI */ - #ifdef IAP +#ifdef IAP /* Received word from iap thread - Check for ACK or Data */ case iap_get_ack_or_reset_or_data(c_iap, is_ack_iap, is_reset, datum_iap): @@ -1016,16 +1016,16 @@ void XUA_Buffer_Ep(register chanend c_aud_out, if (iap_data_collected_from_device == iap_expected_data_length) { XUD_Result_t result1 = XUD_RES_OKAY, result2; - #ifdef IAP_INT_EP +#ifdef IAP_INT_EP result1 = XUD_SetReady_In(ep_iap_to_host_int, gc_zero_buffer, 0); - #endif +#endif result2 = XUD_SetReady_In(ep_iap_to_host, iap_to_host_buffer, iap_data_collected_from_device); if((result1 == XUD_RES_RST) || (result2 == XUD_RES_RST)) { - #ifdef IAP_INT_EP +#ifdef IAP_INT_EP XUD_ResetEndpoint(ep_iap_to_host_int, null); - #endif +#endif XUD_ResetEndpoint(ep_iap_to_host, null); iap_send_reset(c_iap); iap_draining_chan = 1; // Drain c_iap until a reset is sent back @@ -1097,8 +1097,8 @@ void XUA_Buffer_Ep(register chanend c_aud_out, case EA_NATIVE_SEND_DATA: // Unsolicited data from user core for IN ep iAP2_EANativeTransport_readFromChan_data(c_iap_ea_native_data, - iap_ea_native_tx_buffer, - iap_ea_native_tx_length); + iap_ea_native_tx_buffer, + iap_ea_native_tx_length); // Mark the IN EP as ready now we have all the data XUD_SetReady_In(ep_iap_ea_native_in, iap_ea_native_tx_buffer, iap_ea_native_tx_length); break; From f88e5877bea0e572282bc47c7d994b762c215107 Mon Sep 17 00:00:00 2001 From: Angel Cascarino Date: Wed, 12 Jan 2022 15:44:05 +0000 Subject: [PATCH 36/43] Documentation updates --- lib_xua/src/hid/hid.xc | 4 +- lib_xua/src/hid/xua_hid_report.h | 175 +++++++++++++++---------------- 2 files changed, 87 insertions(+), 92 deletions(-) diff --git a/lib_xua/src/hid/hid.xc b/lib_xua/src/hid/hid.xc index 015d94ec..ee8b6ae9 100644 --- a/lib_xua/src/hid/hid.xc +++ b/lib_xua/src/hid/hid.xc @@ -59,8 +59,8 @@ unsigned HidIsSetIdleSilenced( const unsigned id ) * \brief Calculate the timer value for sending the next HID Report. * * With regard to Section 7.2.4 Set_Idle Request of the USB Device Class Definition for Human - * Interface Devices (HID) Version 1.11, I've interpreted 'currently executing period' and - * 'current period' to mean the previously established Set Idle duration if one has been + * Interface Devices (HID) Version 1.11, 'currently executing period' and 'current period' have + * been interpreted to mean the previously established Set Idle duration if one has been * established or the polling interval from the HID Report Descriptor if a Set Idle duration * has not been established. * diff --git a/lib_xua/src/hid/xua_hid_report.h b/lib_xua/src/hid/xua_hid_report.h index 24ed3e8e..41dd7441 100644 --- a/lib_xua/src/hid/xua_hid_report.h +++ b/lib_xua/src/hid/xua_hid_report.h @@ -114,17 +114,43 @@ typedef struct } USB_HID_Report_Element_t; /** - * @brief Does the application use Report IDs? - * - * If the application is not using Report IDs, then the id value that is passed around - * everywhere can just be zero. Otherwise zero is an invalid ID that has a special meaning - * in some cases (read the documentation for each function). - * - * @return Boolean - * @retval 1 Report IDs are in use - * @retval 0 Report IDs are not in use + * \brief Calculate the next time to respond with a HID Report. + * + * If the USB Host has previously sent a valid HID Set_Idle request with + * a duration of zero or greater than the default reporting interval, + * the device sends HID Reports periodically or when the value of the + * payload has changed. + * + * This function calculates the time for sending the next periodic + * HID Report. + * + * Parameters: + * + * @param[in] id The identifier for the HID Report (see 5.6, 6.2.2.7, 8.1 and 8.2) + * A value of zero means the application does not use Report IDs. */ -unsigned hidIsReportIdInUse ( void ); +void hidCalcNextReportTime( const unsigned id ); + +/** + * \brief Capture the time of sending the current HID Report. + * + * If the USB Host has previously sent a valid HID Set_Idle request with + * a duration of zero or greater than the default reporting interval, + * the device sends HID Reports periodically or when the value of the + * payload has changed. + * + * This function captures the time when the HID Report was sent so that + * a subsequent call to HidCalNextReportTime() can calculate the time + * to send the next periodic HID Report. + * + * Parameters: + * + * @param[in] id The identifier for the HID Report (see 5.6, 6.2.2.7, 8.1 and 8.2) + * A value of zero means the application does not use Report IDs. + * + * @param[in] time The time when the HID Report for the given \a id was sent. + */ +void hidCaptureReportTime( const unsigned id, const unsigned time ); /** * \brief Register that a previously changed HID Report data has been sent @@ -147,22 +173,24 @@ unsigned hidIsReportIdInUse ( void ); * HID data has been reported to the USB Host. * * \warning This function will fail silently if given an id that is not - * either the value zero, or a Report ID that is in use. + * either the value zero (in the case that Report IDs are not in use), + * or a Report ID that is in use. * * \param[in] id A HID Report ID. - * Zero clears the pending status of all Report IDs. * Use zero if the application does not use Report IDs. */ void hidClearChangePending( const unsigned id ); /** - * @brief Indicate if the HID Report descriptor has been prepared - * - * \returns A Boolean indicating whether the HID Report descriptor has been prepared. - * \retval True The HID Report descriptor has been prepared. - * \retval False The HID Report descriptor has not been prepared. + * @brief Get the next valid report ID - iterator style. + * + * This function will loop around and start returning the first report ID again once it has + * returned all valid report IDs. + * + * @param idPrev The previous returned id, or 0 if this is the first call + * @return unsigned The next valid report ID. */ - unsigned hidIsReportDescriptorPrepared( void ); +unsigned hidGetNextValidReportId ( unsigned idPrev ); /** * @brief Get the HID Report descriptor @@ -203,31 +231,6 @@ size_t hidGetReportDescriptorLength( void ); */ unsigned hidGetReportIdLimit ( void ); -/** - * @brief Is the provided report ID valid for passing to other functions. - * - * e.g If Report IDs are not in use, then only 0 will return true. - * e.g If Report IDs are in use, then 0 will return false and the report IDs that - * are in use will return true when passed to thsi function. - * - * @param id The ID to check - * @return boolean - * @retval 0 The report ID is not valid, other functions may fail silently - * @retval 1 The report ID is valid and can be used as the argument to other functions - */ -unsigned hidIsReportIdValid ( unsigned id ); - -/** - * @brief Get the next valid report ID - iterator style. - * - * This function will loop around and start returning the first report ID again once it has - * returned all valid report IDs. - * - * @param idPrev The previous returned id, or 0 if this is the first call - * @return unsigned The next valid report ID. - */ -unsigned hidGetNextValidReportId ( unsigned idPrev ); - /** * @brief Get a HID Report descriptor item * @@ -265,45 +268,6 @@ unsigned hidGetReportItem( unsigned char data[]); #endif -/** - * \brief Calculate the next time to respond with a HID Report. - * - * If the USB Host has previously sent a valid HID Set_Idle request with - * a duration of zero or greater than the default reporting interval, - * the device sends HID Reports periodically or when the value of the - * payload has changed. - * - * This function calculates the time for sending the next periodic - * HID Report. - * - * Parameters: - * - * @param[in] id The identifier for the HID Report (see 5.6, 6.2.2.7, 8.1 and 8.2) - * A value of zero means the application does not use Report IDs. - */ -void hidCalcNextReportTime( const unsigned id ); - -/** - * \brief Capture the time of sending the current HID Report. - * - * If the USB Host has previously sent a valid HID Set_Idle request with - * a duration of zero or greater than the default reporting interval, - * the device sends HID Reports periodically or when the value of the - * payload has changed. - * - * This function captures the time when the HID Report was sent so that - * a subsequent call to HidCalNextReportTime() can calculate the time - * to send the next periodic HID Report. - * - * Parameters: - * - * @param[in] id The identifier for the HID Report (see 5.6, 6.2.2.7, 8.1 and 8.2) - * A value of zero means the application does not use Report IDs. - * - * @param[in] time The time when the HID Report for the given \a id was sent. - */ -void hidCaptureReportTime( const unsigned id, const unsigned time ); - /** * @brief Get the time to send the next HID Report for the given \a id * @@ -378,18 +342,16 @@ unsigned hidGetReportTime( const unsigned id ); * whether unreported HID data exists for that Report ID. * * \warning This function will return zero if given an id that is not - * either the value zero, or a Report ID that is in use. + * either the value zero (in the case that Report IDs are not in use), + * or a Report ID that is in use. * * \param[in] id A HID Report ID. - * Zero reports the pending status of all Report IDs. * Use zero if the application does not use Report IDs. * * \returns A Boolean indicating whether the given \a id has a changed * HID Report not yet sent to the USB Host. * \retval True The given \a id has changed HID Report data. - * For an \a id of zero, some HID Report has changed data. * \retval False The given \a id does not have changed HID Report data. - * For an \a id of zero, no HID Report has changed data. */ unsigned hidIsChangePending( const unsigned id ); @@ -399,16 +361,48 @@ unsigned hidIsChangePending( const unsigned id ); * Parameters: * * @param[in] id The identifier for the HID Report (see 5.6, 6.2.2.7, 8.1 and 8.2) - * A value of zero returns the collective Idle state. * * \returns A Boolean indicating whether the HID Report for the given \a id is idle. * \retval True The HID Report is idle. - * For an \a id of zero, all HID Reports are idle. * \retval False The HID Report is not idle. - * For an \a id of zero, at least one HID Report is not idle. */ unsigned hidIsIdleActive( const unsigned id ); +/** + * @brief Indicate if the HID Report descriptor has been prepared + * + * \returns A Boolean indicating whether the HID Report descriptor has been prepared. + * \retval True The HID Report descriptor has been prepared. + * \retval False The HID Report descriptor has not been prepared. + */ + unsigned hidIsReportDescriptorPrepared( void ); + +/** + * @brief Does the application use Report IDs? + * + * If the application is not using Report IDs, then the id value that is passed around + * everywhere can just be zero. Otherwise zero is an invalid ID. + * + * @return Boolean + * @retval 1 Report IDs are in use + * @retval 0 Report IDs are not in use + */ +unsigned hidIsReportIdInUse ( void ); + +/** + * @brief Is the provided report ID valid for passing to other functions. + * + * e.g If Report IDs are not in use, then only 0 will return true. + * e.g If Report IDs are in use, then 0 will return false and the report IDs that + * are in use will return true when passed to this function. + * + * @param id The ID to check + * @return boolean + * @retval 0 The report ID is not valid, other functions may fail silently + * @retval 1 The report ID is valid and can be used as the argument to other functions + */ +unsigned hidIsReportIdValid ( unsigned id ); + /** * @brief Prepare the USB HID Report descriptor * @@ -454,7 +448,8 @@ void hidResetReportDescriptor( void ); * Host. * * \warning This function will fail silently if given an id that is not - * either the value zero, or a Report ID that is in use. + * either the value zero (in the case that Report IDs are not in use), + * or a Report ID that is in use. * * \param[in] id A HID Report ID. * Use zero if the application does not use Report IDs. From 515ec9c0228a91bf010676baa13c3b0596e1714e Mon Sep 17 00:00:00 2001 From: Angel Cascarino Date: Wed, 12 Jan 2022 16:08:46 +0000 Subject: [PATCH 37/43] More code neatness changes --- lib_xua/src/core/buffer/ep/ep_buffer.xc | 4 ++-- 1 file 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 b0d1bbc7..e52eac8a 100644 --- a/lib_xua/src/core/buffer/ep/ep_buffer.xc +++ b/lib_xua/src/core/buffer/ep/ep_buffer.xc @@ -719,8 +719,8 @@ void XUA_Buffer_Ep(register chanend c_aud_out, { /* Inform stream that buffer sent */ SET_SHARED_GLOBAL0(g_aud_to_host_flag, bufferIn+1); - } break; + } #endif #if (NUM_USB_CHAN_OUT > 0) @@ -740,8 +740,8 @@ void XUA_Buffer_Ep(register chanend c_aud_out, { XUD_SetReady_In(ep_aud_fb, (fb_clocks, unsigned char[]), 3); } - } break; + } #endif /* Received Audio packet HOST -> DEVICE. Datalength written to length */ case XUD_GetData_Select(c_aud_out, ep_aud_out, length, result): From a08f5d78fbfe60316348b02cadc848e67da51a60 Mon Sep 17 00:00:00 2001 From: Angel Cascarino Date: Wed, 12 Jan 2022 16:09:54 +0000 Subject: [PATCH 38/43] Another code neatness change --- lib_xua/src/core/buffer/ep/ep_buffer.xc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/src/core/buffer/ep/ep_buffer.xc b/lib_xua/src/core/buffer/ep/ep_buffer.xc index e52eac8a..a9a9a9a1 100644 --- a/lib_xua/src/core/buffer/ep/ep_buffer.xc +++ b/lib_xua/src/core/buffer/ep/ep_buffer.xc @@ -752,8 +752,8 @@ void XUA_Buffer_Ep(register chanend c_aud_out, /* Sync with decouple thread */ SET_SHARED_GLOBAL0(g_aud_from_host_flag, 1); - } break; + } #endif #ifdef MIDI From b3d66f4ca436e1916841efb46326f08075ce2a41 Mon Sep 17 00:00:00 2001 From: Angel Cascarino Date: Wed, 12 Jan 2022 17:37:48 +0000 Subject: [PATCH 39/43] Upversioned, updated changelog, and removed .?project files --- CHANGELOG.rst | 6 + lib_xua/.cproject | 860 -------------------------------------- lib_xua/.project | 42 -- lib_xua/.xproject | 1 - lib_xua/module_build_info | 4 +- xpd.xml | 120 ------ 6 files changed, 8 insertions(+), 1025 deletions(-) delete mode 100644 lib_xua/.cproject delete mode 100644 lib_xua/.project delete mode 100644 lib_xua/.xproject delete mode 100644 xpd.xml diff --git a/CHANGELOG.rst b/CHANGELOG.rst index be25c651..51133206 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,12 @@ lib_xua Change Log ================== +3.1.0 +----- + + * CHANGED: Removed logic from HID API functions allowing a Report ID of 0 + to be used as "all/any" Report. + 3.0.0 ----- diff --git a/lib_xua/.cproject b/lib_xua/.cproject deleted file mode 100644 index 08cfa4f2..00000000 --- a/lib_xua/.cproject +++ /dev/null @@ -1,860 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/lib_xua/.project b/lib_xua/.project deleted file mode 100644 index c752d2f7..00000000 --- a/lib_xua/.project +++ /dev/null @@ -1,42 +0,0 @@ - - - lib_xua - - - - - - com.xmos.cdt.core.ProjectInfoSyncBuilder - - - - - com.xmos.cdt.core.LegacyProjectCheckerBuilder - - - - - com.xmos.cdt.core.ModulePathBuilder - - - - - org.eclipse.cdt.managedbuilder.core.genmakebuilder - clean,full,incremental, - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - full,incremental, - - - - - - org.eclipse.cdt.core.cnature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature - com.xmos.cdt.core.XdeProjectNature - - diff --git a/lib_xua/.xproject b/lib_xua/.xproject deleted file mode 100644 index 2a5ae266..00000000 --- a/lib_xua/.xproject +++ /dev/null @@ -1 +0,0 @@ -lib_xuaXM-012639-SM diff --git a/lib_xua/module_build_info b/lib_xua/module_build_info index 9175f815..6b7bce33 100644 --- a/lib_xua/module_build_info +++ b/lib_xua/module_build_info @@ -1,11 +1,11 @@ -VERSION = 3.0.0 +VERSION = 3.1.0 DEPENDENT_MODULES = lib_logging(>=3.0.0) \ lib_xassert(>=4.0.0) \ lib_xud(>=2.0.1) \ lib_spdif(>=4.0.0) \ lib_mic_array(>=4.0.0) \ - lib_locks(>=2.0.3) + lib_locks(>=2.1.0) MODULE_XCC_FLAGS = $(XCC_FLAGS) \ -O3 \ diff --git a/xpd.xml b/xpd.xml deleted file mode 100644 index 65d892c5..00000000 --- a/xpd.xml +++ /dev/null @@ -1,120 +0,0 @@ - - - - - XMOS USB Audio Reference Designes - DFU - - - - UAC2 - - - XR-USB-AUDIO-20-MC - USB Audio UAC2 - - - - module_queue - MIDI - - - USB Audio Shared Components. For use in the XMOS USB Audio Refererence Designs. - module_dfu/doc - False - git://git/apps/sc_usb_audio - USB Audio Shared Components - xross - XM-004719-DH - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - XM-004720-SM - XMOS - - - - - - 1.0 - \ No newline at end of file From 8c30ce60f2bd03f6eade0624bba7a022fb9b1a05 Mon Sep 17 00:00:00 2001 From: Angel Cascarino Date: Wed, 12 Jan 2022 17:41:52 +0000 Subject: [PATCH 40/43] Removed trailing whitespace in changelog entry --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 51133206..78aa6820 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,7 +5,7 @@ lib_xua Change Log ----- * CHANGED: Removed logic from HID API functions allowing a Report ID of 0 - to be used as "all/any" Report. + to be used as "all/any" Report 3.0.0 ----- From b62782faa0d1c07897886b8d5a6e9e5d71de5019 Mon Sep 17 00:00:00 2001 From: Angel Cascarino Date: Wed, 12 Jan 2022 17:50:06 +0000 Subject: [PATCH 41/43] Moved the word "to" one line up in the changelog --- CHANGELOG.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 78aa6820..736da604 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,8 +4,8 @@ lib_xua Change Log 3.1.0 ----- - * CHANGED: Removed logic from HID API functions allowing a Report ID of 0 - to be used as "all/any" Report + * CHANGED: Removed logic from HID API functions allowing a Report ID of 0 to + be used as "all/any" Report 3.0.0 ----- From 41c6b905494a2e67a2a11ec71fbe2a9615587798 Mon Sep 17 00:00:00 2001 From: Angel Cascarino Date: Wed, 12 Jan 2022 17:57:16 +0000 Subject: [PATCH 42/43] Pruned extraneous whitespace. --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 736da604..0f6fee2f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,7 +4,7 @@ lib_xua Change Log 3.1.0 ----- - * CHANGED: Removed logic from HID API functions allowing a Report ID of 0 to + * CHANGED: Removed logic from HID API functions allowing a Report ID of 0 to be used as "all/any" Report 3.0.0 From a7675ba99723d12e979f51f125b0a5c98156833a Mon Sep 17 00:00:00 2001 From: mbanth Date: Thu, 13 Jan 2022 10:04:56 +0000 Subject: [PATCH 43/43] Require lib_locks v2.0.3 or later since that's the latest released version --- lib_xua/module_build_info | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_xua/module_build_info b/lib_xua/module_build_info index 6b7bce33..4ed428e5 100644 --- a/lib_xua/module_build_info +++ b/lib_xua/module_build_info @@ -5,7 +5,7 @@ DEPENDENT_MODULES = lib_logging(>=3.0.0) \ lib_xud(>=2.0.1) \ lib_spdif(>=4.0.0) \ lib_mic_array(>=4.0.0) \ - lib_locks(>=2.1.0) + lib_locks(>=2.0.3) MODULE_XCC_FLAGS = $(XCC_FLAGS) \ -O3 \