|
1 | 1 | /*************************************************************************** |
2 | | - * Copyright (c) 2024 Microsoft Corporation |
3 | | - * |
| 2 | + * Copyright (c) 2024 Microsoft Corporation |
| 3 | + * |
4 | 4 | * This program and the accompanying materials are made available under the |
5 | 5 | * terms of the MIT License which is available at |
6 | 6 | * https://opensource.org/licenses/MIT. |
7 | | - * |
| 7 | + * |
8 | 8 | * SPDX-License-Identifier: MIT |
9 | 9 | **************************************************************************/ |
10 | 10 |
|
11 | 11 | /**************************************************************************/ |
12 | 12 | /**************************************************************************/ |
13 | | -/** */ |
14 | | -/** USBX Component */ |
| 13 | +/** */ |
| 14 | +/** USBX Component */ |
15 | 15 | /** */ |
16 | 16 | /** Device HID Class */ |
17 | 17 | /** */ |
|
28 | 28 | #include "ux_device_stack.h" |
29 | 29 |
|
30 | 30 |
|
31 | | -/**************************************************************************/ |
32 | | -/* */ |
33 | | -/* FUNCTION RELEASE */ |
34 | | -/* */ |
35 | | -/* _ux_device_class_hid_deactivate PORTABLE C */ |
| 31 | +/**************************************************************************/ |
| 32 | +/* */ |
| 33 | +/* FUNCTION RELEASE */ |
| 34 | +/* */ |
| 35 | +/* _ux_device_class_hid_deactivate PORTABLE C */ |
36 | 36 | /* 6.1.12 */ |
37 | 37 | /* AUTHOR */ |
38 | 38 | /* */ |
39 | 39 | /* Chaoqiong Xiao, Microsoft Corporation */ |
40 | 40 | /* */ |
41 | 41 | /* DESCRIPTION */ |
42 | | -/* */ |
43 | | -/* This function deactivate an instance of the hid class. */ |
44 | | -/* */ |
45 | | -/* INPUT */ |
46 | | -/* */ |
47 | | -/* command Pointer to a class command */ |
48 | | -/* */ |
49 | | -/* OUTPUT */ |
50 | | -/* */ |
51 | | -/* Completion Status */ |
52 | | -/* */ |
53 | | -/* CALLS */ |
54 | | -/* */ |
55 | | -/* _ux_device_stack_transfer_all_request_abort Abort all transfers */ |
56 | | -/* */ |
57 | | -/* CALLED BY */ |
58 | | -/* */ |
| 42 | +/* */ |
| 43 | +/* This function deactivate an instance of the hid class. */ |
| 44 | +/* */ |
| 45 | +/* INPUT */ |
| 46 | +/* */ |
| 47 | +/* command Pointer to a class command */ |
| 48 | +/* */ |
| 49 | +/* OUTPUT */ |
| 50 | +/* */ |
| 51 | +/* Completion Status */ |
| 52 | +/* */ |
| 53 | +/* CALLS */ |
| 54 | +/* */ |
| 55 | +/* _ux_device_stack_transfer_all_request_abort Abort all transfers */ |
| 56 | +/* */ |
| 57 | +/* CALLED BY */ |
| 58 | +/* */ |
59 | 59 | /* HID Class */ |
60 | | -/* */ |
61 | | -/* RELEASE HISTORY */ |
62 | | -/* */ |
63 | | -/* DATE NAME DESCRIPTION */ |
64 | | -/* */ |
| 60 | +/* */ |
| 61 | +/* RELEASE HISTORY */ |
| 62 | +/* */ |
| 63 | +/* DATE NAME DESCRIPTION */ |
| 64 | +/* */ |
65 | 65 | /* 05-19-2020 Chaoqiong Xiao Initial Version 6.0 */ |
66 | 66 | /* 09-30-2020 Chaoqiong Xiao Modified comment(s), */ |
67 | 67 | /* resulting in version 6.1 */ |
|
73 | 73 | /**************************************************************************/ |
74 | 74 | UINT _ux_device_class_hid_deactivate(UX_SLAVE_CLASS_COMMAND *command) |
75 | 75 | { |
76 | | - |
| 76 | + |
77 | 77 | UX_SLAVE_CLASS_HID *hid; |
78 | 78 | UX_SLAVE_CLASS *class_ptr; |
| 79 | +UX_SLAVE_ENDPOINT *endpoint; |
79 | 80 |
|
80 | 81 | /* Get the class container. */ |
81 | 82 | class_ptr = command -> ux_slave_class_command_class_ptr; |
82 | 83 |
|
83 | 84 | /* Get the class instance in the container. */ |
84 | 85 | hid = (UX_SLAVE_CLASS_HID *) class_ptr -> ux_slave_class_instance; |
85 | 86 |
|
86 | | - /* Terminate the transactions pending on the endpoints. */ |
87 | | - _ux_device_stack_transfer_all_request_abort(hid -> ux_device_class_hid_interrupt_endpoint, UX_TRANSFER_BUS_RESET); |
| 87 | + /* Locate the hid interrupt in endpoint. */ |
| 88 | + endpoint = hid -> ux_device_class_hid_interrupt_endpoint; |
| 89 | + |
| 90 | + /* Terminate the transactions pending on the endpoint. */ |
| 91 | + if (endpoint) |
| 92 | + _ux_device_stack_transfer_all_request_abort(endpoint, UX_TRANSFER_BUS_RESET); |
88 | 93 |
|
89 | 94 | #if defined(UX_DEVICE_CLASS_HID_INTERRUPT_OUT_SUPPORT) |
90 | | - _ux_device_stack_transfer_all_request_abort(hid -> ux_device_class_hid_read_endpoint, UX_TRANSFER_BUS_RESET); |
| 95 | + /* Locate the hid interrupt out endpoint. */ |
| 96 | + endpoint = hid -> ux_device_class_hid_read_endpoint; |
| 97 | + |
| 98 | + /* Terminate the transactions pending on the endpoint. */ |
| 99 | + if (endpoint) |
| 100 | + _ux_device_stack_transfer_all_request_abort(endpoint, UX_TRANSFER_BUS_RESET); |
91 | 101 | #endif |
92 | 102 |
|
93 | 103 | /* If there is a deactivate function call it. */ |
|
0 commit comments