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


Ignore:
Timestamp:
2017-11-20T19:14:31Z (7 years ago)
Author:
Salmelu <salmelu@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
27b0ea0
Parents:
d3086873
Message:

Isochronous transfers - endpoint initialization

File:
1 edited

Legend:

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

    rd3086873 r6b433a8  
    193193}
    194194
     195static int xhci_isoch_alloc_transfers(xhci_endpoint_t *xhci_ep) {
     196        int i = 0;
     197        int err = EOK;
     198        while (i < XHCI_ISOCH_BUFFER_COUNT) {
     199                xhci_isoch_transfer_t *transfer = xhci_ep->isoch_transfers[i];
     200                if (dma_buffer_alloc(&transfer->data, xhci_ep->isoch_max_size)) {
     201                        err = ENOMEM;
     202                        break;
     203                }
     204                transfer->size = 0;
     205                ++i;
     206        }
     207
     208        if (err) {
     209                --i;
     210                while(i >= 0) {
     211                        dma_buffer_free(&xhci_ep->isoch_transfers[i]->data);
     212                        --i;
     213                }
     214        }
     215
     216        return err;
     217}
     218
    195219int xhci_endpoint_alloc_transfer_ds(xhci_endpoint_t *xhci_ep)
    196220{
     
    203227        if ((err = xhci_trb_ring_init(&xhci_ep->ring))) {
    204228                return err;
     229        }
     230
     231        if (xhci_ep->base.transfer_type == USB_TRANSFER_ISOCHRONOUS) {
     232                if((err = xhci_isoch_alloc_transfers(xhci_ep))) {
     233                        xhci_trb_ring_fini(&xhci_ep->ring);
     234                        return err;
     235                }
    205236        }
    206237
     
    289320        XHCI_EP_TR_DPTR_SET(*ctx, ep->ring.dequeue);
    290321        XHCI_EP_DCS_SET(*ctx, 1);
    291         // TODO: max ESIT payload
     322
     323        XHCI_EP_MAX_ESIT_PAYLOAD_LO_SET(*ctx, ep->isoch_max_size & 0xFFFF);
     324        XHCI_EP_MAX_ESIT_PAYLOAD_HI_SET(*ctx, (ep->isoch_max_size >> 16) & 0xFF);
    292325}
    293326
Note: See TracChangeset for help on using the changeset viewer.