Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset d736fe38 in mainline


Ignore:
Timestamp:
2011-05-17T12:54:02Z (11 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master
Children:
c7b5826
Parents:
28d9c95
Message:

More comment fixes and code cleanup

Location:
uspace/drv
Files:
4 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)
  • uspace/drv/ohci/endpoint_list.h

    r28d9c95 rd736fe38  
    4141#include "utils/malloc32.h"
    4242
    43 typedef struct endpoint_list {
     43/** Structure maintains both OHCI queue and software list of active endpoints.*/
     44typedef struct endpoint_list
     45{
     46        /** Guard against add/remove races */
    4447        fibril_mutex_t guard;
     48        /** OHCI hw structure at the beginning of the queue */
    4549        ed_t *list_head;
     50        /** Physical address of the first(dummy) ED */
    4651        uint32_t list_head_pa;
     52        /** Assigned name, provides nicer debug output */
    4753        const char *name;
     54        /** Sw list of all active EDs */
    4855        link_t endpoint_list;
    4956} endpoint_list_t;
     
    5360 * @param[in] instance Memory place to use.
    5461 *
    55  * Frees memory for internal qh_t structure.
     62 * Frees memory of the internal ed_t structure.
    5663 */
    5764static inline void endpoint_list_fini(endpoint_list_t *instance)
     
    6875
    6976void endpoint_list_remove_ep(endpoint_list_t *instance, hcd_endpoint_t *hcd_ep);
    70 #if 0
    71 void endpoint_list_remove_finished(endpoint_list_t *instance, link_t *done);
    72 
    73 void endpoint_list_abort_all(endpoint_list_t *instance);
    74 #endif
    7577#endif
    7678/**
  • uspace/drv/ohci/hcd_endpoint.h

    r28d9c95 rd736fe38  
    3737#include <assert.h>
    3838#include <adt/list.h>
    39 
    4039#include <usb/host/endpoint.h>
    4140
     
    4342#include "hw_struct/transfer_descriptor.h"
    4443
    45 typedef struct hcd_endpoint {
     44typedef struct hcd_endpoint
     45{
    4646        ed_t *ed;
    4747        td_t *td;
  • uspace/drv/uhci-hcd/transfer_list.c

    r28d9c95 rd736fe38  
    7272 * @param[in] instance Memory place to use.
    7373 *
    74  * Frees memory for internal qh_t structure.
     74 * Frees memory of the internal qh_t structure.
    7575 */
    7676void transfer_list_fini(transfer_list_t *instance)
Note: See TracChangeset for help on using the changeset viewer.