Changeset fe4dd14 in mainline
- Timestamp:
- 2011-01-30T23:30:39Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 33b88723
- Parents:
- 9753220
- Location:
- uspace/lib/usb
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/include/usb/usbdrv.h
r9753220 rfe4dd14 70 70 usb_handle_t *); 71 71 72 int usb_drv_async_control_write(int, usb_target_t, 73 void *, size_t, void *, size_t, usb_handle_t *); 74 72 75 int usb_drv_psync_control_write_setup(int, usb_target_t, void *, size_t); 73 76 int usb_drv_psync_control_write_data(int, usb_target_t, void *, size_t); … … 77 80 void *, size_t, void *, size_t); 78 81 79 80 82 int usb_drv_async_control_read_setup(int, usb_target_t, 81 83 void *, size_t, usb_handle_t *); … … 84 86 int usb_drv_async_control_read_status(int, usb_target_t, 85 87 usb_handle_t *); 88 89 int usb_drv_async_control_read(int, usb_target_t, 90 void *, size_t, void *, size_t, size_t *, usb_handle_t *); 86 91 87 92 int usb_drv_psync_control_read_setup(int, usb_target_t, void *, size_t); -
uspace/lib/usb/src/usbdrv.c
r9753220 rfe4dd14 495 495 } 496 496 497 /** Issue whole control write transfer. */ 498 int usb_drv_async_control_write(int phone, usb_target_t target, 499 void *setup_packet, size_t setup_packet_size, 500 void *buffer, size_t buffer_size, 501 usb_handle_t *handle) 502 { 503 // FIXME - check input parameters instead of asserting them 504 assert(phone > 0); 505 assert(setup_packet != NULL); 506 assert(setup_packet_size > 0); 507 assert(buffer != NULL); 508 assert(buffer_size > 0); 509 assert(handle != NULL); 510 511 transfer_info_t *transfer 512 = (transfer_info_t *) malloc(sizeof(transfer_info_t)); 513 if (transfer == NULL) { 514 return ENOMEM; 515 } 516 517 transfer->size_transferred = NULL; 518 transfer->buffer = NULL; 519 transfer->size = 0; 520 transfer->phone = phone; 521 522 int rc; 523 524 transfer->request = async_send_3(phone, 525 DEV_IFACE_ID(USBHC_DEV_IFACE), 526 IPC_M_USBHC_CONTROL_WRITE, 527 target.address, target.endpoint, 528 &transfer->reply); 529 530 rc = async_data_write_start(phone, setup_packet, setup_packet_size); 531 if (rc != EOK) { 532 async_wait_for(transfer->request, NULL); 533 return rc; 534 } 535 536 rc = async_data_write_start(phone, buffer, buffer_size); 537 if (rc != EOK) { 538 async_wait_for(transfer->request, NULL); 539 return rc; 540 } 541 542 *handle = (usb_handle_t) transfer; 543 544 return EOK; 545 } 546 497 547 /** Start control read transfer. */ 498 548 int usb_drv_async_control_read_setup(int phone, usb_target_t target, … … 530 580 } 531 581 582 /** Issue whole control read transfer. */ 583 int usb_drv_async_control_read(int phone, usb_target_t target, 584 void *setup_packet, size_t setup_packet_size, 585 void *buffer, size_t buffer_size, size_t *actual_size, 586 usb_handle_t *handle) 587 { 588 // FIXME - check input parameters instead of asserting them 589 assert(phone > 0); 590 assert(setup_packet != NULL); 591 assert(setup_packet_size > 0); 592 assert(buffer != NULL); 593 assert(buffer_size > 0); 594 assert(handle != NULL); 595 596 transfer_info_t *transfer 597 = (transfer_info_t *) malloc(sizeof(transfer_info_t)); 598 if (transfer == NULL) { 599 return ENOMEM; 600 } 601 602 transfer->size_transferred = actual_size; 603 transfer->buffer = buffer; 604 transfer->size = buffer_size; 605 transfer->phone = phone; 606 607 int rc; 608 609 transfer->request = async_send_4(phone, 610 DEV_IFACE_ID(USBHC_DEV_IFACE), 611 IPC_M_USBHC_CONTROL_READ, 612 target.address, target.endpoint, 613 buffer_size, 614 &transfer->reply); 615 616 rc = async_data_write_start(phone, setup_packet, setup_packet_size); 617 if (rc != EOK) { 618 async_wait_for(transfer->request, NULL); 619 return rc; 620 } 621 622 *handle = (usb_handle_t) transfer; 623 624 return EOK; 625 } 626 532 627 /** 533 628 * @}
Note:
See TracChangeset
for help on using the changeset viewer.