Changeset 2b0929e in mainline


Ignore:
Timestamp:
2012-12-21T14:33:23Z (11 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
94c40ce2
Parents:
0a12879
Message:

libusbhost: Drop hcd parameter from hcd_ddf_setup_hub.

Fix OHCI references in ddf_helpers.c

Location:
uspace
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ohci/ohci.c

    r0a12879 r2b0929e  
    159159
    160160        /* HC should be running OK. We can add root hub */
    161         ret = hcd_ddf_setup_hub(dev_to_hcd(device), &hc_impl->rh.address, device);
     161        ret = hcd_ddf_setup_hub(device, &hc_impl->rh.address);
    162162        CHECK_RET_CLEAN_RETURN(ret,
    163163            "Failed to register OHCI root hub: %s.\n", str_error(ret));
  • uspace/lib/usbhost/include/usb/host/ddf_helpers.h

    r0a12879 r2b0929e  
    4545int hcd_ddf_setup_device(ddf_dev_t *device, ddf_fun_t **hc_fun,
    4646    usb_speed_t max_speed, size_t bw, bw_count_func_t bw_count);
    47 int hcd_ddf_setup_hub(hcd_t *instance, usb_address_t *address, ddf_dev_t *dev);
     47int hcd_ddf_setup_hub(ddf_dev_t *dev, usb_address_t *address);
    4848
    4949hcd_t *dev_to_hcd(ddf_dev_t *dev);
  • uspace/lib/usbhost/src/ddf_helpers.c

    r0a12879 r2b0929e  
    5757        hc_dev_t *hc_dev = dev_to_hc_dev(dev);
    5858        if (!hc_dev || !hc_dev->hc_fun) {
    59                 usb_log_error("Invalid OHCI device.\n");
     59                usb_log_error("Invalid HCD device.\n");
    6060                return NULL;
    6161        }
     
    173173/** Announce root hub to the DDF
    174174 *
    175  * @param[in] instance OHCI driver instance
    176  * @param[in] hub_fun DDF function representing OHCI root hub
     175 * @param[in] device Host controller ddf device
     176 * @param[in/out] address USB address of the root hub
    177177 * @return Error code
    178178 */
    179 int hcd_ddf_setup_hub(hcd_t *instance, usb_address_t *address, ddf_dev_t *device)
    180 {
    181         assert(instance);
     179int hcd_ddf_setup_hub(ddf_dev_t *device, usb_address_t *address)
     180{
    182181        assert(address);
    183182        assert(device);
    184183
    185         const usb_speed_t speed = instance->dev_manager.max_speed;
    186 
    187         int ret = usb_device_manager_request_address(&instance->dev_manager,
     184        hcd_t *hcd = dev_to_hcd(device);
     185
     186        const usb_speed_t speed = hcd->dev_manager.max_speed;
     187
     188        int ret = usb_device_manager_request_address(&hcd->dev_manager,
    188189            address, false, speed);
    189190        if (ret != EOK) {
     
    197198        usb_log_error(message); \
    198199        usb_endpoint_manager_remove_ep( \
    199             &instance->ep_manager, *address, 0, \
     200            &hcd->ep_manager, *address, 0, \
    200201            USB_DIRECTION_BOTH, NULL, NULL); \
    201202        usb_device_manager_release_address( \
    202             &instance->dev_manager, *address); \
     203            &hcd->dev_manager, *address); \
    203204        return ret; \
    204205} else (void)0
    205206
    206207        ret = usb_endpoint_manager_add_ep(
    207             &instance->ep_manager, *address, 0,
     208            &hcd->ep_manager, *address, 0,
    208209            USB_DIRECTION_BOTH, USB_TRANSFER_CONTROL, speed, 64,
    209210            0, NULL, NULL);
     
    229230 * @param[in] device DDF instance of the device to use.
    230231 *
    231  * This function does all the preparatory work for hc driver implementation.
    232  *  - gets device hw resources
    233  *  - disables OHCI legacy support
    234  *  - asks for interrupt
    235  *  - registers interrupt handler
     232 * This function does all the ddf work for hc driver.
    236233 */
    237234int hcd_ddf_setup_device(ddf_dev_t *device, ddf_fun_t **hc_fun,
     
    243240        hc_dev_t *instance = ddf_dev_data_alloc(device, sizeof(hc_dev_t));
    244241        if (instance == NULL) {
    245                 usb_log_error("Failed to allocate OHCI driver.\n");
     242                usb_log_error("Failed to allocate HCD ddf structure.\n");
    246243                return ENOMEM;
    247244        }
     
    260257        int ret = instance->hc_fun ? EOK : ENOMEM;
    261258        CHECK_RET_DEST_FREE_RETURN(ret,
    262             "Failed to create OHCI HC function: %s.\n", str_error(ret));
     259            "Failed to create HCD HC function: %s.\n", str_error(ret));
    263260        ddf_fun_set_ops(instance->hc_fun, &hc_ops);
    264261        hcd_t *hcd = ddf_fun_data_alloc(instance->hc_fun, sizeof(hcd_t));
     
    271268        ret = ddf_fun_bind(instance->hc_fun);
    272269        CHECK_RET_DEST_FREE_RETURN(ret,
    273             "Failed to bind OHCI device function: %s.\n", str_error(ret));
     270            "Failed to bind HCD device function: %s.\n", str_error(ret));
    274271
    275272#define CHECK_RET_UNBIND_FREE_RETURN(ret, message...) \
    276273if (ret != EOK) { \
    277274        ddf_fun_unbind(instance->hc_fun); \
    278         CHECK_RET_DEST_FREE_RETURN(ret, \
    279             "Failed to add OHCI to HC class: %s.\n", str_error(ret)); \
     275        CHECK_RET_DEST_FREE_RETURN(ret, message); \
    280276} else (void)0
    281277        ret = ddf_fun_add_to_category(instance->hc_fun, USB_HC_CATEGORY);
Note: See TracChangeset for help on using the changeset viewer.