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


Ignore:
Timestamp:
2011-10-28T21:52:15Z (14 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
57e06ef
Parents:
7265558
Message:

libusbhost: Make interfaces more symmetric.

Make usb_endpoint_manager interface easier to use and understand.
Move ep removal hook pointer from endpoint_t to hcd_t.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbhost/src/endpoint.c

    r7265558 r48ae3ef  
    5454                instance->toggle = 0;
    5555                instance->active = false;
    56                 instance->destroy_hook = NULL;
    5756                instance->hc_data.data = NULL;
    5857                instance->hc_data.toggle_get = NULL;
     
    7069        assert(instance);
    7170        assert(!instance->active);
    72         if (instance->hc_data.data) {
    73                 assert(instance->destroy_hook);
    74                 instance->destroy_hook(instance);
    75         }
     71        assert(instance->hc_data.data == NULL);
    7672        free(instance);
    7773}
    7874/*----------------------------------------------------------------------------*/
    7975void endpoint_set_hc_data(endpoint_t *instance,
    80     void *data, void (*destroy_hook)(endpoint_t *),
    81     int (*toggle_get)(void *), void (*toggle_set)(void *, int))
     76    void *data, int (*toggle_get)(void *), void (*toggle_set)(void *, int))
    8277{
    8378        assert(instance);
    84         instance->destroy_hook = destroy_hook;
    8579        instance->hc_data.data = data;
    8680        instance->hc_data.toggle_get = toggle_get;
     
    9185{
    9286        assert(instance);
    93         instance->destroy_hook = NULL;
    9487        instance->hc_data.data = NULL;
    9588        instance->hc_data.toggle_get = NULL;
Note: See TracChangeset for help on using the changeset viewer.