Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset c0e4b5b2 in mainline


Ignore:
Timestamp:
2017-10-13T09:38:32Z (4 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master
Children:
5995383c
Parents:
741bcdeb
Message:

usbhost refactoring: vhc

Now, please, review.

Location:
uspace/drv/bus/usb/vhc
Files:
3 edited

Legend:

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

    r741bcdeb rc0e4b5b2  
    8989
    9090        /* Initialize generic structures */
    91         ret = hcd_ddf_setup_hc(dev, USB_SPEED_FULL,
    92             BANDWIDTH_AVAILABLE_USB11, bandwidth_count_usb11);
     91        ret = hcd_ddf_setup_hc(dev);
    9392        if (ret != EOK) {
    9493                usb_log_error("Failed to init HCD structures: %s.\n",
     
    9897        }
    9998
    100         hcd_set_implementation(dev_to_hcd(dev), data, &vhc_hc_ops);
     99        hcd_set_implementation(dev_to_hcd(dev), data, &vhc_hc_ops, &data->bus.base);
    101100
    102101        /* Add virtual hub device */
  • uspace/drv/bus/usb/vhc/transfer.c

    r741bcdeb rc0e4b5b2  
    3131#include <usb/debug.h>
    3232#include <usbvirt/device.h>
     33#include <usb/host/bandwidth.h>
    3334#include <usbvirt/ipc.h>
    3435#include "vhcd.h"
     
    3738static bool is_set_address_transfer(vhc_transfer_t *transfer)
    3839{
    39         if (transfer->batch->ep->endpoint != 0) {
     40        if (transfer->batch->ep->target.endpoint != 0) {
    4041                return false;
    4142        }
     
    8081                if (dir == USB_DIRECTION_IN) {
    8182                        rc = usbvirt_data_in(dev, batch->ep->transfer_type,
    82                             batch->ep->endpoint,
     83                            batch->ep->target.endpoint,
    8384                            batch->buffer, batch->buffer_size,
    8485                            actual_data_size);
     
    8687                        assert(dir == USB_DIRECTION_OUT);
    8788                        rc = usbvirt_data_out(dev, batch->ep->transfer_type,
    88                             batch->ep->endpoint,
     89                            batch->ep->target.endpoint,
    8990                            batch->buffer, batch->buffer_size);
    9091                }
     
    115116        } else {
    116117                if (dir == USB_DIRECTION_IN) {
    117                         rc = usbvirt_ipc_send_data_in(sess, batch->ep->endpoint,
     118                        rc = usbvirt_ipc_send_data_in(sess, batch->ep->target.endpoint,
    118119                            batch->ep->transfer_type,
    119120                            batch->buffer, batch->buffer_size,
     
    121122                } else {
    122123                        assert(dir == USB_DIRECTION_OUT);
    123                         rc = usbvirt_ipc_send_data_out(sess, batch->ep->endpoint,
     124                        rc = usbvirt_ipc_send_data_out(sess, batch->ep->target.endpoint,
    124125                            batch->ep->transfer_type,
    125126                            batch->buffer, batch->buffer_size);
     
    159160        list_initialize(&instance->devices);
    160161        fibril_mutex_initialize(&instance->guard);
     162        usb2_bus_init(&instance->bus, BANDWIDTH_AVAILABLE_USB11, bandwidth_count_usb11);
    161163        instance->magic = 0xDEADBEEF;
    162164        return virthub_init(&instance->hub, "root hub");
     
    182184        list_foreach(vhc->devices, link, vhc_virtdev_t, dev) {
    183185                fibril_mutex_lock(&dev->guard);
    184                 if (dev->address == transfer->batch->ep->address) {
     186                if (dev->address == transfer->batch->ep->target.address) {
    185187                        if (!targets) {
    186188                                list_append(&transfer->link, &dev->transfer_queue);
  • uspace/drv/bus/usb/vhc/vhcd.h

    r741bcdeb rc0e4b5b2  
    4242
    4343#include <usb/host/hcd.h>
     44#include <usb/host/usb2_bus.h>
    4445
    4546#define NAME "vhc"
     
    6061        fibril_mutex_t guard;
    6162        usbvirt_device_t hub;
     63        usb2_bus_t bus;
    6264} vhc_data_t;
    6365
Note: See TracChangeset for help on using the changeset viewer.