1 /**************************************************************************/ 2 /* */ 3 /* Copyright (c) Microsoft Corporation. All rights reserved. */ 4 /* */ 5 /* This software is licensed under the Microsoft Software License */ 6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */ 7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ 8 /* and in the root directory of this software. */ 9 /* */ 10 /**************************************************************************/ 11 12 13 /**************************************************************************/ 14 /**************************************************************************/ 15 /** */ 16 /** USBX Component */ 17 /** */ 18 /** HID Mouse Client Class */ 19 /** */ 20 /**************************************************************************/ 21 /**************************************************************************/ 22 23 24 /**************************************************************************/ 25 /* */ 26 /* COMPONENT DEFINITION RELEASE */ 27 /* */ 28 /* ux_host_class_hid_mouse.h PORTABLE C */ 29 /* 6.1.11 */ 30 /* AUTHOR */ 31 /* */ 32 /* Chaoqiong Xiao, Microsoft Corporation */ 33 /* */ 34 /* DESCRIPTION */ 35 /* */ 36 /* This file contains all the header and extern functions used by the */ 37 /* USBX HID mouse class. */ 38 /* */ 39 /* RELEASE HISTORY */ 40 /* */ 41 /* DATE NAME DESCRIPTION */ 42 /* */ 43 /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ 44 /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ 45 /* resulting in version 6.1 */ 46 /* 08-02-2021 Wen Wang Modified comment(s), */ 47 /* added extern "C" keyword */ 48 /* for compatibility with C++, */ 49 /* resulting in version 6.1.8 */ 50 /* 01-31-2022 Chaoqiong Xiao Modified comment(s), */ 51 /* added standalone support, */ 52 /* resulting in version 6.1.10 */ 53 /* 04-25-2022 Chaoqiong Xiao Modified comment(s), */ 54 /* fixed clients management, */ 55 /* resulting in version 6.1.11 */ 56 /* */ 57 /**************************************************************************/ 58 59 #ifndef UX_HOST_CLASS_HID_MOUSE_H 60 #define UX_HOST_CLASS_HID_MOUSE_H 61 62 /* Determine if a C++ compiler is being used. If so, ensure that standard 63 C is used to process the API information. */ 64 65 #ifdef __cplusplus 66 67 /* Yes, C++ compiler is present. Use standard C. */ 68 extern "C" { 69 70 #endif 71 72 73 /* Define HID Mouse Class constants. */ 74 75 #define UX_HOST_CLASS_HID_MOUSE_BUFFER_LENGTH 128 76 #define UX_HOST_CLASS_HID_MOUSE_USAGE_ARRAY_LENGTH 64 77 78 #define UX_HOST_CLASS_HID_MOUSE_BUTTON_1 0x00090001 79 #define UX_HOST_CLASS_HID_MOUSE_BUTTON_2 0x00090002 80 #define UX_HOST_CLASS_HID_MOUSE_BUTTON_3 0x00090003 81 82 #define UX_HOST_CLASS_HID_MOUSE_AXIS_X 0x00010030 83 #define UX_HOST_CLASS_HID_MOUSE_AXIS_Y 0x00010031 84 85 86 #define UX_HOST_CLASS_HID_MOUSE_BUTTON_1_PRESSED 0x01 87 #define UX_HOST_CLASS_HID_MOUSE_BUTTON_2_PRESSED 0x02 88 #define UX_HOST_CLASS_HID_MOUSE_BUTTON_3_PRESSED 0x04 89 90 #define UX_HOST_CLASS_HID_MOUSE_WHEEL 0x00010038 91 92 /* Define HID Mouse Class structure. */ 93 94 typedef struct UX_HOST_CLASS_HID_MOUSE_STRUCT 95 { 96 97 ULONG ux_host_class_hid_mouse_state; 98 UX_HOST_CLASS_HID *ux_host_class_hid_mouse_hid; 99 USHORT ux_host_class_hid_mouse_id; 100 SLONG ux_host_class_hid_mouse_x_position; 101 SLONG ux_host_class_hid_mouse_y_position; 102 ULONG ux_host_class_hid_mouse_buttons; 103 SLONG ux_host_class_hid_mouse_wheel; 104 #if defined(UX_HOST_STANDALONE) 105 UINT ux_host_class_hid_mouse_enum_state; 106 UINT ux_host_class_hid_mouse_status; 107 #endif 108 109 } UX_HOST_CLASS_HID_MOUSE; 110 111 typedef struct UX_HOST_CLASS_HID_CLIENT_MOUSE_STRUCT 112 { 113 UX_HOST_CLASS_HID_MOUSE ux_host_class_hid_client_mouse_mouse; 114 UX_HOST_CLASS_HID_CLIENT ux_host_class_hid_client_mouse_client; 115 } UX_HOST_CLASS_HID_CLIENT_MOUSE; 116 117 /* Define HID Mouse Class function prototypes. */ 118 119 UINT _ux_host_class_hid_mouse_activate(UX_HOST_CLASS_HID_CLIENT_COMMAND *command); 120 VOID _ux_host_class_hid_mouse_callback(UX_HOST_CLASS_HID_REPORT_CALLBACK *callback); 121 UINT _ux_host_class_hid_mouse_deactivate(UX_HOST_CLASS_HID_CLIENT_COMMAND *command); 122 UINT _ux_host_class_hid_mouse_entry(UX_HOST_CLASS_HID_CLIENT_COMMAND *command); 123 UINT _ux_host_class_hid_mouse_buttons_get(UX_HOST_CLASS_HID_MOUSE *mouse_instance, 124 ULONG *mouse_buttons); 125 UINT _ux_host_class_hid_mouse_position_get(UX_HOST_CLASS_HID_MOUSE *mouse_instance, 126 SLONG *mouse_x_position, 127 SLONG *mouse_y_position); 128 UINT _ux_host_class_hid_mouse_wheel_get(UX_HOST_CLASS_HID_MOUSE *mouse_instance, 129 SLONG *mouse_wheel_movement); 130 131 /* Define HID Mouse Class API prototypes. */ 132 133 #define ux_host_class_hid_mouse_entry _ux_host_class_hid_mouse_entry 134 #define ux_host_class_hid_mouse_buttons_get _ux_host_class_hid_mouse_buttons_get 135 #define ux_host_class_hid_mouse_position_get _ux_host_class_hid_mouse_position_get 136 #define ux_host_class_hid_mouse_wheel_get _ux_host_class_hid_mouse_wheel_get 137 138 /* Determine if a C++ compiler is being used. If so, complete the standard 139 C conditional started above. */ 140 #ifdef __cplusplus 141 } 142 #endif 143 144 #endif 145