Changeset bdd8ad2f in mainline
- Timestamp:
- 2011-09-14T20:15:03Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- bbce2c2
- Parents:
- 365e29e2
- Location:
- uspace/lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/generic/remote_usbhc.c
r365e29e2 rbdd8ad2f 230 230 ipc_callid_t callid, ipc_call_t *call) 231 231 { 232 assert(false); 232 233 usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface; 233 234 assert(usb_iface != NULL); … … 291 292 ipc_callid_t callid, ipc_call_t *call) 292 293 { 294 assert(false); 293 295 usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface; 294 296 assert(usb_iface != NULL); … … 388 390 #undef _INIT_FROM_LOW_DATA3 389 391 390 int rc = usb_iface->register_endpoint(fun, target.address, 391 speed, target.endpoint, 392 transfer_type, direction, max_packet_size, interval); 392 int rc = usb_iface->register_endpoint(fun, target.address, speed, 393 target.endpoint, transfer_type, direction, max_packet_size, interval); 393 394 394 395 async_answer_0(callid, rc); … … 431 432 432 433 const usb_target_t target = { .packed = DEV_IPC_GET_ARG1(*call) }; 434 const uint64_t setup = 435 ((uint64_t)DEV_IPC_GET_ARG2(*call)) | 436 (((uint64_t)DEV_IPC_GET_ARG3(*call)) << 32); 433 437 434 438 async_transaction_t *trans = async_transaction_create(callid); … … 451 455 452 456 const int rc = hc_iface->read( 453 fun, target, 0, trans->buffer, trans->size, callback_in, trans);457 fun, target, setup, trans->buffer, trans->size, callback_in, trans); 454 458 455 459 if (rc != EOK) { … … 475 479 476 480 const usb_target_t target = { .packed = DEV_IPC_GET_ARG1(*call) }; 481 const size_t data_buffer_len = DEV_IPC_GET_ARG2(*call); 482 const uint64_t setup = 483 ((uint64_t)DEV_IPC_GET_ARG3(*call)) | 484 (((uint64_t)DEV_IPC_GET_ARG4(*call)) << 32); 477 485 478 486 async_transaction_t *trans = async_transaction_create(callid); … … 482 490 } 483 491 484 int rc = async_data_write_accept(&trans->buffer, false, 485 1, USB_MAX_PAYLOAD_SIZE, 486 0, &trans->size); 487 488 if (rc != EOK) { 489 async_answer_0(callid, rc); 490 async_transaction_destroy(trans); 491 return; 492 } 493 494 rc = hc_iface->write( 495 fun, target, 0, trans->buffer, trans->size, callback_out, trans); 492 if (data_buffer_len > 0) { 493 int rc = async_data_write_accept(&trans->buffer, false, 494 1, USB_MAX_PAYLOAD_SIZE, 495 0, &trans->size); 496 497 if (rc != EOK) { 498 async_answer_0(callid, rc); 499 async_transaction_destroy(trans); 500 return; 501 } 502 } 503 504 int rc = hc_iface->write( 505 fun, target, setup, trans->buffer, trans->size, callback_out, trans); 496 506 497 507 if (rc != EOK) { -
uspace/lib/usbdev/src/pipesio.c
r365e29e2 rbdd8ad2f 219 219 * Make call identifying target USB device and type of transfer. 220 220 */ 221 aid_t opening_request = async_send_ 2(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),222 IPC_M_USBHC_DATA_WRITE, target.packed, NULL);221 aid_t opening_request = async_send_3(exch, DEV_IFACE_ID(USBHC_DEV_IFACE), 222 IPC_M_USBHC_DATA_WRITE, target.packed, size, NULL); 223 223 224 224 if (opening_request == 0) { … … 337 337 {{ .address = pipe->wire->address, .endpoint = pipe->endpoint_no }}; 338 338 339 assert(setup_buffer_size == 8); 340 uint64_t setup_packet; 341 memcpy(&setup_packet, setup_buffer, 8); 339 342 /* 340 343 * Make call identifying target USB device and control transfer type. 341 344 */ 342 345 async_exch_t *exch = async_exchange_begin(pipe->hc_sess); 343 aid_t opening_request = async_send_2(exch, DEV_IFACE_ID(USBHC_DEV_IFACE), 344 IPC_M_USBHC_CONTROL_READ, target.packed, NULL); 345 346 aid_t opening_request = async_send_4(exch, DEV_IFACE_ID(USBHC_DEV_IFACE), 347 IPC_M_USBHC_DATA_READ, target.packed, 348 (setup_packet & UINT32_MAX), (setup_packet >> 32), NULL); 349 346 350 if (opening_request == 0) { 347 351 async_exchange_end(exch); 348 352 return ENOMEM; 349 353 } 350 351 /* 352 * Send the setup packet. 353 */ 354 int rc = async_data_write_start(exch, setup_buffer, setup_buffer_size); 355 if (rc != EOK) { 356 async_exchange_end(exch); 357 pipe_end_transaction(pipe); 358 async_wait_for(opening_request, NULL); 359 return rc; 360 } 361 354 362 355 /* 363 356 * Retrieve the data. … … 484 477 const usb_target_t target = 485 478 {{ .address = pipe->wire->address, .endpoint = pipe->endpoint_no }}; 479 assert(setup_buffer_size == 8); 480 uint64_t setup_packet; 481 memcpy(&setup_packet, setup_buffer, 8); 486 482 487 483 /* … … 489 485 */ 490 486 async_exch_t *exch = async_exchange_begin(pipe->hc_sess); 491 aid_t opening_request = async_send_ 3(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),492 IPC_M_USBHC_ CONTROL_WRITE, target.packed,493 data_buffer_size, NULL);487 aid_t opening_request = async_send_5(exch, DEV_IFACE_ID(USBHC_DEV_IFACE), 488 IPC_M_USBHC_DATA_WRITE, target.packed, data_buffer_size, 489 (setup_packet & UINT32_MAX), (setup_packet >> 32), NULL); 494 490 495 491 if (opening_request == 0) { … … 498 494 return ENOMEM; 499 495 } 500 501 /* 502 * Send the setup packet. 503 */ 504 int rc = async_data_write_start(exch, setup_buffer, setup_buffer_size); 505 if (rc != EOK) { 506 async_exchange_end(exch); 507 pipe_end_transaction(pipe); 508 async_wait_for(opening_request, NULL); 509 return rc; 510 } 511 496 512 497 /* 513 498 * Send the data (if any). 514 499 */ 515 500 if (data_buffer_size > 0) { 516 rc = async_data_write_start(exch, data_buffer, data_buffer_size);501 int rc = async_data_write_start(exch, data_buffer, data_buffer_size); 517 502 518 503 /* All data sent, pipe can be released. */
Note:
See TracChangeset
for help on using the changeset viewer.