Changeset f1d6866 in mainline for uspace/drv/bus/usb/ohci/endpoint_list.c
- Timestamp:
- 2011-09-18T21:22:59Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- dcc44ca1
- Parents:
- 85ff862 (diff), 45a9cf4 (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/bus/usb/ohci/endpoint_list.c
r85ff862 rf1d6866 87 87 * The endpoint is added to the end of the list and queue. 88 88 */ 89 void endpoint_list_add_ep(endpoint_list_t *instance, hcd_endpoint_t *hcd_ep)89 void endpoint_list_add_ep(endpoint_list_t *instance, ohci_endpoint_t *ep) 90 90 { 91 91 assert(instance); 92 assert(hcd_ep); 93 usb_log_debug2("Queue %s: Adding endpoint(%p).\n", 94 instance->name, hcd_ep); 92 assert(ep); 93 usb_log_debug2("Queue %s: Adding endpoint(%p).\n", instance->name, ep); 95 94 96 95 fibril_mutex_lock(&instance->guard); … … 103 102 } else { 104 103 /* There are active EDs, get the last one */ 105 hcd_endpoint_t *last = list_get_instance(106 list_last(&instance->endpoint_list), hcd_endpoint_t, link);104 ohci_endpoint_t *last = list_get_instance( 105 list_last(&instance->endpoint_list), ohci_endpoint_t, link); 107 106 last_ed = last->ed; 108 107 } 109 108 /* Keep link */ 110 hcd_ep->ed->next = last_ed->next;109 ep->ed->next = last_ed->next; 111 110 /* Make sure ED is written to the memory */ 112 111 write_barrier(); 113 112 114 113 /* Add ed to the hw queue */ 115 ed_append_ed(last_ed, hcd_ep->ed);114 ed_append_ed(last_ed, ep->ed); 116 115 /* Make sure ED is updated */ 117 116 write_barrier(); 118 117 119 118 /* Add to the sw list */ 120 list_append(& hcd_ep->link, &instance->endpoint_list);119 list_append(&ep->link, &instance->endpoint_list); 121 120 122 hcd_endpoint_t *first = list_get_instance(123 list_first(&instance->endpoint_list), hcd_endpoint_t, link);121 ohci_endpoint_t *first = list_get_instance( 122 list_first(&instance->endpoint_list), ohci_endpoint_t, link); 124 123 usb_log_debug("HCD EP(%p) added to list %s, first is %p(%p).\n", 125 hcd_ep, instance->name, first, first->ed);124 ep, instance->name, first, first->ed); 126 125 if (last_ed == instance->list_head) { 127 126 usb_log_debug2("%s head ED(%p-0x%0" PRIx32 "): %x:%x:%x:%x.\n", … … 138 137 * @param[in] endpoint Endpoint to remove. 139 138 */ 140 void endpoint_list_remove_ep(endpoint_list_t *instance, hcd_endpoint_t *hcd_ep)139 void endpoint_list_remove_ep(endpoint_list_t *instance, ohci_endpoint_t *ep) 141 140 { 142 141 assert(instance); 143 142 assert(instance->list_head); 144 assert( hcd_ep);145 assert( hcd_ep->ed);143 assert(ep); 144 assert(ep->ed); 146 145 147 146 fibril_mutex_lock(&instance->guard); 148 147 149 usb_log_debug2( 150 "Queue %s: removing endpoint(%p).\n", instance->name, hcd_ep); 148 usb_log_debug2("Queue %s: removing endpoint(%p).\n", instance->name, ep); 151 149 152 150 const char *qpos = NULL; 153 151 ed_t *prev_ed; 154 152 /* Remove from the hardware queue */ 155 if (list_first(&instance->endpoint_list) == & hcd_ep->link) {153 if (list_first(&instance->endpoint_list) == &ep->link) { 156 154 /* I'm the first one here */ 157 155 prev_ed = instance->list_head; 158 156 qpos = "FIRST"; 159 157 } else { 160 hcd_endpoint_t *prev =161 list_get_instance( hcd_ep->link.prev, hcd_endpoint_t, link);158 ohci_endpoint_t *prev = 159 list_get_instance(ep->link.prev, ohci_endpoint_t, link); 162 160 prev_ed = prev->ed; 163 161 qpos = "NOT FIRST"; 164 162 } 165 assert((prev_ed->next & ED_NEXT_PTR_MASK) == addr_to_phys( hcd_ep->ed));166 prev_ed->next = hcd_ep->ed->next;163 assert((prev_ed->next & ED_NEXT_PTR_MASK) == addr_to_phys(ep->ed)); 164 prev_ed->next = ep->ed->next; 167 165 /* Make sure ED is updated */ 168 166 write_barrier(); 169 167 170 168 usb_log_debug("HCD EP(%p) removed (%s) from %s, next %x.\n", 171 hcd_ep, qpos, instance->name, hcd_ep->ed->next);169 ep, qpos, instance->name, ep->ed->next); 172 170 173 171 /* Remove from the endpoint list */ 174 list_remove(& hcd_ep->link);172 list_remove(&ep->link); 175 173 fibril_mutex_unlock(&instance->guard); 176 174 }
Note:
See TracChangeset
for help on using the changeset viewer.