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
112
114
116
118
120
122
124
126
128
130
132
134
136
138
145
147
149
151
153
155
162
166
167
168
169
170
171
172
173
174
175
180
181
182
183
184
185
186
187
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
...
...
...
#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_command(UX_HOST_CLASS_CDC_ACM *cdc_acm, ULONG command,
ULONG value, UCHAR *data_buffer, ULONG data_length)
{
#if defined(UX_HOST_STANDALONE)
UX_INTERRUPT_SAVE_AREA
UX_DEVICE *device;/* ... */
#endif
UX_ENDPOINT *control_endpoint;
UX_TRANSFER *transfer_request;
UINT status;
ULONG request_direction;
control_endpoint = &cdc_acm -> ux_host_class_cdc_acm_device -> ux_device_control_endpoint;
transfer_request = &control_endpoint -> ux_endpoint_transfer_request;
switch (command)
{
case UX_HOST_CLASS_CDC_ACM_REQ_SEND_ENCAPSULATED_COMMAND :
case UX_HOST_CLASS_CDC_ACM_REQ_SEND_ENCAPSULATED_COMMAND :
case UX_HOST_CLASS_CDC_ACM_REQ_SET_COMM_FEATURE :
case UX_HOST_CLASS_CDC_ACM_REQ_SET_COMM_FEATURE :
case UX_HOST_CLASS_CDC_ACM_REQ_CLEAR_COMM_FEATURE :
case UX_HOST_CLASS_CDC_ACM_REQ_CLEAR_COMM_FEATURE :
case UX_HOST_CLASS_CDC_ACM_REQ_SET_AUX_LINE_STATE :
case UX_HOST_CLASS_CDC_ACM_REQ_SET_AUX_LINE_STATE :
case UX_HOST_CLASS_CDC_ACM_REQ_SET_HOOK_STATE :
case UX_HOST_CLASS_CDC_ACM_REQ_SET_HOOK_STATE :
case UX_HOST_CLASS_CDC_ACM_REQ_PULSE_SETUP :
case UX_HOST_CLASS_CDC_ACM_REQ_PULSE_SETUP :
case UX_HOST_CLASS_CDC_ACM_REQ_SEND_PULSE :
case UX_HOST_CLASS_CDC_ACM_REQ_SEND_PULSE :
case UX_HOST_CLASS_CDC_ACM_REQ_SET_PUSLE_TIME :
case UX_HOST_CLASS_CDC_ACM_REQ_SET_PUSLE_TIME :
case UX_HOST_CLASS_CDC_ACM_REQ_RING_AUX_JACK :
case UX_HOST_CLASS_CDC_ACM_REQ_RING_AUX_JACK :
case UX_HOST_CLASS_CDC_ACM_REQ_SET_LINE_CODING :
case UX_HOST_CLASS_CDC_ACM_REQ_SET_LINE_CODING :
case UX_HOST_CLASS_CDC_ACM_REQ_SET_LINE_STATE :
case UX_HOST_CLASS_CDC_ACM_REQ_SET_LINE_STATE :
case UX_HOST_CLASS_CDC_ACM_REQ_SEND_BREAK :
case UX_HOST_CLASS_CDC_ACM_REQ_SEND_BREAK :
case UX_HOST_CLASS_CDC_ACM_REQ_SET_RINGER_PARMS :
case UX_HOST_CLASS_CDC_ACM_REQ_SET_RINGER_PARMS :
case UX_HOST_CLASS_CDC_ACM_REQ_SET_OPERATION_PARMS :
case UX_HOST_CLASS_CDC_ACM_REQ_SET_OPERATION_PARMS :
case UX_HOST_CLASS_CDC_ACM_REQ_SET_LINE_PARMS :
request_direction = UX_REQUEST_OUT;
break;
case UX_HOST_CLASS_CDC_ACM_REQ_SET_LINE_PARMS :
case UX_HOST_CLASS_CDC_ACM_REQ_GET_ENCAPSULATED_COMMAND :
case UX_HOST_CLASS_CDC_ACM_REQ_GET_ENCAPSULATED_COMMAND :
case UX_HOST_CLASS_CDC_ACM_REQ_GET_COMM_FEATURE :
case UX_HOST_CLASS_CDC_ACM_REQ_GET_COMM_FEATURE :
case UX_HOST_CLASS_CDC_ACM_REQ_GET_LINE_CODING :
case UX_HOST_CLASS_CDC_ACM_REQ_GET_LINE_CODING :
case UX_HOST_CLASS_CDC_ACM_REQ_GET_RINGER_PARMS :
case UX_HOST_CLASS_CDC_ACM_REQ_GET_RINGER_PARMS :
case UX_HOST_CLASS_CDC_ACM_REQ_GET_OPERATION_PARMS :
case UX_HOST_CLASS_CDC_ACM_REQ_GET_OPERATION_PARMS :
case UX_HOST_CLASS_CDC_ACM_REQ_GET_LINE_PARMS :
request_direction = UX_REQUEST_IN;
break;
case UX_HOST_CLASS_CDC_ACM_REQ_GET_LINE_PARMS :
default :
return(UX_ERROR);
default
}switch (command) { ... }
#if defined(UX_HOST_STANDALONE)
device = cdc_acm -> ux_host_class_cdc_acm_device;
UX_DISABLE
if (device -> ux_device_flags & UX_DEVICE_FLAG_LOCK)
{
UX_RESTORE
return(UX_STATE_LOCK);
}if (device -> ux_device_flags & UX_DEVICE_FLAG_LOCK) { ... }
device -> ux_device_flags |= UX_DEVICE_FLAG_LOCK;
transfer_request -> ux_transfer_request_flags |= UX_TRANSFER_FLAG_AUTO_DEVICE_UNLOCK;
UX_RESTORE/* ... */
#else
/* ... */
status = _ux_host_semaphore_get(&cdc_acm -> ux_host_class_cdc_acm_device -> ux_device_protection_semaphore, UX_WAIT_FOREVER);
if (status != UX_SUCCESS)
return(status);/* ... */
#endif
transfer_request -> ux_transfer_request_data_pointer = data_buffer;
transfer_request -> ux_transfer_request_requested_length = data_length;
transfer_request -> ux_transfer_request_function = command;
transfer_request -> ux_transfer_request_type = request_direction | UX_REQUEST_TYPE_CLASS | UX_REQUEST_TARGET_INTERFACE;
transfer_request -> ux_transfer_request_value = value;
transfer_request -> ux_transfer_request_index = cdc_acm -> ux_host_class_cdc_acm_interface -> ux_interface_descriptor.bInterfaceNumber;
status = _ux_host_stack_transfer_request(transfer_request);
return(status);
}{ ... }