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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
138
139
140
146
147
148
149
150
151
153
154
155
156
157
158
159
160
161
162
163
164
165
171
172
173
174
175
176
177
178
179
180
181
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
...
...
...
#define UX_SOURCE_CODE
#include "ux_api.h"
#include "ux_host_class_hid.h"
#include "ux_host_stack.h"
...
...
UINT _ux_host_class_hid_activate(UX_HOST_CLASS_COMMAND *command)
{
UX_INTERFACE *interface;
UX_HOST_CLASS_HID *hid;
UINT status;
/* ... */
interface = (UX_INTERFACE *) command -> ux_host_class_command_container;
hid = _ux_utility_memory_allocate(UX_NO_ALIGN, UX_REGULAR_MEMORY,sizeof(UX_HOST_CLASS_HID));
if (hid == UX_NULL)
return(UX_MEMORY_INSUFFICIENT);
hid -> ux_host_class_hid_class = command -> ux_host_class_command_class_ptr;
hid -> ux_host_class_hid_interface = interface;
hid -> ux_host_class_hid_device = interface -> ux_interface_configuration -> ux_configuration_device;
interface -> ux_interface_class_instance = (VOID *) hid;
_ux_host_stack_class_instance_create(command -> ux_host_class_command_class_ptr, (VOID *) hid);
#if defined(UX_HOST_STANDALONE)
hid -> ux_host_class_hid_class -> ux_host_class_task_function = _ux_host_class_hid_tasks_run;
hid -> ux_host_class_hid_enum_state = UX_STATE_WAIT;
status = UX_SUCCESS;
return(status);/* ... */
#else
status = _ux_host_class_hid_configure(hid);
if (status == UX_SUCCESS)
{
status = _ux_host_class_hid_descriptor_parse(hid);
}if (status == UX_SUCCESS) { ... }
if (status == UX_SUCCESS)
{
status = _ux_host_class_hid_interrupt_endpoint_search(hid);
}if (status == UX_SUCCESS) { ... }
if (status == UX_SUCCESS)
{
/* ... */
status = _ux_host_semaphore_create(&hid -> ux_host_class_hid_semaphore, "ux_host_class_hid_semaphore", 1);
if (status == UX_SUCCESS)
{
_ux_host_class_hid_client_search(hid);
hid -> ux_host_class_hid_state = UX_HOST_CLASS_INSTANCE_LIVE;
if (_ux_system_host -> ux_system_host_change_function != UX_NULL)
{
_ux_system_host -> ux_system_host_change_function(UX_DEVICE_INSERTION, 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_ACTIVATE, hid, 0, 0, 0, UX_TRACE_HOST_CLASS_EVENTS, 0, 0)
UX_TRACE_OBJECT_REGISTER(UX_TRACE_HOST_OBJECT_TYPE_INTERFACE, hid, 0, 0, 0)
return(status);
}if (status == UX_SUCCESS) { ... }
else
{
status = UX_SEMAPHORE_ERROR;
}else { ... }
}if (status == UX_SUCCESS) { ... }
if (hid -> ux_host_class_hid_interrupt_endpoint &&
hid -> ux_host_class_hid_interrupt_endpoint -> ux_endpoint_transfer_request.ux_transfer_request_data_pointer)
_ux_utility_memory_free(hid -> ux_host_class_hid_interrupt_endpoint -> ux_endpoint_transfer_request.ux_transfer_request_data_pointer);
_ux_host_class_hid_instance_clean(hid);
_ux_host_stack_class_instance_destroy(hid -> ux_host_class_hid_class, (VOID *) hid);
interface -> ux_interface_class_instance = UX_NULL;
_ux_utility_memory_free(hid);
return(status);
/* ... */
#endif
}{ ... }