Changeset ff14aede in mainline


Ignore:
Timestamp:
2017-11-20T12:24:05Z (6 years ago)
Author:
Aearsis <Hlavaty.Ondrej@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
888238e9
Parents:
306a36d
Message:

usbhost: move TT management to library

Location:
uspace
Files:
4 edited

Legend:

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

    r306a36d rff14aede  
    152152        xhci_device_t *xhci_dev = xhci_device_get(dev);
    153153
    154         /* Manage TT */
    155         if (dev->hub->speed == USB_SPEED_HIGH && usb_speed_is_11(dev->speed)) {
    156                 /* For LS devices under HS hub */
    157                 /* TODO: How about SS hubs? */
    158                 dev->tt.address = dev->hub->address;
    159                 dev->tt.port = dev->port;
    160         }
    161         else {
    162                 /* Inherit hub's TT */
    163                 dev->tt = dev->hub->tt;
    164         }
     154        hcd_setup_device_tt(dev);
    165155
    166156        /* Calculate route string */
  • uspace/lib/usbhost/include/usb/host/hcd.h

    r306a36d rff14aede  
    103103
    104104extern int hcd_get_ep0_max_packet_size(uint16_t *, hcd_t *, device_t *);
     105extern void hcd_setup_device_tt(device_t *);
    105106
    106107extern int hcd_send_batch(hcd_t *, device_t *, usb_target_t,
  • uspace/lib/usbhost/src/hcd.c

    r306a36d rff14aede  
    107107}
    108108
     109/**
     110 * Setup devices Transaction Translation.
     111 *
     112 * This applies for Low/Full speed devices under High speed hub only. Other
     113 * devices just inherit TT from the hub.
     114 *
     115 * Roothub must be handled specially.
     116 */
     117void hcd_setup_device_tt(device_t *dev)
     118{
     119        if (!dev->hub)
     120                return;
     121
     122        if (dev->hub->speed == USB_SPEED_HIGH && usb_speed_is_11(dev->speed)) {
     123                /* For LS devices under HS hub */
     124                dev->tt.address = dev->hub->address;
     125                dev->tt.port = dev->port;
     126        }
     127        else {
     128                /* Inherit hub's TT */
     129                dev->tt = dev->hub->tt;
     130        }
     131}
    109132
    110133/** Prepare generic usb_transfer_batch and schedule it.
  • uspace/lib/usbhost/src/usb2_bus.c

    r306a36d rff14aede  
    199199        usb_log_debug("Found new %s speed USB device.", usb_str_speed(dev->speed));
    200200
    201         if (dev->hub) {
    202                 /* Manage TT */
    203                 if (dev->hub->speed == USB_SPEED_HIGH && usb_speed_is_11(dev->speed)) {
    204                         /* For LS devices under HS hub */
    205                         /* TODO: How about SS hubs? */
    206                         dev->tt.address = dev->hub->address;
    207                         dev->tt.port = dev->port;
    208                 }
    209                 else {
    210                         /* Inherit hub's TT */
    211                         dev->tt = dev->hub->tt;
    212                 }
    213         }
    214         else {
     201        if (!dev->hub) {
     202                /* The device is the roothub */
    215203                dev->tt = (usb_tt_address_t) {
    216204                        .address = -1,
    217205                        .port = 0,
    218206                };
     207        } else {
     208                hcd_setup_device_tt(dev);
    219209        }
    220210
Note: See TracChangeset for help on using the changeset viewer.