Changeset 4fe3b6d in mainline for uspace/drv/ohci/endpoint_list.c
- Timestamp:
- 2011-05-20T11:07:00Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8bb61e6
- Parents:
- 3476be8 (diff), 7941bd6 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/ohci/endpoint_list.c
r3476be8 r4fe3b6d 34 34 #include <errno.h> 35 35 #include <usb/debug.h> 36 #include <arch/barrier.h> 36 37 37 38 #include "endpoint_list.h" … … 43 44 * @return Error code 44 45 * 45 * Allocates memory for internal qh_t structure.46 * Allocates memory for internal ed_t structure. 46 47 */ 47 48 int endpoint_list_init(endpoint_list_t *instance, const char *name) … … 68 69 * @param[in] instance List to lead. 69 70 * @param[in] next List to append. 70 * @return Error code71 71 * 72 * Does not check whether this replaces an existing list 72 * Does not check whether this replaces an existing list. 73 73 */ 74 74 void endpoint_list_set_next(endpoint_list_t *instance, endpoint_list_t *next) … … 79 79 } 80 80 /*----------------------------------------------------------------------------*/ 81 /** Submit transferendpoint to the list and queue.81 /** Add endpoint to the list and queue. 82 82 * 83 83 * @param[in] instance List to use. 84 * @param[in] endpoint Transfer endpoint to submit. 85 * @return Error code 84 * @param[in] endpoint Endpoint to add. 86 85 * 87 86 * The endpoint is added to the end of the list and queue. … … 99 98 /* Add to the hardware queue. */ 100 99 if (list_empty(&instance->endpoint_list)) { 101 /* There is nothing scheduled*/100 /* There are no active EDs */ 102 101 last_ed = instance->list_head; 103 102 } else { 104 /* There is something scheduled*/103 /* There are active EDs, get the last one */ 105 104 hcd_endpoint_t *last = list_get_instance( 106 105 instance->endpoint_list.prev, hcd_endpoint_t, link); 106 assert(last); 107 107 last_ed = last->ed; 108 108 } 109 /* keep link */109 /* Keep link */ 110 110 hcd_ep->ed->next = last_ed->next; 111 /* Make sure ED is written to the memory */ 112 write_barrier(); 113 114 /* Add ed to the hw queue */ 111 115 ed_append_ed(last_ed, hcd_ep->ed); 116 /* Make sure ED is updated */ 117 write_barrier(); 112 118 113 asm volatile ("": : :"memory"); 114 115 /* Add to the driver list */ 119 /* Add to the sw list */ 116 120 list_append(&hcd_ep->link, &instance->endpoint_list); 117 121 … … 129 133 } 130 134 /*----------------------------------------------------------------------------*/ 131 #if 0 132 /** Create list for finished endpoints. 135 /** Remove endpoint from the list and queue. 133 136 * 134 137 * @param[in] instance List to use. 135 * @param[in] done list to fill 136 */ 137 void endpoint_list_remove_finished(endpoint_list_t *instance, link_t *done) 138 { 139 assert(instance); 140 assert(done); 141 142 fibril_mutex_lock(&instance->guard); 143 usb_log_debug2("Checking list %s for completed endpointes(%d).\n", 144 instance->name, list_count(&instance->endpoint_list)); 145 link_t *current = instance->endpoint_list.next; 146 while (current != &instance->endpoint_list) { 147 link_t *next = current->next; 148 hcd_endpoint_t *endpoint = 149 list_get_instance(current, hcd_endpoint_t, link); 150 151 if (endpoint_is_complete(endpoint)) { 152 /* Save for post-processing */ 153 endpoint_list_remove_endpoint(instance, endpoint); 154 list_append(current, done); 155 } 156 current = next; 157 } 158 fibril_mutex_unlock(&instance->guard); 159 } 160 /*----------------------------------------------------------------------------*/ 161 /** Walk the list and abort all endpointes. 162 * 163 * @param[in] instance List to use. 164 */ 165 void endpoint_list_abort_all(endpoint_list_t *instance) 166 { 167 fibril_mutex_lock(&instance->guard); 168 while (!list_empty(&instance->endpoint_list)) { 169 link_t *current = instance->endpoint_list.next; 170 hcd_endpoint_t *endpoint = 171 list_get_instance(current, hcd_endpoint_t, link); 172 endpoint_list_remove_endpoint(instance, endpoint); 173 hcd_endpoint_finish_error(endpoint, EIO); 174 } 175 fibril_mutex_unlock(&instance->guard); 176 } 177 #endif 178 /*----------------------------------------------------------------------------*/ 179 /** Remove a transfer endpoint from the list and queue. 180 * 181 * @param[in] instance List to use. 182 * @param[in] endpoint Transfer endpoint to remove. 183 * @return Error code 184 * 185 * Does not lock the transfer list, caller is responsible for that. 138 * @param[in] endpoint Endpoint to remove. 186 139 */ 187 140 void endpoint_list_remove_ep(endpoint_list_t *instance, hcd_endpoint_t *hcd_ep) … … 212 165 assert((prev_ed->next & ED_NEXT_PTR_MASK) == addr_to_phys(hcd_ep->ed)); 213 166 prev_ed->next = hcd_ep->ed->next; 167 /* Make sure ED is updated */ 168 write_barrier(); 214 169 215 asm volatile ("": : :"memory");216 170 usb_log_debug("HCD EP(%p) removed (%s) from %s, next %x.\n", 217 171 hcd_ep, qpos, instance->name, hcd_ep->ed->next);
Note:
See TracChangeset
for help on using the changeset viewer.