Changeset fc0271a5 in mainline for uspace/lib/usbhost


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

Location:
uspace/lib/usbhost
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbhost/include/usb/host/bandwidth.h

    rd0db4a0 rfc0271a5  
    4949#define BANDWIDTH_AVAILABLE_USB20  1
    5050
    51 extern size_t bandwidth_count_usb11(usb_speed_t, usb_transfer_type_t, size_t, size_t);
     51typedef struct endpoint endpoint_t;
    5252
    53 extern size_t bandwidth_count_usb20(usb_speed_t, usb_transfer_type_t, size_t, size_t);
     53extern size_t bandwidth_count_usb11(endpoint_t *, size_t);
     54
     55extern size_t bandwidth_count_usb20(endpoint_t *, size_t);
    5456
    5557#endif
  • uspace/lib/usbhost/include/usb/host/hcd.h

    rd0db4a0 rfc0271a5  
    5858        /** Transfer scheduling, implement in device driver. */
    5959        schedule_hook_t schedule;
    60         /** Hook called upon registering new endpoint. */
    61         ep_add_hook_t ep_add_hook;
    62         /** Hook called upon removing of an endpoint. */
    63         ep_remove_hook_t ep_remove_hook;
    6460        /** Hook to be called on device interrupt, passes ARG1 */
    6561        interrupt_hook_t irq_hook;
  • uspace/lib/usbhost/include/usb/host/usb2_bus.h

    rd0db4a0 rfc0271a5  
    5050/** Endpoint management structure */
    5151typedef struct usb2_bus {
    52         bus_t bus;                      /**< Inheritance - keep this first */
     52        bus_t base;                     /**< Inheritance - keep this first */
    5353
    5454        /* Device bookkeeping */
  • 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)
  • uspace/lib/usbhost/src/usb2_bus.c

    rd0db4a0 rfc0271a5  
    291291        assert(bus);
    292292
    293         bus_init(&bus->bus, hcd);
    294 
    295         bus->bus.ops = usb2_bus_ops;
    296         bus->bus.ops.count_bw = count_bw;
     293        bus_init(&bus->base, hcd);
     294
     295        bus->base.ops = usb2_bus_ops;
     296        bus->base.ops.count_bw = count_bw;
    297297
    298298        bus->free_bw = available_bandwidth;
Note: See TracChangeset for help on using the changeset viewer.