Changeset fc0271a5 in mainline for uspace/lib/usbhost/src/bandwidth.c


Ignore:
Timestamp:
2017-10-12T16:06:37Z (8 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f9d787c
Parents:
d0db4a0
Message:

WIP usbhost refactoring: uhci converted

File:
1 edited

Legend:

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

    rd0db4a0 rfc0271a5  
    3535
    3636#include <usb/host/bandwidth.h>
     37#include <usb/host/endpoint.h>
    3738
    3839#include <assert.h>
     
    4647 * @param max_packet_size Maximum bytes in one packet.
    4748 */
    48 size_t bandwidth_count_usb11(usb_speed_t speed, usb_transfer_type_t type,
    49     size_t size, size_t max_packet_size)
     49size_t bandwidth_count_usb11(endpoint_t *ep, size_t size)
    5050{
     51        assert(ep);
     52
     53        const usb_transfer_type_t type = ep->transfer_type;
     54
    5155        /* We care about bandwidth only for interrupt and isochronous. */
    5256        if ((type != USB_TRANSFER_INTERRUPT)
     
    5559        }
    5660
     61        const size_t max_packet_size = ep->max_packet_size;
     62
    5763        const unsigned packet_count =
    5864            (size + max_packet_size - 1) / max_packet_size;
     
    6066         * transaction, but I did not find text in USB spec to confirm this */
    6167        /* NOTE: All data packets will be considered to be max_packet_size */
    62         switch (speed)
     68        switch (ep->speed)
    6369        {
    6470        case USB_SPEED_LOW:
     
    94100 * @param max_packet_size Maximum bytes in one packet.
    95101 */
    96 size_t bandwidth_count_usb20(usb_speed_t speed, usb_transfer_type_t type,
    97     size_t size, size_t max_packet_size)
     102size_t bandwidth_count_usb20(endpoint_t *ep, size_t size)
    98103{
     104        assert(ep);
     105
     106        const usb_transfer_type_t type = ep->transfer_type;
     107
    99108        /* We care about bandwidth only for interrupt and isochronous. */
    100109        if ((type != USB_TRANSFER_INTERRUPT)
Note: See TracChangeset for help on using the changeset viewer.