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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
154
155
162
163
164
165
166
167
170
171
172
174
180
181
182
183
184
185
186
187
188
189
190
191
192
193
...
...
...
#define UX_SOURCE_CODE
#include "ux_api.h"
#include "ux_host_class_cdc_acm.h"
#include "ux_host_stack.h"
...
...
UINT _ux_host_class_cdc_acm_deactivate(UX_HOST_CLASS_COMMAND *command)
{
UX_HOST_CLASS_CDC_ACM *cdc_acm;
UX_TRANSFER *transfer_request;
#if !defined(UX_HOST_STANDALONE)
UINT status;
#endif
cdc_acm = (UX_HOST_CLASS_CDC_ACM *) command -> ux_host_class_command_instance;
cdc_acm -> ux_host_class_cdc_acm_state = UX_HOST_CLASS_INSTANCE_SHUTDOWN;
#if !defined(UX_HOST_STANDALONE)
status = _ux_host_semaphore_get(&cdc_acm -> ux_host_class_cdc_acm_semaphore, UX_WAIT_FOREVER);
if (status != UX_SUCCESS)
return(status);/* ... */
#endif
if (cdc_acm -> ux_host_class_cdc_acm_interface -> ux_interface_descriptor.bInterfaceClass == UX_HOST_CLASS_CDC_CONTROL_CLASS)
{
if (cdc_acm -> ux_host_class_cdc_acm_interrupt_endpoint != UX_NULL)
{
transfer_request = &cdc_acm -> ux_host_class_cdc_acm_interrupt_endpoint -> ux_endpoint_transfer_request;
_ux_host_stack_endpoint_transfer_abort(cdc_acm -> ux_host_class_cdc_acm_interrupt_endpoint);
_ux_utility_memory_free(transfer_request -> ux_transfer_request_data_pointer);
}if (cdc_acm -> ux_host_class_cdc_acm_interrupt_endpoint != UX_NULL) { ... }
}if (cdc_acm -> ux_host_class_cdc_acm_interface -> ux_interface_descriptor.bInterfaceClass == UX_HOST_CLASS_CDC_CONTROL_CLASS) { ... }
else
{
/* ... */
transfer_request = &cdc_acm -> ux_host_class_cdc_acm_bulk_in_endpoint -> ux_endpoint_transfer_request;
if (transfer_request -> ux_transfer_request_completion_code == UX_TRANSFER_STATUS_PENDING)
_ux_host_stack_endpoint_transfer_abort(cdc_acm -> ux_host_class_cdc_acm_bulk_in_endpoint);
transfer_request = &cdc_acm -> ux_host_class_cdc_acm_bulk_out_endpoint -> ux_endpoint_transfer_request;
if (transfer_request -> ux_transfer_request_completion_code == UX_TRANSFER_STATUS_PENDING)
_ux_host_stack_endpoint_transfer_abort(cdc_acm -> ux_host_class_cdc_acm_bulk_out_endpoint);
}else { ... }
#if !defined(UX_HOST_STANDALONE)
/* ... */
_ux_host_thread_schedule_other(UX_THREAD_PRIORITY_ENUM); /* ... */
#else
if (cdc_acm -> ux_host_class_cdc_acm_allocated)
{
_ux_utility_memory_free(cdc_acm -> ux_host_class_cdc_acm_allocated);
}if (cdc_acm -> ux_host_class_cdc_acm_allocated) { ... }
/* ... */#endif
_ux_host_stack_class_instance_destroy(cdc_acm -> ux_host_class_cdc_acm_class, (VOID *) cdc_acm);
#if !defined(UX_HOST_STANDALONE)
_ux_host_semaphore_delete(&cdc_acm -> ux_host_class_cdc_acm_semaphore);/* ... */
#endif
/* ... */
if (_ux_system_host -> ux_system_host_change_function != UX_NULL)
{
_ux_system_host -> ux_system_host_change_function(UX_DEVICE_REMOVAL, cdc_acm -> ux_host_class_cdc_acm_class, (VOID *) cdc_acm);
}if (_ux_system_host -> ux_system_host_change_function != UX_NULL) { ... }
_ux_utility_memory_free(cdc_acm);
UX_TRACE_IN_LINE_INSERT(UX_TRACE_HOST_CLASS_CDC_ACM_DEACTIVATE, cdc_acm, 0, 0, 0, UX_TRACE_HOST_CLASS_EVENTS, 0, 0)
UX_TRACE_OBJECT_UNREGISTER(cdc_acm);
return(UX_SUCCESS);
}{ ... }