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

Changeset 4c25c2f in mainline


Ignore:
Timestamp:
2018-01-15T15:02:57Z (4 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master
Children:
745a3f1
Parents:
01d9707
Message:

usbhost: move managing TT to the library

Location:
uspace
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ehci/hw_struct/queue_head.c

    r01d9707 r4c25c2f  
    8383        uint32_t ep_cap = QH_EP_CAP_C_MASK_SET(3 << 2) |
    8484                    QH_EP_CAP_MULTI_SET(ep->packets_per_uframe);
    85         if (ep->device->speed != USB_SPEED_HIGH) {
     85        if (usb_speed_is_11(ep->device->speed)) {
     86                assert(ep->device->tt.dev != NULL);
    8687                ep_cap |=
    8788                    QH_EP_CAP_TT_PORT_SET(ep->device->tt.port) |
    88                     QH_EP_CAP_TT_ADDR_SET(ep->device->tt.address);
     89                    QH_EP_CAP_TT_ADDR_SET(ep->device->tt.dev->address);
    8990        }
    9091        if (ep->transfer_type == USB_TRANSFER_INTERRUPT) {
  • uspace/drv/bus/usb/xhci/bus.c

    r01d9707 r4c25c2f  
    149149        xhci_device_t *xhci_dev = xhci_device_get(dev);
    150150
    151         hcd_setup_device_tt(dev);
    152 
    153151        /* Calculate route string */
    154152        xhci_device_t *xhci_hub = xhci_device_get(dev->hub);
  • uspace/lib/drv/include/usb_iface.h

    r01d9707 r4c25c2f  
    6767typedef int16_t usb_address_t;
    6868
    69 /** USB address for the purposes of Transaction Translation.
    70  */
    71 typedef struct {
    72         usb_address_t address;
    73         unsigned port;
    74 } usb_tt_address_t;
    75 
    7669/** USB transfer type. */
    7770typedef enum {
  • uspace/lib/usbhost/include/usb/host/bus.h

    r01d9707 r4c25c2f  
    7171
    7272        /* Transaction translator */
    73         usb_tt_address_t tt;
     73        struct {
     74                device_t *dev;
     75                unsigned port;
     76        } tt;
    7477
    7578        /* The following are not set by the library */
  • uspace/lib/usbhost/include/usb/host/hcd.h

    r01d9707 r4c25c2f  
    114114 */
    115115extern int hcd_get_ep0_max_packet_size(uint16_t *, bus_t *, device_t *);
    116 extern void hcd_setup_device_tt(device_t *);
    117116
    118117/** How many toggles need to be reset */
  • uspace/lib/usbhost/src/bus.c

    r01d9707 r4c25c2f  
    9797
    9898/**
     99 * Setup devices Transaction Translation.
     100 *
     101 * This applies for Low/Full speed devices under High speed hub only. Other
     102 * devices just inherit TT from the hub.
     103 *
     104 * Roothub must be handled specially.
     105 */
     106static void device_setup_tt(device_t *dev)
     107{
     108        if (!dev->hub)
     109                return;
     110
     111        if (dev->hub->speed == USB_SPEED_HIGH && usb_speed_is_11(dev->speed)) {
     112                /* For LS devices under HS hub */
     113                dev->tt.dev = dev->hub;
     114                dev->tt.port = dev->port;
     115        }
     116        else {
     117                /* Inherit hub's TT */
     118                dev->tt = dev->hub->tt;
     119        }
     120}
     121
     122/**
    99123 * Invoke the device_enumerate bus operation.
    100124 *
     
    111135        if (dev->online)
    112136                return EINVAL;
     137
     138        device_setup_tt(dev);
    113139
    114140        const int r = ops->device_enumerate(dev);
  • uspace/lib/usbhost/src/hcd.c

    r01d9707 r4c25c2f  
    426426        }
    427427        return EOK;
    428 }
    429 
    430 /**
    431  * Setup devices Transaction Translation.
    432  *
    433  * This applies for Low/Full speed devices under High speed hub only. Other
    434  * devices just inherit TT from the hub.
    435  *
    436  * Roothub must be handled specially.
    437  */
    438 void hcd_setup_device_tt(device_t *dev)
    439 {
    440         if (!dev->hub)
    441                 return;
    442 
    443         if (dev->hub->speed == USB_SPEED_HIGH && usb_speed_is_11(dev->speed)) {
    444                 /* For LS devices under HS hub */
    445                 dev->tt.address = dev->hub->address;
    446                 dev->tt.port = dev->port;
    447         }
    448         else {
    449                 /* Inherit hub's TT */
    450                 dev->tt = dev->hub->tt;
    451         }
    452428}
    453429
  • uspace/lib/usbhost/src/usb2_bus.c

    r01d9707 r4c25c2f  
    196196        usb_log_debug("Found new %s speed USB device.", usb_str_speed(dev->speed));
    197197
    198         if (!dev->hub) {
    199                 /* The device is the roothub */
    200                 dev->tt = (usb_tt_address_t) {
    201                         .address = -1,
    202                         .port = 0,
    203                 };
    204         } else {
    205                 hcd_setup_device_tt(dev);
    206         }
    207 
    208198        /* Assign an address to the device */
    209199        if ((err = address_device(dev))) {
Note: See TracChangeset for help on using the changeset viewer.