Changes in uspace/drv/ohci/endpoint_list.c [d736fe38:4125b7d] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/ohci/endpoint_list.c
rd736fe38 r4125b7d 34 34 #include <errno.h> 35 35 #include <usb/debug.h> 36 #include <arch/barrier.h>37 36 38 37 #include "endpoint_list.h" … … 44 43 * @return Error code 45 44 * 46 * Allocates memory for internal ed_t structure.45 * Allocates memory for internal qh_t structure. 47 46 */ 48 47 int endpoint_list_init(endpoint_list_t *instance, const char *name) … … 69 68 * @param[in] instance List to lead. 70 69 * @param[in] next List to append. 71 * 72 * Does not check whether this replaces an existing list. 70 * @return Error code 71 * 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 /** Add endpoint to the list and queue. 82 * 83 * @param[in] instance List to use. 84 * @param[in] endpoint Endpoint to add. 81 /** Submit transfer endpoint to the list and queue. 82 * 83 * @param[in] instance List to use. 84 * @param[in] endpoint Transfer endpoint to submit. 85 * @return Error code 85 86 * 86 87 * The endpoint is added to the end of the list and queue. … … 98 99 /* Add to the hardware queue. */ 99 100 if (list_empty(&instance->endpoint_list)) { 100 /* There are no active EDs*/101 /* There is nothing scheduled */ 101 102 last_ed = instance->list_head; 102 103 } else { 103 /* There are active EDs, get the last one*/104 /* There is something scheduled */ 104 105 hcd_endpoint_t *last = list_get_instance( 105 106 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 */115 111 ed_append_ed(last_ed, hcd_ep->ed); 116 /* Make sure ED is updated */ 117 write_barrier();118 119 /* Add to the swlist */112 113 asm volatile ("": : :"memory"); 114 115 /* Add to the driver list */ 120 116 list_append(&hcd_ep->link, &instance->endpoint_list); 121 117 … … 133 129 } 134 130 /*----------------------------------------------------------------------------*/ 135 /** Remove endpoint from the list and queue. 136 * 137 * @param[in] instance List to use. 138 * @param[in] endpoint Endpoint to remove. 131 #if 0 132 /** Create list for finished endpoints. 133 * 134 * @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. 139 186 */ 140 187 void endpoint_list_remove_ep(endpoint_list_t *instance, hcd_endpoint_t *hcd_ep) … … 165 212 assert((prev_ed->next & ED_NEXT_PTR_MASK) == addr_to_phys(hcd_ep->ed)); 166 213 prev_ed->next = hcd_ep->ed->next; 167 /* Make sure ED is updated */ 168 write_barrier(); 169 214 215 asm volatile ("": : :"memory"); 170 216 usb_log_debug("HCD EP(%p) removed (%s) from %s, next %x.\n", 171 217 hcd_ep, qpos, instance->name, hcd_ep->ed->next);
Note:
See TracChangeset
for help on using the changeset viewer.