Changes in uspace/drv/bus/usb/vhc/connhost.c [7d364fb8:27736cf] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/vhc/connhost.c
r7d364fb8 r27736cf 57 57 * @return Error code. 58 58 */ 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; 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); 75 67 } 76 68 … … 88 80 usb_log_debug("Binding handle %" PRIun " to address %d.\n", 89 81 handle, address); 90 usb_device_manager_bind (&vhc->dev_manager, address, handle);82 usb_device_manager_bind_address(&vhc->dev_manager, address, handle); 91 83 92 84 return EOK; … … 104 96 { 105 97 VHC_DATA(vhc, fun); 106 bool found = 107 usb_device_manager_find_by_address(&vhc->dev_manager, address, handle); 108 return found ? EOK : ENOENT; 98 return usb_device_manager_get_info_by_address( 99 &vhc->dev_manager, address, handle, NULL); 109 100 } 110 101 … … 119 110 VHC_DATA(vhc, fun); 120 111 usb_log_debug("Releasing address %d...\n", address); 121 usb_device_manager_release (&vhc->dev_manager, address);112 usb_device_manager_release_address(&vhc->dev_manager, address); 122 113 123 114 return ENOTSUP; … … 137 128 */ 138 129 static int register_endpoint(ddf_fun_t *fun, 139 usb_address_t address, usb_ speed_t speed, usb_endpoint_t endpoint,130 usb_address_t address, usb_endpoint_t endpoint, 140 131 usb_transfer_type_t transfer_type, usb_direction_t direction, 141 132 size_t max_packet_size, unsigned int interval) 142 133 { 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; 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 159 140 } 160 141 … … 172 153 VHC_DATA(vhc, fun); 173 154 174 int rc = usb_endpoint_manager_ unregister_ep(&vhc->ep_manager,175 address, endpoint, direction );155 int rc = usb_endpoint_manager_remove_ep(&vhc->ep_manager, 156 address, endpoint, direction, NULL, NULL); 176 157 177 158 return rc; … … 414 395 VHC_DATA(vhc, fun); 415 396 416 endpoint_t *ep = usb_endpoint_manager_ get_ep(&vhc->ep_manager,417 target.address, target.endpoint, USB_DIRECTION_IN , NULL);397 endpoint_t *ep = usb_endpoint_manager_find_ep(&vhc->ep_manager, 398 target.address, target.endpoint, USB_DIRECTION_IN); 418 399 if (ep == NULL) { 419 400 return ENOENT; … … 456 437 VHC_DATA(vhc, fun); 457 438 458 endpoint_t *ep = usb_endpoint_manager_ get_ep(&vhc->ep_manager,459 target.address, target.endpoint, USB_DIRECTION_OUT , NULL);439 endpoint_t *ep = usb_endpoint_manager_find_ep(&vhc->ep_manager, 440 target.address, target.endpoint, USB_DIRECTION_OUT); 460 441 if (ep == NULL) { 461 442 return ENOENT; … … 490 471 } 491 472 492 static int tell_address(ddf_fun_t *fun, devman_handle_t handle, 493 usb_address_t *address) 473 static int tell_address(ddf_fun_t *fun, usb_address_t *address) 494 474 { 495 475 UNSUPPORTED("tell_address"); … … 508 488 } 509 489 510 static int tell_address_rh(ddf_fun_t *root_hub_fun, devman_handle_t handle, 511 usb_address_t *address) 490 static int tell_address_rh(ddf_fun_t *root_hub_fun, usb_address_t *address) 512 491 { 513 492 VHC_DATA(vhc, root_hub_fun); 514 493 515 if (handle == 0) { 516 handle = root_hub_fun->handle; 517 } 494 devman_handle_t handle = root_hub_fun->handle; 518 495 519 496 usb_log_debug("tell_address_rh(handle=%" PRIun ")\n", handle); 520 usb_address_t addr = usb_device_manager_find(&vhc->dev_manager, handle); 497 const usb_address_t addr = 498 usb_device_manager_find_address(&vhc->dev_manager, handle); 521 499 if (addr < 0) { 522 500 return addr; … … 542 520 usb_iface_t vhc_usb_iface = { 543 521 .get_hc_handle = usb_iface_get_hc_handle_hc_impl, 544 .get_ address = tell_address522 .get_my_address = tell_address 545 523 }; 546 524 547 525 usb_iface_t rh_usb_iface = { 548 526 .get_hc_handle = usb_iface_get_hc_handle_rh_impl, 549 .get_ address = tell_address_rh527 .get_my_address = tell_address_rh 550 528 }; 551 529
Note:
See TracChangeset
for help on using the changeset viewer.