Changeset 6832245 in mainline for uspace/drv/bus/usb/xhci/endpoint.c


Ignore:
Timestamp:
2017-12-14T23:01:57Z (6 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
837d53d
Parents:
bd05140
git-author:
Ondřej Hlavatý <aearsis@…> (2017-12-14 23:01:54)
git-committer:
Ondřej Hlavatý <aearsis@…> (2017-12-14 23:01:57)
Message:

usbhost bus: refactor the bus ops

This way, method names better represent the entity it is working with.
Their semantics was shifted a bit.

Regarding the tree of structures:

bus ← device ← endpoint ← batch

Previously, devices were kept in DDF function nodes, and endpoints had
pointer to the bus and device. Now, devices have pointer to bus,
endpoints don't.

Pointer to hcd_t in bus is WIP, and will be removed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/xhci/endpoint.c

    rbd05140 r6832245  
    4545#include "endpoint.h"
    4646
    47 int xhci_endpoint_init(xhci_endpoint_t *xhci_ep, xhci_bus_t *xhci_bus)
     47int xhci_endpoint_init(xhci_endpoint_t *xhci_ep, device_t *dev, const usb_endpoint_desc_t *desc)
    4848{
    4949        assert(xhci_ep);
    50         assert(xhci_bus);
    51 
    52         bus_t *bus = &xhci_bus->base;
     50
    5351        endpoint_t *ep = &xhci_ep->base;
    5452
    55         endpoint_init(ep, bus);
     53        endpoint_init(ep, dev, desc);
     54
     55        xhci_ep->max_streams = desc->usb3.max_streams;
     56        xhci_ep->max_burst = desc->usb3.max_burst;
     57        xhci_ep->mult = desc->usb3.mult;
     58
     59        if (xhci_ep->base.transfer_type == USB_TRANSFER_ISOCHRONOUS) {
     60                xhci_ep->isoch_max_size = desc->usb3.bytes_per_interval
     61                        ? desc->usb3.bytes_per_interval
     62                        : desc->max_packet_size * (desc->packets + 1);
     63                /* Technically there could be superspeed plus too. */
     64
     65                /* Allocate and setup isochronous-specific structures. */
     66                xhci_ep->isoch_enqueue = 0;
     67                xhci_ep->isoch_dequeue = XHCI_ISOCH_BUFFER_COUNT - 1;
     68                xhci_ep->isoch_started = false;
     69
     70                fibril_mutex_initialize(&xhci_ep->isoch_guard);
     71                fibril_condvar_initialize(&xhci_ep->isoch_avail);
     72        }
    5673
    5774        return EOK;
Note: See TracChangeset for help on using the changeset viewer.