Changeset d736fe38 in mainline
- Timestamp:
- 2011-05-17T12:54:02Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c7b5826
- Parents:
- 28d9c95
- Location:
- uspace/drv
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/ohci/endpoint_list.c
r28d9c95 rd736fe38 44 44 * @return Error code 45 45 * 46 * Allocates memory for internal qh_t structure.46 * Allocates memory for internal ed_t structure. 47 47 */ 48 48 int endpoint_list_init(endpoint_list_t *instance, const char *name) … … 69 69 * @param[in] instance List to lead. 70 70 * @param[in] next List to append. 71 * @return Error code72 71 * 73 * Does not check whether this replaces an existing list 72 * Does not check whether this replaces an existing list. 74 73 */ 75 74 void endpoint_list_set_next(endpoint_list_t *instance, endpoint_list_t *next) … … 80 79 } 81 80 /*----------------------------------------------------------------------------*/ 82 /** Submit transferendpoint to the list and queue.81 /** Add endpoint to the list and queue. 83 82 * 84 83 * @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. 87 85 * 88 86 * The endpoint is added to the end of the list and queue. … … 100 98 /* Add to the hardware queue. */ 101 99 if (list_empty(&instance->endpoint_list)) { 102 /* There is nothing scheduled*/100 /* There are no active EDs */ 103 101 last_ed = instance->list_head; 104 102 } else { 105 /* There is something scheduled*/103 /* There are active EDs, get the last one */ 106 104 hcd_endpoint_t *last = list_get_instance( 107 105 instance->endpoint_list.prev, hcd_endpoint_t, link); 106 assert(last); 108 107 last_ed = last->ed; 109 108 } … … 113 112 write_barrier(); 114 113 115 /* Add ed to the hw list*/114 /* Add ed to the hw queue */ 116 115 ed_append_ed(last_ed, hcd_ep->ed); 117 116 /* Make sure ED is updated */ 118 117 write_barrier(); 119 118 120 121 /* Add to the driver list */ 119 /* Add to the sw list */ 122 120 list_append(&hcd_ep->link, &instance->endpoint_list); 123 121 … … 135 133 } 136 134 /*----------------------------------------------------------------------------*/ 137 #if 0 138 /** Create list for finished endpoints. 135 /** Remove endpoint from the list and queue. 139 136 * 140 137 * @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. 192 139 */ 193 140 void endpoint_list_remove_ep(endpoint_list_t *instance, hcd_endpoint_t *hcd_ep) -
uspace/drv/ohci/endpoint_list.h
r28d9c95 rd736fe38 41 41 #include "utils/malloc32.h" 42 42 43 typedef struct endpoint_list { 43 /** Structure maintains both OHCI queue and software list of active endpoints.*/ 44 typedef struct endpoint_list 45 { 46 /** Guard against add/remove races */ 44 47 fibril_mutex_t guard; 48 /** OHCI hw structure at the beginning of the queue */ 45 49 ed_t *list_head; 50 /** Physical address of the first(dummy) ED */ 46 51 uint32_t list_head_pa; 52 /** Assigned name, provides nicer debug output */ 47 53 const char *name; 54 /** Sw list of all active EDs */ 48 55 link_t endpoint_list; 49 56 } endpoint_list_t; … … 53 60 * @param[in] instance Memory place to use. 54 61 * 55 * Frees memory for internal qh_t structure.62 * Frees memory of the internal ed_t structure. 56 63 */ 57 64 static inline void endpoint_list_fini(endpoint_list_t *instance) … … 68 75 69 76 void endpoint_list_remove_ep(endpoint_list_t *instance, hcd_endpoint_t *hcd_ep); 70 #if 071 void endpoint_list_remove_finished(endpoint_list_t *instance, link_t *done);72 73 void endpoint_list_abort_all(endpoint_list_t *instance);74 #endif75 77 #endif 76 78 /** -
uspace/drv/ohci/hcd_endpoint.h
r28d9c95 rd736fe38 37 37 #include <assert.h> 38 38 #include <adt/list.h> 39 40 39 #include <usb/host/endpoint.h> 41 40 … … 43 42 #include "hw_struct/transfer_descriptor.h" 44 43 45 typedef struct hcd_endpoint { 44 typedef struct hcd_endpoint 45 { 46 46 ed_t *ed; 47 47 td_t *td; -
uspace/drv/uhci-hcd/transfer_list.c
r28d9c95 rd736fe38 72 72 * @param[in] instance Memory place to use. 73 73 * 74 * Frees memory forinternal qh_t structure.74 * Frees memory of the internal qh_t structure. 75 75 */ 76 76 void transfer_list_fini(transfer_list_t *instance)
Note:
See TracChangeset
for help on using the changeset viewer.