Changeset 3de7a62 in mainline
- Timestamp:
- 2014-01-24T01:24:58Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4e732f1a
- Parents:
- a24d6825
- Location:
- uspace/drv/bus/usb/ehci
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ehci/ehci_endpoint.h
ra24d6825 r3de7a62 66 66 } 67 67 68 static inline ehci_endpoint_t * ehci_endpoint_list_instance(link_t *l) 69 { 70 return list_get_instance(l, ehci_endpoint_t, link); 71 } 72 68 73 #endif 69 74 /** -
uspace/drv/bus/usb/ehci/endpoint_list.c
ra24d6825 r3de7a62 64 64 name, instance->list_head, instance->list_head_pa); 65 65 66 // qh_init(instance->list_head, NULL, NULL);66 qh_init(instance->list_head, NULL); 67 67 list_initialize(&instance->endpoint_list); 68 68 fibril_mutex_initialize(&instance->guard); … … 70 70 } 71 71 72 /** Add endpoint to the list and queue.72 /** Add endpoint to the end of the list and queue. 73 73 * 74 74 * @param[in] instance List to use. … … 77 77 * The endpoint is added to the end of the list and queue. 78 78 */ 79 void endpoint_list_a dd_ep(endpoint_list_t *instance, ehci_endpoint_t *ep)79 void endpoint_list_append_ep(endpoint_list_t *instance, ehci_endpoint_t *ep) 80 80 { 81 81 assert(instance); 82 82 assert(ep); 83 assert(ep->qh); 83 84 usb_log_debug2("Queue %s: Adding endpoint(%p).\n", instance->name, ep); 84 85 85 86 fibril_mutex_lock(&instance->guard); 86 87 87 #if 0 88 //TODO Implement this 89 ed_t *last_ed = NULL; 88 qh_t *last_qh = NULL; 90 89 /* Add to the hardware queue. */ 91 90 if (list_empty(&instance->endpoint_list)) { 92 91 /* There are no active EDs */ 93 last_ ed= instance->list_head;92 last_qh = instance->list_head; 94 93 } else { 95 94 /* There are active EDs, get the last one */ 96 ehci_endpoint_t *last = list_get_instance(97 list_last(&instance->endpoint_list) , ehci_endpoint_t, link);98 last_ ed = last->ed;95 ehci_endpoint_t *last = ehci_endpoint_list_instance( 96 list_last(&instance->endpoint_list)); 97 last_qh = last->qh; 99 98 } 99 assert(last_qh); 100 100 /* Keep link */ 101 ep-> ed->next = last_ed->next;102 /* Make sure EDis written to the memory */101 ep->qh->horizontal = last_qh->horizontal; 102 /* Make sure QH update is written to the memory */ 103 103 write_barrier(); 104 104 105 105 /* Add ed to the hw queue */ 106 ed_append_ed(last_ed, ep->ed);106 qh_append_qh(last_qh, ep->qh); 107 107 /* Make sure ED is updated */ 108 108 write_barrier(); … … 110 110 list_append(&ep->link, &instance->endpoint_list); 111 111 112 ehci_endpoint_t *first = list_get_instance(113 list_first(&instance->endpoint_list) , ehci_endpoint_t, link);112 ehci_endpoint_t *first = ehci_endpoint_list_instance( 113 list_first(&instance->endpoint_list)); 114 114 usb_log_debug("HCD EP(%p) added to list %s, first is %p(%p).\n", 115 ep, instance->name, first, first->ed); 116 if (last_ed == instance->list_head) { 117 usb_log_debug2("%s head ED(%p-0x%0" PRIx32 "): %x:%x:%x:%x.\n", 118 instance->name, last_ed, instance->list_head_pa, 119 last_ed->status, last_ed->td_tail, last_ed->td_head, 120 last_ed->next); 115 ep, instance->name, first, first->qh); 116 if (last_qh == instance->list_head) { 117 usb_log_debug2("%s head ED(%p-0x%0" PRIx32 "): %x:%x.\n", 118 instance->name, last_qh, instance->list_head_pa, 119 last_qh->status, last_qh->horizontal); 121 120 } 122 #endif123 121 fibril_mutex_unlock(&instance->guard); 124 122 } … … 153 151 qpos = "NOT FIRST"; 154 152 } 155 // assert(ed_next(prev_qh) == addr_to_phys(ep->eq));153 assert(qh_next(prev_qh) == addr_to_phys(ep->qh)); 156 154 prev_qh->next = ep->qh->next; 157 155 /* Make sure ED is updated */ -
uspace/drv/bus/usb/ehci/endpoint_list.h
ra24d6825 r3de7a62 69 69 free32(instance->list_head); 70 70 instance->list_head = NULL; 71 instance->list_head_pa = 0; 71 72 } 72 73 73 74 int endpoint_list_init(endpoint_list_t *instance, const char *name); 74 void endpoint_list_set_next( 75 const endpoint_list_t *instance, const endpoint_list_t *next); 76 void endpoint_list_add_ep(endpoint_list_t *instance, ehci_endpoint_t *ep); 75 void endpoint_list_append_ep(endpoint_list_t *instance, ehci_endpoint_t *ep); 77 76 void endpoint_list_remove_ep(endpoint_list_t *instance, ehci_endpoint_t *ep); 78 77 #endif -
uspace/drv/bus/usb/ehci/hw_struct/queue_head.h
ra24d6825 r3de7a62 40 40 41 41 #include "link_pointer.h" 42 #include "mem_access.h" 42 43 43 44 /** This structure is defined in EHCI design guide p. 46 */ … … 140 141 } qh_t; 141 142 143 static inline void qh_append_qh(qh_t *qh, const qh_t *next) 144 { 145 assert(qh); 146 assert(next); 147 const uint32_t pa = addr_to_phys(next); 148 assert((pa & LINK_POINTER_ADDRESS_MASK) == pa); 149 EHCI_MEM32_WR(qh->horizontal, LINK_POINTER_QH(pa)); 150 } 151 152 static inline uintptr_t qh_next(const qh_t *qh) 153 { 154 assert(qh); 155 return (qh->horizontal & LINK_POINTER_ADDRESS_MASK); 156 } 157 142 158 void qh_init(qh_t *instance, const endpoint_t *ep); 143 159 #endif
Note:
See TracChangeset
for help on using the changeset viewer.