Changeset 2e2af3a in mainline
- Timestamp:
- 2017-12-27T20:43:24Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 95a62dc
- Parents:
- f4b83cc
- git-author:
- Petr Manek <petr.manek@…> (2017-12-27 19:50:18)
- git-committer:
- Petr Manek <petr.manek@…> (2017-12-27 20:43:24)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/xhci/endpoint.c
rf4b83cc r2e2af3a 45 45 #include "endpoint.h" 46 46 47 /** Initialize new XHCI endpoint. 48 * @param[in] xhci_ep Allocated XHCI endpoint to initialize. 49 * @param[in] dev Device, to which the endpoint belongs. 50 * @param[in] desc USB endpoint descriptor carrying configuration data. 51 * 52 * @return Error code. 53 */ 47 54 int xhci_endpoint_init(xhci_endpoint_t *xhci_ep, device_t *dev, const usb_endpoint_desc_t *desc) 48 55 { … … 75 82 } 76 83 84 /** Finalize XHCI endpoint. 85 * @param[in] xhci_ep XHCI endpoint to finalize. 86 */ 77 87 void xhci_endpoint_fini(xhci_endpoint_t *xhci_ep) 78 88 { … … 82 92 } 83 93 94 /** Determine the type of a XHCI endpoint. 95 * @param[in] ep XHCI endpoint to query. 96 * 97 * @return EP_TYPE_[CONTROL|ISOCH|BULK|INTERRUPT]_[IN|OUT] 98 */ 84 99 static int xhci_endpoint_type(xhci_endpoint_t *ep) 85 100 { … … 106 121 } 107 122 123 /** Test whether an XHCI endpoint uses streams. 124 * @param[in] xhci_ep XHCI endpoint to query. 125 * 126 * @return True if the endpoint uses streams. 127 */ 108 128 static bool endpoint_using_streams(xhci_endpoint_t *xhci_ep) 109 129 { … … 111 131 } 112 132 133 /** Determine maximum size of XHCI endpoint's Primary Stream Context Array. 134 * @param[in] xhci_ep XHCI endpoint to query. 135 * 136 * @return Number of items in the Primary Stream Context Array. 137 */ 113 138 static size_t primary_stream_ctx_array_max_size(xhci_endpoint_t *xhci_ep) 114 139 { … … 130 155 // } 131 156 157 /** Initialize primary streams of XHCI bulk endpoint. 158 * @param[in] hc Host controller of the endpoint. 159 * @param[in] xhci_epi XHCI bulk endpoint to use. 160 * @param[in] count Number of primary streams to initialize. 161 */ 132 162 static void initialize_primary_streams(xhci_hc_t *hc, xhci_endpoint_t *xhci_ep, unsigned count) { 133 163 for (size_t index = 0; index < count; ++index) { … … 136 166 137 167 /* Init and register TRB ring for every primary stream */ 138 xhci_trb_ring_init(ring); 168 xhci_trb_ring_init(ring); // FIXME: Not checking error code? 139 169 XHCI_STREAM_DEQ_PTR_SET(*ctx, ring->dequeue); 140 170 … … 144 174 } 145 175 176 /** Configure XHCI bulk endpoint's stream context. 177 * @param[in] xhci_ep Associated XHCI bulk endpoint. 178 * @param[in] ctx Endpoint context to configure. 179 * @param[in] pstreams The value of MaxPStreams. 180 */ 146 181 static void setup_stream_context(xhci_endpoint_t *xhci_ep, xhci_ep_ctx_t *ctx, unsigned pstreams) { 147 182 XHCI_EP_TYPE_SET(*ctx, xhci_endpoint_type(xhci_ep)); … … 156 191 } 157 192 193 /** TODO document this 194 */ 158 195 int xhci_endpoint_request_streams(xhci_hc_t *hc, xhci_device_t *dev, xhci_endpoint_t *xhci_ep, unsigned count) { 159 196 if (xhci_ep->base.transfer_type != USB_TRANSFER_BULK … … 210 247 } 211 248 249 /** TODO document this 250 */ 212 251 static int xhci_isoch_alloc_transfers(xhci_endpoint_t *xhci_ep) { 213 252 int i = 0; … … 234 273 } 235 274 275 /** Allocate transfer data structures for XHCI endpoint. 276 * @param[in] xhci_ep XHCI endpoint to allocate data structures for. 277 * 278 * @return Error code. 279 */ 236 280 int xhci_endpoint_alloc_transfer_ds(xhci_endpoint_t *xhci_ep) 237 281 { … … 256 300 } 257 301 302 /** Free transfer data structures for XHCI endpoint. 303 * @param[in] xhci_ep XHCI endpoint to free data structures for. 304 */ 258 305 void xhci_endpoint_free_transfer_ds(xhci_endpoint_t *xhci_ep) 259 306 { … … 311 358 } 312 359 360 /** Configure endpoint context of a control endpoint. 361 * @param[in] ep XHCI control endpoint. 362 * @param[in] ctx Endpoint context to configure. 363 */ 313 364 static void setup_control_ep_ctx(xhci_endpoint_t *ep, xhci_ep_ctx_t *ctx) 314 365 { … … 322 373 } 323 374 375 /** Configure endpoint context of a bulk endpoint. 376 * @param[in] ep XHCI bulk endpoint. 377 * @param[in] ctx Endpoint context to configure. 378 */ 324 379 static void setup_bulk_ep_ctx(xhci_endpoint_t *ep, xhci_ep_ctx_t *ctx) 325 380 { … … 334 389 } 335 390 391 /** Configure endpoint context of a isochronous endpoint. 392 * @param[in] ep XHCI isochronous endpoint. 393 * @param[in] ctx Endpoint context to configure. 394 */ 336 395 static void setup_isoch_ep_ctx(xhci_endpoint_t *ep, xhci_ep_ctx_t *ctx) 337 396 { … … 348 407 } 349 408 409 /** Configure endpoint context of a interrupt endpoint. 410 * @param[in] ep XHCI interrupt endpoint. 411 * @param[in] ctx Endpoint context to configure. 412 */ 350 413 static void setup_interrupt_ep_ctx(xhci_endpoint_t *ep, xhci_ep_ctx_t *ctx) 351 414 { … … 360 423 } 361 424 425 /** Type of endpoint context configuration function. */ 362 426 typedef void (*setup_ep_ctx_helper)(xhci_endpoint_t *, xhci_ep_ctx_t *); 363 427 428 /** Static array, which maps USB endpoint types to their respective endpoint context configuration functions. */ 364 429 static const setup_ep_ctx_helper setup_ep_ctx_helpers[] = { 365 430 [USB_TRANSFER_CONTROL] = setup_control_ep_ctx, … … 369 434 }; 370 435 436 /** Configure endpoint context of XHCI endpoint. 437 * @param[in] ep Associated XHCI endpoint. 438 * @param[in] ep_ctx Endpoint context to configure. 439 */ 371 440 void xhci_setup_endpoint_context(xhci_endpoint_t *ep, xhci_ep_ctx_t *ep_ctx) 372 441 { … … 381 450 } 382 451 452 /** Add a new XHCI endpoint to a device. The device must be online unless 453 * the added endpoint is number 0. 454 * @param[in] dev XHCI device, to which to add the endpoint 455 * @param[in] ep XHCI endpoint to add. 456 * 457 * @return Error code. 458 */ 383 459 int xhci_device_add_endpoint(xhci_device_t *dev, xhci_endpoint_t *ep) 384 460 { … … 404 480 } 405 481 482 /** Remove XHCI endpoint from a device. 483 * @param[in] ep XHCI endpoint to remove. 484 */ 406 485 void xhci_device_remove_endpoint(xhci_endpoint_t *ep) 407 486 { … … 416 495 } 417 496 497 /** Retrieve XHCI endpoint from a device by the endpoint number. 498 * @param[in] dev XHCI device to query. 499 * @param[in] ep Endpoint number identifying the endpoint to retrieve. 500 * 501 * @return XHCI endpoint with the specified number or NULL if no such endpoint exists. 502 */ 418 503 xhci_endpoint_t *xhci_device_get_endpoint(xhci_device_t *dev, usb_endpoint_t ep) 419 504 {
Note:
See TracChangeset
for help on using the changeset viewer.