Changes in uspace/drv/bus/usb/vhc/connhost.c [27736cf:7d364fb8] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/vhc/connhost.c
r27736cf r7d364fb8 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; … … 437 456 VHC_DATA(vhc, fun); 438 457 439 endpoint_t *ep = usb_endpoint_manager_ find_ep(&vhc->ep_manager,440 target.address, target.endpoint, USB_DIRECTION_OUT );458 endpoint_t *ep = usb_endpoint_manager_get_ep(&vhc->ep_manager, 459 target.address, target.endpoint, USB_DIRECTION_OUT, NULL); 441 460 if (ep == NULL) { 442 461 return ENOENT; … … 471 490 } 472 491 473 static int tell_address(ddf_fun_t *fun, usb_address_t *address) 492 static int tell_address(ddf_fun_t *fun, devman_handle_t handle, 493 usb_address_t *address) 474 494 { 475 495 UNSUPPORTED("tell_address"); … … 488 508 } 489 509 490 static int tell_address_rh(ddf_fun_t *root_hub_fun, usb_address_t *address) 510 static int tell_address_rh(ddf_fun_t *root_hub_fun, devman_handle_t handle, 511 usb_address_t *address) 491 512 { 492 513 VHC_DATA(vhc, root_hub_fun); 493 514 494 devman_handle_t handle = root_hub_fun->handle; 515 if (handle == 0) { 516 handle = root_hub_fun->handle; 517 } 495 518 496 519 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); 520 usb_address_t addr = usb_device_manager_find(&vhc->dev_manager, handle); 499 521 if (addr < 0) { 500 522 return addr; … … 520 542 usb_iface_t vhc_usb_iface = { 521 543 .get_hc_handle = usb_iface_get_hc_handle_hc_impl, 522 .get_ my_address = tell_address544 .get_address = tell_address 523 545 }; 524 546 525 547 usb_iface_t rh_usb_iface = { 526 548 .get_hc_handle = usb_iface_get_hc_handle_rh_impl, 527 .get_ my_address = tell_address_rh549 .get_address = tell_address_rh 528 550 }; 529 551
Note:
See TracChangeset
for help on using the changeset viewer.