Changeset a3886be in mainline


Ignore:
Timestamp:
2013-01-04T21:31:46Z (11 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bbd68a4
Parents:
ceb444c
Message:

libusbhost: Remove the old root hub initialization code.

Location:
uspace/lib/usbhost
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbhost/include/usb/host/ddf_helpers.h

    rceb444c ra3886be  
    4646    usb_speed_t max_speed, size_t bw, bw_count_func_t bw_count);
    4747int hcd_ddf_setup_root_hub(ddf_dev_t *dev, usb_speed_t speed);
    48 int hcd_ddf_setup_hub(ddf_dev_t *dev, usb_address_t *address);
    4948int hcd_ddf_new_device(ddf_dev_t *device);
    5049
  • uspace/lib/usbhost/src/ddf_helpers.c

    rceb444c ra3886be  
    393393
    394394        hcd_reserve_default_address(hcd, speed);
    395         int ret = hcd_ddf_new_device(device);
     395        const int ret = hcd_ddf_new_device(device);
    396396        hcd_release_default_address(hcd);
    397397        return ret;
    398 }
    399 
    400 /** Announce root hub to the DDF
    401  *
    402  * @param[in] device Host controller ddf device
    403  * @param[in/out] address USB address of the root hub
    404  * @return Error code
    405  */
    406 int hcd_ddf_setup_hub(ddf_dev_t *device, usb_address_t *address)
    407 {
    408         assert(address);
    409         assert(device);
    410 
    411         hcd_t *hcd = dev_to_hcd(device);
    412 
    413         const usb_speed_t speed = hcd->dev_manager.max_speed;
    414 
    415         int ret = usb_device_manager_request_address(&hcd->dev_manager,
    416             address, false, speed);
    417         if (ret != EOK) {
    418                 usb_log_error("Failed to get root hub address: %s\n",
    419                     str_error(ret));
    420                 return ret;
    421         }
    422 
    423 #define CHECK_RET_UNREG_RETURN(ret, message...) \
    424 if (ret != EOK) { \
    425         usb_log_error(message); \
    426         usb_endpoint_manager_remove_ep( \
    427             &hcd->ep_manager, *address, 0, \
    428             USB_DIRECTION_BOTH, NULL, NULL); \
    429         usb_device_manager_release_address( \
    430             &hcd->dev_manager, *address); \
    431         return ret; \
    432 } else (void)0
    433 
    434         ret = usb_endpoint_manager_add_ep(
    435             &hcd->ep_manager, *address, 0,
    436             USB_DIRECTION_BOTH, USB_TRANSFER_CONTROL, speed, 64,
    437             0, NULL, NULL);
    438         CHECK_RET_UNREG_RETURN(ret,
    439             "Failed to add root hub control endpoint: %s.\n", str_error(ret));
    440 
    441         match_id_t mid = { .id = "usb&class=hub", .score = 100 };
    442         link_initialize(&mid.link);
    443         match_id_list_t mid_list;
    444         init_match_ids(&mid_list);
    445         add_match_id(&mid_list, &mid);
    446 
    447         ret = hcd_ddf_add_usb_device(device, *address, speed, "rh", &mid_list);
    448         CHECK_RET_UNREG_RETURN(ret,
    449             "Failed to add hcd device: %s.\n", str_error(ret));
    450 
    451         return EOK;
    452 #undef CHECK_RET_UNREG_RETURN
    453398}
    454399
Note: See TracChangeset for help on using the changeset viewer.