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 Class */ 18 /** */ 19 /**************************************************************************/ 20 /**************************************************************************/ 21 22 23 /**************************************************************************/ 24 /* */ 25 /* COMPONENT DEFINITION RELEASE */ 26 /* */ 27 /* ux_device_class_hid.h PORTABLE C */ 28 /* 6.3.0 */ 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 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 /* used UX prefix to refer to */ 45 /* TX symbols instead of using */ 46 /* them directly, */ 47 /* resulting in version 6.1 */ 48 /* 12-31-2020 Chaoqiong Xiao Modified comment(s), */ 49 /* added Get/Set Protocol */ 50 /* request support, */ 51 /* resulting in version 6.1.3 */ 52 /* 08-02-2021 Chaoqiong Xiao Modified comment(s), */ 53 /* added extern "C" keyword */ 54 /* for compatibility with C++, */ 55 /* resulting in version 6.1.8 */ 56 /* 01-31-2022 Chaoqiong Xiao Modified comment(s), */ 57 /* added standalone support, */ 58 /* added interrupt OUT support,*/ 59 /* resulting in version 6.1.10 */ 60 /* 04-25-2022 Chaoqiong Xiao Modified comment(s), */ 61 /* added receiver callback, */ 62 /* resulting in version 6.1.11 */ 63 /* 07-29-2022 Chaoqiong Xiao Modified comment(s), */ 64 /* added standalone int out, */ 65 /* resulting in version 6.1.12 */ 66 /* 10-31-2023 Chaoqiong Xiao Modified comment(s), */ 67 /* added zero copy support, */ 68 /* added a new mode to manage */ 69 /* endpoint buffer in classes, */ 70 /* moved build option check, */ 71 /* resulting in version 6.3.0 */ 72 /* */ 73 /**************************************************************************/ 74 75 #ifndef UX_DEVICE_CLASS_HID_H 76 #define UX_DEVICE_CLASS_HID_H 77 78 /* Determine if a C++ compiler is being used. If so, ensure that standard 79 C is used to process the API information. */ 80 81 #ifdef __cplusplus 82 83 /* Yes, C++ compiler is present. Use standard C. */ 84 extern "C" { 85 86 #endif 87 88 /* Device HID Compile Options. */ 89 90 /* If defined, interrupt OUT transfer is supported. */ 91 /* #define UX_DEVICE_CLASS_HID_INTERRUPT_OUT_SUPPORT */ 92 93 94 /* Internal option: enable the basic USBX error checking. This define is typically used 95 while debugging application. */ 96 #if defined(UX_ENABLE_ERROR_CHECKING) && !defined(UX_DEVICE_CLASS_HID_ENABLE_ERROR_CHECKING) 97 #define UX_DEVICE_CLASS_HID_ENABLE_ERROR_CHECKING 98 #endif 99 100 101 /* Use UX general thread stack size for receiver thread. */ 102 #define UX_DEVICE_CLASS_HID_RECEIVER_THREAD_STACK_SIZE UX_THREAD_STACK_SIZE 103 104 /* Use UX general thread stack size for HID class thread. */ 105 #define UX_DEVICE_CLASS_HID_THREAD_STACK_SIZE UX_THREAD_STACK_SIZE 106 107 /* Interrupt out endpoint buffer size, must be larger than endpoint, and aligned in 4-bytes. */ 108 #define UX_DEVICE_CLASS_HID_INTERRUPTIN_BUFFER_SIZE UX_DEVICE_CLASS_HID_EVENT_BUFFER_LENGTH 109 110 /* Interrupt in endpoint buffer size, must be larger than endpoint, and aligned in 4-bytes. */ 111 #ifdef UX_DEVICE_CLASS_HID_INTERRUPT_OUT_SUPPORT 112 #define UX_DEVICE_CLASS_HID_INTERRUPTOUT_BUFFER_SIZE 8 113 #else 114 #define UX_DEVICE_CLASS_HID_INTERRUPTOUT_BUFFER_SIZE 0 115 #endif 116 117 /* Option: defined, it enables zero copy support (works if HID owns endpoint buffer). */ 118 /* #define UX_DEVICE_CLASS_HID_ZERO_COPY */ 119 120 /* Option: defined, it enables initialize parameters to set event queue size and event max length. 121 If disabled, the default value is UX_DEVICE_CLASS_HID_MAX_EVENTS_QUEUE for queue size 122 and UX_DEVICE_CLASS_HID_EVENT_BUFFER_LENGTH for event max length. 123 If enabled, the parameter _event_max_number (2~UX_DEVICE_CLASS_HID_MAX_EVENTS_QUEUE) sets 124 the queue size and _event_max_length (max UX_DEVICE_CLASS_HID_EVENT_BUFFER_LENGTH) sets 125 event max length. If parameters are not valid, maximum values are used. 126 It's enabled automatically if HID owns endpoint buffer and zero copy is enabled. 127 */ 128 #ifndef UX_DEVICE_CLASS_HID_FLEXIBLE_EVENTS_QUEUE 129 #if (UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1) && defined(UX_DEVICE_CLASS_HID_ZERO_COPY) 130 #define UX_DEVICE_CLASS_HID_FLEXIBLE_EVENTS_QUEUE 131 #endif 132 #endif 133 134 /* Internal: check if class own endpoint buffer */ 135 #if (UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1) 136 #define UX_DEVICE_CLASS_HID_OWN_ENDPOINT_BUFFER 137 #endif 138 139 140 /* Define HID Class constants. */ 141 142 #define UX_DEVICE_CLASS_HID_CLASS 0x03 143 #define UX_DEVICE_CLASS_HID_SUBCLASS 0X00 144 #define UX_DEVICE_CLASS_HID_PROTOCOL 0X00 145 146 /* Define HID Class commands. */ 147 148 #define UX_DEVICE_CLASS_HID_COMMAND_GET_REPORT 0x01 149 #define UX_DEVICE_CLASS_HID_COMMAND_GET_IDLE 0x02 150 #define UX_DEVICE_CLASS_HID_COMMAND_GET_PROTOCOL 0x03 151 #define UX_DEVICE_CLASS_HID_COMMAND_SET_REPORT 0x09 152 #define UX_DEVICE_CLASS_HID_COMMAND_SET_IDLE 0x0A 153 #define UX_DEVICE_CLASS_HID_COMMAND_SET_PROTOCOL 0x0B 154 155 /* Define HID Class Descriptor types. */ 156 157 #define UX_DEVICE_CLASS_HID_DESCRIPTOR_HID 0x21 158 #define UX_DEVICE_CLASS_HID_DESCRIPTOR_REPORT 0x22 159 #define UX_DEVICE_CLASS_HID_DESCRIPTOR_PHYSICAL 0x23 160 161 /* Define HID Report Types. */ 162 163 #define UX_DEVICE_CLASS_HID_REPORT_TYPE_INPUT 0x1 164 #define UX_DEVICE_CLASS_HID_REPORT_TYPE_OUTPUT 0x2 165 #define UX_DEVICE_CLASS_HID_REPORT_TYPE_FEATURE 0x3 166 167 /* Define HID Protocols. */ 168 169 #define UX_DEVICE_CLASS_HID_PROTOCOL_BOOT 0 170 #define UX_DEVICE_CLASS_HID_PROTOCOL_REPORT 1 171 172 /* Define HID standalone read/receiver states. */ 173 174 #define UX_DEVICE_CLASS_HID_READ_START (UX_STATE_STEP + 1) 175 #define UX_DEVICE_CLASS_HID_READ_WAIT (UX_STATE_STEP + 2) 176 177 #define UX_DEVICE_CLASS_HID_RECEIVER_START (UX_STATE_STEP + 3) 178 #define UX_DEVICE_CLASS_HID_RECEIVER_WAIT (UX_STATE_STEP + 4) 179 #define UX_DEVICE_CLASS_HID_RECEIVER_ERROR (UX_STATE_STEP + 5) 180 181 182 /* Define HID event info structure. */ 183 184 #ifndef UX_DEVICE_CLASS_HID_EVENT_BUFFER_LENGTH 185 #define UX_DEVICE_CLASS_HID_EVENT_BUFFER_LENGTH 32 186 #endif 187 188 /* Ensure the event buffer can fit inside the control endpoint's data buffer. */ 189 #if UX_DEVICE_CLASS_HID_EVENT_BUFFER_LENGTH > UX_SLAVE_REQUEST_CONTROL_MAX_LENGTH 190 /* #error "Error: the event buffer cannot fit inside the control endpoint's data buffer. Reduce UX_DEVICE_CLASS_HID_EVENT_BUFFER_LENGTH such that it is less than or equal to UX_SLAVE_REQUEST_CONTROL_MAX_LENGTH." */ 191 /* Build option checked runtime by UX_ASSERT */ 192 #endif 193 194 /* Ensure the event buffer can fit inside the interrupt endpoint's data buffer. */ 195 #if UX_DEVICE_CLASS_HID_EVENT_BUFFER_LENGTH > UX_SLAVE_REQUEST_DATA_MAX_LENGTH 196 /* #error "Error: the event buffer cannot fit inside the interrupt endpoint's data buffer. Reduce UX_DEVICE_CLASS_HID_EVENT_BUFFER_LENGTH such that it is less than or equal to UX_SLAVE_REQUEST_DATA_MAX_LENGTH." */ 197 /* Build option checked runtime by UX_ASSERT */ 198 #endif 199 200 #ifndef UX_DEVICE_CLASS_HID_MAX_EVENTS_QUEUE 201 #define UX_DEVICE_CLASS_HID_MAX_EVENTS_QUEUE 16 202 #endif 203 204 #define UX_DEVICE_CLASS_HID_NEW_EVENT 1u 205 #define UX_DEVICE_CLASS_HID_NEW_IDLE_RATE 2u 206 #define UX_DEVICE_CLASS_HID_EVENTS_MASK 3u /* Mask _NEW_EVENT and _NEW_IDLE_RATE */ 207 208 #define UX_DEVICE_CLASS_HID_RECEIVER_RESTART 4u 209 210 #define UX_DEVICE_CLASS_HID_EVENTS_ALL_MASK 7u /* Mask all event flags. */ 211 212 typedef struct UX_SLAVE_CLASS_HID_EVENT_STRUCT 213 { 214 ULONG ux_device_class_hid_event_report_id; 215 ULONG ux_device_class_hid_event_report_type; 216 ULONG ux_device_class_hid_event_length; 217 UCHAR ux_device_class_hid_event_buffer[UX_DEVICE_CLASS_HID_EVENT_BUFFER_LENGTH]; 218 219 } UX_SLAVE_CLASS_HID_EVENT; 220 221 /* Internal (transmit) event header. */ 222 typedef struct UX_DEVICE_CLASS_HID_EVENT_STRUCT 223 { 224 ULONG ux_device_class_hid_event_report_id; 225 ULONG ux_device_class_hid_event_report_type; 226 ULONG ux_device_class_hid_event_length; 227 UCHAR *ux_device_class_hid_event_buffer; 228 } UX_DEVICE_CLASS_HID_EVENT; 229 230 #if defined(UX_DEVICE_CLASS_HID_FLEXIBLE_EVENTS_QUEUE) 231 #define UX_DEVICE_CLASS_HID_EVENT_BUFFER(e) ((e)->ux_device_class_hid_event_buffer) 232 #else 233 #define UX_DEVICE_CLASS_HID_EVENT_BUFFER(e) (((UX_SLAVE_CLASS_HID_EVENT*)e)->ux_device_class_hid_event_buffer) 234 #endif 235 236 237 /* Define HID structure. */ 238 239 typedef struct UX_SLAVE_CLASS_HID_STRUCT 240 { 241 242 UX_SLAVE_INTERFACE *ux_slave_class_hid_interface; 243 UX_SLAVE_ENDPOINT *ux_device_class_hid_interrupt_endpoint; 244 245 #if defined(UX_DEVICE_CLASS_HID_OWN_ENDPOINT_BUFFER) 246 UCHAR *ux_device_class_hid_endpoint_buffer; 247 #endif 248 249 UINT ux_device_class_hid_state; 250 UINT (*ux_device_class_hid_callback)(struct UX_SLAVE_CLASS_HID_STRUCT *hid, UX_SLAVE_CLASS_HID_EVENT *); 251 UINT (*ux_device_class_hid_get_callback)(struct UX_SLAVE_CLASS_HID_STRUCT *hid, UX_SLAVE_CLASS_HID_EVENT *); 252 VOID (*ux_slave_class_hid_instance_activate)(VOID *); 253 VOID (*ux_slave_class_hid_instance_deactivate)(VOID *); 254 UCHAR *ux_device_class_hid_report_address; 255 ULONG ux_device_class_hid_report_id; 256 ULONG ux_device_class_hid_report_length; 257 #if !defined(UX_DEVICE_STANDALONE) 258 UX_EVENT_FLAGS_GROUP ux_device_class_hid_event_flags_group; 259 #else 260 UINT ux_device_class_hid_event_state; 261 ULONG ux_device_class_hid_event_wait_start; 262 UX_DEVICE_CLASS_HID_EVENT ux_device_class_hid_event; 263 #endif 264 ULONG ux_device_class_hid_event_idle_rate; 265 ULONG ux_device_class_hid_event_wait_timeout; 266 ULONG ux_device_class_hid_protocol; 267 UX_DEVICE_CLASS_HID_EVENT *ux_device_class_hid_event_array; 268 UX_DEVICE_CLASS_HID_EVENT *ux_device_class_hid_event_array_head; 269 UX_DEVICE_CLASS_HID_EVENT *ux_device_class_hid_event_array_tail; 270 UX_DEVICE_CLASS_HID_EVENT *ux_device_class_hid_event_array_end; 271 #if defined(UX_DEVICE_CLASS_HID_FLEXIBLE_EVENTS_QUEUE) 272 ULONG ux_device_class_hid_event_max_length; 273 #endif 274 275 #if defined(UX_DEVICE_CLASS_HID_INTERRUPT_OUT_SUPPORT) 276 UX_SLAVE_ENDPOINT *ux_device_class_hid_read_endpoint; 277 struct UX_DEVICE_CLASS_HID_RECEIVER_STRUCT 278 *ux_device_class_hid_receiver; 279 #if !defined(UX_DEVICE_STANDALONE) 280 UX_MUTEX ux_device_class_hid_read_mutex; 281 #else 282 283 UCHAR *ux_device_class_hid_read_buffer; 284 ULONG ux_device_class_hid_read_requested_length; 285 ULONG ux_device_class_hid_read_actual_length; 286 ULONG ux_device_class_hid_read_transfer_length; 287 288 UINT ux_device_class_hid_read_state; 289 UINT ux_device_class_hid_read_status; 290 #endif 291 #endif 292 293 } UX_SLAVE_CLASS_HID; 294 295 /* Define HID endpoint buffer settings (when HID owns buffer). */ 296 #define UX_DEVICE_CLASS_HID_ENDPOINT_BUFFER_SIZE_CALC_OVERFLOW \ 297 (UX_OVERFLOW_CHECK_ADD_ULONG(UX_DEVICE_CLASS_HID_INTERRUPTIN_BUFFER_SIZE, \ 298 UX_DEVICE_CLASS_HID_INTERRUPTOUT_BUFFER_SIZE)) 299 #define UX_DEVICE_CLASS_HID_ENDPOINT_BUFFER_SIZE (UX_DEVICE_CLASS_HID_INTERRUPTOUT_BUFFER_SIZE + UX_DEVICE_CLASS_HID_INTERRUPTIN_BUFFER_SIZE) 300 #define UX_DEVICE_CLASS_HID_INTERRUPTOUT_BUFFER(hid) ((hid)->ux_device_class_hid_endpoint_buffer) 301 #define UX_DEVICE_CLASS_HID_INTERRUPTIN_BUFFER(hid) (UX_DEVICE_CLASS_HID_INTERRUPTOUT_BUFFER(hid) + UX_DEVICE_CLASS_HID_INTERRUPTOUT_BUFFER_SIZE) 302 303 #ifdef UX_DEVICE_CLASS_HID_FLEXIBLE_EVENTS_QUEUE 304 #define UX_DEVICE_CLASS_HID_EVENT_MAX_LENGTH(hid) ((hid)->ux_device_class_hid_event_max_length) 305 #if (UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1) && defined(UX_DEVICE_CLASS_HID_ZERO_COPY) 306 #define UX_DEVICE_CLASS_HID_EVENT_QUEUE_ITEM_SIZE(hid) sizeof(UX_DEVICE_CLASS_HID_EVENT) 307 #else 308 #define UX_DEVICE_CLASS_HID_EVENT_QUEUE_ITEM_SIZE(hid) (sizeof(UX_DEVICE_CLASS_HID_EVENT) - 4 + UX_DEVICE_CLASS_HID_EVENT_MAX_LENGTH(hid)) 309 #endif 310 #else 311 #define UX_DEVICE_CLASS_HID_EVENT_MAX_LENGTH(hid) UX_DEVICE_CLASS_HID_EVENT_BUFFER_LENGTH 312 #define UX_DEVICE_CLASS_HID_EVENT_QUEUE_ITEM_SIZE(hid) sizeof(UX_SLAVE_CLASS_HID_EVENT) 313 #endif 314 315 316 /* HID interrupt OUT support extensions. */ 317 318 typedef struct UX_DEVICE_CLASS_HID_RECEIVED_EVENT_STRUCT 319 { 320 ULONG ux_device_class_hid_received_event_length; 321 UCHAR *ux_device_class_hid_received_event_data; 322 } UX_DEVICE_CLASS_HID_RECEIVED_EVENT; 323 324 typedef struct UX_DEVICE_CLASS_HID_RECEIVER_STRUCT 325 { 326 327 VOID (*ux_device_class_hid_receiver_uninitialize)(struct UX_DEVICE_CLASS_HID_RECEIVER_STRUCT *receiver); 328 VOID (*ux_device_class_hid_receiver_event_callback)(struct UX_SLAVE_CLASS_HID_STRUCT *hid); 329 330 ULONG ux_device_class_hid_receiver_event_buffer_size; 331 UX_DEVICE_CLASS_HID_RECEIVED_EVENT 332 *ux_device_class_hid_receiver_events; 333 UX_DEVICE_CLASS_HID_RECEIVED_EVENT 334 *ux_device_class_hid_receiver_events_end; 335 UX_DEVICE_CLASS_HID_RECEIVED_EVENT 336 *ux_device_class_hid_receiver_event_read_pos; 337 UX_DEVICE_CLASS_HID_RECEIVED_EVENT 338 *ux_device_class_hid_receiver_event_save_pos; 339 340 #if !defined(UX_DEVICE_STANDALONE) 341 UX_THREAD ux_device_class_hid_receiver_thread; 342 #else 343 UINT (*ux_device_class_hid_receiver_tasks_run)(struct UX_SLAVE_CLASS_HID_STRUCT *hid); 344 #endif 345 } UX_DEVICE_CLASS_HID_RECEIVER; 346 347 #if (UX_DEVICE_ENDPOINT_BUFFER_OWNER == 1) && defined(UX_DEVICE_CLASS_HID_ZERO_COPY) 348 #define UX_DEVICE_CLASS_HID_RECEIVED_QUEUE_ITEM_BUFFER(i) ((i) -> ux_device_class_hid_received_event_data) 349 #define UX_DEVICE_CLASS_HID_RECEIVED_QUEUE_ITEM_SIZE(r) sizeof(UX_DEVICE_CLASS_HID_RECEIVED_EVENT) 350 #else 351 #define UX_DEVICE_CLASS_HID_RECEIVED_QUEUE_ITEM_BUFFER(i) ((UCHAR*)&(i) -> ux_device_class_hid_received_event_data) 352 #define UX_DEVICE_CLASS_HID_RECEIVED_QUEUE_ITEM_SIZE(r) ((r) -> ux_device_class_hid_receiver_event_buffer_size + sizeof(ULONG)) 353 #endif 354 355 356 /* Define HID initialization command structure. */ 357 358 typedef struct UX_SLAVE_CLASS_HID_PARAMETER_STRUCT 359 { 360 361 VOID (*ux_slave_class_hid_instance_activate)(VOID *); 362 VOID (*ux_slave_class_hid_instance_deactivate)(VOID *); 363 UCHAR *ux_device_class_hid_parameter_report_address; 364 ULONG ux_device_class_hid_parameter_report_id; 365 ULONG ux_device_class_hid_parameter_report_length; 366 UINT (*ux_device_class_hid_parameter_callback)(struct UX_SLAVE_CLASS_HID_STRUCT *hid, UX_SLAVE_CLASS_HID_EVENT *); 367 UINT (*ux_device_class_hid_parameter_get_callback)(struct UX_SLAVE_CLASS_HID_STRUCT *hid, UX_SLAVE_CLASS_HID_EVENT *); 368 #if defined(UX_DEVICE_CLASS_HID_FLEXIBLE_EVENTS_QUEUE) 369 ULONG ux_device_class_hid_parameter_event_max_number; 370 ULONG ux_device_class_hid_parameter_event_max_length; 371 #endif 372 #if defined(UX_DEVICE_CLASS_HID_INTERRUPT_OUT_SUPPORT) 373 UINT (*ux_device_class_hid_parameter_receiver_initialize)(UX_SLAVE_CLASS_HID *hid, struct UX_SLAVE_CLASS_HID_PARAMETER_STRUCT *parameter, UX_DEVICE_CLASS_HID_RECEIVER **receiver); 374 ULONG ux_device_class_hid_parameter_receiver_event_max_number; 375 ULONG ux_device_class_hid_parameter_receiver_event_max_length; 376 VOID (*ux_device_class_hid_parameter_receiver_event_callback)(struct UX_SLAVE_CLASS_HID_STRUCT *hid); 377 #endif 378 379 } UX_SLAVE_CLASS_HID_PARAMETER; 380 381 #ifdef UX_DEVICE_CLASS_HID_FLEXIBLE_EVENTS_QUEUE 382 #define UX_DEVICE_CLASS_HID_PARAM_EVENT_QUEUE_SIZE(p) ((p)->ux_device_class_hid_parameter_event_max_number) 383 #define UX_DEVICE_CLASS_HID_PARAM_EVENT_MAX_LENGTH(p) ((p)->ux_device_class_hid_parameter_event_max_length) 384 #else 385 #define UX_DEVICE_CLASS_HID_PARAM_EVENT_QUEUE_SIZE(p) UX_DEVICE_CLASS_HID_MAX_EVENTS_QUEUE 386 #define UX_DEVICE_CLASS_HID_PARAM_EVENT_MAX_LENGTH(p) UX_DEVICE_CLASS_HID_EVENT_BUFFER_LENGTH 387 #endif 388 389 390 /* Define HID Class function prototypes. */ 391 UINT _ux_device_class_hid_descriptor_send(UX_SLAVE_CLASS_HID *hid, ULONG descriptor_type, 392 ULONG request_index, ULONG host_length); 393 UINT _ux_device_class_hid_activate(UX_SLAVE_CLASS_COMMAND *command); 394 UINT _ux_device_class_hid_deactivate(UX_SLAVE_CLASS_COMMAND *command); 395 UINT _ux_device_class_hid_control_request(UX_SLAVE_CLASS_COMMAND *command); 396 UINT _ux_device_class_hid_entry(UX_SLAVE_CLASS_COMMAND *command); 397 VOID _ux_device_class_hid_interrupt_thread(ULONG hid_class); 398 UINT _ux_device_class_hid_initialize(UX_SLAVE_CLASS_COMMAND *command); 399 UINT _ux_device_class_hid_uninitialize(UX_SLAVE_CLASS_COMMAND *command); 400 UINT _ux_device_class_hid_event_set(UX_SLAVE_CLASS_HID *hid, 401 UX_SLAVE_CLASS_HID_EVENT *hid_event); 402 UINT _ux_device_class_hid_event_check(UX_SLAVE_CLASS_HID *hid, 403 UX_DEVICE_CLASS_HID_EVENT **hid_event); 404 VOID _ux_device_class_hid_event_free(UX_SLAVE_CLASS_HID *hid); 405 UINT _ux_device_class_hid_event_get(UX_SLAVE_CLASS_HID *hid, 406 UX_SLAVE_CLASS_HID_EVENT *hid_event); 407 UINT _ux_device_class_hid_report_set(UX_SLAVE_CLASS_HID *hid, ULONG descriptor_type, 408 ULONG request_index, ULONG host_length); 409 UINT _ux_device_class_hid_report_get(UX_SLAVE_CLASS_HID *hid, ULONG descriptor_type, 410 ULONG request_index, ULONG host_length); 411 412 UINT _ux_device_class_hid_tasks_run(VOID *class_instance); 413 414 UINT _ux_device_class_hid_read(UX_SLAVE_CLASS_HID *hid, 415 UCHAR *buffer, ULONG requested_length, 416 ULONG *actual_length); 417 418 VOID _ux_device_class_hid_receiver_thread(ULONG hid_class); 419 UINT _ux_device_class_hid_receiver_initialize(UX_SLAVE_CLASS_HID *hid, 420 UX_SLAVE_CLASS_HID_PARAMETER *parameter, 421 UX_DEVICE_CLASS_HID_RECEIVER **receiver); 422 VOID _ux_device_class_hid_receiver_uninitialize(UX_DEVICE_CLASS_HID_RECEIVER *receiver); 423 UINT _ux_device_class_hid_receiver_event_get(UX_SLAVE_CLASS_HID *hid, 424 UX_DEVICE_CLASS_HID_RECEIVED_EVENT *event); 425 UINT _ux_device_class_hid_receiver_event_free(UX_SLAVE_CLASS_HID *hid); 426 427 UINT _ux_device_class_hid_read_run(UX_SLAVE_CLASS_HID *hid, 428 UCHAR *buffer, ULONG requested_length, 429 ULONG *actual_length); 430 UINT _ux_device_class_hid_receiver_tasks_run(UX_SLAVE_CLASS_HID *hid); 431 432 433 UINT _uxe_device_class_hid_initialize(UX_SLAVE_CLASS_COMMAND *command); 434 UINT _uxe_device_class_hid_event_set(UX_SLAVE_CLASS_HID *hid, 435 UX_SLAVE_CLASS_HID_EVENT *hid_event); 436 UINT _uxe_device_class_hid_event_get(UX_SLAVE_CLASS_HID *hid, 437 UX_SLAVE_CLASS_HID_EVENT *hid_event); 438 UINT _uxe_device_class_hid_read(UX_SLAVE_CLASS_HID *hid, 439 UCHAR *buffer, ULONG requested_length, 440 ULONG *actual_length); 441 UINT _uxe_device_class_hid_read_run(UX_SLAVE_CLASS_HID *hid, 442 UCHAR *buffer, ULONG requested_length, 443 ULONG *actual_length); 444 UINT _uxe_device_class_hid_receiver_initialize(UX_SLAVE_CLASS_HID *hid, 445 UX_SLAVE_CLASS_HID_PARAMETER *parameter, 446 UX_DEVICE_CLASS_HID_RECEIVER **receiver); 447 UINT _uxe_device_class_hid_receiver_event_get(UX_SLAVE_CLASS_HID *hid, 448 UX_DEVICE_CLASS_HID_RECEIVED_EVENT *event); 449 UINT _uxe_device_class_hid_receiver_event_free(UX_SLAVE_CLASS_HID *hid); 450 451 452 /* Define Device HID Class API prototypes. */ 453 454 #if defined(UX_DEVICE_CLASS_HID_ENABLE_ERROR_CHECKING) 455 456 #define ux_device_class_hid_entry _ux_device_class_hid_entry 457 #define ux_device_class_hid_event_set _uxe_device_class_hid_event_set 458 #define ux_device_class_hid_event_get _uxe_device_class_hid_event_get 459 #define ux_device_class_hid_report_set _ux_device_class_hid_report_set 460 #define ux_device_class_hid_report_get _ux_device_class_hid_report_get 461 462 #define ux_device_class_hid_protocol_get(hid) (((hid) == UX_NULL) ? UX_ERROR : (hid) -> ux_device_class_hid_protocol) 463 464 #define ux_device_class_hid_read _uxe_device_class_hid_read 465 #define ux_device_class_hid_read_run _uxe_device_class_hid_read_run 466 467 #define ux_device_class_hid_receiver_initialize _ux_device_class_hid_receiver_initialize 468 #define ux_device_class_hid_receiver_event_get _uxe_device_class_hid_receiver_event_get 469 #define ux_device_class_hid_receiver_event_free _uxe_device_class_hid_receiver_event_free 470 471 #else 472 473 #define ux_device_class_hid_entry _ux_device_class_hid_entry 474 #define ux_device_class_hid_event_set _ux_device_class_hid_event_set 475 #define ux_device_class_hid_event_get _ux_device_class_hid_event_get 476 #define ux_device_class_hid_report_set _ux_device_class_hid_report_set 477 #define ux_device_class_hid_report_get _ux_device_class_hid_report_get 478 479 #define ux_device_class_hid_protocol_get(hid) ((hid) -> ux_device_class_hid_protocol) 480 481 #define ux_device_class_hid_read _ux_device_class_hid_read 482 #define ux_device_class_hid_read_run _ux_device_class_hid_read_run 483 484 #define ux_device_class_hid_receiver_initialize _ux_device_class_hid_receiver_initialize 485 #define ux_device_class_hid_receiver_event_get _ux_device_class_hid_receiver_event_get 486 #define ux_device_class_hid_receiver_event_free _ux_device_class_hid_receiver_event_free 487 488 #endif 489 490 /* Determine if a C++ compiler is being used. If so, complete the standard 491 C conditional started above. */ 492 #ifdef __cplusplus 493 } 494 #endif 495 496 #endif 497