1 /*************************************************************************** 2 * Copyright (c) 2024 Microsoft Corporation 3 * 4 * This program and the accompanying materials are made available under the 5 * terms of the MIT License which is available at 6 * https://opensource.org/licenses/MIT. 7 * 8 * SPDX-License-Identifier: MIT 9 **************************************************************************/ 10 11 12 /**************************************************************************/ 13 /**************************************************************************/ 14 /** */ 15 /** USBX Component */ 16 /** */ 17 /** HID Remote Control Class */ 18 /** */ 19 /**************************************************************************/ 20 /**************************************************************************/ 21 22 23 /**************************************************************************/ 24 /* */ 25 /* COMPONENT DEFINITION RELEASE */ 26 /* */ 27 /* ux_host_class_hid_remote_control.h PORTABLE C */ 28 /* 6.1.11 */ 29 /* AUTHOR */ 30 /* */ 31 /* Chaoqiong Xiao, Microsoft Corporation */ 32 /* */ 33 /* DESCRIPTION */ 34 /* */ 35 /* This file contains all the header and extern functions used by the */ 36 /* USBX HID remote control class. */ 37 /* */ 38 /* RELEASE HISTORY */ 39 /* */ 40 /* DATE NAME DESCRIPTION */ 41 /* */ 42 /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ 43 /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ 44 /* resulting in version 6.1 */ 45 /* 08-02-2021 Wen Wang Modified comment(s), */ 46 /* added extern "C" keyword */ 47 /* for compatibility with C++, */ 48 /* resulting in version 6.1.8 */ 49 /* 04-25-2022 Chaoqiong Xiao Modified comment(s), */ 50 /* fixed clients management, */ 51 /* resulting in version 6.1.11 */ 52 /* */ 53 /**************************************************************************/ 54 55 #ifndef UX_HOST_CLASS_HID_REMOTE_CONTROL_H 56 #define UX_HOST_CLASS_HID_REMOTE_CONTROL_H 57 58 /* Determine if a C++ compiler is being used. If so, ensure that standard 59 C is used to process the API information. */ 60 61 #ifdef __cplusplus 62 63 /* Yes, C++ compiler is present. Use standard C. */ 64 extern "C" { 65 66 #endif 67 68 69 /* Internal option: enable the basic USBX error checking. This define is typically used 70 while debugging application. */ 71 #if defined(UX_ENABLE_ERROR_CHECKING) && !defined(UX_DEVICE_CLASS_HID_REMOTE_CONTROL_ENABLE_ERROR_CHECKING) 72 #define UX_DEVICE_CLASS_HID_REMOTE_CONTROL_ENABLE_ERROR_CHECKING 73 #endif 74 75 76 /* Define HID Remote Control Class constants. */ 77 78 #define UX_HOST_CLASS_HID_REMOTE_CONTROL_BUFFER_LENGTH 128 79 #define UX_HOST_CLASS_HID_REMOTE_CONTROL_USAGE_ARRAY_LENGTH 64 80 81 /* Each item in usage array takes 4 bytes. Check memory bytes calculation overflow here. */ 82 #if UX_OVERFLOW_CHECK_MULC_ULONG(UX_HOST_CLASS_HID_REMOTE_CONTROL_USAGE_ARRAY_LENGTH, 4) 83 #error UX_HOST_CLASS_HID_REMOTE_CONTROL_USAGE_ARRAY_LENGTH is too large for memory allocation, please check 84 #endif 85 86 /* Define HID Remote Control Class structure. */ 87 88 typedef struct UX_HOST_CLASS_HID_REMOTE_CONTROL_STRUCT 89 { 90 91 ULONG ux_host_class_hid_remote_control_state; 92 UX_HOST_CLASS_HID *ux_host_class_hid_remote_control_hid; 93 ULONG *ux_host_class_hid_remote_control_usage_array; 94 ULONG *ux_host_class_hid_remote_control_usage_array_head; 95 ULONG *ux_host_class_hid_remote_control_usage_array_tail; 96 } UX_HOST_CLASS_HID_REMOTE_CONTROL; 97 98 typedef struct UX_HOST_CLASS_HID_CLIENT_REMOTE_CONTROL_STRUCT 99 { 100 UX_HOST_CLASS_HID_REMOTE_CONTROL 101 ux_host_class_hid_client_remote_control_remote_control; 102 UX_HOST_CLASS_HID_CLIENT 103 ux_host_class_hid_client_remote_control_client; 104 } UX_HOST_CLASS_HID_CLIENT_REMOTE_CONTROL; 105 106 /* Define HID Remote Control Class function prototypes. */ 107 108 VOID _ux_host_class_hid_remote_control_callback(UX_HOST_CLASS_HID_REPORT_CALLBACK *callback); 109 UINT _ux_host_class_hid_remote_control_activate(UX_HOST_CLASS_HID_CLIENT_COMMAND *command); 110 UINT _ux_host_class_hid_remote_control_deactivate(UX_HOST_CLASS_HID_CLIENT_COMMAND *command); 111 UINT _ux_host_class_hid_remote_control_entry(UX_HOST_CLASS_HID_CLIENT_COMMAND *command); 112 UINT _ux_host_class_hid_remote_control_usage_get(UX_HOST_CLASS_HID_REMOTE_CONTROL *remote_control_instance, ULONG *usage, ULONG *value); 113 114 UINT _uxe_host_class_hid_remote_control_usage_get(UX_HOST_CLASS_HID_REMOTE_CONTROL *remote_control_instance, ULONG *usage, ULONG *value); 115 116 117 /* Define HID Keyboard Class API prototypes. */ 118 119 #define ux_host_class_hid_remote_control_entry _ux_host_class_hid_remote_control_entry 120 121 #if defined(UX_DEVICE_CLASS_HID_REMOTE_CONTROL_ENABLE_ERROR_CHECKING) 122 123 #define ux_host_class_hid_remote_control_usage_get _uxe_host_class_hid_remote_control_usage_get 124 125 #else 126 127 #define ux_host_class_hid_remote_control_usage_get _ux_host_class_hid_remote_control_usage_get 128 129 #endif 130 131 /* Determine if a C++ compiler is being used. If so, complete the standard 132 C conditional started above. */ 133 #ifdef __cplusplus 134 } 135 #endif 136 137 #endif 138 139