Ignore:
Timestamp:
2011-09-16T14:50:20Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
432a269, d1e18573
Parents:
47fecbb (diff), 82a31261 (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.
Message:

Merge USB changes from bzr://krabicka.net/orome/helenos/usb/

  • Move common HC code from uhci/ohci drivers to libusbhost
  • Rewrite USB HC interface to have common read/write functions for all transfer types.
  • Restructure hc drivers to avoid some hooks and void* casts
  • Cleanup the code and remove unnecessary mallocs.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ohci/endpoint_list.c

    r47fecbb rfd07e526  
    8787 * The endpoint is added to the end of the list and queue.
    8888 */
    89 void endpoint_list_add_ep(endpoint_list_t *instance, hcd_endpoint_t *hcd_ep)
     89void endpoint_list_add_ep(endpoint_list_t *instance, ohci_endpoint_t *ep)
    9090{
    9191        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);
    9594
    9695        fibril_mutex_lock(&instance->guard);
     
    103102        } else {
    104103                /* 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);
    107106                last_ed = last->ed;
    108107        }
    109108        /* Keep link */
    110         hcd_ep->ed->next = last_ed->next;
     109        ep->ed->next = last_ed->next;
    111110        /* Make sure ED is written to the memory */
    112111        write_barrier();
    113112
    114113        /* Add ed to the hw queue */
    115         ed_append_ed(last_ed, hcd_ep->ed);
     114        ed_append_ed(last_ed, ep->ed);
    116115        /* Make sure ED is updated */
    117116        write_barrier();
    118117
    119118        /* Add to the sw list */
    120         list_append(&hcd_ep->link, &instance->endpoint_list);
     119        list_append(&ep->link, &instance->endpoint_list);
    121120
    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);
    124123        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);
    126125        if (last_ed == instance->list_head) {
    127126                usb_log_debug2("%s head ED(%p-0x%0" PRIx32 "): %x:%x:%x:%x.\n",
     
    138137 * @param[in] endpoint Endpoint to remove.
    139138 */
    140 void endpoint_list_remove_ep(endpoint_list_t *instance, hcd_endpoint_t *hcd_ep)
     139void endpoint_list_remove_ep(endpoint_list_t *instance, ohci_endpoint_t *ep)
    141140{
    142141        assert(instance);
    143142        assert(instance->list_head);
    144         assert(hcd_ep);
    145         assert(hcd_ep->ed);
     143        assert(ep);
     144        assert(ep->ed);
    146145
    147146        fibril_mutex_lock(&instance->guard);
    148147
    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);
    151149
    152150        const char *qpos = NULL;
    153151        ed_t *prev_ed;
    154152        /* Remove from the hardware queue */
    155         if (list_first(&instance->endpoint_list) == &hcd_ep->link) {
     153        if (list_first(&instance->endpoint_list) == &ep->link) {
    156154                /* I'm the first one here */
    157155                prev_ed = instance->list_head;
    158156                qpos = "FIRST";
    159157        } 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);
    162160                prev_ed = prev->ed;
    163161                qpos = "NOT FIRST";
    164162        }
    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;
    167165        /* Make sure ED is updated */
    168166        write_barrier();
    169167
    170168        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);
    172170
    173171        /* Remove from the endpoint list */
    174         list_remove(&hcd_ep->link);
     172        list_remove(&ep->link);
    175173        fibril_mutex_unlock(&instance->guard);
    176174}
Note: See TracChangeset for help on using the changeset viewer.