Changeset 8393c73b in mainline for uspace/lib/drv/generic/remote_usbdiag.c
- Timestamp:
- 2018-02-01T16:10:12Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3b5a5e3
- Parents:
- 24c41ba1
- git-author:
- Petr Manek <petr.manek@…> (2018-02-01 16:09:15)
- git-committer:
- Petr Manek <petr.manek@…> (2018-02-01 16:10:12)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/generic/remote_usbdiag.c
r24c41ba1 r8393c73b 43 43 44 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 45 IPC_M_USBDIAG_TEST_IN, 46 IPC_M_USBDIAG_TEST_OUT, 57 47 } usb_iface_funcs_t; 58 48 … … 68 58 } 69 59 70 int usbdiag_ burst_intr_in(async_exch_t *exch, int cycles, size_t size, usbdiag_dur_t *duration)60 int usbdiag_test_in(async_exch_t *exch, const usbdiag_test_params_t *params, usbdiag_test_results_t *results) 71 61 { 72 62 if (!exch) 73 63 return EBADMEM; 74 64 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) 65 ipc_call_t answer; 66 aid_t req = async_send_1(exch, DEV_IFACE_ID(USBDIAG_DEV_IFACE), IPC_M_USBDIAG_TEST_IN, &answer); 67 68 int rc = async_data_write_start(exch, params, sizeof(usbdiag_test_params_t)); 69 if (rc != EOK) { 70 async_exchange_end(exch); 71 async_forget(req); 72 return rc; 73 } 74 75 rc = async_data_read_start(exch, results, sizeof(usbdiag_test_results_t)); 76 if (rc != EOK) { 77 async_exchange_end(exch); 78 async_forget(req); 79 return rc; 80 } 81 82 async_exchange_end(exch); 83 84 sysarg_t retval; 85 async_wait_for(req, &retval); 86 87 return (int) retval; 88 } 89 90 int usbdiag_test_out(async_exch_t *exch, const usbdiag_test_params_t *params, usbdiag_test_results_t *results) 85 91 { 86 92 if (!exch) 87 93 return EBADMEM; 88 94 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 *); 95 ipc_call_t answer; 96 aid_t req = async_send_1(exch, DEV_IFACE_ID(USBDIAG_DEV_IFACE), IPC_M_USBDIAG_TEST_OUT, &answer); 97 98 int rc = async_data_write_start(exch, params, sizeof(usbdiag_test_params_t)); 99 if (rc != EOK) { 100 async_exchange_end(exch); 101 async_forget(req); 102 return rc; 103 } 104 105 rc = async_data_read_start(exch, results, sizeof(usbdiag_test_results_t)); 106 if (rc != EOK) { 107 async_exchange_end(exch); 108 async_forget(req); 109 return rc; 110 } 111 112 async_exchange_end(exch); 113 114 sysarg_t retval; 115 async_wait_for(req, &retval); 116 117 return (int) retval; 118 } 119 120 static void remote_usbdiag_test_in(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); 121 static void remote_usbdiag_test_out(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *); 251 122 252 123 /** Remote USB diagnostic interface operations. */ 253 124 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 125 [IPC_M_USBDIAG_TEST_IN] = remote_usbdiag_test_in, 126 [IPC_M_USBDIAG_TEST_OUT] = remote_usbdiag_test_out 266 127 }; 267 128 … … 272 133 }; 273 134 274 void remote_usbdiag_ burst_intr_in(ddf_fun_t *fun, void *iface, ipc_callid_t callid, ipc_call_t *call)135 void remote_usbdiag_test_in(ddf_fun_t *fun, void *iface, ipc_callid_t callid, ipc_call_t *call) 275 136 { 276 137 const usbdiag_iface_t *diag_iface = (usbdiag_iface_t *) iface; 277 138 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); 139 size_t size; 140 ipc_callid_t data_callid; 141 if (!async_data_write_receive(&data_callid, &size)) { 142 async_answer_0(data_callid, EINVAL); 143 async_answer_0(callid, EINVAL); 144 return; 145 } 146 147 if (size != sizeof(usbdiag_test_params_t)) { 148 async_answer_0(data_callid, EINVAL); 149 async_answer_0(callid, EINVAL); 150 return; 151 } 152 153 usbdiag_test_params_t params; 154 if (async_data_write_finalize(data_callid, ¶ms, size) != EOK) { 155 async_answer_0(callid, EINVAL); 156 return; 157 } 158 159 usbdiag_test_results_t results; 160 const int ret = !diag_iface->test_in ? ENOTSUP : diag_iface->test_in(fun, ¶ms, &results); 287 161 288 162 if (ret != EOK) { 289 163 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) 164 return; 165 } 166 167 if (!async_data_read_receive(&data_callid, &size)) { 168 async_answer_0(data_callid, EINVAL); 169 async_answer_0(callid, EINVAL); 170 return; 171 } 172 173 if (size != sizeof(usbdiag_test_results_t)) { 174 async_answer_0(data_callid, EINVAL); 175 async_answer_0(callid, EINVAL); 176 return; 177 } 178 179 if (async_data_read_finalize(data_callid, &results, size) != EOK) { 180 async_answer_0(callid, EINVAL); 181 return; 182 } 183 184 async_answer_0(callid, ret); 185 } 186 187 void remote_usbdiag_test_out(ddf_fun_t *fun, void *iface, ipc_callid_t callid, ipc_call_t *call) 296 188 { 297 189 const usbdiag_iface_t *diag_iface = (usbdiag_iface_t *) iface; 298 190 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); 191 size_t size; 192 ipc_callid_t data_callid; 193 if (!async_data_write_receive(&data_callid, &size)) { 194 async_answer_0(data_callid, EINVAL); 195 async_answer_0(callid, EINVAL); 196 return; 197 } 198 199 if (size != sizeof(usbdiag_test_params_t)) { 200 async_answer_0(data_callid, EINVAL); 201 async_answer_0(callid, EINVAL); 202 return; 203 } 204 205 usbdiag_test_params_t params; 206 if (async_data_write_finalize(data_callid, ¶ms, size) != EOK) { 207 async_answer_0(callid, EINVAL); 208 return; 209 } 210 211 usbdiag_test_results_t results; 212 const int ret = !diag_iface->test_out ? ENOTSUP : diag_iface->test_out(fun, ¶ms, &results); 308 213 309 214 if (ret != EOK) { 310 215 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 } 216 return; 217 } 218 219 if (!async_data_read_receive(&data_callid, &size)) { 220 async_answer_0(data_callid, EINVAL); 221 async_answer_0(callid, EINVAL); 222 return; 223 } 224 225 if (size != sizeof(usbdiag_test_results_t)) { 226 async_answer_0(data_callid, EINVAL); 227 async_answer_0(callid, EINVAL); 228 return; 229 } 230 231 if (async_data_read_finalize(data_callid, &results, size) != EOK) { 232 async_answer_0(callid, EINVAL); 233 return; 234 } 235 236 async_answer_0(callid, ret); 524 237 } 525 238
Note:
See TracChangeset
for help on using the changeset viewer.