1 | /*
|
---|
2 | * Copyright (c) 2017 Petr Manek
|
---|
3 | * All rights reserved.
|
---|
4 | *
|
---|
5 | * Redistribution and use in source and binary forms, with or without
|
---|
6 | * modification, are permitted provided that the following conditions
|
---|
7 | * are met:
|
---|
8 | *
|
---|
9 | * - Redistributions of source code must retain the above copyright
|
---|
10 | * notice, this list of conditions and the following disclaimer.
|
---|
11 | * - Redistributions in binary form must reproduce the above copyright
|
---|
12 | * notice, this list of conditions and the following disclaimer in the
|
---|
13 | * documentation and/or other materials provided with the distribution.
|
---|
14 | * - The name of the author may not be used to endorse or promote products
|
---|
15 | * derived from this software without specific prior written permission.
|
---|
16 | *
|
---|
17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
27 | */
|
---|
28 |
|
---|
29 | /** @addtogroup libdrv
|
---|
30 | * @{
|
---|
31 | */
|
---|
32 | /** @file
|
---|
33 | * USB diagnostic device remote interface.
|
---|
34 | */
|
---|
35 |
|
---|
36 | #include <async.h>
|
---|
37 | #include <assert.h>
|
---|
38 | #include <macros.h>
|
---|
39 | #include <errno.h>
|
---|
40 | #include <devman.h>
|
---|
41 |
|
---|
42 | #include "usbdiag_iface.h"
|
---|
43 |
|
---|
44 | typedef enum {
|
---|
45 | IPC_M_USBDIAG_BURST_INTR_IN,
|
---|
46 | IPC_M_USBDIAG_BURST_INTR_OUT,
|
---|
47 | IPC_M_USBDIAG_BURST_BULK_IN,
|
---|
48 | IPC_M_USBDIAG_BURST_BULK_OUT,
|
---|
49 | IPC_M_USBDIAG_BURST_ISOCH_IN,
|
---|
50 | IPC_M_USBDIAG_BURST_ISOCH_OUT,
|
---|
51 | IPC_M_USBDIAG_DATA_INTR_IN,
|
---|
52 | IPC_M_USBDIAG_DATA_INTR_OUT,
|
---|
53 | IPC_M_USBDIAG_DATA_BULK_IN,
|
---|
54 | IPC_M_USBDIAG_DATA_BULK_OUT,
|
---|
55 | IPC_M_USBDIAG_DATA_ISOCH_IN,
|
---|
56 | IPC_M_USBDIAG_DATA_ISOCH_OUT
|
---|
57 | } usb_iface_funcs_t;
|
---|
58 |
|
---|
59 | async_sess_t *usbdiag_connect(devman_handle_t handle)
|
---|
60 | {
|
---|
61 | return devman_device_connect(handle, IPC_FLAG_BLOCKING);
|
---|
62 | }
|
---|
63 |
|
---|
64 | void usbdiag_disconnect(async_sess_t *sess)
|
---|
65 | {
|
---|
66 | if (sess)
|
---|
67 | async_hangup(sess);
|
---|
68 | }
|
---|
69 |
|
---|
70 | int usbdiag_burst_intr_in(async_exch_t *exch, int cycles, size_t size, usbdiag_dur_t *duration)
|
---|
71 | {
|
---|
72 | if (!exch)
|
---|
73 | return EBADMEM;
|
---|
74 |
|
---|
75 | sysarg_t duration_;
|
---|
76 | const int rc = async_req_3_1(exch, DEV_IFACE_ID(USBDIAG_DEV_IFACE), IPC_M_USBDIAG_BURST_INTR_IN, cycles, size, &duration_);
|
---|
77 |
|
---|
78 | if (rc == EOK && duration)
|
---|
79 | *duration = duration_;
|
---|
80 |
|
---|
81 | return rc;
|
---|
82 | }
|
---|
83 |
|
---|
84 | int usbdiag_burst_intr_out(async_exch_t *exch, int cycles, size_t size, usbdiag_dur_t *duration)
|
---|
85 | {
|
---|
86 | if (!exch)
|
---|
87 | return EBADMEM;
|
---|
88 |
|
---|
89 | sysarg_t duration_;
|
---|
90 | const int rc = async_req_3_1(exch, DEV_IFACE_ID(USBDIAG_DEV_IFACE), IPC_M_USBDIAG_BURST_INTR_OUT, cycles, size, &duration_);
|
---|
91 |
|
---|
92 | if (rc == EOK && duration)
|
---|
93 | *duration = duration_;
|
---|
94 |
|
---|
95 | return rc;
|
---|
96 | }
|
---|
97 |
|
---|
98 | int usbdiag_burst_bulk_in(async_exch_t *exch, int cycles, size_t size, usbdiag_dur_t *duration)
|
---|
99 | {
|
---|
100 | if (!exch)
|
---|
101 | return EBADMEM;
|
---|
102 |
|
---|
103 | sysarg_t duration_;
|
---|
104 | const int rc = async_req_3_1(exch, DEV_IFACE_ID(USBDIAG_DEV_IFACE), IPC_M_USBDIAG_BURST_BULK_IN, cycles, size, &duration_);
|
---|
105 |
|
---|
106 | if (rc == EOK && duration)
|
---|
107 | *duration = duration_;
|
---|
108 |
|
---|
109 | return rc;
|
---|
110 | }
|
---|
111 |
|
---|
112 | int usbdiag_burst_bulk_out(async_exch_t *exch, int cycles, size_t size, usbdiag_dur_t *duration)
|
---|
113 | {
|
---|
114 | if (!exch)
|
---|
115 | return EBADMEM;
|
---|
116 |
|
---|
117 | sysarg_t duration_;
|
---|
118 | const int rc = async_req_3_1(exch, DEV_IFACE_ID(USBDIAG_DEV_IFACE), IPC_M_USBDIAG_BURST_BULK_OUT, cycles, size, &duration_);
|
---|
119 |
|
---|
120 | if (rc == EOK && duration)
|
---|
121 | *duration = duration_;
|
---|
122 |
|
---|
123 | return rc;
|
---|
124 | }
|
---|
125 |
|
---|
126 | int usbdiag_burst_isoch_in(async_exch_t *exch, int cycles, size_t size, usbdiag_dur_t *duration)
|
---|
127 | {
|
---|
128 | if (!exch)
|
---|
129 | return EBADMEM;
|
---|
130 |
|
---|
131 | sysarg_t duration_;
|
---|
132 | const int rc = async_req_3_1(exch, DEV_IFACE_ID(USBDIAG_DEV_IFACE), IPC_M_USBDIAG_BURST_ISOCH_IN, cycles, size, &duration_);
|
---|
133 |
|
---|
134 | if (rc == EOK && duration)
|
---|
135 | *duration = duration_;
|
---|
136 |
|
---|
137 | return rc;
|
---|
138 | }
|
---|
139 |
|
---|
140 | int usbdiag_burst_isoch_out(async_exch_t *exch, int cycles, size_t size, usbdiag_dur_t *duration)
|
---|
141 | {
|
---|
142 | if (!exch)
|
---|
143 | return EBADMEM;
|
---|
144 |
|
---|
145 | sysarg_t duration_;
|
---|
146 | const int rc = async_req_3_1(exch, DEV_IFACE_ID(USBDIAG_DEV_IFACE), IPC_M_USBDIAG_BURST_ISOCH_OUT, cycles, size, &duration_);
|
---|
147 |
|
---|
148 | if (rc == EOK && duration)
|
---|
149 | *duration = duration_;
|
---|
150 |
|
---|
151 | return rc;
|
---|
152 | }
|
---|
153 |
|
---|
154 | int usbdiag_data_intr_in(async_exch_t *exch, int cycles, size_t size, usbdiag_dur_t *duration)
|
---|
155 | {
|
---|
156 | if (!exch)
|
---|
157 | return EBADMEM;
|
---|
158 |
|
---|
159 | sysarg_t duration_;
|
---|
160 | const int rc = async_req_3_1(exch, DEV_IFACE_ID(USBDIAG_DEV_IFACE), IPC_M_USBDIAG_DATA_INTR_IN, cycles, size, &duration_);
|
---|
161 |
|
---|
162 | if (rc == EOK && duration)
|
---|
163 | *duration = duration_;
|
---|
164 |
|
---|
165 | return rc;
|
---|
166 | }
|
---|
167 |
|
---|
168 | int usbdiag_data_intr_out(async_exch_t *exch, int cycles, size_t size, usbdiag_dur_t *duration)
|
---|
169 | {
|
---|
170 | if (!exch)
|
---|
171 | return EBADMEM;
|
---|
172 |
|
---|
173 | sysarg_t duration_;
|
---|
174 | const int rc = async_req_3_1(exch, DEV_IFACE_ID(USBDIAG_DEV_IFACE), IPC_M_USBDIAG_DATA_INTR_OUT, cycles, size, &duration_);
|
---|
175 |
|
---|
176 | if (rc == EOK && duration)
|
---|
177 | *duration = duration_;
|
---|
178 |
|
---|
179 | return rc;
|
---|
180 | }
|
---|
181 |
|
---|
182 | int usbdiag_data_bulk_in(async_exch_t *exch, int cycles, size_t size, usbdiag_dur_t *duration)
|
---|
183 | {
|
---|
184 | if (!exch)
|
---|
185 | return EBADMEM;
|
---|
186 |
|
---|
187 | sysarg_t duration_;
|
---|
188 | const int rc = async_req_3_1(exch, DEV_IFACE_ID(USBDIAG_DEV_IFACE), IPC_M_USBDIAG_DATA_BULK_IN, cycles, size, &duration_);
|
---|
189 |
|
---|
190 | if (rc == EOK && duration)
|
---|
191 | *duration = duration_;
|
---|
192 |
|
---|
193 | return rc;
|
---|
194 | }
|
---|
195 |
|
---|
196 | int usbdiag_data_bulk_out(async_exch_t *exch, int cycles, size_t size, usbdiag_dur_t *duration)
|
---|
197 | {
|
---|
198 | if (!exch)
|
---|
199 | return EBADMEM;
|
---|
200 |
|
---|
201 | sysarg_t duration_;
|
---|
202 | const int rc = async_req_3_1(exch, DEV_IFACE_ID(USBDIAG_DEV_IFACE), IPC_M_USBDIAG_DATA_BULK_OUT, cycles, size, &duration_);
|
---|
203 |
|
---|
204 | if (rc == EOK && duration)
|
---|
205 | *duration = duration_;
|
---|
206 |
|
---|
207 | return rc;
|
---|
208 | }
|
---|
209 |
|
---|
210 | int usbdiag_data_isoch_in(async_exch_t *exch, int cycles, size_t size, usbdiag_dur_t *duration)
|
---|
211 | {
|
---|
212 | if (!exch)
|
---|
213 | return EBADMEM;
|
---|
214 |
|
---|
215 | sysarg_t duration_;
|
---|
216 | const int rc = async_req_3_1(exch, DEV_IFACE_ID(USBDIAG_DEV_IFACE), IPC_M_USBDIAG_DATA_ISOCH_IN, cycles, size, &duration_);
|
---|
217 |
|
---|
218 | if (rc == EOK && duration)
|
---|
219 | *duration = duration_;
|
---|
220 |
|
---|
221 | return rc;
|
---|
222 | }
|
---|
223 |
|
---|
224 | int usbdiag_data_isoch_out(async_exch_t *exch, int cycles, size_t size, usbdiag_dur_t *duration)
|
---|
225 | {
|
---|
226 | if (!exch)
|
---|
227 | return EBADMEM;
|
---|
228 |
|
---|
229 | sysarg_t duration_;
|
---|
230 | const int rc = async_req_3_1(exch, DEV_IFACE_ID(USBDIAG_DEV_IFACE), IPC_M_USBDIAG_DATA_ISOCH_OUT, cycles, size, &duration_);
|
---|
231 |
|
---|
232 | if (rc == EOK && duration)
|
---|
233 | *duration = duration_;
|
---|
234 |
|
---|
235 | return rc;
|
---|
236 | }
|
---|
237 |
|
---|
238 | static void remote_usbdiag_burst_intr_in(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
|
---|
239 | static void remote_usbdiag_burst_intr_out(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
|
---|
240 | static void remote_usbdiag_burst_bulk_in(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
|
---|
241 | static void remote_usbdiag_burst_bulk_out(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
|
---|
242 | static void remote_usbdiag_burst_isoch_in(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
|
---|
243 | static void remote_usbdiag_burst_isoch_out(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
|
---|
244 |
|
---|
245 | static void remote_usbdiag_data_intr_in(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
|
---|
246 | static void remote_usbdiag_data_intr_out(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
|
---|
247 | static void remote_usbdiag_data_bulk_in(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
|
---|
248 | static void remote_usbdiag_data_bulk_out(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
|
---|
249 | static void remote_usbdiag_data_isoch_in(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
|
---|
250 | static void remote_usbdiag_data_isoch_out(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
|
---|
251 |
|
---|
252 | /** Remote USB diagnostic interface operations. */
|
---|
253 | static const remote_iface_func_ptr_t remote_usbdiag_iface_ops [] = {
|
---|
254 | [IPC_M_USBDIAG_BURST_INTR_IN] = remote_usbdiag_burst_intr_in,
|
---|
255 | [IPC_M_USBDIAG_BURST_INTR_OUT] = remote_usbdiag_burst_intr_out,
|
---|
256 | [IPC_M_USBDIAG_BURST_BULK_IN] = remote_usbdiag_burst_bulk_in,
|
---|
257 | [IPC_M_USBDIAG_BURST_BULK_OUT] = remote_usbdiag_burst_bulk_out,
|
---|
258 | [IPC_M_USBDIAG_BURST_ISOCH_IN] = remote_usbdiag_burst_isoch_in,
|
---|
259 | [IPC_M_USBDIAG_BURST_ISOCH_OUT] = remote_usbdiag_burst_isoch_out,
|
---|
260 | [IPC_M_USBDIAG_DATA_INTR_IN] = remote_usbdiag_data_intr_in,
|
---|
261 | [IPC_M_USBDIAG_DATA_INTR_OUT] = remote_usbdiag_data_intr_out,
|
---|
262 | [IPC_M_USBDIAG_DATA_BULK_IN] = remote_usbdiag_data_bulk_in,
|
---|
263 | [IPC_M_USBDIAG_DATA_BULK_OUT] = remote_usbdiag_data_bulk_out,
|
---|
264 | [IPC_M_USBDIAG_DATA_ISOCH_IN] = remote_usbdiag_data_isoch_in,
|
---|
265 | [IPC_M_USBDIAG_DATA_ISOCH_OUT] = remote_usbdiag_data_isoch_out
|
---|
266 | };
|
---|
267 |
|
---|
268 | /** Remote USB diagnostic interface structure. */
|
---|
269 | const remote_iface_t remote_usbdiag_iface = {
|
---|
270 | .method_count = ARRAY_SIZE(remote_usbdiag_iface_ops),
|
---|
271 | .methods = remote_usbdiag_iface_ops,
|
---|
272 | };
|
---|
273 |
|
---|
274 | void remote_usbdiag_burst_intr_in(ddf_fun_t *fun, void *iface, ipc_callid_t callid, ipc_call_t *call)
|
---|
275 | {
|
---|
276 | const usbdiag_iface_t *diag_iface = (usbdiag_iface_t *) iface;
|
---|
277 |
|
---|
278 | if (diag_iface->burst_bulk_in == NULL) {
|
---|
279 | async_answer_0(callid, ENOTSUP);
|
---|
280 | return;
|
---|
281 | }
|
---|
282 |
|
---|
283 | int cycles = DEV_IPC_GET_ARG1(*call);
|
---|
284 | size_t size = DEV_IPC_GET_ARG2(*call);
|
---|
285 | usbdiag_dur_t duration;
|
---|
286 | const int ret = diag_iface->burst_intr_in(fun, cycles, size, &duration);
|
---|
287 |
|
---|
288 | if (ret != EOK) {
|
---|
289 | async_answer_0(callid, ret);
|
---|
290 | } else {
|
---|
291 | async_answer_1(callid, EOK, duration);
|
---|
292 | }
|
---|
293 | }
|
---|
294 |
|
---|
295 | void remote_usbdiag_burst_intr_out(ddf_fun_t *fun, void *iface, ipc_callid_t callid, ipc_call_t *call)
|
---|
296 | {
|
---|
297 | const usbdiag_iface_t *diag_iface = (usbdiag_iface_t *) iface;
|
---|
298 |
|
---|
299 | if (diag_iface->burst_bulk_out == NULL) {
|
---|
300 | async_answer_0(callid, ENOTSUP);
|
---|
301 | return;
|
---|
302 | }
|
---|
303 |
|
---|
304 | int cycles = DEV_IPC_GET_ARG1(*call);
|
---|
305 | size_t size = DEV_IPC_GET_ARG2(*call);
|
---|
306 | usbdiag_dur_t duration;
|
---|
307 | const int ret = diag_iface->burst_intr_out(fun, cycles, size, &duration);
|
---|
308 |
|
---|
309 | if (ret != EOK) {
|
---|
310 | async_answer_0(callid, ret);
|
---|
311 | } else {
|
---|
312 | async_answer_1(callid, EOK, duration);
|
---|
313 | }
|
---|
314 | }
|
---|
315 |
|
---|
316 | void remote_usbdiag_burst_bulk_in(ddf_fun_t *fun, void *iface, ipc_callid_t callid, ipc_call_t *call)
|
---|
317 | {
|
---|
318 | const usbdiag_iface_t *diag_iface = (usbdiag_iface_t *) iface;
|
---|
319 |
|
---|
320 | if (diag_iface->burst_bulk_in == NULL) {
|
---|
321 | async_answer_0(callid, ENOTSUP);
|
---|
322 | return;
|
---|
323 | }
|
---|
324 |
|
---|
325 | int cycles = DEV_IPC_GET_ARG1(*call);
|
---|
326 | size_t size = DEV_IPC_GET_ARG2(*call);
|
---|
327 | usbdiag_dur_t duration;
|
---|
328 | const int ret = diag_iface->burst_bulk_in(fun, cycles, size, &duration);
|
---|
329 |
|
---|
330 | if (ret != EOK) {
|
---|
331 | async_answer_0(callid, ret);
|
---|
332 | } else {
|
---|
333 | async_answer_1(callid, EOK, duration);
|
---|
334 | }
|
---|
335 | }
|
---|
336 |
|
---|
337 | void remote_usbdiag_burst_bulk_out(ddf_fun_t *fun, void *iface, ipc_callid_t callid, ipc_call_t *call)
|
---|
338 | {
|
---|
339 | const usbdiag_iface_t *diag_iface = (usbdiag_iface_t *) iface;
|
---|
340 |
|
---|
341 | if (diag_iface->burst_bulk_out == NULL) {
|
---|
342 | async_answer_0(callid, ENOTSUP);
|
---|
343 | return;
|
---|
344 | }
|
---|
345 |
|
---|
346 | int cycles = DEV_IPC_GET_ARG1(*call);
|
---|
347 | size_t size = DEV_IPC_GET_ARG2(*call);
|
---|
348 | usbdiag_dur_t duration;
|
---|
349 | const int ret = diag_iface->burst_bulk_out(fun, cycles, size, &duration);
|
---|
350 |
|
---|
351 | if (ret != EOK) {
|
---|
352 | async_answer_0(callid, ret);
|
---|
353 | } else {
|
---|
354 | async_answer_1(callid, EOK, duration);
|
---|
355 | }
|
---|
356 | }
|
---|
357 |
|
---|
358 | void remote_usbdiag_burst_isoch_in(ddf_fun_t *fun, void *iface, ipc_callid_t callid, ipc_call_t *call)
|
---|
359 | {
|
---|
360 | const usbdiag_iface_t *diag_iface = (usbdiag_iface_t *) iface;
|
---|
361 |
|
---|
362 | if (diag_iface->burst_isoch_in == NULL) {
|
---|
363 | async_answer_0(callid, ENOTSUP);
|
---|
364 | return;
|
---|
365 | }
|
---|
366 |
|
---|
367 | int cycles = DEV_IPC_GET_ARG1(*call);
|
---|
368 | size_t size = DEV_IPC_GET_ARG2(*call);
|
---|
369 | usbdiag_dur_t duration;
|
---|
370 | const int ret = diag_iface->burst_isoch_in(fun, cycles, size, &duration);
|
---|
371 |
|
---|
372 | if (ret != EOK) {
|
---|
373 | async_answer_0(callid, ret);
|
---|
374 | } else {
|
---|
375 | async_answer_1(callid, EOK, duration);
|
---|
376 | }
|
---|
377 | }
|
---|
378 |
|
---|
379 | void remote_usbdiag_burst_isoch_out(ddf_fun_t *fun, void *iface, ipc_callid_t callid, ipc_call_t *call)
|
---|
380 | {
|
---|
381 | const usbdiag_iface_t *diag_iface = (usbdiag_iface_t *) iface;
|
---|
382 |
|
---|
383 | if (diag_iface->burst_isoch_out == NULL) {
|
---|
384 | async_answer_0(callid, ENOTSUP);
|
---|
385 | return;
|
---|
386 | }
|
---|
387 |
|
---|
388 | int cycles = DEV_IPC_GET_ARG1(*call);
|
---|
389 | size_t size = DEV_IPC_GET_ARG2(*call);
|
---|
390 | usbdiag_dur_t duration;
|
---|
391 | const int ret = diag_iface->burst_isoch_out(fun, cycles, size, &duration);
|
---|
392 |
|
---|
393 | if (ret != EOK) {
|
---|
394 | async_answer_0(callid, ret);
|
---|
395 | } else {
|
---|
396 | async_answer_1(callid, EOK, duration);
|
---|
397 | }
|
---|
398 | }
|
---|
399 |
|
---|
400 | void remote_usbdiag_data_intr_in(ddf_fun_t *fun, void *iface, ipc_callid_t callid, ipc_call_t *call)
|
---|
401 | {
|
---|
402 | const usbdiag_iface_t *diag_iface = (usbdiag_iface_t *) iface;
|
---|
403 |
|
---|
404 | if (diag_iface->data_bulk_in == NULL) {
|
---|
405 | async_answer_0(callid, ENOTSUP);
|
---|
406 | return;
|
---|
407 | }
|
---|
408 |
|
---|
409 | int cycles = DEV_IPC_GET_ARG1(*call);
|
---|
410 | size_t size = DEV_IPC_GET_ARG2(*call);
|
---|
411 | usbdiag_dur_t duration;
|
---|
412 | const int ret = diag_iface->data_intr_in(fun, cycles, size, &duration);
|
---|
413 |
|
---|
414 | if (ret != EOK) {
|
---|
415 | async_answer_0(callid, ret);
|
---|
416 | } else {
|
---|
417 | async_answer_1(callid, EOK, duration);
|
---|
418 | }
|
---|
419 | }
|
---|
420 |
|
---|
421 | void remote_usbdiag_data_intr_out(ddf_fun_t *fun, void *iface, ipc_callid_t callid, ipc_call_t *call)
|
---|
422 | {
|
---|
423 | const usbdiag_iface_t *diag_iface = (usbdiag_iface_t *) iface;
|
---|
424 |
|
---|
425 | if (diag_iface->data_bulk_out == NULL) {
|
---|
426 | async_answer_0(callid, ENOTSUP);
|
---|
427 | return;
|
---|
428 | }
|
---|
429 |
|
---|
430 | int cycles = DEV_IPC_GET_ARG1(*call);
|
---|
431 | size_t size = DEV_IPC_GET_ARG2(*call);
|
---|
432 | usbdiag_dur_t duration;
|
---|
433 | const int ret = diag_iface->data_intr_out(fun, cycles, size, &duration);
|
---|
434 |
|
---|
435 | if (ret != EOK) {
|
---|
436 | async_answer_0(callid, ret);
|
---|
437 | } else {
|
---|
438 | async_answer_1(callid, EOK, duration);
|
---|
439 | }
|
---|
440 | }
|
---|
441 |
|
---|
442 | void remote_usbdiag_data_bulk_in(ddf_fun_t *fun, void *iface, ipc_callid_t callid, ipc_call_t *call)
|
---|
443 | {
|
---|
444 | const usbdiag_iface_t *diag_iface = (usbdiag_iface_t *) iface;
|
---|
445 |
|
---|
446 | if (diag_iface->data_bulk_in == NULL) {
|
---|
447 | async_answer_0(callid, ENOTSUP);
|
---|
448 | return;
|
---|
449 | }
|
---|
450 |
|
---|
451 | int cycles = DEV_IPC_GET_ARG1(*call);
|
---|
452 | size_t size = DEV_IPC_GET_ARG2(*call);
|
---|
453 | usbdiag_dur_t duration;
|
---|
454 | const int ret = diag_iface->data_bulk_in(fun, cycles, size, &duration);
|
---|
455 |
|
---|
456 | if (ret != EOK) {
|
---|
457 | async_answer_0(callid, ret);
|
---|
458 | } else {
|
---|
459 | async_answer_1(callid, EOK, duration);
|
---|
460 | }
|
---|
461 | }
|
---|
462 |
|
---|
463 | void remote_usbdiag_data_bulk_out(ddf_fun_t *fun, void *iface, ipc_callid_t callid, ipc_call_t *call)
|
---|
464 | {
|
---|
465 | const usbdiag_iface_t *diag_iface = (usbdiag_iface_t *) iface;
|
---|
466 |
|
---|
467 | if (diag_iface->data_bulk_out == NULL) {
|
---|
468 | async_answer_0(callid, ENOTSUP);
|
---|
469 | return;
|
---|
470 | }
|
---|
471 |
|
---|
472 | int cycles = DEV_IPC_GET_ARG1(*call);
|
---|
473 | size_t size = DEV_IPC_GET_ARG2(*call);
|
---|
474 | usbdiag_dur_t duration;
|
---|
475 | const int ret = diag_iface->data_bulk_out(fun, cycles, size, &duration);
|
---|
476 |
|
---|
477 | if (ret != EOK) {
|
---|
478 | async_answer_0(callid, ret);
|
---|
479 | } else {
|
---|
480 | async_answer_1(callid, EOK, duration);
|
---|
481 | }
|
---|
482 | }
|
---|
483 |
|
---|
484 | void remote_usbdiag_data_isoch_in(ddf_fun_t *fun, void *iface, ipc_callid_t callid, ipc_call_t *call)
|
---|
485 | {
|
---|
486 | const usbdiag_iface_t *diag_iface = (usbdiag_iface_t *) iface;
|
---|
487 |
|
---|
488 | if (diag_iface->data_isoch_in == NULL) {
|
---|
489 | async_answer_0(callid, ENOTSUP);
|
---|
490 | return;
|
---|
491 | }
|
---|
492 |
|
---|
493 | int cycles = DEV_IPC_GET_ARG1(*call);
|
---|
494 | size_t size = DEV_IPC_GET_ARG2(*call);
|
---|
495 | usbdiag_dur_t duration;
|
---|
496 | const int ret = diag_iface->data_isoch_in(fun, cycles, size, &duration);
|
---|
497 |
|
---|
498 | if (ret != EOK) {
|
---|
499 | async_answer_0(callid, ret);
|
---|
500 | } else {
|
---|
501 | async_answer_1(callid, EOK, duration);
|
---|
502 | }
|
---|
503 | }
|
---|
504 |
|
---|
505 | void remote_usbdiag_data_isoch_out(ddf_fun_t *fun, void *iface, ipc_callid_t callid, ipc_call_t *call)
|
---|
506 | {
|
---|
507 | const usbdiag_iface_t *diag_iface = (usbdiag_iface_t *) iface;
|
---|
508 |
|
---|
509 | if (diag_iface->data_isoch_out == NULL) {
|
---|
510 | async_answer_0(callid, ENOTSUP);
|
---|
511 | return;
|
---|
512 | }
|
---|
513 |
|
---|
514 | int cycles = DEV_IPC_GET_ARG1(*call);
|
---|
515 | size_t size = DEV_IPC_GET_ARG2(*call);
|
---|
516 | usbdiag_dur_t duration;
|
---|
517 | const int ret = diag_iface->data_isoch_out(fun, cycles, size, &duration);
|
---|
518 |
|
---|
519 | if (ret != EOK) {
|
---|
520 | async_answer_0(callid, ret);
|
---|
521 | } else {
|
---|
522 | async_answer_1(callid, EOK, duration);
|
---|
523 | }
|
---|
524 | }
|
---|
525 |
|
---|
526 | /**
|
---|
527 | * @}
|
---|
528 | */
|
---|