Changeset 32fb6bce in mainline for uspace/lib/usbhost/src/usb2_bus.c


Ignore:
Timestamp:
2017-12-18T22:50:21Z (8 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7f70d1c
Parents:
1ea0bbf
git-author:
Ondřej Hlavatý <aearsis@…> (2017-12-18 22:04:50)
git-committer:
Ondřej Hlavatý <aearsis@…> (2017-12-18 22:50:21)
Message:

usbhost: refactoring

This commit moves interrupt, status and schedule to bus
operations. Then the purpose of hcd_t is better defined, and split into
hc_driver_t and hc_device_t. hc_driver_t is used to wrap driver
implementation by the library (similar to how usb_driver_t is used to
wrap usb device drivers). hc_device_t is used as a parent for hc_t
inside drivers, and is allocated inside the DDF device node.

To support these changes, some local identifiers were renamed, some
functions were moved and/or renamed and their arguments changed. The
most notable one being hcd_send_batch → bus_device_send_batch.

File:
1 edited

Legend:

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

    r1ea0bbf r32fb6bce  
    205205
    206206        usb2_bus_t *bus = (usb2_bus_t *) dev->bus;
    207         hcd_t *hcd = (hcd_t *) bus->base.hcd;
    208207
    209208        /* The default address is currently reserved for this device */
     
    231230
    232231        uint16_t max_packet_size;
    233         if ((err = hcd_get_ep0_max_packet_size(&max_packet_size, hcd, dev)))
     232        if ((err = hcd_get_ep0_max_packet_size(&max_packet_size, &bus->base, dev)))
    234233                goto err_address;
    235234
     
    238237
    239238        usb_log_debug("Device(%d): Setting USB address.", address);
    240         err = hcd_send_batch_sync(hcd, dev, usb2_default_target, USB_DIRECTION_OUT,
     239        err = bus_device_send_batch_sync(dev, usb2_default_target, USB_DIRECTION_OUT,
    241240            NULL, 0, *(uint64_t *)&set_address, "set address");
    242241        if (err != 0) {
     
    315314
    316315        /* Read the device descriptor, derive the match ids */
    317         if ((err = hcd_ddf_device_explore(dev))) {
     316        if ((err = hcd_device_explore(dev))) {
    318317                usb_log_error("Device(%d): Failed to explore device: %s", dev->address, str_error(err));
    319318                release_address(bus, dev->address);
     
    463462 * @return Error code.
    464463 */
    465 int usb2_bus_init(usb2_bus_t *bus, hcd_t *hcd, size_t available_bandwidth)
     464int usb2_bus_init(usb2_bus_t *bus, size_t available_bandwidth)
    466465{
    467466        assert(bus);
    468467
    469         bus_init(&bus->base, hcd, sizeof(device_t));
     468        bus_init(&bus->base, sizeof(device_t));
    470469        bus->base.ops = &usb2_bus_ops;
    471470
Note: See TracChangeset for help on using the changeset viewer.