Ignore:
File:
1 edited

Legend:

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

    r129b821f r58563585  
    4040
    4141#include <usb/host/ddf_helpers.h>
    42 #include <usb/host/utility.h>
    4342
    4443#include <usb/debug.h>
     
    7069                return ret;
    7170        }
     71        vhc_init(vhc);
    7272        return EOK;
    7373}
    7474
     75hcd_ops_t vhc_hc_ops = {
     76        .schedule = vhc_schedule,
     77};
     78
    7579static int vhc_dev_add(ddf_dev_t *dev)
    7680{
    77         /* Initialize generic structures */
    78         int ret = hcd_ddf_setup_hc(dev, sizeof(vhc_data_t));
     81        /* Initialize virtual structure */
     82        ddf_fun_t *ctl_fun = NULL;
     83        int ret = vhc_control_node(dev, &ctl_fun);
    7984        if (ret != EOK) {
    80                 usb_log_error("Failed to init HCD structures: %s.",
    81                    str_error(ret));
     85                usb_log_error("Failed to setup control node.\n");
    8286                return ret;
    8387        }
    84         vhc_data_t *vhc = ddf_dev_data_get(dev);
    85         vhc_init(vhc);
     88        vhc_data_t *data = ddf_fun_data_get(ctl_fun);
    8689
    87         hc_device_setup(&vhc->base, (bus_t *) &vhc->bus);
    88 
    89         /* Initialize virtual structure */
    90         ddf_fun_t *ctl_fun = NULL;
    91         ret = vhc_control_node(dev, &ctl_fun);
     90        /* Initialize generic structures */
     91        ret = hcd_ddf_setup_hc(dev, USB_SPEED_FULL,
     92            BANDWIDTH_AVAILABLE_USB11, bandwidth_count_usb11);
    9293        if (ret != EOK) {
    93                 usb_log_error("Failed to setup control node.");
     94                usb_log_error("Failed to init HCD structures: %s.\n",
     95                   str_error(ret));
     96                ddf_fun_destroy(ctl_fun);
    9497                return ret;
    9598        }
    9699
     100        hcd_set_implementation(dev_to_hcd(dev), data, &vhc_hc_ops);
     101
    97102        /* Add virtual hub device */
    98         ret = vhc_virtdev_plug_hub(vhc, &vhc->hub, NULL, 0);
     103        ret = vhc_virtdev_plug_hub(data, &data->hub, NULL, 0);
    99104        if (ret != EOK) {
    100                 usb_log_error("Failed to plug root hub: %s.", str_error(ret));
     105                usb_log_error("Failed to plug root hub: %s.\n", str_error(ret));
    101106                ddf_fun_destroy(ctl_fun);
    102107                return ret;
     
    107112         * needs to be ready at this time.
    108113         */
    109         ret = hc_setup_virtual_root_hub(&vhc->base, USB_SPEED_HIGH);
     114        ret = hcd_ddf_setup_root_hub(dev);
    110115        if (ret != EOK) {
    111                 usb_log_error("Failed to init VHC root hub: %s",
     116                usb_log_error("Failed to init VHC root hub: %s\n",
    112117                        str_error(ret));
    113118                // TODO do something here...
Note: See TracChangeset for help on using the changeset viewer.