Changeset e779bd3c in mainline
- Timestamp:
- 2011-09-13T14:17:20Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e3f6304
- Parents:
- 7eb32a8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/vhc/connhost.c
r7eb32a8 re779bd3c 172 172 VHC_DATA(vhc, fun); 173 173 174 endpoint_t *ep = usb_endpoint_manager_get_ep(&vhc->ep_manager,175 address, endpoint, direction, NULL);176 if (ep == NULL) {177 return ENOENT;178 }179 180 174 int rc = usb_endpoint_manager_unregister_ep(&vhc->ep_manager, 181 175 address, endpoint, direction); … … 183 177 return rc; 184 178 } 185 179 #if 0 186 180 /** Schedule interrupt out transfer. 187 181 * … … 413 407 return EOK; 414 408 } 409 #endif 410 static int usb_read(ddf_fun_t *fun, usb_target_t target, uint64_t setup_buffer, 411 uint8_t *data_buffer, size_t data_buffer_size, 412 usbhc_iface_transfer_in_callback_t callback, void *arg) 413 { 414 VHC_DATA(vhc, fun); 415 416 endpoint_t *ep = usb_endpoint_manager_get_ep(&vhc->ep_manager, 417 target.address, target.endpoint, USB_DIRECTION_IN, NULL); 418 if (ep == NULL) { 419 return ENOENT; 420 } 421 const usb_transfer_type_t transfer_type = ep->transfer_type; 422 423 424 vhc_transfer_t *transfer = vhc_transfer_create(target.address, 425 target.endpoint, USB_DIRECTION_IN, transfer_type, 426 fun, arg); 427 if (transfer == NULL) { 428 return ENOMEM; 429 } 430 if (transfer_type == USB_TRANSFER_CONTROL) { 431 transfer->setup_buffer = malloc(sizeof(uint64_t)); 432 assert(transfer->setup_buffer); 433 memcpy(transfer->setup_buffer, &setup_buffer, sizeof(uint64_t)); 434 transfer->setup_buffer_size = sizeof(uint64_t); 435 } 436 transfer->data_buffer = data_buffer; 437 transfer->data_buffer_size = data_buffer_size; 438 transfer->callback_in = callback; 439 440 int rc = vhc_virtdev_add_transfer(vhc, transfer); 441 if (rc != EOK) { 442 free(transfer); 443 return rc; 444 } 445 446 return EOK; 447 } 448 449 static int usb_write(ddf_fun_t *fun, usb_target_t target, uint64_t setup_buffer, 450 const uint8_t *data_buffer, size_t data_buffer_size, 451 usbhc_iface_transfer_out_callback_t callback, void *arg) 452 { 453 VHC_DATA(vhc, fun); 454 455 endpoint_t *ep = usb_endpoint_manager_get_ep(&vhc->ep_manager, 456 target.address, target.endpoint, USB_DIRECTION_OUT, NULL); 457 if (ep == NULL) { 458 return ENOENT; 459 } 460 const usb_transfer_type_t transfer_type = ep->transfer_type; 461 462 463 vhc_transfer_t *transfer = vhc_transfer_create(target.address, 464 target.endpoint, USB_DIRECTION_OUT, transfer_type, 465 fun, arg); 466 if (transfer == NULL) { 467 return ENOMEM; 468 } 469 if (transfer_type == USB_TRANSFER_CONTROL) { 470 transfer->setup_buffer = malloc(sizeof(uint64_t)); 471 assert(transfer->setup_buffer); 472 memcpy(transfer->setup_buffer, &setup_buffer, sizeof(uint64_t)); 473 transfer->setup_buffer_size = sizeof(uint64_t); 474 } 475 transfer->data_buffer = (void*)data_buffer; 476 transfer->data_buffer_size = data_buffer_size; 477 transfer->callback_out = callback; 478 479 int rc = vhc_virtdev_add_transfer(vhc, transfer); 480 if (rc != EOK) { 481 free(transfer); 482 return rc; 483 } 484 485 return EOK; 486 } 415 487 416 488 static int tell_address(ddf_fun_t *fun, devman_handle_t handle, … … 460 532 .unregister_endpoint = unregister_endpoint, 461 533 462 .interrupt_out = interrupt_out, 463 .interrupt_in = interrupt_in, 464 465 .bulk_in = bulk_in, 466 .bulk_out = bulk_out, 467 468 .control_write = control_write, 469 .control_read = control_read 534 .write = usb_write, 535 .read = usb_read, 470 536 }; 471 537
Note:
See TracChangeset
for help on using the changeset viewer.