Changeset 00aece0 in mainline for uspace/drv/bus/usb/ohci/endpoint_list.c
- Timestamp:
- 2012-02-18T16:47:38Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4449c6c
- Parents:
- bd5f3b7 (diff), f943dd3 (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
rbd5f3b7 r00aece0 60 60 name, instance->list_head, instance->list_head_pa); 61 61 62 ed_init(instance->list_head, NULL );62 ed_init(instance->list_head, NULL, NULL); 63 63 list_initialize(&instance->endpoint_list); 64 64 fibril_mutex_initialize(&instance->guard); … … 73 73 * Does not check whether this replaces an existing list. 74 74 */ 75 void endpoint_list_set_next(endpoint_list_t *instance, endpoint_list_t *next) 75 void endpoint_list_set_next( 76 const endpoint_list_t *instance, const endpoint_list_t *next) 76 77 { 77 78 assert(instance); … … 87 88 * The endpoint is added to the end of the list and queue. 88 89 */ 89 void endpoint_list_add_ep(endpoint_list_t *instance, hcd_endpoint_t *hcd_ep)90 void endpoint_list_add_ep(endpoint_list_t *instance, ohci_endpoint_t *ep) 90 91 { 91 92 assert(instance); 92 assert(hcd_ep); 93 usb_log_debug2("Queue %s: Adding endpoint(%p).\n", 94 instance->name, hcd_ep); 93 assert(ep); 94 usb_log_debug2("Queue %s: Adding endpoint(%p).\n", instance->name, ep); 95 95 96 96 fibril_mutex_lock(&instance->guard); … … 103 103 } else { 104 104 /* 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);105 ohci_endpoint_t *last = list_get_instance( 106 list_last(&instance->endpoint_list), ohci_endpoint_t, link); 107 107 last_ed = last->ed; 108 108 } 109 109 /* Keep link */ 110 hcd_ep->ed->next = last_ed->next;110 ep->ed->next = last_ed->next; 111 111 /* Make sure ED is written to the memory */ 112 112 write_barrier(); 113 113 114 114 /* Add ed to the hw queue */ 115 ed_append_ed(last_ed, hcd_ep->ed);115 ed_append_ed(last_ed, ep->ed); 116 116 /* Make sure ED is updated */ 117 117 write_barrier(); 118 118 119 119 /* Add to the sw list */ 120 list_append(& hcd_ep->link, &instance->endpoint_list);120 list_append(&ep->link, &instance->endpoint_list); 121 121 122 hcd_endpoint_t *first = list_get_instance(123 list_first(&instance->endpoint_list), hcd_endpoint_t, link);122 ohci_endpoint_t *first = list_get_instance( 123 list_first(&instance->endpoint_list), ohci_endpoint_t, link); 124 124 usb_log_debug("HCD EP(%p) added to list %s, first is %p(%p).\n", 125 hcd_ep, instance->name, first, first->ed);125 ep, instance->name, first, first->ed); 126 126 if (last_ed == instance->list_head) { 127 127 usb_log_debug2("%s head ED(%p-0x%0" PRIx32 "): %x:%x:%x:%x.\n", … … 138 138 * @param[in] endpoint Endpoint to remove. 139 139 */ 140 void endpoint_list_remove_ep(endpoint_list_t *instance, hcd_endpoint_t *hcd_ep)140 void endpoint_list_remove_ep(endpoint_list_t *instance, ohci_endpoint_t *ep) 141 141 { 142 142 assert(instance); 143 143 assert(instance->list_head); 144 assert( hcd_ep);145 assert( hcd_ep->ed);144 assert(ep); 145 assert(ep->ed); 146 146 147 147 fibril_mutex_lock(&instance->guard); 148 148 149 usb_log_debug2( 150 "Queue %s: removing endpoint(%p).\n", instance->name, hcd_ep); 149 usb_log_debug2("Queue %s: removing endpoint(%p).\n", instance->name, ep); 151 150 152 151 const char *qpos = NULL; 153 152 ed_t *prev_ed; 154 153 /* Remove from the hardware queue */ 155 if (list_first(&instance->endpoint_list) == & hcd_ep->link) {154 if (list_first(&instance->endpoint_list) == &ep->link) { 156 155 /* I'm the first one here */ 157 156 prev_ed = instance->list_head; 158 157 qpos = "FIRST"; 159 158 } else { 160 hcd_endpoint_t *prev =161 list_get_instance( hcd_ep->link.prev, hcd_endpoint_t, link);159 ohci_endpoint_t *prev = 160 list_get_instance(ep->link.prev, ohci_endpoint_t, link); 162 161 prev_ed = prev->ed; 163 162 qpos = "NOT FIRST"; 164 163 } 165 assert((prev_ed->next & ED_NEXT_PTR_MASK) == addr_to_phys( hcd_ep->ed));166 prev_ed->next = hcd_ep->ed->next;164 assert((prev_ed->next & ED_NEXT_PTR_MASK) == addr_to_phys(ep->ed)); 165 prev_ed->next = ep->ed->next; 167 166 /* Make sure ED is updated */ 168 167 write_barrier(); 169 168 170 169 usb_log_debug("HCD EP(%p) removed (%s) from %s, next %x.\n", 171 hcd_ep, qpos, instance->name, hcd_ep->ed->next);170 ep, qpos, instance->name, ep->ed->next); 172 171 173 172 /* Remove from the endpoint list */ 174 list_remove(& hcd_ep->link);173 list_remove(&ep->link); 175 174 fibril_mutex_unlock(&instance->guard); 176 175 }
Note:
See TracChangeset
for help on using the changeset viewer.