Changeset ef1a3a8 in mainline
- Timestamp:
- 2017-10-29T11:53:45Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a312d8f
- Parents:
- d33dc780
- Location:
- uspace/drv/bus/usb/xhci
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/xhci/endpoint.c
rd33dc780 ref1a3a8 116 116 static void initialize_primary_streams(xhci_hc_t *hc, xhci_endpoint_t *xhci_ep, unsigned count) { 117 117 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); 124 127 } 125 128 } … … 151 154 uint8_t max_psa_size = 2 << XHCI_REG_RD(hc->cap_regs, XHCI_CAP_MAX_PSA_SIZE); 152 155 if (count > max_psa_size) { 153 // We don't support secondary stream arrays yet, so we just give up for this156 // FIXME: We don't support secondary stream arrays yet, so we just give up for this 154 157 return ENOTSUP; 155 158 } … … 169 172 } 170 173 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 171 180 // FIXME: count should be rounded to nearest power of 2 for xHC, workaround for now 172 181 count = 1024; … … 182 191 return hc_add_endpoint(hc, dev->slot_id, xhci_endpoint_index(xhci_ep), &ep_ctx); 183 192 } 184 // Complex stuff not supported yet193 // FIXME: Complex stuff not supported yet 185 194 return ENOTSUP; 186 195 } -
uspace/drv/bus/usb/xhci/endpoint.h
rd33dc780 ref1a3a8 74 74 xhci_transfer_t active_transfer; 75 75 76 /** Primary stream context array (or NULL if endpoint doesn't use streams) */76 /** Primary stream context array (or NULL if endpoint doesn't use streams). */ 77 77 xhci_stream_ctx_t *primary_stream_ctx_array; 78 78 79 /** Size of the allocated primary stream context array. */ 79 /** Primary stream ring array (or NULL if endpoint doesn't use streams). */ 80 xhci_trb_ring_t *primary_stream_rings; 81 82 /** Size of the allocated primary stream context array (and ring array). */ 80 83 uint16_t primary_stream_ctx_array_size; 81 84 -
uspace/drv/bus/usb/xhci/hw_struct/context.h
rd33dc780 ref1a3a8 169 169 #define XHCI_STREAM_SCT_SET(ctx, val) \ 170 170 xhci_qword_set_bits(&(ctx).data[0], val, 3, 1) 171 #define XHCI_STREAM_DEQ_PTR_SET(ctx, val) \ 172 xhci_qword_set_bits(&(ctx).data[0], (val >> 4), 63, 4) 171 173 } __attribute__((packed)) xhci_stream_ctx_t; 172 174 -
uspace/drv/bus/usb/xhci/transfers.c
rd33dc780 ref1a3a8 324 324 if (!xhci_ep->ring.segment_count) { 325 325 usb_log_error("Ring not initialized for endpoint " XHCI_EP_FMT, 326 326 XHCI_EP_ARGS(*xhci_ep)); 327 327 return EINVAL; 328 328 }
Note:
See TracChangeset
for help on using the changeset viewer.