Changeset 83c3123 in mainline for uspace/lib/usbhost/src/iface.c


Ignore:
Timestamp:
2011-10-27T11:40:06Z (14 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7265558
Parents:
4267908
Message:

libusbhost: Store bandwidth in endpoint structure.

Remove redundant node_t tructure and use endpoint_t directly.

File:
1 edited

Legend:

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

    r4267908 r83c3123  
    4949        assert(hcd);
    5050
    51         int ret;
    52 
    53         size_t res_bw;
    5451        endpoint_t *ep = usb_endpoint_manager_get_ep(&hcd->ep_manager,
    55             target.address, target.endpoint, direction, &res_bw);
     52            target.address, target.endpoint, direction);
    5653        if (ep == NULL) {
    5754                usb_log_error("Endpoint(%d:%d) not registered for %s.\n",
     
    6562        const size_t bw = bandwidth_count_usb11(
    6663            ep->speed, ep->transfer_type, size, ep->max_packet_size);
    67         if (res_bw < bw) {
     64        /* Check if we have enough bandwidth reserved */
     65        if (ep->bandwidth < bw) {
    6866                usb_log_error("Endpoint(%d:%d) %s needs %zu bw "
    6967                    "but only %zu is reserved.\n",
    70                     target.address, target.endpoint, name, bw, res_bw);
     68                    ep->address, ep->endpoint, name, bw, ep->bandwidth);
    7169                return ENOSPC;
    7270        }
     
    8482        }
    8583
    86         ret = hcd->schedule(hcd, batch);
     84        const int ret = hcd->schedule(hcd, batch);
    8785        if (ret != EOK)
    8886                usb_transfer_batch_dispose(batch);
     
    190188            max_packet_size, interval);
    191189
    192         endpoint_t *ep = endpoint_get(
    193             address, endpoint, direction, transfer_type, speed, max_packet_size);
     190        endpoint_t *ep =
     191            endpoint_create(address, endpoint, direction, transfer_type,
     192                speed, max_packet_size, 0);
    194193        if (!ep)
    195194                return ENOMEM;
Note: See TracChangeset for help on using the changeset viewer.