Changeset 1af4c00 in mainline
- Timestamp:
- 2018-01-17T13:28:34Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4cc0c2e0
- Parents:
- 61e27e80
- Location:
- uspace/drv/bus/usb/xhci
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/xhci/endpoint.c
r61e27e80 r1af4c00 47 47 48 48 static int alloc_transfer_ds(xhci_endpoint_t *); 49 static void free_transfer_ds(xhci_endpoint_t *);50 49 51 50 /** … … 121 120 assert(xhci_ep); 122 121 123 free_transfer_ds(xhci_ep);122 xhci_endpoint_free_transfer_ds(xhci_ep); 124 123 125 124 // TODO: Something missed? … … 156 155 } 157 156 158 /** Allocate transfer data structures for XHCI endpoint .157 /** Allocate transfer data structures for XHCI endpoint not using streams. 159 158 * @param[in] xhci_ep XHCI endpoint to allocate data structures for. 160 159 * … … 166 165 usb_log_debug2("Allocating main transfer ring for endpoint " XHCI_EP_FMT, XHCI_EP_ARGS(*xhci_ep)); 167 166 168 xhci_ep->primary_stream_ctx_array = NULL; 167 xhci_ep->primary_stream_data_array = NULL; 168 xhci_ep->primary_stream_data_size = 0; 169 169 170 170 int err; … … 186 186 * @param[in] xhci_ep XHCI endpoint to free data structures for. 187 187 */ 188 static voidfree_transfer_ds(xhci_endpoint_t *xhci_ep)188 void xhci_endpoint_free_transfer_ds(xhci_endpoint_t *xhci_ep) 189 189 { 190 190 if (xhci_ep->primary_stream_data_size) { -
uspace/drv/bus/usb/xhci/endpoint.h
r61e27e80 r1af4c00 135 135 void xhci_endpoint_fini(xhci_endpoint_t *); 136 136 137 void xhci_endpoint_free_transfer_ds(xhci_endpoint_t *xhci_ep); 138 137 139 uint8_t xhci_endpoint_dci(xhci_endpoint_t *); 138 140 uint8_t xhci_endpoint_index(xhci_endpoint_t *); -
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: -
uspace/drv/bus/usb/xhci/streams.h
r61e27e80 r1af4c00 64 64 void xhci_stream_free_ds(xhci_endpoint_t *xhci_ep); 65 65 66 int xhci_endpoint_remove_streams(xhci_hc_t *hc, xhci_device_t *dev, xhci_endpoint_t *xhci_ep); 66 67 int xhci_endpoint_request_primary_streams(xhci_hc_t *hc, xhci_device_t *dev, 67 68 xhci_endpoint_t *xhci_ep, unsigned count);
Note:
See TracChangeset
for help on using the changeset viewer.