Fork us on GitHub Follow us on Facebook Follow us on Twitter

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


Ignore:
Timestamp:
2017-10-29T11:53:45Z (4 years ago)
Author:
Petr Manek <petr.manek@…>
Branches:
lfn, master
Children:
a312d8f
Parents:
d33dc78
Message:

Added memory structure for stream TRB rings. Implemented their initialization. Fixed white space.

File:
1 edited

Legend:

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

    rd33dc78 ref1a3a8  
    116116static void initialize_primary_streams(xhci_hc_t *hc, xhci_endpoint_t *xhci_ep, unsigned count) {
    117117        for (size_t index = 0; index < count; ++index) {
    118                 // Create trb ring for every primary stream
    119                 // Store it somewhere
    120                 // Set the dequeue pointer in stream context structure
    121 
    122                 // Set to linear stream array
    123                 XHCI_STREAM_SCT_SET(xhci_ep->primary_stream_ctx_array[index], 1);
     118                xhci_stream_ctx_t *ctx = &xhci_ep->primary_stream_ctx_array[index];
     119                xhci_trb_ring_t *ring = &xhci_ep->primary_stream_rings[index];
     120
     121                /* Init and register TRB ring for every primary stream */
     122                xhci_trb_ring_init(ring);
     123                XHCI_STREAM_DEQ_PTR_SET(*ctx, ring->dequeue);
     124
     125                /* Set to linear stream array */
     126                XHCI_STREAM_SCT_SET(*ctx, 1);
    124127        }
    125128}
     
    151154        uint8_t max_psa_size = 2 << XHCI_REG_RD(hc->cap_regs, XHCI_CAP_MAX_PSA_SIZE);
    152155        if (count > max_psa_size) {
    153                 // We don't support secondary stream arrays yet, so we just give up for this
     156                // FIXME: We don't support secondary stream arrays yet, so we just give up for this
    154157                return ENOTSUP;
    155158        }
     
    169172                }
    170173
     174                xhci_ep->primary_stream_rings = calloc(count, sizeof(xhci_trb_ring_t));
     175                if (!xhci_ep->primary_stream_rings) {
     176                        free32(xhci_ep->primary_stream_ctx_array);
     177                        return ENOMEM;
     178                }
     179
    171180                // FIXME: count should be rounded to nearest power of 2 for xHC, workaround for now
    172181                count = 1024;
     
    182191                return hc_add_endpoint(hc, dev->slot_id, xhci_endpoint_index(xhci_ep), &ep_ctx);
    183192        }
    184         // Complex stuff not supported yet
     193        // FIXME: Complex stuff not supported yet
    185194        return ENOTSUP;
    186195}
Note: See TracChangeset for help on using the changeset viewer.