Changeset 61e27e80 in mainline
- Timestamp:
- 2018-01-17T12:29:19Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1af4c00
- Parents:
- 5dab9ef0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/xhci/streams.c
r5dab9ef0 r61e27e80 39 39 #include "streams.h" 40 40 41 /** Finds stream data with given stream ID if it exists. 42 * Note that streams with ID 0, 65534 and 65535 are reserved. 43 * Splits the ID into primary and secondary context ID and searches the structures. 44 * @param[in] ep Affected endpoint. 45 * @param[in] stream_id Id of the stream. 46 */ 41 47 xhci_stream_data_t *xhci_get_stream_ctx_data(xhci_endpoint_t *ep, uint32_t stream_id) 42 48 { … … 70 76 } 71 77 78 /** Initializes primary stream data structures in endpoint. 79 * @param[in] xhci_ep Used XHCI bulk endpoint. 80 * @param[in] count Amount of primary streams. 81 */ 72 82 static int initialize_primary_structures(xhci_endpoint_t *xhci_ep, unsigned count) 73 83 { … … 91 101 } 92 102 103 /** 104 * 105 */ 93 106 static void clear_primary_structures(xhci_endpoint_t *xhci_ep) 94 107 { … … 125 138 } 126 139 127 /** Initialize primary stream structure with given index.128 * @param[in] hc Host controller of the endpoint. 129 * @param[in] xhci_ep iXHCI bulk endpoint to use.140 /** Initialize a single primary stream structure with given index. 141 * @param[in] hc Host controller of the endpoint. 142 * @param[in] xhci_ep XHCI bulk endpoint to use. 130 143 * @param[in] index index of the initialized stream structure. 131 144 */ … … 137 150 int err = EOK; 138 151 139 /* Init and register TRB ring for everyprimary stream */152 /* Init and register TRB ring for the primary stream */ 140 153 if ((err = xhci_trb_ring_init(&data->ring))) { 141 154 return err; … … 182 195 { 183 196 if (count == 0) { 197 /* The primary stream context can still point to a single ring, not a secondary. */ 184 198 return initialize_primary_stream(hc, xhci_ep, idx); 185 199 } … … 209 223 XHCI_STREAM_SCT_SET(*ctx, fnzb32(count) + 1); 210 224 225 /* Initialize all the rings. */ 211 226 int err = EOK; 212 227 size_t index; … … 251 266 } 252 267 268 /** Verifies if all the common preconditions are satisfied. 269 * @param[in] hc Host controller of the endpoint. 270 * @param[in] dev Used device. 271 * @param[in] xhci_ep Associated XHCI bulk endpoint. 272 * @param[in] count Amount of primary streams requested. 273 */ 253 274 static int verify_stream_conditions(xhci_hc_t *hc, xhci_device_t *dev, 254 275 xhci_endpoint_t *xhci_ep, unsigned count) … … 270 291 } 271 292 272 uint8_t max_psa_size = 2 << XHCI_REG_RD(hc->cap_regs, XHCI_CAP_MAX_PSA_SIZE); 293 /* The maximum amount of primary streams is 2 ^ (MaxPSA + 1) (See table 26 of XHCI specification) */ 294 uint8_t max_psa_size = 1 << (XHCI_REG_RD(hc->cap_regs, XHCI_CAP_MAX_PSA_SIZE) + 1); 273 295 if (count > max_psa_size) { 274 296 usb_log_error("Host controller only supports %u primary streams.", max_psa_size); … … 290 312 } 291 313 292 /** Initialize primary streams 314 /** Initialize, setup and register primary streams. 315 * @param[in] hc Host controller of the endpoint. 316 * @param[in] dev Used device. 317 * @param[in] xhci_ep Associated XHCI bulk endpoint. 318 * @param[in] count Amount of primary streams requested. 293 319 */ 294 320 int xhci_endpoint_request_primary_streams(xhci_hc_t *hc, xhci_device_t *dev, … … 313 339 314 340 xhci_ep_ctx_t ep_ctx; 341 /* Allowed values are 1-15, where 2 ^ pstreams is the actual amount of streams. */ 315 342 const size_t pstreams = fnzb32(count) - 1; 316 343 setup_stream_context(xhci_ep, &ep_ctx, pstreams, 1); … … 320 347 } 321 348 322 /** Initialize secondary streams 323 * sizes - the size of each secondary stream context (an array) 324 * count - the amount of primary stream contexts 349 /** Initialize, setup and register secondary streams. 350 * @param[in] hc Host controller of the endpoint. 351 * @param[in] dev Used device. 352 * @param[in] xhci_ep Associated XHCI bulk endpoint. 353 * @param[in] sizes Amount of secondary streams in each primary stream. 354 This array should have exactly count elements. 355 If the size is 0, then a primary ring is created with that index. 356 * @param[in] count Amount of primary streams requested. 325 357 */ 326 358 int xhci_endpoint_request_secondary_streams(xhci_hc_t *hc, xhci_device_t *dev,
Note:
See TracChangeset
for help on using the changeset viewer.