Changeset a5b3de6 in mainline for uspace/lib/usbhost/src


Ignore:
Timestamp:
2017-10-25T11:55:15Z (8 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2b35478
Parents:
c3d926f3
Message:

usbhost endpoint: removed target

The reasons for having usb_target_t inside endpoint have been dismissed. Enpoint is not a target of a transaction, so this was just misleading.

Location:
uspace/lib/usbhost/src
Files:
3 edited

Legend:

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

    rc3d926f3 ra5b3de6  
    109109                usb_log_error("Endpoint(%d:%d) %s needs %zu bw "
    110110                    "but only %zu is reserved.\n",
    111                     ep->target.address, ep->target.endpoint, name, bw, ep->bandwidth);
     111                    device->address, ep->endpoint, name, bw, ep->bandwidth);
    112112                return ENOSPC;
    113113        }
     
    119119        }
    120120
     121        batch->target = target;
    121122        batch->buffer = data;
    122123        batch->buffer_size = size;
  • uspace/lib/usbhost/src/usb2_bus.c

    rc3d926f3 ra5b3de6  
    273273        usb2_bus_t *bus = bus_to_usb2_bus(bus_base);
    274274
    275         if (!usb_address_is_valid(target.address))
    276                 return NULL;
     275        assert(device->address == target.address);
    277276
    278277        list_foreach(*get_list(bus, target.address), link, endpoint_t, ep) {
     
    280279                       || (ep->direction == USB_DIRECTION_BOTH)
    281280                       || (direction == USB_DIRECTION_BOTH))
    282                     && (target.packed == ep->target.packed))
     281                    && (target.endpoint == ep->endpoint))
    283282                        return ep;
    284283        }
     
    296295}
    297296
     297static usb_target_t usb2_ep_to_target(endpoint_t *ep)
     298{
     299        assert(ep);
     300        assert(ep->device);
     301
     302        return (usb_target_t) {{
     303                .address = ep->device->address,
     304                .endpoint = ep->endpoint,
     305        }};
     306}
     307
    298308/** Register an endpoint to the bus. Reserves bandwidth.
    299309 * @param bus usb_bus structure, non-null.
     
    308318
    309319        /* Extract USB2-related information from endpoint_desc */
    310         ep->target = (usb_target_t) {{
    311                 .address = ep->device->address,
    312                 .endpoint = desc->endpoint_no,
    313         }};
     320        ep->endpoint = desc->endpoint_no;
    314321        ep->direction = desc->direction;
    315322        ep->transfer_type = desc->transfer_type;
     
    320327
    321328        /* Check for existence */
    322         if (usb2_bus_find_ep(bus_base, ep->device, ep->target, ep->direction))
     329        if (usb2_bus_find_ep(bus_base, ep->device, usb2_ep_to_target(ep), ep->direction))
    323330                return EEXIST;
    324331
     
    356363
    357364        list_foreach(*get_list(bus, target.address), link, endpoint_t, ep) {
    358                 if ((ep->target.address == target.address)
    359                     && (all || ep->target.endpoint == target.endpoint)) {
     365                assert(ep->device->address == target.address);
     366
     367                if (all || ep->endpoint == target.endpoint) {
    360368                        endpoint_toggle_set(ep, 0);
    361369                        ret = EOK;
     
    386394                endpoint_t *ep = list_get_instance(link, endpoint_t, link);
    387395                link = list_next(link, list);
    388                 assert(ep->target.address == address);
     396
     397                assert(ep->device->address == address);
    389398                list_remove(&ep->link);
    390399
    391400                usb_log_warning("Endpoint %d:%d %s was left behind, removing.\n",
    392                     ep->target.address, ep->target.endpoint, usb_str_direction(ep->direction));
     401                    address, ep->endpoint, usb_str_direction(ep->direction));
    393402
    394403                /* Drop bus reference */
  • uspace/lib/usbhost/src/usb_transfer_batch.c

    rc3d926f3 ra5b3de6  
    8181
    8282        if (batch->error == EOK && batch->toggle_reset_mode != RESET_NONE) {
    83                 usb_log_debug2("Reseting %s due to transaction of %d:%d.\n",
    84                     batch->toggle_reset_mode == RESET_ALL ? "all EPs toggle" : "EP toggle",
    85                     batch->ep->target.address, batch->ep->target.endpoint);
    86                 bus_reset_toggle(batch->ep->bus,
    87                     batch->ep->target, batch->toggle_reset_mode == RESET_ALL);
     83                usb_log_debug2("Batch %p " USB_TRANSFER_BATCH_FMT " resets %s",
     84                    batch, USB_TRANSFER_BATCH_ARGS(*batch),
     85                    batch->toggle_reset_mode == RESET_ALL ? "all EPs toggle" : "EP toggle");
     86                bus_reset_toggle(batch->ep->bus, 
     87                    batch->target, batch->toggle_reset_mode == RESET_ALL);
    8888        }
    8989
Note: See TracChangeset for help on using the changeset viewer.