Changeset fd07e526 in mainline for uspace/lib/usbhost/src/endpoint.c


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/lib/usbhost/src/endpoint.c

    r47fecbb rfd07e526  
    5353                instance->toggle = 0;
    5454                instance->active = false;
     55                instance->destroy_hook = NULL;
     56                instance->hc_data.data = NULL;
     57                instance->hc_data.toggle_get = NULL;
     58                instance->hc_data.toggle_set = NULL;
    5559                fibril_mutex_initialize(&instance->guard);
    5660                fibril_condvar_initialize(&instance->avail);
     
    6468        assert(instance);
    6569        assert(!instance->active);
     70        if (instance->hc_data.data) {
     71                assert(instance->destroy_hook);
     72                instance->destroy_hook(instance);
     73        }
    6674        free(instance);
    6775}
    6876/*----------------------------------------------------------------------------*/
    6977void endpoint_set_hc_data(endpoint_t *instance,
    70     void *data, int (*toggle_get)(void *), void (*toggle_set)(void *, int))
     78    void *data, void (*destroy_hook)(endpoint_t *),
     79    int (*toggle_get)(void *), void (*toggle_set)(void *, int))
    7180{
    7281        assert(instance);
     82        instance->destroy_hook = destroy_hook;
    7383        instance->hc_data.data = data;
    7484        instance->hc_data.toggle_get = toggle_get;
     
    7989{
    8090        assert(instance);
     91        instance->destroy_hook = NULL;
    8192        instance->hc_data.data = NULL;
    8293        instance->hc_data.toggle_get = NULL;
Note: See TracChangeset for help on using the changeset viewer.