Changeset d736fe38 in mainline for uspace/drv/ohci/endpoint_list.c


Ignore:
Timestamp:
2011-05-17T12:54:02Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c7b5826
Parents:
28d9c95
Message:

More comment fixes and code cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/ohci/endpoint_list.c

    r28d9c95 rd736fe38  
    4444 * @return Error code
    4545 *
    46  * Allocates memory for internal qh_t structure.
     46 * Allocates memory for internal ed_t structure.
    4747 */
    4848int endpoint_list_init(endpoint_list_t *instance, const char *name)
     
    6969 * @param[in] instance List to lead.
    7070 * @param[in] next List to append.
    71  * @return Error code
    7271 *
    73  * Does not check whether this replaces an existing list .
     72 * Does not check whether this replaces an existing list.
    7473 */
    7574void endpoint_list_set_next(endpoint_list_t *instance, endpoint_list_t *next)
     
    8079}
    8180/*----------------------------------------------------------------------------*/
    82 /** Submit transfer endpoint to the list and queue.
     81/** Add endpoint to the list and queue.
    8382 *
    8483 * @param[in] instance List to use.
    85  * @param[in] endpoint Transfer endpoint to submit.
    86  * @return Error code
     84 * @param[in] endpoint Endpoint to add.
    8785 *
    8886 * The endpoint is added to the end of the list and queue.
     
    10098        /* Add to the hardware queue. */
    10199        if (list_empty(&instance->endpoint_list)) {
    102                 /* There is nothing scheduled */
     100                /* There are no active EDs */
    103101                last_ed = instance->list_head;
    104102        } else {
    105                 /* There is something scheduled */
     103                /* There are active EDs, get the last one */
    106104                hcd_endpoint_t *last = list_get_instance(
    107105                    instance->endpoint_list.prev, hcd_endpoint_t, link);
     106                assert(last);
    108107                last_ed = last->ed;
    109108        }
     
    113112        write_barrier();
    114113
    115         /* Add ed to the hw list */
     114        /* Add ed to the hw queue */
    116115        ed_append_ed(last_ed, hcd_ep->ed);
    117116        /* Make sure ED is updated */
    118117        write_barrier();
    119118
    120 
    121         /* Add to the driver list */
     119        /* Add to the sw list */
    122120        list_append(&hcd_ep->link, &instance->endpoint_list);
    123121
     
    135133}
    136134/*----------------------------------------------------------------------------*/
    137 #if 0
    138 /** Create list for finished endpoints.
     135/** Remove endpoint from the list and queue.
    139136 *
    140137 * @param[in] instance List to use.
    141  * @param[in] done list to fill
    142  */
    143 void endpoint_list_remove_finished(endpoint_list_t *instance, link_t *done)
    144 {
    145         assert(instance);
    146         assert(done);
    147 
    148         fibril_mutex_lock(&instance->guard);
    149         usb_log_debug2("Checking list %s for completed endpointes(%d).\n",
    150             instance->name, list_count(&instance->endpoint_list));
    151         link_t *current = instance->endpoint_list.next;
    152         while (current != &instance->endpoint_list) {
    153                 link_t *next = current->next;
    154                 hcd_endpoint_t *endpoint =
    155                     list_get_instance(current, hcd_endpoint_t, link);
    156 
    157                 if (endpoint_is_complete(endpoint)) {
    158                         /* Save for post-processing */
    159                         endpoint_list_remove_endpoint(instance, endpoint);
    160                         list_append(current, done);
    161                 }
    162                 current = next;
    163         }
    164         fibril_mutex_unlock(&instance->guard);
    165 }
    166 /*----------------------------------------------------------------------------*/
    167 /** Walk the list and abort all endpointes.
    168  *
    169  * @param[in] instance List to use.
    170  */
    171 void endpoint_list_abort_all(endpoint_list_t *instance)
    172 {
    173         fibril_mutex_lock(&instance->guard);
    174         while (!list_empty(&instance->endpoint_list)) {
    175                 link_t *current = instance->endpoint_list.next;
    176                 hcd_endpoint_t *endpoint =
    177                     list_get_instance(current, hcd_endpoint_t, link);
    178                 endpoint_list_remove_endpoint(instance, endpoint);
    179                 hcd_endpoint_finish_error(endpoint, EIO);
    180         }
    181         fibril_mutex_unlock(&instance->guard);
    182 }
    183 #endif
    184 /*----------------------------------------------------------------------------*/
    185 /** Remove a transfer endpoint from the list and queue.
    186  *
    187  * @param[in] instance List to use.
    188  * @param[in] endpoint Transfer endpoint to remove.
    189  * @return Error code
    190  *
    191  * Does not lock the transfer list, caller is responsible for that.
     138 * @param[in] endpoint Endpoint to remove.
    192139 */
    193140void endpoint_list_remove_ep(endpoint_list_t *instance, hcd_endpoint_t *hcd_ep)
Note: See TracChangeset for help on using the changeset viewer.