Changes in uspace/drv/bus/usb/vhc/connhost.c [02fc5c4:82a31261] in mainline
- File:
-
- 1 edited
-
uspace/drv/bus/usb/vhc/connhost.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/vhc/connhost.c
r02fc5c4 r82a31261 57 57 * @return Error code. 58 58 */ 59 static int request_address(ddf_fun_t *fun, usb_address_t *address, bool strict, 60 usb_speed_t speed) 61 { 62 VHC_DATA(vhc, fun); 63 64 assert(address); 65 return usb_device_manager_request_address( 66 &vhc->dev_manager, address, strict, speed); 59 static int request_address(ddf_fun_t *fun, usb_speed_t speed, 60 usb_address_t *address) 61 { 62 VHC_DATA(vhc, fun); 63 64 usb_address_t addr = usb_device_manager_get_free_address( 65 &vhc->dev_manager, USB_SPEED_HIGH); 66 if (addr < 0) { 67 return addr; 68 } 69 70 if (address != NULL) { 71 *address = addr; 72 } 73 74 return EOK; 67 75 } 68 76 … … 80 88 usb_log_debug("Binding handle %" PRIun " to address %d.\n", 81 89 handle, address); 82 usb_device_manager_bind _address(&vhc->dev_manager, address, handle);90 usb_device_manager_bind(&vhc->dev_manager, address, handle); 83 91 84 92 return EOK; … … 96 104 { 97 105 VHC_DATA(vhc, fun); 98 return usb_device_manager_get_info_by_address( 99 &vhc->dev_manager, address, handle, NULL); 106 bool found = 107 usb_device_manager_find_by_address(&vhc->dev_manager, address, handle); 108 return found ? EOK : ENOENT; 100 109 } 101 110 … … 110 119 VHC_DATA(vhc, fun); 111 120 usb_log_debug("Releasing address %d...\n", address); 112 usb_device_manager_release _address(&vhc->dev_manager, address);121 usb_device_manager_release(&vhc->dev_manager, address); 113 122 114 123 return ENOTSUP; … … 128 137 */ 129 138 static int register_endpoint(ddf_fun_t *fun, 130 usb_address_t address, usb_ endpoint_t endpoint,139 usb_address_t address, usb_speed_t speed, usb_endpoint_t endpoint, 131 140 usb_transfer_type_t transfer_type, usb_direction_t direction, 132 141 size_t max_packet_size, unsigned int interval) 133 142 { 134 VHC_DATA(vhc, fun); 135 136 return usb_endpoint_manager_add_ep(&vhc->ep_manager, 137 address, endpoint, direction, transfer_type, USB_SPEED_FULL, 1, 0, 138 NULL, NULL); 139 143 /* TODO: Use usb_endpoint_manager_add_ep */ 144 VHC_DATA(vhc, fun); 145 146 endpoint_t *ep = endpoint_get( 147 address, endpoint, direction, transfer_type, USB_SPEED_FULL, 1); 148 if (ep == NULL) { 149 return ENOMEM; 150 } 151 152 int rc = usb_endpoint_manager_register_ep(&vhc->ep_manager, ep, 1); 153 if (rc != EOK) { 154 endpoint_destroy(ep); 155 return rc; 156 } 157 158 return EOK; 140 159 } 141 160 … … 153 172 VHC_DATA(vhc, fun); 154 173 155 int rc = usb_endpoint_manager_ remove_ep(&vhc->ep_manager,156 address, endpoint, direction , NULL, NULL);174 int rc = usb_endpoint_manager_unregister_ep(&vhc->ep_manager, 175 address, endpoint, direction); 157 176 158 177 return rc; … … 395 414 VHC_DATA(vhc, fun); 396 415 397 endpoint_t *ep = usb_endpoint_manager_ find_ep(&vhc->ep_manager,398 target.address, target.endpoint, USB_DIRECTION_IN );416 endpoint_t *ep = usb_endpoint_manager_get_ep(&vhc->ep_manager, 417 target.address, target.endpoint, USB_DIRECTION_IN, NULL); 399 418 if (ep == NULL) { 400 419 return ENOENT; … … 421 440 int rc = vhc_virtdev_add_transfer(vhc, transfer); 422 441 if (rc != EOK) { 423 if (transfer->setup_buffer != NULL) { 424 free(transfer->setup_buffer); 425 } 442 free(transfer->setup_buffer); 426 443 free(transfer); 427 444 return rc; … … 437 454 VHC_DATA(vhc, fun); 438 455 439 endpoint_t *ep = usb_endpoint_manager_ find_ep(&vhc->ep_manager,440 target.address, target.endpoint, USB_DIRECTION_OUT );456 endpoint_t *ep = usb_endpoint_manager_get_ep(&vhc->ep_manager, 457 target.address, target.endpoint, USB_DIRECTION_OUT, NULL); 441 458 if (ep == NULL) { 442 459 return ENOENT; … … 471 488 } 472 489 473 static int tell_address(ddf_fun_t *fun, usb_address_t *address) 490 static int tell_address(ddf_fun_t *fun, devman_handle_t handle, 491 usb_address_t *address) 474 492 { 475 493 UNSUPPORTED("tell_address"); … … 488 506 } 489 507 490 static int tell_address_rh(ddf_fun_t *root_hub_fun, usb_address_t *address) 508 static int tell_address_rh(ddf_fun_t *root_hub_fun, devman_handle_t handle, 509 usb_address_t *address) 491 510 { 492 511 VHC_DATA(vhc, root_hub_fun); 493 512 494 devman_handle_t handle = root_hub_fun->handle; 513 if (handle == 0) { 514 handle = root_hub_fun->handle; 515 } 495 516 496 517 usb_log_debug("tell_address_rh(handle=%" PRIun ")\n", handle); 497 const usb_address_t addr = 498 usb_device_manager_find_address(&vhc->dev_manager, handle); 518 usb_address_t addr = usb_device_manager_find(&vhc->dev_manager, handle); 499 519 if (addr < 0) { 500 520 return addr; … … 508 528 .request_address = request_address, 509 529 .bind_address = bind_address, 510 . get_handle= find_by_address,530 .find_by_address = find_by_address, 511 531 .release_address = release_address, 512 532 … … 520 540 usb_iface_t vhc_usb_iface = { 521 541 .get_hc_handle = usb_iface_get_hc_handle_hc_impl, 522 .get_ my_address = tell_address542 .get_address = tell_address 523 543 }; 524 544 525 545 usb_iface_t rh_usb_iface = { 526 546 .get_hc_handle = usb_iface_get_hc_handle_rh_impl, 527 .get_ my_address = tell_address_rh547 .get_address = tell_address_rh 528 548 }; 529 549
Note:
See TracChangeset
for help on using the changeset viewer.
