1
10
13
14
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
110
111
112
113
114
115
116
117
118
119
120
122
123
124
125
126
127
128
129
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
147
148
149
150
151
152
153
154
155
157
163
164
165
166
167
168
169
170
171
172
173
174
175
176
...
...
...
#define UX_SOURCE_CODE
#include "ux_api.h"
#include "ux_host_class_hid.h"
#include "ux_host_stack.h"
...
...
UINT _ux_host_class_hid_deactivate(UX_HOST_CLASS_COMMAND *command)
{
UX_HOST_CLASS_HID *hid;
UX_HOST_CLASS_HID_CLIENT_COMMAND hid_client_command;
UX_TRANSFER *transfer_request;
#if !defined(UX_HOST_STANDALONE)
UINT status;
#endif
hid = (UX_HOST_CLASS_HID *) command -> ux_host_class_command_instance;
hid -> ux_host_class_hid_state = UX_HOST_CLASS_INSTANCE_SHUTDOWN;
#if !defined(UX_HOST_STANDALONE)
status = _ux_host_semaphore_get(&hid -> ux_host_class_hid_semaphore, UX_WAIT_FOREVER);
if (status != UX_SUCCESS)
return(status);/* ... */
#endif
#if defined(UX_HOST_STANDALONE)
if (hid -> ux_host_class_hid_interrupt_endpoint)
#endif
{
_ux_host_stack_endpoint_transfer_abort(hid -> ux_host_class_hid_interrupt_endpoint);
/* ... */
transfer_request = &hid -> ux_host_class_hid_interrupt_endpoint -> ux_endpoint_transfer_request;
_ux_utility_memory_free(transfer_request -> ux_transfer_request_data_pointer);
...}
#if defined(UX_HOST_STANDALONE)
if (hid -> ux_host_class_hid_allocated)
_ux_utility_memory_free(hid -> ux_host_class_hid_allocated);/* ... */
#endif
hid_client_command.ux_host_class_hid_client_command_instance = (VOID *) hid;
hid_client_command.ux_host_class_hid_client_command_container = (VOID *) hid -> ux_host_class_hid_class;
hid_client_command.ux_host_class_hid_client_command_request = UX_HOST_CLASS_COMMAND_DEACTIVATE;
if (hid -> ux_host_class_hid_client != UX_NULL)
hid -> ux_host_class_hid_client -> ux_host_class_hid_client_handler(&hid_client_command);
_ux_host_class_hid_instance_clean(hid);
/* ... */
_ux_host_thread_schedule_other(UX_THREAD_PRIORITY_ENUM);
_ux_host_stack_class_instance_destroy(hid -> ux_host_class_hid_class, (VOID *) hid);
_ux_host_semaphore_delete(&hid -> ux_host_class_hid_semaphore);
/* ... */
if (_ux_system_host -> ux_system_host_change_function != UX_NULL)
{
_ux_system_host -> ux_system_host_change_function(UX_DEVICE_REMOVAL, hid -> ux_host_class_hid_class, (VOID *) hid);
}if (_ux_system_host -> ux_system_host_change_function != UX_NULL) { ... }
UX_TRACE_IN_LINE_INSERT(UX_TRACE_HOST_CLASS_HID_DEACTIVATE, hid, 0, 0, 0, UX_TRACE_HOST_CLASS_EVENTS, 0, 0)
UX_TRACE_OBJECT_UNREGISTER(hid);
_ux_utility_memory_free(hid);
return(UX_SUCCESS);
}{ ... }