Changeset 327f147 in mainline for uspace/lib/usbhost/src/usb2_bus.c


Ignore:
Timestamp:
2017-10-23T19:03:37Z (7 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b724494
Parents:
e160bfe8
Message:

usbhost: change parameters of methods

Pass (device_t, usb_target_t) to read and write, which finally allows to drop hash tables and access device right away. Then, all callbacks to complete transfer now uses usb_transfer_batch. This requires libdrv to include libusbhost, but it is not linked against it - it is there only to share definition of usb_transfer_batch_t.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbhost/src/usb2_bus.c

    re160bfe8 r327f147  
    126126        usb_log_debug("Device(%d): Requesting first 8B of device descriptor.",
    127127            address);
    128         ssize_t got = hcd_send_batch_sync(hcd, default_target, USB_DIRECTION_IN,
    129             &desc, CTRL_PIPE_MIN_PACKET_SIZE, *(uint64_t *)&get_device_desc_8,
     128        ssize_t got = hcd_send_batch_sync(hcd, dev, default_target, USB_DIRECTION_IN,
     129            (char *) &desc, CTRL_PIPE_MIN_PACKET_SIZE, *(uint64_t *)&get_device_desc_8,
    130130            "read first 8 bytes of dev descriptor");
    131131
     
    141141
    142142        usb_log_debug("Device(%d): Setting USB address.", address);
    143         err = hcd_send_batch_sync(hcd, default_target, USB_DIRECTION_OUT,
     143        err = hcd_send_batch_sync(hcd, dev, default_target, USB_DIRECTION_OUT,
    144144            NULL, 0, *(uint64_t *)&set_address, "set address");
    145145        if (err != 0) {
     
    163163        }
    164164
    165         bus_remove_ep(bus, default_target, USB_DIRECTION_BOTH);
     165        bus_remove_ep(bus, dev, default_target, USB_DIRECTION_BOTH);
    166166        return EOK;
    167167
    168168err_default_target:
    169         bus_remove_ep(bus, default_target, USB_DIRECTION_BOTH);
     169        bus_remove_ep(bus, dev, default_target, USB_DIRECTION_BOTH);
    170170err_address:
    171171        bus_release_address(bus, address);
     
    247247 * @note Assumes that the internal mutex is locked.
    248248 */
    249 static endpoint_t *usb2_bus_find_ep(bus_t *bus_base, usb_target_t target, usb_direction_t direction)
     249static endpoint_t *usb2_bus_find_ep(bus_t *bus_base, device_t *device, usb_target_t target, usb_direction_t direction)
    250250{
    251251        usb2_bus_t *bus = bus_to_usb2_bus(bus_base);
     
    293293
    294294        /* Check for existence */
    295         if (usb2_bus_find_ep(bus_base, ep->target, ep->direction))
     295        if (usb2_bus_find_ep(bus_base, ep->device, ep->target, ep->direction))
    296296                return EEXIST;
    297297
Note: See TracChangeset for help on using the changeset viewer.