From 737c5bd7d07f7e5e37c0d4b00c0da3f0505bebe2 Mon Sep 17 00:00:00 2001 From: mbanth Date: Wed, 5 Jan 2022 17:52:07 +0000 Subject: [PATCH] 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__