Changeset 2e2af3a in mainline for uspace/drv/bus/usb/xhci/endpoint.c


Ignore:
Timestamp:
2017-12-27T20:43:24Z (6 years ago)
Author:
Petr Manek <petr.manek@…>
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)
Message:

xhci: add docstrings in endpoint.c

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/xhci/endpoint.c

    rf4b83cc r2e2af3a  
    4545#include "endpoint.h"
    4646
     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 */
    4754int xhci_endpoint_init(xhci_endpoint_t *xhci_ep, device_t *dev, const usb_endpoint_desc_t *desc)
    4855{
     
    7582}
    7683
     84/** Finalize XHCI endpoint.
     85 * @param[in] xhci_ep XHCI endpoint to finalize.
     86 */
    7787void xhci_endpoint_fini(xhci_endpoint_t *xhci_ep)
    7888{
     
    8292}
    8393
     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 */
    8499static int xhci_endpoint_type(xhci_endpoint_t *ep)
    85100{
     
    106121}
    107122
     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 */
    108128static bool endpoint_using_streams(xhci_endpoint_t *xhci_ep)
    109129{
     
    111131}
    112132
     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 */
    113138static size_t primary_stream_ctx_array_max_size(xhci_endpoint_t *xhci_ep)
    114139{
     
    130155// }
    131156
     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 */
    132162static void initialize_primary_streams(xhci_hc_t *hc, xhci_endpoint_t *xhci_ep, unsigned count) {
    133163        for (size_t index = 0; index < count; ++index) {
     
    136166
    137167                /* 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?
    139169                XHCI_STREAM_DEQ_PTR_SET(*ctx, ring->dequeue);
    140170
     
    144174}
    145175
     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 */
    146181static void setup_stream_context(xhci_endpoint_t *xhci_ep, xhci_ep_ctx_t *ctx, unsigned pstreams) {
    147182        XHCI_EP_TYPE_SET(*ctx, xhci_endpoint_type(xhci_ep));
     
    156191}
    157192
     193/** TODO document this
     194 */
    158195int xhci_endpoint_request_streams(xhci_hc_t *hc, xhci_device_t *dev, xhci_endpoint_t *xhci_ep, unsigned count) {
    159196        if (xhci_ep->base.transfer_type != USB_TRANSFER_BULK
     
    210247}
    211248
     249/** TODO document this
     250 */
    212251static int xhci_isoch_alloc_transfers(xhci_endpoint_t *xhci_ep) {
    213252        int i = 0;
     
    234273}
    235274
     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 */
    236280int xhci_endpoint_alloc_transfer_ds(xhci_endpoint_t *xhci_ep)
    237281{
     
    256300}
    257301
     302/** Free transfer data structures for XHCI endpoint.
     303 * @param[in] xhci_ep XHCI endpoint to free data structures for.
     304 */
    258305void xhci_endpoint_free_transfer_ds(xhci_endpoint_t *xhci_ep)
    259306{
     
    311358}
    312359
     360/** Configure endpoint context of a control endpoint.
     361 * @param[in] ep XHCI control endpoint.
     362 * @param[in] ctx Endpoint context to configure.
     363 */
    313364static void setup_control_ep_ctx(xhci_endpoint_t *ep, xhci_ep_ctx_t *ctx)
    314365{
     
    322373}
    323374
     375/** Configure endpoint context of a bulk endpoint.
     376 * @param[in] ep XHCI bulk endpoint.
     377 * @param[in] ctx Endpoint context to configure.
     378 */
    324379static void setup_bulk_ep_ctx(xhci_endpoint_t *ep, xhci_ep_ctx_t *ctx)
    325380{
     
    334389}
    335390
     391/** Configure endpoint context of a isochronous endpoint.
     392 * @param[in] ep XHCI isochronous endpoint.
     393 * @param[in] ctx Endpoint context to configure.
     394 */
    336395static void setup_isoch_ep_ctx(xhci_endpoint_t *ep, xhci_ep_ctx_t *ctx)
    337396{
     
    348407}
    349408
     409/** Configure endpoint context of a interrupt endpoint.
     410 * @param[in] ep XHCI interrupt endpoint.
     411 * @param[in] ctx Endpoint context to configure.
     412 */
    350413static void setup_interrupt_ep_ctx(xhci_endpoint_t *ep, xhci_ep_ctx_t *ctx)
    351414{
     
    360423}
    361424
     425/** Type of endpoint context configuration function. */
    362426typedef void (*setup_ep_ctx_helper)(xhci_endpoint_t *, xhci_ep_ctx_t *);
    363427
     428/** Static array, which maps USB endpoint types to their respective endpoint context configuration functions. */
    364429static const setup_ep_ctx_helper setup_ep_ctx_helpers[] = {
    365430        [USB_TRANSFER_CONTROL] = setup_control_ep_ctx,
     
    369434};
    370435
     436/** Configure endpoint context of XHCI endpoint.
     437 * @param[in] ep Associated XHCI endpoint.
     438 * @param[in] ep_ctx Endpoint context to configure.
     439 */
    371440void xhci_setup_endpoint_context(xhci_endpoint_t *ep, xhci_ep_ctx_t *ep_ctx)
    372441{
     
    381450}
    382451
     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 */
    383459int xhci_device_add_endpoint(xhci_device_t *dev, xhci_endpoint_t *ep)
    384460{
     
    404480}
    405481
     482/** Remove XHCI endpoint from a device.
     483 * @param[in] ep XHCI endpoint to remove.
     484 */
    406485void xhci_device_remove_endpoint(xhci_endpoint_t *ep)
    407486{
     
    416495}
    417496
     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 */
    418503xhci_endpoint_t *xhci_device_get_endpoint(xhci_device_t *dev, usb_endpoint_t ep)
    419504{
Note: See TracChangeset for help on using the changeset viewer.