Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/vhc/connhost.c

    r27736cf r7d364fb8  
    5757 * @return Error code.
    5858 */
    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);
     59static 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;
    6775}
    6876
     
    8088        usb_log_debug("Binding handle %" PRIun " to address %d.\n",
    8189            handle, address);
    82         usb_device_manager_bind_address(&vhc->dev_manager, address, handle);
     90        usb_device_manager_bind(&vhc->dev_manager, address, handle);
    8391
    8492        return EOK;
     
    96104{
    97105        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;
    100109}
    101110
     
    110119        VHC_DATA(vhc, fun);
    111120        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);
    113122
    114123        return ENOTSUP;
     
    128137 */
    129138static 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,
    131140    usb_transfer_type_t transfer_type, usb_direction_t direction,
    132141    size_t max_packet_size, unsigned int interval)
    133142{
    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;
    140159}
    141160
     
    153172        VHC_DATA(vhc, fun);
    154173
    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);
    157176
    158177        return rc;
     
    395414        VHC_DATA(vhc, fun);
    396415
    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);
    399418        if (ep == NULL) {
    400419                return ENOENT;
     
    437456        VHC_DATA(vhc, fun);
    438457
    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);
    441460        if (ep == NULL) {
    442461                return ENOENT;
     
    471490}
    472491
    473 static int tell_address(ddf_fun_t *fun, usb_address_t *address)
     492static int tell_address(ddf_fun_t *fun, devman_handle_t handle,
     493    usb_address_t *address)
    474494{
    475495        UNSUPPORTED("tell_address");
     
    488508}
    489509
    490 static int tell_address_rh(ddf_fun_t *root_hub_fun, usb_address_t *address)
     510static int tell_address_rh(ddf_fun_t *root_hub_fun, devman_handle_t handle,
     511    usb_address_t *address)
    491512{
    492513        VHC_DATA(vhc, root_hub_fun);
    493514
    494         devman_handle_t handle = root_hub_fun->handle;
     515        if (handle == 0) {
     516                handle = root_hub_fun->handle;
     517        }
    495518
    496519        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);
    499521        if (addr < 0) {
    500522                return addr;
     
    520542usb_iface_t vhc_usb_iface = {
    521543        .get_hc_handle = usb_iface_get_hc_handle_hc_impl,
    522         .get_my_address = tell_address
     544        .get_address = tell_address
    523545};
    524546
    525547usb_iface_t rh_usb_iface = {
    526548        .get_hc_handle = usb_iface_get_hc_handle_rh_impl,
    527         .get_my_address = tell_address_rh
     549        .get_address = tell_address_rh
    528550};
    529551
Note: See TracChangeset for help on using the changeset viewer.