Changeset 272f46f8 in mainline
- Timestamp:
- 2011-11-25T18:55:20Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b4292e7
- Parents:
- 095bddfc
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/generic/remote_usbhc.c
r095bddfc r272f46f8 357 357 ipc_callid_t data_caller; 358 358 void *buffer; 359 size_t size;360 359 } async_transaction_t; 361 360 … … 382 381 trans->data_caller = 0; 383 382 trans->buffer = NULL; 384 trans->size = 0;385 383 386 384 return trans; … … 466 464 int outcome, void *arg) 467 465 { 468 async_transaction_t *trans = (async_transaction_t *)arg;466 async_transaction_t *trans = arg; 469 467 470 468 async_answer_0(trans->caller, outcome); … … 472 470 async_transaction_destroy(trans); 473 471 } 474 472 /*----------------------------------------------------------------------------*/ 475 473 static void callback_in(ddf_fun_t *fun, 476 474 int outcome, size_t actual_size, void *arg) … … 487 485 } 488 486 489 trans->size = actual_size;490 491 487 if (trans->data_caller) { 492 488 async_data_read_finalize(trans->data_caller, … … 498 494 async_transaction_destroy(trans); 499 495 } 500 496 /*----------------------------------------------------------------------------*/ 501 497 void remote_usbhc_register_endpoint(ddf_fun_t *fun, void *iface, 502 498 ipc_callid_t callid, ipc_call_t *call) … … 576 572 } 577 573 578 if (!async_data_read_receive(&trans->data_caller, &trans->size)) { 574 size_t size = 0; 575 if (!async_data_read_receive(&trans->data_caller, &size)) { 579 576 async_answer_0(callid, EPARTY); 580 577 return; 581 578 } 582 579 583 trans->buffer = malloc( trans->size);580 trans->buffer = malloc(size); 584 581 if (trans->buffer == NULL) { 585 582 async_answer_0(trans->data_caller, ENOMEM); … … 589 586 590 587 const int rc = hc_iface->read( 591 fun, target, setup, trans->buffer, trans->size, callback_in, trans);588 fun, target, setup, trans->buffer, size, callback_in, trans); 592 589 593 590 if (rc != EOK) { … … 597 594 } 598 595 } 599 596 /*----------------------------------------------------------------------------*/ 600 597 void remote_usbhc_write( 601 598 ddf_fun_t *fun, void *iface, ipc_callid_t callid, ipc_call_t *call) … … 624 621 } 625 622 623 size_t size = 0; 626 624 if (data_buffer_len > 0) { 627 int rc = async_data_write_accept(&trans->buffer, false,625 const int rc = async_data_write_accept(&trans->buffer, false, 628 626 1, USB_MAX_PAYLOAD_SIZE, 629 0, & trans->size);627 0, &size); 630 628 631 629 if (rc != EOK) { … … 636 634 } 637 635 638 int rc = hc_iface->write(639 fun, target, setup, trans->buffer, trans->size, callback_out, trans);636 const int rc = hc_iface->write( 637 fun, target, setup, trans->buffer, size, callback_out, trans); 640 638 641 639 if (rc != EOK) { … … 644 642 } 645 643 } 646 647 648 644 /** 649 645 * @}
Note:
See TracChangeset
for help on using the changeset viewer.