Changeset c6f82e5 in mainline for uspace/lib/usbhost/src/endpoint.c


Ignore:
Timestamp:
2018-01-19T20:56:14Z (7 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7ec7b7e
Parents:
69b2dfee
Message:

libusbhost: do not try to handle the toggle bit in a generic way

File:
1 edited

Legend:

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

    r69b2dfee rc6f82e5  
    121121}
    122122
    123 static void endpoint_toggle_reset(endpoint_t *ep, toggle_reset_mode_t mode);
    124 
    125123/**
    126124 * Wait until the endpoint have no transfer scheduled.
     
    166164        assert(ep);
    167165        assert(fibril_mutex_is_locked(&ep->guard));
    168 
    169         if (ep->active_batch && ep->active_batch->error == EOK)
    170                 endpoint_toggle_reset(ep, ep->active_batch->toggle_reset_mode);
    171 
    172166        ep->active_batch = NULL;
    173167        fibril_condvar_signal(&ep->avail);
    174 }
    175 
    176 /**
    177  * The transfer on an endpoint can trigger a reset of the toggle bit. This
    178  * function calls the respective bus callbacks to resolve it.
    179  *
    180  * @param ep The endpoint that triggered the reset
    181  * @param mode Whether to reset no, one or all endpoints on a device.
    182  */
    183 static void endpoint_toggle_reset(endpoint_t *ep, toggle_reset_mode_t mode)
    184 {
    185         assert(ep);
    186 
    187         if (mode == RESET_NONE)
    188                 return;
    189 
    190         const bus_ops_t *ops = BUS_OPS_LOOKUP(get_bus_ops(ep), endpoint_toggle_reset);
    191         if (!ops)
    192                 return;
    193 
    194 
    195         if (mode == RESET_ALL) {
    196                 const device_t *dev = ep->device;
    197                 for (usb_endpoint_t i = 0; i < USB_ENDPOINT_MAX; ++i) {
    198                         if (dev->endpoints[i])
    199                                 ops->endpoint_toggle_reset(dev->endpoints[i]);
    200                 }
    201         } else {
    202                 ops->endpoint_toggle_reset(ep);
    203         }
    204168}
    205169
     
    282246        batch->on_complete_data = arg;
    283247
    284         /* Check for commands that reset toggle bit */
    285         if (ep->transfer_type == USB_TRANSFER_CONTROL)
    286                 batch->toggle_reset_mode
    287                         = hc_get_request_toggle_reset_mode(&batch->setup.packet);
    288 
    289248        const int ret = ops->batch_schedule(batch);
    290249        if (ret != EOK) {
Note: See TracChangeset for help on using the changeset viewer.