Changeset 61e27e80 in mainline


Ignore:
Timestamp:
2018-01-17T12:29:19Z (6 years ago)
Author:
Salmelu <salmelu@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1af4c00
Parents:
5dab9ef0
Message:

xhci: streams: documentation comments

File:
1 edited

Legend:

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

    r5dab9ef0 r61e27e80  
    3939#include "streams.h"
    4040
     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 */
    4147xhci_stream_data_t *xhci_get_stream_ctx_data(xhci_endpoint_t *ep, uint32_t stream_id)
    4248{
     
    7076}
    7177
     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 */
    7282static int initialize_primary_structures(xhci_endpoint_t *xhci_ep, unsigned count)
    7383{
     
    91101}
    92102
     103/**
     104 *
     105 */
    93106static void clear_primary_structures(xhci_endpoint_t *xhci_ep)
    94107{
     
    125138}
    126139
    127 /** Initialize primary stream structure with given index.
    128  * @param[in] hc Host controller of the endpoint.
    129  * @param[in] xhci_epi XHCI 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.
    130143 * @param[in] index index of the initialized stream structure.
    131144 */
     
    137150        int err = EOK;
    138151
    139         /* Init and register TRB ring for every primary stream */
     152        /* Init and register TRB ring for the primary stream */
    140153        if ((err = xhci_trb_ring_init(&data->ring))) {
    141154                return err;
     
    182195{
    183196        if (count == 0) {
     197                /* The primary stream context can still point to a single ring, not a secondary. */
    184198                return initialize_primary_stream(hc, xhci_ep, idx);
    185199        }
     
    209223        XHCI_STREAM_SCT_SET(*ctx, fnzb32(count) + 1);
    210224
     225        /* Initialize all the rings. */
    211226        int err = EOK;
    212227        size_t index;
     
    251266}
    252267
     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 */
    253274static int verify_stream_conditions(xhci_hc_t *hc, xhci_device_t *dev,
    254275        xhci_endpoint_t *xhci_ep, unsigned count)
     
    270291        }
    271292
    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);
    273295        if (count > max_psa_size) {
    274296                usb_log_error("Host controller only supports %u primary streams.", max_psa_size);
     
    290312}
    291313
    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.
    293319 */
    294320int xhci_endpoint_request_primary_streams(xhci_hc_t *hc, xhci_device_t *dev,
     
    313339
    314340        xhci_ep_ctx_t ep_ctx;
     341        /* Allowed values are 1-15, where 2 ^ pstreams is the actual amount of streams. */
    315342        const size_t pstreams = fnzb32(count) - 1;
    316343        setup_stream_context(xhci_ep, &ep_ctx, pstreams, 1);
     
    320347}
    321348
    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.
    325357 */
    326358int xhci_endpoint_request_secondary_streams(xhci_hc_t *hc, xhci_device_t *dev,
Note: See TracChangeset for help on using the changeset viewer.