Changeset 5e2b1ae6 in mainline for uspace/drv


Ignore:
Timestamp:
2018-01-07T01:54:45Z (8 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3dc3f99
Parents:
63431db2
Message:

usbhost: reserve default speed in library

Location:
uspace/drv/bus/usb
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/uhci/hc.c

    r63431db2 r5e2b1ae6  
    388388int hc_init_mem_structures(hc_t *instance, hc_device_t *hcd)
    389389{
    390         int err;
    391390        assert(instance);
    392391
    393         if ((err = usb2_bus_init(&instance->bus, BANDWIDTH_AVAILABLE_USB11)))
    394                 return err;
     392        usb2_bus_init(&instance->bus, BANDWIDTH_AVAILABLE_USB11);
    395393
    396394        bus_t *bus = (bus_t *) &instance->bus;
  • uspace/drv/bus/usb/usbhub/port.c

    r63431db2 r5e2b1ae6  
    406406
    407407        /* Reserve default address */
    408         while ((ret = usbhc_reserve_default_address(exch, speed)) == ENOENT) {
     408        while ((ret = usbhc_reserve_default_address(exch, speed)) == EAGAIN) {
    409409                async_usleep(1000000);
    410410        }
  • uspace/drv/bus/usb/xhci/bus.c

    r63431db2 r5e2b1ae6  
    426426}
    427427
    428 static int reserve_default_address(bus_t *bus_base, usb_speed_t speed)
    429 {
    430         xhci_bus_t *xhci_bus = bus_to_xhci_bus(bus_base);
    431 
    432         if (xhci_bus->default_address_speed != USB_SPEED_MAX)
    433                 /* Already allocated */
    434                 return ENOENT;
    435 
    436         xhci_bus->default_address_speed = speed;
    437         return EOK;
    438 }
    439 
    440 static int release_default_address(bus_t *bus_base)
    441 {
    442         xhci_bus_t *xhci_bus = bus_to_xhci_bus(bus_base);
    443 
    444         xhci_bus->default_address_speed = USB_SPEED_MAX;
    445         return EOK;
    446 }
    447 
    448428static usb_transfer_batch_t *batch_create(endpoint_t *ep)
    449429{
     
    461441// TODO: Is it good idea to use this macro? It blurrs the fact that the callbacks and static functions are called the same.
    462442#define BIND_OP(op) .op = op,
    463         BIND_OP(reserve_default_address)
    464         BIND_OP(release_default_address)
    465 
    466443        BIND_OP(device_enumerate)
    467444        BIND_OP(device_remove)
     
    501478        bus->hc = hc;
    502479        bus->base.ops = &xhci_bus_ops;
    503         bus->default_address_speed = USB_SPEED_MAX;
    504480        return EOK;
    505481}
  • uspace/drv/bus/usb/xhci/bus.h

    r63431db2 r5e2b1ae6  
    5151
    5252        xhci_device_t **devices_by_slot;        /**< Devices by Slot ID */
    53 
    54         usb_speed_t default_address_speed;      /**< Used to get speed from usb hubs */
    5553} xhci_bus_t;
    5654
Note: See TracChangeset for help on using the changeset viewer.