Changeset 925a21e in mainline for uspace/drv/bus/usb/ohci/endpoint_list.c
- Timestamp:
- 2011-09-24T14:20:29Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5bf76c1
- Parents:
- 867e2555 (diff), 1ab4aca (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
r867e2555 r925a21e 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 28 29 /** @addtogroup drvusbohci 29 30 * @{ … … 32 33 * @brief OHCI driver transfer list implementation 33 34 */ 35 34 36 #include <errno.h> 35 37 #include <usb/debug.h> 36 #include <arch/barrier.h> 37 38 #include <libarch/barrier.h> 38 39 #include "endpoint_list.h" 39 40 … … 86 87 * The endpoint is added to the end of the list and queue. 87 88 */ 88 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) 89 90 { 90 91 assert(instance); 91 assert(hcd_ep); 92 usb_log_debug2("Queue %s: Adding endpoint(%p).\n", 93 instance->name, hcd_ep); 92 assert(ep); 93 usb_log_debug2("Queue %s: Adding endpoint(%p).\n", instance->name, ep); 94 94 95 95 fibril_mutex_lock(&instance->guard); … … 102 102 } else { 103 103 /* There are active EDs, get the last one */ 104 hcd_endpoint_t *last = list_get_instance(105 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); 106 106 last_ed = last->ed; 107 107 } 108 108 /* Keep link */ 109 hcd_ep->ed->next = last_ed->next;109 ep->ed->next = last_ed->next; 110 110 /* Make sure ED is written to the memory */ 111 111 write_barrier(); 112 112 113 113 /* Add ed to the hw queue */ 114 ed_append_ed(last_ed, hcd_ep->ed);114 ed_append_ed(last_ed, ep->ed); 115 115 /* Make sure ED is updated */ 116 116 write_barrier(); 117 117 118 118 /* Add to the sw list */ 119 list_append(& hcd_ep->link, &instance->endpoint_list);119 list_append(&ep->link, &instance->endpoint_list); 120 120 121 hcd_endpoint_t *first = list_get_instance(122 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); 123 123 usb_log_debug("HCD EP(%p) added to list %s, first is %p(%p).\n", 124 hcd_ep, instance->name, first, first->ed);124 ep, instance->name, first, first->ed); 125 125 if (last_ed == instance->list_head) { 126 126 usb_log_debug2("%s head ED(%p-0x%0" PRIx32 "): %x:%x:%x:%x.\n", … … 137 137 * @param[in] endpoint Endpoint to remove. 138 138 */ 139 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) 140 140 { 141 141 assert(instance); 142 142 assert(instance->list_head); 143 assert( hcd_ep);144 assert( hcd_ep->ed);143 assert(ep); 144 assert(ep->ed); 145 145 146 146 fibril_mutex_lock(&instance->guard); 147 147 148 usb_log_debug2( 149 "Queue %s: removing endpoint(%p).\n", instance->name, hcd_ep); 148 usb_log_debug2("Queue %s: removing endpoint(%p).\n", instance->name, ep); 150 149 151 150 const char *qpos = NULL; 152 151 ed_t *prev_ed; 153 152 /* Remove from the hardware queue */ 154 if (list_first(&instance->endpoint_list) == & hcd_ep->link) {153 if (list_first(&instance->endpoint_list) == &ep->link) { 155 154 /* I'm the first one here */ 156 155 prev_ed = instance->list_head; 157 156 qpos = "FIRST"; 158 157 } else { 159 hcd_endpoint_t *prev =160 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); 161 160 prev_ed = prev->ed; 162 161 qpos = "NOT FIRST"; 163 162 } 164 assert((prev_ed->next & ED_NEXT_PTR_MASK) == addr_to_phys( hcd_ep->ed));165 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; 166 165 /* Make sure ED is updated */ 167 166 write_barrier(); 168 167 169 168 usb_log_debug("HCD EP(%p) removed (%s) from %s, next %x.\n", 170 hcd_ep, qpos, instance->name, hcd_ep->ed->next);169 ep, qpos, instance->name, ep->ed->next); 171 170 172 171 /* Remove from the endpoint list */ 173 list_remove(& hcd_ep->link);172 list_remove(&ep->link); 174 173 fibril_mutex_unlock(&instance->guard); 175 174 }
Note:
See TracChangeset
for help on using the changeset viewer.