Changeset 1af4c00 in mainline for uspace/drv/bus/usb/xhci/streams.c
- Timestamp:
- 2018-01-17T13:28:34Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4cc0c2e0
- Parents:
- 61e27e80
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/xhci/streams.c
r61e27e80 r1af4c00 110 110 dma_buffer_free(&xhci_ep->primary_stream_ctx_dma); 111 111 free(xhci_ep->primary_stream_data_array); 112 113 xhci_ep->primary_stream_data_array = NULL; 114 xhci_ep->primary_stream_data_size = 0; 112 115 } 113 116 … … 312 315 } 313 316 317 /** Cancels streams and reconfigures endpoint back to single ring no stream endpoint. 318 * @param[in] hc Host controller of the endpoint. 319 * @param[in] dev Used device. 320 * @param[in] xhci_ep Associated XHCI bulk endpoint. 321 */ 322 int xhci_endpoint_remove_streams(xhci_hc_t *hc, xhci_device_t *dev, xhci_endpoint_t *xhci_ep) 323 { 324 if (!xhci_ep->primary_stream_data_size) { 325 usb_log_warning("There are no streams enabled on the endpoint, doing nothing."); 326 return EOK; 327 } 328 329 hc_stop_endpoint(hc, dev->slot_id, xhci_endpoint_index(xhci_ep)); 330 xhci_endpoint_free_transfer_ds(xhci_ep); 331 332 /* Streams are now removed, proceed with reconfiguring endpoint. */ 333 int err; 334 if ((err = xhci_trb_ring_init(&xhci_ep->ring))) { 335 usb_log_error("Failed to initialize a transfer ring."); 336 return err; 337 } 338 339 xhci_ep_ctx_t ep_ctx; 340 memset(&ep_ctx, 0, sizeof(ep_ctx)); 341 xhci_setup_endpoint_context(xhci_ep, &ep_ctx); 342 return hc_update_endpoint(hc, dev->slot_id, xhci_endpoint_index(xhci_ep), &ep_ctx); 343 } 344 314 345 /** Initialize, setup and register primary streams. 315 346 * @param[in] hc Host controller of the endpoint. … … 325 356 return err; 326 357 } 358 359 /* 360 * We have passed the checks. 361 * Stop the endpoint, destroy the ring, and transition to streams. 362 */ 363 hc_stop_endpoint(hc, dev->slot_id, xhci_endpoint_index(xhci_ep)); 364 xhci_endpoint_free_transfer_ds(xhci_ep); 327 365 328 366 err = initialize_primary_structures(xhci_ep, count); … … 343 381 setup_stream_context(xhci_ep, &ep_ctx, pstreams, 1); 344 382 345 // FIXME: do we add endpoint? do we need to destroy previous configuration? 346 return hc_add_endpoint(hc, dev->slot_id, xhci_endpoint_index(xhci_ep), &ep_ctx); 383 return hc_update_endpoint(hc, dev->slot_id, xhci_endpoint_index(xhci_ep), &ep_ctx); 347 384 } 348 385 … … 393 430 } 394 431 432 /* 433 * We have passed all checks. 434 * Stop the endpoint, destroy the ring, and transition to streams. 435 */ 436 hc_stop_endpoint(hc, dev->slot_id, xhci_endpoint_index(xhci_ep)); 437 xhci_endpoint_free_transfer_ds(xhci_ep); 438 395 439 err = initialize_primary_structures(xhci_ep, count); 396 440 if (err) { … … 411 455 setup_stream_context(xhci_ep, &ep_ctx, pstreams, 0); 412 456 413 // FIXME: do we add endpoint? do we need to destroy previous configuration? 414 return hc_add_endpoint(hc, dev->slot_id, xhci_endpoint_index(xhci_ep), &ep_ctx); 457 return hc_update_endpoint(hc, dev->slot_id, xhci_endpoint_index(xhci_ep), &ep_ctx); 415 458 416 459 err_init:
Note:
See TracChangeset
for help on using the changeset viewer.