Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset c7dd69d in mainline for uspace/lib/usb/src/host/endpoint.c


Ignore:
Timestamp:
2011-04-15T13:19:59Z (11 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master
Children:
da1dd48
Parents:
e3b5129 (diff), 8fd4ba0 (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:

Development changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usb/src/host/endpoint.c

    re3b5129 rc7dd69d  
    5353        fibril_mutex_initialize(&instance->guard);
    5454        fibril_condvar_initialize(&instance->avail);
     55        endpoint_clear_hc_data(instance);
    5556        return EOK;
    5657}
     
    6162        assert(!instance->active);
    6263        free(instance);
     64}
     65/*----------------------------------------------------------------------------*/
     66void endpoint_set_hc_data(endpoint_t *instance,
     67    void *data, int (*toggle_get)(void *), void (*toggle_set)(void *, int))
     68{
     69        assert(instance);
     70        instance->hc_data.data = data;
     71        instance->hc_data.toggle_get = toggle_get;
     72        instance->hc_data.toggle_set = toggle_set;
     73}
     74/*----------------------------------------------------------------------------*/
     75void endpoint_clear_hc_data(endpoint_t *instance)
     76{
     77        assert(instance);
     78        instance->hc_data.data = NULL;
     79        instance->hc_data.toggle_get = NULL;
     80        instance->hc_data.toggle_set = NULL;
    6381}
    6482/*----------------------------------------------------------------------------*/
     
    85103{
    86104        assert(instance);
     105        if (instance->hc_data.toggle_get)
     106                instance->toggle =
     107                    instance->hc_data.toggle_get(instance->hc_data.data);
    87108        return (int)instance->toggle;
    88109}
     
    92113        assert(instance);
    93114        assert(toggle == 0 || toggle == 1);
     115        if (instance->hc_data.toggle_set)
     116                instance->hc_data.toggle_set(instance->hc_data.data, toggle);
    94117        instance->toggle = toggle;
    95118}
     
    100123        if (instance->address == target.address &&
    101124            (instance->endpoint == target.endpoint || target.endpoint == 0))
    102                 instance->toggle = 0;
     125                endpoint_toggle_set(instance, 0);
    103126}
    104127/**
Note: See TracChangeset for help on using the changeset viewer.