summaryrefslogtreecommitdiff
path: root/common/usbx_host_classes
diff options
context:
space:
mode:
authorScott Larson <[email protected]>2020-08-14 10:45:58 -0700
committerScott Larson <[email protected]>2020-08-14 10:45:58 -0700
commit10ad1105ef70e8954e8beb684b409a5c8b5cedd1 (patch)
treeba9c570a0b61c30f55651a838311742c7483b901 /common/usbx_host_classes
parent0ae68ff7d12bb4c359fa062ffd905f8cf4c58e24 (diff)
apply 6.0.2 patch and add additional architectures and toolchain supportv6.0.2_rel
Diffstat (limited to 'common/usbx_host_classes')
-rw-r--r--common/usbx_host_classes/inc/ux_host_class_hid.h8
-rw-r--r--common/usbx_host_classes/src/ux_host_class_hid_idle_get.c25
-rw-r--r--common/usbx_host_classes/src/ux_host_class_hid_idle_set.c21
-rw-r--r--common/usbx_host_classes/src/ux_host_class_hid_report_get.c14
4 files changed, 60 insertions, 8 deletions
diff --git a/common/usbx_host_classes/inc/ux_host_class_hid.h b/common/usbx_host_classes/inc/ux_host_class_hid.h
index acce24e..d7aa0d5 100644
--- a/common/usbx_host_classes/inc/ux_host_class_hid.h
+++ b/common/usbx_host_classes/inc/ux_host_class_hid.h
@@ -26,7 +26,7 @@
/* COMPONENT DEFINITION RELEASE */
/* */
/* ux_host_class_hid.h PORTABLE C */
-/* 6.0 */
+/* 6.0.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -41,6 +41,10 @@
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* 08-14-2020 Chaoqiong Xiao Modified comment(s), */
+/* fixed struct field */
+/* definition issues, */
+/* resulting in version 6.0.2 */
/* */
/**************************************************************************/
@@ -847,7 +851,7 @@ typedef struct UX_HOST_CLASS_HID_FIELD_STRUCT
ULONG ux_host_class_hid_field_number_usage;
ULONG *ux_host_class_hid_field_values;
ULONG ux_host_class_hid_field_number_values;
- struct UX_HOST_CLASS_HID_REPORT
+ struct UX_HOST_CLASS_HID_REPORT_STRUCT
*ux_host_class_hid_field_report;
struct UX_HOST_CLASS_HID_FIELD_STRUCT
*ux_host_class_hid_field_next_field;
diff --git a/common/usbx_host_classes/src/ux_host_class_hid_idle_get.c b/common/usbx_host_classes/src/ux_host_class_hid_idle_get.c
index acf0f01..5deb535 100644
--- a/common/usbx_host_classes/src/ux_host_class_hid_idle_get.c
+++ b/common/usbx_host_classes/src/ux_host_class_hid_idle_get.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_hid_idle_get PORTABLE C */
-/* 6.0 */
+/* 6.0.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -70,6 +70,10 @@
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* 08-14-2020 Chaoqiong Xiao Modified comment(s), */
+/* protected default control */
+/* endpoint before using it, */
+/* resulting in version 6.0.2 */
/* */
/**************************************************************************/
UINT _ux_host_class_hid_idle_get(UX_HOST_CLASS_HID *hid, USHORT *idle_time, USHORT report_id)
@@ -116,6 +120,25 @@ UINT status;
return(UX_MEMORY_INSUFFICIENT);
}
+ /* Protect the control endpoint semaphore here. It will be unprotected in the
+ transfer request function. */
+ status = _ux_utility_semaphore_get(&hid -> ux_host_class_hid_device -> ux_device_protection_semaphore, UX_WAIT_FOREVER);
+
+ /* Check for status. */
+ if (status != UX_SUCCESS)
+ {
+
+ /* Something went wrong. */
+
+ /* Free allocated memory. */
+ _ux_utility_memory_free(idle_byte);
+
+ /* Unprotect thread reentry to this instance. */
+ _ux_utility_semaphore_put(&hid -> ux_host_class_hid_semaphore);
+
+ return(status);
+ }
+
/* Create a transfer request for the GET_IDLE request. */
transfer_request -> ux_transfer_request_data_pointer = idle_byte;
transfer_request -> ux_transfer_request_requested_length = 1;
diff --git a/common/usbx_host_classes/src/ux_host_class_hid_idle_set.c b/common/usbx_host_classes/src/ux_host_class_hid_idle_set.c
index a7fd64d..42eaf96 100644
--- a/common/usbx_host_classes/src/ux_host_class_hid_idle_set.c
+++ b/common/usbx_host_classes/src/ux_host_class_hid_idle_set.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_hid_idle_set PORTABLE C */
-/* 6.0 */
+/* 6.0.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -70,6 +70,10 @@
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* 08-14-2020 Chaoqiong Xiao Modified comment(s), */
+/* protected default control */
+/* endpoint before using it, */
+/* resulting in version 6.0.2 */
/* */
/**************************************************************************/
UINT _ux_host_class_hid_idle_set(UX_HOST_CLASS_HID *hid, USHORT idle_time, USHORT report_id)
@@ -97,6 +101,21 @@ UINT status;
if (status != UX_SUCCESS)
return(status);
+ /* Protect the control endpoint semaphore here. It will be unprotected in the
+ transfer request function. */
+ status = _ux_utility_semaphore_get(&hid -> ux_host_class_hid_device -> ux_device_protection_semaphore, UX_WAIT_FOREVER);
+
+ /* Check for status. */
+ if (status != UX_SUCCESS)
+ {
+
+ /* Something went wrong. */
+ /* Unprotect thread reentry to this instance. */
+ _ux_utility_semaphore_put(&hid -> ux_host_class_hid_semaphore);
+
+ return(status);
+ }
+
/* We need to get the default control endpoint transfer request pointer. */
control_endpoint = &hid -> ux_host_class_hid_device -> ux_device_control_endpoint;
transfer_request = &control_endpoint -> ux_endpoint_transfer_request;
diff --git a/common/usbx_host_classes/src/ux_host_class_hid_report_get.c b/common/usbx_host_classes/src/ux_host_class_hid_report_get.c
index add69ce..0c3cd1d 100644
--- a/common/usbx_host_classes/src/ux_host_class_hid_report_get.c
+++ b/common/usbx_host_classes/src/ux_host_class_hid_report_get.c
@@ -35,7 +35,7 @@
/* FUNCTION RELEASE */
/* */
/* _ux_host_class_hid_report_get PORTABLE C */
-/* 6.0 */
+/* 6.0.2 */
/* AUTHOR */
/* */
/* Chaoqiong Xiao, Microsoft Corporation */
@@ -75,6 +75,11 @@
/* DATE NAME DESCRIPTION */
/* */
/* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */
+/* 08-14-2020 Chaoqiong Xiao Modified comment(s), */
+/* verified memset and memcpy */
+/* cases, accepted both INPUT */
+/* and FEATURE reports, */
+/* resulting in version 6.0.2 */
/* */
/**************************************************************************/
UINT _ux_host_class_hid_report_get(UX_HOST_CLASS_HID *hid, UX_HOST_CLASS_HID_CLIENT_REPORT *client_report)
@@ -112,8 +117,9 @@ UINT status;
/* Get the report pointer from the caller. */
hid_report = client_report -> ux_host_class_hid_client_report;
- /* Ensure this is a INPUT report. */
- if (hid_report -> ux_host_class_hid_report_type != UX_HOST_CLASS_HID_REPORT_TYPE_INPUT)
+ /* Ensure this is a INPUT report or FEATURE report. */
+ if (hid_report -> ux_host_class_hid_report_type != UX_HOST_CLASS_HID_REPORT_TYPE_INPUT &&
+ hid_report -> ux_host_class_hid_report_type != UX_HOST_CLASS_HID_REPORT_TYPE_FEATURE)
{
/* Unprotect thread reentry to this instance. */
@@ -202,7 +208,7 @@ UINT status;
{
/* We have enough memory to store the raw buffer. */
- _ux_utility_memory_copy(client_report -> ux_host_class_hid_client_report_buffer, report_buffer, transfer_request -> ux_transfer_request_actual_length);
+ _ux_utility_memory_copy(client_report -> ux_host_class_hid_client_report_buffer, report_buffer, transfer_request -> ux_transfer_request_actual_length); /* Use case of memcpy is verified. */
/* Set status to success. */
status = UX_SUCCESS;