Changeset fa2a361 in mainline for uspace/lib/usb/hcd.c
- Timestamp:
- 2010-10-26T21:38:59Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- aab02fb
- Parents:
- 56cb9bd
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/hcd.c
r56cb9bd rfa2a361 40 40 #include <errno.h> 41 41 42 /** Information about pending transaction on HC. */ 42 43 typedef struct { 44 /** Phone to host controller driver. */ 43 45 int phone; 46 /** Data buffer. */ 44 47 void *buffer; 48 /** Buffer size. */ 45 49 size_t size; 50 /** Storage for actual number of bytes transferred. */ 46 51 size_t *size_transferred; 52 /** Initial call replay data. */ 47 53 ipc_call_t reply; 54 /** Initial call identifier. */ 48 55 aid_t request; 49 56 } transfer_info_t; … … 355 362 * ================= 356 363 */ 357 364 365 /** Send data to HCD. 366 * 367 * @param phone Opened phone to HCD. 368 * @param method Method used for calling. 369 * @param target Target device. 370 * @param buffer Data buffer (NULL to skip data transfer phase). 371 * @param size Buffer size (must be zero when @p buffer is NULL). 372 * @param handle Storage for transaction handle (cannot be NULL). 373 * @return Error status. 374 * @retval EINVAL Invalid parameter. 375 * @retval ENOMEM Not enough memory to complete the operation. 376 */ 358 377 static int async_send_buffer(int phone, int method, 359 378 usb_target_t target, … … 405 424 } 406 425 426 /** Prepare data retrieval. 427 * 428 * @param phone Opened phone to HCD. 429 * @param method Method used for calling. 430 * @param target Target device. 431 * @param buffer Buffer where to store retrieved data 432 * (NULL to skip data transfer phase). 433 * @param size Buffer size (must be zero when @p buffer is NULL). 434 * @param actual_size Storage where actual number of bytes transferred will 435 * be stored. 436 * @param handle Storage for transaction handle (cannot be NULL). 437 * @return Error status. 438 * @retval EINVAL Invalid parameter. 439 * @retval ENOMEM Not enough memory to complete the operation. 440 */ 407 441 static int async_recv_buffer(int phone, int method, 408 442 usb_target_t target, … … 444 478 } 445 479 480 /** Read buffer from HCD. 481 * 482 * @param phone Opened phone to HCD. 483 * @param hash Buffer hash (obtained after completing IN transaction). 484 * @param buffer Buffer where to store data data. 485 * @param size Buffer size. 486 * @param actual_size Storage where actual number of bytes transferred will 487 * be stored. 488 * @return Error status. 489 */ 446 490 static int read_buffer_in(int phone, ipcarg_t hash, 447 491 void *buffer, size_t size, size_t *actual_size) … … 475 519 } 476 520 477 521 /** Blocks caller until given USB transaction is finished. 522 * After the transaction is finished, the user can access all output data 523 * given to initial call function. 524 * 525 * @param handle Transaction handle. 526 * @return Error status. 527 * @retval EOK No error. 528 * @retval EBADMEM Invalid handle. 529 * @retval ENOENT Data buffer associated with transaction does not exist. 530 */ 478 531 int usb_hcd_async_wait_for(usb_handle_t handle) 479 532 { … … 528 581 } 529 582 583 /** Send interrupt data to device. */ 530 584 int usb_hcd_async_transfer_interrupt_out(int hcd_phone, 531 585 usb_target_t target, … … 540 594 } 541 595 596 /** Request interrupt data from device. */ 542 597 int usb_hcd_async_transfer_interrupt_in(int hcd_phone, 543 598 usb_target_t target, … … 552 607 } 553 608 609 /** Start WRITE control transfer. */ 554 610 int usb_hcd_async_transfer_control_write_setup(int hcd_phone, 555 611 usb_target_t target, … … 564 620 } 565 621 622 /** Send data during WRITE control transfer. */ 566 623 int usb_hcd_async_transfer_control_write_data(int hcd_phone, 567 624 usb_target_t target, … … 576 633 } 577 634 635 /** Terminate WRITE control transfer. */ 578 636 int usb_hcd_async_transfer_control_write_status(int hcd_phone, 579 637 usb_target_t target, … … 587 645 } 588 646 647 /** Start READ control transfer. */ 589 648 int usb_hcd_async_transfer_control_read_setup(int hcd_phone, 590 649 usb_target_t target, … … 599 658 } 600 659 660 /** Request data during READ control transfer. */ 601 661 int usb_hcd_async_transfer_control_read_data(int hcd_phone, 602 662 usb_target_t target, … … 611 671 } 612 672 673 /** Terminate READ control transfer. */ 613 674 int usb_hcd_async_transfer_control_read_status(int hcd_phone, 614 675 usb_target_t target,
Note:
See TracChangeset
for help on using the changeset viewer.