From 255e9f75b543aa8d9bdcf1cfb67a303f116712e0 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Thu, 5 Dec 2019 16:45:11 +0000 Subject: [PATCH 1/3] Add missing header file guards. --- lib_xua/src/core/user/hid/user_hid.h | 4 ++++ lib_xua/src/hid/xua_hid.h | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/lib_xua/src/core/user/hid/user_hid.h b/lib_xua/src/core/user/hid/user_hid.h index 88165b2a..7d67b00c 100644 --- a/lib_xua/src/core/user/hid/user_hid.h +++ b/lib_xua/src/core/user/hid/user_hid.h @@ -1,5 +1,8 @@ // Copyright (c) 2013-2019, XMOS Ltd, All rights reserved +#ifndef __USER_HID_H__ +#define __USER_HID_H__ + /* These defines relate to the HID report desc - do not mod */ #define HID_CONTROL_PLAYPAUSE_SHIFT 0x00 #define HID_CONTROL_NEXT_SHIFT 0x01 @@ -17,3 +20,4 @@ void UserReadHIDData( unsigned char hidData[ HID_DATA_SIZE ]); void UserSetHIDData( const unsigned hidData ); #endif /* ( 0 < HID_CONTROLS ) */ +#endif /* __USER_HID_H__ */ diff --git a/lib_xua/src/hid/xua_hid.h b/lib_xua/src/hid/xua_hid.h index 23d507e0..63469054 100644 --- a/lib_xua/src/hid/xua_hid.h +++ b/lib_xua/src/hid/xua_hid.h @@ -1,4 +1,8 @@ // Copyright (c) 2019, XMOS Ltd, All rights reserved + +#ifndef __XUA_HID_H__ +#define __XUA_HID_H__ + #include #include #include "xud.h" @@ -53,3 +57,5 @@ XUD_Result_t HidInterfaceClassRequests( * \retval 0 -- Send the HID Report */ unsigned HidIsSetIdleSilenced( void ); + +#endif // __XUA_HID_H__ From 83284620ccc6cf9dd3ce8b2f38724924ede7a4af Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Thu, 5 Dec 2019 16:45:49 +0000 Subject: [PATCH 2/3] Explain the need for using the assembler gettime operation instead of an XC timer more fully. --- lib_xua/src/hid/hid.xc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib_xua/src/hid/hid.xc b/lib_xua/src/hid/hid.xc index 478bfea5..854b78d3 100644 --- a/lib_xua/src/hid/hid.xc +++ b/lib_xua/src/hid/hid.xc @@ -57,7 +57,10 @@ unsigned HidIsSetIdleSilenced( void ) if( s_hidIdleActive ) { unsigned currentTime; - asm volatile( "gettime %0" : "=r" ( currentTime )); // Use inline assembly to access the time without creating a side-effect + // 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 = ( s_hidIndefiniteDuration || ( timeafter( s_hidNextReportTime, currentTime ))); } From 746635b2eb48dd7eb39024a6c755184a18983741 Mon Sep 17 00:00:00 2001 From: Michael Banther Date: Thu, 5 Dec 2019 18:01:14 +0000 Subject: [PATCH 3/3] Update change log. --- CHANGELOG.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 11d15168..d8b82f4a 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -10,6 +10,7 @@ lib_xua Change Log * ADDED: Pre-processor symbols to enable single-threaded, dual-PDM microphone operation * FIXED: Descriptors for XUA_ADAPTIVE incorrectly defined for IN endpoint + * ADDED: Guards to user_hid.h and xua_hid.h 0.2.1 -----